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

Remove redundant "Add Consultation" button #9095

Merged
58 changes: 8 additions & 50 deletions src/components/Patient/PatientHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,15 @@ export const PatientHome = (props: any) => {
!(patientData?.last_consultation?.facility === facilityId)
);
};
// Commented out as this is no longer used should I completely remove this?

const isPatientEligibleForNewConsultation = (patientData: PatientModel) => {
return patientData.is_active &&
(!patientData?.last_consultation ||
patientData?.last_consultation?.discharge_date)
? true
: false;
};
// const isPatientEligibleForNewConsultation = (patientData: PatientModel) => {
// return patientData.is_active &&
// (!patientData?.last_consultation ||
// patientData?.last_consultation?.discharge_date)
// ? true
// : false;
// };
Srayash marked this conversation as resolved.
Show resolved Hide resolved

return (
<Page
Expand Down Expand Up @@ -1061,49 +1062,6 @@ export const PatientHome = (props: any) => {
<section className="mt-4 space-y-2 md:flex">
<div className="hidden lg:block">
<div className="mt-4 grid grid-cols-6 gap-5 xl:grid-cols-7">
<div
className={classNames(
"w-full rounded-lg border",
isPatientEligibleForNewConsultation(patientData)
? "cursor-pointer border-green-700 hover:bg-primary-400"
: "border-secondary-700 text-secondary-700 hover:cursor-not-allowed",
)}
onClick={() =>
isPatientEligibleForNewConsultation(patientData) &&
navigate(
`/facility/${patientData?.facility}/patient/${id}/consultation`,
)
}
>
<div
className={classNames(
"h-full space-y-2 rounded-lg bg-white p-4 shadow",
isPatientEligibleForNewConsultation(patientData) &&
"hover:bg-secondary-200",
)}
>
<div
className={classNames(
"text-center",
isPatientEligibleForNewConsultation(patientData) &&
"text-green-700",
)}
>
<span>
<CareIcon
icon="l-chat-bubble-user"
className="text-5xl"
/>
</span>
</div>

<div>
<p className="text-center text-sm font-medium">
Add Consultation
</p>
</div>
</div>
</div>
<div
className="w-full"
onClick={() => navigate(`/patient/${id}/investigation_reports`)}
Expand Down
Loading