Nama Bilik | +Maklumat | +Tempoh | +Status | +Tindakan | +
---|---|---|---|---|
Nama Bilik | +Maklumat | +Tempoh | +Status | +Tindakan | +
From 01ae78f0df16aa706900ffceb17a4091381d9d9d Mon Sep 17 00:00:00 2001
From: rookiextreme <90501419+rookiextreme@users.noreply.github.com>
Date: Thu, 15 Sep 2022 15:28:43 +0800
Subject: [PATCH] main module done
---
.../Bilik/AdminTempahanBilikController.php | 100 +++
.../Segment/Dashboard/DashboardController.php | 14 +
.../Tempahan/TempahanBilikController.php | 2 +-
app/Models/Tempahan/TempahanBilik.php | 2 +-
.../admin/tempahan/bilik/controller.js | 56 ++
.../segment/admin/tempahan/bilik/main.js | 45 +
.../segment/admin/tempahan/bilik/settings.js | 35 +
.../pengguna/tempahan/bilik/settings.js | 19 +-
.../segment/admin/bilik/modal/index.blade.php | 4 +-
.../admin/tempahan/bilik/index.blade.php | 71 ++
.../tempahan/bilik/modal/index.blade.php | 68 ++
.../tetapan/bangunan/modal/index.blade.php | 4 +-
.../tetapan/fasiliti/modal/index.blade.php | 4 +-
.../tetapan/lokasi/modal/index.blade.php | 4 +-
.../views/segment/dashboard/index.blade.php | 843 +++---------------
.../calendar/css/index.blade.php | 2 +
.../calendar/js/index.blade.php | 2 +
.../views/segment/layouts/main.blade.php | 4 +-
.../views/segment/layouts/menu.blade.php | 26 +-
.../tempahan/bilik/modal/index.blade.php | 4 +-
routes/web.php | 12 +-
21 files changed, 569 insertions(+), 752 deletions(-)
create mode 100644 app/Http/Controllers/Segment/Admin/Tempahan/Bilik/AdminTempahanBilikController.php
create mode 100644 public/app_js_helper/segment/admin/tempahan/bilik/controller.js
create mode 100644 public/app_js_helper/segment/admin/tempahan/bilik/main.js
create mode 100644 public/app_js_helper/segment/admin/tempahan/bilik/settings.js
create mode 100644 resources/views/segment/admin/tempahan/bilik/index.blade.php
create mode 100644 resources/views/segment/admin/tempahan/bilik/modal/index.blade.php
create mode 100644 resources/views/segment/layouts/custom_view_links/calendar/css/index.blade.php
create mode 100644 resources/views/segment/layouts/custom_view_links/calendar/js/index.blade.php
diff --git a/app/Http/Controllers/Segment/Admin/Tempahan/Bilik/AdminTempahanBilikController.php b/app/Http/Controllers/Segment/Admin/Tempahan/Bilik/AdminTempahanBilikController.php
new file mode 100644
index 0000000..101c742
--- /dev/null
+++ b/app/Http/Controllers/Segment/Admin/Tempahan/Bilik/AdminTempahanBilikController.php
@@ -0,0 +1,100 @@
+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.'
'.$data->tempahanBilik->kapasiti.' orang
Aras '.$data->tempahanBilik->aras.'
Bangunan '.$data->tempahanBilik->bilikBangunan->bangunanLokasi->nama.'('.$data->tempahanBilik->bilikBangunan->nama.')' ;
+ })
+ ->addColumn('maklumat', function($data){
+ $getUrusetia = ListPegawai2::getMaklumatPegawai($data->nokp_urusetia);
+ return 'Tujuan: '.$data->nama.'
Urusetia: '.$getUrusetia['name'].'
Pengerusi: '.$data->pengerusi;
+ })
+ ->addColumn('tempoh', function($data){
+ return 'Dari: '.date('d-m-Y H:i', strtotime($data->masa_mula)).'
Hingga: '.date('d-m-Y H:i', strtotime($data->masa_tamat));
+ })
+ ->addColumn('status', function($data){
+ $label = '';
+ if($data->status == 0){
+ $label = 'Belum Lulus';
+ }else if($data->status == 1){
+ $label = 'Lulus';
+ }
+ else if($data->status == 2){
+ $label = 'Tidak Lulus';
+ }
+ 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
+ ]);
+ }
+}
diff --git a/app/Http/Controllers/Segment/Dashboard/DashboardController.php b/app/Http/Controllers/Segment/Dashboard/DashboardController.php
index 2ed4b72..2af77bb 100644
--- a/app/Http/Controllers/Segment/Dashboard/DashboardController.php
+++ b/app/Http/Controllers/Segment/Dashboard/DashboardController.php
@@ -2,6 +2,9 @@
namespace App\Http\Controllers\Segment\Dashboard;
use App\Http\Controllers\Controller;
+use App\Models\Tempahan\TempahanBilik;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
class DashboardController extends Controller{
public function __construct()
@@ -12,4 +15,15 @@ public function __construct()
public function index(){
return view('segment.dashboard.index');
}
+
+ public function getEvents(Request $request){
+ $model = DB::select(DB::raw("SELECT CONCAT(j.nama, ', ', bb.nama , ', Bangunan ', b.nama, ', ', l.nama) as title, DATE(j.masa_mula) as start, DATE(j.masa_tamat) as end from tempahan_biliks j
+ join bangunan_biliks bb on j.bangunan_biliks_id = bb.id
+ join bangunans b on b.id = bb.bangunans_id
+ join lokasis l on l.id = b.lokasis_id
+ where j.status = 1
+ "));
+
+ return response()->json($model);
+ }
}
diff --git a/app/Http/Controllers/Segment/Pengguna/Tempahan/TempahanBilikController.php b/app/Http/Controllers/Segment/Pengguna/Tempahan/TempahanBilikController.php
index ee07220..40af945 100644
--- a/app/Http/Controllers/Segment/Pengguna/Tempahan/TempahanBilikController.php
+++ b/app/Http/Controllers/Segment/Pengguna/Tempahan/TempahanBilikController.php
@@ -70,7 +70,7 @@ public function getTempahanBilik(Request $request){
}
public function deleteTempahanBilik(Request $request){
- CommonController::softDeleteRecord(BangunanBilik::class, $request->input('id'));
+ CommonController::softDeleteRecord(TempahanBilik::class, $request->input('id'));
return response()->json([
'success' => 1,
]);
diff --git a/app/Models/Tempahan/TempahanBilik.php b/app/Models/Tempahan/TempahanBilik.php
index c8e8c2f..cb95f6b 100644
--- a/app/Models/Tempahan/TempahanBilik.php
+++ b/app/Models/Tempahan/TempahanBilik.php
@@ -59,7 +59,7 @@ public static function storeUpdate(Request $request){
$model->nama = $v->tempahan_bilik_name;
$model->masa_mula = date('Y-m-d H:i', strtotime($v->tempahan_masa_mula));
$model->masa_tamat = date('Y-m-d H:i', strtotime($v->tempahan_masa_tamat));
- $model->nokp_urusetia = 010202022;
+ $model->nokp_urusetia = $v->tempahan_bilik_urusetia;
$model->tel_urusetia = $v->tempahan_bilik_notel_urusetia;
$model->pengerusi = $v->tempahan_bilik_pengerusi;
$model->bil_agensi_d = $v->tempahan_bilik_agensi;
diff --git a/public/app_js_helper/segment/admin/tempahan/bilik/controller.js b/public/app_js_helper/segment/admin/tempahan/bilik/controller.js
new file mode 100644
index 0000000..f8d1929
--- /dev/null
+++ b/public/app_js_helper/segment/admin/tempahan/bilik/controller.js
@@ -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');
+ }
+ });
+ }
+}
diff --git a/public/app_js_helper/segment/admin/tempahan/bilik/main.js b/public/app_js_helper/segment/admin/tempahan/bilik/main.js
new file mode 100644
index 0000000..4124da0
--- /dev/null
+++ b/public/app_js_helper/segment/admin/tempahan/bilik/main.js
@@ -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
+ });
+});
diff --git a/public/app_js_helper/segment/admin/tempahan/bilik/settings.js b/public/app_js_helper/segment/admin/tempahan/bilik/settings.js
new file mode 100644
index 0000000..13188fc
--- /dev/null
+++ b/public/app_js_helper/segment/admin/tempahan/bilik/settings.js
@@ -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 = '
Nama Bilik | +Maklumat | +Tempoh | +Status | +Tindakan | +
---|---|---|---|---|
Nama Bilik | +Maklumat | +Tempoh | +Status | +Tindakan | +
Updated 1 month ago
-Sales
-Customers
-Products
-Revenue
-- 68.2% more earnings than last month. -
-Company | -Category | -Views | -Revenue | -Sales | -
---|---|---|---|---|
-
-
-
-
-
-
-
-
-
- Dixons
- meguc@ruj.io
- |
-
-
-
-
-
- Technology
-
-
-
- |
-
-
- 23.4k
- in 24 hours
-
- |
- $891.2 | -
-
- 68%
-
-
- |
-
-
-
-
-
-
-
-
-
-
- Motels
- vecav@hodzi.co.uk
- |
-
-
-
-
-
- Grocery
-
-
-
- |
-
-
- 78k
- in 2 days
-
- |
- $668.51 | -
-
- 97%
-
-
- |
-
-
-
-
-
-
-
-
-
-
- Zipcar
- davcilse@is.gov
- |
-
-
-
-
-
- Fashion
-
-
-
- |
-
-
- 162
- in 5 days
-
- |
- $522.29 | -
-
- 62%
-
-
- |
-
-
-
-
-
-
-
-
-
-
- Owning
- us@cuhil.gov
- |
-
-
-
-
-
- Technology
-
-
-
- |
-
-
- 214
- in 24 hours
-
- |
- $291.01 | -
-
- 88%
-
-
- |
-
-
-
-
-
-
-
-
-
-
- Cafés
- pudais@jife.com
- |
-
-
-
-
-
- Grocery
-
-
-
- |
-
-
- 208
- in 1 week
-
- |
- $783.93 | -
-
- 16%
-
-
- |
-
-
-
-
-
-
-
-
-
-
- Kmart
- bipri@cawiw.com
- |
-
-
-
-
-
- Fashion
-
-
-
- |
-
-
- 990
- in 1 month
-
- |
- $780.05 | -
-
- 78%
-
-
- |
-
-
-
-
-
-
-
-
-
-
- Payers
- luk@izug.io
- |
-
-
-
-
-
- Fashion
-
-
-
- |
-
-
- 12.9k
- in 12 hours
-
- |
- $531.49 | -
-
- 42%
-
-
- |
-
Meet world popular developers
-Counter August 2020
-Completed
-In Progress
-