|
|
@@ -328,9 +328,16 @@ class CompoundResourceController extends BaseController |
|
|
|
$data = ''; |
|
|
|
if($row['status'] == 'Berbayar'){ |
|
|
|
|
|
|
|
$data = '<b>'.$row['status'].'</b><div style="margin-top: 8px"><span>Bayaran: </span><br/>'; |
|
|
|
$data .= 'RM '.$row['amount_payment'].'</div>'; |
|
|
|
$data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; |
|
|
|
if ($row['modul'] == '02') { |
|
|
|
|
|
|
|
$data = '<b>Selesai</b><div style="margin-top: 8px"><span></span><br/></div>'; |
|
|
|
$data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; |
|
|
|
} |
|
|
|
else{ |
|
|
|
$data = '<b>'.$row['status'].'</b><div style="margin-top: 8px"><span>Bayaran: </span><br/>'; |
|
|
|
$data .= 'RM '.$row['amount_payment'].'</div>'; |
|
|
|
$data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; |
|
|
|
} |
|
|
|
|
|
|
|
if($row['updated_by'] !== null ){ |
|
|
|
$data .= '<div style="margin-top: 8px"><span>Kemaskini: </span><br/>'; |
|
|
@@ -343,8 +350,8 @@ class CompoundResourceController extends BaseController |
|
|
|
$data .= '<div style="margin-top: 8px"><span>Kemaskini: </span><br/>'; |
|
|
|
$data .= $row['updated_at'].' <br/>'.$row['updates_by'].'</div>'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else if($row['status'] == 'Belum Bayar' && $row['updated_by'] !== null){ |
|
|
|
$data = '<b>'.$row['status'].'</b>'; |
|
|
|
$data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; |
|
|
@@ -373,107 +380,6 @@ class CompoundResourceController extends BaseController |
|
|
|
})->rawColumns(['index','status_kemaskini','kesalahan'])->make(true); |
|
|
|
} |
|
|
|
|
|
|
|
public function notice_index(Request $request) |
|
|
|
{ |
|
|
|
$per_page = ''; |
|
|
|
$kpd = ''; |
|
|
|
|
|
|
|
$modul = '02'; |
|
|
|
$status = 'All'; |
|
|
|
$jenis = 'Pelbagai_JPB'; |
|
|
|
|
|
|
|
$department = array ( |
|
|
|
0 => '5df355f891d6e66b9c5e626d', |
|
|
|
1 => '5df721c5cde7fd741433c6b2', |
|
|
|
2 => '5df722a24636f4594f4a3c3d', |
|
|
|
3 => '5f17a31795dbfd3320761bfe', |
|
|
|
4 => '5f3b872fea58cb3c1b0e7b8d', |
|
|
|
); |
|
|
|
|
|
|
|
$start_date = '2020-08-18'; |
|
|
|
$end_date = '2020-09-20'; |
|
|
|
|
|
|
|
$enforcer = 'All'; |
|
|
|
$faulty = 'All'; |
|
|
|
|
|
|
|
$plate_no = strtolower(''); |
|
|
|
$company_no = strtolower(''); |
|
|
|
$nric = ''; |
|
|
|
$license = ''; |
|
|
|
$namaP = ''; |
|
|
|
$company_name = ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
############################################################################################################### |
|
|
|
|
|
|
|
// $per_page = $request->per_page; |
|
|
|
// $kpd = $request->kpd; |
|
|
|
|
|
|
|
// $modul = $request->modul; |
|
|
|
// $status = $request->status; |
|
|
|
// $jenis = $request->type; |
|
|
|
// if(!empty($request->department)){ |
|
|
|
// $department = json_decode($request->department); |
|
|
|
// }else { |
|
|
|
// $department = []; |
|
|
|
// } |
|
|
|
// $start_date = $request->start_date; |
|
|
|
// $end_date = $request->end_date; |
|
|
|
|
|
|
|
// $enforcer = $request->enforcer; |
|
|
|
// $faulty = $request->faulty; |
|
|
|
|
|
|
|
// $plate_no = strtolower($request->plate_no); |
|
|
|
// $company_no = strtolower($request->company_no); |
|
|
|
// $nric = $request->nric; |
|
|
|
// $license = $request->license; |
|
|
|
// $namaP = $request->nameP; |
|
|
|
// $company_name = $request->company_name; |
|
|
|
|
|
|
|
$nested_data = array(); |
|
|
|
|
|
|
|
$compound = $this->searchCompanyName($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$nric,$license,$namaP,$company_name)->orderBy('created_at','ASC')->get(); |
|
|
|
|
|
|
|
// return \DataTables::of(CompoundResource::collection($compound))->addIndexColumn() |
|
|
|
// ->addColumn('index', function($row) { |
|
|
|
// $curr = Carbon::now(); |
|
|
|
// $dtC = Carbon::parse($row['created_at'])->setTimezone('Asia/Kuala_Lumpur'); |
|
|
|
|
|
|
|
// if($curr->diffInDays($dtC) <= 3){ |
|
|
|
// $html = 'New'; |
|
|
|
// }else{ $html = ''; } |
|
|
|
// return $html; |
|
|
|
// }); |
|
|
|
|
|
|
|
if (!empty($compound)) { |
|
|
|
|
|
|
|
foreach ($compound as $key => $c) { |
|
|
|
|
|
|
|
$faulty = Faulty::where('_id', $c->seksyen_kesalahan)->first(); |
|
|
|
$enforcer = StaffDetail::where('_id', $c->dikeluarkan)->first(); |
|
|
|
|
|
|
|
array_push($nested_data, array( |
|
|
|
'index' => '', |
|
|
|
'modul' => $c->modul, |
|
|
|
'kpd' => $c->kpd, |
|
|
|
'jenis' => $c->jenis, |
|
|
|
'masa' => $c->created_at, |
|
|
|
'kesalahan' => $faulty->nama, |
|
|
|
'nric' => $c->identity, |
|
|
|
'nama' => $c->nama, |
|
|
|
'penguatkuasa' => $enforcer->full_name, |
|
|
|
// 'tindakan' => |
|
|
|
|
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return \DataTables::of($nested_data)->addIndexcolumn()->make(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Show the form for creating a new resource. |
|
|
@@ -1203,6 +1109,201 @@ class CompoundResourceController extends BaseController |
|
|
|
// |
|
|
|
} |
|
|
|
|
|
|
|
public function updateStatusNoticeViaDashboard(Request $request) |
|
|
|
{ |
|
|
|
$compound = $this->compound::with('ConfidentialFile')->find($request->id); |
|
|
|
$staff = StaffDetail::find($request->current_id); |
|
|
|
if(!empty($compound) && !empty($staff)){ |
|
|
|
if($staff->roles_access == "sysadmin" || $staff->roles_access == "Ketua Jabatan"){ |
|
|
|
|
|
|
|
if($compound->status != $request->status){ |
|
|
|
$compound->status = $request->status; |
|
|
|
$compound->catatan_dari_admin = $request->remark; |
|
|
|
$compound->update_by = $request->current_id; |
|
|
|
$saved = $compound->save(); |
|
|
|
|
|
|
|
if($saved){ |
|
|
|
|
|
|
|
$gDate = $compound->created_at->format('F Y'); |
|
|
|
$historyData = [ |
|
|
|
'tarikh_kumpulan' => $gDate, |
|
|
|
]; |
|
|
|
$subHistory = [ |
|
|
|
'no_siri' => $compound->ConfidentialFile->no_siri, |
|
|
|
'tajuk' => "Status notis ".$compound->kpd. " telah dikemaskini", |
|
|
|
'huraian' => "Status penyelesaian notis telah dikemaskini melalui 'dashboard' oleh <a href='https://mdch.sipadu.my/main/staff/".$staff->_id."/profile'>".$staff->full_name."</a>", |
|
|
|
]; |
|
|
|
|
|
|
|
$groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); |
|
|
|
if(!empty($groupByDate)){ |
|
|
|
$groupByDate->subhistory()->create($subHistory); |
|
|
|
$historySaved = $compound->ConfidentialFile->history()->attach($groupByDate); |
|
|
|
}else{ |
|
|
|
$history = History::create($historyData); |
|
|
|
$history->subhistory()->create($subHistory); |
|
|
|
$historySaved = $compound->ConfidentialFile->history()->attach($history); |
|
|
|
} |
|
|
|
|
|
|
|
if($request->status == "Berbayar"){ |
|
|
|
return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun/Notis Dijelaskan" '); |
|
|
|
}else{ |
|
|
|
return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun/Notis DiBatalkan" '); |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
$response = [ |
|
|
|
'success' => false, 'message' => 'Notis ini tidak berjaya dikemaskini', |
|
|
|
]; |
|
|
|
return response()->json($response, 200); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
|
|
|
|
if($request->remark != ''){ |
|
|
|
$compound->catatan_dari_admin = $request->remark; |
|
|
|
$compound->update_by = $request->current_id; |
|
|
|
$compound->save(); |
|
|
|
|
|
|
|
$saved = $compound->save(); |
|
|
|
if($saved){ |
|
|
|
|
|
|
|
$gDate = $compound->created_at->format('F Y'); |
|
|
|
$historyData = [ |
|
|
|
'tarikh_kumpulan' => $gDate, |
|
|
|
]; |
|
|
|
$subHistory = [ |
|
|
|
'no_siri' => $compound->ConfidentialFile->no_siri, |
|
|
|
'tajuk' => "Catatan ".$compound->kpd. " telah ditambah/dikemaskini", |
|
|
|
'huraian' => "Catatan notis ini telah dikemaskini melalui 'dashboard' oleh <a href='https://mdch.sipadu.my/main/staff/".$staff->_id."/profile'>".$staff->full_name."</a>", |
|
|
|
]; |
|
|
|
|
|
|
|
$groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); |
|
|
|
if(!empty($groupByDate)){ |
|
|
|
$groupByDate->subhistory()->create($subHistory); |
|
|
|
$historySaved = $compound->ConfidentialFile->history()->attach($groupByDate); |
|
|
|
}else{ |
|
|
|
$history = History::create($historyData); |
|
|
|
$history->subhistory()->create($subHistory); |
|
|
|
$historySaved = $compound->ConfidentialFile->history()->attach($history); |
|
|
|
} |
|
|
|
|
|
|
|
return $this->sendResponse('', 'Berjaya tambah catatan untuk notis ini'); |
|
|
|
|
|
|
|
}else{ |
|
|
|
$response = [ |
|
|
|
'success' => false, 'message' => 'Notis ini tidak berjaya dikemaskini', |
|
|
|
]; |
|
|
|
return response()->json($response, 200); |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
$response = [ |
|
|
|
'success' => false, 'message' => 'Tiada kemaskini!', |
|
|
|
]; |
|
|
|
return response()->json($response, 200); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
if($compound->status != 'Berbayar' && $compound->status != $request->status){ |
|
|
|
$compound->status = $request->status; |
|
|
|
$compound->catatan_dari_admin = $request->remark; |
|
|
|
// $compound->amount_payment = $request->amount; |
|
|
|
$compound->update_by = $request->current_id; |
|
|
|
$saved = $compound->save(); |
|
|
|
|
|
|
|
if($saved){ |
|
|
|
|
|
|
|
$gDate = $compound->created_at->format('F Y'); |
|
|
|
$historyData = [ |
|
|
|
'tarikh_kumpulan' => $gDate, |
|
|
|
]; |
|
|
|
$subHistory = [ |
|
|
|
'no_siri' => $compound->ConfidentialFile->no_siri, |
|
|
|
'tajuk' => "Status notis telah dikemaskini", |
|
|
|
'huraian' => "Status penyelesaian notis telah dikemaskini melalui 'dashboard' oleh <a href='https://mdch.sipadu.my/main/staff/".$staff->_id."/profile'>".$staff->full_name."</a>", |
|
|
|
]; |
|
|
|
|
|
|
|
$groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); |
|
|
|
if(!empty($groupByDate)){ |
|
|
|
$groupByDate->subhistory()->create($subHistory); |
|
|
|
$historySaved = $compound->ConfidentialFile->history()->attach($groupByDate); |
|
|
|
}else{ |
|
|
|
$history = History::create($historyData); |
|
|
|
$history->subhistory()->create($subHistory); |
|
|
|
$historySaved = $compound->ConfidentialFile->history()->attach($history); |
|
|
|
} |
|
|
|
|
|
|
|
if($request->status == "Berbayar"){ |
|
|
|
return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk notis ini di modul kategori "Kompaun/Notis Dijelaskan" '); |
|
|
|
}else{ |
|
|
|
return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk notis ini di modul kategori "Kompaun/Notis DiBatalkan" '); |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
$response = [ |
|
|
|
'success' => false, 'message' => 'Notis ini tidak berjaya dikemaskini', |
|
|
|
]; |
|
|
|
return response()->json($response, 200); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
|
|
|
|
if($request->remark != ''){ |
|
|
|
$compound->catatan_dari_admin = $request->remark; |
|
|
|
$compound->update_by = $request->current_id; |
|
|
|
$compound->save(); |
|
|
|
|
|
|
|
$saved = $compound->save(); |
|
|
|
if($saved){ |
|
|
|
|
|
|
|
$gDate = $compound->created_at->format('F Y'); |
|
|
|
$historyData = [ |
|
|
|
'tarikh_kumpulan' => $gDate, |
|
|
|
]; |
|
|
|
$subHistory = [ |
|
|
|
'no_siri' => $compound->ConfidentialFile->no_siri, |
|
|
|
'tajuk' => "Catatan ".$compound->kpd. " telah ditambah/dikemaskini", |
|
|
|
'huraian' => "Catatan notis ini telah dikemaskini melalui 'dashboard' oleh <a href='https://mdch.sipadu.my/main/staff/".$staff->_id."/profile'>".$staff->full_name."</a>", |
|
|
|
]; |
|
|
|
|
|
|
|
$groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); |
|
|
|
if(!empty($groupByDate)){ |
|
|
|
$groupByDate->subhistory()->create($subHistory); |
|
|
|
$historySaved = $compound->ConfidentialFile->history()->attach($groupByDate); |
|
|
|
}else{ |
|
|
|
$history = History::create($historyData); |
|
|
|
$history->subhistory()->create($subHistory); |
|
|
|
$historySaved = $compound->ConfidentialFile->history()->attach($history); |
|
|
|
} |
|
|
|
|
|
|
|
return $this->sendResponse('', 'Berjaya tambah catatan untuk notis ini'); |
|
|
|
|
|
|
|
}else{ |
|
|
|
$response = [ |
|
|
|
'success' => false, 'message' => 'Notis ini tidak berjaya dikemaskini', |
|
|
|
]; |
|
|
|
return response()->json($response, 200); |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
$response = [ |
|
|
|
'success' => false, 'message' => 'Tiada kemaskini!', |
|
|
|
]; |
|
|
|
return response()->json($response, 200); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
$response = [ |
|
|
|
'success' => false, |
|
|
|
'message' => 'Notis ini tidak dijumpai / staff tidak ditemui', |
|
|
|
]; |
|
|
|
return response()->json($response, 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function updateStatusPaymentViaDashboard(Request $request) |
|
|
|
{ |
|
|
|
$compound = $this->compound::with('ConfidentialFile')->find($request->id); |