fix pbg task add toggle and rab krk dlh
This commit is contained in:
@@ -42,11 +42,11 @@ class BigDataResumeController extends Controller
|
||||
}
|
||||
|
||||
$data_settings = DataSetting::all();
|
||||
if($data_settings->isEmpty()){
|
||||
return response()->json(['message' => 'No data setting found']);
|
||||
$target_pad = 0;
|
||||
if($data_settings->where('key', 'TARGET_PAD')->first()){
|
||||
$target_pad = floatval($data_settings->where('key', 'TARGET_PAD')->first()->value ?? 0);
|
||||
}
|
||||
|
||||
$target_pad = floatval(optional($data_settings->where('key', 'TARGET_PAD')->first())->value);
|
||||
$realisasi_terbit_pbg_sum = $big_data_resume->issuance_realization_pbg_sum;
|
||||
$realisasi_terbit_pbg_count = $big_data_resume->issuance_realization_pbg_count;
|
||||
$menunggu_klik_dpmptsp_sum = $big_data_resume->waiting_click_dpmptsp_sum;
|
||||
@@ -107,7 +107,7 @@ class BigDataResumeController extends Controller
|
||||
$business_krk_count = $big_data_resume->business_krk_count;
|
||||
$non_business_rab_count = $big_data_resume->non_business_rab_count;
|
||||
$non_business_krk_count = $big_data_resume->non_business_krk_count;
|
||||
$non_business_dlh_count = $big_data_resume->non_business_dlh_count;
|
||||
$business_dlh_count = $big_data_resume->business_dlh_count;
|
||||
|
||||
$result = [
|
||||
'target_pad' => [
|
||||
@@ -167,7 +167,7 @@ class BigDataResumeController extends Controller
|
||||
'business_krk_count' => $business_krk_count,
|
||||
'non_business_rab_count' => $non_business_rab_count,
|
||||
'non_business_krk_count' => $non_business_krk_count,
|
||||
'non_business_dlh_count' => $non_business_dlh_count
|
||||
'business_dlh_count' => $business_dlh_count
|
||||
];
|
||||
return response()->json($result);
|
||||
}catch(\Exception $e){
|
||||
@@ -336,9 +336,15 @@ class BigDataResumeController extends Controller
|
||||
return $pdf->download('laporan-pimpinan.pdf');
|
||||
}
|
||||
private function response_empty_resume(){
|
||||
$data_settings = DataSetting::all();
|
||||
$target_pad = 0;
|
||||
if($data_settings->where('key', 'TARGET_PAD')->first()){
|
||||
$target_pad = floatval($data_settings->where('key', 'TARGET_PAD')->first()->value ?? 0);
|
||||
}
|
||||
|
||||
$result = [
|
||||
'target_pad' => [
|
||||
'sum' => 0,
|
||||
'sum' => $target_pad,
|
||||
'percentage' => 100,
|
||||
],
|
||||
'tata_ruang' => [
|
||||
|
||||
@@ -132,39 +132,48 @@ class PbgTaskController extends Controller
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'owner_name' => 'required|string|max:255',
|
||||
'name' => 'nullable|string|max:255',
|
||||
'owner_name' => 'nullable|string|max:255',
|
||||
'application_type' => ['nullable', new Enum(PbgTaskApplicationTypes::class)],
|
||||
'condition' => 'required|string|max:255',
|
||||
'registration_number' => 'required|string|max:255',
|
||||
'document_number' => 'required|string|max:255',
|
||||
'condition' => 'nullable|string|max:255',
|
||||
'registration_number' => 'nullable|string|max:255',
|
||||
'document_number' => 'nullable|string|max:255',
|
||||
'status' => ['nullable', new Enum(PbgTaskStatus::class)],
|
||||
'address' => 'required|string|max:255',
|
||||
'address' => 'nullable|string|max:255',
|
||||
'slf_status_name' => 'nullable|string|max:255',
|
||||
'function_type' => 'required|string|max:255',
|
||||
'consultation_type' => 'required|string|max:255',
|
||||
'due_date' => 'nullable|date|after_or_equal:today',
|
||||
'function_type' => 'nullable|string|max:255',
|
||||
'consultation_type' => 'nullable|string|max:255',
|
||||
'due_date' => 'nullable|date',
|
||||
'is_valid' => 'nullable|boolean',
|
||||
]);
|
||||
|
||||
$statusLabel = $validated['status'] !== null ? PbgTaskStatus::getLabel($validated['status']) : null;
|
||||
$applicationLabel = $validated['application_type'] !== null ? PbgTaskApplicationTypes::getLabel($validated['application_type']) : null;
|
||||
|
||||
$pbg_task->update([
|
||||
'name' => $validated['name'],
|
||||
'owner_name' => $validated['owner_name'],
|
||||
'application_type' => $validated['application_type'],
|
||||
'application_type_name' => $applicationLabel, // Automatically set application_type_name
|
||||
'condition' => $validated['condition'],
|
||||
'registration_number' => $validated['registration_number'],
|
||||
'document_number' => $validated['document_number'],
|
||||
'status' => $validated['status'],
|
||||
'status_name' => $statusLabel, // Automatically set status_name
|
||||
'address' => $validated['address'],
|
||||
'slf_status_name' => $validated['slf_status_name'],
|
||||
'function_type' => $validated['function_type'],
|
||||
'consultation_type' => $validated['consultation_type'],
|
||||
'due_date' => $validated['due_date'],
|
||||
]);
|
||||
// Prepare update data - only include fields that are actually provided
|
||||
$updateData = [];
|
||||
|
||||
foreach ($validated as $key => $value) {
|
||||
if ($value !== null || $request->has($key)) {
|
||||
$updateData[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle special cases for labels
|
||||
if (isset($updateData['status'])) {
|
||||
$updateData['status_name'] = $statusLabel;
|
||||
}
|
||||
|
||||
if (isset($updateData['application_type'])) {
|
||||
$updateData['application_type_name'] = $applicationLabel;
|
||||
}
|
||||
|
||||
// Handle is_valid specifically
|
||||
if ($request->has('is_valid')) {
|
||||
$updateData['is_valid'] = $validated['is_valid'];
|
||||
}
|
||||
|
||||
$pbg_task->update($updateData);
|
||||
return response()->json([
|
||||
"success"=> true,
|
||||
"message"=> "Data berhasil diubah",
|
||||
|
||||
Reference in New Issue
Block a user