From 84489894980b4015920b32eb4e54d8c089b2287f Mon Sep 17 00:00:00 2001 From: nithish Date: Tue, 19 Nov 2024 14:51:44 +0530 Subject: [PATCH 01/14] Added Clear Image functionality --- src/components/Patient/UpdateStatusDialog.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/Patient/UpdateStatusDialog.tsx b/src/components/Patient/UpdateStatusDialog.tsx index 9414ba9bb95..460001debf9 100644 --- a/src/components/Patient/UpdateStatusDialog.tsx +++ b/src/components/Patient/UpdateStatusDialog.tsx @@ -69,7 +69,6 @@ const UpdateStatusDialog = (props: Props) => { const [contentType, setcontentType] = useState(""); const [uploadPercent, setUploadPercent] = useState(0); const [uploadStarted, setUploadStarted] = useState(false); - const [uploadDone, setUploadDone] = useState(false); const currentStatus = SAMPLE_TEST_STATUS.find( (i) => i.text === sample.status, @@ -123,7 +122,6 @@ const UpdateStatusDialog = (props: Props) => { (xhr: XMLHttpRequest) => { if (xhr.status >= 200 && xhr.status < 300) { setUploadStarted(false); - setUploadDone(true); request(routes.editUpload, { pathParams: { id: data.id, @@ -156,13 +154,15 @@ const UpdateStatusDialog = (props: Props) => { ); return e.target.files[0]; }; + const removeFile = () => { + setfile(undefined); + }; const handleUpload = async () => { const f = file; if (f === undefined) return; const category = "UNSPECIFIED"; const name = f.name; setUploadStarted(true); - setUploadDone(false); const { data } = await request(routes.createUpload, { body: { @@ -226,6 +226,7 @@ const UpdateStatusDialog = (props: Props) => {
+ {file && ( + + )} Upload From 662f437f09b385f5672fcc4a10a2ba673c4ee5f9 Mon Sep 17 00:00:00 2001 From: nithish Date: Tue, 19 Nov 2024 14:59:03 +0530 Subject: [PATCH 02/14] removed unneccessary line --- src/components/Patient/UpdateStatusDialog.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Patient/UpdateStatusDialog.tsx b/src/components/Patient/UpdateStatusDialog.tsx index 460001debf9..22d7a45d081 100644 --- a/src/components/Patient/UpdateStatusDialog.tsx +++ b/src/components/Patient/UpdateStatusDialog.tsx @@ -226,7 +226,6 @@ const UpdateStatusDialog = (props: Props) => {
{ onClick={fileUpload.clearFiles} disabled={fileUpload.uploading} > - + {t("discard")}
From 66cf623324cb5043410897a9c919129efc31d853 Mon Sep 17 00:00:00 2001 From: nithish Date: Sat, 30 Nov 2024 18:07:22 +0530 Subject: [PATCH 12/14] updated primary button color --- src/components/ui/button.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 61ac64a305d..4555a7a97af 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -16,7 +16,7 @@ const buttonVariants = cva( outline: "border border-gray-200 bg-white shadow-sm hover:bg-gray-100 hover:text-gray-900 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50", primary: - "bg-primary-500 text-white shadow hover:bg-primary-700/90 dark:bg-primary-100 dark:text-primary-900 dark:hover:bg-primary-100/90", + "bg-primary-700 text-white shadow hover:bg-primary-700/90 dark:bg-primary-100 dark:text-primary-900 dark:hover:bg-primary-100/90", secondary: "bg-gray-100 text-gray-900 shadow-sm hover:bg-gray-100/80 dark:bg-gray-800 dark:text-gray-50 dark:hover:bg-gray-800/80", ghost: From 37cfc0eefeb9b1c8810ddac5e80732186542e09c Mon Sep 17 00:00:00 2001 From: nithish Date: Sat, 30 Nov 2024 18:12:07 +0530 Subject: [PATCH 13/14] fixed eslint issues --- src/components/Shifting/ShiftDetails.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/Shifting/ShiftDetails.tsx b/src/components/Shifting/ShiftDetails.tsx index bc97b0b0f24..cb5140d6ed0 100644 --- a/src/components/Shifting/ShiftDetails.tsx +++ b/src/components/Shifting/ShiftDetails.tsx @@ -492,13 +492,20 @@ export default function ShiftDetails(props: { id: string }) { : "" } tooltipClassName="tooltip-top -translate-x-28 -translate-y-1 text-xs" - disabled={data?.status === "COMPLETED" || data?.status === "CANCELLED"} - onClick={() => navigate(`/shifting/${data?.external_id}/update`)} + disabled={ + data?.status === "COMPLETED" || data?.status === "CANCELLED" + } + onClick={() => + navigate(`/shifting/${data?.external_id}/update`) + } > {t("update_status_details")} - setIsPrintMode(true)}> + setIsPrintMode(true)} + > {" "} {t("referral_letter")} From cd09c746f19c29ba1065f84ed693191d54447e6a Mon Sep 17 00:00:00 2001 From: nithish Date: Tue, 3 Dec 2024 19:25:37 +0530 Subject: [PATCH 14/14] removed button array --- src/components/Patient/UpdateStatusDialog.tsx | 40 ++++--------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/src/components/Patient/UpdateStatusDialog.tsx b/src/components/Patient/UpdateStatusDialog.tsx index b40922ca764..e9a767847aa 100644 --- a/src/components/Patient/UpdateStatusDialog.tsx +++ b/src/components/Patient/UpdateStatusDialog.tsx @@ -1,7 +1,7 @@ -import { ReactNode, useEffect, useReducer } from "react"; +import { useEffect, useReducer } from "react"; import { useTranslation } from "react-i18next"; -import CareIcon, { IconName } from "@/CAREUI/icons/CareIcon"; +import CareIcon from "@/CAREUI/icons/CareIcon"; import { Button } from "@/components/ui/button"; @@ -56,7 +56,6 @@ const updateStatusReducer = (state = initialState, action: any) => { return state; } }; - const UpdateStatusDialog = (props: Props) => { const { t } = useTranslation(); const { sample, handleOk, handleCancel } = props; @@ -67,22 +66,6 @@ const UpdateStatusDialog = (props: Props) => { allowedExtensions: ["pdf", "jpg", "jpeg", "png"], allowNameFallback: true, }); - const uploadButtons: { - name: string; - icon: IconName; - onClick?: () => void; - children?: ReactNode; - show?: boolean; - id: string; - }[] = [ - { - name: t("choose_file"), - icon: "l-file-upload-alt", - children: , - id: "upload-file", - }, - ]; - const currentStatus = SAMPLE_TEST_STATUS.find( (i) => i.text === sample.status, ); @@ -224,20 +207,11 @@ const UpdateStatusDialog = (props: Props) => { ) : (
- {uploadButtons - .filter((b) => b.show !== false) - .map((button, i) => ( - - ))} +
)}