123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951 |
- <?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' => function($q){
- $q->with('Department');
- }])->where('_id',$compound->seksyen_kesalahan)->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.compound_detail', compact('user','compound','file','faulty','role','total','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')->find($_id);
-
- return view('main-dashboard.compound.compound_form_edit',compact('user','site','faulty','staff','compound'));
- }
-
- 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'){
- $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', '<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!');
- }
-
- }
- }
|