Skip to content

Commit

Permalink
Download Discharge Summary, Medicine Administration Records and upgra…
Browse files Browse the repository at this point in the history
…ded Prescriptions (#5458)

* Adds new prescription API routes and actions

* Copy most of the diffs from #5317

Co-authored-by: skks1212 <[email protected]>

* fix issues when creating new consultation

* update API and actions

* revert changes in critical care IO Balance Editor

* define types

* fix typo

* minor patches to `Form` HOC

* revert changes in critical care

* so we no longer need upsert

* `ResponsiveMedicineTable` to support custom actions

* Adds `PrescriptionForm` component

* Adds `PrescriptionDetailCard` component

* Adds `PrescriptionBuilder` component

* Adds `ManagePrescriptions` page route

* Consultation Form: onSave navigate to manage prescriptions page if new

* this is not an atomic commit :/

* so now there's Administration History Table

* lots of diff :/

* so fixed the issue that caused not to work during weekly demo

* add units to dosage

* Adds `NumericWithUnitsFormField`

* chore

* discharge flow

* disable buttons if discharged

* highlight if selected for discharge

* administer medicines per row

* detailed view for row onclick

* fix deploy fail

* fix numeric input alignment

* fix onrow click propogration

* fix responsiveness issue

* fix responsiveness for medicine administrations

* fix table heading actions responsiveness

* remove id from success notif

* add back button

* ux: warning and all changes saved

* minor fix

* minor responsive fix

* adds translations

* fix responsiveness issues

* minor fix: translation key and notes col. missing

* fix responsiveness and filter regular prescriptions

* fix table obj keys order

* remove medicines from critical care

* unmess

* reflact discharge prescriptions in sicharge summary

* some fixes during testing

* translations and other fixes

* fix casing for prescription frequency

---------
  • Loading branch information
rithviknishad authored May 24, 2023
1 parent e818c0a commit 14f9547
Show file tree
Hide file tree
Showing 37 changed files with 1,866 additions and 1,402 deletions.
27 changes: 8 additions & 19 deletions src/Components/Common/ConfirmDialogV2.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import DialogModal from "./Dialog";
import ButtonV2, { ButtonVariant, Cancel } from "./components/ButtonV2";
import { ButtonVariant, Cancel, Submit } from "./components/ButtonV2";

type ConfirmDialogV2Props = {
className?: string;
title: React.ReactNode;
description?: React.ReactNode;
disabled?: boolean;
show: boolean;
action: string;
action: React.ReactNode;
variant?: ButtonVariant;
onClose: () => void;
onConfirm: () => void;
Expand All @@ -15,34 +16,22 @@ type ConfirmDialogV2Props = {
};

const ConfirmDialogV2 = ({
title,
description,
show,
disabled,
variant,
action,
onClose,
onConfirm,
cancelLabel,
children,
...props
}: ConfirmDialogV2Props) => {
return (
<DialogModal
onClose={onClose}
title={title}
description={
<span className={`font-medium text-${variant || "secondary"}-600`}>
{description}
</span>
}
show={show}
>
<DialogModal {...props}>
{children}
<div className="mt-6 flex justify-end gap-2 w-full flex-col md:flex-row">
<Cancel onClick={onClose} label={cancelLabel} />
<ButtonV2 onClick={onConfirm} variant={variant} disabled={disabled}>
<Cancel onClick={props.onClose} label={cancelLabel} />
<Submit onClick={onConfirm} variant={variant} disabled={disabled}>
{action}
</ButtonV2>
</Submit>
</div>
</DialogModal>
);
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Common/PrescriptionBuilder.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let select = (setPrescription, prescription) => setPrescription(_ => prescription)

@react.component
export make = (~prescriptions, ~setPrescriptions) =>
@genType @react.component
let make = (~prescriptions, ~setPrescriptions) =>
<div> <Prescription__Builder prescriptions selectCB={select(setPrescriptions)} /> </div>
44 changes: 34 additions & 10 deletions src/Components/Common/components/ResponsiveMedicineTables.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useState } from "react";
import AccordionV2 from "./AccordionV2";
import { classNames } from "../../../Utils/utils";

function getWindowSize() {
const { innerWidth, innerHeight } = window;
Expand All @@ -11,6 +12,10 @@ export default function ResponsiveMedicineTable(props: {
list: Array<any>;
objectKeys: Array<string>;
fieldsToDisplay: Array<number>;
actions?: (item: any) => JSX.Element;
actionLabel?: string;
maxWidthColumn?: number;
onClick?: (item: any) => void;
}) {
const [windowSize, setWindowSize] = useState(getWindowSize());
useEffect(() => {
Expand All @@ -32,30 +37,49 @@ export default function ResponsiveMedicineTable(props: {
<tr>
{props.theads.map((item) => {
return (
<th className="px-6 py-3 border-b border-gray-200 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-800 uppercase tracking-wider">
<th className="px-6 py-3 border-b border-gray-200 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-800 uppercase tracking-wider whitespace-nowrap">
{item}
</th>
);
})}
{props.actions && (
<th className="px-6 py-3 border-b border-gray-200 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-800 uppercase tracking-wider">
{props.actionLabel || ""}
</th>
)}
</tr>
</thead>
<tbody>
{props.list?.map?.((med: any, index: number) => (
<tr className="bg-white" key={index}>
<tr
className={classNames(
"bg-white",
props.onClick && "hover:bg-gray-200 cursor-pointer"
)}
key={index}
onClick={() => props.onClick && props.onClick(med)}
>
{props.objectKeys.map((key, idx) => {
if (idx === 0)
if (
props.maxWidthColumn !== undefined &&
idx === props.maxWidthColumn
) {
return (
<td className="px-6 py-4 w-[450px] text-sm leading-5 font-medium text-gray-900">
{med[key]}
</td>
);
else
return (
<td className="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-900">
<td className="px-6 py-4 w-full text-sm leading-5 font-medium text-gray-900">
{med[key]}
</td>
);
}

return (
<td className="px-6 py-4 text-sm leading-5 text-gray-900">
{med[key]}
</td>
);
})}
{props.actions && (
<td className="px-6">{props.actions(med)}</td>
)}
</tr>
))}
</tbody>
Expand Down
Loading

0 comments on commit 14f9547

Please sign in to comment.