-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
569 additions
and
752 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
app/Http/Controllers/Segment/Admin/Tempahan/Bilik/AdminTempahanBilikController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
namespace App\Http\Controllers\Segment\Admin\Tempahan\Bilik; | ||
|
||
use App\Http\Controllers\Common\CommonController; | ||
use App\Http\Controllers\Controller; | ||
use App\Models\Mykj\ListPegawai2; | ||
use App\Models\Tempahan\TempahanBilik; | ||
use App\Models\Tetapan\Fasiliti; | ||
use Illuminate\Http\Request; | ||
use Yajra\DataTables\DataTables; | ||
|
||
class AdminTempahanBilikController extends Controller{ | ||
public function __construct() | ||
{ | ||
$this->middleware('auth'); | ||
} | ||
|
||
public function index(){ | ||
return view('segment.admin.tempahan.bilik.index'); | ||
} | ||
|
||
public function getTempahanBilikList(){ | ||
$model = TempahanBilik::where('delete_id', 0); | ||
|
||
return DataTables::of($model) | ||
->setRowAttr([ | ||
'data-tempahan-id' => function($data) { | ||
return $data->id; | ||
}, | ||
]) | ||
->addColumn('nama', function($data){ | ||
return $data->tempahanBilik->nama.'<br> '.$data->tempahanBilik->kapasiti.' orang<br> Aras '.$data->tempahanBilik->aras.'<br> Bangunan '.$data->tempahanBilik->bilikBangunan->bangunanLokasi->nama.'('.$data->tempahanBilik->bilikBangunan->nama.')' ; | ||
}) | ||
->addColumn('maklumat', function($data){ | ||
$getUrusetia = ListPegawai2::getMaklumatPegawai($data->nokp_urusetia); | ||
return 'Tujuan: '.$data->nama.'<br> Urusetia: '.$getUrusetia['name'].'<br> Pengerusi: '.$data->pengerusi; | ||
}) | ||
->addColumn('tempoh', function($data){ | ||
return 'Dari: '.date('d-m-Y H:i', strtotime($data->masa_mula)).' <br> Hingga: '.date('d-m-Y H:i', strtotime($data->masa_tamat)); | ||
}) | ||
->addColumn('status', function($data){ | ||
$label = ''; | ||
if($data->status == 0){ | ||
$label = '<span style="color:blue">Belum Lulus</span>'; | ||
}else if($data->status == 1){ | ||
$label = '<span style="color:green">Lulus</span>'; | ||
} | ||
else if($data->status == 2){ | ||
$label = '<span style="color:red">Tidak Lulus</span>'; | ||
} | ||
return $label; | ||
}) | ||
->addColumn('action', function($data){ | ||
}) | ||
->rawColumns(['action', 'nama', 'maklumat', 'tempoh', 'status']) | ||
->make(true); | ||
} | ||
|
||
public function getTempahanBilik(Request $request){ | ||
$id = $request->input('id'); | ||
$model = TempahanBilik::find($id); | ||
|
||
$data = []; | ||
$data['tempahan'] = [ | ||
'tempahan' => date('d-m-Y H:i', strtotime($model->created_at)), | ||
'masa_mula' => date('d-m-Y H:i', strtotime($model->masa_mula)), | ||
'masa_tamat' => date('d-m-Y H:i', strtotime($model->masa_tamat)), | ||
'bilik' => $model->tempahanBilik->nama | ||
]; | ||
|
||
$getUrusetia = ListPegawai2::getMaklumatPegawai($model->nokp_urusetia); | ||
$data['maklumat'] = [ | ||
'nama' => $model->nama, | ||
'urusetia' => $getUrusetia['name'], | ||
'pengerusi' => $model->pengerusi, | ||
'bil_agensi_d' => $model->bil_agensi_d, | ||
'bil_agensi_l' => $model->bil_agensi_l, | ||
'nota' => $model->nota | ||
]; | ||
|
||
return response()->json([ | ||
'success' => 1, | ||
'data' => $data | ||
]); | ||
} | ||
|
||
public function lulusTempahanBilik(Request $request){ | ||
$status = $request->input('status'); | ||
$id = $request->input('id'); | ||
|
||
$model = CommonController::getModel(TempahanBilik::class, 1, $id); | ||
$model->status = $status; | ||
$model->save(); | ||
|
||
return response()->json([ | ||
'success' => 1, | ||
'data' => $status | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
public/app_js_helper/segment/admin/tempahan/bilik/controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
class FasilitiController extends Ajax{ | ||
static storeUpdateFasiliti({url, data, trigger}){ | ||
this.runAjax({ | ||
url : url, | ||
data: data, | ||
func: function(success){ | ||
ToastAlert.toasting('Success', trigger == 0 ? 'Fasiliti Ditambah' : 'Fasiliti Dikemaskini', 'success'); | ||
DatatableUI.reloadTable('.fasiliti-table'); | ||
$('#fasiliti-modal').modal('hide'); | ||
} | ||
}); | ||
} | ||
|
||
static deleteFasiliti({url, data}){ | ||
SwalUI.init({ | ||
title: 'Adakah Anda Pasti?', | ||
subtitle: 'Fasiliti Akan Dipadam!', | ||
icon: 'error', | ||
confirmText: 'Delete', | ||
confirmButtonClass: 'btn btn-danger', | ||
callback: function (){ | ||
Ajax.runAjax({ | ||
url: url, | ||
data: data, | ||
func: function () { | ||
SwalUI.fireSwal({ | ||
icon: 'error', | ||
title: 'Fasiliti Dipadam!', | ||
subtitle: 'Tindakan Tidak Boleh Dipadam!' | ||
}); | ||
DatatableUI.reloadTable('.fasiliti-table'); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
static lulusTempahan({url, data}){ | ||
this.runAjax({ | ||
url : url, | ||
data: data, | ||
func: function(data){ | ||
let status = data.data.status; | ||
|
||
if(status == 1){ | ||
ToastAlert.toasting('Lulus', 'Tempahan Diluluskan', 'success'); | ||
}else if(status == 2){ | ||
ToastAlert.toasting('Tidak Lulus', 'Tempahan Dibatalkan', 'error'); | ||
} | ||
|
||
DatatableUI.reloadTable('.tempahan-table'); | ||
$('#tempahan-modal').modal('hide'); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
$(document).on('click', '.tempahan-edit', function(){ | ||
let id = $(this).closest('tr').attr('data-tempahan-id'); | ||
$('#tempahan-id').val(id); | ||
ModalUI.modal({ | ||
selector: '#tempahan-modal', | ||
mode: 'show', | ||
color: 'modal-warning', | ||
label: 'Tempahan Bilik', | ||
callback: function(){ | ||
let v = Common.emptyRequest(); | ||
v.append('id', id); | ||
Ajax.runAjax({ | ||
url: 'admin/tempahan/bilik/get-tempahan', | ||
data: v, | ||
func: function(data){ | ||
$('#tempah-pada').html(data.data.tempahan.tempahan); | ||
$('#tempah-masa-mula').html(data.data.tempahan.masa_mula); | ||
$('#tempah-masa-tamat').html(data.data.tempahan.masa_tamat); | ||
$('#tempah-nama-bilik').html(data.data.tempahan.bilik); | ||
|
||
$('#tempah-tujuan').html(data.data.maklumat.nama); | ||
$('#tempah-urusetia').html(data.data.maklumat.urusetia); | ||
$('#tempah-pengerusi').html(data.data.maklumat.pengerusi); | ||
$('#tempah-agensi-d').html(data.data.maklumat.bil_agensi_d); | ||
$('#tempah-agensi-l').html(data.data.maklumat.bil_agensi_l); | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
|
||
$(document).on('click', '#tempahan-edit', function(){ | ||
let curThis = $(this); | ||
let trigger = ''; | ||
|
||
let data = Common.emptyRequest(); | ||
data.append('status', curThis.attr('data-status')); | ||
data.append('id', $('#tempahan-id').val()); | ||
|
||
FasilitiController.lulusTempahan({ | ||
url: 'admin/tempahan/bilik/lulus', | ||
data: data, | ||
trigger: trigger | ||
}); | ||
}); |
35 changes: 35 additions & 0 deletions
35
public/app_js_helper/segment/admin/tempahan/bilik/settings.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
DatatableUI.init({ | ||
selector: '.tempahan-table', | ||
columnList: [ | ||
{ data: 'nama' }, | ||
{ data: 'maklumat' }, | ||
{ data: 'tempoh' }, | ||
{ data: 'status' }, | ||
{ data: 'action' }, | ||
], | ||
url: '/admin/tempahan/bilik/get-list', | ||
columnDef: [ | ||
{ | ||
// Actions | ||
targets: -1, | ||
title: 'Actions', | ||
orderable: false, | ||
render: function (data, type, full, meta) { | ||
let activate = full.status; | ||
|
||
let val = ''; | ||
if(activate !== 0){ | ||
val = '-'; | ||
}else{ | ||
val = '<div class="btn-group" role="group" aria-label="Basic example">' + | ||
'<button type="button" class="btn btn-outline-primary tempahan-edit" data-bs-toggle="tooltip" data-bs-placement="top" title="Kelulusan">' + feather.icons['edit-3'].toSvg() +'</button>' + | ||
'</div>'; | ||
} | ||
|
||
|
||
return val; | ||
} | ||
} | ||
], | ||
label: 'List Lokasi' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
resources/views/segment/admin/tempahan/bilik/index.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@extends('segment.layouts.main') | ||
|
||
@section('CSS') | ||
@include('segment.layouts.custom_view_links.toast.css.index') | ||
@include('segment.layouts.custom_view_links.datatable.css.index') | ||
@include('segment.layouts.custom_view_links.swal.css.index') | ||
@endsection | ||
|
||
@section('customCSS') | ||
@endsection | ||
|
||
@section('content') | ||
<div class="content-header row"> | ||
<div class="content-header-left col-md-9 col-12 mb-2"> | ||
<div class="row breadcrumbs-top"> | ||
<div class="col-12"> | ||
<h2 class="content-header-title float-start mb-0">Tetapan Biasa</h2> | ||
<div class="breadcrumb-wrapper"> | ||
<ol class="breadcrumb"> | ||
<li class="breadcrumb-item"><a href="index.html">Fasiliti</a> | ||
</li> | ||
</ol> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="content-body"> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<div class="card"> | ||
<table class="tempahan-table table"> | ||
<thead> | ||
<tr> | ||
<th>Nama Bilik</th> | ||
<th>Maklumat</th> | ||
<th>Tempoh</th> | ||
<th>Status</th> | ||
<th>Tindakan</th> | ||
</tr> | ||
</thead> | ||
<tfoot> | ||
<tr> | ||
<th>Nama Bilik</th> | ||
<th>Maklumat</th> | ||
<th>Tempoh</th> | ||
<th>Status</th> | ||
<th>Tindakan</th> | ||
</tr> | ||
</tfoot> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
@include('segment.admin.tempahan.bilik.modal.index') | ||
@endsection | ||
|
||
@section('JS') | ||
@include('segment.layouts.custom_view_links.toast.js.index') | ||
@include('segment.layouts.custom_view_links.datatable.js.index') | ||
@include('segment.layouts.custom_view_links.modals.js.index') | ||
@include('segment.layouts.custom_view_links.swal.js.index') | ||
@endsection | ||
|
||
@section('customJS') | ||
@include('segment.layouts.custom_view_links.customjavascript.index') | ||
<script src="{{ asset('app_js_helper/segment/admin/tempahan/bilik/settings.js') }}"></script> | ||
<script src="{{ asset('app_js_helper/segment/admin/tempahan/bilik/controller.js') }}"></script> | ||
<script src="{{ asset('app_js_helper/segment/admin/tempahan/bilik/main.js') }}"></script> | ||
@endsection |
Oops, something went wrong.