diff --git a/app/Http/Controllers/MarhunController.php b/app/Http/Controllers/MarhunController.php index e3a76d05..1feb42e1 100644 --- a/app/Http/Controllers/MarhunController.php +++ b/app/Http/Controllers/MarhunController.php @@ -130,6 +130,14 @@ class MarhunController extends Controller ->where('status_ubah', 6) ->first(); + $statusSemakMarhun = ScanMarhun::where('lelongbid_id', $bid['id']) + ->whereNotNull('masa_terima') + ->whereNull('masa_serah') + ->first(); + if ($statusSemakMarhun) { + $lelongbid[$index1]['statusterimamarhun'] = 1; + } + $lelongbid[$index1]['statustangguhlel'] = $statusdrpdpc; if($sudahdisahkan) @@ -1164,12 +1172,52 @@ class MarhunController extends Controller } - public function terimaserahmarhun() { + public function terimaserahmarhun() + { $user = Auth::user(); $caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first(); - return view('marhun.terimaserahmarhun'); + $senaraiScanKeluar = ScanMarhun::where('kodcaw', '=', $caw->caw_code) + ->whereNull('masa_terima') + ->orderBy('id', 'desc') + ->get(); + $sedangDinilai = ScanMarhun::whereNull('masa_serah') + ->orderBy('id', 'desc') + ->get(); + + $sudahSerah = ScanMarhun::whereNotNull('masa_serah') + ->orderBy('id', 'desc') + ->get(); + + return view('marhun.terimaserahmarhun', compact('senaraiScanKeluar', 'sedangDinilai', 'sudahSerah')); + } + + public function terimaMarhun(Request $request) + { + $user = Auth::user(); + $current = Carbon::now(); + + foreach ($request->scanKeluar_id as $index) { + $terimaMarhun = ScanMarhun::where('id', '=', $index)->first(); + $terimaMarhun->penilai_id = $user->id; + $terimaMarhun->masa_terima = $current->toTimeString(); + $terimaMarhun->update(); + } + return redirect()->route('marhun.terimaserahmarhun')->with('success', 'Terima Marhun Berjaya Direkodkan'); + } + + public function serahMarhun(Request $request) + { + $user = Auth::user(); + $current = Carbon::now(); + + foreach ($request->sedangDinilai_id as $index) { + $serahMarhun = ScanMarhun::where('id', '=', $index)->first(); + $serahMarhun->masa_serah = $current->toTimeString(); + $serahMarhun->update(); + } + return redirect()->route('marhun.terimaserahmarhun')->with('success', 'Serah Marhun Berjaya Direkodkan'); } public function listScanBarcode($lelong_id) @@ -1184,57 +1232,69 @@ class MarhunController extends Controller $senaraiScanKeluar = ScanMarhun::where('lelong_id', '=', $lelong_id) ->where('kodcaw', '=', $caw->caw_code) + ->whereNull('masa_scanmasuk') ->orderBy('id', 'desc') ->get(); - return view('marhun.scanbarcode', compact('lelong_id', 'lelongDetail', 'lelongbid', 'senaraiScanKeluar')); + $senaraiScanMasuk = ScanMarhun::where('lelong_id', '=', $lelong_id) + ->where('kodcaw', '=', $caw->caw_code) + ->whereNotNull('masa_scanmasuk') + ->orderBy('id', 'desc') + ->get(); + + return view('marhun.scanbarcode', compact('lelong_id', 'lelongDetail', 'lelongbid', 'senaraiScanKeluar', 'senaraiScanMasuk')); } public function scanKeluarMarhun(Request $request) { $user = Auth::user(); - $caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first(); $current = Carbon::now(); - $lelongbidItem = LelongBid::where('norujukan', '=', $request->norujukan_barcode)->first(); - - $scanKeluar = new ScanMarhun; - $scanKeluar->kodcaw = $lelongbidItem['kodcaw']; - $scanKeluar->lelong_id = $lelongbidItem['lelong_id']; - $scanKeluar->lelongbid_id = $lelongbidItem['id']; - $scanKeluar->norujukan = $lelongbidItem['norujukan']; - $scanKeluar->user_id = $user['id']; - $scanKeluar->tarikh_scankeluar = $current->toDateString(); - $scanKeluar->masa_scankeluar = $current->toTimeString(); - $scanKeluar->tag_scankeluar = 1; - // $scanKeluar->masa_scanmasuk = $current->toTimeString(); //dummy data - // $scanKeluar->tarikh_scanmasuk = $current->toDateString(); //dummy data - // $scanKeluar->masa = $current->toTimeString(); //dummy data - $scanKeluar->save(); - - $lelong_id = $lelongbidItem['lelong_id']; - $lelongDetail = Lelong::where('id', '=', $lelong_id)->first(); - $lelongbid = LelongBid::where('lelong_id', '=', $lelong_id) - ->where('caw_id', '=', $caw->id) + $checkExisting = ScanMarhun::where('norujukan', '=', $request->norujukan_barcode) + ->whereNull('masa_scanmasuk') ->get(); - $senaraiScanKeluar = ScanMarhun::where('lelong_id', '=', $lelong_id) - ->where('kodcaw', '=', $caw->caw_code) - ->orderBy('id', 'desc') - ->get(); + if ($checkExisting->isEmpty()) { + $lelongbidItem = LelongBid::where('norujukan', '=', $request->norujukan_barcode)->first(); - return view('marhun.scanbarcode', compact('lelong_id', 'lelongDetail', 'lelongbid', 'senaraiScanKeluar')); + $scanKeluar = new ScanMarhun; + $scanKeluar->kodcaw = $lelongbidItem['kodcaw']; + $scanKeluar->lelong_id = $lelongbidItem['lelong_id']; + $scanKeluar->lelongbid_id = $lelongbidItem['id']; + $scanKeluar->norujukan = $lelongbidItem['norujukan']; + $scanKeluar->khazanah_id = $user['id']; + $scanKeluar->tarikh_scankeluar = $current->toDateString(); + $scanKeluar->masa_scankeluar = $current->toTimeString(); + $scanKeluar->save(); + + return redirect()->route('marhun.scanbarcode', $request->lelong_id) + ->with('success', 'Marhun Berjaya Di Scan Keluar Dari Peti Besi.'); + } else { + return redirect()->route('marhun.scanbarcode', $request->lelong_id) + ->with('failed', 'Marhun Sudah Berada Di Luar Peti Besi.'); + } } public function scanMasukMarhun(Request $request) { $user = Auth::user(); - $caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first(); $current = Carbon::now(); - $lelongbidItem = LelongBid::where('norujukan', '=', $request->norujukan_barcode)->first(); - $scanMasuk = ScanMarhun::where(''); + $scanMasuk = ScanMarhun::where('norujukan', '=', $request->norujukan_barcode) + ->whereNull('masa_scanmasuk') + ->first(); + + if ($scanMasuk) { + $scanMasuk->tarikh_scanmasuk = $current->toDateString(); + $scanMasuk->masa_scanmasuk = $current->toTimeString(); + $scanMasuk->update(); + return redirect()->route('marhun.scanbarcode', $request->lelong_id) + ->with('success', 'Marhun Berjaya Di Scan Masuk Ke Peti Besi.'); + } else { + return redirect()->route('marhun.scanbarcode', $request->lelong_id) + ->with('failed', 'Marhun Gagal Di Scan Masuk Ke Peti Besi.'); + } } public function senaraiScanKeluar(Request $request) diff --git a/database/migrations/2022_03_07_061858_create_pengesahan_table.php b/database/migrations/2022_03_07_061858_create_pengesahan_table.php index 314d5191..ba6f1d89 100644 --- a/database/migrations/2022_03_07_061858_create_pengesahan_table.php +++ b/database/migrations/2022_03_07_061858_create_pengesahan_table.php @@ -48,26 +48,17 @@ class CreatePengesahanTable extends Migration $table->unsignedBigInteger('lelong_id')->unsigned(); $table->integer('lelongbid_id'); $table->string('norujukan'); - $table->string('user_id', '100'); + $table->string('khazanah_id', '100'); $table->date('tarikh_scankeluar'); $table->time('masa_scankeluar'); - $table->integer('tag_scankeluar'); + $table->string('penilai_id', '100')->nullable(); + $table->time('masa_terima')->nullable(); + $table->time('masa_serah')->nullable(); $table->date('tarikh_scanmasuk')->nullable(); $table->time('masa_scanmasuk')->nullable(); - $table->integer('tag_scanmasuk')->nullable(); $table->timestamps(); }); - Schema::create('terimaserah_marhun', function (Blueprint $table) { - $table->id(); - $table->integer('scanmarhun_id'); - $table->string('user_id', '100'); - $table->integer('tagterima'); - $table->time('masa_terima'); - $table->integer('tagserah')->nullable(); - $table->time('masa_serah')->nullable(); - $table->timestamps(); - }); } /** diff --git a/resources/views/marhun/scanbarcode.blade.php b/resources/views/marhun/scanbarcode.blade.php index 563342c0..cea84c74 100644 --- a/resources/views/marhun/scanbarcode.blade.php +++ b/resources/views/marhun/scanbarcode.blade.php @@ -7,11 +7,16 @@
Scan Barcode
- @if (!empty($success)) + @if ($message = Session::get('success'))
-

{{ $success }}

+

{{ $message }}

+
+ @elseif ($message = Session::get('failed')) +
+

{{ $message }}

@endif + Kembali

Tarikh Lelong: @php $myDateTime = DateTime::createFromFormat('Y-m-d', $lelongDetail['tarikh_lelong'] ); @@ -22,17 +27,17 @@

-
+
@@ -42,7 +47,6 @@ - @@ -51,17 +55,15 @@ - + - @endforeach
Marhun N. Marhun BeratStatus
{{$loop->iteration}} {{$index->norujukan}} {{$index->marhun}}{{$index->nilaimarhun}}{{ number_format($index->nilaimarhun, 2, '.', ',')}} {{$index->berat}}
-
-

keluar

+
@@ -69,19 +71,18 @@
Scan Barcode Marhun Yang Dibawa Keluar Dari Peti Besi
-
- +
- - + + @@ -89,7 +90,7 @@ - + @@ -98,32 +99,42 @@
Bil No Rujukan StatusTarikhMasaTarikh Scan KeluarMasa Scan Keluar
{{$loop->iteration}} {{$index->norujukan}}{{$index->tag_scankeluar}}Berada Di Luar Peti Besi {{$index->tarikh_scankeluar}} {{$index->masa_scankeluar}}
- -
-

masuk

+
-
+ @csrf - + - +
- +
- - - + + + + + - + @foreach ($senaraiScanMasuk as $index) + + + + + + + + + + @endforeach
Bil No RujukanPembiayaanN. MarhunTellerStatusTarikh Scan KeluarMasa Scan KeluarTarikh Scan MasukMasa Scan Masuk
{{$loop->iteration}}{{$index->norujukan}}Berada Di Dalam Peti Besi{{$index->tarikh_scankeluar}}{{$index->masa_scankeluar}}{{$index->tarikh_scanmasuk}}{{$index->masa_scanmasuk}}
@@ -136,9 +147,9 @@
@endsection \ No newline at end of file diff --git a/resources/views/marhun/senaraimarhun.blade.php b/resources/views/marhun/senaraimarhun.blade.php index e34d81d7..2863386e 100644 --- a/resources/views/marhun/senaraimarhun.blade.php +++ b/resources/views/marhun/senaraimarhun.blade.php @@ -70,8 +70,10 @@ @endif + @if($bid['statusterimamarhun'] == 1) + @endif @endforeach diff --git a/resources/views/marhun/terimaserahmarhun.blade.php b/resources/views/marhun/terimaserahmarhun.blade.php index 5d489645..a54fef90 100644 --- a/resources/views/marhun/terimaserahmarhun.blade.php +++ b/resources/views/marhun/terimaserahmarhun.blade.php @@ -8,99 +8,113 @@
Terima/Serah Marhun
+ @if ($message = Session::get('success')) +
+

{{ $message }}

+
+ @elseif ($message = Session::get('failed')) +
+

{{ $message }}

+
+ @endif
-
-
- +
+
+ @csrf +
- - - + + + @foreach($senaraiScanKeluar as $index) + - + + + + + + @endforeach
Bil No RujukanMarhunN. MarhunBeratTarikh Scan KeluarMasa Scan Keluar Status
{{$loop->iteration}}{{$index->norujukan}}{{$index->tarikh_scankeluar}}{{$index->masa_scankeluar}}Belum Terima
-
-
-
-

keluar

-
-
- - @csrf -
Scan Barcode Marhun Yang Dibawa Keluar Dari Peti Besi
- - - +
+
-
-
- + + + +
+
+ @csrf + +
+ - - + @foreach($sedangDinilai as $index) + - + + + + + @endforeach
Bil No RujukanMasa Terima StatusTarikhMasa
{{$loop->iteration}}{{$index->norujukan}}{{$index->masa_terima}}Sedang Dinilai
-
+
+ +
+
-
-

masuk

-
-
-
- @csrf - - - -
-
-
-
- - - - - - - - - - - - - -
BilNo RujukanPembiayaanN. MarhunTeller
-
+
+ + + + + + + + + + + + @foreach($sudahSerah as $index) + + + + + + + + @endforeach + +
BilNo RujukanMasa TerimaMasa SerahStatus
{{$loop->iteration}}{{$index->norujukan}}{{$index->masa_terima}}{{$index->masa_serah}}Sudah Serah
@@ -109,4 +123,10 @@
+ + @endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 63ff94c8..0e164a9e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -229,6 +229,9 @@ Route::group(['middleware' => ['permission:semakanmarhun','permission:kemaskinim Route::get('/senarailelongscan',['as'=>'marhun.senarailelongscan','uses'=>'MarhunController@senarailelongscan']); Route::get('/scanbarcode/{lelong_id}',['as'=>'marhun.scanbarcode','uses'=>'MarhunController@listScanBarcode']); Route::post('/scankeluarmarhun',['as'=>'marhun.scankeluarmarhun','uses'=>'MarhunController@scanKeluarMarhun']); + Route::post('/scanmasukmarhun',['as'=>'marhun.scanmasukmarhun','uses'=>'MarhunController@scanMasukMarhun']); + Route::post('/terimamarhun',['as'=>'marhun.terimamarhun','uses'=>'MarhunController@terimaMarhun']); + Route::post('/serahmarhun',['as'=>'marhun.serahmarhun','uses'=>'MarhunController@serahMarhun']); Route::get('/senaraimarhun/{lelong_id}',['as'=>'marhun.senaraimarhun','uses'=>'MarhunController@index']); Route::get('/marhun/{id}/{lelong_id}',['as'=>'marhun.show','uses'=>'MarhunController@show']); Route::post('/submitdelete',['as'=>'marhun.submitdelete','uses'=>'MarhunController@submitdelete']);