|
|
@@ -45,24 +45,24 @@ class TaskController extends Controller |
|
|
|
$id = Auth::guard('sadmin')->id(); |
|
|
|
$user = Staff::with('StaffDetail')->find($id); |
|
|
|
|
|
|
|
if($request->modul == '02') |
|
|
|
{ |
|
|
|
$compound = Compound::with('ConfidentialFile')->where('non',$request->non)->first(); |
|
|
|
$faulty = Faulty::with('DeedLaw', 'Department') ->where('_id', $compound->seksyen_kesalahan_n)->first(); |
|
|
|
$jbkod = $compound->jbkod_n; |
|
|
|
} |
|
|
|
else{ |
|
|
|
$compound = Compound::with('ConfidentialFile')->where('kpd',$request->kpd)->first(); |
|
|
|
$faulty = Faulty::with('DeedLaw', 'Department') ->where('_id', $compound->seksyen_kesalahan)->first(); |
|
|
|
$jbkod = $compound->jbkod; |
|
|
|
} |
|
|
|
|
|
|
|
$file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first(); |
|
|
|
$data = []; |
|
|
|
$file = ConfidentialFile::where('no_siri',$request->confidential)->first(); |
|
|
|
$now = Carbon::now(); |
|
|
|
$gDate = $now->format('F Y'); |
|
|
|
|
|
|
|
if($request->dashboard == "true"){ |
|
|
|
|
|
|
|
if($request->modul == '02') |
|
|
|
{ |
|
|
|
$compound = Compound::with('ConfidentialFile')->where('confidential_file_id',$request->confidential_id)->first(); |
|
|
|
$faulty = Faulty::with('DeedLaw', 'Department') ->where('_id', $compound->seksyen_kesalahan_n)->first(); |
|
|
|
$jbkod = $compound->jbkod_n; |
|
|
|
} |
|
|
|
else{ |
|
|
|
$compound = Compound::with('ConfidentialFile')->where('kpd',$request->kpd)->first(); |
|
|
|
$faulty = Faulty::with('DeedLaw', 'Department') ->where('_id', $compound->seksyen_kesalahan)->first(); |
|
|
|
$jbkod = $compound->jbkod; |
|
|
|
} |
|
|
|
|
|
|
|
$roles = Roles::where('kod', $request->kategori_modul)->first(); |
|
|
|
|
|
|
|
if($compound->modul == $request->kategori_modul){ |
|
|
@@ -83,8 +83,6 @@ class TaskController extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(count($reg_id) > 0) { |
|
|
|
$client = new \GuzzleHttp\Client(); |
|
|
|
$result = $client->request('POST', url('api/push/notification'), [ |
|
|
@@ -96,9 +94,11 @@ class TaskController extends Controller |
|
|
|
] |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
|
$compound->modul = $request->kategori_modul; |
|
|
|
$compound->save(); |
|
|
|
if(!($request->kategori_modul == '03' && $compound->modul == '02')) |
|
|
|
{ |
|
|
|
$compound->modul = $request->kategori_modul; |
|
|
|
$compound->save(); |
|
|
|
} |
|
|
|
|
|
|
|
$historyData = [ |
|
|
|
'tarikh_kumpulan' => $gDate, |
|
|
@@ -122,22 +122,34 @@ class TaskController extends Controller |
|
|
|
return redirect()->back()->with('success_msg', '<strong>Berjaya Kemaskini!</strong> Kompaun ini berjaya diserahkan ke kategori modul '.$roles->name); |
|
|
|
} |
|
|
|
}else if($request->dashboard == "false"){ |
|
|
|
|
|
|
|
$compound = Compound::with('ConfidentialFile')->where('confidential_file_id',$request->confidential)->first(); |
|
|
|
|
|
|
|
$data = array(); |
|
|
|
|
|
|
|
if($compound->penguatkuasa == $request->penguatkuasa){ |
|
|
|
|
|
|
|
$staff = StaffDetail::where('_id',$request->penguatkuasa)->first(); |
|
|
|
|
|
|
|
return redirect()->back()->withInput()->with('error_msg','<strong>Tidak Berjaya!</strong> Kompaun ini sudah diserahkan kepada penguatkuasa ['.$staff->no_badan.'] '.$staff->full_name); |
|
|
|
}else{ |
|
|
|
|
|
|
|
$staff = Staff::with('StaffDetail')->where('_id',$request->penguatkuasa)->where(function($q){ |
|
|
|
$q->where('roles_access','PenguatKuasa')->orWhere('roles_access','PPenguatKuasa'); |
|
|
|
})->first(); |
|
|
|
$role = Roles::where('kod', $compound->modul)->first(); |
|
|
|
$role = Roles::where('kod', $compound->modul)->first(); |
|
|
|
|
|
|
|
if($request->categori_modul == '03' && $compound->modul == '02') |
|
|
|
{ |
|
|
|
if($compound->modul == '02') |
|
|
|
{ |
|
|
|
$compound = Compound::with('ConfidentialFile')->where('non',$request->non)->first(); |
|
|
|
$faulty = Faulty::where('_id', $compound->seksyen_kesalahan_n)->first(); |
|
|
|
$department = Department::where('_id', $compound->jbkod_n)->first(); |
|
|
|
$deedlaw = DeedLaw::where('_id', $compound->akta_n)->first(); |
|
|
|
$jbkod = $compound->jbkod_n; |
|
|
|
|
|
|
|
$this->dispatch(new StoreCompoundEPBT($request->all(), $compound->kpd, $user->StaffDetail->full_name, $user->StaffDetail->no_badan, $compound->seksyen_kesalahan)); |
|
|
|
// dd($faulty); |
|
|
|
|
|
|
|
$data = [ |
|
|
|
array_push($data, array( |
|
|
|
'non' => $compound->non, |
|
|
|
'jenis' => $compound->jenis_n, |
|
|
|
'nama' => $compound->nama, |
|
|
@@ -148,13 +160,48 @@ class TaskController extends Controller |
|
|
|
'nama_jalan' =>$compound->nama_jalan, |
|
|
|
'catatan' => $compound->catatan, |
|
|
|
'latlong' => $compound->latlong, |
|
|
|
'jabatan' => $faulty->Department->jnama, |
|
|
|
'akta' => $faulty->DeedLaw->nama, |
|
|
|
'jabatan' => $department->jnama, |
|
|
|
'akta' => $deedlaw->nama, |
|
|
|
'seksyen' => $faulty->nama, |
|
|
|
'tempoh' => $compound->tempoh, |
|
|
|
'tindakan' => $compound->tindakan ?? "", |
|
|
|
'created_n' => $compound->created_n, |
|
|
|
]; |
|
|
|
} |
|
|
|
)); |
|
|
|
|
|
|
|
} |
|
|
|
else{ |
|
|
|
$compound = Compound::with('ConfidentialFile')->where('kpd',$request->kpd)->first(); |
|
|
|
$faulty = Faulty::with('DeedLaw', 'Department') ->where('_id', $compound->seksyen_kesalahan)->first(); |
|
|
|
$jbkod = $compound->jbkod; |
|
|
|
} |
|
|
|
|
|
|
|
// if($compound->modul == '02') |
|
|
|
// { |
|
|
|
// $this->dispatch(new StoreCompoundEPBT($request->all(), $compound->kpd, $user->StaffDetail->full_name, $user->StaffDetail->no_badan, $compound->seksyen_kesalahan)); |
|
|
|
|
|
|
|
// dd($faulty); |
|
|
|
|
|
|
|
// array_push($data, array( |
|
|
|
// 'non' => $compound->non, |
|
|
|
// 'jenis' => $compound->jenis_n, |
|
|
|
// 'nama' => $compound->nama, |
|
|
|
// 'identity' => $compound->identity, |
|
|
|
// 'alamat' => $compound->alamat, |
|
|
|
// 'nama_kawasan' =>$compound->nama_kawasan, |
|
|
|
// 'nama_taman' => $compound->nama_taman, |
|
|
|
// 'nama_jalan' =>$compound->nama_jalan, |
|
|
|
// 'catatan' => $compound->catatan, |
|
|
|
// 'latlong' => $compound->latlong, |
|
|
|
// 'jabatan' => $faulty['Department']['jnama'], |
|
|
|
// 'akta' => $faulty['DeedLaw']['nama'], |
|
|
|
// 'tempoh' => $compound->tempoh, |
|
|
|
// 'tindakan' => $compound->tindakan ?? "", |
|
|
|
// 'created_n' => $compound->created_n, |
|
|
|
// )); |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
info(json_encode($data)); |
|
|
|
|
|
|
|
if(!empty($staff)){ |
|
|
|
if($staff->token_firebase != '') { |
|
|
@@ -163,13 +210,13 @@ class TaskController extends Controller |
|
|
|
'verify' => false, |
|
|
|
'form_params' => [ |
|
|
|
'title' => $role->name.' '.$compound->kpd, |
|
|
|
'msg' => 'Kompaun ini berada di ruangan '.$role->name . '\n' .$data, |
|
|
|
'msg' => 'Kompaun ini berada di ruangan '.$role->name , |
|
|
|
'data' => json_encode($data), |
|
|
|
'register_id[]' => $staff->token_firebase, |
|
|
|
] |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$compound->penguatkuasa = $request->penguatkuasa; |
|
|
|
$compound->save(); |
|
|
|
|