12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031 |
- <?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\EditCompoundEPBT;
- 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 EditCompoundEPBT($request->kpd, $user->id));
-
- 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!');
- }
-
- }
- }
|