Skip to content

Commit

Permalink
Fixed: Transfer patient pop-up behavior (#8245)
Browse files Browse the repository at this point in the history
* Updated Pop Close

* Updaed Pop-up Close for Transfer
  • Loading branch information
renoseHarsh authored Aug 7, 2024
1 parent 91ef1cf commit 203afd2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/Components/Facility/DuplicatePatientDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ interface Props {
patientList: Array<DupPatientModel>;
handleOk: (action: string) => void;
handleCancel: () => void;
isNew: boolean;
}

const tdClass = "border border-secondary-400 p-2 text-left";

const DuplicatePatientDialog = (props: Props) => {
const { patientList, handleOk, handleCancel, isNew } = props;
const { patientList, handleOk, handleCancel } = props;
const [action, setAction] = useState("");

return (
Expand Down Expand Up @@ -118,7 +117,7 @@ const DuplicatePatientDialog = (props: Props) => {
<Cancel
onClick={handleCancel}
className="mb-2 sm:mb-0"
label={`Cancel ${isNew ? "Registration" : "Update"}`}
label={"Close"}
/>
<Submit
id="submit-continue-button"
Expand Down
24 changes: 20 additions & 4 deletions src/Components/Patient/PatientRegister.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export const PatientRegister = (props: PatientRegisterProps) => {
});
const [careExtId, setCareExtId] = useState("");
const [formField, setFormField] = useState<any>();
const [resetNum, setResetNum] = useState(false);
const [isDistrictLoading, setIsDistrictLoading] = useState(false);
const [isLocalbodyLoading, setIsLocalbodyLoading] = useState(false);
const [isWardLoading, setIsWardLoading] = useState(false);
Expand Down Expand Up @@ -1003,21 +1004,29 @@ export const PatientRegister = (props: PatientRegisterProps) => {
<DuplicatePatientDialog
patientList={statusDialog.patientList}
handleOk={handleDialogClose}
handleCancel={goBack}
isNew={!id}
handleCancel={() => {
handleDialogClose("close");
setResetNum(true);
}}
/>
)}
{statusDialog.transfer && (
<DialogModal
show={statusDialog.transfer}
onClose={() => handleDialogClose("back")}
onClose={() => {
setResetNum(true);
handleDialogClose("close");
}}
title="Patient Transfer Form"
className="max-w-md md:min-w-[600px]"
>
<TransferPatientDialog
patientList={statusDialog.patientList}
handleOk={() => handleDialogClose("close")}
handleCancel={() => handleDialogClose("back")}
handleCancel={() => {
setResetNum(true);
handleDialogClose("close");
}}
facilityId={facilityId}
/>
</DialogModal>
Expand Down Expand Up @@ -1134,6 +1143,13 @@ export const PatientRegister = (props: PatientRegisterProps) => {
>
{(field) => {
if (!formField) setFormField(field);
if (resetNum) {
field("phone_number").onChange({
name: "phone_number",
value: "+91",
});
setResetNum(false);
}
return (
<>
<div className="mb-2 overflow-visible rounded border border-secondary-200 p-4">
Expand Down

0 comments on commit 203afd2

Please sign in to comment.