From f3ca2494d60b8f4a40130c88d1139b825265c3f7 Mon Sep 17 00:00:00 2001 From: rookiextreme <90501419+rookiextreme@users.noreply.github.com> Date: Mon, 19 Sep 2022 16:28:10 +0800 Subject: [PATCH] Bilik Fasiliti and stuff --- .../Segment/Admin/Bilik/BilikController.php | 35 ++- .../Bilik/AdminTempahanBilikController.php | 25 +- app/Models/Tetapan/BangunanBilik.php | 26 ++ app/Models/Tetapan/BilikFasiliti.php | 2 +- composer.lock | 259 +++++++++--------- public/app_js_helper/main/common.js | 24 ++ .../app_js_helper/segment/admin/bilik/main.js | 41 +++ .../segment/admin/bilik/settings.js | 47 ++++ .../segment/admin/tempahan/bilik/main.js | 10 + .../segment/admin/tempahan/bilik/settings.js | 2 +- .../segment/admin/bilik/modal/index.blade.php | 14 + .../tempahan/bilik/modal/index.blade.php | 23 +- .../tempahan/bilik/modal/index.blade.php | 2 +- routes/web.php | 1 + 14 files changed, 369 insertions(+), 142 deletions(-) diff --git a/app/Http/Controllers/Segment/Admin/Bilik/BilikController.php b/app/Http/Controllers/Segment/Admin/Bilik/BilikController.php index 28dfdb9..6979974 100644 --- a/app/Http/Controllers/Segment/Admin/Bilik/BilikController.php +++ b/app/Http/Controllers/Segment/Admin/Bilik/BilikController.php @@ -5,6 +5,8 @@ use App\Http\Controllers\Controller; use App\Models\Tetapan\Bangunan; use App\Models\Tetapan\BangunanBilik; +use App\Models\Tetapan\BilikFasiliti; +use App\Models\Tetapan\Fasiliti; use App\Models\Tetapan\Lokasi; use Illuminate\Http\Request; use Yajra\DataTables\DataTables; @@ -17,8 +19,10 @@ public function __construct() public function index(){ $lokasiList = Lokasi::where('flag', 1)->where('delete_id', 0)->get(); + $kemudahanList = Fasiliti::where('flag', 1)->where('delete_id', 0)->get(); return view('segment.admin.bilik.index', [ - 'lokasiList' => $lokasiList + 'lokasiList' => $lokasiList, + 'kemudahanList' => $kemudahanList ]); } @@ -50,13 +54,29 @@ public function getBilik(Request $request){ $id = $request->input('id'); $model = BangunanBilik::find($id); - $data = []; + $data = [ + 'fasiliti' => [] + ]; + $data['nama'] = $model->nama; $data['lokasi_id'] = $model->bilikBangunan->lokasis_id; $data['bangunan_id'] = $model->bangunans_id; $data['aras'] = $model->aras; $data['kapasiti'] = $model->kapasiti; + $fasiliti = $model->bilikFasiliti; + + if($fasiliti){ + foreach($fasiliti as $f){ + $data['fasiliti'][] = [ + 'id' => $f->id, + 'fasiliti_name' => $f->BFFasiliti->nama, + 'fasilitisId' => $f->fasilitis_id, + 'kuantiti' => $f->kuantiti + ]; + } + } + return response()->json([ 'success' => 1, 'data' => $data @@ -78,4 +98,15 @@ public function deleteBilik(Request $request){ 'success' => 1, ]); } + + public function deleteItemBilik(Request $request){ + $id = $request->input('id'); + $model = BilikFasiliti::find($id); + $model->delete_id = 1; + $model->save(); + + return response()->json([ + 'success' => 1, + ]); + } } diff --git a/app/Http/Controllers/Segment/Admin/Tempahan/Bilik/AdminTempahanBilikController.php b/app/Http/Controllers/Segment/Admin/Tempahan/Bilik/AdminTempahanBilikController.php index 101c742..222db79 100644 --- a/app/Http/Controllers/Segment/Admin/Tempahan/Bilik/AdminTempahanBilikController.php +++ b/app/Http/Controllers/Segment/Admin/Tempahan/Bilik/AdminTempahanBilikController.php @@ -5,6 +5,7 @@ use App\Http\Controllers\Controller; use App\Models\Mykj\ListPegawai2; use App\Models\Tempahan\TempahanBilik; +use App\Models\Tetapan\BangunanBilik; use App\Models\Tetapan\Fasiliti; use Illuminate\Http\Request; use Yajra\DataTables\DataTables; @@ -38,7 +39,7 @@ public function getTempahanBilikList(){ ->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){ + ->addColumn('status_tempahan', function($data){ $label = ''; if($data->status == 0){ $label = 'Belum Lulus'; @@ -52,10 +53,27 @@ public function getTempahanBilikList(){ }) ->addColumn('action', function($data){ }) - ->rawColumns(['action', 'nama', 'maklumat', 'tempoh', 'status']) + ->rawColumns(['action', 'nama', 'maklumat', 'tempoh', 'status_tempahan']) ->make(true); } + public function getFasilitiBilik(BangunanBilik $bilik){ + $data = []; + + $getFasiliti = $bilik->bilikFasiliti; + + if(count($getFasiliti) > 0){ + foreach($getFasiliti as $gF){ + $data[] = [ + 'nama' => $gF->BFFasiliti->nama, + 'kuantiti' => $gF->kuantiti + ]; + } + } + return $data; + + } + public function getTempahanBilik(Request $request){ $id = $request->input('id'); $model = TempahanBilik::find($id); @@ -65,7 +83,8 @@ public function getTempahanBilik(Request $request){ '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 + 'bilik' => $model->tempahanBilik->nama, + 'fasiliti' => self::getFasilitiBilik($model->tempahanBilik) ]; $getUrusetia = ListPegawai2::getMaklumatPegawai($model->nokp_urusetia); diff --git a/app/Models/Tetapan/BangunanBilik.php b/app/Models/Tetapan/BangunanBilik.php index d27dd65..27abf9b 100644 --- a/app/Models/Tetapan/BangunanBilik.php +++ b/app/Models/Tetapan/BangunanBilik.php @@ -16,6 +16,10 @@ public function bilikBangunan(){ return $this->hasOne(Bangunan::class, 'id', 'bangunans_id'); } + public function bilikFasiliti(){ + return $this->hasMany(BilikFasiliti::class, 'biliks_id', 'id')->where('flag', 1)->where('delete_id', 0); + } + public static function storeUpdate(Request $request){ try { $v = new ValidationController(); @@ -45,6 +49,11 @@ public static function storeUpdate(Request $request){ $model->kapasiti = $v->bilik_kapasiti; if($model->save()){ + $kemudahan_list = json_decode($request->input('kemudahan_list')); + if(!empty($kemudahan_list)){ + BangunanBilik::addFasiliti($kemudahan_list, $model->id); + } + return response()->json([ 'success' => 1 ]); @@ -63,4 +72,21 @@ public static function checkDuplicate($name, $id = false, $bangunan_id = false){ return !($model == null); } + + public static function addFasiliti($kemudahan, $bilik_id){ + foreach($kemudahan as $k){ + $model = BilikFasiliti::where('biliks_id', $bilik_id)->where('fasilitis_id', $k[0])->first(); + + if(!$model){ + $model = new BilikFasiliti; + $model->biliks_id = $bilik_id; + $model->flag = 1; + $model->delete_id = 0; + } + + $model->kuantiti = $k[1]; + $model->fasilitis_id = $k[0]; + $model->save(); + } + } } diff --git a/app/Models/Tetapan/BilikFasiliti.php b/app/Models/Tetapan/BilikFasiliti.php index ed441bf..3c48c13 100644 --- a/app/Models/Tetapan/BilikFasiliti.php +++ b/app/Models/Tetapan/BilikFasiliti.php @@ -14,6 +14,6 @@ public function BFBilik(){ } public function BFFasiliti(){ - return $this->hasOne(Fasiliti::class, 'fasilitis_id', 'id'); + return $this->hasOne(Fasiliti::class, 'id', 'fasilitis_id'); } } diff --git a/composer.lock b/composer.lock index 3b30bcf..f71d4a3 100644 --- a/composer.lock +++ b/composer.lock @@ -139,28 +139,28 @@ }, { "name": "doctrine/inflector", - "version": "2.0.4", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" + "reference": "ade2b3bbfb776f27f0558e26eed43b5d9fe1b392" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", - "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/ade2b3bbfb776f27f0558e26eed43b5d9fe1b392", + "reference": "ade2b3bbfb776f27f0558e26eed43b5d9fe1b392", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", - "vimeo/psalm": "^4.10" + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "^8.5 || ^9.5", + "vimeo/psalm": "^4.25" }, "type": "library", "autoload": { @@ -210,7 +210,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.4" + "source": "https://github.com/doctrine/inflector/tree/2.0.5" }, "funding": [ { @@ -226,7 +226,7 @@ "type": "tidelift" } ], - "time": "2021-10-22T20:16:43+00:00" + "time": "2022-09-07T09:01:28+00:00" }, { "name": "doctrine/lexer", @@ -306,16 +306,16 @@ }, { "name": "dragonmantank/cron-expression", - "version": "v3.3.1", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/dragonmantank/cron-expression.git", - "reference": "be85b3f05b46c39bbc0d95f6c071ddff669510fa" + "reference": "782ca5968ab8b954773518e9e49a6f892a34b2a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/be85b3f05b46c39bbc0d95f6c071ddff669510fa", - "reference": "be85b3f05b46c39bbc0d95f6c071ddff669510fa", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/782ca5968ab8b954773518e9e49a6f892a34b2a8", + "reference": "782ca5968ab8b954773518e9e49a6f892a34b2a8", "shasum": "" }, "require": { @@ -355,7 +355,7 @@ ], "support": { "issues": "https://github.com/dragonmantank/cron-expression/issues", - "source": "https://github.com/dragonmantank/cron-expression/tree/v3.3.1" + "source": "https://github.com/dragonmantank/cron-expression/tree/v3.3.2" }, "funding": [ { @@ -363,7 +363,7 @@ "type": "github" } ], - "time": "2022-01-18T15:43:28+00:00" + "time": "2022-09-10T18:51:20+00:00" }, { "name": "egulias/email-validator", @@ -949,16 +949,16 @@ }, { "name": "laravel/framework", - "version": "v9.27.0", + "version": "v9.30.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "27572f45120fd3977d92651a71d8c711a9aaa790" + "reference": "9533f7926f31939f25a620fbbf545318c18c943f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/27572f45120fd3977d92651a71d8c711a9aaa790", - "reference": "27572f45120fd3977d92651a71d8c711a9aaa790", + "url": "https://api.github.com/repos/laravel/framework/zipball/9533f7926f31939f25a620fbbf545318c18c943f", + "reference": "9533f7926f31939f25a620fbbf545318c18c943f", "shasum": "" }, "require": { @@ -1035,12 +1035,15 @@ "illuminate/view": "self.version" }, "require-dev": { + "ably/ably-php": "^1.0", "aws/aws-sdk-php": "^3.198.1", "doctrine/dbal": "^2.13.3|^3.1.4", "fakerphp/faker": "^1.9.2", "guzzlehttp/guzzle": "^7.2", "league/flysystem-aws-s3-v3": "^3.0", "league/flysystem-ftp": "^3.0", + "league/flysystem-path-prefixing": "^3.3", + "league/flysystem-read-only": "^3.3", "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.4.4", "orchestra/testbench-core": "^7.1", @@ -1048,7 +1051,8 @@ "phpstan/phpstan": "^1.4.7", "phpunit/phpunit": "^9.5.8", "predis/predis": "^1.1.9|^2.0", - "symfony/cache": "^6.0" + "symfony/cache": "^6.0", + "symfony/uid": "^6.0" }, "suggest": { "ably/ably-php": "Required to use the Ably broadcast driver (^1.0).", @@ -1068,6 +1072,8 @@ "laravel/tinker": "Required to use the tinker console command (^2.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^3.0).", "league/flysystem-ftp": "Required to use the Flysystem FTP driver (^3.0).", + "league/flysystem-path-prefixing": "Required to use the scoped driver (^3.3).", + "league/flysystem-read-only": "Required to use read-only disks (^3.3)", "league/flysystem-sftp-v3": "Required to use the Flysystem SFTP driver (^3.0).", "mockery/mockery": "Required to use mocking (^1.4.4).", "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", @@ -1081,7 +1087,8 @@ "symfony/http-client": "Required to enable support for the Symfony API mail transports (^6.0).", "symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).", "symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0).", - "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)." + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0).", + "symfony/uid": "Required to generate ULIDs for Eloquent (^6.0)." }, "type": "library", "extra": { @@ -1125,7 +1132,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-08-30T13:34:43+00:00" + "time": "2022-09-15T13:15:47+00:00" }, { "name": "laravel/sanctum", @@ -1194,16 +1201,16 @@ }, { "name": "laravel/serializable-closure", - "version": "v1.2.1", + "version": "v1.2.2", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "d78fd36ba031a1a695ea5a406f29996948d7011b" + "reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/d78fd36ba031a1a695ea5a406f29996948d7011b", - "reference": "d78fd36ba031a1a695ea5a406f29996948d7011b", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/47afb7fae28ed29057fdca37e16a84f90cc62fae", + "reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae", "shasum": "" }, "require": { @@ -1250,7 +1257,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2022-08-26T15:25:27+00:00" + "time": "2022-09-08T13:45:54+00:00" }, { "name": "laravel/tinker", @@ -1510,16 +1517,16 @@ }, { "name": "league/flysystem", - "version": "3.2.1", + "version": "3.3.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "81aea9e5217084c7850cd36e1587ee4aad721c6b" + "reference": "d8295793b3e2f91aa39e1feb2d5bfce772891ae2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/81aea9e5217084c7850cd36e1587ee4aad721c6b", - "reference": "81aea9e5217084c7850cd36e1587ee4aad721c6b", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d8295793b3e2f91aa39e1feb2d5bfce772891ae2", + "reference": "d8295793b3e2f91aa39e1feb2d5bfce772891ae2", "shasum": "" }, "require": { @@ -1530,6 +1537,7 @@ "aws/aws-sdk-php": "3.209.31 || 3.210.0", "guzzlehttp/guzzle": "<7.0", "guzzlehttp/ringphp": "<1.1.1", + "phpseclib/phpseclib": "3.0.15", "symfony/http-client": "<5.2" }, "require-dev": { @@ -1543,7 +1551,7 @@ "friendsofphp/php-cs-fixer": "^3.5", "google/cloud-storage": "^1.23", "microsoft/azure-storage-blob": "^1.1", - "phpseclib/phpseclib": "^2.0", + "phpseclib/phpseclib": "^3.0.14", "phpstan/phpstan": "^0.12.26", "phpunit/phpunit": "^9.5.11", "sabre/dav": "^4.3.1" @@ -1580,11 +1588,11 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.2.1" + "source": "https://github.com/thephpleague/flysystem/tree/3.3.0" }, "funding": [ { - "url": "https://offset.earth/frankdejonge", + "url": "https://ecologi.com/frankdejonge", "type": "custom" }, { @@ -1596,7 +1604,7 @@ "type": "tidelift" } ], - "time": "2022-08-14T20:48:34+00:00" + "time": "2022-09-09T11:11:42+00:00" }, { "name": "league/mime-type-detection", @@ -1758,16 +1766,16 @@ }, { "name": "nesbot/carbon", - "version": "2.62.0", + "version": "2.62.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "7507aec3d626797ce2123cf6c6556683be22b5f8" + "reference": "01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7507aec3d626797ce2123cf6c6556683be22b5f8", - "reference": "7507aec3d626797ce2123cf6c6556683be22b5f8", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a", + "reference": "01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a", "shasum": "" }, "require": { @@ -1856,7 +1864,7 @@ "type": "tidelift" } ], - "time": "2022-08-28T19:48:05+00:00" + "time": "2022-09-02T07:48:13+00:00" }, { "name": "nette/schema", @@ -1922,20 +1930,20 @@ }, { "name": "nette/utils", - "version": "v3.2.7", + "version": "v3.2.8", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99" + "reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/0af4e3de4df9f1543534beab255ccf459e7a2c99", - "reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99", + "url": "https://api.github.com/repos/nette/utils/zipball/02a54c4c872b99e4ec05c4aec54b5a06eb0f6368", + "reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368", "shasum": "" }, "require": { - "php": ">=7.2 <8.2" + "php": ">=7.2 <8.3" }, "conflict": { "nette/di": "<3.0.6" @@ -2001,22 +2009,22 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v3.2.7" + "source": "https://github.com/nette/utils/tree/v3.2.8" }, - "time": "2022-01-24T11:29:14+00:00" + "time": "2022-09-12T23:36:20+00:00" }, { "name": "nikic/php-parser", - "version": "v4.14.0", + "version": "v4.15.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", "shasum": "" }, "require": { @@ -2057,9 +2065,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" }, - "time": "2022-05-31T20:59:12+00:00" + "time": "2022-09-04T07:30:47+00:00" }, { "name": "nunomaduro/termwind", @@ -2787,20 +2795,20 @@ }, { "name": "ramsey/uuid", - "version": "4.4.0", + "version": "4.5.1", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "373f7bacfcf3de038778ff27dcce5672ddbf4c8a" + "reference": "a161a26d917604dc6d3aa25100fddf2556e9f35d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/373f7bacfcf3de038778ff27dcce5672ddbf4c8a", - "reference": "373f7bacfcf3de038778ff27dcce5672ddbf4c8a", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/a161a26d917604dc6d3aa25100fddf2556e9f35d", + "reference": "a161a26d917604dc6d3aa25100fddf2556e9f35d", "shasum": "" }, "require": { - "brick/math": "^0.8 || ^0.9 || ^0.10", + "brick/math": "^0.8.8 || ^0.9 || ^0.10", "ext-ctype": "*", "ext-json": "*", "php": "^8.0", @@ -2821,12 +2829,13 @@ "php-mock/php-mock-mockery": "^1.3", "php-parallel-lint/php-parallel-lint": "^1.1", "phpbench/phpbench": "^1.0", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-mockery": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-phpunit": "^1.1", "phpunit/phpunit": "^8.5 || ^9", - "slevomat/coding-standard": "^7.0", + "ramsey/composer-repl": "^1.4", + "slevomat/coding-standard": "^8.4", "squizlabs/php_codesniffer": "^3.5", "vimeo/psalm": "^4.9" }, @@ -2864,7 +2873,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.4.0" + "source": "https://github.com/ramsey/uuid/tree/4.5.1" }, "funding": [ { @@ -2876,7 +2885,7 @@ "type": "tidelift" } ], - "time": "2022-08-05T17:58:37+00:00" + "time": "2022-09-16T03:22:46+00:00" }, { "name": "santigarcor/laratrust", @@ -5059,16 +5068,16 @@ }, { "name": "tijsverkoyen/css-to-inline-styles", - "version": "2.2.4", + "version": "2.2.5", "source": { "type": "git", "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c" + "reference": "4348a3a06651827a27d989ad1d13efec6bb49b19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/da444caae6aca7a19c0c140f68c6182e337d5b1c", - "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/4348a3a06651827a27d989ad1d13efec6bb49b19", + "reference": "4348a3a06651827a27d989ad1d13efec6bb49b19", "shasum": "" }, "require": { @@ -5106,9 +5115,9 @@ "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", "support": { "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", - "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.4" + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.5" }, - "time": "2021-12-08T09:12:39+00:00" + "time": "2022-09-12T13:28:28+00:00" }, { "name": "vlucas/phpdotenv", @@ -5672,16 +5681,16 @@ }, { "name": "laravel/breeze", - "version": "v1.12.0", + "version": "v1.13.0", "source": { "type": "git", "url": "https://github.com/laravel/breeze.git", - "reference": "6d95e9aacbe992e19c81d5cd6f7eec994e50dd8d" + "reference": "3b601e881820c36dc0252cc5fa6c4131a8e5734d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/breeze/zipball/6d95e9aacbe992e19c81d5cd6f7eec994e50dd8d", - "reference": "6d95e9aacbe992e19c81d5cd6f7eec994e50dd8d", + "url": "https://api.github.com/repos/laravel/breeze/zipball/3b601e881820c36dc0252cc5fa6c4131a8e5734d", + "reference": "3b601e881820c36dc0252cc5fa6c4131a8e5734d", "shasum": "" }, "require": { @@ -5729,20 +5738,20 @@ "issues": "https://github.com/laravel/breeze/issues", "source": "https://github.com/laravel/breeze" }, - "time": "2022-08-15T22:57:15+00:00" + "time": "2022-09-05T14:26:39+00:00" }, { "name": "laravel/pint", - "version": "v1.1.2", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "ebfe95b446e4395eba1eefb8615214fb55163165" + "reference": "1d276e4c803397a26cc337df908f55c2a4e90d86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/ebfe95b446e4395eba1eefb8615214fb55163165", - "reference": "ebfe95b446e4395eba1eefb8615214fb55163165", + "url": "https://api.github.com/repos/laravel/pint/zipball/1d276e4c803397a26cc337df908f55c2a4e90d86", + "reference": "1d276e4c803397a26cc337df908f55c2a4e90d86", "shasum": "" }, "require": { @@ -5753,13 +5762,13 @@ "php": "^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.10.0", - "illuminate/view": "^9.26.0", + "friendsofphp/php-cs-fixer": "^3.11.0", + "illuminate/view": "^9.27", "laravel-zero/framework": "^9.1.3", "mockery/mockery": "^1.5.0", - "nunomaduro/larastan": "^2.1.12", + "nunomaduro/larastan": "^2.2", "nunomaduro/termwind": "^1.14.0", - "pestphp/pest": "^1.22.0" + "pestphp/pest": "^1.22.1" }, "bin": [ "builds/pint" @@ -5795,20 +5804,20 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2022-08-30T15:28:20+00:00" + "time": "2022-09-13T15:07:15+00:00" }, { "name": "laravel/sail", - "version": "v1.15.4", + "version": "v1.16.0", "source": { "type": "git", "url": "https://github.com/laravel/sail.git", - "reference": "853dea1fa866a52a93beccc4e5affdc49b98e7d5" + "reference": "73030c18b769f27e6f6aacf7848d024fa9a55560" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/sail/zipball/853dea1fa866a52a93beccc4e5affdc49b98e7d5", - "reference": "853dea1fa866a52a93beccc4e5affdc49b98e7d5", + "url": "https://api.github.com/repos/laravel/sail/zipball/73030c18b769f27e6f6aacf7848d024fa9a55560", + "reference": "73030c18b769f27e6f6aacf7848d024fa9a55560", "shasum": "" }, "require": { @@ -5855,20 +5864,20 @@ "issues": "https://github.com/laravel/sail/issues", "source": "https://github.com/laravel/sail" }, - "time": "2022-08-17T13:17:15+00:00" + "time": "2022-08-31T16:38:14+00:00" }, { "name": "mockery/mockery", - "version": "1.5.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac" + "reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", - "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", + "url": "https://api.github.com/repos/mockery/mockery/zipball/e92dcc83d5a51851baf5f5591d32cb2b16e3684e", + "reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e", "shasum": "" }, "require": { @@ -5925,9 +5934,9 @@ ], "support": { "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.5.0" + "source": "https://github.com/mockery/mockery/tree/1.5.1" }, - "time": "2022-01-20T13:18:17+00:00" + "time": "2022-09-07T15:32:08+00:00" }, { "name": "myclabs/deep-copy", @@ -6772,16 +6781,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { @@ -6834,7 +6843,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -6842,7 +6851,7 @@ "type": "github" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { "name": "sebastian/complexity", @@ -7032,16 +7041,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { @@ -7097,7 +7106,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -7105,7 +7114,7 @@ "type": "github" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", @@ -7460,16 +7469,16 @@ }, { "name": "sebastian/type", - "version": "3.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb44e1cc6e557418387ad815780360057e40753e" + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb44e1cc6e557418387ad815780360057e40753e", - "reference": "fb44e1cc6e557418387ad815780360057e40753e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", "shasum": "" }, "require": { @@ -7481,7 +7490,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -7504,7 +7513,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.1.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" }, "funding": [ { @@ -7512,7 +7521,7 @@ "type": "github" } ], - "time": "2022-08-29T06:55:37+00:00" + "time": "2022-09-12T14:47:03+00:00" }, { "name": "sebastian/version", @@ -7775,27 +7784,27 @@ }, { "name": "spatie/laravel-ignition", - "version": "1.4.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-ignition.git", - "reference": "71c627a0838f107562e89bc2b0201a81f26e9011" + "reference": "192962f4d84526f6868c512530c00633e3165749" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/71c627a0838f107562e89bc2b0201a81f26e9011", - "reference": "71c627a0838f107562e89bc2b0201a81f26e9011", + "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/192962f4d84526f6868c512530c00633e3165749", + "reference": "192962f4d84526f6868c512530c00633e3165749", "shasum": "" }, "require": { "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "illuminate/support": "^8.77|^9.0", + "illuminate/support": "^8.77|^9.27", "monolog/monolog": "^2.3", "php": "^8.0", "spatie/flare-client-php": "^1.0.1", - "spatie/ignition": "^1.2.4", + "spatie/ignition": "^1.4.1", "symfony/console": "^5.0|^6.0", "symfony/var-dumper": "^5.0|^6.0" }, @@ -7861,7 +7870,7 @@ "type": "github" } ], - "time": "2022-08-26T13:28:24+00:00" + "time": "2022-09-16T13:45:54+00:00" }, { "name": "theseer/tokenizer", diff --git a/public/app_js_helper/main/common.js b/public/app_js_helper/main/common.js index 7cc5efa..14e785c 100644 --- a/public/app_js_helper/main/common.js +++ b/public/app_js_helper/main/common.js @@ -13,4 +13,28 @@ class Common{ return data; } + + static postEmptyFields(fieldArray){ + for(var x = 0;x 0){ + fasiliti.forEach(function(v){ + $('#bilik-kemudahan-list').append(getKemudahanAppend(v.fasiliti_name, v.fasilitisId, v.kuantiti, v.id)); + }); + } } }); } @@ -57,6 +75,8 @@ $(document).on('click', '#bilik-add, #bilik-edit', function(){ let validate = new Validation(); let curThis = $(this); let trigger = ''; + let kemudahan_list = []; + let pass = 0; let v = validate.checkEmpty( validate.getValue('#bilik-name', 'mix', 'Nama', 'bilik_name'), @@ -66,6 +86,27 @@ $(document).on('click', '#bilik-add, #bilik-edit', function(){ validate.getValue('#bilik-kapasiti', 'int', 'Kapasiti', 'bilik_kapasiti') ); + + if($('.bilik-kemudahan-item').length > 0){ + $('.bilik-kemudahan-item').each(function (v){ + let reg = /^\d+$/; + if(!reg.test($(this).val())){ + pass = 1; + Validation.addInvalidUI($(this), 'Mesti Di Dalam Bentuk Int', false); + }else{ + let parentId = $(this).closest('.bilik-kemudahan-main').attr('data-item-parent'); + kemudahan_list.push([parentId, $(this).val()]); + Validation.removeInvalidUI($(this)); + } + }); + } + + v.append('kemudahan_list', JSON.stringify(kemudahan_list)); + console.log(kemudahan_list); + if(pass == 1){ + return false; + } + if(curThis.is('#bilik-add')){ v.append('trigger', 0); trigger = 0; diff --git a/public/app_js_helper/segment/admin/bilik/settings.js b/public/app_js_helper/segment/admin/bilik/settings.js index c4b6b89..183ae78 100644 --- a/public/app_js_helper/segment/admin/bilik/settings.js +++ b/public/app_js_helper/segment/admin/bilik/settings.js @@ -76,3 +76,50 @@ $(document).on('change', '#bilik-lokasi', function(){ } }); }); + +$(document).on('change', '#bilik-kemudahan', function(){ + let curThis = $(this); + let val = curThis.val(); + let label = curThis.text(); + if(val != '' && typeof val != undefined){ + let append = getKemudahanAppend(label, val); + + $('#bilik-kemudahan-list').append(append); + } +}); + +$(document).on('click', '.padam-item', function(){ + let parent_id = $(this).closest('.parent-item').attr('data-id'); + + if(parent_id != '' && typeof parent_id != 'undefined'){ + let data = Common.emptyRequest(); + + data.append('id', parent_id); + Ajax.runAjax({ + url: 'admin/bilik/delete-item', + data: data, + func: function(){} + }); + } + + $(this).closest('.parent-item').remove(); +}); + +function getKemudahanAppend(label, fasiliti_id, kuantiti= '', mainId = ''){ + return '
' + + '
' + + '' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + + '
'; +} diff --git a/public/app_js_helper/segment/admin/tempahan/bilik/main.js b/public/app_js_helper/segment/admin/tempahan/bilik/main.js index 4124da0..bceb1fc 100644 --- a/public/app_js_helper/segment/admin/tempahan/bilik/main.js +++ b/public/app_js_helper/segment/admin/tempahan/bilik/main.js @@ -23,6 +23,16 @@ $(document).on('click', '.tempahan-edit', function(){ $('#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); + + let fasiliti = data.data.tempahan.fasiliti; + let curString = ''; + if(fasiliti.length > 0){ + fasiliti.forEach(function(v){ + curString += v.nama + ' - Kuantiti: ' + v.kuantiti + '
'; + }); + } + + $('#tempah-bilik-fasiliti').html(curString); } }); } diff --git a/public/app_js_helper/segment/admin/tempahan/bilik/settings.js b/public/app_js_helper/segment/admin/tempahan/bilik/settings.js index 13188fc..2c3ca99 100644 --- a/public/app_js_helper/segment/admin/tempahan/bilik/settings.js +++ b/public/app_js_helper/segment/admin/tempahan/bilik/settings.js @@ -4,7 +4,7 @@ DatatableUI.init({ { data: 'nama' }, { data: 'maklumat' }, { data: 'tempoh' }, - { data: 'status' }, + { data: 'status_tempahan' }, { data: 'action' }, ], url: '/admin/tempahan/bilik/get-list', diff --git a/resources/views/segment/admin/bilik/modal/index.blade.php b/resources/views/segment/admin/bilik/modal/index.blade.php index f49b13f..33fdf3c 100644 --- a/resources/views/segment/admin/bilik/modal/index.blade.php +++ b/resources/views/segment/admin/bilik/modal/index.blade.php @@ -49,6 +49,20 @@
+
+
+ + +
+
+
+
+
- +
diff --git a/routes/web.php b/routes/web.php index ff9250e..10cda2a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -63,6 +63,7 @@ Route::post('/get-bilik', [BilikController::class, 'getBilik']); Route::post('/activate', [BilikController::class, 'activateBilik']); Route::post('/delete', [BilikController::class, 'deleteBilik']); + Route::post('/delete-item', [BilikController::class, 'deleteItemBilik']); }); Route::prefix('/tempahan')->group(function () {