diff --git a/Modules/Internal/Http/Controllers/Api/CorporateMemberController.php b/Modules/Internal/Http/Controllers/Api/CorporateMemberController.php index 549a01a0..9acc2340 100644 --- a/Modules/Internal/Http/Controllers/Api/CorporateMemberController.php +++ b/Modules/Internal/Http/Controllers/Api/CorporateMemberController.php @@ -21,6 +21,7 @@ use PDF; use Illuminate\Support\Facades\DB; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Facades\File; +use Spatie\Browsershot\Browsershot; class CorporateMemberController extends Controller { @@ -396,34 +397,68 @@ class CorporateMemberController extends Controller } public function sendAllECard(Request $request, $corporate_id){ - $members = DB::table('members') - ->leftJoin('corporate_employees', 'members.id', '=', 'corporate_employees.member_id') - ->where('corporate_employees.corporate_id', $corporate_id) - ->get() - ->toArray(); - - + $members = Member::with([ + 'currentPlan', + 'currentPolicy', + 'currentCorporate', + // 'currentPlan.corporateBenefits.benefit' + ])->whereHas('currentCorporate', function ($query) use ($corporate_id) { + $query->where('corporate_id', $corporate_id); + })->get(); + $data = []; + $countSuccesSend = 0; foreach($members as $member){ - $pdf = PDF::loadView('pdf.ecard', compact(['member'])); // Simpan file PDF ke direktori yang diinginkan - $pdfPath = storage_path('app/pdf/ecards/E-card-' . $member->name . '.pdf'); + $pdfPath = storage_path('app/pdf/ecards/E-card-' . $member->name. '.pdf'); // Cek apakah file sudah ada if (!File::exists($pdfPath)) { - $pdf = PDF::loadView('pdf.ecard', compact('member')); + $pdf = PDF::loadView('pdf.ecard', compact('member'))->setPaper('A5', 'portrait'); $pdf->save($pdfPath); } $dataEmail = [ - 'email' => $member->email, + // 'email' => $member->email, + 'email' => 'tbfajri', 'name' => $member->name, 'subject' => 'Digital E Card '. $member->name, - 'body' => '

Hi ' . $member->name . '

', + 'body' => '

Hi ' . $member->name . '


ini adalah uji coba kirim e-card' , 'attach' => $pdfPath, ]; $sendEmail = Helper::sendEmailattachData($dataEmail); - } + + if ($sendEmail === true){ + $countSuccesSend ++; - return true; + File::delete($pdfPath); + } else { + $dataFaild = [ + 'email' => $member->email, + 'name' => $member->name, + 'message' => $sendEmail + ]; + array_push($data, $dataFaild); + } + } + $response = [ + 'data_fail_send' => count($data), + 'message' => $data, + 'data_succes_send' => $countSuccesSend, + ]; + + return response()->json($response); + } + + public function viewECard(Request $request, $member_id){ + $member = Member::with([ + 'currentPlan', + 'currentPolicy', + 'currentCorporate', + // 'currentPlan.corporateBenefits.benefit' + ])->find($member_id); + + $pdf = PDF::loadView('pdf.ecard', compact('member'))->setPaper('A5', 'portrait'); + return $pdf->download('Ecard - '.$member->full_name.'.pdf'); } + } diff --git a/Modules/Internal/Http/Controllers/Api/DailyMonitoringController.php b/Modules/Internal/Http/Controllers/Api/DailyMonitoringController.php index 1d70de74..d5da9d0f 100644 --- a/Modules/Internal/Http/Controllers/Api/DailyMonitoringController.php +++ b/Modules/Internal/Http/Controllers/Api/DailyMonitoringController.php @@ -3,12 +3,14 @@ namespace Modules\Internal\Http\Controllers\Api; use App\Models\DailyMonitoring; +use App\Models\RequestDailyMonitoring; use App\Models\MedicalPlan; use DB; use Exception; use Illuminate\Http\Request; use Illuminate\Routing\Controller; use Illuminate\Support\Facades\Validator; +use App\Models\File; /** * Bagaskoro BSD 27-10-2023 @@ -17,6 +19,7 @@ use Illuminate\Support\Facades\Validator; */ class DailyMonitoringController extends Controller { + protected $path_for_store = 'public/lab_result'; protected function messages() { return [ @@ -88,21 +91,17 @@ class DailyMonitoringController extends Controller /** * Detail Monitoring List - by claim_code */ - public function GetDetailMonitoringList(Request $request, $claim_code) + public function GetDetailMonitoringList(Request $request, $request_code) { - // get claim request - $claim_request = DB::table('claim_requests') + // get id request log + $request_logs = DB::table('request_logs') ->select('id') - ->where('code', $claim_code) + ->where('code', $request_code) ->first(); - // get claim - $claim = DB::table('claims') - ->select('id') - ->where('claim_request_id', empty($claim_request)==false ? $claim_request->id : '') - ->first(); - - $detail_list = DailyMonitoring::where('claim_id', empty($claim) == false ? $claim->id : '')->orderBy("created_at", "desc")->get()->makeHidden(['updated_at']); + $detail_list = RequestDailyMonitoring::where('request_log_id', empty($request_logs) == false ? $request_logs->id : '') + ->orderBy("created_at", "desc") + ->get(); return response()->json([ 'error' => false, @@ -213,4 +212,194 @@ class DailyMonitoringController extends Controller ],500); } } + + /** + * Add Detail Request LOG LIST + */ + public function AddDetailMonitoringListRequestLog(Request $request, $request_code) + { + $request->merge(['request_code' => $request_code]); + + // validation rule + $validator = Validator::make($request->all(),[ + 'request_code' => 'required|exists:request_logs,code', + 'subject' => 'required', + 'body_temperature' => 'required|numeric', + 'sistole' => 'required|numeric', + 'diastole' => 'required|numeric', + 'respiration_rate' => 'required|numeric', + 'analysis' => 'required', + 'medical_plan' => 'required', + 'non_medikamentosa_plan' => 'required', + ],$this->messages()); + + // validation error + if ($validator->fails()) { + return response()->json([ + 'error' => true, + 'message' => $validator->getMessageBag() + ],400); + } + + // get claim request + $request_log = DB::table('request_logs') + ->select('id') + ->where('code', $request_code) + ->first(); + DB::beginTransaction(); + try { + // insert claim daily monitoring + $db_response = RequestDailyMonitoring::create([ + 'request_log_id' => $request_log->id, + 'subject' => $request->subject, + 'sistole' => $request->sistole, + 'diastole' => $request->diastole, + 'body_temperature' => $request->body_temperature, + 'respiration_rate' => $request->respiration_rate, + 'analysis' => $request->analysis, + 'lab_date' => $request->lab_date, + 'provider' => $request->provider, + 'examination' => $request->examination, + ]); + + + // 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) { + DB::table('request_log_medical_plan')->insert([ + 'request_log_daily_monitoring_id' => $db_response->id, + 'plan' => $row['medical_plan_str'], + 'type' => 1, + 'created_at' => date('Y-m-d'), + ]); + } + + // insert non medical plan + foreach ($request->non_medikamentosa_plan as $row) { + DB::table('request_log_medical_plan')->insert([ + 'request_log_daily_monitoring_id' => $db_response->id, + 'plan' => $row['non_medikamentosa_plan_str'], + 'type' => 2, + 'created_at' => date('Y-m-d'), + ]); + } + + // insert file result + if ($request->confirmation_medical_leter){ + foreach ($request->confirmation_medical_leter as $file) { + $name = 'labresult-' . uniqid(); + $extension= $file->getClientOriginalExtension(); + $fileName = $name . '.' . $extension; + $path = $file->storeAs($this->path_for_store, $fileName); + File::create([ + 'fileable_type' => 'App\Models\LaboratoriumResult', + 'fileable_id' => $db_response->id, + 'type' => 'confirmation-medical-letter', + 'name' => $name, + 'original_name' => $fileName, + 'extension' => $extension, + 'path' => $path, + ]); + + } + } + if ($request->medical_action_letter){ + foreach ($request->medical_action_letter as $file) { + $name = 'labresult-' . uniqid(); + $extension= $file->getClientOriginalExtension(); + $fileName = $name . '.' . $extension; + $path = $file->storeAs($this->path_for_store, $fileName); + File::create([ + 'fileable_type' => 'App\Models\LaboratoriumResult', + 'fileable_id' => $db_response->id, + 'type' => 'medical-action-letter', + 'name' => $name, + 'original_name' => $fileName, + 'extension' => $extension, + 'path' => $path, + ]); + + // $file->storeAs($this->path_for_store, $fileName); + } + } + if ($request->result){ + foreach ($request->result as $file) { + $name = 'labresult-' . uniqid(); + $extension= $file->getClientOriginalExtension(); + $fileName = $name . '.' . $extension; + $path = $file->storeAs($this->path_for_store, $fileName); + File::create([ + 'fileable_type' => 'App\Models\LaboratoriumResult', + 'fileable_id' => $db_response->id, + 'type' => 'laboratorium-result', + 'name' => $name, + 'original_name' => $fileName, + 'extension' => $extension, + 'path' => $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); + } + } + + /** + * Update Status Request LOG + */ + public function UpdateListRequestLog(Request $request, $request_code) + { + // get claim request + $request_log = DB::table('request_logs') + ->where('code', $request_code) + ->update(['discharge_date' => now()]); + if ($request_log) { + return response()->json([ + 'error' => false, + 'message' => "success", + 'data' => [] + ], 200); + } else { + 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 4a262d30..a4b86bba 100644 --- a/Modules/Internal/Routes/api.php +++ b/Modules/Internal/Routes/api.php @@ -170,6 +170,8 @@ Route::prefix('internal')->group(function () { Route::prefix('daily_monitoring')->group(function () { Route::get('detail/{claim_code}/list', [DailyMonitoringController::class, 'GetDetailMonitoringList']); Route::post('detail/{claim_code}/add', [DailyMonitoringController::class, 'AddDetailMonitoringList']); + Route::post('detail/{claim_code}/add-request', [DailyMonitoringController::class, 'AddDetailMonitoringListRequestLog']); + Route::post('detail/{claim_code}/update-status', [DailyMonitoringController::class, 'UpdateListRequestLog']); }); // Laboratorium Result @@ -285,7 +287,8 @@ Route::prefix('internal')->group(function () { Route::post('generate-log/{member_id}', [CorporateMemberController::class, 'generateLog']); - Route::post('send_card/{corporate_id}', [CorporateMemberController::class, 'sendAllECard']); + Route::get('send_card/{corporate_id}', [CorporateMemberController::class, 'sendAllECard']); + Route::get('view_card/{member_id}', [CorporateMemberController::class, 'viewECard']); Route::controller(ClaimRequestController::class)->group(function () { Route::post('files-mcu', 'filesMcu'); }); diff --git a/Modules/Internal/Services/MemberEnrollmentService.php b/Modules/Internal/Services/MemberEnrollmentService.php index 278e7720..4c554386 100644 --- a/Modules/Internal/Services/MemberEnrollmentService.php +++ b/Modules/Internal/Services/MemberEnrollmentService.php @@ -324,6 +324,12 @@ class MemberEnrollmentService // "Ingestion Status", ]; + public $doc_headers_send_email = [ + "Name", + "Email", + "Message" + ]; + public function __construct(Member $member) { app()->setLocale('en'); diff --git a/app/Models/Member.php b/app/Models/Member.php index 1d0435a3..ef95adb6 100644 --- a/app/Models/Member.php +++ b/app/Models/Member.php @@ -255,19 +255,46 @@ class Member extends Model ); } - protected function birthDate(): Attribute + // protected function birthDate(): Attribute + // { + // // $date = $this->person->birth_date ?? ($this->birth_date ?? null); + // $date = $this->birth_date ?? ($this->person->birth_date ?? null); + // return Attribute::make( + // get: fn () => !empty($date) ? Carbon::parse($date)->format('Y-m-d') : null + // ); + // } + + protected function birthDateeCard(): Attribute { // $date = $this->person->birth_date ?? ($this->birth_date ?? null); - $date = $this->person->birth_date ?? ($this->birth_date ?? null); + $date = $this->birth_date ?? ($this->birth_date ?? this->person->birth_date); return Attribute::make( - get: fn () => !empty($date) ? Carbon::parse($date)->format('Y-m-d') : null + get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null + ); + } + + protected function startDate(): Attribute + { + // $date = $this->person->birth_date ?? ($this->birth_date ?? null); + $date = $this->members_effective_date; + return Attribute::make( + get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null + ); + } + + protected function endDate(): Attribute + { + // $date = $this->person->birth_date ?? ($this->birth_date ?? null); + $date = $this->members_expire_date; + return Attribute::make( + get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null ); } protected function gender(): Attribute { return Attribute::make( - get: fn () => $this->person->gender ?? null + get: fn () => ucfirst($this->person->gender) ?? null ); } diff --git a/app/Models/RequestDailyMonitoring.php b/app/Models/RequestDailyMonitoring.php new file mode 100644 index 00000000..6eb1aa77 --- /dev/null +++ b/app/Models/RequestDailyMonitoring.php @@ -0,0 +1,99 @@ +attributes['body_temperature'], 0); + } + + public function getSistoleAttribute() + { + return round($this->attributes['sistole'], 0); + } + + public function getDiastoleAttribute() + { + return round($this->attributes['diastole'], 0); + } + + public function getRespirationRateAttribute() + { + return round($this->attributes['respiration_rate'], 0); + } + + public function getMedicalPlanAttribute() + { + $arr_medical_plan = []; + $medical_plan = DB::table('request_log_medical_plan')->where(['request_log_daily_monitoring_id' => $this->attributes['id'], 'type' => 1])->get(); + + foreach ($medical_plan as $row) { + $arr_medical_plan[] = [ + 'medical_plan_str' => $row->plan + ]; + } + + return $arr_medical_plan; + } + + public function getNonMedikamentosaPlanAttribute() + { + $arr_non_medikamentosa_plan = []; + $non_medikamentosa_plan = DB::table('request_log_medical_plan')->where(['request_log_daily_monitoring_id' => $this->attributes['id'], 'type' => 2])->get(); + + foreach ($non_medikamentosa_plan as $row) { + $arr_non_medikamentosa_plan[] = [ + 'non_medikamentosa_plan_str' => $row->plan + ]; + } + + return $arr_non_medikamentosa_plan; + } + + public function getDocumentAttribute() + { + $arr_document = []; + $document = DB::table('files')->where(['fileable_type' => 'App\Models\LaboratoriumResult', 'fileable_id' => $this->attributes['id']])->get(); + + foreach ($document as $row) { + $arr_document[] = [ + 'file_name' => $row->original_name, + 'path' => env('APP_URL') . '/storage/lab_result/' . $row->original_name, + 'type' => $row->type, + ]; + } + + return $arr_document; + } + + public function getDischargeDateAttribute() + { + return $discharge_date = DB::table('request_logs')->where('id', $this->attributes['request_log_id'])->select('discharge_date')->first(); + } + +} diff --git a/database/migrations/2023_12_27_141340_create_request_log_daily_monitoring.php b/database/migrations/2023_12_27_141340_create_request_log_daily_monitoring.php new file mode 100644 index 00000000..aa6f74e9 --- /dev/null +++ b/database/migrations/2023_12_27_141340_create_request_log_daily_monitoring.php @@ -0,0 +1,33 @@ +id(); + $table->foreignId('request_log_daily_monitoring_id'); + $table->string('plan'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('request_log_medical_plan'); + } +}; diff --git a/database/migrations/2023_12_27_163050_add_column_to_request_log_medical_plan.php b/database/migrations/2023_12_27_163050_add_column_to_request_log_medical_plan.php new file mode 100644 index 00000000..9e3115f5 --- /dev/null +++ b/database/migrations/2023_12_27_163050_add_column_to_request_log_medical_plan.php @@ -0,0 +1,32 @@ +integer('type')->after('plan'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('request_log_medical_plan', function (Blueprint $table) { + $table->dropColumn('type'); + }); + } +}; diff --git a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/ClaimListRow.tsx b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/ClaimListRow.tsx index 3b758f82..e08b4db5 100644 --- a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/ClaimListRow.tsx +++ b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/ClaimListRow.tsx @@ -22,6 +22,8 @@ import TableMoreMenu from '@/components/table/TableMoreMenu'; */ import { fDate } from "@/utils/formatTime"; import { ClaimListType } from "../Model/Types"; +import { ClearOutlined, LoopOutlined } from "@mui/icons-material"; +import DialogConfirmation from "./DialogConfirmation"; type Props = { row: ClaimListType, @@ -30,6 +32,14 @@ type Props = { export default function ClaimListRow ({ ...props }: Props) { const navigate = useNavigate() + const [openDialogSubmit, setOpenDialogSubmit] = useState(false); + const [code, setCode] = useState(''); + const [member_id, setMemberId] = useState(''); + const handleUpdate = (code: string, member_id: string) => { + setOpenDialogSubmit(true) + setMemberId(member_id) + setCode(code) + } return ( @@ -87,21 +97,45 @@ export default function ClaimListRow ({ ...props }: Props) { e.stopPropagation()}> - - navigate(`/case_management/daily_monitoring/${props.row.member_id}/claims/${props.row.code}/list_monitoring`)}> - - View - - navigate(`/case_management/daily_monitoring/${props.row.member_id}/claims/${props.row.code}/add_monitoring`)}> - - Daily Monitoring - - - } /> + {props.row.discharge_date == null ? + ( + + navigate(`/case_management/daily_monitoring/${props.row.member_id}/claims/${props.row.code}/list_monitoring`)}> + + View + + navigate(`/case_management/daily_monitoring/${props.row.member_id}/claims/${props.row.code}/add_monitoring`)}> + + Daily Monitoring + + handleUpdate(props.row.code, props.row.member_id)}> + + Update Status + + + } /> + ) : + ( + + navigate(`/case_management/daily_monitoring/${props.row.member_id}/claims/${props.row.code}/list_monitoring`)}> + + View + + + } /> + ) + } + + ); diff --git a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringForm.tsx b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringForm.tsx index fae9e07d..0960b7ab 100644 --- a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringForm.tsx +++ b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringForm.tsx @@ -4,7 +4,7 @@ */ import { useFieldArray, useForm } from 'react-hook-form'; import { useNavigate, useParams } from 'react-router-dom'; -import { Box, IconButton, Typography, Grid, Card, Button, ButtonBase } from '@mui/material'; +import { Box, IconButton, Typography, Grid, Card, Button, ButtonBase, Stack } from '@mui/material'; import { LoadingButton } from "@mui/lab"; /** @@ -13,6 +13,7 @@ import { LoadingButton } from "@mui/lab"; */ import Page from '@/components/Page'; import { FormProvider, RHFTextField } from '@/components/hook-form'; +import RHFDatePickerV2 from '@/components/hook-form/RHFDatePickerV2'; /** * Icon @@ -21,6 +22,7 @@ import { FormProvider, RHFTextField } from '@/components/hook-form'; import ArrowBackIosNew from '@mui/icons-material/ArrowBackIosNew'; import AddIcon from '@mui/icons-material/Add'; import RemoveIcon from '@mui/icons-material/Remove'; +import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile'; /** * Utils, Types, Functions @@ -37,7 +39,9 @@ export default function DetailMonitoringList() { const { member_id, claim_code } = useParams(); const navigate = useNavigate() const pageTitle = claim_code??'_ _ _ _'; - const fileInput = useRef(null); + const fileInput1 = useRef(null); + const fileInput2 = useRef(null); + const fileInput3 = useRef(null); // setup form // ==================================== @@ -58,7 +62,13 @@ export default function DetailMonitoringList() { non_medikamentosa_plan : [{ non_medikamentosa_plan_str: '' }], - created_at : '' + confirmation_medical_leter : [], + medical_action_letter : [], + result : [], + created_at : '', + lab_date : '', + provider : '', + examination : '', }; const methods = useForm({ @@ -72,29 +82,75 @@ export default function DetailMonitoringList() { const formValues = watch(); // Handle File Input // ===================================== - const handleInputChange = (event: any) => { + const handleInputChangeConfirmationMedicalLeter = (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]); + let arr_confirmation_medical_leter_file = formValues.confirmation_medical_leter; + arr_confirmation_medical_leter_file.push(event.target.files[0]); - setValue('lab_result_file', arr_lab_result_file) + setValue('confirmation_medical_leter', arr_confirmation_medical_leter_file); + } + else { + console.log('NO FILE'); + } + }; + const handleInputChangeMedicalActionLetter = (event: any) => { + if (event.target.files[0]) { + + let arr_medical_action_letter = formValues.medical_action_letter; + arr_medical_action_letter.push(event.target.files[0]); + + setValue('medical_action_letter', arr_medical_action_letter) + console.log('test2') } else { console.log('NO FILE'); } }; + const handleInputChangeResult = (event: any) => { + if (event.target.files[0]) { + + let arr_result = formValues.result; + arr_result.push(event.target.files[0]); + + setValue('result', arr_result) + console.log('test3') + } + 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) =>{ + const handleRemoveFileConfirmationMedicalLeter = (target_index: number) => { + let arr_confirmation_medical_leter_file = formValues.confirmation_medical_leter.filter((file: any, index: number) =>{ if (target_index !== index) { return file; } }); - setValue('lab_result_file', arr_lab_result_file) + setValue('confirmation_medical_leter', arr_confirmation_medical_leter_file) + }; + const handleRemoveFileMedicalActionLetter = (target_index: number) => { + let arr_medical_action_letter = formValues.medical_action_letter.filter((file: any, index: number) =>{ + if (target_index !== index) { + return file; + } + }); + + setValue('medical_action_letter', arr_medical_action_letter) + }; + const handleRemoveFileResult = (target_index: number) => { + let arr_result = formValues.result.filter((file: any, index: number) =>{ + if (target_index !== index) { + return file; + } + }); + + setValue('result', arr_result) }; // Submit Form @@ -106,8 +162,8 @@ export default function DetailMonitoringList() { if (response == true) { reset(); - navigate('case_management/daily_monitoring/'+claim_code+'claims'); - window.location.reload() + navigate('/case_management/daily_monitoring/'+member_id+'/claims', { replace: true }); + // window.location.reload() } } @@ -370,7 +426,7 @@ export default function DetailMonitoringList() { { - formValues.lab_result_file.map((file: any, index: number) => ( + formValues.confirmation_medical_leter.map((file: any, index: number) => ( @@ -379,7 +435,7 @@ export default function DetailMonitoringList() { handleRemoveFile(index)} + onClick={() => handleRemoveFileConfirmationMedicalLeter(index)} sx={{cursor: 'pointer'}} > @@ -387,7 +443,7 @@ export default function DetailMonitoringList() { } - fileInput.current?.click()}> + fileInput1.current?.click()}> - Upload Result + Upload File handleInputChangeConfirmationMedicalLeter(e)} accept="application/pdf" /> @@ -417,8 +473,165 @@ export default function DetailMonitoringList() { {/* Medical Action Letter */} + + + + + Medical Action Letter* + + + + { + formValues.medical_action_letter.map((file: any, index: number) => ( + + + + {file.name ? file.name : '-'} + + handleRemoveFileMedicalActionLetter(index)} + sx={{cursor: 'pointer'}} + > + + )) + } + + + fileInput2.current?.click()}> + + + + Upload File + + + + + + + + - {/* Button Cancle & Save */} + + {/* Laboratorium */} + + + + + Laboratorium Result* + + + + + Date* + + + + + Provider* + + + + + + + + + + + + Examination* + + + + + + + + Laboratorium Result* + + + + { + formValues.result.map((file: any, index: number) => ( + + + + {file.name ? file.name : '-'} + + handleRemoveFileResult(index)} + sx={{cursor: 'pointer'}} + > + + )) + } + + + fileInput3.current?.click()}> + + + + Upload File + + + + + + + + + + + {/* Button Cancel & Save */} @@ -426,7 +639,7 @@ export default function DetailMonitoringList() { Cancel - Save Changes + Add diff --git a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringList.tsx b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringList.tsx index da31d37d..3c96fa02 100644 --- a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringList.tsx +++ b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DetailMonitoringList.tsx @@ -27,7 +27,7 @@ import FiberManualRecord from '@mui/icons-material/FiberManualRecord'; * Utils, Types, Functions * ============================================ */ -import { fDate } from "@/utils/formatTime"; +import { fDate, fDateOnly } from '@/utils/formatTime'; import { getMonitoringDetailList } from '../Model/Functions'; import { DetailMonitoringListType } from '../Model/Types'; @@ -87,6 +87,22 @@ export default function DetailMonitoringList() { > {row.created_at ? fDate(row.created_at) : '-'} + + {row.discharge_date.discharge_date ? + () : ()} + {/* card body */} @@ -160,21 +176,6 @@ export default function DetailMonitoringList() { - - - - - Subject : - - - - - {row.subject} - - - - - @@ -190,21 +191,6 @@ export default function DetailMonitoringList() { - - - - - Complaints : - - - - - {row.complaints} - - - - - @@ -215,7 +201,7 @@ export default function DetailMonitoringList() { { - row.medical_plan.map((data, index) => { + row.medical_plan?.map((data, index) => { return ( {data.medical_plan_str} @@ -227,6 +213,164 @@ export default function DetailMonitoringList() { + + + + + + Non Medikamentosa Plan : + + + + + { + row.non_medikamentosa_plan?.map((data, index) => { + return ( + + {data.non_medikamentosa_plan_str} + + ) + }) + } + + + + + + + + + + Laboratorium Result : + + + + + + Date + + + + + { row.lab_date != null ? fDate(row.lab_date) : '-'} + + + + + + + Location + + + + + {row.provider} + + + + + + + Examination + + + + + {row.examination} + + + + + + + + + + + Document Confirmation Medical Letter: + + + + + {row.document?.map((data, index) => ( + + {data.type === 'confirmation-medical-letter' ? ( + <> + + + {data.file_name} + + + ) : null} + + ))} + + + + + + + + + Document Medical Action Letter: + + + + + {row.document?.map((data, index) => ( + + {data.type === 'medical-action-letter' ? ( + <> + + + {data.file_name} + + + ) : null} + + ))} + + + + + + + + + Document Laboratorium Result: + + + + + {row.document?.map((data, index) => ( + + {data.type === 'laboratorium-result' ? ( + <> + + + {data.file_name} + + + ) : null} + + ))} + + + + + diff --git a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DialogConfirmation.tsx b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DialogConfirmation.tsx new file mode 100644 index 00000000..d391a9ad --- /dev/null +++ b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Components/DialogConfirmation.tsx @@ -0,0 +1,92 @@ +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 { fDate, fDateTimesecond, toTitleCase } from "@/utils/formatTime"; +import axios from "@/utils/axios"; +import { enqueueSnackbar } from "notistack"; +import { useNavigate } from "react-router"; +import { replace } from "lodash"; +import { ClaimListType } from "../Model/Types"; +import Label from "@/components/Label"; + + +type DialogConfirmationType = { + openDialog: boolean; + setOpenDialog: any; + onSubmit?: void; + row: ClaimListType; +} + +export default function DialogConfirmation({ setOpenDialog, openDialog, row} : DialogConfirmationType ) { + + const navigate = useNavigate(); + const handleSubmit = () => { + axios + .post(`case_management/daily_monitoring/detail/${row.code}/update-status`) + .then((response) => { + enqueueSnackbar('Close Monitoring Success', { variant: 'success' }); + setOpenDialog(false); + navigate(`/case_management/daily_monitoring/${row.member_id}/claims`, { replace: true }) + 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 closed this monitoring ? + + + + Name + {row.name} + + + Code + {row.code} + + + Admision Date + + + + + + + + + + + + ); + + + return ( + + ); +} \ No newline at end of file diff --git a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Functions.ts b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Functions.ts index 05ace34d..fd68763e 100644 --- a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Functions.ts +++ b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Functions.ts @@ -1,6 +1,8 @@ import axios from '@/utils/axios'; +import { makeFormData } from '@/utils/jsonToFormData'; import { enqueueSnackbar } from 'notistack'; import { DailyMonitoringListType, DetailMonitoringListType, ResponseListingClaimType } from "./Types"; +import { fDate, fDateOnly } from '@/utils/formatTime'; /** * Listing Daily Monitoring @@ -44,9 +46,11 @@ export const getClaimList = async ( member_id: string ): Promise => { - const response = await axios.post(`/case_management/daily_monitoring/detail/${claim_code}/add`, { - ...data - }) + data.lab_date = data.lab_date != '' && data.lab_date != null ? fDateOnly(data.lab_date) : ''; + + const formData = makeFormData({...data}); + + const response = await axios.post(`/case_management/daily_monitoring/detail/${claim_code}/add-request`, formData) .then((res) =>{ enqueueSnackbar(res.data.message, { variant: 'success', diff --git a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Types.ts b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Types.ts index 5d8c058d..3e4706c5 100644 --- a/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Types.ts +++ b/frontend/dashboard/src/pages/CaseManagement/DailyMonitoring/Model/Types.ts @@ -35,6 +35,7 @@ export type ClaimListType = { admission_date : string, discharge_date : string, claim_code : string, + name : string, code : string, service_name : string, claim_status : string, @@ -56,8 +57,15 @@ export type DetailMonitoringListType = { diastole : string analysis : string, complaints : string, + lab_date : string, + provider : string, + examination : string, medical_plan : MedicalPlanStrType[], non_medikamentosa_plan : NonMedikamentosaPlanType[], + confirmation_medical_leter : files[], + medical_action_letter : files[], + result : files[], + document : document[], created_at : string|null } @@ -68,3 +76,13 @@ export type MedicalPlanStrType = { export type NonMedikamentosaPlanType = { non_medikamentosa_plan_str: string } + +export type files = { + file: string +} + +export type document = { + file_name: string, + path: string, + type: string +} diff --git a/frontend/dashboard/src/pages/Corporates/Member/List.tsx b/frontend/dashboard/src/pages/Corporates/Member/List.tsx index b2e0c17e..b6030f4f 100644 --- a/frontend/dashboard/src/pages/Corporates/Member/List.tsx +++ b/frontend/dashboard/src/pages/Corporates/Member/List.tsx @@ -94,6 +94,7 @@ export default function CorporatePlanList({handleSubmitSuccess}) { const { corporate_id } = useParams(); const [searchParams, setSearchParams] = useSearchParams(); const [importResult, setImportResult] = useState(null); + const [sendResult, setSendResult] = useState(null); const [openDialog, setOpenDialog] = useState(false); const [isDialog, setIsDialog] = useState(''); @@ -267,6 +268,25 @@ export default function CorporatePlanList({handleSubmitSuccess}) { }); } + const handleSendAllEcard = () => { + setImportLoading(true); + setDataTableLoading(true); + axios + .get(`send_card/${corporate_id}`) + .then((response) => { + loadDataTableData(); + }) + + .catch((response) => { + enqueueSnackbar( + 'Looks like something went wrong. Please check your data and try again.', + { variant: 'error' } + ); + setImportLoading(false); + loadDataTableData(); + }); + } + const handleCancelImportButton = () => { importPlan.current.value = ''; importPlan.current.dispatchEvent(new Event('change', { bubbles: true })); @@ -363,6 +383,9 @@ export default function CorporatePlanList({handleSubmitSuccess}) { Download Member + + Send All Ecard + )} @@ -413,6 +436,7 @@ export default function CorporatePlanList({handleSubmitSuccess}) { )} + ); } @@ -470,6 +494,21 @@ export default function CorporatePlanList({handleSubmitSuccess}) { const style1 = { color: '#637381' } + + + const handleDownloadEcard = (id: number) => { + axios + .get(`view_card/${id}`, { + responseType: 'blob', + }) + .then((response) => { + window.open(URL.createObjectURL(response.data)); + }) + .catch((response) => { + enqueueSnackbar(response.message, { variant: 'error' }); + }); + } + return ( @@ -527,6 +566,10 @@ export default function CorporatePlanList({handleSubmitSuccess}) { Update Status + handleDownloadEcard(row.id)}> + + Download E-card + navigate ('/corporates/'+corporate_id+'/members/'+row.id+'/history')}> History diff --git a/public/images/background-vale.png b/public/images/background-vale.png new file mode 100644 index 00000000..e41e2fa3 Binary files /dev/null and b/public/images/background-vale.png differ diff --git a/public/images/logo-default.png b/public/images/logo-default.png new file mode 100644 index 00000000..267e2e13 Binary files /dev/null and b/public/images/logo-default.png differ diff --git a/resources/views/pdf/ecard.blade.php b/resources/views/pdf/ecard.blade.php index 003b4dfa..99c30f7e 100644 --- a/resources/views/pdf/ecard.blade.php +++ b/resources/views/pdf/ecard.blade.php @@ -2,7 +2,6 @@ - Guarantee Letter {{ $member->name }} {{-- --}} @@ -13,69 +12,111 @@ src: url('{{asset('fonts/PublicSans-Medium.ttf')}}') format('truetype'); } */ + html, body { + height: 100%; + margin: 0; + padding: 0; + } + body { font-family: 'Public Sans'; color: #404040; font-size: 20px; + margin: 0; /* Reset default margin */ + padding: 0; /* Reset default padding */ + background-image: url("{{ public_path('images/background-vale.png') }}"); + background-repeat: no-repeat; + background-size: cover; /* Adjust as needed */ } .text-sm { font-size: 18px; + color: #FFFFFF } .text-md { - font-size: 20px; + font-size: 18px; + color: #159C9C } .text-lg { font-size: 22px; + color: #117D7D; + } .text-gray { color: #919EAB; } - - #member-detail{ - - } - #member-detail td { - width: 50%; - padding: 10px 0px; - } - #member-detail td>div{ - margin-bottom: 5px; + + .content { + margin: 10% 0 0 0; } - .benefit-table-wrapper { - border: 1px solid #E0E0E0; - border-radius: 5px; - overflow: hidden; - } - #benefit-table { - width: 100%; - border-collapse: collapse; + .image-container { + margin-left: 75%; /* Adjust the margin as needed */ } - #benefit-table th, #benefit-table th { - width: 50%; + .label { + background-color: #117D7D; + color: #fff; + border-radius: 15px; + padding: 8px; /* Sesuaikan dengan kebutuhan Anda */ + font-size: 18px; + gap: 4px; + display: inline-flex; /* Untuk memastikan ikon dan teks berada dalam satu baris */ + align-items: center; /* Untuk memastikan ikon dan teks berada dalam satu baris */ } - #benefit-table th{ - font-size: 20px; - font-weight: 400; - padding: 15px; - text-align: left; + .label svg { + margin-right: 4px; /* Jarak antara ikon dan teks */ } - #benefit-table tr:first-child { - background: #F5F5F5; - border-bottom: 1px solid #E0E0E0; + .text-sm { + font-size: 18px; /* Sesuaikan dengan kebutuhan Anda */ } - #benefit-table td { - padding: 15px; - font-size: 20px; - } + -

Hi {{ $member->name }}

+



+
+
+ Member Name +

{{ $member->fullName }}

+ + Member ID +

{{ $member->member_id }}

+ + Policy Holder +

{{ $member->currentCorporate->name }}

+ + Policy Number +

{{ $member->currentPolicy->code }}

+ + Date of Birth +

{{ $member->birthDateeCard }}

+ + Gender +

{{ $member->gender }}

+ + Start Date +

{{ $member->startDate }}

+ +
+ +
+ + + + + + 08114123962 + + + Valid until: {{ $member->endDate }} +
+ +
+ + \ No newline at end of file