From bf6b307e309786c3ab8ea383270d6bdafde5089c Mon Sep 17 00:00:00 2001 From: nithish Date: Fri, 8 Nov 2024 16:03:11 +0530 Subject: [PATCH 1/2] Fixed search icon and removed delete option --- src/components/Form/SearchInput.tsx | 2 +- src/components/Resource/ResourceDetails.tsx | 46 --------------------- src/components/Shifting/ShiftDetails.tsx | 43 ------------------- 3 files changed, 1 insertion(+), 90 deletions(-) diff --git a/src/components/Form/SearchInput.tsx b/src/components/Form/SearchInput.tsx index bbf59305a0a..69334c0f4db 100644 --- a/src/components/Form/SearchInput.tsx +++ b/src/components/Form/SearchInput.tsx @@ -87,7 +87,7 @@ const SearchInput = ({ className={className} leading={ props.leading || ( - + ) } trailing={ diff --git a/src/components/Resource/ResourceDetails.tsx b/src/components/Resource/ResourceDetails.tsx index 2495c64433d..d77bdcc3fea 100644 --- a/src/components/Resource/ResourceDetails.tsx +++ b/src/components/Resource/ResourceDetails.tsx @@ -4,21 +4,16 @@ import { useState } from "react"; import CareIcon from "@/CAREUI/icons/CareIcon"; import ButtonV2 from "@/components/Common/ButtonV2"; -import ConfirmDialog from "@/components/Common/ConfirmDialog"; import Loading from "@/components/Common/Loading"; import Page from "@/components/Common/Page"; import CommentSection from "@/components/Resource/ResourceCommentSection"; -import * as Notification from "@/Utils/Notifications"; import routes from "@/Utils/request/api"; -import request from "@/Utils/request/request"; import useQuery from "@/Utils/request/useQuery"; import { classNames, formatDateTime, formatName } from "@/Utils/utils"; export default function ResourceDetails(props: { id: string }) { const [isPrintMode, setIsPrintMode] = useState(false); - const [openDeleteResourceDialog, setOpenDeleteResourceDialog] = - useState(false); const { data, loading } = useQuery(routes.getResourceDetails, { pathParams: { id: props.id }, onResponse: ({ res, data }) => { @@ -27,25 +22,6 @@ export default function ResourceDetails(props: { id: string }) { } }, }); - - const handleResourceDelete = async () => { - setOpenDeleteResourceDialog(true); - const { res, data } = await request(routes.deleteResourceRecord, { - pathParams: { id: props.id }, - }); - if (res?.status === 204) { - Notification.Success({ - msg: "Resource record has been deleted successfully.", - }); - } else { - Notification.Error({ - msg: "Error while deleting Resource: " + (data?.detail || ""), - }); - } - - navigate("/resource"); - }; - const showFacilityCard = (facilityData: any) => { return (
@@ -329,28 +305,6 @@ export default function ResourceDetails(props: { id: string }) {
{data.reason || "--"}
- -
-
- setOpenDeleteResourceDialog(true)} - > - Delete Record - - - setOpenDeleteResourceDialog(false)} - onConfirm={handleResourceDelete} - /> -
-

Audit Log

diff --git a/src/components/Shifting/ShiftDetails.tsx b/src/components/Shifting/ShiftDetails.tsx index d5b251eeb8d..8e85fda3d19 100644 --- a/src/components/Shifting/ShiftDetails.tsx +++ b/src/components/Shifting/ShiftDetails.tsx @@ -9,7 +9,6 @@ import RecordMeta from "@/CAREUI/display/RecordMeta"; import CareIcon from "@/CAREUI/icons/CareIcon"; import ButtonV2 from "@/components/Common/ButtonV2"; -import ConfirmDialog from "@/components/Common/ConfirmDialog"; import Loading from "@/components/Common/Loading"; import Page from "@/components/Common/Page"; import { ConsultationModel } from "@/components/Facility/models"; @@ -22,16 +21,13 @@ import { SHIFTING_CHOICES_WARTIME, } from "@/common/constants"; -import * as Notification from "@/Utils/Notifications"; import routes from "@/Utils/request/api"; -import request from "@/Utils/request/request"; import useQuery from "@/Utils/request/useQuery"; import { formatDateTime, formatName, formatPatientAge } from "@/Utils/utils"; export default function ShiftDetails(props: { id: string }) { const [isPrintMode, setIsPrintMode] = useState(false); const [isCopied, setIsCopied] = useState(false); - const [openDeleteShiftDialog, setOpenDeleteShiftDialog] = useState(false); const { t } = useTranslation(); const shiftStatusOptions = careConfig.wartimeShifting @@ -41,26 +37,6 @@ export default function ShiftDetails(props: { id: string }) { const { data, loading } = useQuery(routes.getShiftDetails, { pathParams: { id: props.id }, }); - - const handleShiftDelete = async () => { - setOpenDeleteShiftDialog(true); - - const { res, data } = await request(routes.deleteShiftRecord, { - pathParams: { id: props.id }, - }); - if (res?.status == 204) { - Notification.Success({ - msg: t("shifting_deleted"), - }); - } else { - Notification.Error({ - msg: t("error_deleting_shifting") + (data?.detail || ""), - }); - } - - navigate("/shifting"); - }; - const showCopyToclipBoard = (data: any) => { return ( @@ -732,25 +708,6 @@ export default function ShiftDetails(props: { id: string }) { time={data?.modified_date} /> - -
-
- setOpenDeleteShiftDialog(true)} - > - {t("delete_record")} - - setOpenDeleteShiftDialog(false)} - onConfirm={handleShiftDelete} - /> -
-
From 1c0923e462122690e5d5d18661f08b4e76642eff Mon Sep 17 00:00:00 2001 From: nithish Date: Fri, 8 Nov 2024 19:55:39 +0530 Subject: [PATCH 2/2] removed delete routes --- src/Utils/request/api.tsx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/Utils/request/api.tsx b/src/Utils/request/api.tsx index 441b9a3d8c8..e1777364b3f 100644 --- a/src/Utils/request/api.tsx +++ b/src/Utils/request/api.tsx @@ -1065,11 +1065,6 @@ const routes = { TBody: Type(), TRes: Type(), }, - deleteShiftRecord: { - path: "/api/v1/shift/{id}/", - method: "DELETE", - TRes: Type<{ detail: string }>(), - }, listShiftRequests: { path: "/api/v1/shift/", method: "GET", @@ -1241,13 +1236,6 @@ const routes = { TRes: Type(), TBody: Type>(), }, - deleteResourceRecord: { - path: "/api/v1/resource/{id}/", - method: "DELETE", - TRes: Type<{ - detail?: string; - }>(), - }, listResourceRequests: { path: "/api/v1/resource/", method: "GET",