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

Fix bed check for log update button #7202

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/e2e/users_spec/user_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("User Creation", () => {
}
return result;
};
const username = makeid(25);
const username = makeid(8);
const alreadylinkedusersviews = [
"devdoctor",
"devstaff2",
Expand Down
103 changes: 45 additions & 58 deletions src/Components/Patient/PatientInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -472,72 +472,59 @@ export default function PatientInfoCard(props: {
</div>
)}
<div className="flex w-full flex-col gap-3 lg:w-auto 2xl:flex-row">
{[
[
`/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/daily-rounds`,
"Log Update",
"plus",
patient.is_active &&
consultation?.id &&
!consultation?.discharge_date,
[
!(consultation?.facility !== patient.facility) &&
{patient.is_active &&
consultation?.id &&
!consultation?.discharge_date && (
<div className="h-10 min-h-[40px] w-full min-w-[170px] lg:w-auto">
<ButtonV2
variant={
!(consultation?.facility !== patient.facility) &&
!(consultation?.discharge_date ?? !patient.is_active) &&
dayjs(consultation?.modified_date).isBefore(
dayjs().subtract(1, "day")
)
? "danger"
: "primary"
}
href={
consultation?.admitted && !consultation?.current_bed
? undefined
: `/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/daily-rounds`
}
onClick={() => {
if (
consultation?.admitted &&
!consultation?.current_bed
) {
Notification.Error({
msg: "Please assign a bed to the patient",
});
setOpen(true);
}
}}
className="w-full"
>
<span className="flex w-full items-center justify-center gap-2">
<CareIcon className="care-l-plus text-xl" />
<p className="font-semibold">Log Update</p>
</span>
</ButtonV2>
{!(consultation?.facility !== patient.facility) &&
!(consultation?.discharge_date ?? !patient.is_active) &&
dayjs(consultation?.modified_date).isBefore(
dayjs().subtract(1, "day")
),
<div className="text-center">
<CareIcon className="care-l-exclamation-triangle" /> No
update filed in the last 24 hours
</div>,
],
],
].map(
(action: any, i) =>
action[3] && (
<div
className="h-10 min-h-[40px] w-full min-w-[170px] lg:w-auto"
key={i}
>
<ButtonV2
key={i}
variant={action?.[4]?.[0] ? "danger" : "primary"}
href={
consultation?.admitted &&
!consultation?.current_bed &&
i === 1
? undefined
: `${action[0]}`
}
onClick={() => {
if (
consultation?.admitted &&
!consultation?.current_bed &&
i === 1
) {
Notification.Error({
msg: "Please assign a bed to the patient",
});
setOpen(true);
}
}}
className="w-full"
>
<span className="flex w-full items-center justify-center gap-2">
<CareIcon className={`care-l-${action[2]} text-xl`} />
<p className="font-semibold">{action[1]}</p>
</span>
</ButtonV2>
{action?.[4]?.[0] && (
) && (
<>
<p className="mt-0.5 text-xs text-red-500">
{action[4][1]}
<div className="text-center">
<CareIcon className="care-l-exclamation-triangle" />{" "}
No update filed in the last 24 hours
</div>
</p>
</>
)}
</div>
)
)}
</div>
)}
<DropdownMenu
id="show-more"
itemClassName="min-w-0 sm:min-w-[225px]"
Expand Down
Loading