From 40371bd53af6d4e8bde2d05b677af3dca2c9ad89 Mon Sep 17 00:00:00 2001 From: Tb Fajri Date: Tue, 19 Dec 2023 08:56:18 +0700 Subject: [PATCH] Update customer service --- .../Api/DailyMonitoringController.php | 32 +- .../Controllers/Api/RequestLogController.php | 4 +- .../Api/RequestLogMedicineController.php | 136 ++++++ Modules/Internal/Routes/api.php | 10 +- .../Transformers/RequestLogShowResource.php | 15 +- app/Models/RequestLogMedicine.php | 30 ++ ...954_create_request_log_medicines_table.php | 34 ++ ..._15_153059_add_columns_to_request_logs.php | 32 ++ ...te_request_log_daily_monitoring_table.php} | 13 +- .../dashboard/src/components/MuiDialog.tsx | 2 +- .../Components/ClaimListRow.tsx | 30 +- .../Components/DailyMonitoringList.tsx | 2 + .../Components/DailyMonitoringListRow.tsx | 9 + .../DailyMonitoring/Model/Types.ts | 2 + .../Components/FormCreate.tsx | 355 -------------- .../Components/FormCreateBtnChoose.tsx | 39 -- .../Components/FormCreateBtnUpload.tsx | 39 -- .../Components/FormCreateFilesUpload.tsx | 25 - .../Components/FormCreateListChoose.tsx | 78 --- .../Components/FormCreateSearch.tsx | 70 --- .../Components/FormEdit.tsx | 456 ------------------ .../InpatientMonitoring/CreateUpdate.tsx | 63 --- .../InpatientMonitoring/Detail.tsx | 306 ------------ .../InpatientMonitoring/DetailStepper.tsx | 58 --- .../InpatientMonitoring/DetailTimeline.tsx | 426 ---------------- .../InpatientMonitoring/Index.tsx | 6 +- .../InpatientMonitoring/List.tsx | 18 +- .../InpatientMonitoring/Model/Functions.tsx | 79 --- .../InpatientMonitoring/Model/Types.tsx | 36 -- .../Components/CardBenefit.tsx | 214 ++++++++ .../CustomerService/Components/CardFile.tsx | 50 ++ .../Components/CardMedicine.tsx | 65 +++ .../Components/DetailBenefit.tsx | 115 ----- .../Components/DialogConfirmation.tsx | 11 +- .../FinalLog/Components/DialogDelete.tsx | 51 ++ .../Components/DialogDeleteMedicine.tsx | 69 +++ .../FinalLog/Components/DialogEditBenefit.tsx | 2 +- .../FinalLog/Components/DialogMedicine.tsx | 171 ++++--- .../pages/CustomerService/FinalLog/Detail.tsx | 76 +-- .../FinalLog/Model/Functions.tsx | 41 +- .../CustomerService/FinalLog/Model/Types.tsx | 41 +- resources/views/pdf/guaranted_leter.blade.php | 44 +- 42 files changed, 1027 insertions(+), 2328 deletions(-) create mode 100644 Modules/Internal/Http/Controllers/Api/RequestLogMedicineController.php create mode 100644 app/Models/RequestLogMedicine.php create mode 100644 database/migrations/2023_12_13_091954_create_request_log_medicines_table.php create mode 100644 database/migrations/2023_12_15_153059_add_columns_to_request_logs.php rename database/migrations/{2023_10_27_111432_create_claim_daily_monitoring_table.php => 2023_12_15_154820_create_request_log_daily_monitoring_table.php} (66%) delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreate.tsx delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateBtnChoose.tsx delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateBtnUpload.tsx delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateFilesUpload.tsx delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateListChoose.tsx delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateSearch.tsx delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormEdit.tsx delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/CreateUpdate.tsx delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Detail.tsx delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/DetailStepper.tsx delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/DetailTimeline.tsx delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Model/Functions.tsx delete mode 100644 frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Model/Types.tsx create mode 100644 frontend/dashboard/src/pages/CustomerService/Components/CardBenefit.tsx create mode 100644 frontend/dashboard/src/pages/CustomerService/Components/CardFile.tsx create mode 100644 frontend/dashboard/src/pages/CustomerService/Components/CardMedicine.tsx delete mode 100644 frontend/dashboard/src/pages/CustomerService/Components/DetailBenefit.tsx create mode 100644 frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogDeleteMedicine.tsx diff --git a/Modules/Internal/Http/Controllers/Api/DailyMonitoringController.php b/Modules/Internal/Http/Controllers/Api/DailyMonitoringController.php index 3bb34c82..09347128 100644 --- a/Modules/Internal/Http/Controllers/Api/DailyMonitoringController.php +++ b/Modules/Internal/Http/Controllers/Api/DailyMonitoringController.php @@ -35,12 +35,15 @@ class DailyMonitoringController extends Controller */ public function GetMemberList() { - $memberList = DB::table('claims') - ->leftJoin('members', 'claims.member_id', '=', 'members.id') - ->leftJoin('member_plans', 'members.id', '=', 'member_plans.id') - ->select('members.member_id','members.name','member_plans.start AS startdate','member_plans.end AS enddate') - ->groupBy('claims.member_id') - ->orderBy('claims.created_at', 'desc') + $memberList = DB::table('request_logs') + ->leftJoin('members', 'request_logs.member_id', '=', 'members.id') + ->leftJoin('member_plans', 'request_logs.member_id', '=', 'member_plans.member_id') + ->leftJoin('organizations', 'organizations.id', '=', 'request_logs.organization_id') + ->select('members.member_id','members.name','member_plans.start AS startdate','member_plans.end AS enddate', 'request_logs.submission_date as addmision_date', 'organizations.name as provider' ) + ->where('request_logs.service_code', 'IP') + ->where('request_logs.status_final_log', 'approved') + ->groupBy('request_logs.member_id') + ->orderBy('request_logs.created_at', 'desc') ->get(); return response()->json([ @@ -62,15 +65,14 @@ class DailyMonitoringController extends Controller ->where('member_id', $member_id) ->first(); - $claimList = DB::table('claims') - ->leftJoin('claim_requests', 'claims.claim_request_id', '=', 'claim_requests.id') - ->leftJoin('claim_history_cares', 'claims.id', '=', 'claim_history_cares.claim_id') - ->leftJoin('services', 'claim_requests.service_code', '=', 'services.code') - ->leftJoin('members', 'claims.member_id', '=', 'members.id') - ->select('claims.id AS claim_id','claim_history_cares.admission_date','claim_history_cares.discharge_date','claim_requests.code AS claim_code','services.name AS service_type','claims.status AS claim_status','members.member_id',) - ->where("claims.member_id", "=", $memberDetail->id) - ->where("claim_requests.claim_id", "!=",null) - ->orderBy("claims.created_at", "desc") + $claimList = DB::table('request_logs') + ->leftJoin('services', 'services.code', '=', 'request_logs.service_code') + ->leftJoin('members', 'members.id', '=', 'request_logs.member_id') + ->select('request_logs.id','request_logs.submission_date AS admission_date','request_logs.discharge_date','request_logs.code','services.name as service_name','request_logs.status','members.name',) + ->where('request_logs.service_code', 'IP') + ->where('request_logs.status_final_log', 'approved') + ->where("request_logs.member_id", "=", $memberDetail->id) + ->orderBy("request_logs.created_at", "desc") ->get(); return response()->json([ diff --git a/Modules/Internal/Http/Controllers/Api/RequestLogController.php b/Modules/Internal/Http/Controllers/Api/RequestLogController.php index b4b0f168..ba8e088f 100644 --- a/Modules/Internal/Http/Controllers/Api/RequestLogController.php +++ b/Modules/Internal/Http/Controllers/Api/RequestLogController.php @@ -306,10 +306,12 @@ class RequestLogController extends Controller { $id = $request->id; $requestLog = RequestLog::findOrFail($id); + $status = $request->status ?? 'requested'; + // Update Request LOG untuk lanjut ke Final LOG $requestLog->final_log = 1; - $requestLog->status_final_log = 'requested'; + $requestLog->status_final_log = $status; $requestLog->save(); diff --git a/Modules/Internal/Http/Controllers/Api/RequestLogMedicineController.php b/Modules/Internal/Http/Controllers/Api/RequestLogMedicineController.php new file mode 100644 index 00000000..d9aaeb59 --- /dev/null +++ b/Modules/Internal/Http/Controllers/Api/RequestLogMedicineController.php @@ -0,0 +1,136 @@ + 'Kolom :attribute wajib diisi.', + 'numeric' => 'Kolom :attribute harus berupa angka.', + ]; + + $validator = Validator::make($request->all(), [ + 'medicine' => 'required|array', + 'medicine.*' => 'required', + ], $customMessages); + + if ($validator->fails()) { + return Helper::responseJson([],'error', 400, $validator->errors()); + } else { + $medicine = $request->medicine; + + if (count($medicine)>0){ + // BeginTransaction + DB::beginTransaction(); + foreach($medicine as $key => $value){ + $data = [ + 'request_log_id' => $value['request_log_id'], + 'medicine' => $value['medicine_name'], + 'price' => $value['medicine_price'], + ]; + // Insert Data + try { + RequestLogMedicine::create($data); + } catch (\Throwable $th) { + DB::rollBack(); + return Helper::responseJson(status: 'failed', statusCode: 500, message: $th->getMessage()); + } + } + DB::commit(); + return Helper::responseJson(status: 'success', statusCode: 201, message: 'success', data: $request->toArray()); + }; + + } + + + $requestLogMedicine = RequestLogMedicine::insert($data); + return $requestLogMedicine; + } + + /** + * Show the form for editing the specified resource. + * @param int $id + * @return Renderable + */ + public function edit($id) + { + return view('internal::edit'); + } + + /** + * Update the specified resource in storage. + * @param Request $request + * @param int $id + * @return Renderable + */ + public function update(Request $request, $id) + { + $requestLogBenefit = requestLogBenefit::findOrFail($id); + $requestLogBenefit->amount_approved = $request->amount_approved; + $requestLogBenefit->amount_incurred = $request->amount_incurred; + $requestLogBenefit->amount_not_approved = $request->amount_not_approved; + $requestLogBenefit->excess_paid = $request->excess_paid; + $requestLogBenefit->keterangan = $request->keterangan; + + $requestLogBenefit->save(); + + return response()->json([ + 'error' => false, + 'message' => 'Update succses', + 'data' => $requestLogBenefit], + 200); + } + + /** + * Remove the specified resource from storage. + * @param int $id + * @return Renderable + */ + public function destroy($id) + { + $RequestLogMedicine = RequestLogMedicine::findOrFail($id); + $RequestLogMedicine->delete(); + } + +} diff --git a/Modules/Internal/Routes/api.php b/Modules/Internal/Routes/api.php index f4a08dc7..c97454bd 100644 --- a/Modules/Internal/Routes/api.php +++ b/Modules/Internal/Routes/api.php @@ -7,9 +7,10 @@ use Modules\Internal\Http\Controllers\Api\AppointmentController; use Modules\Internal\Http\Controllers\Api\BenefitController; use Modules\Internal\Http\Controllers\Api\CityController; use Modules\Internal\Http\Controllers\Api\ClaimController; +use Modules\Internal\Http\Controllers\Api\ClaimRequestController; use Modules\Internal\Http\Controllers\Api\RequestLogController; use Modules\Internal\Http\Controllers\Api\RequestLogBenefitController; -use Modules\Internal\Http\Controllers\Api\ClaimRequestController; +use Modules\Internal\Http\Controllers\Api\RequestLogMedicineController; use Modules\Internal\Http\Controllers\Api\CorporateBenefitController; use Modules\Internal\Http\Controllers\Api\CorporateController; use Modules\Internal\Http\Controllers\Api\CorporateFormulariumController; @@ -258,12 +259,17 @@ Route::prefix('internal')->group(function () { Route::get('customer-service/request/data', [RequestLogController::class, 'generateDataRequestLogExcel']); Route::post('customer-service/request/final-log', [RequestLogController::class, 'updateFinalLog']); + // insert benefit Route::post('customer-service/request/insert-benefit', [RequestLogBenefitController::class, 'store']); Route::delete('customer-service/request/benefit_data/{id}', [RequestLogBenefitController::class, 'destroy']); Route::put('customer-service/request/benefit_data/{id}', [RequestLogBenefitController::class, 'update']); - + // insert medicine + Route::post('customer-service/request/medicine-data', [RequestLogMedicineController::class, 'store']); + Route::delete('customer-service/request/medicine-data/{id}', [RequestLogMedicineController::class, 'destroy']); + Route::put('customer-service/request/medicine-data/{id}', [RequestLogMedicineController::class, 'update']); + Route::get('search-organizations', [OrganizationController::class, 'searchOrganization']); Route::get('search-specialities', [SpecialityController::class, 'searchSpeciality']); Route::resource('organizations', OrganizationController::class); diff --git a/Modules/Internal/Transformers/RequestLogShowResource.php b/Modules/Internal/Transformers/RequestLogShowResource.php index e9a5c60e..480eb3f1 100644 --- a/Modules/Internal/Transformers/RequestLogShowResource.php +++ b/Modules/Internal/Transformers/RequestLogShowResource.php @@ -7,6 +7,7 @@ use App\Models\CorporateBenefit; use App\Models\ClaimRequest; use App\Models\CorporateService; use App\Models\RequestLogBenefit; +use App\Models\RequestLogMedicine; use App\Models\Exclusion; use App\Models\Icd; use App\Helpers\Helper; @@ -26,6 +27,7 @@ class RequestLogShowResource extends JsonResource $corporateId = $requestLog['member']['current_plan']['corporate_id'] ?? 0; $benefit = CorporateBenefit::with('benefit')->where('plan_id', $corporateId)->get()->toArray(); $benefitDetailLog = RequestLogBenefit::with('benefit')->where('request_log_id', $requestLog['id'])->get()->toArray(); + $medicineDetailLog = RequestLogMedicine::where('request_log_id', $requestLog['id'])->get()->toArray(); $benefitData = []; if (count($benefit)){ foreach($benefit as $data){ @@ -33,13 +35,23 @@ class RequestLogShowResource extends JsonResource } } + // Medicine + $medicineData = []; + if (count($medicineDetailLog)){ + foreach($medicineDetailLog as $data){ + array_push($medicineData, $data); + } + } // Service Rule $corporateService = CorporateService::query() ->where('corporate_id', $corporateId) ->where('service_code', $requestLog['service_code']) ->with(['configs']) ->first(); - $config = $corporateService->configs->pluck('value', 'name')->toArray(); + $config = []; + if ($corporateService) { + $config = $corporateService->configs->pluck('value', 'name')->toArray(); + } // Exclusion Service or diagnosis $exclusions = Exclusion::query() @@ -70,6 +82,7 @@ class RequestLogShowResource extends JsonResource 'benefit_data' => $benefitDetailLog, 'config_service' => $config, 'exclusion' => $exclusions, + 'medicine' => $medicineData, 'files' => $requestLog['files'], diff --git a/app/Models/RequestLogMedicine.php b/app/Models/RequestLogMedicine.php new file mode 100644 index 00000000..2cd1cec8 --- /dev/null +++ b/app/Models/RequestLogMedicine.php @@ -0,0 +1,30 @@ +belongsTo(Benefit::class, 'benefit_id', 'id'); + } +} diff --git a/database/migrations/2023_12_13_091954_create_request_log_medicines_table.php b/database/migrations/2023_12_13_091954_create_request_log_medicines_table.php new file mode 100644 index 00000000..3013006a --- /dev/null +++ b/database/migrations/2023_12_13_091954_create_request_log_medicines_table.php @@ -0,0 +1,34 @@ +id(); + $table->timestamps(); + $table->foreignId('request_log_id'); + $table->integer('price'); + $table->string('medicine'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('request_log_medicines'); + } +}; diff --git a/database/migrations/2023_12_15_153059_add_columns_to_request_logs.php b/database/migrations/2023_12_15_153059_add_columns_to_request_logs.php new file mode 100644 index 00000000..81bb25c6 --- /dev/null +++ b/database/migrations/2023_12_15_153059_add_columns_to_request_logs.php @@ -0,0 +1,32 @@ +dateTime('discharge_date')->after('submission_date')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('request_logs', function (Blueprint $table) { + $table->dropColumn('discharge_date'); + }); + } +}; diff --git a/database/migrations/2023_10_27_111432_create_claim_daily_monitoring_table.php b/database/migrations/2023_12_15_154820_create_request_log_daily_monitoring_table.php similarity index 66% rename from database/migrations/2023_10_27_111432_create_claim_daily_monitoring_table.php rename to database/migrations/2023_12_15_154820_create_request_log_daily_monitoring_table.php index 61713605..f09cf94e 100644 --- a/database/migrations/2023_10_27_111432_create_claim_daily_monitoring_table.php +++ b/database/migrations/2023_12_15_154820_create_request_log_daily_monitoring_table.php @@ -13,9 +13,10 @@ return new class extends Migration */ public function up() { - Schema::create('claim_daily_monitoring', function (Blueprint $table) { - $table->bigIncrements('id'); - $table->integer('claim_id'); + Schema::create('request_log_daily_monitorings', function (Blueprint $table) { + $table->id(); + $table->foreignId('request_log_id'); + $table->timestamps(); $table->text('subject'); $table->decimal('body_temperature', 11, 2); $table->decimal('respiration_rate', 11, 2); @@ -23,7 +24,9 @@ return new class extends Migration $table->decimal('diastole', 11, 2); $table->text('analysis'); $table->text('complaints'); - $table->timestamps(); + $table->dateTime('lab_date')->nullable(); + $table->string('provider')->nullable(); + $table->string('examination')->nullable(); }); } @@ -34,6 +37,6 @@ return new class extends Migration */ public function down() { - Schema::dropIfExists('claim_daily_monitoring'); + Schema::dropIfExists('request_log_daily_monitorings'); } }; diff --git a/frontend/dashboard/src/components/MuiDialog.tsx b/frontend/dashboard/src/components/MuiDialog.tsx index 599eb60f..c9b57835 100644 --- a/frontend/dashboard/src/components/MuiDialog.tsx +++ b/frontend/dashboard/src/components/MuiDialog.tsx @@ -13,7 +13,7 @@ type MuiDialogProps = { openDialog: boolean; setOpenDialog: Function; content?: ReactElement; - action?: ReactElement; + action?: ReactElement|null; maxWidth?: string; }; diff --git a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/ClaimListRow.tsx b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/ClaimListRow.tsx index d89c0ef7..67e46a89 100644 --- a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/ClaimListRow.tsx +++ b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/ClaimListRow.tsx @@ -37,7 +37,7 @@ export default function ClaimListRow ({ ...props }: Props) { td': { borderBottom: '1' } }}> - {props.row.admission_date == "0000-00-00 00:00:00" ? + {props.row.admission_date == null? ('-') : ( @@ -50,7 +50,7 @@ export default function ClaimListRow ({ ...props }: Props) { )} - {props.row.discharge_date == "0000-00-00 00:00:00" ? + {props.row.discharge_date == null ? ('-') : ( @@ -62,9 +62,29 @@ export default function ClaimListRow ({ ...props }: Props) { )} - {props.row.claim_code} - {props.row.service_type} - {props.row.claim_status} + {props.row.code} + {props.row.service_name} + + {props.row.discharge_date == null ? + ( + + ) : + ( + + ) + } + + e.stopPropagation()}> Name Start Date End Date + Admission Date + Provider diff --git a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DailyMonitoringListRow.tsx b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DailyMonitoringListRow.tsx index 40dc5395..2b6df13b 100644 --- a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DailyMonitoringListRow.tsx +++ b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DailyMonitoringListRow.tsx @@ -53,6 +53,15 @@ export default function DailyMonitoringListRow ({ ...props }: Props) { {fDate(props.row.enddate)} + + + + {props.row.provider} e.stopPropagation()}> (''); - const [listChoosed, setListChoosed] = useState([]); - const [isChoosed, setIsChoosed] = useState(false); - const [formIsLoading, setFormIsLoading] = useState(false); - - // List Choose - auto Scroll - // ------------------------- - const fetchFunction = async (page: number): Promise => getMemberList(page, keyword) - - const {data: MemberList, isLoading: scrollIsLoading, setData, resetLastPage, refetchData} = useLoadOnScroll(fetchFunction); - - // List Choose - Search - // ------------------------- - const handleSearch = (keyword: string) => { - setData([]) - resetLastPage() - setKeyword(keyword) - refetchData() - } - - // Function - Clear Form - // ----------------------------- - const clearForm = () => { - setListChoosed(defaultListChoosed); - setIsChoosed(false); - } - - // Function - Choose Patien Type - // ----------------------------- - const handleChoosePatienType = (data: MemberListType, type: string) => { - let newListChoosed = listChoosed.map((list) => { - if (data.id == list.id) { - list.patien_type = type - } - - return list; - }) - setListChoosed(newListChoosed) - } - - // Function - Handle Btn Upload - // ----------------------------- - const handleChangeInput = (data: MemberListType, type_file: 'kondisi'|'diagnosa'|'penunjang', file: any) => { - let newListChoosed = listChoosed.map((list) => { - if (data.id == list.id) { - if (type_file == 'kondisi') { - if (list.file_kondisi == undefined) { - list.file_kondisi = [file]; - } - else { - list.file_kondisi.push(file); - } - } - - if (type_file == 'diagnosa') { - if (list.file_diagnosa == undefined) { - list.file_diagnosa = [file]; - } - else { - list.file_diagnosa.push(file); - } - } - - if (type_file == 'penunjang') { - if (list.file_penunjang == undefined) { - list.file_penunjang = [file]; - } - else { - list.file_penunjang.push(file); - } - } - } - - return list; - }) - - setListChoosed(newListChoosed) - } - - // Function - Handle Remove Fle - // ----------------------------- - const handleRemoveFile = (data: MemberListType, type_file: 'kondisi'|'diagnosa'|'penunjang', target_index: number) => { - let newListChoosed = listChoosed.map((list) => { - if (data.id == list.id) { - if (type_file == 'kondisi') { - list.file_kondisi = list.file_kondisi?.filter((file: any, index: number) =>{ - if (target_index !== index) { - return file; - } - }); - } - - if (type_file == 'diagnosa') { - list.file_diagnosa = list.file_diagnosa?.filter((file: any, index: number) =>{ - if (target_index !== index) { - return file; - } - }); - } - - if (type_file == 'penunjang') { - list.file_penunjang = list.file_penunjang?.filter((file: any, index: number) =>{ - if (target_index !== index) { - return file; - } - }); - } - } - - return list; - }) - - setListChoosed(newListChoosed) - } - - // Function - Handle Submit Form - // ----------------------------- - const handleSubmit = async () => { - setFormIsLoading(true) - let response = await addClaimRequest(listChoosed) - setFormIsLoading(false) - - if (response == true) { - clearForm() - } - } - - - - let isDirty = listChoosed.some((row) => { - if (row.patien_type == undefined) { - return true - } - }) - - return ( - - {/* Back Button */} - - isChoosed==false ? navigate(`/claim-requests`) : setIsChoosed(false)} > - - - - - {'Create Claim Requests'} - - - - {/* Choose Section */} - - {/* Search */} - - handleSearch('')} onSubmit={(keyword) => handleSearch(keyword)} /> - - - - - {/* List */} - - - { - MemberList.map((row, index) => { - return ( - { - checked ? setListChoosed((prevData) => [...prevData, data]) : setListChoosed((items) => items.filter(item => item.id != data.id)) - }} - /> - ) - }) - } - - - - {/* Loading */} - - - - - {/* Submit List */} - - setIsChoosed(true)} /> - - - - - - {/* Input Section */} - - { - listChoosed.map((row, index) => { - return ( - - - {/* Patien Name */} - - - - - {row.name} - - - {row.member_id} - - - - - - - {/* Patien Type */} - - - {row.service_type.map((r,i) => { - const code = r.code - return ( - - - - ) - })} - - - - {/* File Kondisi */} - - - - Condition Document - - - {row.file_kondisi && row.file_kondisi.map((file, index) => ( - - handleRemoveFile(row, 'kondisi', index)} /> - - ))} - - - handleChangeInput(row, 'kondisi', file)} /> - - - - - {/* File Diagnosa */} - - - - Diagnosis Document - - - {row.file_diagnosa && row.file_diagnosa.map((file, index) => ( - - handleRemoveFile(row, 'diagnosa', index)} /> - - ))} - - - handleChangeInput(row, 'diagnosa', file)} /> - - - - - {/* File Penunjang */} - - - - Supporting Result Document - - - {row.file_penunjang && row.file_penunjang.map((file, index) => ( - - handleRemoveFile(row, 'penunjang', index)} /> - - ))} - - - handleChangeInput(row, 'penunjang', file)} /> - - - - - - - ) - }) - } - - - - - handleSubmit()}> - Save Changes - - - - - - ) -} diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateBtnChoose.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateBtnChoose.tsx deleted file mode 100644 index cffd3bc3..00000000 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateBtnChoose.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { styled, Button } from "@mui/material"; -import useCollapseDrawer from "@/hooks/useCollapseDrawer"; - -/** - * Custom Style - * ============================================ -*/ -const DivCustom1 = styled('div')(({ theme }) => ({ - background: 'white', - position: 'fixed', - left: '350px', - right: 0, - bottom: 0, - paddingLeft: '32px', - paddingRight: '32px', - paddingTop: '32px', - paddingBottom: '48px', - [theme.breakpoints.between('sm', 'lg')]: { - left: '0px', - }, -})); - -type Props = { - disabled: boolean, - title : string, - handleClickProp: () => void -} - -export default function FormCreateBtnChoose ({disabled, title, handleClickProp}: Props) { - const { collapseClick } = useCollapseDrawer(); - - return ( - - - - ) -} diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateBtnUpload.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateBtnUpload.tsx deleted file mode 100644 index 23df5ed5..00000000 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateBtnUpload.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { useRef } from "react"; -import { Box, ButtonBase, Typography } from "@mui/material"; -import Iconify from "@/components/Iconify"; - -type Props = { - handleChangeInputProp: (event: any) => void -} - -export default function FormCreateBtnUpload ({handleChangeInputProp}: Props) { - const fileInput = useRef(null); - - return ( - fileInput.current?.click()}> - - - - Upload Result - - - handleChangeInputProp(event.target.files ? event.target.files[0] : {})} - accept="application/pdf" - /> - - ) -} diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateFilesUpload.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateFilesUpload.tsx deleted file mode 100644 index 7ab9d7bd..00000000 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateFilesUpload.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import Iconify from "@/components/Iconify"; -import { ArrowBackIosNew, InsertDriveFile } from '@mui/icons-material'; -import { Stack, Typography } from "@mui/material"; - -type Props = { - file: any, - handleRemoveFileProp: () => void, -} - -export default function FormCreateFilesUpload({ file, handleRemoveFileProp }: Props) { - return ( - - - - {file.name ? file.name : '-'} - - {handleRemoveFileProp()}} - sx={{cursor: 'pointer'}} - > - - ) -} diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateListChoose.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateListChoose.tsx deleted file mode 100644 index 03c8d0b1..00000000 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateListChoose.tsx +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Core - * ============================================ - */ -import { useEffect, useState } from 'react'; -import { Box, FormControlLabel, Grid, Checkbox, Typography, Card} from '@mui/material'; - -/** - * Components - * ============================================ -*/ -// - Global - -import Label from '@/components/Label'; -// - Local - - -/** - * Icon, Utils, Types, Functions, theme, hook - * ============================================ - */ -import { fDateTimesecond } from '@/utils/formatTime'; -import { MemberListType } from '../Model/Types'; -import palette from '@/theme/palette'; - -/** - * Props - * ===================================================== - */ -type Props = { - data: MemberListType, - ListChoosed: MemberListType[], - handleCheckedProp: (checked: boolean, data: MemberListType) => void, -}; - -export default function FormCreateListChoose({data, ListChoosed, handleCheckedProp}: Props) { - const [isChoosed, setIsChoosed] = useState(false) - - useEffect(() => { - setIsChoosed(false); - - ListChoosed.forEach(list => { - if (list.id == data.id) { - setIsChoosed(true); - } - }) - }, [ListChoosed]) - - return ( - - { - return isChoosed ? palette.light.primary.lighter : palette.light.background.default - } - }}> - - handleCheckedProp(checked, data)} />} - checked={isChoosed} - /> - - - - {data.name} - - - {data.member_id} - - - - - - - - ) -} diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateSearch.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateSearch.tsx deleted file mode 100644 index 026b886b..00000000 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormCreateSearch.tsx +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Core - * ============================================ - */ -import { useEffect } from 'react'; -import { useForm } from 'react-hook-form'; -import { Grid } from '@mui/material'; - -/** - * Components - * ============================================ -*/ -// - Global - -import { FormProvider, RHFTextField } from '@/components/hook-form'; -// - Local - - -/** - * Icon, Utils, Types, Functions - * ============================================ - */ -import { Search } from '@mui/icons-material'; -import { SearchType } from '../Model/Types'; - -type Props = { - onSubmit: (keyword: string) => void, - onEmpty: () => void, -}; - -const FormCreateSearch = ({ onSubmit, onEmpty }: Props) => { - const defaultValuesSearchForm = { - keyword: '' - }; - - const methodsSearchForm = useForm({ - defaultValues: defaultValuesSearchForm - }); - - const { handleSubmit, formState: { isDirty } } = methodsSearchForm; - - // search on submit - const onSubmitSearch = (data: SearchType ) => { - onSubmit(data.keyword); - } - - // search on empty - useEffect(() => { - if (isDirty === false) { - onEmpty() - } - },[isDirty]) - - return ( - - - - }} - sx={{ input: { paddingLeft: '14px' } }} - /> - - - - ) -} - -export default FormCreateSearch diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormEdit.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormEdit.tsx deleted file mode 100644 index faa95bf0..00000000 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Components/FormEdit.tsx +++ /dev/null @@ -1,456 +0,0 @@ -import * as Yup from 'yup'; -import { useSnackbar } from 'notistack'; -import { useNavigate } from 'react-router-dom'; -import { yupResolver } from '@hookform/resolvers/yup'; -import { Controller, useForm } from 'react-hook-form'; -import React, { useRef, useEffect, useMemo, useState } from 'react'; -import axios from '../../../utils/axios'; -import { FormProvider, RHFTextField } from '../../../components/hook-form'; - -import { makeFormData } from '@/utils/jsonToFormData'; -import { - Autocomplete, - Button, - Grid, - Stack, - Table, - TableBody, - TableCell, - TableRow, - TextField, - Typography, - useTheme, - List, - ListItem, - IconButton, - ListItemAvatar, - Avatar, - ListItemText, - Card, - InputAdornment, - Divider, - ButtonBase, - Box, -} from '@mui/material'; -import Iconify from '../../../components/Iconify'; -import CalendarTodayIcon from '@mui/icons-material/CalendarToday'; -import { LoadingButton } from '@mui/lab'; -import { fCurrency } from '../../../utils/formatNumber'; -import MemberSelectDialog from '../../../components/dialogs/MemberSelectDialog'; -import { Add, ArrowBackIosNew, DeleteOutline } from '@mui/icons-material'; -import { ClaimRequest, Files } from '@/@types/claims'; -import { fDateTimesecond } from '@/utils/formatTime'; - -interface FormValuesProps extends Partial { - taxes: boolean; - inStock: boolean; -} - -type Props = { - isEdit: boolean; - currentClaim?: ClaimRequest; -}; - -export default function FormEdit({ isEdit, currentClaim }: Props) { - const navigate = useNavigate(); - - const { enqueueSnackbar } = useSnackbar(); - - const EditClaimSchema = Yup.object().shape({ - organization_id: Yup.string().required('Code Provider is required'), - }); - - const defaultValues = useMemo( - () => ({ - id: currentClaim?.id || '-', - code: currentClaim?.code || '-', - member_name: currentClaim?.member?.name || '-', - date: currentClaim?.submission_date ? fDateTimesecond(currentClaim?.submission_date) : '-', - claim_method: currentClaim?.payment_type || '-', - service_type: currentClaim?.service_code || '-', - organization_id: currentClaim?.organization?.code || '-', - }), - [currentClaim] - ); - - useEffect(() => { - if (isEdit && currentClaim) { - reset(defaultValues); - } - if (!isEdit) { - reset(defaultValues); - } - // setFileKondisis(currentClaim?.files_by_type?.claim_diagnosis); - // setFileDiagnosas(currentClaim?.files_by_type?.claim_diagnosis); - setFileHasilPenunjangCurrent(currentClaim?.files_by_type?.claim_result); - }, [isEdit, currentClaim]); - - - const methods = useForm({ - resolver: yupResolver(EditClaimSchema), - defaultValues, - }); - - const { - reset, - watch, - control, - setValue, - getValues, - setError, - handleSubmit, - formState: { isSubmitting }, - } = methods; - - const values = watch(); - - const [isCheckingLimit, setIsCheckingLimit] = useState(false); - const [isEligible, setIsEligible] = useState(false); - const [memberBenefits, setMemberBenefits] = useState([]); - const [diagnosisOption, setDiagnosisOption] = useState([]); - const [isMemberDialogOpen, setIsMemberDialogOpen] = useState(false); - const [member, setMember] = useState({}) - - // ---------------------------------------------------------------------- - - // Files Result Kondisi - const fileKondisiInput = useRef(null); - const [fileKondisis, setFileKondisis] = useState([]); - - const handleKondisiInputChange = (event) => { - if (event.target.files[0]) { - setFileKondisis([...fileKondisis, ...event.target.files]); - } else { - console.log('NO FILE'); - } - }; - const removeKondisiFiles = (filesState, index) => { - setFileKondisis( - filesState.filter((file, fileIndex) => { - return fileIndex != index; - }) - ); - }; - - // Files Result Diagnosa - const fileDiagnosaInput = useRef(null); - const [fileDiagnosas, setFileDiagnosas] = useState([]); - - const handleDiagnosaInputChange = (event) => { - if (event.target.files[0]) { - setFileDiagnosas([...fileDiagnosas, ...event.target.files]); - } else { - console.log('NO FILE'); - } - }; - const removeDiagnosaFiles = (filesState, index) => { - setFileDiagnosas( - filesState.filter((file, fileIndex) => { - return fileIndex != index; - }) - ); - }; - - // Files Result Hasil Penunjang - const fileHasilPenunjangInput = useRef(null); - const [fileHasilPenunjangs, setFileHasilPenunjangs] = useState([]); - const [fileHasilPenunjangsCurrent, setFileHasilPenunjangCurrent] = useState([]); - - const handleResultInputChange = (event) => { - if (event.target.files[0]) { - setFileHasilPenunjangs([...fileHasilPenunjangs, ...event.target.files]); - } else { - console.log('NO FILE'); - } - }; - const removeFiles = (filesState, index) => { - setFileHasilPenunjangs( - filesState.filter((file, fileIndex) => { - return fileIndex != index; - }) - ); - }; - - - const onSubmit = async (data: FormValuesProps) => { - try { - // const formData = new FormData(); - // formData.append('result_files', fileHasilPenunjangs); - // formData.append('diagnosa_files', fileDiagnosaInput); - // formData.append('kondisi_files', fileKondisiInput); - // formData.append('provider_code', data.organization_id); - // formData.append('_method', 'PUT'); - const formData = makeFormData({ - result_files: fileHasilPenunjangs, - diagnosa_files: fileDiagnosas, - kondisi_files: fileKondisis, - provider_code: data.organization_id, - _method: 'PUT' - }); - - const response = await axios.put(`/claim-requests/${data.id}`, formData); - - reset(); - enqueueSnackbar('Claim Request Updated Successfully!', { variant: 'success' }); - navigate('/claim-requests'); - } catch (error: any) { - if (error && error.response.status === 422) { - for (const [key, value] of Object.entries(error.response.data.errors)) { - // setError(key, { message: value[0] }); - enqueueSnackbar('Failed Processing Request', { variant: 'error' }); - } - } else { - enqueueSnackbar(error.message ?? 'Failed Processing Request', { variant: 'error' }); - } - } - }; - - - return ( - - - - navigate(`/claim-requests`)} > - - - - - {'Edit Claim Requests'} - - - - - - - - Code* - - - Name* - - - - - - - - {/* */} - - - - - - Date of Submission* - - - Claim Method* - - - Service Type* - - - Code Provider* - - - - - - - - ), }} - name="date" label="Date of Submission" disabled/> - - - - - - - - - - - - - {/* -------------------------------Upload Dokumen Kondisi------------------------------- */} - - - Condition Document - - - {fileKondisis && - fileKondisis.map((file, index) => ( - - {file.name} - { - removeKondisiFiles(fileKondisis, index); - }} - > - - ))} - - - fileKondisiInput.current?.click()}> - - - - Add File - - - - - - - {/* -------------------------------Upload Dokumen Diagnosa------------------------------- */} - - - Diagnosis Document - - - {fileDiagnosas && - fileDiagnosas.map((file, index) => ( - - {file.name} - { - removeDiagnosaFiles(fileDiagnosas, index); - }} - > - - ))} - - - fileDiagnosaInput.current?.click()}> - - - - Add Result - - - - - - - {/* -------------------------------Upload Result Hasil Penunjang------------------------------- */} - - - Supporting Result Document - - - {fileHasilPenunjangs && - fileHasilPenunjangs.map((file, index) => ( - - {file.name} - { - removeFiles(fileHasilPenunjangs, index); - }} - > - - ))} - - - fileHasilPenunjangInput.current?.click()}> - - - - Add Result - - - - - - - - - - - - - - - Update - - - - - - ); -} diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/CreateUpdate.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/CreateUpdate.tsx deleted file mode 100644 index c710deaa..00000000 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/CreateUpdate.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import * as Yup from 'yup'; -import { Box, IconButton } from '@mui/material'; -import { ArrowBackIosNew } from '@mui/icons-material'; -import { yupResolver } from '@hookform/resolvers/yup'; -import { Autocomplete, Button, Card, Collapse, Container, Divider, Grid, Stack, Table, TableBody, TableCell, TableRow, TextField, Typography } from '@mui/material'; -import { Controller, useForm } from 'react-hook-form'; -import { useParams } from 'react-router-dom'; -import HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs'; -import { FormProvider, RHFCheckbox, RHFSelect, RHFTextField } from '../../components/hook-form'; -import Page from '../../components/Page'; -import useSettings from '../../hooks/useSettings'; -import { useEffect, useMemo, useRef, useState } from 'react'; -import MemberSelectDialog from '../../components/dialogs/MemberSelectDialog'; -import { styled } from '@mui/system'; -import axios from '../../utils/axios'; -import { enqueueSnackbar } from 'notistack'; -import { LoadingButton } from '@mui/lab'; -import { fCurrency } from '../../utils/formatNumber'; -import Iconify from '../../components/Iconify'; -import { ClaimRequest } from '@/@types/claims'; -import FormEdit from './Components/FormEdit'; -import FormCreate from './Components/FormCreate'; - -export default function ClaimsCreateUpdate() { - - const { themeStretch } = useSettings(); - const { id } = useParams(); - - const isEdit = id ? true : false; - - const [currentClaim, setCurrentClaim] = useState(); - - useEffect(() => { - if (isEdit) { - axios.get('/claim-requests/' + id).then((res) => { - console.log('Yeet', res.data); - setCurrentClaim(res.data.data); - }); - - console.log(currentClaim) - } - }, [id]); - - - return ( - - - { - id == undefined - ? - ( - - ) - : - ( - - ) - } - - - - ); -} diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Detail.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Detail.tsx deleted file mode 100644 index 39aa66ab..00000000 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Detail.tsx +++ /dev/null @@ -1,306 +0,0 @@ -// mui -import { Container, Grid, Stack, Typography, Card, TextField, Divider, ButtonBase, Box, IconButton } from '@mui/material'; -// components -import Page from '../../components/Page'; -// utils -import useSettings from '../../hooks/useSettings'; -// react -import { useNavigate, useParams, useLocation } from 'react-router-dom'; -import { useEffect, useState, useRef } from 'react'; -import axios from '../../utils/axios'; -// pages -import DetailTimeline from '../../pages/ClaimRequests/DetailTimeline'; -import DetailStepper from '../../pages/ClaimRequests/DetailStepper'; -import { format } from 'date-fns'; -import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos'; -import Button from '@mui/material/Button'; -import AddIcon from '@mui/icons-material/Add'; -import RemoveIcon from '@mui/icons-material/Remove'; -import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers'; -import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; -import Iconify from '@/components/Iconify'; -import { fPostFormat } from '@/utils/formatTime'; -import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile'; -import DownloadIcon from '@mui/icons-material/Download'; -import { Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material'; -import CloseIcon from '@mui/icons-material/Close'; -import { fDateTimesecond } from '@/utils/formatTime'; -import { makeFormData } from '@/utils/jsonToFormData'; - -import { enqueueSnackbar } from 'notistack'; - -// ---------------------------------------------------------------------- - -export default function Detail() { - const location = useLocation(); - const queryParams = new URLSearchParams(location.search); - const code = queryParams.get('code'); - - const navigate = useNavigate(); - const { themeStretch } = useSettings(); - const [data, setData] = useState(); - const [dataDialog, setDataDialog] = useState(); - const [document, setDocument] = useState(null); - - const { id } = useParams(); - - useEffect(() => { - axios - .get('/claim-requests/detail/'+id) - .then((response) => { - setData(response.data); - setDataDialog(response.data.data.dialog_submits); - setDocument(response.data.data.documents); - - }) - .catch((error) => { - console.error(error); - }); - - }, []); - - const [isInvoiceVisible, setInvoiceVisibility] = useState(false); - - const handleInvoice = () => { - setInvoiceVisibility(!isInvoiceVisible); - } - const currentDate = new Date(); - const formattedCurrentDate = format(currentDate, 'dd MMM yyyy'); - const [dateInvoice, setDateInvoice] = useState(currentDate); - - const fileInvoiceInput = useRef(null); - const [fileInvoices, setFileInvoices] = useState([]); - - const handleInvoiceInputChange = (event) => { - if (event.target.files[0]) { - setFileInvoices([...fileInvoices, ...event.target.files]); - } else { - console.log('NO FILE'); - } - }; - const removeInvoiceFiles = (filesState, index) => { - setFileInvoices( - filesState.filter((file, fileIndex) => { - return fileIndex != index; - }) - ); - }; - const date = dateInvoice ? fPostFormat(dateInvoice, 'yyyy-MM-dd') : null; - - const [openDialogSubmit, setOpenDialogSubmit] = useState(false); - const handleCloseDialogSubmit = () => { - setOpenDialogSubmit(false); - } - const handleSubmitData = () => { - // if(fileInvoices.length > 0) - // { - //submit data - axios - .post('claim-requests/'+id+'/approve') - .then((response) => { - enqueueSnackbar('Success Submit Claim Request', { variant: 'success' }); - setOpenDialogSubmit(false); - }) - .catch(({ response }) => { - enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' }); - }); - //Upload file invoices - const formData = makeFormData({ - date:date, - invoice_files: fileInvoices, - }); - axios - .post('claim-requests/'+id+'/invoice-files', formData) - .then((response) => { - enqueueSnackbar(response.data.message ?? 'Success upload invoice', { variant: 'success' }); - }) - .catch(({ response }) => { - enqueueSnackbar(response.data.message ?? 'Something Went Wrong', { variant: 'error' }); - }); - // } - // else - // { - // enqueueSnackbar('Please upload file invoice, before submit', { variant: 'warning' }); - // } - - setTimeout(() => - { - window.location.reload(); - }, 5000); - - }; - - const check_invoice = document?.find((dataInvoice) => dataInvoice.type === 'claim-invoice'); - - return ( - - - - navigate(-1)} sx={{cursor:'pointer'}}/> - {(data && data.data) ? data.data.status.code : ''} - {data ? ( - - Submission Date - {(data && data.data) ? format(new Date(data.data.status.submission_date), "d MMM yyyy") : ''} - - ) : ''} - - {data ? ( - - - - - - - Format Claim - - - - {check_invoice ? ( - - - Request Claim - - - - ) : ''} - - - - - { - setDateInvoice(newValue); - }} - inputFormat="dd MMM yyyy" - renderInput={(params) => } - /> - - } - spacing={1} - sx={{ marginY: 2 }} - > - {fileInvoices && - fileInvoices.map((file, index) => ( - - - - {file.name ? file.name : '-'} - - { - removeInvoiceFiles(fileInvoices, index); - }} - sx={{cursor: 'pointer'}} - > - - ))} - - fileInvoiceInput.current?.click()}> - - - - Upload Invoice - - - - - - - - - - - - - {dataDialog && dataDialog.status === 'requested' ? ( - <> - - - - ) : ''} - {/* Dialog Submits */} - - - - - Confirmation - - - - - - - - {dataDialog ? ( - - Are you sure to submit this claim ? - - - Code - {dataDialog.code} - - - Name - {dataDialog.name} - - - Date Submission - {fDateTimesecond(dataDialog.submission_date)} - - - Claim Method - Service Type - - - Service Type - - {dataDialog.service_code === 'IP' ? 'Inpatient' : 'Outpatient'} - - - - - ) : ''} - - - - - - - - - - ) : ''} - - - ); -} diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/DetailStepper.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/DetailStepper.tsx deleted file mode 100644 index b788e29f..00000000 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/DetailStepper.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import * as React from 'react'; -import Box from '@mui/material/Box'; -import Stepper from '@mui/material/Stepper'; -import Step from '@mui/material/Step'; -import StepLabel from '@mui/material/StepLabel'; -import { useEffect, useState } from 'react'; -import ClearIcon from '@mui/icons-material/Clear'; - -const steps = [ - 'Request', - 'Review', - 'Approval', - 'Decline', - ]; - - export default function HorizontalLinearAlternativeLabelStepper({data}) { - const [active, setActive] = useState(0); - const [status, SetStatus] = useState(null); - let updatedSteps = [...steps]; - useEffect(() => { - if (data && data.data) { - if (data.data.status.status === 'requested') { - setActive(1); - updatedSteps = updatedSteps.filter(step => step !== 'Decline'); - } - else if (data.data.status.status === 'reviewed') { - setActive(2); - updatedSteps = updatedSteps.filter(step => step !== 'Decline'); - } - else if (data.data.status.status === 'approved') - { - setActive(3); - updatedSteps = updatedSteps.filter(step => step !== 'Decline'); - } - else if(data.data.status.status === 'declined') - { - setActive(4) - updatedSteps = updatedSteps.filter(step => step !== 'Approval'); - } - } - SetStatus(updatedSteps); - }, [data]); - - - - - return ( - - - {status?.map((label) => ( - - : ''}>{label} - - ))} - - - ); -} diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/DetailTimeline.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/DetailTimeline.tsx deleted file mode 100644 index f62a706d..00000000 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/DetailTimeline.tsx +++ /dev/null @@ -1,426 +0,0 @@ -import * as React from 'react'; -import Timeline from '@mui/lab/Timeline'; -import TimelineItem, { timelineItemClasses } from '@mui/lab/TimelineItem'; -import TimelineSeparator from '@mui/lab/TimelineSeparator'; -import TimelineConnector from '@mui/lab/TimelineConnector'; -import TimelineContent from '@mui/lab/TimelineContent'; -import TimelineDot from '@mui/lab/TimelineDot'; -import {Typography, Card, Stack, ButtonBase, Box, Divider} from '@mui/material'; -import { styled } from '@mui/material/styles'; -import Paper from '@mui/material/Paper'; -import Button from '@mui/material/Button'; -import AddIcon from '@mui/icons-material/Add'; -import Iconify from '../../components/Iconify'; -import { useEffect, useState, useRef } from 'react'; -import { format } from 'date-fns'; -import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile'; -import DescriptionIcon from '@mui/icons-material/Description'; -import { LoadingButton } from '@mui/lab'; -import axios from '../../utils/axios'; -import { makeFormData } from '@/utils/jsonToFormData'; -import { enqueueSnackbar } from 'notistack'; -import { useParams} from 'react-router-dom'; - -const Item1 = styled(Paper)(({ theme }) => ({ - ...theme.typography.body2, - padding: theme.spacing(1), - textAlign: 'center', - backgroundColor: '#919EAB29', - color: '#637381', - width: 'fit-content', - marginRight: 'auto', -})); - -const Item2 = styled(Paper)(({ theme }) => ({ - backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', - ...theme.typography.body2, - padding: theme.spacing(1), - textAlign: 'center', - color: theme.palette.text.secondary, - width: 'fit-content', - marginLeft: 'auto', -})); - -export default function NoOppositeContent({data}) { - const [timeline, setTimeline] = useState(null); - const [requestFile, setRequestFile] = useState(null); - const [document, setDocument] = useState(null); - useEffect(() => { - if (data && data.data) { - setTimeline(data.data.timeline); - setRequestFile(data.data.request_files); - setDocument(data.data.documents); - } - - }, [data]); - - // Diagnosis - const fileRequestDocumentInputDiagnosis = useRef(null); - const [fileDiagnosis, setFileDiagnosis] = useState([]); - const handleRequestDocumentInputChangeDiagnosis = (event) => { - if (event.target.files[0]) { - setFileDiagnosis([...fileDiagnosis, ...event.target.files]); - } - }; - const removeFileDiagnois = (filesState, index) => { - setFileDiagnosis( - filesState.filter((file, fileIndex) => { - return fileIndex != index; - }) - ); - }; - // Kondisi - const fileRequestDocumentInputKondisi = useRef(null); - const [fileKondisi, setFileKondisi] = useState([]); - const handleRequestDocumentInputChangeKondisi = (event) => { - if (event.target.files[0]) { - setFileKondisi([...fileKondisi, ...event.target.files]); - } - }; - const removeFileKondisi = (filesState, index) => { - setFileKondisi( - filesState.filter((file, fileIndex) => { - return fileIndex != index; - }) - ); - }; - // Result - const fileRequestDocumentInputResult = useRef(null); - const [fileResult, setFileResult] = useState([]); - const handleRequestDocumentInputChangeResult = (event) => { - if (event.target.files[0]) { - setFileResult([...fileResult, ...event.target.files]); - } - }; - const removeFileResult = (filesState, index) => { - setFileResult( - filesState.filter((file, fileIndex) => { - return fileIndex != index; - }) - ); - }; - const { id } = useParams(); - const [submitLoading, setSubmitLoading] = useState(false); - const submitRequestFiles = () => { - setSubmitLoading(true); - const formData = makeFormData({ - fileDiagnosis: fileDiagnosis, - fileKondisis: fileKondisi, - fileResults: fileResult - }); - axios - .post('claim-requests/'+id+'/request-files', formData) - .then((response) => { - window.location.reload(); - }) - .catch(({ response }) => { - enqueueSnackbar(response.data.message ?? 'Something Went Wrong', { variant: 'error' }); - }); - } - const submitButton = requestFile?.find((dataRequestFile) => dataRequestFile.check_files === null); - return ( - <> - {timeline?.map((dataTimeline, index) => ( - - {dataTimeline.date ? format(new Date(dataTimeline.date), "d MMM yyyy") : ''} - - - - - - - - - - {dataTimeline.date ? format(new Date(dataTimeline.date), "HH : mm") : ''} - {dataTimeline.txt_status} - - - Detail: - {dataTimeline.description} - - {dataTimeline.status === 'reviewed' && requestFile ? ( - <> - {submitButton ? ( - Request Document - ) : ( - Request Document Success Uploaded - )} - {/* Diagnosis */} - {requestFile?.map((dataRequestFile, index) => { - if(dataRequestFile.type !== 'claim-diagnosis' || dataRequestFile.check_files !== null){ - return null; - } - return ( - - - Diagnosis - - } - spacing={1} - sx={{ marginY: 2 }} - > - {fileDiagnosis && - fileDiagnosis.map((file, index) => ( - - - - {file.name ? file.name : '-'} - - { - removeFileDiagnois(fileDiagnosis, index); - }} - sx={{cursor: 'pointer'}} - > - - ))} - - fileRequestDocumentInputDiagnosis.current?.click()} - > - - - - Add Result - - - handleRequestDocumentInputChangeDiagnosis(event)} - accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain, application/pdf" - /> - - - ); - })} - {/* Kondisi */} - {requestFile?.map((dataRequestFile, index) => { - if(dataRequestFile.type !== 'claim-kondisi' || dataRequestFile.check_files !== null){ - return null; - } - return ( - - - Condition - - } - spacing={1} - sx={{ marginY: 2 }} - > - {fileKondisi && - fileKondisi.map((file, index) => ( - - - - {file.name ? file.name : '-'} - - { - removeFileKondisi(fileKondisi, index); - }} - sx={{cursor: 'pointer'}} - > - - ))} - - fileRequestDocumentInputKondisi.current?.click()} - > - - - - Add Result - - - handleRequestDocumentInputChangeKondisi(event)} - accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain, application/pdf" - /> - - - ); - })} - {/* Supporting Result */} - {requestFile?.map((dataRequestFile, index) => { - if(dataRequestFile.type !== 'claim-result' || dataRequestFile.check_files !== null){ - return null; - } - return ( - - - Supporting Result - - } - spacing={1} - sx={{ marginY: 2 }} - > - {fileResult && - fileResult.map((file, index) => ( - - - - {file.name ? file.name : '-'} - - { - removeFileResult(fileResult, index); - }} - sx={{cursor: 'pointer'}} - > - - ))} - - fileRequestDocumentInputResult.current?.click()} - > - - - - Add Result - - - handleRequestDocumentInputChangeResult(event)} - accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain, application/pdf" - /> - - - ); - })} - {submitButton ? ( - { - submitRequestFiles(); - }} - loading={submitLoading} - > - Submit - - ) : ''} - - ) : ''} - - - {dataTimeline.status === 'requested' ? ( - - - - - Documents - - - {document?.map((dataDocument, index) => ( - - - {dataDocument.type === 'claim-diagnosis' ? - 'Diagnosis' - : dataDocument.type === 'claim-kondisi' ? - 'Condition' - : dataDocument.type === 'claim-result' ? - 'Supporting Result' - : dataDocument.type === 'claim-invoice' ? - 'Invoice' - : ''} - - - - - {dataDocument.original_name ? dataDocument.original_name : '-'} - - - - ))} - - - - ) : ''} - - - - ))} - - ); -} diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Index.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Index.tsx index d26903b0..16298e5e 100644 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Index.tsx +++ b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Index.tsx @@ -7,7 +7,7 @@ import List from "./List"; export default function Claims() { - const pageTitle = 'Claim Request'; + const pageTitle = 'Inpatient Monitoring'; return ( @@ -16,8 +16,8 @@ export default function Claims() { links={[ { name: 'Dashboard', href: '/dashboard' }, { - name: 'Claim Request', - href: '/claim-requests', + name: 'Inpatient Monitoring', + href: '/inpatient_monitoring', }, ]} /> diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/List.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/List.tsx index 8bc34214..f734db68 100644 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/List.tsx +++ b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/List.tsx @@ -49,7 +49,7 @@ import Label from '@/components/Label'; import TableMoreMenu from '@/components/table/TableMoreMenu'; import { Import } from '@/@types/claims'; -import { FinalLogType } from './Model/Types'; +import { FinalLogType } from '../../CustomerService/FinalLog/Model/Types'; // import LoadingButton from '@/theme/overrides/LoadingButton'; export default function List() { @@ -344,7 +344,7 @@ export default function List() { {open ? : } */ } - + {/* { // handleShowClaim(row); @@ -352,9 +352,9 @@ export default function List() { > {row.id} - + */} {row.code} - {row.member?.full_name} + {row.member_name} {row.service_name} {row.payment_type_name} @@ -370,11 +370,11 @@ export default function List() { - navigate(`/claim-requests/edit/${row.id}`)}> + {/* navigate(`/claim-requests/edit/${row.id}`)}> Edit - - navigate ('/claim-requests/detail/'+row.id+'')}> + */} + navigate ('/custormer-service/final-log/detail/'+row.id+'')}> Detail @@ -476,9 +476,9 @@ export default function List() { {/* */} - + {/* ID Request LOG - + */} Code diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Model/Functions.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Model/Functions.tsx deleted file mode 100644 index da72ff60..00000000 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Model/Functions.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import axios from '@/utils/axios'; -import { enqueueSnackbar } from 'notistack'; -import { MemberListType } from './Types'; -import { makeFormData } from '@/utils/jsonToFormData'; - -/** - * Listing Member - */ -export const getMemberList = async ( page: number, keyword: string ): Promise => { - const response = await axios.get(`/claim-requests/list-member?page=${page}&keyword=${keyword}`) - .then((res) =>{ - return res.data.data.member_list; - }) - .catch((res) => { - enqueueSnackbar("server error !", { - variant: 'error', - }); - - return []; - }); - - return response; -}; - -/** - * Add Claim Request - */ -export const addClaimRequest = async ( data: MemberListType[] ): Promise => { - // Mapping - const formData = new FormData(); - - data.map((row, index) => { - formData.append(`member_id[${index}]`, row.id.toString()); - formData.append(`service_code[${index}]`, row.patien_type??''); - - if (row.file_kondisi != undefined) { - row.file_kondisi.forEach((file, file_index) => { - console.log(file); - - formData.append(`file_kondisi[member_${row.id}][${file_index}]`, file); - }); - } - - if (row.file_diagnosa != undefined) { - row.file_diagnosa.forEach((file, file_index) => { - console.log(file); - - formData.append(`file_diagnosa[member_${row.id}][${file_index}]`, file); - }); - } - - if (row.file_penunjang != undefined) { - row.file_penunjang.forEach((file, file_index) => { - console.log(file); - - formData.append(`file_penunjang[member_${row.id}][${file_index}]`, file); - }); - } - }) - - // Axios - const response = await axios.post(`/claim-requests`, formData) - .then((res) =>{ - enqueueSnackbar("Berhasil membuat data !", { - variant: 'success', - }); - - return true; - }) - .catch((res) => { - enqueueSnackbar("server error !", { - variant: 'error', - }); - - return false; - }); - - return response; -}; diff --git a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Model/Types.tsx b/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Model/Types.tsx deleted file mode 100644 index e1d99d40..00000000 --- a/frontend/dashboard/src/pages/CaseManagement/InpatientMonitoring/Model/Types.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { Member } from "@/@types/member" - -/** - * Search Type - */ -export type SearchType = { - keyword: string, -} - -/** - * Member List - */ -export type FinalLogType = { - id : number, - code : string, - member : Member, - submission_date : string, - service_name : string, - payment_type_name : string, - status_final_log : string, - status : string, - files_by_type : files_by_type, -} - -export type files_by_type = { - claim_diagnosis : file[], - claim_kondisi : file[], - claim_result : file[], -} - -export type file = { - name: string, - url: string[], -} - - diff --git a/frontend/dashboard/src/pages/CustomerService/Components/CardBenefit.tsx b/frontend/dashboard/src/pages/CustomerService/Components/CardBenefit.tsx new file mode 100644 index 00000000..65addbfe --- /dev/null +++ b/frontend/dashboard/src/pages/CustomerService/Components/CardBenefit.tsx @@ -0,0 +1,214 @@ +import { Card, Grid, MenuItem, Typography } from "@mui/material"; +import { Stack } from '@mui/material'; +import { BenefitData, DetailFinalLogType } from "../FinalLog/Model/Types"; +import { useEffect, useState, useRef, useMemo } from 'react'; +import { Box } from "@mui/material"; + + +import { fDate, fDateTimesecond, toTitleCase } from "@/utils/formatTime"; +import Label from '@/components/Label'; + +import AddIcon from '@mui/icons-material/Add'; +import { Button } from "@mui/material"; +import MoreMenu from "@/components/MoreMenu"; +import { Delete, EditOutlined } from "@mui/icons-material"; +import { fNumber } from "@/utils/formatNumber"; +import palette from "@/theme/palette"; +import DialogBenefit from "../FinalLog/Components/DialogBenefit"; +import DialogEditBenefit from "../FinalLog/Components/DialogEditBenefit"; +import DialogDelete from "../FinalLog/Components/DialogDelete"; + + + +type CardDetail = { + requestLog: DetailFinalLogType|undefined; +} + +const style1 = { + color: '#919EAB', + width: '30%' +} +const style2 = { + width: '70%' +} +const marginBottom1 = { + marginBottom: 1, +} +const marginBottom2 = { + marginBottom: 2, +} + +const [openDialogBenefit, setDialogBenefit] = useState(false); +// Handle Edit Detail Benefit +const [openDialogEditBenefit, setDialogEditBenefit] = useState(false) +const [BenefitConfigurationData, setBenefitConfigurationData] = useState(); + +// Handel Delete Detail Benefit +const [idBenefitData, setIdBenefitData] = useState(); +const [openDialogDeleteBenefit, setDialogDeleteBenefit] = useState(false) + + +export default function CardBenefit({requestLog} : CardDetail ) { + return ( + + + Benefit + + + + {requestLog?.benefit_data?.map((item, index) => ( + + + + + + + {item.benefit?.description} + + + + + { + setDialogEditBenefit(true) + setIdBenefitData(item.id) + setBenefitConfigurationData(item) + }} + > + + Edit + + { + setIdBenefitData(item.id) + setDialogDeleteBenefit(true) + }} + > + + Delete + + + } /> + + + + + + + + {/* Amount Incurred */} + + + + + Amount Incurred + + + + + {fNumber(item.amount_incurred)} + + + + + + {/* Amount Approved */} + + + + + Amount Approved + + + + + {fNumber(item.amount_approved)} + + + + + + {/* Amount Not Approved */} + + + + + Amount Not Approved + + + + + {fNumber(item.amount_not_approved)} + + + + + + {/* Excess Paid* */} + + + + + Excess Paid* + + + + + {fNumber(item.excess_paid)} + + + + + + {/* Keterangan* */} + + + + + Keterangan* + + + + + {item.keterangan} + + + + + + + + + + + + ))} + + {/* Dialog Edit */} + + + + {/* Dialog Delete */} + + + + ) + +} \ No newline at end of file diff --git a/frontend/dashboard/src/pages/CustomerService/Components/CardFile.tsx b/frontend/dashboard/src/pages/CustomerService/Components/CardFile.tsx new file mode 100644 index 00000000..9cb6efb4 --- /dev/null +++ b/frontend/dashboard/src/pages/CustomerService/Components/CardFile.tsx @@ -0,0 +1,50 @@ +import { Card, Typography } from "@mui/material"; +import { Stack } from '@mui/material'; +import { DetailFinalLogType } from "../FinalLog/Model/Types"; +import { fDate, fDateTimesecond, toTitleCase } from "@/utils/formatTime"; + + +type CardDetail = { + requestLog: DetailFinalLogType|undefined; +} + +const style1 = { + color: '#919EAB', + width: '30%' +} +const style2 = { + width: '70%' +} +const marginBottom1 = { + marginBottom: 1, +} +const marginBottom2 = { + marginBottom: 2, +} + + +export default function CardFile({requestLog} : CardDetail ) { + return ( + + + + Files History + {requestLog?.files?.map((documentType, index) => ( + + + + {documentType.original_name ? documentType.original_name : '-'} + + + + ))} + + + + ) + +} \ No newline at end of file diff --git a/frontend/dashboard/src/pages/CustomerService/Components/CardMedicine.tsx b/frontend/dashboard/src/pages/CustomerService/Components/CardMedicine.tsx new file mode 100644 index 00000000..4054024c --- /dev/null +++ b/frontend/dashboard/src/pages/CustomerService/Components/CardMedicine.tsx @@ -0,0 +1,65 @@ +import { Card, Grid, Typography } from "@mui/material"; +import { Stack } from '@mui/material'; +import { DetailFinalLogType } from "../FinalLog/Model/Types"; +import { fDate, fDateTimesecond, toTitleCase } from "@/utils/formatTime"; +import DialogMedicine from "../FinalLog/Components/DialogMedicine"; +import { fNumber } from "@/utils/formatNumber"; +import { Button } from '@mui/material'; +import AddIcon from '@mui/icons-material/Add'; +import { useState } from "react"; + +type CardDetail = { + requestLog: DetailFinalLogType|undefined; +} + +const style1 = { + color: '#919EAB', + width: '30%' +} +const style2 = { + width: '70%' +} +const marginBottom1 = { + marginBottom: 1, +} +const marginBottom2 = { + marginBottom: 2, +} + +const [openDialogMedicine, setDialogMedicine] = useState(false); + + +export default function CardMedicine({requestLog} : CardDetail ) { + return ( + + + Medicine + + + + {requestLog?.medicine.map((item, index) => ( + + {item.medicine} + Rp. {fNumber(item.price)} + + ))} + + {/* */} + + ) + +} \ No newline at end of file diff --git a/frontend/dashboard/src/pages/CustomerService/Components/DetailBenefit.tsx b/frontend/dashboard/src/pages/CustomerService/Components/DetailBenefit.tsx deleted file mode 100644 index de3371b2..00000000 --- a/frontend/dashboard/src/pages/CustomerService/Components/DetailBenefit.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import { Card, Grid, Typography } from "@mui/material"; -import { Stack } from '@mui/material'; -import { DetailFinalLogType } from "../FinalLog/Model/Types"; -import { useEffect, useState, useRef, useMemo } from 'react'; -import { Box } from "@mui/material"; - - -import { fDate, fDateTimesecond, toTitleCase } from "@/utils/formatTime"; -import Label from '@/components/Label'; - -import AddIcon from '@mui/icons-material/Add'; -import { Button } from "@mui/material"; - - - -type CardDetail = { - requestLog: DetailFinalLogType|undefined; -} - -const style1 = { - color: '#919EAB', - width: '30%' -} -const style2 = { - width: '70%' -} -const marginBottom1 = { - marginBottom: 1, -} -const marginBottom2 = { - marginBottom: 2, -} - - - -export default function DetailBenefit({requestLog} : CardDetail ) { - return ( - {requestLog.benefitData?.map((item, index) => ( - - - - - {item.description} - - - - - - - Amount Incurred* - - - - - - - - - - - - - Amount Approved* - - - - - - - - - - - - - Amount Not Approved* - - - - - - - - - - - - - Excess Paid* - - - - - - - - - - - - - Keterangan* - - - - - - - - - - ))} - ) - -} \ No newline at end of file diff --git a/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogConfirmation.tsx b/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogConfirmation.tsx index b53cc2f0..061739d0 100644 --- a/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogConfirmation.tsx +++ b/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogConfirmation.tsx @@ -23,14 +23,15 @@ export default function DialogConfirmation({requestLog, setOpenDialog, openDialo const navigate = useNavigate(); const handleSubmit = () => { const formData = { - status : approve + status : approve, + id: requestLog?.id } axios - .put(`customer-service/request/${requestLog?.id}`, formData) + .post(`customer-service/request/final-log`, formData) .then((response) => { - enqueueSnackbar('Verification Request LOG Success', { variant: 'success' }); + enqueueSnackbar('Verification Final LOG Success', { variant: 'success' }); setOpenDialog(false); - navigate('/custormer-service/request') + navigate('/custormer-service/final-log') }) .catch(({ response }) => { enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' }); @@ -54,7 +55,7 @@ export default function DialogConfirmation({requestLog, setOpenDialog, openDialo const getContent = () => ( - Are you sure to {approve == 'approved' ? 'approve' : 'deciline'} this request ? + Are you sure to {approve == 'approved' ? 'approve' : 'deciline'} this final log ? diff --git a/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogDelete.tsx b/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogDelete.tsx index 1d493427..59669585 100644 --- a/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogDelete.tsx +++ b/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogDelete.tsx @@ -66,4 +66,55 @@ export default function DialogDelete({id, setOpenDialog, openDialog,onSubmit} : maxWidth="xs" /> ); +} + +export function DialogDeleteMedicine({id, setOpenDialog, openDialog,onSubmit} : DialogDeleteType ) { + const handleSubmit = () => { + axios + .delete(`customer-service/request/medicine-data/${id}`) + .then((response) => { + enqueueSnackbar('Benefit Data has Deleted', { variant: 'success' }); + setOpenDialog(false); + window.location.reload() + }) + .catch(({ response }) => { + enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' }); + }); + } + + const style1 = { + color: '#919EAB', + width: '30%' + } + const style2 = { + width: '70%' + } + const marginBottom1 = { + marginBottom: 1, + } + + const handleCloseDialog = () => { + setOpenDialog(false); + } + + const getContent = () => ( + + Are you sure to delete this detail medicine ? + + + + + + ); + + + return ( + + ); } \ No newline at end of file diff --git a/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogDeleteMedicine.tsx b/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogDeleteMedicine.tsx new file mode 100644 index 00000000..bd98ba42 --- /dev/null +++ b/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogDeleteMedicine.tsx @@ -0,0 +1,69 @@ +import MuiDialog from "@/components/MuiDialog"; +import { Button, Card, Checkbox, DialogActions, Grid, Typography } from "@mui/material"; +import { Paper } from "@mui/material"; +import { Stack } from '@mui/material'; +import React, { useState } from 'react'; +import { DetailFinalLogType } from "../Model/Types"; +import { fDateTimesecond, toTitleCase } from "@/utils/formatTime"; +import axios from "@/utils/axios"; +import { enqueueSnackbar } from "notistack"; +import { useNavigate } from "react-router"; + + +type DialogDeleteType = { + openDialog: boolean; + setOpenDialog: any; + onSubmit?: void; + id: number|undefined; +} + +export default function DialogDeleteMedicine({id, setOpenDialog, openDialog,onSubmit} : DialogDeleteType ) { + const handleSubmit = () => { + axios + .delete(`customer-service/request/medicine-data/${id}`) + .then((response) => { + enqueueSnackbar('Benefit Data has Deleted', { variant: 'success' }); + setOpenDialog(false); + window.location.reload() + }) + .catch(({ response }) => { + enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' }); + }); + } + + const style1 = { + color: '#919EAB', + width: '30%' + } + const style2 = { + width: '70%' + } + const marginBottom1 = { + marginBottom: 1, + } + + const handleCloseDialog = () => { + setOpenDialog(false); + } + + const getContent = () => ( + + Are you sure to delete this detail medicine ? + + + + + + ); + + + return ( + + ); +} \ No newline at end of file diff --git a/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogEditBenefit.tsx b/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogEditBenefit.tsx index 50860d19..57063b87 100644 --- a/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogEditBenefit.tsx +++ b/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogEditBenefit.tsx @@ -24,7 +24,7 @@ type DialogDeleteType = { setOpenDialog: any; onSubmit?: void; data: BenefitConfigurationListType|undefined; - id: number; + id: number|undefined; } export default function DialogEditBenefit({id, data, setOpenDialog, openDialog,onSubmit} : DialogDeleteType ) { diff --git a/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogMedicine.tsx b/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogMedicine.tsx index 53cd0ad8..0b9d01ed 100644 --- a/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogMedicine.tsx +++ b/frontend/dashboard/src/pages/CustomerService/FinalLog/Components/DialogMedicine.tsx @@ -1,9 +1,13 @@ +import * as Yup from 'yup'; +import { yupResolver } from '@hookform/resolvers/yup'; + import MuiDialog from "@/components/MuiDialog"; import { Button, Autocomplete, Card, Checkbox, DialogActions, Grid, Typography } from "@mui/material"; import { Paper } from "@mui/material"; import { Stack } from '@mui/material'; -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { DetailFinalLogType } from "../Model/Types"; +import { MedicineType } from "../Model/Types"; import { fDateTimesecond, toTitleCase } from "@/utils/formatTime"; import { useFieldArray, useForm } from 'react-hook-form'; import { FormProvider, RHFDatepicker, RHFSelect, RHFTextField } from '@/components/hook-form'; @@ -13,8 +17,10 @@ import { enqueueSnackbar } from "notistack"; import { useNavigate } from "react-router"; import { LoadingButton } from '@mui/lab'; import AddIcon from '@mui/icons-material/Add'; +import RemoveIcon from '@mui/icons-material/Remove'; import RHFTextFieldMoney from "@/components/hook-form/v2/RHFTextFieldMoney"; - +import { IconButton } from '@mui/material'; +import { postAddMedince } from '../Model/Functions'; type DialogConfirmationType = { openDialog: boolean; @@ -23,128 +29,133 @@ type DialogConfirmationType = { requestLog: DetailFinalLogType|undefined; } -export default function DialogHMedicine({requestLog, setOpenDialog, openDialog } : DialogConfirmationType ) { - - interface FormValuesProps extends Partial { - taxes: boolean; - inStock: boolean; - } - - const onSubmit = async (data: DetailFinalLogType) => { - - reset(); - } - +export default function DialogMedicine({requestLog, setOpenDialog, openDialog } : DialogConfirmationType ) { const handleCloseDialogMedicine = () => { - setOpenDialog(false) - setMedicines([]) + setOpenDialog(false); } - const [medicines, setMedicines] = useState([]); - const addMedicine = () => { - setMedicines((prevMedicines) => [...prevMedicines, { medicine: '', price: '' }]); - + const requestID = requestLog?.id + + const defaultValues: MedicineType = { + medicine : [{ + id: 0, + medicine_name: '', + medicine_price: 0, + request_log_id: requestID, + medicine: '', // input to database + price: 0, // input to database + }], }; - const handleDelete = (index) => { - // Update the medicines state to remove the medicine at the given index - setMedicines((prevMeds) => prevMeds.filter((med, medIndex) => medIndex !== index)); - }; + const validationSchema = Yup.object().shape({ + medicine: Yup.array().of( + Yup.object().shape({ + medicine_name : Yup.string().typeError('').required(''), + medicine_price : Yup.number().typeError('').required(''), + request_log_id : Yup.number().typeError('').required(''), + }) + ) + }) - const removeMedicene = (i:number) => { - const index = medicines.indexOf(i); - if (index > -1) { // only splice array when item is found - medicines.splice(index, 1); // 2nd parameter means remove one item only + const methods = useForm({ + resolver: yupResolver(validationSchema), + defaultValues + }); + + const {fields, append, remove} = useFieldArray({name: 'medicine',control: methods.control}) + + useEffect(() => { + let temp = fields.map((item, i) => { + return { + medicine_name: 'test', + medicine_price: 0, + request_log_id: 3, + } + }) + + reset({medicine: temp}) + }, []) + + + + const { handleSubmit, reset, watch, setValue, formState: { isDirty, isSubmitting, errors } } = methods; + // Submit Form + // ===================================== + const submitHandler = async (data: MedicineType) => { + const response = await postAddMedince(data); + + if (response == true) { + reset(); + // navigate('custormer-service/final-log/detail/'+requestLog?.id); + window.location.reload() } } - - - const methods = useForm(); - const { - reset, - watch, - control, - setValue, - getValues, - setError, - handleSubmit, - resetField, - formState: { isSubmitting }, - } = methods; - - const {fields, append, remove} = useFieldArray({name: "secondary_diagnosis_id", control}) const getContent = () => ( - + {/* Medicine */} Medicine* - - {/* Listing */} - - - - - - - {medicines.map((medicine, index) => ( - + {fields.map((field, index) => ( + - + - {/* - - */} + { + index != (fields.length-1) ? + ( + + remove(index)}> + + + + ) : null + } ))} + + + + + Add + + + ); - const getAction = () => ( - - - - - ); - + const getAction = () => null; return ( diff --git a/frontend/dashboard/src/pages/CustomerService/FinalLog/Detail.tsx b/frontend/dashboard/src/pages/CustomerService/FinalLog/Detail.tsx index f1e97362..480fd05a 100644 --- a/frontend/dashboard/src/pages/CustomerService/FinalLog/Detail.tsx +++ b/frontend/dashboard/src/pages/CustomerService/FinalLog/Detail.tsx @@ -11,6 +11,7 @@ import { Collapse, AccordionSummary, AccordionDetails, + IconButton, } from '@mui/material'; // components import Page from '../../../components/Page'; @@ -37,19 +38,22 @@ import AddIcon from '@mui/icons-material/Add'; import CardDetail from '../Components/CardDetail'; import CardService from '../Components/CardService'; import CardExclusion from '../Components/CardExclusion'; +import CardBenefit from '../Components/CardBenefit'; // Import Dialog import DialogHospitalCare from './Components/DialogHospitalCare'; import DialogBenefit from './Components/DialogBenefit'; import DialogMedicine from './Components/DialogMedicine'; -import DetailBenefit from '../Components/DetailBenefit'; +import DialogDelete from './Components/DialogDelete'; import DialogEditBenefit from './Components/DialogEditBenefit'; +import { DialogDeleteMedicine } from './Components/DialogDelete'; import MoreMenu from '@/components/MoreMenu'; import { MenuItem } from '@mui/material'; import { fNumber } from '@/utils/formatNumber'; import palette from '@/theme/palette'; -import DialogDelete from './Components/DialogDelete'; +import CardMedicine from '../Components/CardMedicine'; +import CardFile from '../Components/CardFile'; // ---------------------------------------------------------------------- @@ -299,7 +303,13 @@ export default function Detail() { - + + {/* PR Buat pindahin ke componen */} + {/* + + */} Medicine - - + {requestLog?.medicine.map((item, index) => ( + + {item.medicine} + Rp. {fNumber(item.price)} + { + setIdBenefitData(item.id) + setDialogDeleteBenefit(true) + }}> + + + + + ))} + + + + {/* File */} - - - - Files History - {requestLog?.files?.map((documentType, index) => ( - - - - {documentType.original_name ? documentType.original_name : '-'} - - - - ))} - - - + {requestLog?.status_final_log == 'requested' ? ( diff --git a/frontend/dashboard/src/pages/CustomerService/FinalLog/Model/Functions.tsx b/frontend/dashboard/src/pages/CustomerService/FinalLog/Model/Functions.tsx index c0831263..753fca55 100644 --- a/frontend/dashboard/src/pages/CustomerService/FinalLog/Model/Functions.tsx +++ b/frontend/dashboard/src/pages/CustomerService/FinalLog/Model/Functions.tsx @@ -1,6 +1,6 @@ import axios from '@/utils/axios'; import { enqueueSnackbar } from 'notistack'; -import { MemberListType } from './Types'; +import { MedicineType, MemberListType } from './Types'; import { BenefitConfigurationListType } from './Types'; import { makeFormData } from '@/utils/jsonToFormData'; @@ -119,7 +119,7 @@ export const postAddBenefit = async (data: BenefitConfigurationListType):Promise /** * Edit Benefit */ -export const postEditBenefit = async (id:number, data: BenefitConfigurationListType):Promise => { +export const postEditBenefit = async (id:number|undefined, data: BenefitConfigurationListType):Promise => { const response = await axios.put(`customer-service/request/benefit_data/${id}`, { ...data }) @@ -151,3 +151,40 @@ export const postEditBenefit = async (id:number, data: BenefitConfigurationListT return response; } + +/** + * Add Medicine + */ + +export const postAddMedince = async (data: MedicineType):Promise => { + const response = await axios.post(`customer-service/request/medicine-data`, { + ...data + }) + .then((res) =>{ + enqueueSnackbar(res.data.message, { + variant: 'success', + }); + + return true; + }) + .catch((res) => { + if (res.response.status == 400) { + let arr_message = res.response.data.message; + + // for (const key in arr_message) { + enqueueSnackbar(arr_message, { + variant: 'warning', + }); + // } + } + else { + enqueueSnackbar("server error !", { + variant: 'error', + }); + } + + return false; + }); + + return response; +} diff --git a/frontend/dashboard/src/pages/CustomerService/FinalLog/Model/Types.tsx b/frontend/dashboard/src/pages/CustomerService/FinalLog/Model/Types.tsx index c89f0369..ad56d099 100644 --- a/frontend/dashboard/src/pages/CustomerService/FinalLog/Model/Types.tsx +++ b/frontend/dashboard/src/pages/CustomerService/FinalLog/Model/Types.tsx @@ -14,6 +14,7 @@ export type FinalLogType = { id : number, code : string, member : Member, + member_name : string, submission_date : string, service_name : string, payment_type_name : string, @@ -41,6 +42,7 @@ export type DetailFinalLogType = { benefit_data : BenefitData[], config_service : ConfigService, exclusion : Exclusion[], + medicine : Medicine[], files : file[], } @@ -51,9 +53,26 @@ export type BenefitData = { excess_paid : number, keterangan : string, benefit : Benefit, + request_log_id : number, + benefit_name : string, + description : string, id : number, } +export type BenefitConfigurationListType = { + request_log_id: number|undefined, + benefit_name: string, + benefit: { + description: string + }, + amount_incurred: number, + amount_approved: number, + amount_not_approved: number, + excess_paid: number, + keterangan: string, + description: string, +} + export type Benefit = { id: number, code: string, @@ -104,15 +123,17 @@ export type Rule = { } - -export type BenefitConfigurationListType = { - request_log_id: number|undefined, - benefit_name: string, - amount_incurred: number, - amount_approved: number, - amount_not_approved: number, - excess_paid: number, - keterangan: string, - description: string, +export type MedicineType = { + medicine: Medicine[], } +export type Medicine = { + id: number, + medicine_name: string, + medicine_price: number, + medicine: string, + price: number, + request_log_id: number|undefined, +} + + diff --git a/resources/views/pdf/guaranted_leter.blade.php b/resources/views/pdf/guaranted_leter.blade.php index 324614f5..8738d901 100644 --- a/resources/views/pdf/guaranted_leter.blade.php +++ b/resources/views/pdf/guaranted_leter.blade.php @@ -123,8 +123,8 @@
Date of Admission
- @if (isset($claimRequest)) -
{{ !empty($claimRequest->submission_date) ? \Carbon\Carbon::parse($claimRequest->submission_date)->format('d/m/Y') : now()->format('d/m/Y') }}
+ @if (isset($requestLog)) +
{{ !empty($requestLog->submission_date) ? \Carbon\Carbon::parse($requestLog->submission_date)->format('d/m/Y') : now()->format('d/m/Y') }}
@else
{{ $dateOfAdmission->format('d/m/Y') }}
@endif @@ -140,7 +140,7 @@ - + @@ -148,18 +148,34 @@ --}} + @if ($member->currentPlan) + @foreach ($member->currentPlan->corporateBenefits as $corporateBenefit) + + + + + + @endforeach + @endif +
Detail BenefitLimit
Medical Check Up As Charged
{{ @$corporateBenefit->benefit->description ?? '' }}
+ - @foreach ($member->currentPlan->corporateBenefits as $corporateBenefit) - - - {{ @$corporateBenefit->benefit->description ?? '' }} - @if($corporateBenefit->limit_amount == 999999999) - As Charged - @else - IDR {{ number_format($corporateBenefit->limit_amount, 0, ',', '.') ?? '' }} - @endif - - @endforeach +
+ + + + + + + @if ($member->currentPlan) + @foreach ($member->currentPlan->corporateBenefits as $corporateBenefit) + + + + + + @endforeach + @endif
Term on Condition
{{ @$corporateBenefit->benefit->description ?? '' }}