Skip to content

Commit

Permalink
Sort discontinued medicines to the last (#7925)
Browse files Browse the repository at this point in the history
* Sort discontinued medicines to the last

* Update src/Components/Medicine/PrescriptionBuilder.tsx

* Update src/Components/Medicine/PrescriptionBuilder.tsx
  • Loading branch information
rithviknishad authored May 28, 2024
1 parent 568b98f commit 5316402
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/Components/Medicine/PrescriptionBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import useQuery from "../../Utils/request/useQuery";
import MedicineRoutes from "./routes";
import useSlug from "../../Common/hooks/useSlug";
import { AuthorizedForConsultationRelatedActions } from "../../CAREUI/misc/AuthorizedChild";
import { compareBy } from "../../Utils/utils";

interface Props {
prescription_type?: Prescription["prescription_type"];
Expand Down Expand Up @@ -66,16 +67,18 @@ export default function PrescriptionBuilder({
/>
)}
<div className="flex flex-col gap-3">
{data?.results.map((obj) => (
<PrescriptionDetailCard
key={obj.id}
prescription={obj}
collapsible
onDiscontinueClick={() => setShowDiscontinueFor(obj)}
onAdministerClick={() => setShowAdministerFor(obj)}
readonly={disabled}
/>
))}
{data?.results
.sort(compareBy("discontinued"))
?.map((obj) => (
<PrescriptionDetailCard
key={obj.id}
prescription={obj}
collapsible
onDiscontinueClick={() => setShowDiscontinueFor(obj)}
onAdministerClick={() => setShowAdministerFor(obj)}
readonly={disabled}
/>
))}
</div>
<AuthorizedForConsultationRelatedActions>
<ButtonV2
Expand Down

0 comments on commit 5316402

Please sign in to comment.