| @@ -24,6 +24,7 @@ use App\Model\Module\History; | |||
| use App\Model\Module\SubHistory; | |||
| use App\Model\Module\Memo; | |||
| use App\Model\Module\Attachment; | |||
| use App\Model\Module\ReportOverallCompound; | |||
| use App\Jobs\StoreCompound; | |||
| use App\Jobs\StoreCompoundManual; | |||
| @@ -41,84 +42,219 @@ class CompoundController extends Controller | |||
| $id = Auth::guard('sadmin')->id(); | |||
| $user = Staff::with('StaffDetail')->find($id); | |||
| $baru = count(Compound::where('modul','03')->where('status','Belum Bayar')->get()); | |||
| $invest = count(Compound::where('modul','04')->where('status','Belum Bayar')->get()); | |||
| $notice = count(Compound::where('modul','05')->where('status','Belum Bayar')->get()); | |||
| $inven = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get()); | |||
| $collap = count(Compound::where('modul','08')->where('status','Belum Bayar')->get()); | |||
| $comp = count(Compound::where('status','Berbayar')->get()); | |||
| // $department = Department::all(); | |||
| if(count($user->StaffDetail->department_ids) > 1){ | |||
| $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->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(); | |||
| $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; | |||
| $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')->get(); | |||
| $faulty = Deedlaw::with('Faulty')->get(); | |||
| return view('main-dashboard.compound.compound_index', compact('user','site','staff','faulty','baru','invest','notice','inven','collap','comp')); | |||
| $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','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(); | |||
| $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(); | |||
| $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; | |||
| $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','baru','invest','notice','inven','collap','comp')); | |||
| } | |||
| public function investigation_index(){ | |||
| $id = Auth::guard('sadmin')->id(); | |||
| $user = Staff::with('StaffDetail')->find($id); | |||
| $baru = count(Compound::where('modul','03')->where('status','Belum Bayar')->get()); | |||
| $invest = count(Compound::where('modul','04')->where('status','Belum Bayar')->get()); | |||
| $notice = count(Compound::where('modul','05')->where('status','Belum Bayar')->get()); | |||
| $inven = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get()); | |||
| $collap = count(Compound::where('modul','08')->where('status','Belum Bayar')->get()); | |||
| $comp = count(Compound::where('status','Berbayar')->get()); | |||
| // $department = Department::all(); | |||
| if(count($user->StaffDetail->department_ids) > 1){ | |||
| $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->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(); | |||
| $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; | |||
| $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')->get(); | |||
| $faulty = Deedlaw::with('Faulty')->get(); | |||
| return view('main-dashboard.compound.investigation_index', compact('user','site','staff','faulty','baru','invest','notice','inven','collap','comp')); | |||
| $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','baru','invest','notice','inven','collap','comp')); | |||
| } | |||
| public function notice_index(){ | |||
| $id = Auth::guard('sadmin')->id(); | |||
| $user = Staff::with('StaffDetail')->find($id); | |||
| $baru = count(Compound::where('modul','03')->where('status','Belum Bayar')->get()); | |||
| $invest = count(Compound::where('modul','04')->where('status','Belum Bayar')->get()); | |||
| $notice = count(Compound::where('modul','05')->where('status','Belum Bayar')->get()); | |||
| $inven = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get()); | |||
| $collap = count(Compound::where('modul','08')->where('status','Belum Bayar')->get()); | |||
| $comp = count(Compound::where('status','Berbayar')->get()); | |||
| // $department = Department::all(); | |||
| if(count($user->StaffDetail->department_ids) > 1){ | |||
| $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->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(); | |||
| $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; | |||
| $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')->get(); | |||
| $faulty = Deedlaw::with('Faulty')->get(); | |||
| return view('main-dashboard.compound.notice_index', compact('user','site','staff','faulty','baru','invest','notice','inven','collap','comp')); | |||
| $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','baru','invest','notice','inven','collap','comp')); | |||
| } | |||
| public function confiscated_index(){ | |||
| $id = Auth::guard('sadmin')->id(); | |||
| $user = Staff::with('StaffDetail')->find($id); | |||
| $baru = count(Compound::where('modul','03')->where('status','Belum Bayar')->get()); | |||
| $invest = count(Compound::where('modul','04')->where('status','Belum Bayar')->get()); | |||
| $notice = count(Compound::where('modul','05')->where('status','Belum Bayar')->get()); | |||
| $inven = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get()); | |||
| $collap = count(Compound::where('modul','08')->where('status','Belum Bayar')->get()); | |||
| $comp = count(Compound::where('status','Berbayar')->get()); | |||
| // $department = Department::all(); | |||
| if(count($user->StaffDetail->department_ids) > 1){ | |||
| $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->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(); | |||
| $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; | |||
| $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')->get(); | |||
| $faulty = Deedlaw::with('Faulty')->get(); | |||
| return view('main-dashboard.compound.confiscated_index', compact('user','site','staff','faulty','baru','invest','notice','inven','collap','comp')); | |||
| $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','baru','invest','notice','inven','collap','comp')); | |||
| } | |||
| public function collapsed_index(){ | |||
| $id = Auth::guard('sadmin')->id(); | |||
| $user = Staff::with('StaffDetail')->find($id); | |||
| $baru = count(Compound::where('modul','03')->where('status','Belum Bayar')->get()); | |||
| $invest = count(Compound::where('modul','04')->where('status','Belum Bayar')->get()); | |||
| $notice = count(Compound::where('modul','05')->where('status','Belum Bayar')->get()); | |||
| $inven = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get()); | |||
| $collap = count(Compound::where('modul','08')->where('status','Belum Bayar')->get()); | |||
| $comp = count(Compound::where('status','Berbayar')->get()); | |||
| // $department = Department::all(); | |||
| if(count($user->StaffDetail->department_ids) > 1){ | |||
| $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->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(); | |||
| $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; | |||
| $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')->get(); | |||
| $faulty = Deedlaw::with('Faulty')->get(); | |||
| $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','baru','invest','notice','inven','collap','comp')); | |||
| } | |||
| @@ -126,19 +262,40 @@ class CompoundController extends Controller | |||
| $id = Auth::guard('sadmin')->id(); | |||
| $user = Staff::with('StaffDetail')->find($id); | |||
| $baru = count(Compound::where('modul','03')->where('status','Belum Bayar')->get()); | |||
| $invest = count(Compound::where('modul','04')->where('status','Belum Bayar')->get()); | |||
| $notice = count(Compound::where('modul','05')->where('status','Belum Bayar')->get()); | |||
| $inven = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get()); | |||
| $collap = count(Compound::where('modul','08')->where('status','Belum Bayar')->get()); | |||
| $comp = count(Compound::where('status','Berbayar')->get()); | |||
| // $department = Department::all(); | |||
| if(count($user->StaffDetail->department_ids) > 1){ | |||
| $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->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(); | |||
| $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; | |||
| $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')->get(); | |||
| $faulty = Deedlaw::with('Faulty')->get(); | |||
| return view('main-dashboard.compound.completed_index', compact('user','site','staff','faulty','baru','invest','notice','inven','collap','comp')); | |||
| $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','baru','invest','notice','inven','collap','comp')); | |||
| } | |||
| public function viewCompoundHistoryDetail($kpd){ | |||
| $id = Auth::guard('sadmin')->id(); | |||
| $user = Staff::with('StaffDetail')->find($id); | |||
| @@ -153,7 +310,7 @@ class CompoundController extends Controller | |||
| public function viewCompoundDetail($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(); | |||
| $faulty = Faulty::with(['DeedLaw' => function($q){ | |||
| @@ -419,48 +576,57 @@ class CompoundController extends Controller | |||
| $compound = Compound::find($request->_id); | |||
| if(!empty($compound)){ | |||
| if($compound->jenis == 'Parkir'){ | |||
| // $compound->kpd = $request->kpd; | |||
| $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(); | |||
| $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'){ | |||
| $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'){ | |||
| // $compound->kpd = $request->kpd; | |||
| $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!'); | |||
| return redirect()->back()->with('success_msg', 'Berjaya kemasikini!'); | |||
| } | |||
| }else { | |||
| return redirect()->back()->withInput()->with('error_msg', '<strong>Tidak Berjaya!</strong> Rekod seksyen kesalahan tidak ditemui!'); | |||
| } | |||
| }else{ | |||
| return redirect()->back()->withInput()->with('error_msg', '<strong>Tidak Berjaya!</strong> Rekod kompaun '.$request->kpd.' tidak wujud!'); | |||
| } | |||