1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030 |
- <?php
-
- namespace App\Http\Controllers\Main;
-
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- use Illuminate\Support\Facades\Auth;
-
- use Carbon\Carbon;
-
- use App\SiteSetting;
- use App\Model\Staff;
- use App\Model\StaffDetail;
- use App\Model\User;
- use App\Model\UserDetail;
- use App\Model\Module\Roles;
- use App\Model\Module\Department;
- use App\Model\Module\DeedLaw;
- use App\Model\Module\Faulty;
- use App\Model\Module\Compound;
- use App\Model\Module\CodeMukim;
- use App\Model\Module\CompoundInvestigation;
- 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\Model\Module\ReportOverallCompound;
-
- use App\Jobs\StoreCompound;
- use App\Jobs\StoreCompoundManual;
- use App\Jobs\StoreCompoundEPBT;
- use App\Jobs\UpdateCompoundPrice;
-
- class CompoundController extends Controller
- {
- /**
- * Create compound list interface controller.
- *
- * @return json
- */
-
- public function 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.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', '<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.' 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', '<strong>Tidak Berjaya!</strong> Rekod jabatan / seksyen kesalahan tidak ditemui!');
- }
-
- }else{
-
- return redirect()->back()->withInput()->with('error_msg', '<strong>Tidak Berjaya!</strong> 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', 'faultyNotis', 'deedlawNotis')->find($_id);
- $jalan = CodeMukim::all();
-
- if($compound->modul == '02'){
- return view('main-dashboard.notice.notice_form_edit',compact('user','site','faulty','staff','compound', 'jalan'));
- }
- else{
- 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)){
-
- $tarikh_dikeluarkan = new Carbon($request->tarikh_dikeluarkan);
- $jalan = CodeMukim::where('_id', $request->namaJalan)->first();
- 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 = $jalan->JLN_JNAMA;
- $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->butiran_kesalahan = $request->butiran_kesalahan;
- $compound->seksyen_kesalahan = $faulty->_id;
- $compound->akta = $faulty->DeedLaw->_id;
- $compound->jbkod = $faulty->Department[0]->_id;
- $compound->nama = $request->namaP;
- $compound->identity = $request->noIc;
- $compound->alamat = $request->alamat;
- $compound->nama_syarikat = $request->namaS;
- $compound->no_daftar_syarikat = strtolower($request->daftarNo);
- $compound->no_akaun_lesen = $request->lesen;
- $compound->lokasi_kejadian = $request->lokasi_kejadian;
- $compound->nama_jalan = $jalan->JLN_JNAMA;
- $compound->nama_taman = $request->namaTaman;
- $compound->nama_kawasan = $request->namaKawasan;
- $compound->dikeluarkan = $request->staff;
- $compound->created_c = $tarikh_dikeluarkan->toDateTimeString();
- $compound->save();
-
- // return redirect()->back()->with('success_msg', 'Berjaya kemasikini!');
-
- }else if($compound->jenis == 'Pelbagai_JPB'){
- $compound->kpd = $request->kpd;
- $compound->butiran_kesalahan = $request->butiran_kesalahan;
- $compound->seksyen_kesalahan = $faulty->_id;
- $compound->akta = $faulty->DeedLaw->_id;
- $compound->jbkod = $faulty->Department[0]->_id;
- $compound->nama = $request->namaP;
- $compound->identity = $request->noIc;
- $compound->alamat = $request->alamat;
- $compound->nama_syarikat = $request->namaS;
- $compound->no_daftar_syarikat = strtolower($request->daftarNo);
- $compound->no_akaun_lesen = $request->lesen;
- $compound->lokasi_kejadian = $request->lokasi_kejadian;
- $compound->nama_jalan = $jalan->JLN_JNAMA;
- $compound->nama_taman = $request->namaTaman;
- $compound->nama_kawasan = $request->namaKawasan;
- $compound->dikeluarkan = $request->staff;
- $compound->created_c = $tarikh_dikeluarkan->toDateTimeString();
- $compound->save();
-
- // return redirect()->back()->with('success_msg', 'Berjaya kemasikini!');
- }
-
- if($compound->modul == '03')
- {
- // $this->dispatch(new StoreCompoundEPBT($request->all(), $kpd, $staff->StaffDetail->full_name, $staff->StaffDetail->no_badan, $faulty->nama));
-
- 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!');
- }
-
- }
-
- public function editmanualNotice(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();
- $jalan = CodeMukim::where('_id', $request->namaJalan)->first();
-
- if(!empty($faulty) && !empty($faulty->Deedlaw) && !empty($faulty->Department)){
-
- $tarikh_dikeluarkan = new Carbon($request->tarikh_dikeluarkan);
-
- $compound->non = $request->non;
- $compound->butiran_kesalahan_n = $request->butiran_kesalahan;
- $compound->seksyen_kesalahan_n = $faulty->_id;
- $compound->akta_n = $faulty->DeedLaw->_id;
- $compound->jbkod = $faulty->Department[0]->_id;
- $compound->nama = $request->namaP;
- $compound->identity = $request->noIc;
- $compound->alamat = $request->alamat;
- $compound->nama_syarikat = $request->namaS;
- $compound->no_daftar_syarikat = strtolower($request->daftarNo);
- $compound->no_akaun_lesen = $request->lesen;
- $compound->lokasi_kejadian = $request->lokasi_kejadian;
- $compound->nama_jalan = $jalan->JLN_JNAMA;
- $compound->nama_taman = $request->namaTaman;
- $compound->nama_kawasan = $request->namaKawasan;
- $compound->dikeluarkan_n = $request->staff;
- $compound->created_n = $tarikh_dikeluarkan->toDateTimeString();
- $compound->save();
-
- 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!');
- }
-
- }
- }
|