Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block expired patients from being transfered #8123

Merged
merged 9 commits into from
Jul 17, 2024
8 changes: 6 additions & 2 deletions src/Components/Facility/DischargeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,13 @@ const DischargeModal = ({
title={
<div>
<p>Discharge patient from CARE</p>
<span className="mt-1 flex gap-1 text-sm font-medium text-warning-500">
<span className="mt-1 flex gap-1 text-sm font-medium text-danger-500">
<CareIcon icon="l-exclamation-triangle" className="text-base" />
<p>Caution: this action is irreversible.</p>
<p>
{new_discharge_reason === 3 // Expired
? "Caution: Once a patient is marked as expired, the patient file cannot be transferred or edited. Please proceed with caution."
: "Caution: This action is irrevesible. Please proceed with caution."}
</p>
</span>
</div>
}
Expand Down
2 changes: 2 additions & 0 deletions src/Components/Facility/TransferPatientDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const TransferPatientDialog = (props: Props) => {
return {
id: patient.patient_id as unknown as number,
text: `${patient.name} (${patient.gender})`,
disabled: patient.is_expired,
};
});

Expand Down Expand Up @@ -171,6 +172,7 @@ const TransferPatientDialog = (props: Props) => {
options={patientOptions}
optionLabel={(patient) => patient.text}
optionValue={(patient) => patient.id}
optionDisabled={(patient) => patient.disabled ?? false}
value={state.form.patient}
onChange={handleChange}
error={state.errors.patient}
Expand Down
1 change: 1 addition & 0 deletions src/Components/Facility/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export interface DupPatientModel {
date_of_birth: string;
year_of_birth: number;
state_id: number;
is_expired: boolean;
}

export interface InventoryItemsModel {
Expand Down
Loading