diff --git a/src/Components/Facility/DischargeModal.tsx b/src/Components/Facility/DischargeModal.tsx index 138e74fb9b9..3384efa686b 100644 --- a/src/Components/Facility/DischargeModal.tsx +++ b/src/Components/Facility/DischargeModal.tsx @@ -8,9 +8,7 @@ import ClaimDetailCard from "../HCX/ClaimDetailCard"; import { ConsultationModel } from "./models"; import CreateClaimCard from "../HCX/CreateClaimCard"; import { DISCHARGE_REASONS } from "../../Common/constants"; -import DateFormField from "../Form/FormFields/DateFormField"; import DialogModal from "../Common/Dialog"; -import { FieldChangeEvent } from "../Form/FormFields/Utils"; import { FieldLabel } from "../Form/FormFields/FormField"; import { HCXActions } from "../../Redux/actions"; import { HCXClaimModel } from "../HCX/models"; @@ -161,11 +159,6 @@ const DischargeModal = ({ setIsSendingDischargeApi(false); if (dischargeResponse?.status === 200) { - // TODO: check this later - // const dischargeData = Object.assign({}, patientData); - // dischargeData["discharge"] = value; - // setPatientData(dischargeData); - Notification.Success({ msg: "Patient Discharged Successfully", }); @@ -174,15 +167,6 @@ const DischargeModal = ({ } }; - const handleDateChange = (e: FieldChangeEvent) => { - setPreDischargeForm((form) => { - return { - ...form, - discharge_date: e.value.toString(), - }; - }); - }; - const handleFacilitySelect = (selected: FacilityModel) => { setFacility(selected); const { id, name } = selected || {}; @@ -248,11 +232,10 @@ const DischargeModal = ({ - {preDischargeForm.discharge_reason === "REC" && ( -
- + { + const updates: Record = { + discharge_date: undefined, + death_datetime: undefined, + }; + updates[e.name] = e.value; + setPreDischargeForm((form) => ({ ...form, ...updates })); + }} + required + min={dayjs( + consultationData?.admission_date ?? consultationData?.created_date + ).format("YYYY-MM-DDTHH:mm")} + max={dayjs().format("YYYY-MM-DDTHH:mm")} + error={ + preDischargeForm.discharge_reason === "EXP" + ? errors?.death_datetime + : errors?.discharge_date + } + /> + {preDischargeForm.discharge_reason === "REC" && ( + <>
Discharge Prescription Medications @@ -288,61 +296,24 @@ const DischargeModal = ({ Discharge PRN Prescriptions
-
+ )} {preDischargeForm.discharge_reason === "EXP" && ( -
- { - setPreDischargeForm((form) => { - return { - ...form, - death_datetime: e.value, - }; - }); - }} - required - min={dayjs(consultationData?.admission_date).format( - "YYYY-MM-DDTHH:mm" - )} - max={dayjs().format("YYYY-MM-DDTHH:mm")} - /> - { - setPreDischargeForm((form) => { - return { - ...form, - death_confirmed_doctor: e.value, - }; - }); - }} - required - placeholder="Attending Doctor's Name and Designation" - /> -
- )} - {["REF", "LAMA"].includes(preDischargeForm.discharge_reason) && ( -
- -
+ { + setPreDischargeForm((form) => { + return { + ...form, + death_confirmed_doctor: e.value, + }; + }); + }} + required + placeholder="Attending Doctor's Name and Designation" + /> )} diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx index 78e299fe218..8bf20a65f64 100644 --- a/src/Components/Patient/PatientInfoCard.tsx +++ b/src/Components/Patient/PatientInfoCard.tsx @@ -330,7 +330,8 @@ export default function PatientInfoCard(props: { ) : ( {" "} - Discharged on {formatDate(consultation?.discharge_date)} + Discharged on{" "} + {formatDateTime(consultation?.discharge_date)} )}