diff --git a/Modules/Internal/Http/Controllers/Api/DailyMonitoringController.php b/Modules/Internal/Http/Controllers/Api/DailyMonitoringController.php index 3723de92..b6573618 100644 --- a/Modules/Internal/Http/Controllers/Api/DailyMonitoringController.php +++ b/Modules/Internal/Http/Controllers/Api/DailyMonitoringController.php @@ -2,7 +2,7 @@ namespace Modules\Internal\Http\Controllers\Api; -use App\Models\ClaimDailyMonitoring; +use App\Models\DailyMonitoring; use App\Models\MedicalPlan; use DB; use Exception; @@ -98,7 +98,7 @@ class DailyMonitoringController extends Controller ->where('claim_request_id', empty($claim_request)==false ? $claim_request->id : '') ->first(); - $detail_list = ClaimDailyMonitoring::where('claim_id', empty($claim) == false ? $claim->id : '')->orderBy("created_at", "desc")->get()->makeHidden(['updated_at']); + $detail_list = DailyMonitoring::where('claim_id', empty($claim) == false ? $claim->id : '')->orderBy("created_at", "desc")->get()->makeHidden(['updated_at']); return response()->json([ 'error' => false, @@ -153,7 +153,7 @@ class DailyMonitoringController extends Controller try { // insert claim daily monitoring - $db_response = ClaimDailyMonitoring::create([ + $db_response = DailyMonitoring::create([ 'claim_id' => $claim->id, 'subject' => $request->subject, 'sistole' => $request->sistole, @@ -164,6 +164,27 @@ class DailyMonitoringController extends Controller 'complaints' => $request->complaints, ]); + // cek medical plan + $num_medical_plan = 0; + + foreach ($request->medical_plan as $row) { + if ($row['medical_plan_str']) { + $num_medical_plan++; + } + } + + if ($num_medical_plan == 0) { + DB::rollBack(); + + return response()->json([ + 'error' => true, + 'message' => [ + 'medical_plan' => ['medical plan harus diisi'] + ], + 'data' => [] + ],400); + } + // insert medical plan foreach ($request->medical_plan as $row) { MedicalPlan::create([ diff --git a/Modules/Internal/Http/Controllers/Api/LaboratoriumResultController.php b/Modules/Internal/Http/Controllers/Api/LaboratoriumResultController.php new file mode 100644 index 00000000..81239f6e --- /dev/null +++ b/Modules/Internal/Http/Controllers/Api/LaboratoriumResultController.php @@ -0,0 +1,148 @@ + ':attribute harus diisi', + 'integer' => ':attribute harus angka', + 'unique' => ':attribute (:input) sudah ada', + 'max' => ':attribute maximal :max karakter', + 'exists' => ':attribute (:input) tidak ditemukan', + 'numeric' => ':attribute harus angka', + 'digits_between'=> ':attribute maximal :max digit minimal :min digit' + ]; + } + + /** + * Detail Lab Result List - by claim_code + */ + public function GetDetailLabResultList(Request $request, $claim_code) + { + // get claim request + $claim_request = DB::table('claim_requests') + ->select('id') + ->where('code', $claim_code) + ->first(); + + // get claim + $claim = DB::table('claims') + ->select('id') + ->where('claim_request_id', empty($claim_request)==false ? $claim_request->id : '') + ->first(); + + $detail_list = LaboratoriumResult::where('claim_id', empty($claim) == false ? $claim->id : '')->orderBy("created_at", "desc")->get()->makeHidden(['updated_at']); + + return response()->json([ + 'error' => false, + 'message' => "success", + 'data' => [ + 'lab_result_list'=> $detail_list, + ] + ],200); + } + + /** + * Add Detail Lab Result List + */ + public function AddDetailLabResultList(Request $request, $claim_code) + { + $request->merge(['claim_code' => $claim_code]); + + // validation rule + $validator = Validator::make($request->all(),[ + 'claim_code' => 'required|exists:claim_requests,code', + 'date' => 'required', + 'location' => 'required', + 'examination' => 'required', + 'lab_result_file' => 'required', + ],$this->messages()); + + // validation error + if ($validator->fails()) { + return response()->json([ + 'error' => true, + 'message' => $validator->getMessageBag() + ],400); + } + + // get claim request + $claim_request = DB::table('claim_requests') + ->select('id') + ->where('code', $claim_code) + ->first(); + + // get claim + $claim = DB::table('claims') + ->select('id') + ->where('claim_request_id', $claim_request->id) + ->first(); + + DB::beginTransaction(); + + try { + // insert lab result + $db_response = LaboratoriumResult::create([ + 'claim_id' => $claim->id, + 'date' => $request->date, + 'location' => $request->location, + 'examination' => $request->examination, + ]); + + // insert file result + foreach ($request->lab_result_file as $file) { + $name = 'labresult-' . uniqid(); + $extension= $file->getClientOriginalExtension(); + $fileName = $name . '.' . $extension; + + File::create([ + 'fileable_type' => 'App\Models\LaboratoriumResult', + 'fileable_id' => $db_response->id, + 'type' => 'laboratorium-result', + 'name' => $name, + 'original_name' => $fileName, + 'extension' => $extension, + 'path' => '', + ]); + + $file->storeAs($this->path_for_store, $fileName); + } + + DB::commit(); + + return response()->json([ + 'error' => false, + 'message' => "success", + 'data' => [] + ],200); + } + catch (Exception $e) { + DB::rollBack(); + + return response()->json([ + 'error' => true, + 'message' => $e->getMessage(), + 'data' => [] + ],500); + } + } +} diff --git a/Modules/Internal/Routes/api.php b/Modules/Internal/Routes/api.php index bf539592..fa7dcf5b 100644 --- a/Modules/Internal/Routes/api.php +++ b/Modules/Internal/Routes/api.php @@ -38,6 +38,7 @@ use Modules\Internal\Http\Controllers\Api\SpecialityController; use Modules\Internal\Http\Controllers\Api\VillageController; use Modules\Internal\Http\Controllers\Api\AuditTrailController; use Modules\Internal\Http\Controllers\Api\DailyMonitoringController; +use Modules\Internal\Http\Controllers\Api\LaboratoriumResultController; use Modules\Internal\Http\Controllers\ClaimEncounterController; /* @@ -149,12 +150,20 @@ Route::prefix('internal')->group(function () { Route::get('audittrail/{corporate_id}', [AuditTrailController::class, 'index']); Route::prefix('case_management')->group(function () { + Route::get('memberlist', [DailyMonitoringController::class, 'GetMemberList']); + Route::get('claimlist/{member_id}', [DailyMonitoringController::class, 'GetClaimList']); + + // Daily Monitoring Route::prefix('daily_monitoring')->group(function () { - Route::get('memberlist', [DailyMonitoringController::class, 'GetMemberList']); - Route::get('claimlist/{member_id}', [DailyMonitoringController::class, 'GetClaimList']); Route::get('detail/{claim_code}/list', [DailyMonitoringController::class, 'GetDetailMonitoringList']); Route::post('detail/{claim_code}/add', [DailyMonitoringController::class, 'AddDetailMonitoringList']); }); + + // Laboratorium Result + Route::prefix('laboratorium_result')->group(function () { + Route::get('detail/{claim_code}/list', [LaboratoriumResultController::class, 'GetDetailLabResultList']); + Route::post('detail/{claim_code}/add', [LaboratoriumResultController::class, 'AddDetailLabResultList']); + }); }); Route::get('master/diagnosis-template', [DiagnosisTemplateController::class, 'index']); diff --git a/app/Models/ClaimDailyMonitoring.php b/app/Models/DailyMonitoring.php similarity index 90% rename from app/Models/ClaimDailyMonitoring.php rename to app/Models/DailyMonitoring.php index 1fd11fb9..2285102c 100644 --- a/app/Models/ClaimDailyMonitoring.php +++ b/app/Models/DailyMonitoring.php @@ -6,7 +6,7 @@ use DB; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -class ClaimDailyMonitoring extends Model +class DailyMonitoring extends Model { use HasFactory; @@ -51,7 +51,9 @@ class ClaimDailyMonitoring extends Model $medical_plan = DB::table('medical_plan')->where('claim_daily_monitoring_id','=',$this->attributes['id'])->get(); foreach ($medical_plan as $row) { - $arr_medical_plan[] = $row->plan; + $arr_medical_plan[] = [ + 'medical_plan_str' => $row->plan + ]; } return $arr_medical_plan; diff --git a/app/Models/LaboratoriumResult.php b/app/Models/LaboratoriumResult.php new file mode 100644 index 00000000..de65e237 --- /dev/null +++ b/app/Models/LaboratoriumResult.php @@ -0,0 +1,39 @@ +select('name','original_name','path','extension')->where("type","=","laboratorium-result")->where('fileable_id','=',$this->attributes['id'])->get(); + + foreach ($files as $row) { + $row->path = url($this->path_for_public . "/" . $row->original_name); + + $arr_files[] = [ + 'lab_result_file_obj' => $row + ]; + } + + return $arr_files; + } +} diff --git a/database/migrations/2023_10_28_160127_create_laboratorium_result_table.php b/database/migrations/2023_10_28_160127_create_laboratorium_result_table.php new file mode 100644 index 00000000..77320316 --- /dev/null +++ b/database/migrations/2023_10_28_160127_create_laboratorium_result_table.php @@ -0,0 +1,35 @@ +bigIncrements('id'); + $table->integer('claim_id'); + $table->string('date'); + $table->text('location'); + $table->text('examination'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('laboratorium_result'); + } +}; diff --git a/frontend/dashboard/src/components/hook-form/RHFDatePickerV2.tsx b/frontend/dashboard/src/components/hook-form/RHFDatePickerV2.tsx new file mode 100644 index 00000000..ef1853be --- /dev/null +++ b/frontend/dashboard/src/components/hook-form/RHFDatePickerV2.tsx @@ -0,0 +1,53 @@ +// form +import { useFormContext, Controller } from 'react-hook-form'; +// @mui +import { FormHelperText, TextField } from '@mui/material'; +import { DesktopDatePicker, LocalizationProvider } from '@mui/lab'; +import AdapterDateFns from '@mui/lab/AdapterDateFns'; + +// ---------------------------------------------------------------------- + +interface IProps { + name: string; + label: string; + dateFormat: string; + fullWidth?: boolean; + minDate?: any; + maxDate?: any; + disabled?: boolean; +} + +export default function RHFDatePickerV2({ name, label, dateFormat, minDate, maxDate, disabled, ...other }: IProps) { + const { control } = useFormContext(); + + const { fullWidth } = other; + + return ( + + ( + <> + field.onChange(date)} + inputFormat={dateFormat} + value={field.value} + mask={''} + minDate={(minDate) ? new Date(minDate) : null} + maxDate={(maxDate) ? new Date(maxDate) : null} + renderInput={(params) => } + /> + {!!error && ( + + {error.message} + + )} + + )} + /> + + ); +} diff --git a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringForm.tsx b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringForm.tsx index 2919085e..50905ec4 100644 --- a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringForm.tsx +++ b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringForm.tsx @@ -26,7 +26,7 @@ import RemoveIcon from '@mui/icons-material/Remove'; * Utils, Types, Functions * ============================================ */ -import { AddClaimDetail } from '../Model/Functions'; +import { AddMonitoringDetail } from '../Model/Functions'; import { DetailMonitoringListType} from '../Model/Types'; export default function DetailMonitoringList() { @@ -36,7 +36,10 @@ export default function DetailMonitoringList() { // setup form // ==================================== - const defaultValues: any = { + const defaultValues: DetailMonitoringListType = { + id : '', + claim_code : '', + claim_id : '', subject : '', body_temperature: '', sistole : '', @@ -46,7 +49,8 @@ export default function DetailMonitoringList() { analysis : '', medical_plan : [{ medical_plan_str: '' - }] + }], + created_at : '' }; const methods = useForm({ @@ -62,7 +66,7 @@ export default function DetailMonitoringList() { const submitHandler = async (data: DetailMonitoringListType) => { console.log(claim_code); - const response = await AddClaimDetail(claim_code??'', data); + const response = await AddMonitoringDetail(claim_code??'', data); if (response == true) { reset(); @@ -71,7 +75,7 @@ export default function DetailMonitoringList() { return ( - + navigate(`/case_management/daily_monitoring/${member_id}/claims`)} > diff --git a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringList.tsx b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringList.tsx index 18829123..da31d37d 100644 --- a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringList.tsx +++ b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringList.tsx @@ -28,7 +28,7 @@ import FiberManualRecord from '@mui/icons-material/FiberManualRecord'; * ============================================ */ import { fDate } from "@/utils/formatTime"; -import { AddClaimDetail, getClaimDetailList } from '../Model/Functions'; +import { getMonitoringDetailList } from '../Model/Functions'; import { DetailMonitoringListType } from '../Model/Types'; @@ -50,7 +50,7 @@ export default function DetailMonitoringList() { // Load Data // ------------------- const loadDataTableData = async () => { - const response = await getClaimDetailList(claim_code??''); + const response = await getMonitoringDetailList(claim_code??''); setDetailMonitoringList(response); } @@ -215,10 +215,10 @@ export default function DetailMonitoringList() { { - row.medical_plan.map((str, index) => { + row.medical_plan.map((data, index) => { return ( - {str} + {data.medical_plan_str} ) }) diff --git a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Functions.ts b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Functions.ts index 8ffd0eb8..05ace34d 100644 --- a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Functions.ts +++ b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Functions.ts @@ -6,7 +6,7 @@ import { DailyMonitoringListType, DetailMonitoringListType, ResponseListingClaim * Listing Daily Monitoring */ export const getDailyMonitoringList = async ( ): Promise => { - const response = await axios.get('/case_management/daily_monitoring/memberlist') + const response = await axios.get('/case_management/memberlist') .then((res) =>{ return res.data.data.member_list; }) @@ -25,7 +25,7 @@ export const getDailyMonitoringList = async ( ): Promise => { - const response = await axios.get(`/case_management/daily_monitoring/claimlist/${member_id}`) + const response = await axios.get(`/case_management/claimlist/${member_id}`) .then((res) =>{ return res.data.data; }) @@ -41,9 +41,9 @@ export const getClaimList = async ( member_id: string ): Promise => { +export const AddMonitoringDetail = async ( claim_code: string,data: DetailMonitoringListType ): Promise => { const response = await axios.post(`/case_management/daily_monitoring/detail/${claim_code}/add`, { ...data }) @@ -77,9 +77,9 @@ export const AddClaimDetail = async ( claim_code: string,data: DetailMonitoringL }; /** - * Get Claim Detail List + * Get Monitoring Detail List */ -export const getClaimDetailList = async ( claim_code: string ): Promise => { +export const getMonitoringDetailList = async ( claim_code: string ): Promise => { const response = await axios.get(`/case_management/daily_monitoring/detail/${claim_code}/list`) .then((res) =>{ return res.data.data.detail_list; diff --git a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Types.ts b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Types.ts index d6c1b3be..fc5fc9ac 100644 --- a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Types.ts +++ b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Types.ts @@ -39,7 +39,7 @@ export type ClaimListType = { } /** - * Detail Claim + * Detail Monitoring List */ export type DetailMonitoringListType = { id : string|null, @@ -52,6 +52,10 @@ export type DetailMonitoringListType = { diastole : string analysis : string, complaints : string, - medical_plan : string[], + medical_plan : MedicalPlanStrType[], created_at : string|null } + +export type MedicalPlanStrType = { + medical_plan_str: string +} diff --git a/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Components/DetailLabResultForm.tsx b/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Components/DetailLabResultForm.tsx new file mode 100644 index 00000000..7d6191dd --- /dev/null +++ b/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Components/DetailLabResultForm.tsx @@ -0,0 +1,237 @@ +/** + * Core + * ============================================ + */ +import { useRef } from 'react'; +import { useFieldArray, useForm } from 'react-hook-form'; +import { useNavigate, useParams } from 'react-router-dom'; +import { Box, IconButton, Typography, Grid, Card, Button, ButtonBase, Stack } from '@mui/material'; +import { LoadingButton } from "@mui/lab"; + +/** + * Components + * ============================================ +*/ +import Page from '@/components/Page'; +import { FormProvider, RHFDatepicker, RHFTextField } from '@/components/hook-form'; +import RHFDatePickerV2 from '@/components/hook-form/RHFDatePickerV2'; + +/** + * Icon + * ============================================ + */ +import ArrowBackIosNew from '@mui/icons-material/ArrowBackIosNew'; +import Iconify from '@/components/Iconify'; +import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile'; + +/** + * Utils, Types, Functions + * ============================================ + */ +import { AddLabResultDetail } from '../Model/Functions'; +import { DetailLabResultListType} from '../Model/Types'; + +export default function DetailMonitoringList() { + const { member_id, claim_code } = useParams(); + const navigate = useNavigate() + const pageTitle = claim_code??'_ _ _ _'; + const fileInput = useRef(null); + + // setup form + // ==================================== + const defaultValues: DetailLabResultListType = { + id : '', + claim_id : '', + claim_code : '', + date : '', + location : '', + examination : '', + lab_result_file : [], + created_at : '' + }; + + const methods = useForm({ + defaultValues + }); + + const { handleSubmit, reset, watch, setValue, formState: { isDirty, isSubmitting } } = methods; + const formValues = watch(); + + // Handle File Input + // ===================================== + const handleInputChange = (event: any) => { + if (event.target.files[0]) { + + let arr_lab_result_file = formValues.lab_result_file; + arr_lab_result_file.push(event.target.files[0]); + + setValue('lab_result_file', arr_lab_result_file) + } + else { + console.log('NO FILE'); + } + }; + + // Handle Remove File + // ===================================== + const handleRemoveFile = (target_index: number) => { + let arr_lab_result_file = formValues.lab_result_file.filter((file: any, index: number) =>{ + if (target_index !== index) { + return file; + } + }); + + setValue('lab_result_file', arr_lab_result_file) + }; + + // Submit Form + // ===================================== + const submitHandler = async (data: DetailLabResultListType) => { + const response = await AddLabResultDetail(claim_code??'', data); + + if (response == true) { + reset(defaultValues); + } + } + + return ( + + + navigate(`/case_management/laboratorium_result/${member_id}/claims`)} > + + + + + {pageTitle} + + + + + + + + {/* Date */} + + + + + Date* : + + + + + + + + + {/* Location */} + + + + + Location* : + + + + + + + + + {/* Examination */} + + + + + Examination* : + + + + + + + + + {/* list file & button upload */} + + + + { + formValues.lab_result_file.map((file: any, index: number) => ( + + + + {file.name ? file.name : '-'} + + handleRemoveFile(index)} + sx={{cursor: 'pointer'}} + > + + )) + } + + + fileInput.current?.click()}> + + + + Upload Result + + + + + + + + + {/* Button Cancle & Save */} + + + + + + Save Changes + + + + + + + + + + ) +} diff --git a/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Components/DetailLabResultList.tsx b/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Components/DetailLabResultList.tsx new file mode 100644 index 00000000..6336fd8e --- /dev/null +++ b/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Components/DetailLabResultList.tsx @@ -0,0 +1,165 @@ +/** + * Core + * ============================================ + */ +import { useEffect, useState } from 'react'; +import { useFieldArray, useForm } from 'react-hook-form'; +import { useNavigate, useParams } from 'react-router-dom'; +import { Box, IconButton, Typography, Grid, Card, List, ListItem, Stack, Link } from '@mui/material'; +import { LoadingButton } from "@mui/lab"; + +/** + * Components + * ============================================ +*/ +// - Global - +import Page from '@/components/Page'; +import Label from "@/components/Label"; + +/** + * Icon + * ============================================ + */ +import ArrowBackIosNew from '@mui/icons-material/ArrowBackIosNew'; +import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile'; + +/** + * Utils, Types, Functions + * ============================================ + */ +import { fDate } from "@/utils/formatTime"; +import { getLabResultDetailList } from '../Model/Functions'; +import { DetailLabResultListType } from '../Model/Types'; + + +export default function DetailLabResultList() { + const { member_id, claim_code } = useParams(); + const navigate = useNavigate() + const pageTitle = claim_code??'_ _ _ _'; + + // State + // -------------------- + const [LabResultList, setLabResultList] = useState(); + + // Use Effect + // -------------------- + useEffect(() => { + loadDataTableData(); + }, []) + + // Load Data + // ------------------- + const loadDataTableData = async () => { + const response = await getLabResultDetailList(claim_code??''); + + setLabResultList(response); + } + + return ( + + + {/* back button */} + + + navigate(`/case_management/daily_monitoring/${member_id}/claims`)} > + + + + + {pageTitle} + + + + + {/* tabel claims */} + + + { + LabResultList?.map((row, index) => { + return ( + + + {/* card header */} + + + + + {/* card body */} + + + + + + Date + + + + + {row.date} + + + + + Location + + + + + {row.location} + + + + + Examination + + + + + {row.examination} + + + + + + + + + + Document : + + + + { + row.lab_result_file.map((data, index) => { + return ( + + + + + {data.lab_result_file_obj.original_name??'-'} + + + + ) + }) + } + + + + + + + ) + }) + } + + + + + ); +} diff --git a/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Model/Functions.ts b/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Model/Functions.ts index cb4c94cb..cc674bc6 100644 --- a/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Model/Functions.ts +++ b/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Model/Functions.ts @@ -1,12 +1,14 @@ import axios from '@/utils/axios'; +import { makeFormData } from '@/utils/jsonToFormData'; import { enqueueSnackbar } from 'notistack'; -import { LaboratoriumResultListType, ResponseListingClaimType } from "./Types"; +import { DetailLabResultListType, LaboratoriumResultListType, ResponseListingClaimType } from "./Types"; +import { fDate } from '@/utils/formatTime'; /** * Listing Daily Monitoring */ export const getDailyMonitoringList = async ( ): Promise => { - const response = await axios.get('/case_management/daily_monitoring/memberlist') + const response = await axios.get('/case_management/memberlist') .then((res) =>{ return res.data.data.member_list; }) @@ -25,7 +27,7 @@ export const getDailyMonitoringList = async ( ): Promise => { - const response = await axios.get(`/case_management/daily_monitoring/claimlist/${member_id}`) + const response = await axios.get(`/case_management/claimlist/${member_id}`) .then((res) =>{ return res.data.data; }) @@ -39,3 +41,60 @@ export const getClaimList = async ( member_id: string ): Promise => { + data.date = data.date != '' ? fDate(data.date) : ''; + + const formData = makeFormData({...data}); + + const response = await axios.post(`/case_management/laboratorium_result/detail/${claim_code}/add`, formData) + .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[key][0], { + variant: 'warning', + }); + } + } + else { + enqueueSnackbar("server error !", { + variant: 'error', + }); + } + + return false; + }); + + return response; +}; + +/** + * Get Lab Result Detail List + */ +export const getLabResultDetailList = async ( claim_code: string ): Promise => { + const response = await axios.get(`/case_management/laboratorium_result/detail/${claim_code}/list`) + .then((res) =>{ + return res.data.data.lab_result_list; + }) + .catch((res) => { + enqueueSnackbar("server error !", { + variant: 'error', + }); + + return []; + }); + + return response; +}; diff --git a/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Model/Types.ts b/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Model/Types.ts index 701231a7..8a4e3a8d 100644 --- a/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Model/Types.ts +++ b/frontend/dashboard/src/pages/CaseManagement/LaboratoriumResult/Model/Types.ts @@ -37,3 +37,21 @@ export type ClaimListType = { service_type : string, member_id : string } + +/** + * Detail Lab Result List + */ +export type DetailLabResultListType = { + id : string|null, + claim_id : string|null, + claim_code : string, + date : string, + location : string, + examination : string, + lab_result_file : LabResultFileStrType[], + created_at : string|null +} + +export type LabResultFileStrType = { + lab_result_file_obj: any +} diff --git a/frontend/dashboard/src/pages/ClaimRequests/Detail.tsx b/frontend/dashboard/src/pages/ClaimRequests/Detail.tsx index 3af03ad6..85b17f2b 100644 --- a/frontend/dashboard/src/pages/ClaimRequests/Detail.tsx +++ b/frontend/dashboard/src/pages/ClaimRequests/Detail.tsx @@ -49,7 +49,7 @@ export default function Detail() { .then((response) => { setData(response.data); setDataDialog(response.data.data.dialog_submits); - + }) .catch((error) => { console.error(error); @@ -71,6 +71,8 @@ export default function Detail() { const handleInvoiceInputChange = (event) => { if (event.target.files[0]) { + console.log('ok'); + setFileInvoices([...fileInvoices, ...event.target.files]); } else { console.log('NO FILE'); @@ -84,7 +86,7 @@ export default function Detail() { ); }; const date = dateInvoice ? fPostFormat(dateInvoice, 'yyyy-MM-dd') : null; - + const [openDialogSubmit, setOpenDialogSubmit] = useState(false); const handleCloseDialogSubmit = () => { setOpenDialogSubmit(false); @@ -121,13 +123,13 @@ export default function Detail() { enqueueSnackbar('Please upload file invoice, before submit', { variant: 'warning' }); } - setTimeout(() => + setTimeout(() => { window.location.reload(); }, 5000); - + }; - + return ( @@ -209,7 +211,7 @@ export default function Detail() { placeItems: 'center', gap: 1, placeContent: 'center', - + }} > @@ -297,4 +299,4 @@ export default function Detail() { ); -} \ No newline at end of file +} diff --git a/frontend/dashboard/src/routes/index.tsx b/frontend/dashboard/src/routes/index.tsx index 71a087a2..aec83214 100644 --- a/frontend/dashboard/src/routes/index.tsx +++ b/frontend/dashboard/src/routes/index.tsx @@ -244,6 +244,14 @@ export default function Router() { path: 'laboratorium_result/:member_id/claims', element: }, + { + path: 'laboratorium_result/:member_id/claims/:claim_code/add_lab_result', + element: + }, + { + path: 'laboratorium_result/:member_id/claims/:claim_code/list_lab_result', + element: + }, ] }, { @@ -572,6 +580,8 @@ const DetailMonitoringList = Loadable(lazy(() => import('../pages/CaseManagemen // Laboratorium Result const LaboratoriumResult = Loadable(lazy(() => import('../pages/CaseManagement/LaboratoriumResult/index'))) const LaboratoriumResultClaims = Loadable(lazy(() => import('../pages/CaseManagement/LaboratoriumResult/Claim'))) +const DetailLabResultForm = Loadable(lazy(() => import('../pages/CaseManagement/LaboratoriumResult/Components/DetailLabResultForm'))) +const DetailLabResultList = Loadable(lazy(() => import('../pages/CaseManagement/LaboratoriumResult/Components/DetailLabResultList'))) const MasterDiagnosisTemplate = Loadable(lazy(() => import('../pages/Master/Diagnosis/Master/Index'))); const MasterDiagnosisTemplateCreate = Loadable(lazy(() => import('../pages/Master/Diagnosis/Master/CreateUpdate')));