| $data = array(); | $data = array(); | ||||
| $faulty = $request->seksyen; | $faulty = $request->seksyen; | ||||
| $faulty = Faulty::where('_id',$request->get('seksyen'))->orWhere('nama', 'like', $faulty)->first(); | $faulty = Faulty::where('_id',$request->get('seksyen'))->orWhere('nama', 'like', $faulty)->first(); | ||||
| if($request->jenis == 'Parkir') | if($request->jenis == 'Parkir') | ||||
| $compound = Compound::where('jenis_n', $request->jenis)->orWhere('non', $request->non)->first(); | $compound = Compound::where('jenis_n', $request->jenis)->orWhere('non', $request->non)->first(); | ||||
| if(!empty($compound)) { | if(!empty($compound)) { | ||||
| $saved = ''; | $saved = ''; |
| public function filterTaman($nama) | public function filterTaman($nama) | ||||
| { | { | ||||
| $result = CodeMukim::where('JLN_JNAMA',$nama)->first(); | |||||
| info($nama); | |||||
| $result = CodeMukim::where('_id',$nama)->first(); | |||||
| if(!empty($result)){ | if(!empty($result)){ | ||||
| return $this->sendResponse($result->KWS_KNAMA, 'Rekod Ditemui'); | return $this->sendResponse($result->KWS_KNAMA, 'Rekod Ditemui'); | ||||
| public function filterKawasan($nama) | public function filterKawasan($nama) | ||||
| { | { | ||||
| $result = CodeMukim::where('JLN_JNAMA',$nama)->first(); | |||||
| $result = CodeMukim::where('_id',$nama)->first(); | |||||
| if(!empty($result)){ | if(!empty($result)){ | ||||
| return $this->sendResponse($result->MKM_MNAMA, 'Rekod Ditemui'); | return $this->sendResponse($result->MKM_MNAMA, 'Rekod Ditemui'); |
| })->get(); | })->get(); | ||||
| } | } | ||||
| else if($request->filled('search')){ | else if($request->filled('search')){ | ||||
| "masa_notis" => $masa_n , | "masa_notis" => $masa_n , | ||||
| "tarikh_kompaun" => $tarikh, | "tarikh_kompaun" => $tarikh, | ||||
| "masa_kompaun" => $masa, | "masa_kompaun" => $masa, | ||||
| "bil_haiwan" => $c->bil_haiwan, | |||||
| "bil_haiwan" => $c->bil_haiwan ?? '-', | |||||
| )); | )); | ||||
| // } | // } | ||||
| public function storemanualCompound(Request $request){ | |||||
| public function storemanualCompound(Request $request){ | |||||
| $id = Auth::guard('sadmin')->id(); | $id = Auth::guard('sadmin')->id(); | ||||
| $user = Staff::with('StaffDetail')->find($id); | $user = Staff::with('StaffDetail')->find($id); | ||||
| $kpd = $request->kpd; | $kpd = $request->kpd; | ||||
| $no_siri = ''; | $no_siri = ''; | ||||
| $compoundData = []; | |||||
| $created_c = new Carbon($request->tarikh_dikeluarkan); | |||||
| if($request->jenis == 'Parkir') | |||||
| if($request->jenisKompaun == 'Parkir') | |||||
| { | { | ||||
| //for compound numbering | //for compound numbering | ||||
| // $countKPD = $this->compound->where('jenis','Parkir')->withTrashed()->count(); | // $countKPD = $this->compound->where('jenis','Parkir')->withTrashed()->count(); | ||||
| //only for compound parkir | //only for compound parkir | ||||
| $compoundData = [ | $compoundData = [ | ||||
| 'jenis' => 'Parkir', | 'jenis' => 'Parkir', | ||||
| 'kpd' => $request->kpd, | |||||
| 'kpd' => strtoupper($request->kpd), | |||||
| 'nama' => '-', | 'nama' => '-', | ||||
| 'identity' => '-', | 'identity' => '-', | ||||
| 'alamat' => '-', | 'alamat' => '-', | ||||
| "receipt" => '-', | "receipt" => '-', | ||||
| "modul" => '03', | "modul" => '03', | ||||
| "penguatkuasa" => '-', | "penguatkuasa" => '-', | ||||
| "created_c" => new Carbon($request->tarikh_dikeluarkan), | |||||
| "created_c" => $created_c->toDateTimeString(), | |||||
| "created_at" => new Carbon($request->tarikh_dikeluarkan), | "created_at" => new Carbon($request->tarikh_dikeluarkan), | ||||
| ]; | ]; | ||||
| } | } | ||||
| elseif ($request->jenis == 'Pelbagai_KT') { | |||||
| elseif ($request->jenisKompaun == 'Pelbagai_KT') { | |||||
| // $kpd = $this->generateNumber($request->jenis, 'KT', '03'); | // $kpd = $this->generateNumber($request->jenis, 'KT', '03'); | ||||
| $compoundData = [ | $compoundData = [ | ||||
| 'jenis' => $request->jenisKompaun, | 'jenis' => $request->jenisKompaun, | ||||
| 'kpd' => $request->kpd, | |||||
| 'kpd' => strtoupper($request->kpd), | |||||
| 'nama' => $request->namaP, | 'nama' => $request->namaP, | ||||
| 'identity' => $request->noIc, | 'identity' => $request->noIc, | ||||
| 'nama_syarikat' => $request->namaS, | 'nama_syarikat' => $request->namaS, | ||||
| "modul" => '03', | "modul" => '03', | ||||
| "penguatkuasa" => '-', | "penguatkuasa" => '-', | ||||
| "no_akaun_lesen" => $request->lesen, | "no_akaun_lesen" => $request->lesen, | ||||
| "created_c" => new Carbon($request->tarikh_dikeluarkan), | |||||
| "created_c" => $created_c->toDateTimeString(), | |||||
| "created_at" => new Carbon($request->tarikh_dikeluarkan), | "created_at" => new Carbon($request->tarikh_dikeluarkan), | ||||
| ]; | ]; | ||||
| } | } | ||||
| elseif ($request->jenis == 'Pelbagai_JPB') { | |||||
| elseif ($request->jenisKompaun == 'Pelbagai_JPB') { | |||||
| // $kpd = $this->generateNumber($request->jenis, 'JPB', '03'); | // $kpd = $this->generateNumber($request->jenis, 'JPB', '03'); | ||||
| $compoundData = [ | $compoundData = [ | ||||
| 'jenis' => $request->jenisKompaun, | 'jenis' => $request->jenisKompaun, | ||||
| 'kpd' => $request->kpd, | |||||
| 'kpd' => strtoupper($request->kpd), | |||||
| 'nama' => $request->namaP, | 'nama' => $request->namaP, | ||||
| 'identity' => $request->noIc, | 'identity' => $request->noIc, | ||||
| 'nama_syarikat' => $request->namaS, | 'nama_syarikat' => $request->namaS, | ||||
| "modul" => '03', | "modul" => '03', | ||||
| "penguatkuasa" => '-', | "penguatkuasa" => '-', | ||||
| "no_akaun_lesen" => $request->lesen, | "no_akaun_lesen" => $request->lesen, | ||||
| "created_c" => new Carbon($request->tarikh_dikeluarkan), | |||||
| "created_c" => $created_c->toDateTimeString(), | |||||
| "created_at" => new Carbon($request->tarikh_dikeluarkan), | "created_at" => new Carbon($request->tarikh_dikeluarkan), | ||||
| ]; | ]; | ||||
| } | } |
| if($request->dashboard == "true"){ | if($request->dashboard == "true"){ | ||||
| // if($request->modul == '02') | |||||
| // { | |||||
| // $compound = Compound::with('ConfidentialFile')->where('confidential_file_id',$request->confidential_id)->first(); | |||||
| // $faulty = Faulty::with('DeedLaw', 'Department') ->where('_id', $compound->seksyen_kesalahan_n)->first(); | |||||
| // $jbkod = $compound->jbkod_n; | |||||
| // } | |||||
| // else{ | |||||
| $compound = Compound::with('ConfidentialFile')->where('kpd',$request->kpd)->first(); | |||||
| $faulty = Faulty::with('DeedLaw', 'Department') ->where('_id', $compound->seksyen_kesalahan) | |||||
| ->orWhere('_id', $compound->seksyen_kesalahan_n)->first(); | |||||
| $jbkod = $compound->jbkod; | |||||
| // } | |||||
| $compound = Compound::with('ConfidentialFile')->where('kpd',$request->kpd)->first(); | |||||
| $faulty = Faulty::with('DeedLaw', 'Department') ->where('_id', $compound->seksyen_kesalahan) | |||||
| ->orWhere('_id', $compound->seksyen_kesalahan_n)->first(); | |||||
| $jbkod = $compound->jbkod; | |||||
| $roles = Roles::where('kod', $request->kategori_modul)->first(); | $roles = Roles::where('kod', $request->kategori_modul)->first(); | ||||
| if(!empty($staff)){ | if(!empty($staff)){ | ||||
| $dataNoti = [ | $dataNoti = [ | ||||
| 'title' => $title, | 'title' => $title, | ||||
| 'body' => $msg, | |||||
| 'body' => $msg, | |||||
| 'data' => $data, | |||||
| ]; | ]; | ||||
| $staff->notification()->create($dataNoti); | $staff->notification()->create($dataNoti); | ||||
| } | } |
| <?php | |||||
| namespace App\Jobs; | |||||
| use Illuminate\Bus\Queueable; | |||||
| use Illuminate\Queue\SerializesModels; | |||||
| use Illuminate\Queue\InteractsWithQueue; | |||||
| use Illuminate\Contracts\Queue\ShouldQueue; | |||||
| use Illuminate\Foundation\Bus\Dispatchable; | |||||
| use Illuminate\Http\Request; | |||||
| use Carbon\Carbon; | |||||
| use App\SiteSetting; | |||||
| use App\Model\Staff; | |||||
| use App\Model\StaffDetail; | |||||
| use App\Model\Module\Department; | |||||
| use App\Model\Module\DeedLaw; | |||||
| use App\Model\Module\Faulty; | |||||
| use App\Model\Module\Compound; | |||||
| use App\Model\Module\ConfidentialFile; | |||||
| use App\Model\Module\History; | |||||
| use App\Model\Module\SubHistory; | |||||
| use App\Model\Module\Memo; | |||||
| use App\Model\Module\Attachment; | |||||
| use App\Jobs\UpdateCompoundPrice; | |||||
| class StoreCompoundManual implements ShouldQueue | |||||
| { | |||||
| use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | |||||
| protected $request, $kpd, $no_badan, $no_siri; | |||||
| /** | |||||
| * Create a new job instance. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function __construct(array $request, $kpd, $no_badan, $no_siri) | |||||
| { | |||||
| // | |||||
| $this->request = $request; | |||||
| $this->kpd = $kpd; | |||||
| $this->no_badan = $no_badan; | |||||
| $this->no_siri = $no_siri; | |||||
| } | |||||
| /** | |||||
| * Execute the job. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function handle(ConfidentialFile $file) | |||||
| { | |||||
| // $success_save_data = false; | |||||
| // $faulty = Faulty::where('_id', $this->request['seksyen'])->first(); | |||||
| // if($success_save_data == false){ | |||||
| // $count = $file->count(); | |||||
| // if($count == 0){ | |||||
| // $count = $count + 1; | |||||
| // $siri = str_pad($count, 5, '0', STR_PAD_LEFT); | |||||
| // }else { | |||||
| // $count = $count + 1; | |||||
| // $siri = str_pad($count, 5, '0', STR_PAD_LEFT); | |||||
| // } | |||||
| // $kpd = $this->kpd; | |||||
| // $no_siri = date('yn').'-'.$count; | |||||
| // $fileData = [ | |||||
| // 'no_siri' => $no_siri, | |||||
| // ]; | |||||
| // if($this->request['no_plate'] != '-'){ | |||||
| // $compoundData = [ | |||||
| // 'jenis' => 'Parkir', | |||||
| // 'kpd' => $this->request['kpd'], | |||||
| // 'nama' => '-', | |||||
| // 'identity' => '-', | |||||
| // 'alamat' => '-', | |||||
| // "no_plate" => strtolower($this->request['no_plate']), | |||||
| // "no_cukai_jalan" => $this->request['noCukaijalan'], | |||||
| // "jenis_kenderaan" => $this->request['jenisKenderaan'], | |||||
| // "model_kenderaan" => $this->request['modelKenderaan'], | |||||
| // "warna_kenderaan" => $this->request['warnakenderaan'], | |||||
| // "nama_taman" => $this->request['namaTaman'], | |||||
| // "nama_jalan" => $this->request['namaJalan'], | |||||
| // "no_parking" => $this->request['noParking'], | |||||
| // "catatan" => $this->request['catatan'], | |||||
| // "lokasi_kejadian" => '-', | |||||
| // 'latlong' => $this->request['Latlong'], | |||||
| // 'jbkod' => $this->request['jabatan'], | |||||
| // 'akta' => $faulty->deed_law_id, | |||||
| // 'seksyen_kesalahan' => $faulty->_id, | |||||
| // 'jumlah_asal_kompaun' => $faulty->amount, | |||||
| // 'jumlah_kemaskini_kompaun' => '', | |||||
| // 'dikeluarkan' => $this->no_badan, | |||||
| // "status" => 'Belum Bayar', | |||||
| // "amount_payment" => '', | |||||
| // "receipt" => '', | |||||
| // "modul" => '03', | |||||
| // "penguatkuasa" => '', | |||||
| // "created_at" => new Carbon($this->request['tarikh_dikeluarkan']), | |||||
| // ]; | |||||
| // }else{ | |||||
| // $compoundData = [ | |||||
| // 'jenis' => 'Pelbagai', | |||||
| // 'kpd' => $this->request['kpd'], | |||||
| // 'nama' => $this->request['namaP'], | |||||
| // 'identity' => $this->request['noIc'], | |||||
| // 'nama_syarikat' => $this->request['namaS'], | |||||
| // 'no_daftar_syarikat' => strtolower($this->request['daftarNo']), | |||||
| // 'alamat' => $this->request['alamat'], | |||||
| // 'no_telefon' => $this->request['tel'], | |||||
| // 'no_akaun_lesen' =>$this->request['lesen'], | |||||
| // "no_plate" => $this->request['no_plate'], | |||||
| // "catatan" => $this->request['catatan'], | |||||
| // "lokasi_kejadian" => $this->request['lokasi_kejadian'], | |||||
| // 'latlong' => $this->request['Latlong'], | |||||
| // 'jbkod' => $this->request['jabatan'], | |||||
| // 'akta' => $faulty->deed_law_id, | |||||
| // 'seksyen_kesalahan' => $faulty->_id, | |||||
| // 'jumlah_asal_kompaun' => $faulty->amount, | |||||
| // 'jumlah_kemaskini_kompaun' => '', | |||||
| // 'dikeluarkan' => $this->no_badan, | |||||
| // "status" => 'Belum Bayar', | |||||
| // "amount_payment" => '', | |||||
| // "receipt" => '', | |||||
| // "modul" => '03', | |||||
| // "penguatkuasa" => '', | |||||
| // "created_at" => new Carbon($this->request['tarikh_dikeluarkan']), | |||||
| // ]; | |||||
| // } | |||||
| // $file = $file->create($fileData); | |||||
| // $file->compound()->create($compoundData); | |||||
| // $success_save_data = true; | |||||
| // } | |||||
| // if($success_save_data == true){ | |||||
| // dispatch(new UpdateCompoundPrice($this->kpd)); | |||||
| $staff = Staff::with('StaffDetail')->where('_id', $this->no_badan)->first(); | |||||
| $compound = Compound::with('ConfidentialFile','Attachment','CompoundInvestigation')->where('kpd',$this->request['kpd'])->first(); | |||||
| $site = SiteSetting::first(); | |||||
| $faulty = Faulty::with('DeedLaw')->where('_id',$compound->seksyen_kesalahan)->first(); | |||||
| $department = Department::where('_id', $compound->jbkod)->first(); | |||||
| $tawaran = ''; | |||||
| if($compound->jumlah_kemaskini_kompaun == ''){ | |||||
| $tawaran = $compound->jumlah_asal_kompaun; | |||||
| }else{ | |||||
| $tawaran = $compound->jumlah_kemaskini_kompaun; | |||||
| } | |||||
| /******************************************************************/ | |||||
| $gDate = $compound->created_at->format('F Y'); | |||||
| $historyData = [ | |||||
| 'tarikh_kumpulan' => $gDate, | |||||
| ]; | |||||
| $subHistory = [ | |||||
| 'no_siri' => $compound->ConfidentialFile->no_siri, | |||||
| 'tajuk' => "Penguatkuasa ".$staff->StaffDetail->full_name." mengeluarkan kompaun ".$this->request['kpd'], | |||||
| 'huraian' => "Kompaun ".$this->request['kpd']." telah dihasilkan oleh penguatkuasa <a href='".url('/main/staff')."/".$staff->_id."/profile'>".$staff->StaffDetail->full_name."</a> di bawah akta seksyen kesalahan [".$faulty->sketr."] ".$faulty->nama, | |||||
| ]; | |||||
| $groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); | |||||
| if(!empty($groupByDate)){ | |||||
| $groupByDate->subhistory()->create($subHistory); | |||||
| $compound->ConfidentialFile->history()->attach($groupByDate); | |||||
| }else{ | |||||
| $history = History::create($historyData); | |||||
| $history->subhistory()->create($subHistory); | |||||
| $compound->ConfidentialFile->history()->attach($history); | |||||
| } | |||||
| $memo = Memo::where('itkod', $compound->seksyen_kesalahan)->get(); | |||||
| if(!empty($memo)){ | |||||
| foreach ($memo as $key => $m) { | |||||
| $staffD = StaffDetail::where('_id',$m->dikeluarkan)->first(); | |||||
| if($m->disahkan != ''){ | |||||
| $compound->ConfidentialFile->memo()->attach($m); | |||||
| $historyData = [ | |||||
| 'tarikh_kumpulan' => $gDate, | |||||
| ]; | |||||
| $subHistory = [ | |||||
| 'no_siri' => $compound->ConfidentialFile->no_siri, | |||||
| 'tajuk' => "Penambahan Memo[ ".$m->no_rujukan." ] : ".$m->subjek." oleh ".$staffD->roles_access." ".$staffD->full_name, | |||||
| 'huraian' => $m->penerangan, | |||||
| ]; | |||||
| $groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); | |||||
| if(!empty($groupByDate)){ | |||||
| $groupByDate->subhistory()->create($subHistory); | |||||
| $compound->ConfidentialFile->history()->attach($groupByDate); | |||||
| }else{ | |||||
| $history = History::create($historyData); | |||||
| $history->subhistory()->create($subHistory); | |||||
| $compound->ConfidentialFile->history()->attach($history); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| // Convert To Pdf | |||||
| $upload [] = [ 'name' => 'compound', 'contents' => $compound ]; | |||||
| $upload [] = [ 'name' => 'faulty', 'contents' => $faulty ]; | |||||
| $upload [] = [ 'name' => 'staff', 'contents' => $staff ]; | |||||
| $upload [] = [ 'name' => 'department', 'contents' => $department ]; | |||||
| $upload [] = [ 'name' => 'site', 'contents' => $site ]; | |||||
| $upload [] = [ 'name' => 'type', 'contents' => 'proxy' ]; | |||||
| $client = new \GuzzleHttp\Client(); | |||||
| $result = $client->request('POST', 'http://filegoforce.sipadu.my/api/compound/pdf', [ | |||||
| 'multipart' => $upload | |||||
| ]); | |||||
| $response = json_decode($result->getBody()->getContents()); | |||||
| if($response->success == true){ | |||||
| $compound->pdf_path = $response->data; | |||||
| $compound->save(); | |||||
| } | |||||
| // } | |||||
| } | |||||
| } | |||||
| <?php | |||||
| namespace App\Jobs; | |||||
| use Illuminate\Bus\Queueable; | |||||
| use Illuminate\Queue\SerializesModels; | |||||
| use Illuminate\Queue\InteractsWithQueue; | |||||
| use Illuminate\Contracts\Queue\ShouldQueue; | |||||
| use Illuminate\Foundation\Bus\Dispatchable; | |||||
| use Illuminate\Http\Request; | |||||
| use Carbon\Carbon; | |||||
| use App\SiteSetting; | |||||
| use App\Model\Staff; | |||||
| use App\Model\StaffDetail; | |||||
| use App\Model\Module\Department; | |||||
| use App\Model\Module\DeedLaw; | |||||
| use App\Model\Module\Faulty; | |||||
| use App\Model\Module\Compound; | |||||
| use App\Model\Module\ConfidentialFile; | |||||
| use App\Model\Module\History; | |||||
| use App\Model\Module\SubHistory; | |||||
| use App\Model\Module\Memo; | |||||
| use App\Model\Module\Attachment; | |||||
| use App\Jobs\UpdateCompoundPrice; | |||||
| class StoreCompoundManual implements ShouldQueue | |||||
| { | |||||
| use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | |||||
| protected $request, $kpd, $no_badan, $no_siri; | |||||
| /** | |||||
| * Create a new job instance. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function __construct(array $request, $kpd, $no_badan, $no_siri) | |||||
| { | |||||
| // | |||||
| $this->request = $request; | |||||
| $this->kpd = $kpd; | |||||
| $this->no_badan = $no_badan; | |||||
| $this->no_siri = $no_siri; | |||||
| } | |||||
| /** | |||||
| * Execute the job. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function handle(ConfidentialFile $file) | |||||
| { | |||||
| // $success_save_data = false; | |||||
| // $faulty = Faulty::where('_id', $this->request['seksyen'])->first(); | |||||
| // if($success_save_data == false){ | |||||
| // $count = $file->count(); | |||||
| // if($count == 0){ | |||||
| // $count = $count + 1; | |||||
| // $siri = str_pad($count, 5, '0', STR_PAD_LEFT); | |||||
| // }else { | |||||
| // $count = $count + 1; | |||||
| // $siri = str_pad($count, 5, '0', STR_PAD_LEFT); | |||||
| // } | |||||
| // $kpd = $this->kpd; | |||||
| // $no_siri = date('yn').'-'.$count; | |||||
| // $fileData = [ | |||||
| // 'no_siri' => $no_siri, | |||||
| // ]; | |||||
| // if($this->request['no_plate'] != '-'){ | |||||
| // $compoundData = [ | |||||
| // 'jenis' => 'Parkir', | |||||
| // 'kpd' => $this->request['kpd'], | |||||
| // 'nama' => '-', | |||||
| // 'identity' => '-', | |||||
| // 'alamat' => '-', | |||||
| // "no_plate" => strtolower($this->request['no_plate']), | |||||
| // "no_cukai_jalan" => $this->request['noCukaijalan'], | |||||
| // "jenis_kenderaan" => $this->request['jenisKenderaan'], | |||||
| // "model_kenderaan" => $this->request['modelKenderaan'], | |||||
| // "warna_kenderaan" => $this->request['warnakenderaan'], | |||||
| // "nama_taman" => $this->request['namaTaman'], | |||||
| // "nama_jalan" => $this->request['namaJalan'], | |||||
| // "no_parking" => $this->request['noParking'], | |||||
| // "catatan" => $this->request['catatan'], | |||||
| // "lokasi_kejadian" => '-', | |||||
| // 'latlong' => $this->request['Latlong'], | |||||
| // 'jbkod' => $this->request['jabatan'], | |||||
| // 'akta' => $faulty->deed_law_id, | |||||
| // 'seksyen_kesalahan' => $faulty->_id, | |||||
| // 'jumlah_asal_kompaun' => $faulty->amount, | |||||
| // 'jumlah_kemaskini_kompaun' => '', | |||||
| // 'dikeluarkan' => $this->no_badan, | |||||
| // "status" => 'Belum Bayar', | |||||
| // "amount_payment" => '', | |||||
| // "receipt" => '', | |||||
| // "modul" => '03', | |||||
| // "penguatkuasa" => '', | |||||
| // "created_at" => new Carbon($this->request['tarikh_dikeluarkan']), | |||||
| // ]; | |||||
| // }else{ | |||||
| // $compoundData = [ | |||||
| // 'jenis' => 'Pelbagai', | |||||
| // 'kpd' => $this->request['kpd'], | |||||
| // 'nama' => $this->request['namaP'], | |||||
| // 'identity' => $this->request['noIc'], | |||||
| // 'nama_syarikat' => $this->request['namaS'], | |||||
| // 'no_daftar_syarikat' => strtolower($this->request['daftarNo']), | |||||
| // 'alamat' => $this->request['alamat'], | |||||
| // 'no_telefon' => $this->request['tel'], | |||||
| // 'no_akaun_lesen' =>$this->request['lesen'], | |||||
| // "no_plate" => $this->request['no_plate'], | |||||
| // "catatan" => $this->request['catatan'], | |||||
| // "lokasi_kejadian" => $this->request['lokasi_kejadian'], | |||||
| // 'latlong' => $this->request['Latlong'], | |||||
| // 'jbkod' => $this->request['jabatan'], | |||||
| // 'akta' => $faulty->deed_law_id, | |||||
| // 'seksyen_kesalahan' => $faulty->_id, | |||||
| // 'jumlah_asal_kompaun' => $faulty->amount, | |||||
| // 'jumlah_kemaskini_kompaun' => '', | |||||
| // 'dikeluarkan' => $this->no_badan, | |||||
| // "status" => 'Belum Bayar', | |||||
| // "amount_payment" => '', | |||||
| // "receipt" => '', | |||||
| // "modul" => '03', | |||||
| // "penguatkuasa" => '', | |||||
| // "created_at" => new Carbon($this->request['tarikh_dikeluarkan']), | |||||
| // ]; | |||||
| // } | |||||
| // $file = $file->create($fileData); | |||||
| // $file->compound()->create($compoundData); | |||||
| // $success_save_data = true; | |||||
| // } | |||||
| // if($success_save_data == true){ | |||||
| // dispatch(new UpdateCompoundPrice($this->kpd)); | |||||
| $staff = Staff::with('StaffDetail')->where('_id', $this->no_badan)->first(); | |||||
| $compound = Compound::with('ConfidentialFile','Attachment','CompoundInvestigation')->where('kpd',$this->request['kpd'])->first(); | |||||
| $site = SiteSetting::first(); | |||||
| $faulty = Faulty::with('DeedLaw')->where('_id',$compound->seksyen_kesalahan)->first(); | |||||
| $department = Department::where('_id', $compound->jbkod)->first(); | |||||
| $tawaran = ''; | |||||
| if($compound->jumlah_kemaskini_kompaun == ''){ | |||||
| $tawaran = $compound->jumlah_asal_kompaun; | |||||
| }else{ | |||||
| $tawaran = $compound->jumlah_kemaskini_kompaun; | |||||
| } | |||||
| /******************************************************************/ | |||||
| $gDate = $compound->created_at->format('F Y'); | |||||
| $historyData = [ | |||||
| 'tarikh_kumpulan' => $gDate, | |||||
| ]; | |||||
| $subHistory = [ | |||||
| 'no_siri' => $compound->ConfidentialFile->no_siri, | |||||
| 'tajuk' => "Penguatkuasa ".$staff->StaffDetail->full_name." mengeluarkan kompaun ".$this->request['kpd'], | |||||
| 'huraian' => "Kompaun ".$this->request['kpd']." telah dihasilkan oleh penguatkuasa <a href='".url('/main/staff')."/".$staff->_id."/profile'>".$staff->StaffDetail->full_name."</a> di bawah akta seksyen kesalahan [".$faulty->sketr."] ".$faulty->nama, | |||||
| ]; | |||||
| $groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); | |||||
| if(!empty($groupByDate)){ | |||||
| $groupByDate->subhistory()->create($subHistory); | |||||
| $compound->ConfidentialFile->history()->attach($groupByDate); | |||||
| }else{ | |||||
| $history = History::create($historyData); | |||||
| $history->subhistory()->create($subHistory); | |||||
| $compound->ConfidentialFile->history()->attach($history); | |||||
| } | |||||
| $memo = Memo::where('itkod', $compound->seksyen_kesalahan)->get(); | |||||
| if(!empty($memo)){ | |||||
| foreach ($memo as $key => $m) { | |||||
| $staffD = StaffDetail::where('_id',$m->dikeluarkan)->first(); | |||||
| if($m->disahkan != ''){ | |||||
| $compound->ConfidentialFile->memo()->attach($m); | |||||
| $historyData = [ | |||||
| 'tarikh_kumpulan' => $gDate, | |||||
| ]; | |||||
| $subHistory = [ | |||||
| 'no_siri' => $compound->ConfidentialFile->no_siri, | |||||
| 'tajuk' => "Penambahan Memo[ ".$m->no_rujukan." ] : ".$m->subjek." oleh ".$staffD->roles_access." ".$staffD->full_name, | |||||
| 'huraian' => $m->penerangan, | |||||
| ]; | |||||
| $groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); | |||||
| if(!empty($groupByDate)){ | |||||
| $groupByDate->subhistory()->create($subHistory); | |||||
| $compound->ConfidentialFile->history()->attach($groupByDate); | |||||
| }else{ | |||||
| $history = History::create($historyData); | |||||
| $history->subhistory()->create($subHistory); | |||||
| $compound->ConfidentialFile->history()->attach($history); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| // Convert To Pdf | |||||
| $upload [] = [ 'name' => 'compound', 'contents' => $compound ]; | |||||
| $upload [] = [ 'name' => 'faulty', 'contents' => $faulty ]; | |||||
| $upload [] = [ 'name' => 'staff', 'contents' => $staff ]; | |||||
| $upload [] = [ 'name' => 'department', 'contents' => $department ]; | |||||
| $upload [] = [ 'name' => 'site', 'contents' => $site ]; | |||||
| $upload [] = [ 'name' => 'type', 'contents' => 'proxy' ]; | |||||
| $client = new \GuzzleHttp\Client(); | |||||
| $result = $client->request('POST', 'http://filegoforce.sipadu.my/api/compound/pdf', [ | |||||
| 'multipart' => $upload | |||||
| ]); | |||||
| $response = json_decode($result->getBody()->getContents()); | |||||
| if($response->success == true){ | |||||
| $compound->pdf_path = $response->data; | |||||
| $compound->save(); | |||||
| } | |||||
| // } | |||||
| } | |||||
| } |
| [{"_id":"5f89022a539a5c155d7638a9","modul":"02","jenis":"Notis_NHN","kpd":"NHN0001","no_plate":"","nric":"kp","no_daftar_syarikat":"nosya","nama_syarikat":"sya","nama":"nhn","lesen":"lesen","tarikh_masa":"16/10/2020 10:15:06 AM","faulty_skter":"UUK3","faulty_name":"MENJALANKAN PERNIAGAAN TANPA LESEN MPJBT","enforcer":"000000, Test Enforcer","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 10:15:06","updated_at":"2020-10-16 10:48","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":1},{"_id":"5f892fd269060627d946af4f","modul":"02","jenis":"Notis_NHN","kpd":"NHN0002","no_plate":"","nric":"test","no_daftar_syarikat":"test","nama_syarikat":"test","nama":"nhn test","lesen":"test","tarikh_masa":"16/10/2020 13:29:54 PM","faulty_skter":"UUK3","faulty_name":"MENJALANKAN PERNIAGAAN TANPA LESEN MPJBT","enforcer":"111111, Testing 1","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 13:29:54","updated_at":"2020-10-16 13:29","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":2},{"_id":"5f894666a9f8e91277171c34","modul":"02","jenis":"Notis_NHN","kpd":"NHN0003","no_plate":"","nric":"-","no_daftar_syarikat":"test","nama_syarikat":"test","nama":"test lesen","lesen":"-","tarikh_masa":"16/10/2020 15:06:14 PM","faulty_skter":"UUK3","faulty_name":"MENJAJA TANPA LESEN MPJBT","enforcer":"111111, Testing 1","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 15:06:14","updated_at":"2020-10-16 17:11","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":3}] |
| [{"_id":"5f88fe87467def320d5c856a","modul":"02","jenis":"Notis_NKG","kpd":"NKG0002","no_plate":"","nric":"kp","no_daftar_syarikat":"nosya","nama_syarikat":"syarikat","nama":"nkgnama","lesen":"lesem","tarikh_masa":"16/10/2020 09:59:35 AM","faulty_skter":"SEK.82","faulty_name":"NOTIS KACAU GANGGU","enforcer":"000000, Test Enforcer","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 09:59:35","updated_at":"2020-10-17 12:32","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":1},{"_id":"5f891456b349cb2d286ebc68","modul":"02","jenis":"Notis_NKG","kpd":"NKG0003","no_plate":"","nric":"no kp","no_daftar_syarikat":"nos yarikat","nama_syarikat":"syarikat","nama":"nama","lesen":"lesen","tarikh_masa":"16/10/2020 11:32:38 AM","faulty_skter":"SEK.82","faulty_name":"NOTIS KACAU GANGGU","enforcer":"000000, Test Enforcer","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 11:32:38","updated_at":"2020-10-16 11:32","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":2},{"_id":"5f8914ed6484113a113cee0a","modul":"02","jenis":"Notis_NKG","kpd":"NKG0004","no_plate":"","nric":"no kp","no_daftar_syarikat":"no syarikat","nama_syarikat":"syarikat","nama":"nama","lesen":"no lesen","tarikh_masa":"16/10/2020 11:35:09 AM","faulty_skter":"SEK.82","faulty_name":"NOTIS KACAU GANGGU","enforcer":"000000, Test Enforcer","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 11:35:09","updated_at":"2020-10-16 11:35","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":3},{"_id":"5f8946a9b4cc5f307e26bdeb","modul":"02","jenis":"Notis_NKG","kpd":"NKG0005","no_plate":"","nric":"-","no_daftar_syarikat":"-","nama_syarikat":"test","nama":"nkg test","lesen":"test","tarikh_masa":"16/10/2020 15:07:21 PM","faulty_skter":"SEK.82","faulty_name":"NOTIS KACAU GANGGU","enforcer":"111111, Testing 1","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 15:07:21","updated_at":"2020-10-16 15:07","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":4},{"_id":"5f89485ad6efb4639c2980f3","modul":"02","jenis":"Notis_NKG","kpd":"NKG0006","no_plate":"","nric":"-","no_daftar_syarikat":"-","nama_syarikat":"-","nama":"kt","lesen":"-","tarikh_masa":"16/10/2020 15:14:34 PM","faulty_skter":"SEK.82","faulty_name":"NOTIS KACAU GANGGU","enforcer":"111111, Testing 1","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 15:14:34","updated_at":"2020-10-16 15:14","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":5}] |
| [{"_id":"5f8901b39b08984d1a51170b","modul":"02","jenis":"Notis_NPPM","kpd":"NPPM0001","no_plate":"","nric":"kp","no_daftar_syarikat":"nosya","nama_syarikat":"sya","nama":"nppm nama","lesen":"lesen","tarikh_masa":"16/10/2020 10:13:07 AM","faulty_skter":"SEK.107(2)","faulty_name":"TIDAK MEMATUHI SYARAT LESEN/ PERMIT MPJBT","enforcer":"000000, Test Enforcer","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 10:13:07","updated_at":"2020-10-16 10:13","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":1}] |
| [{"_id":"5f88fe3a3ca6d61b5a46f9ab","modul":"02","jenis":"Notis_PA","kpd":"PA0001","no_plate":"","nric":"kp","no_daftar_syarikat":"nosya","nama_syarikat":"sya","nama":"panamq","lesen":"lesen","tarikh_masa":"16/10/2020 09:58:18 AM","faulty_skter":"UUK3(1)","faulty_name":"MEMILIKI ANJING TANPA LESEN MDJBT","enforcer":"000000, Test Enforcer","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 09:58:18","updated_at":"2020-10-16 11:47","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":1},{"_id":"5f89153e965cfa5596614afd","modul":"02","jenis":"Notis_PA","kpd":"PA0002","no_plate":"","nric":"no kp","no_daftar_syarikat":"no syarikay","nama_syarikat":"syarikat","nama":"nama","lesen":"no lesen","tarikh_masa":"16/10/2020 11:36:30 AM","faulty_skter":"UUK3(1)","faulty_name":"MEMILIKI ANJING TANPA LESEN MDJBT","enforcer":"000000, Test Enforcer","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 11:36:30","updated_at":"2020-10-16 11:36","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":2},{"_id":"5f8915a8c692920cdd41618f","modul":"02","jenis":"Notis_PA","kpd":"PA0003","no_plate":"","nric":"no kp","no_daftar_syarikat":"no syarikat","nama_syarikat":"syarikat","nama":"nama","lesen":"lesen","tarikh_masa":"16/10/2020 11:38:16 AM","faulty_skter":"UUK3(1)","faulty_name":"MEMILIKI ANJING TANPA LESEN MDJBT","enforcer":"000000, Test Enforcer","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 11:38:16","updated_at":"2020-10-16 16:35","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":3},{"_id":"5f8942b16fbe4944b325ce9a","modul":"02","jenis":"Notis_PA","kpd":"PA0004","no_plate":"","nric":"-","no_daftar_syarikat":"test","nama_syarikat":"test","nama":"test","lesen":"-","tarikh_masa":"16/10/2020 14:50:25 PM","faulty_skter":"UUK3(1)","faulty_name":"MEMILIKI ANJING TANPA LESEN MDJBT","enforcer":"111111, Testing 1","status":"Belum Bayar","kadar_kompaun":"","catatan_dari_admin":null,"updated_by":null,"updates_by":null,"tarikh_bayar":"","amount_payment":"","created_at":"2020-10-16 14:50:25","updated_at":"2020-10-16 14:50","index":"","status_kemaskini":"-","kesalahan":"-","DT_RowIndex":4}] |
| <div class="form-line"> | <div class="form-line"> | ||||
| <select id="namaJalan" name="namaJalan" class="js-section form-control" multiple="multiple" required> | <select id="namaJalan" name="namaJalan" class="js-section form-control" multiple="multiple" required> | ||||
| @foreach($jalan as $j) | @foreach($jalan as $j) | ||||
| <option value="{{ $j->JLN_JNAMA}}">{{ $j->JLN_JNAMA }}</option> | |||||
| <option value="{{ $j->_id}}">{{ $j->JLN_JNAMA }}</option> | |||||
| @endforeach | @endforeach | ||||
| </select> | </select> | ||||
| </div> | </div> |
| <div class="form-line"> | <div class="form-line"> | ||||
| <select id="namaJalan2" name="namaJalan" class="js-section form-control" multiple="multiple" required> | <select id="namaJalan2" name="namaJalan" class="js-section form-control" multiple="multiple" required> | ||||
| @foreach($jalan as $j) | @foreach($jalan as $j) | ||||
| <option value="{{ $j->JLN_JNAMA}}">{{ $j->JLN_JNAMA }}</option> | |||||
| <option value="{{ $j->_id}}">{{ $j->JLN_JNAMA }}</option> | |||||
| @endforeach | @endforeach | ||||
| </select> | </select> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="row clearfix"> | <div class="row clearfix"> | ||||
| <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12"> | <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12"> | ||||
| <label for="subject"><b>Dikeluarkan Oleh <code>*</code></b></label> | <label for="subject"><b>Dikeluarkan Oleh <code>*</code></b></label> |
| <div class="form-line"> | <div class="form-line"> | ||||
| <select id="namaJalan3" name="namaJalan" class="js-section form-control" multiple="multiple" required> | <select id="namaJalan3" name="namaJalan" class="js-section form-control" multiple="multiple" required> | ||||
| @foreach($jalan as $j) | @foreach($jalan as $j) | ||||
| <option value="{{ $j->JLN_JNAMA}}">{{ $j->JLN_JNAMA }}</option> | |||||
| <option value="{{ $j->_id}}">{{ $j->JLN_JNAMA }}</option> | |||||
| @endforeach | @endforeach | ||||
| </select> | </select> | ||||
| </div> | </div> |
| $('#pelbagai_JPB').hide(); | $('#pelbagai_JPB').hide(); | ||||
| $('#petak').hide(); | $('#petak').hide(); | ||||
| var origin = window.location.origin; | |||||
| var origin = window.location.origin; | |||||
| // var nama; | |||||
| $(".theme-loader").animate({ | $(".theme-loader").animate({ | ||||
| opacity: "0" | opacity: "0" | ||||
| $.ajax({ | $.ajax({ | ||||
| type: "GET", | type: "GET", | ||||
| url: "{{ url('api/filter-department-based-faulty') }}"+"/"+$(this).val(), | |||||
| url: "{{ url('api/filter-department-based-faulty') }}"+"/"+$(this).val(), | |||||
| success: function(result){ | success: function(result){ | ||||
| $("#jabatan").val(result.data); | $("#jabatan").val(result.data); | ||||
| // $.each(result.data, function(i, d) { | // $.each(result.data, function(i, d) { |
| @extends('layout.master', ['uid' => $user->_id, 'token' => $user->token_firebase]) | |||||
| @section('page_title', 'Halaman Utama') | |||||
| @section('sub_page_title', 'Selamat Datang ke Papan Pemuka Pegawai') | |||||
| @section('name', $user->StaffDetail->full_name) | |||||
| @section('img_profile', $user->StaffDetail->profile_img) | |||||
| @section('content') | |||||
| <style type="text/css"> | |||||
| html, body { | |||||
| height: 100% !important; | |||||
| } | |||||
| body { overflow-y:hidden !important; } | |||||
| .pcoded-inner-content { padding-left: 0px !important; padding-right: 0px !important; } | |||||
| .main-body .page-wrapper { padding: 0px !important; } | |||||
| #map { | |||||
| height: 100%; | |||||
| width: 100%; | |||||
| } | |||||
| #dataS { | |||||
| position: absolute; | |||||
| left: 10px; | |||||
| top: 0px; | |||||
| z-index: 999; | |||||
| margin: 10px 15px 0px 15px; | |||||
| border-radius: 8px 8px 0 0; | |||||
| border-bottom: 1px solid #DADCE0; | |||||
| box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 -1px 0px rgba(0,0,0,0.02); | |||||
| } | |||||
| #dataEmer { | |||||
| position: absolute; | |||||
| left: 50%; | |||||
| top: 30px; | |||||
| z-index: 999; | |||||
| margin: 10px 15px -50px 15px; | |||||
| border-radius: 8px 8px 0 0; | |||||
| border-bottom: 1px solid #DADCE0; | |||||
| box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 -1px 0px rgba(0,0,0,0.02); | |||||
| } | |||||
| .searchbox-shadow { | |||||
| box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 -1px 0px rgba(0,0,0,0.02); | |||||
| } | |||||
| #dataS .card { height: 100%; } | |||||
| @media (max-width: 765px) { | |||||
| .pcoded .pcoded-inner-content { | |||||
| padding: 0px !important; | |||||
| } | |||||
| body.horizontal-icon .pcoded .main-body, body.horizontal-icon-fixed .pcoded .main-body { | |||||
| margin-top: 0px !important; | |||||
| } | |||||
| #map { | |||||
| height: 100%; | |||||
| width: 100%; | |||||
| } | |||||
| } | |||||
| </style> | |||||
| <div class="row"> | |||||
| <div class="col-xl-12 col-md-12"> | |||||
| <audio id="myAudio"> | |||||
| <source src="{{ url('siren.mp3') }}" type="audio/mpeg"> | |||||
| Your browser does not support the audio element. | |||||
| </audio> | |||||
| <div id="map"></div> | |||||
| <div id="dataS"> | |||||
| <div class="card" style="margin-bottom: 0px"> | |||||
| <div class="card-header"> | |||||
| <h5>Senarai PenguatKuasa</h5> | |||||
| </div> | |||||
| <div class="card-block"> | |||||
| <form class="form-inline"> | |||||
| <div class="form-group" style="padding-right: 10px;"> | |||||
| <select id="pg" name="pg" class="form-control"> | |||||
| <option selected value="null">Sila pilih penguatkuasa</option> | |||||
| </select> | |||||
| </div> | |||||
| <div class="form-group"> | |||||
| <button type="button" id="tapis" class="btn btn-primary btn-sm waves-effect waves-light" style="padding: 6px 14px !important;">Tapis</button> | |||||
| </div> | |||||
| </form> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| <div id="dataEmer"> | |||||
| <button id="closeEmergency">Tutup Amaran Kecemasan</button> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| @endsection | |||||
| @section('external_js') | |||||
| @parent | |||||
| <script type="text/javascript"> | |||||
| var origin = window.location.origin; | |||||
| var param = 'null', map, infowindow, markers = [], markerStore = [], infoWindowContent = []; | |||||
| var focusCenter = '', stateMap = 'init', focus = true; | |||||
| function initialize(latit, logit) { | |||||
| infowindow = new google.maps.InfoWindow(); | |||||
| var myLatlng = new google.maps.LatLng(1.5371973,103.6602123); | |||||
| var myOptions = { | |||||
| zoom: 17, | |||||
| center: myLatlng, | |||||
| mapTypeId: google.maps.MapTypeId.TERRAIN | |||||
| } | |||||
| map = new google.maps.Map(document.getElementById("map"), myOptions); | |||||
| setMarkers(param); | |||||
| } | |||||
| // Sets the map on all markers in the array. | |||||
| function setMapOnAll(map) { | |||||
| for (var i = 0; i < markers.length; i++) { | |||||
| markers[i].setMap(map); | |||||
| } | |||||
| } | |||||
| // Removes the markers from the map, but keeps them in the array. | |||||
| function clearMarkers() { | |||||
| setMapOnAll(null); | |||||
| } | |||||
| // Shows any markers currently in the array. | |||||
| function showMarkers() { | |||||
| setMapOnAll(map); | |||||
| } | |||||
| // Deletes all markers in the array by removing references to them. | |||||
| function deleteMarkers() { | |||||
| clearMarkers(); | |||||
| markerStore = []; | |||||
| } | |||||
| function setMarkers(data){ | |||||
| var bounds = new google.maps.LatLngBounds(); | |||||
| $.ajax({ | |||||
| type: "GET", | |||||
| url: origin+"/api/track/coordinates/"+data+"/list", | |||||
| success: function(result){ | |||||
| if(result.success == true){ | |||||
| if(stateMap == 'normal' && focus == false){ | |||||
| if(map.getZoom() == 17){ | |||||
| focus = true; | |||||
| } | |||||
| } | |||||
| for(var i=0, len=result.data.length; i<len; i++) { | |||||
| var lati = parseFloat(result.data[i].latitude); | |||||
| var logi = parseFloat(result.data[i].longitude); | |||||
| var iconM = result.data[i].icon; | |||||
| //Do we have this marker already? | |||||
| if(markerStore.hasOwnProperty(result.data[i]._id)) { | |||||
| var marker = markerStore[result.data[i]._id]; | |||||
| markerStore[result.data[i]._id].setPosition(new google.maps.LatLng(lati,logi)); | |||||
| if(result.data[i].status == 'emergency'){ | |||||
| stateMap = 'emergency'; | |||||
| bounds.extend(new google.maps.LatLng(lati,logi)); | |||||
| markerStore[result.data[i]._id].setIcon(result.data[i].icon); | |||||
| markerStore[result.data[i]._id].setAnimation(google.maps.Animation.BOUNCE); | |||||
| map.fitBounds(bounds); | |||||
| }else if(result.data[i].status == 'normal'){ | |||||
| markerStore[result.data[i]._id].setIcon(result.data[i].icon); | |||||
| markerStore[result.data[i]._id].setAnimation(null); | |||||
| if(result.data[i]._id == data){ | |||||
| focusSelectionStaff(lati,logi); | |||||
| } | |||||
| } | |||||
| } else { | |||||
| var html = "<b>" + result.data[i].title + "</b> <br/>" + result.data[i].content + "<br> <a target='_blank ' href='https://www.google.com/maps/search/?api=1&query="+lati+","+logi+"'>Lihat di google map</a>"; | |||||
| var location = new google.maps.LatLng(lati, logi); | |||||
| var marker = new google.maps.Marker({ | |||||
| position: location, | |||||
| map: map, | |||||
| icon: iconM, | |||||
| }); | |||||
| markerStore[result.data[i]._id] = marker; | |||||
| google.maps.event.addListener(markerStore[result.data[i]._id], 'click', getInfoCallback(map, html), eventP()); | |||||
| } | |||||
| } | |||||
| }else if(result.success == false){ | |||||
| swal("Tiada Rekod", "Tiada data yang ditemui", "error"); | |||||
| } | |||||
| } | |||||
| }); | |||||
| } | |||||
| function getInfoCallback(map, content) { | |||||
| var infowindow = new google.maps.InfoWindow({ content: content }); | |||||
| return function () { | |||||
| infowindow.setContent(content); | |||||
| infowindow.open(map, this); | |||||
| }; | |||||
| }; | |||||
| function focusSelectionStaff(newLat,newLng) { | |||||
| map.setCenter({ | |||||
| lat : newLat, | |||||
| lng : newLng | |||||
| }); | |||||
| } | |||||
| function eventP(){ | |||||
| var passiveEvent = false; | |||||
| try { | |||||
| var opts = Object.defineProperty({}, 'passive', { | |||||
| get: function () { | |||||
| passiveEvent = true; | |||||
| } | |||||
| }); | |||||
| window.addEventListener("test", null, opts); | |||||
| } catch (e) { } | |||||
| // in my case I need both passive and capture set to true, change as you need it. | |||||
| passiveEvent = passiveEvent ? { capture: true, passive: true } : true; | |||||
| return passiveEvent; | |||||
| } | |||||
| </script> | |||||
| <script type="text/javascript"> | |||||
| var ellipsis = "..."; | |||||
| function TrimLength(text, maxLength) | |||||
| { | |||||
| text = $.trim(text); | |||||
| if (text.length > maxLength) | |||||
| { | |||||
| text = text.substring(0, maxLength - ellipsis.length) | |||||
| return text.substring(0, text.lastIndexOf(" ")) + ellipsis; | |||||
| } | |||||
| else | |||||
| return text; | |||||
| } | |||||
| $.ajaxSetup({ | |||||
| headers: { | |||||
| 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |||||
| } | |||||
| }); | |||||
| function setSelectedIndex(s, i){ | |||||
| s.options[i-1].selected = true; | |||||
| return; | |||||
| } | |||||
| function checkStateMap(audio, callback){ | |||||
| callback(param); | |||||
| setTimeout(function () { | |||||
| if(stateMap == 'emergency'){ | |||||
| $('#dataS').hide(); | |||||
| $('#dataEmer').show(); | |||||
| audio.play(); | |||||
| }else if(stateMap == 'normal'){ | |||||
| $('#dataS').show(); | |||||
| $('#dataEmer').hide(); | |||||
| audio.pause(); | |||||
| audio.currentTime = 0; | |||||
| if(focus == false){ | |||||
| param = 'null'; | |||||
| setSelectedIndex(document.getElementById("pg"),1); | |||||
| focusSelectionStaff(4.4695721,101.376383); | |||||
| map.setZoom(17); | |||||
| } | |||||
| } | |||||
| }, 5000); | |||||
| } | |||||
| function fill_staff_list(){ | |||||
| $.ajax({ | |||||
| type: "GET", | |||||
| url: "{{ url('api/track/staff/list') }}", | |||||
| success: function(result){ | |||||
| $.each(result.data, function(i, d) { | |||||
| var full_sentences = '[' + d.no_badan + '] '+ d.nama; | |||||
| $('#pg').append('<option value="' + d.id + '">' + TrimLength(full_sentences, 30) +'</option>'); | |||||
| $('#pg').prop('required',true); | |||||
| }); | |||||
| } | |||||
| }); | |||||
| } | |||||
| $(document).ready(function() { | |||||
| $('#dataEmer').hide(); | |||||
| $(".theme-loader").animate({ | |||||
| opacity: "0" | |||||
| },1000); | |||||
| setTimeout(function() { | |||||
| $(".theme-loader").remove(); | |||||
| }, 800); | |||||
| $('[data-toggle="tooltip"]').tooltip(); | |||||
| var nav = $(".pcoded-navbar").height(); | |||||
| var navbar = $(".navbar").height(); | |||||
| $('#map').css('height', $(window).height() - (nav+navbar) ); | |||||
| fill_staff_list(); | |||||
| var audio = document.getElementById("myAudio"); | |||||
| $("#tapis").click(function(){ | |||||
| var pg = $('#pg').val(); | |||||
| if(pg == 'null'){ | |||||
| focus = false; | |||||
| stateMap = 'normal'; | |||||
| }else{ | |||||
| param = pg; | |||||
| stateMap = 'init'; | |||||
| } | |||||
| $('#dataEmer').hide(); | |||||
| }); | |||||
| $("#closeEmergency").click(function(){ | |||||
| $.ajax({ | |||||
| type: "POST", | |||||
| url: origin+"/api/update/normal/status", | |||||
| success: function(result){ | |||||
| if(result.success == true){ | |||||
| focus = false; | |||||
| stateMap = 'normal'; | |||||
| }else if(result.success == false){ | |||||
| swal("Tiada Rekod", "Tiada data yang ditemui", "error"); | |||||
| } | |||||
| } | |||||
| }); | |||||
| }); | |||||
| setInterval(function() { | |||||
| checkStateMap(audio,setMarkers); | |||||
| var navbars = $("#map").width(); | |||||
| $('#map').css('height', $(window).height() - (nav+navbar) ); | |||||
| if(navbars <= 765){ | |||||
| $('#map').css('height', $(window).height() - (nav) ); | |||||
| } | |||||
| }, 4000); | |||||
| }); | |||||
| </script> | |||||
| @endsection | |||||
| @extends('layout.master', ['uid' => $user->_id, 'token' => $user->token_firebase]) | |||||
| @section('page_title', 'Halaman Utama') | |||||
| @section('sub_page_title', 'Selamat Datang ke Papan Pemuka Pegawai') | |||||
| @section('name', $user->StaffDetail->full_name) | |||||
| @section('img_profile', $user->StaffDetail->profile_img) | |||||
| @section('content') | |||||
| <style type="text/css"> | |||||
| html, body { | |||||
| height: 100% !important; | |||||
| } | |||||
| body { overflow-y:hidden !important; } | |||||
| .pcoded-inner-content { padding-left: 0px !important; padding-right: 0px !important; } | |||||
| .main-body .page-wrapper { padding: 0px !important; } | |||||
| #map { | |||||
| height: 100%; | |||||
| width: 100%; | |||||
| } | |||||
| #dataS { | |||||
| position: absolute; | |||||
| left: 10px; | |||||
| top: 0px; | |||||
| z-index: 999; | |||||
| margin: 10px 15px 0px 15px; | |||||
| border-radius: 8px 8px 0 0; | |||||
| border-bottom: 1px solid #DADCE0; | |||||
| box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 -1px 0px rgba(0,0,0,0.02); | |||||
| } | |||||
| #dataEmer { | |||||
| position: absolute; | |||||
| left: 50%; | |||||
| top: 30px; | |||||
| z-index: 999; | |||||
| margin: 10px 15px -50px 15px; | |||||
| border-radius: 8px 8px 0 0; | |||||
| border-bottom: 1px solid #DADCE0; | |||||
| box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 -1px 0px rgba(0,0,0,0.02); | |||||
| } | |||||
| .searchbox-shadow { | |||||
| box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 -1px 0px rgba(0,0,0,0.02); | |||||
| } | |||||
| #dataS .card { height: 100%; } | |||||
| @media (max-width: 765px) { | |||||
| .pcoded .pcoded-inner-content { | |||||
| padding: 0px !important; | |||||
| } | |||||
| body.horizontal-icon .pcoded .main-body, body.horizontal-icon-fixed .pcoded .main-body { | |||||
| margin-top: 0px !important; | |||||
| } | |||||
| #map { | |||||
| height: 100%; | |||||
| width: 100%; | |||||
| } | |||||
| } | |||||
| </style> | |||||
| <div class="row"> | |||||
| <div class="col-xl-12 col-md-12"> | |||||
| <audio id="myAudio"> | |||||
| <source src="{{ url('siren.mp3') }}" type="audio/mpeg"> | |||||
| Your browser does not support the audio element. | |||||
| </audio> | |||||
| <div id="map"></div> | |||||
| <div id="dataS"> | |||||
| <div class="card" style="margin-bottom: 0px"> | |||||
| <div class="card-header"> | |||||
| <h5>Senarai PenguatKuasa</h5> | |||||
| </div> | |||||
| <div class="card-block"> | |||||
| <form class="form-inline"> | |||||
| <div class="form-group" style="padding-right: 10px;"> | |||||
| <select id="pg" name="pg" class="form-control"> | |||||
| <option selected value="null">Sila pilih penguatkuasa</option> | |||||
| </select> | |||||
| </div> | |||||
| <div class="form-group"> | |||||
| <button type="button" id="tapis" class="btn btn-primary btn-sm waves-effect waves-light" style="padding: 6px 14px !important;">Tapis</button> | |||||
| </div> | |||||
| </form> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| <div id="dataEmer"> | |||||
| <button id="closeEmergency">Tutup Amaran Kecemasan</button> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| @endsection | |||||
| @section('external_js') | |||||
| @parent | |||||
| <script type="text/javascript"> | |||||
| var origin = window.location.origin; | |||||
| var param = 'null', map, infowindow, markers = [], markerStore = [], infoWindowContent = []; | |||||
| var focusCenter = '', stateMap = 'init', focus = true; | |||||
| function initialize(latit, logit) { | |||||
| infowindow = new google.maps.InfoWindow(); | |||||
| var myLatlng = new google.maps.LatLng(1.5374869,103.6612584); | |||||
| var myOptions = { | |||||
| zoom: 17, | |||||
| center: myLatlng, | |||||
| mapTypeId: google.maps.MapTypeId.TERRAIN | |||||
| } | |||||
| map = new google.maps.Map(document.getElementById("map"), myOptions); | |||||
| setMarkers(param); | |||||
| } | |||||
| // Sets the map on all markers in the array. | |||||
| function setMapOnAll(map) { | |||||
| for (var i = 0; i < markers.length; i++) { | |||||
| markers[i].setMap(map); | |||||
| } | |||||
| } | |||||
| // Removes the markers from the map, but keeps them in the array. | |||||
| function clearMarkers() { | |||||
| setMapOnAll(null); | |||||
| } | |||||
| // Shows any markers currently in the array. | |||||
| function showMarkers() { | |||||
| setMapOnAll(map); | |||||
| } | |||||
| // Deletes all markers in the array by removing references to them. | |||||
| function deleteMarkers() { | |||||
| clearMarkers(); | |||||
| markerStore = []; | |||||
| } | |||||
| function setMarkers(data){ | |||||
| var bounds = new google.maps.LatLngBounds(); | |||||
| $.ajax({ | |||||
| type: "GET", | |||||
| url: origin+"/api/track/coordinates/"+data+"/list", | |||||
| success: function(result){ | |||||
| if(result.success == true){ | |||||
| if(stateMap == 'normal' && focus == false){ | |||||
| if(map.getZoom() == 17){ | |||||
| focus = true; | |||||
| } | |||||
| } | |||||
| for(var i=0, len=result.data.length; i<len; i++) { | |||||
| var lati = parseFloat(result.data[i].latitude); | |||||
| var logi = parseFloat(result.data[i].longitude); | |||||
| var iconM = result.data[i].icon; | |||||
| //Do we have this marker already? | |||||
| if(markerStore.hasOwnProperty(result.data[i]._id)) { | |||||
| var marker = markerStore[result.data[i]._id]; | |||||
| markerStore[result.data[i]._id].setPosition(new google.maps.LatLng(lati,logi)); | |||||
| if(result.data[i].status == 'emergency'){ | |||||
| stateMap = 'emergency'; | |||||
| bounds.extend(new google.maps.LatLng(lati,logi)); | |||||
| markerStore[result.data[i]._id].setIcon(result.data[i].icon); | |||||
| markerStore[result.data[i]._id].setAnimation(google.maps.Animation.BOUNCE); | |||||
| map.fitBounds(bounds); | |||||
| }else if(result.data[i].status == 'normal'){ | |||||
| markerStore[result.data[i]._id].setIcon(result.data[i].icon); | |||||
| markerStore[result.data[i]._id].setAnimation(null); | |||||
| if(result.data[i]._id == data){ | |||||
| focusSelectionStaff(lati,logi); | |||||
| } | |||||
| } | |||||
| } else { | |||||
| var html = "<b>" + result.data[i].title + "</b> <br/>" + result.data[i].content + "<br> <a target='_blank ' href='https://www.google.com/maps/search/?api=1&query="+lati+","+logi+"'>Lihat di google map</a>"; | |||||
| var location = new google.maps.LatLng(lati, logi); | |||||
| var marker = new google.maps.Marker({ | |||||
| position: location, | |||||
| map: map, | |||||
| icon: iconM, | |||||
| }); | |||||
| markerStore[result.data[i]._id] = marker; | |||||
| google.maps.event.addListener(markerStore[result.data[i]._id], 'click', getInfoCallback(map, html), eventP()); | |||||
| } | |||||
| } | |||||
| }else if(result.success == false){ | |||||
| swal("Tiada Rekod", "Tiada data yang ditemui", "error"); | |||||
| } | |||||
| } | |||||
| }); | |||||
| } | |||||
| function getInfoCallback(map, content) { | |||||
| var infowindow = new google.maps.InfoWindow({ content: content }); | |||||
| return function () { | |||||
| infowindow.setContent(content); | |||||
| infowindow.open(map, this); | |||||
| }; | |||||
| }; | |||||
| function focusSelectionStaff(newLat,newLng) { | |||||
| map.setCenter({ | |||||
| lat : newLat, | |||||
| lng : newLng | |||||
| }); | |||||
| } | |||||
| function eventP(){ | |||||
| var passiveEvent = false; | |||||
| try { | |||||
| var opts = Object.defineProperty({}, 'passive', { | |||||
| get: function () { | |||||
| passiveEvent = true; | |||||
| } | |||||
| }); | |||||
| window.addEventListener("test", null, opts); | |||||
| } catch (e) { } | |||||
| // in my case I need both passive and capture set to true, change as you need it. | |||||
| passiveEvent = passiveEvent ? { capture: true, passive: true } : true; | |||||
| return passiveEvent; | |||||
| } | |||||
| </script> | |||||
| <script type="text/javascript"> | |||||
| var ellipsis = "..."; | |||||
| function TrimLength(text, maxLength) | |||||
| { | |||||
| text = $.trim(text); | |||||
| if (text.length > maxLength) | |||||
| { | |||||
| text = text.substring(0, maxLength - ellipsis.length) | |||||
| return text.substring(0, text.lastIndexOf(" ")) + ellipsis; | |||||
| } | |||||
| else | |||||
| return text; | |||||
| } | |||||
| $.ajaxSetup({ | |||||
| headers: { | |||||
| 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |||||
| } | |||||
| }); | |||||
| function setSelectedIndex(s, i){ | |||||
| s.options[i-1].selected = true; | |||||
| return; | |||||
| } | |||||
| function checkStateMap(audio, callback){ | |||||
| callback(param); | |||||
| setTimeout(function () { | |||||
| if(stateMap == 'emergency'){ | |||||
| $('#dataS').hide(); | |||||
| $('#dataEmer').show(); | |||||
| audio.play(); | |||||
| }else if(stateMap == 'normal'){ | |||||
| $('#dataS').show(); | |||||
| $('#dataEmer').hide(); | |||||
| audio.pause(); | |||||
| audio.currentTime = 0; | |||||
| if(focus == false){ | |||||
| param = 'null'; | |||||
| setSelectedIndex(document.getElementById("pg"),1); | |||||
| focusSelectionStaff(1.5374869,103.6612584); | |||||
| map.setZoom(17); | |||||
| } | |||||
| } | |||||
| }, 5000); | |||||
| } | |||||
| function fill_staff_list(){ | |||||
| $.ajax({ | |||||
| type: "GET", | |||||
| url: "{{ url('api/track/staff/list') }}", | |||||
| success: function(result){ | |||||
| $.each(result.data, function(i, d) { | |||||
| var full_sentences = '[' + d.no_badan + '] '+ d.nama; | |||||
| $('#pg').append('<option value="' + d.id + '">' + TrimLength(full_sentences, 30) +'</option>'); | |||||
| $('#pg').prop('required',true); | |||||
| }); | |||||
| } | |||||
| }); | |||||
| } | |||||
| $(document).ready(function() { | |||||
| $('#dataEmer').hide(); | |||||
| $(".theme-loader").animate({ | |||||
| opacity: "0" | |||||
| },1000); | |||||
| setTimeout(function() { | |||||
| $(".theme-loader").remove(); | |||||
| }, 800); | |||||
| $('[data-toggle="tooltip"]').tooltip(); | |||||
| var nav = $(".pcoded-navbar").height(); | |||||
| var navbar = $(".navbar").height(); | |||||
| $('#map').css('height', $(window).height() - (nav+navbar) ); | |||||
| fill_staff_list(); | |||||
| var audio = document.getElementById("myAudio"); | |||||
| $("#tapis").click(function(){ | |||||
| var pg = $('#pg').val(); | |||||
| if(pg == 'null'){ | |||||
| focus = false; | |||||
| stateMap = 'normal'; | |||||
| }else{ | |||||
| param = pg; | |||||
| stateMap = 'init'; | |||||
| } | |||||
| $('#dataEmer').hide(); | |||||
| }); | |||||
| $("#closeEmergency").click(function(){ | |||||
| $.ajax({ | |||||
| type: "POST", | |||||
| url: origin+"/api/update/normal/status", | |||||
| success: function(result){ | |||||
| if(result.success == true){ | |||||
| focus = false; | |||||
| stateMap = 'normal'; | |||||
| }else if(result.success == false){ | |||||
| swal("Tiada Rekod", "Tiada data yang ditemui", "error"); | |||||
| } | |||||
| } | |||||
| }); | |||||
| }); | |||||
| setInterval(function() { | |||||
| checkStateMap(audio,setMarkers); | |||||
| var navbars = $("#map").width(); | |||||
| $('#map').css('height', $(window).height() - (nav+navbar) ); | |||||
| if(navbars <= 765){ | |||||
| $('#map').css('height', $(window).height() - (nav) ); | |||||
| } | |||||
| }, 4000); | |||||
| }); | |||||
| </script> | |||||
| @endsection |