From acfc8d1288089632dcfaeacab7b4f743ed526e33 Mon Sep 17 00:00:00 2001 From: Tb Fajri Date: Fri, 12 Sep 2025 11:28:15 +0700 Subject: [PATCH] update approval di list approval --- .../Controllers/Api/RequestLogController.php | 5 + .../Transformers/RequestLogResource.php | 2 + .../Transformers/RequestLogShowResource.php | 3 +- app/Models/RequestLog.php | 2 + ..._columns_nominal_to_table_request_log.php} | 4 + .../ApprovalMonitoring/List.tsx | 73 ++++++++- .../pages/CustomerService/FinalLog/Detail.tsx | 143 +++++++++++------- .../CustomerService/FinalLog/Model/Types.tsx | 4 +- 8 files changed, 174 insertions(+), 62 deletions(-) rename database/migrations/{2025_09_10_103219_add_columns_nominal_to_table_request_log.php => 2025_09_10_103221_add_columns_nominal_to_table_request_log.php} (70%) diff --git a/Modules/Internal/Http/Controllers/Api/RequestLogController.php b/Modules/Internal/Http/Controllers/Api/RequestLogController.php index 4058a280..d66b3255 100755 --- a/Modules/Internal/Http/Controllers/Api/RequestLogController.php +++ b/Modules/Internal/Http/Controllers/Api/RequestLogController.php @@ -346,6 +346,11 @@ class RequestLogController extends Controller $requestLog->approved_at = Carbon::now(); } + if ($request->status_approval){ + $requestLog->status_approval = $request->status_approval; + $requestLog->approval_nominal_by = auth()->user()->id; + } + $requestLog->save(); // update nirc member diff --git a/Modules/Internal/Transformers/RequestLogResource.php b/Modules/Internal/Transformers/RequestLogResource.php index 60a4f0ac..4ecc2d10 100755 --- a/Modules/Internal/Transformers/RequestLogResource.php +++ b/Modules/Internal/Transformers/RequestLogResource.php @@ -31,6 +31,8 @@ class RequestLogResource extends JsonResource 'status' => $this->status ?? 'unknown', 'provider' => $provider ? $provider->name : '-', 'status_final_log' => $this->status_final_log ?? 'unknown', + 'nominal' => $this->nominal ?? 'unknown', + 'status_approval' => $this->status_approval ?? 'requested', 'service_name' => $this->service ? $this->service->name : '', 'payment_type' => $this->payment_type, 'payment_type_name' => $this->payment_type_name, diff --git a/Modules/Internal/Transformers/RequestLogShowResource.php b/Modules/Internal/Transformers/RequestLogShowResource.php index 4b9432d5..54a67090 100755 --- a/Modules/Internal/Transformers/RequestLogShowResource.php +++ b/Modules/Internal/Transformers/RequestLogShowResource.php @@ -175,10 +175,11 @@ class RequestLogShowResource extends JsonResource 'hak_kamar_pasien' => $requestLog['hak_kamar_pasien'], 'penempatan_kamar' => $requestLog['penempatan_kamar'], 'nominal' => $requestLog['nominal'], + 'status_approval' => $requestLog['status_approval'], 'catatan' => $requestLog['catatan'], 'reason' => $requestLog['reason'], 'diagnosis' => $icd, - 'url_approval' => env('LMS_WEB_URL') . '/custormer-service/final-log/detail/'.$requestLog['id'], + 'url_approval' => env('LMS_WEB_URL') . '/custormer-service/final-log/detail/'.$requestLog['id'] . '/' . auth()->user()->id, 'is_reversal' => $isReversal, // untuk penjagaan, jika true tidak bisa di edit/hapus lagi diff --git a/app/Models/RequestLog.php b/app/Models/RequestLog.php index 0ae461e9..d415be4f 100755 --- a/app/Models/RequestLog.php +++ b/app/Models/RequestLog.php @@ -33,6 +33,7 @@ class RequestLog extends Model 'final_log', 'status', 'status_final_log', + 'status_approval', 'source', 'claim_id', 'organization_id', @@ -55,6 +56,7 @@ class RequestLog extends Model 'dppj', 'type_of_member', 'nominal', + 'approval_nominal_by', ]; protected $hidden = [ diff --git a/database/migrations/2025_09_10_103219_add_columns_nominal_to_table_request_log.php b/database/migrations/2025_09_10_103221_add_columns_nominal_to_table_request_log.php similarity index 70% rename from database/migrations/2025_09_10_103219_add_columns_nominal_to_table_request_log.php rename to database/migrations/2025_09_10_103221_add_columns_nominal_to_table_request_log.php index f2294eab..d5094d82 100644 --- a/database/migrations/2025_09_10_103219_add_columns_nominal_to_table_request_log.php +++ b/database/migrations/2025_09_10_103221_add_columns_nominal_to_table_request_log.php @@ -15,6 +15,8 @@ return new class extends Migration { Schema::table('request_logs', function (Blueprint $table) { $table->integer('nominal')->default(0)->after('total_cob'); + $table->string('status_approval')->nullable()->after('status_final_log'); + $table->integer('approval_nominal_by')->nullable()->after('status_approval'); }); } @@ -27,6 +29,8 @@ return new class extends Migration { Schema::table('table_request_log', function (Blueprint $table) { $table->dropColumn('nominal'); + $table->dropColumn('status_approval'); + $table->dropColumn('approval_nominal_by'); }); } }; diff --git a/frontend/dashboard/src/pages/CaseManagement/ApprovalMonitoring/List.tsx b/frontend/dashboard/src/pages/CaseManagement/ApprovalMonitoring/List.tsx index 864145af..216603a7 100755 --- a/frontend/dashboard/src/pages/CaseManagement/ApprovalMonitoring/List.tsx +++ b/frontend/dashboard/src/pages/CaseManagement/ApprovalMonitoring/List.tsx @@ -367,6 +367,39 @@ export default function List() { }; } + const updateApproval = async (id:any) => { + axios + .put(`/customer-service/request/${id}`, { + status_approval: 'approved', + }) + .then((response) => { + enqueueSnackbar('Berhasil Approve', { variant: 'success' }); + window.location.reload(); + }) + .catch(({ response }) => { + enqueueSnackbar(response?.data?.message || 'Something Went Wrong', { variant: 'error' }); + }) + .finally(() => { + }); + }; + + + const updateDecline = async (id:any) => { + axios + .put(`/customer-service/request/${id}`, { + status_approval: 'declined', + }) + .then((response) => { + enqueueSnackbar('Berhasil Approve', { variant: 'success' }); + window.location.reload(); + }) + .catch(({ response }) => { + enqueueSnackbar(response?.data?.message || 'Something Went Wrong', { variant: 'error' }); + }) + .finally(() => { + }); + } + { /* ------------------ TABLE ROW ------------------ */ } @@ -423,14 +456,38 @@ export default function List() { )} - { row.status_final_log == "requested" ? - () : - row.status_final_log == "declined" ? - () + { row.status_approval == "requested" ? + () : + row.status_approval == "declined" ? + () : - () + () } + {fCurrency(row.nominal)} + + {row.status_approval !== "approved" && ( + + + + + + )} + @@ -575,6 +632,12 @@ export default function List() { Status + + Nominal + + + Action + diff --git a/frontend/dashboard/src/pages/CustomerService/FinalLog/Detail.tsx b/frontend/dashboard/src/pages/CustomerService/FinalLog/Detail.tsx index 88724ef4..e3e27566 100755 --- a/frontend/dashboard/src/pages/CustomerService/FinalLog/Detail.tsx +++ b/frontend/dashboard/src/pages/CustomerService/FinalLog/Detail.tsx @@ -117,6 +117,43 @@ export default function Detail() { }); } + const updateApproval = async () => { + setSubmitLoading(true); + axios + .put(`/customer-service/request/${id}`, { + status_approval: 'approved', + }) + .then((response) => { + enqueueSnackbar('Berhasil Approve', { variant: 'success' }); + window.location.reload(); + }) + .catch(({ response }) => { + enqueueSnackbar(response?.data?.message || 'Something Went Wrong', { variant: 'error' }); + }) + .finally(() => { + setSubmitLoading(false); + }); + }; + + + const updateDecline = async () => { + setSubmitLoading(true); + axios + .put(`/customer-service/request/${id}`, { + status_approval: 'declined', + }) + .then((response) => { + enqueueSnackbar('Berhasil Approve', { variant: 'success' }); + window.location.reload(); + }) + .catch(({ response }) => { + enqueueSnackbar(response?.data?.message || 'Something Went Wrong', { variant: 'error' }); + }) + .finally(() => { + setSubmitLoading(false); + }); + } + const { id, approval } = useParams(); useEffect(() => { @@ -457,13 +494,14 @@ export default function Detail() { /> - {/* Simpan */} - + {approval ? ( <> - - {/* GRUP TOMBOL DI KANAN */} - - + + {/* GRUP TOMBOL DI KANAN */} + {requestLog?.status_approval !== 'approved' && ( + + - - + + + )} - ) : ( + ) : ( <> - {/* TOMBOL SIMPAN DI KIRI */} - + > Simpan - + - {/* Ini adalah spacer untuk mendorong tombol berikutnya ke kanan */} - + {/* Ini adalah spacer untuk mendorong tombol berikutnya ke kanan */} + - {/* GRUP TOMBOL DI KANAN */} - + {/* GRUP TOMBOL DI KANAN */} + - + - )} + )} @@ -1009,8 +1043,7 @@ export default function Detail() { variant="outlined" sx={{ color: '#FF4842', borderColor: '#FF4842' }} onClick={() => { - setOpenDialogSubmit(true); - setApprove('declined'); + }} > Decline diff --git a/frontend/dashboard/src/pages/CustomerService/FinalLog/Model/Types.tsx b/frontend/dashboard/src/pages/CustomerService/FinalLog/Model/Types.tsx index 6c1d2a16..cb9081c1 100755 --- a/frontend/dashboard/src/pages/CustomerService/FinalLog/Model/Types.tsx +++ b/frontend/dashboard/src/pages/CustomerService/FinalLog/Model/Types.tsx @@ -21,6 +21,8 @@ export type FinalLogType = { service_name : string, payment_type_name : string, status_final_log : string, + status_approval : string, + nominal : number, provider : string, status : string, files_by_type : files_by_type, @@ -43,12 +45,12 @@ export type DetailFinalLogType = { marital_status : string, admission_date : string, submission_date : string, - admission_date : string, approved_final_log_at : string, service_type : string, claim_method : string, status : string, status_final_log : string, + status_approval : string, no_identitas : string, keterangan : string, hak_kamar_pasien : string,