id(); $user = Staff::with('StaffDetail')->find($id); if(count($user->StaffDetail->department_ids) > 1){ $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); }else { $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first(); } $semua = $overall->total; $pre_notice = $n->total; $baru = $b->total; $invest = $pk->total; $notice = $na->total; $inven = $si->total; $collap = 0; $comp = $by->total; $site = SiteSetting::first(); $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $now = Carbon::now()->format('Y-m-d'); $modul = 'All'; return view('main-dashboard.compound.compound_index', compact('user','site','staff','deedlaw','now','modul','semua','pre_notice','baru','invest','notice','inven','collap','comp')); } public function preNoticeIndex(){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); if(count($user->StaffDetail->department_ids) > 1){ $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); }else { $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first(); } $semua = $overall->total; $pre_notice = $n->total; $baru = $b->total; $invest = $pk->total; $notice = $na->total; $inven = $si->total; $collap = 0; $comp = $by->total; $site = SiteSetting::first(); $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $now = Carbon::now()->format('Y-m-d'); $modul = '02'; return view('main-dashboard.compound.prenotice_index', compact('user','site','staff','deedlaw','now','modul','semua','pre_notice','baru','invest','notice','inven','collap','comp')); } public function new_index(){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); if(count($user->StaffDetail->department_ids) > 1){ $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); }else { $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first(); } $semua = $overall->total; $pre_notice = $n->total; $baru = $b->total; $invest = $pk->total; $notice = $na->total; $inven = $si->total; $collap = 0; $comp = $by->total; $site = SiteSetting::first(); $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $now = Carbon::now()->format('Y-m-d'); $modul = '03'; return view('main-dashboard.compound.new_index', compact('user','site','staff','deedlaw','now','modul','semua','pre_notice','baru','invest','notice','inven','collap','comp')); } public function investigation_index(){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); if(count($user->StaffDetail->department_ids) > 1){ $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); }else { $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first(); } $semua = $overall->total; $pre_notice = $n->total; $baru = $b->total; $invest = $pk->total; $notice = $na->total; $inven = $si->total; $collap = 0; $comp = $by->total; $site = SiteSetting::first(); $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $now = Carbon::now()->format('Y-m-d'); $modul = '04'; return view('main-dashboard.compound.investigation_index', compact('user','site','staff','deedlaw','now','modul','semua','pre_notice','baru','invest','notice','inven','collap','comp')); } public function notice_index(){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); if(count($user->StaffDetail->department_ids) > 1){ $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); }else { $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first(); } $semua = $overall->total; $pre_notice = $n->total; $baru = $b->total; $invest = $pk->total; $notice = $na->total; $inven = $si->total; $collap = 0; $comp = $by->total; $site = SiteSetting::first(); $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $now = Carbon::now()->format('Y-m-d'); $modul = '05'; return view('main-dashboard.compound.notice_index', compact('user','site','staff','deedlaw','now','modul','semua','pre_notice','baru','invest','notice','inven','collap','comp')); } public function confiscated_index(){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); if(count($user->StaffDetail->department_ids) > 1){ $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); }else { $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first(); } $semua = $overall->total; $pre_notice = $n->total; $baru = $b->total; $invest = $pk->total; $notice = $na->total; $inven = $si->total; $collap = 0; $comp = $by->total; $site = SiteSetting::first(); $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $now = Carbon::now()->format('Y-m-d'); $modul = '06-07'; return view('main-dashboard.compound.confiscated_index', compact('user','site','staff','deedlaw','now','modul','semua','pre_notice','baru','invest','notice','inven','collap','comp')); } public function collapsed_index(){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); if(count($user->StaffDetail->department_ids) > 1){ $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); }else { $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first(); } $semua = $overall->total; $pre_notice = $n->total; $baru = $b->total; $invest = $pk->total; $notice = $na->total; $inven = $si->total; $collap = 0; $comp = $by->total; $site = SiteSetting::first(); $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $faulty = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); return view('main-dashboard.compound.collapsed_index', compact('user','site','staff','faulty','pre_notice','baru','invest','notice','inven','collap','comp')); } public function completed_index(){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); if(count($user->StaffDetail->department_ids) > 1){ $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); }else { $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first(); $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first(); } $semua = $overall->total; $pre_notice = $n->total; $baru = $b->total; $invest = $pk->total; $notice = $na->total; $inven = $si->total; $collap = 0; $comp = $by->total; $site = SiteSetting::first(); $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get(); $now = Carbon::now()->format('Y-m-d'); $modul = 'All'; return view('main-dashboard.compound.completed_index', compact('user','site','staff','deedlaw','now','modul','semua', 'pre_notice','baru','invest','notice','inven','collap','comp')); } public function viewCompoundHistoryDetail($kpd){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->orWhere('non',$kpd)->first(); if(empty($compound)) { $kpd = (int)$kpd; $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->orWhere('non',$kpd)->first(); } $file = ConfidentialFile::with('History','History.SubHistory')->where('no_siri',$compound->ConfidentialFile->no_siri)->first(); $role = Roles::where('kod',$file->modul)->first(); $site = SiteSetting::first(); return view('main-dashboard.compound_detail.history_detail', compact('user','compound','file','role','site')); } public function viewCompoundDetail($kpd){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->orWhere('non',$kpd)->first(); $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first(); $faulty = Faulty::with('DeedLaw','Department')->where('_id',$compound->seksyen_kesalahan)->first(); $role = Roles::where('kod',$compound->modul)->first(); $enforcer = ''; $site = SiteSetting::first(); $enforcer = Staff::with('StaffDetail')->where('_id',$compound->dikeluarkan)->first(); return view('main-dashboard.compound_detail.compound_detail', compact('user','compound','file','faulty','role','enforcer','site')); } public function viewCompoundMemoDetail($kpd){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first(); $roles = Roles::all(); $role = Roles::where('kod',$compound->modul)->first(); $site = SiteSetting::first(); return view('main-dashboard.compound_detail.memo_detail', compact('user','compound','file','roles','role','site')); } public function viewCompoundEditMemoDetail($kpd, $memo){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first(); $memo = Memo::where('_id',$memo)->first(); $roles = Roles::all(); $role = Roles::where('kod',$compound->modul)->first(); $site = SiteSetting::first(); return view('main-dashboard.compound_detail.compound_memo_edit', compact('user','compound','file','roles','role','memo','site')); } public function viewCompoundInvestigationDetail($kpd){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); $investigation = Compound::with('CompoundInvestigation')->where('kpd',$kpd)->first(); $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first(); $faulty = Faulty::where('_id',$compound->seksyen_kesalahan)->first(); $akta = DeedLaw::where('akkod',$faulty->akkod)->first(); $role = Roles::where('kod',$compound->modul)->first(); $total = ''; $enforcer = ''; if($compound->jumlah_kemaskini_kompaun == ''){ $total = $compound->jumlah_asal_kompaun; }else{ $total = $compound->jumlah_kemaskini_kompaun; } $site = SiteSetting::first(); $enforcer = Staff::with('StaffDetail')->where('_id',$compound->dikeluarkan)->first(); return view('main-dashboard.compound_detail.investigation_detail', compact('user','compound','investigation','file','akta','faulty','role','total','enforcer','site')); } public function viewCompoundNoticeDetail($kpd){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first(); $role = Roles::where('kod',$compound->modul)->first(); $site = SiteSetting::first(); return view('main-dashboard.compound_detail.notice_detail', compact('user','compound','file','role','site')); } public function viewCompoundInventoryDetail($kpd){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first(); $role = Roles::where('kod',$compound->modul)->first(); $site = SiteSetting::first(); return view('main-dashboard.compound_detail.inventory_detail', compact('user','compound','file','role','site')); } public function viewCompoundAuctionDetail($kpd){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first(); $role = Roles::where('kod',$compound->modul)->first(); $site = SiteSetting::first(); return view('main-dashboard.compound_detail.auction_detail', compact('user','compound','file','role','site')); } public function viewTaskIndex($kpd){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->orWhere('non', $kpd)->first(); $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first(); $staffs = StaffDetail::where('roles_access','PenguatKuasa')->where('department_ids',$compound->jbkod)->get(); $roles = Roles::get(); $role = Roles::where('kod',$compound->modul)->first(); $department = Department::get(); $site = SiteSetting::first(); $currentS = ''; $s = StaffDetail::where('roles_access','PenguatKuasa')->where('_id',$compound->penguatkuasa)->first(); if(!empty($s)){ $currentS = '['.$s->no_badan.'] '.$s->full_name; } return view('main-dashboard.compound_detail.compound_job',compact('user','compound','file','roles','staffs','role','department','currentS','site')); } public function manualCompound(){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $site = SiteSetting::first(); $faulty = Faulty::with('DeedLaw','Department')->get(); $staff = StaffDetail::where('roles_access','PenguatKuasa')->get(); $kawasan = CodeMukim::select('JLN_MKKOD', 'MKM_MNAMA')->groupBy('JLN_MKKOD')->get(); $taman = CodeMukim::select('JLN_KWKOD','KWS_KNAMA')->groupBy('JLN_KWKOD')->get(); $jalan = CodeMukim::all(); return view('main-dashboard.compound.compound_form',compact('user','site','faulty','staff', 'kawasan', 'taman', 'jalan')); } /** * Create generate kpd number controller. * * @return value */ public function generateKPD(){ $count = 0; do { $count = Compound::count(); $count = $count + 1; } while (Compound::where("kpd", "=", 'KP'.$count)->first() instanceof Compound); return $count; } // public function storemanualCompound(Request $request){ // $id = Auth::guard('sadmin')->id(); // $user = Staff::with('StaffDetail')->find($id); // $compound = Compound::where('kpd', $request->kpd)->first(); // if(empty($compound)){ // $faulty = Faulty::where('_id',$request->get('seksyen'))->first(); // if(!empty($faulty)){ // $kpd = $request->kpd; // $no_siri = date('yn',strtotime($request->tarikh_dikeluarkan)).'-'.$kpd; // $fileData = [ // 'no_siri' => $no_siri, // ]; // if($request->jenisKompaun == 'Parkir'){ // $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_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' => $request->staff, // "status" => 'Belum Bayar', // "amount_payment" => '', // "receipt" => '', // "modul" => '03', // "penguatkuasa" => '', // "created_at" => new Carbon($request->tarikh_dikeluarkan), // ]; // }else if($request->jenisKompaun == 'Pelbagai_KT'){ // $compoundData = [ // 'jenis' => 'Pelbagai_KT', // 'kpd' => $kpd, // 'nama' => $request->namaP, // 'identity' => $request->noIc, // 'nama_syarikat' => $request->namaS, // 'no_daftar_syarikat' => strtolower($request->daftarNo), // 'alamat' => $request->alamat, // 'no_telefon' => $request->tel, // 'no_akaun_lesen' =>$request->lesen, // "no_plate" => strtolower($request->no_plate), // "no_cukai_jalan" => $request->noCukaijalan, // // "maklumat_tambahan" => $request->catatan, // "catatan" => $request->catatan, // "lokasi_kejadian" => $request->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' => $request->staff, // "status" => 'Belum Bayar', // "amount_payment" => '', // "receipt" => '', // "modul" => '03', // "penguatkuasa" => '', // "created_at" => new Carbon($request->tarikh_dikeluarkan), // ]; // }else if($request->jenisKompaun == 'Pelbagai_JPB'){ // $compoundData = [ // 'jenis' => 'Pelbagai_JPB', // 'kpd' => $kpd, // 'nama' => $request->namaP, // 'identity' => $request->noIc, // 'nama_syarikat' => $request->namaS, // 'no_daftar_syarikat' => strtolower($request->daftarNo), // 'alamat' => $request->alamat, // 'no_telefon' => $request->tel, // 'no_akaun_lesen' =>$request->lesen, // "no_plate" => strtolower($request->no_plate), // "no_cukai_jalan" => $request->noCukaijalan, // // "maklumat_tambahan" => $request->catatan, // "catatan" => $request->catatan, // "lokasi_kejadian" => $request->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' => $request->staff, // "status" => 'Belum Bayar', // "amount_payment" => '', // "receipt" => '', // "modul" => '03', // "penguatkuasa" => '', // "created_at" => new Carbon($request->tarikh_dikeluarkan), // ]; // }else if($request->jenisKompaun == 'Pelbagai_PA'){ // $compoundData = [ // 'jenis' => 'Pelbagai_PA', // 'kpd' => $kpd, // 'nama' => $request->namaP, // 'identity' => $request->noIc, // 'nama_syarikat' => $request->namaS, // 'no_daftar_syarikat' => strtolower($request->daftarNo), // 'alamat' => $request->alamat, // 'no_telefon' => $request->tel, // 'no_akaun_lesen' =>$request->lesen, // "no_plate" => strtolower($request->no_plate), // "no_cukai_jalan" => $request->noCukaijalan, // // "maklumat_tambahan" => $request->catatan, // "catatan" => $request->catatan, // "lokasi_kejadian" => $request->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' => $request->staff, // "status" => 'Belum Bayar', // "amount_payment" => '', // "receipt" => '', // "modul" => '03', // "penguatkuasa" => '', // "created_at" => new Carbon($request->tarikh_dikeluarkan), // ]; // }else if($request->jenisKompaun == 'Pelbagai_LESEN'){ // $compoundData = [ // 'jenis' => 'Pelbagai_LESEN', // 'kpd' => $kpd, // 'nama' => $request->namaP, // 'identity' => $request->noIc, // 'nama_syarikat' => $request->namaS, // 'no_daftar_syarikat' => strtolower($request->daftarNo), // 'alamat' => $request->alamat, // 'no_telefon' => $request->tel, // 'no_akaun_lesen' =>$request->lesen, // "no_plate" => strtolower($request->no_plate), // "no_cukai_jalan" => $request->noCukaijalan, // // "maklumat_tambahan" => $request->catatan, // "catatan" => $request->catatan, // "lokasi_kejadian" => $request->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' => $request->staff, // "status" => 'Belum Bayar', // "amount_payment" => '', // "receipt" => '', // "modul" => '03', // "penguatkuasa" => '', // "created_at" => new Carbon($request->tarikh_dikeluarkan), // ]; // } // $file = ConfidentialFile::create($fileData); // $saved = $file->compound()->create($compoundData); // if($saved){ // $this->dispatch(new StoreCompoundManual($request->all(), $kpd, $request->staff, $no_siri)); // return redirect()->back()->with('success_msg', 'Berjaya simpan rekod kompaun!'); // } // }else{ // return redirect()->back()->withInput()->with('error_msg', 'Tidak Berjaya! Rekod seksyen kesalahan tidak ditemui!'); // } // }else{ // return redirect()->back()->withInput()->with('error_msg', 'Tidak Berjaya! Rekod kompaun '.$request->kpd.' telah wujud!'); // } // } public function storemanualCompound(Request $request){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $compound = Compound::where('kpd', $request->kpd)->first(); if(empty($compound)){ $faulty = Faulty::where('_id',$request->get('seksyen'))->first(); $jabatan = Department::where('jnama', $request->jabatan)->first(); if(!empty($faulty) && !empty($jabatan)){ $kpd = $request->kpd; $no_siri = ''; $compoundData = []; $created_c = new Carbon($request->tarikh_dikeluarkan); if($request->jenisKompaun == 'Parkir') { //for compound numbering // $countKPD = $this->compound->where('jenis','Parkir')->withTrashed()->count(); // $kpd = 'KPD'.$countKPD; $no_siri = date('yn',strtotime($request->tarikh_dikeluarkan)).'-'.$kpd.'-0K'; //only for compound parkir $compoundData = [ 'jenis' => 'Parkir', 'kpd' => strtoupper($request->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' => $jabatan->_id, 'akta' => $faulty->deed_law_id, 'seksyen_kesalahan' => $faulty->_id, 'jumlah_asal_kompaun' => $faulty->amount, 'jumlah_kemaskini_kompaun' => '-', 'dikeluarkan' => $user->_id, "status" => 'Belum Bayar', "amount_payment" => '-', "receipt" => '-', "modul" => '03', "penguatkuasa" => '-', "created_c" => $created_c->toDateTimeString(), "created_at" => new Carbon($request->tarikh_dikeluarkan), ]; } elseif ($request->jenisKompaun == 'Pelbagai_KT') { // $kpd = $this->generateNumber($request->jenis, 'KT', '03'); $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-1K'; $compoundData = [ 'jenis' => $request->jenisKompaun, 'kpd' => strtoupper($request->kpd), 'nama' => $request->namaP, 'identity' => $request->noIc, 'nama_syarikat' => $request->namaS, 'no_daftar_syarikat' => strtolower($request->daftarNo), 'alamat' => $request->alamat, "lokasi_kejadian" => $request->lokasi_kejadian, "nama_kawasan" => $request->namaKawasan, "nama_taman" => $request->namaTaman, "nama_jalan" => $request->namaJalan, 'latlong' => $request->Latlong, 'jbkod' => $jabatan->_id, 'akta' => $faulty->deed_law_id, 'seksyen_kesalahan' => $faulty->_id, 'butiran_kesalahan' => $request->butiran_kesalahan, 'jumlah_asal_kompaun' => $faulty->amount, 'jumlah_kemaskini_kompaun' => '-', 'dikeluarkan' => $user->_id, "status" => 'Belum Bayar', "amount_payment" => '-', "receipt" => '-', "modul" => '03', "penguatkuasa" => '-', "no_akaun_lesen" => $request->lesen, "created_c" => $created_c->toDateTimeString(), "created_at" => new Carbon($request->tarikh_dikeluarkan), ]; } elseif ($request->jenisKompaun == 'Pelbagai_JPB') { // $kpd = $this->generateNumber($request->jenis, 'JPB', '03'); $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-2K'; $compoundData = [ 'jenis' => $request->jenisKompaun, 'kpd' => strtoupper($request->kpd), 'nama' => $request->namaP, 'identity' => $request->noIc, 'nama_syarikat' => $request->namaS, 'no_daftar_syarikat' => strtolower($request->daftarNo), 'alamat' => $request->alamat, "lokasi_kejadian" => $request->lokasi_kejadian, "nama_kawasan" => $request->namaKawasan, "nama_taman" => $request->namaTaman, "nama_jalan" => $request->namaJalan, 'latlong' => $request->Latlong, 'jbkod' => $jabatan->_id, 'akta' => $faulty->deed_law_id, 'seksyen_kesalahan' => $faulty->_id, 'butiran_kesalahan' => $request->butiran_kesalahan, 'jumlah_asal_kompaun' => $faulty->amount, 'jumlah_kemaskini_kompaun' => '-', 'dikeluarkan' => $user->_id, "status" => 'Belum Bayar', "amount_payment" => '-', "receipt" => '-', "modul" => '03', "penguatkuasa" => '-', "no_akaun_lesen" => $request->lesen, "created_c" => $created_c->toDateTimeString(), "created_at" => new Carbon($request->tarikh_dikeluarkan), ]; } $fileData = [ 'no_siri' => $no_siri, ]; $file = ConfidentialFile::create($fileData); $saved = $file->compound()->create($compoundData); if($saved){ $this->dispatch(new StoreCompoundManual($request->all(), $kpd, $request->staff, $no_siri)); // $this->dispatch(new StoreCompoundEPBT($request->all(), $kpd, $user->StaffDetail->full_name, $user->StaffDetail->no_badan, $faulty->nama)); return redirect()->back()->with('success_msg', 'Berjaya simpan rekod kompaun!'); } }else{ return redirect()->back()->withInput()->with('error_msg', 'Tidak Berjaya! Rekod jabatan / seksyen kesalahan tidak ditemui!'); } }else{ return redirect()->back()->withInput()->with('error_msg', 'Tidak Berjaya! Rekod kompaun '.$request->kpd.' telah wujud!'); } } public function manualCompoundEdit($_id){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $site = SiteSetting::first(); $faulty = Faulty::with('DeedLaw','Department')->get(); $staff = StaffDetail::where('roles_access','PenguatKuasa')->get(); $compound = Compound::with('Faulty','Department','Deedlaw')->find($_id); $jalan = CodeMukim::all(); return view('main-dashboard.compound.compound_form_edit',compact('user','site','faulty','staff','compound', 'jalan')); } public function editmanualCompound(Request $request){ $id = Auth::guard('sadmin')->id(); $user = Staff::with('StaffDetail')->find($id); $compound = Compound::find($request->_id); if(!empty($compound)){ $faulty = Faulty::with('DeedLaw','Department')->where('_id',$request->get('seksyen'))->first(); if(!empty($faulty) && !empty($faulty->Deedlaw) && !empty($faulty->Department)){ if($compound->jenis == 'Parkir'){ $compound->kpd = $request->kpd; $compound->jbkod = $faulty->Department[0]->_id; $compound->akta = $faulty->DeedLaw->_id; $compound->seksyen_kesalahan = $faulty->_id; $compound->no_plate = strtolower($request->no_plate); $compound->no_cukai_jalan = $request->noCukaijalan; $compound->jenis_kenderaan = $request->jenisKenderaan; $compound->model_kenderaan = $request->modelKenderaan; $compound->warna_kenderaan = $request->warnakenderaan; $compound->nama_taman = $request->namaTaman; $compound->nama_jalan = $request->namaJalan; $compound->no_parking = $request->noParking; $compound->maklumat_tambahan = $request->catatan; $compound->catatan = $request->butiran_kesalahan; $compound->lokasi_kejadian = $request->lokasi_kejadian; $compound->created_at = new Carbon($request->tarikh_dikeluarkan); $compound->save(); return redirect()->back()->with('success_msg', 'Berjaya kemasikini!'); }else if($compound->jenis == 'Pelbagai_KT'){ $compound->kpd = $request->kpd; $compound->jbkod = $faulty->Department[0]->_id; $compound->akta = $faulty->DeedLaw->_id; $compound->seksyen_kesalahan = $faulty->_id; $compound->nama = $request->namaP; $compound->identity = $request->noIc; $compound->nama_syarikat = $request->namaS; $compound->no_daftar_syarikat = strtolower($request->daftarNo); $compound->alamat = $request->alamat; $compound->no_telefon = $request->tel; $compound->no_akaun_lesen = $request->lesen; $compound->no_plate = strtolower($request->no_plate); $compound->no_cukai_jalan = $request->noCukaijalan; $compound->no_plate = strtolower($request->no_plate); $compound->maklumat_tambahan = $request->catatan; $compound->catatan = $request->butiran_kesalahan; $compound->lokasi_kejadian = $request->lokasi_kejadian; $compound->created_at = new Carbon($request->tarikh_dikeluarkan); $compound->save(); return redirect()->back()->with('success_msg', 'Berjaya kemasikini!'); }else if($compound->jenis == 'Pelbagai_JPB'){ $compound->kpd = $request->kpd; $compound->jbkod = $faulty->Department[0]->_id; $compound->akta = $faulty->DeedLaw->_id; $compound->seksyen_kesalahan = $faulty->_id; $compound->nama = $request->namaP; $compound->identity = $request->noIc; $compound->nama_syarikat = $request->namaS; $compound->no_daftar_syarikat = strtolower($request->daftarNo); $compound->alamat = $request->alamat; $compound->no_telefon = $request->tel; $compound->no_akaun_lesen = $request->lesen; $compound->no_plate = strtolower($request->no_plate); $compound->no_cukai_jalan = $request->noCukaijalan; $compound->no_plate = strtolower($request->no_plate); $compound->maklumat_tambahan = $request->catatan; $compound->catatan = $request->butiran_kesalahan; $compound->lokasi_kejadian = $request->lokasi_kejadian; $compound->created_at = new Carbon($request->tarikh_dikeluarkan); $compound->save(); return redirect()->back()->with('success_msg', 'Berjaya kemasikini!'); } }else { return redirect()->back()->withInput()->with('error_msg', 'Tidak Berjaya! Rekod seksyen kesalahan tidak ditemui!'); } }else{ return redirect()->back()->withInput()->with('error_msg', 'Tidak Berjaya! Rekod kompaun '.$request->kpd.' tidak wujud!'); } } }