|
|
@@ -256,7 +256,7 @@ class CompoundResourceController extends BaseController |
|
|
|
"no_plate" => $request->no_plate, |
|
|
|
"no_cukai_jalan" => $request->no_cukai_jalan, |
|
|
|
"catatan" => $request->catatan, |
|
|
|
"lokasi_kejadian" => $request->lokasi_kejadian, |
|
|
|
"lokasi_kejadian" => '-', |
|
|
|
'latlong' => $request->Latlong, |
|
|
|
'jbkod' => $request->jabatan, |
|
|
|
'akta' => $faulty->deed_law_id, |
|
|
@@ -271,7 +271,7 @@ class CompoundResourceController extends BaseController |
|
|
|
"penguatkuasa" => '', |
|
|
|
"no_telefon" => $request->tel, |
|
|
|
"no_akaun_lesen" => $request->lesen, |
|
|
|
"maklumat_tambahan" => $request->maklumat_tambahan, |
|
|
|
"maklumat_tambahan" => '-', |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
@@ -298,6 +298,116 @@ class CompoundResourceController extends BaseController |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function storeNotice(Request $request) |
|
|
|
{ |
|
|
|
$staff = Staff::with('StaffDetail')->where('api_token',$request->api_token)->first(); |
|
|
|
if(empty($staff)){ |
|
|
|
return $this->sendError('Invalid', 'Staff not existed'); |
|
|
|
}else { |
|
|
|
$faulty = Faulty::where('_id',$request->get('seksyen'))->first(); |
|
|
|
if(!empty($faulty)){ |
|
|
|
|
|
|
|
$data = array(); |
|
|
|
$countKPD = $this->compound->withTrashed()->count(); |
|
|
|
|
|
|
|
do { |
|
|
|
$countKPD = $countKPD + 1; |
|
|
|
} while (Compound::where("kpd", "=", 'KP'.$countKPD)->first() instanceof Compound); |
|
|
|
|
|
|
|
$kpd = 'KP' . $countKPD; |
|
|
|
$no_siri = date('yn').'-'.$countKPD; |
|
|
|
|
|
|
|
$fileData = [ |
|
|
|
'no_siri' => $no_siri, |
|
|
|
]; |
|
|
|
|
|
|
|
if($request->jenis != 'Pelbagai'){ |
|
|
|
$compoundData = [ |
|
|
|
'jenis' => 'Parkir', |
|
|
|
'kpd' => $kpd, |
|
|
|
'nama' => '-', |
|
|
|
'identity' => '-', |
|
|
|
'alamat' => '-', |
|
|
|
"no_plate" => strtolower($request->no_plate), |
|
|
|
"no_cukai_jalan" => $request->noCukaijalan, |
|
|
|
"jenis_kenderaan" => $request->jenisKenderaan, |
|
|
|
"model_kenderaan" => $request->modelKenderaan, |
|
|
|
"warna_kenderaan" => $request->warnakenderaan, |
|
|
|
"nama_kawasan" => $request->namaKawasan, |
|
|
|
"nama_taman" => $request->namaTaman, |
|
|
|
"nama_jalan" => $request->namaJalan, |
|
|
|
"no_parking" => $request->noParking, |
|
|
|
"catatan" => $request->catatan, |
|
|
|
"lokasi_kejadian" => '-', |
|
|
|
'latlong' => $request->Latlong, |
|
|
|
'jbkod' => $request->jabatan, |
|
|
|
'akta' => $faulty->deed_law_id, |
|
|
|
'seksyen_kesalahan' => $faulty->_id, |
|
|
|
'jumlah_asal_kompaun' => $faulty->amount, |
|
|
|
'jumlah_kemaskini_kompaun' => '', |
|
|
|
'dikeluarkan' => $staff->_id, |
|
|
|
"status" => 'Belum Bayar', |
|
|
|
"amount_payment" => '', |
|
|
|
"receipt" => '', |
|
|
|
"modul" => '05', |
|
|
|
"penguatkuasa" => '', |
|
|
|
]; |
|
|
|
}else{ |
|
|
|
$compoundData = [ |
|
|
|
'jenis' => 'Pelbagai', |
|
|
|
'kpd' => $kpd, |
|
|
|
'nama' => $request->namaP, |
|
|
|
'identity' => $request->noIc, |
|
|
|
'nama_syarikat' => $request->namaS, |
|
|
|
'no_daftar_syarikat' => strtolower($request->daftarNo), |
|
|
|
'alamat' => $request->alamat, |
|
|
|
"no_plate" => $request->no_plate, |
|
|
|
"no_cukai_jalan" => $request->no_cukai_jalan, |
|
|
|
"catatan" => $request->catatan, |
|
|
|
"lokasi_kejadian" => '-', |
|
|
|
'latlong' => $request->Latlong, |
|
|
|
'jbkod' => $request->jabatan, |
|
|
|
'akta' => $faulty->deed_law_id, |
|
|
|
'seksyen_kesalahan' => $faulty->_id, |
|
|
|
'jumlah_asal_kompaun' => $faulty->amount, |
|
|
|
'jumlah_kemaskini_kompaun' => '', |
|
|
|
'dikeluarkan' => $staff->_id, |
|
|
|
"status" => 'Belum Bayar', |
|
|
|
"amount_payment" => '', |
|
|
|
"receipt" => '', |
|
|
|
"modul" => '05', |
|
|
|
"penguatkuasa" => '', |
|
|
|
"no_telefon" => $request->tel, |
|
|
|
"no_akaun_lesen" => $request->lesen, |
|
|
|
"maklumat_tambahan" => '-', |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
$file = ConfidentialFile::create($fileData); |
|
|
|
$saved = $file->compound()->create($compoundData); |
|
|
|
|
|
|
|
if($saved){ |
|
|
|
// $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); |
|
|
|
// if(!empty($compound)){ |
|
|
|
dispatch(new UpdateCompoundPrice($kpd)); |
|
|
|
// $tawaran = ''; |
|
|
|
// if($compound->jumlah_kemaskini_kompaun != ''){ |
|
|
|
// $tawaran = $compound->jumlah_kemaskini_kompaun; |
|
|
|
// }else{ |
|
|
|
// $tawaran = $compound->jumlah_asal_kompaun; |
|
|
|
// } |
|
|
|
$this->dispatch(new StoreCompound($request->all(), $kpd, $staff->_id, $no_siri)); |
|
|
|
array_push($data, array('kpd' => $kpd)); |
|
|
|
|
|
|
|
return $this->sendResponse($data, 'Berjaya simpan rekod notis!'); |
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Display the specified resource. |
|
|
|
* |