Skip to content

Commit

Permalink
Fixed search icon and removed delete option (#9059)
Browse files Browse the repository at this point in the history
  • Loading branch information
nithish1018 authored Nov 11, 2024
1 parent 6931845 commit fc4f94d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 102 deletions.
12 changes: 0 additions & 12 deletions src/Utils/request/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1065,11 +1065,6 @@ const routes = {
TBody: Type<ShiftingModel>(),
TRes: Type<ShiftingModel>(),
},
deleteShiftRecord: {
path: "/api/v1/shift/{id}/",
method: "DELETE",
TRes: Type<{ detail: string }>(),
},
listShiftRequests: {
path: "/api/v1/shift/",
method: "GET",
Expand Down Expand Up @@ -1241,13 +1236,6 @@ const routes = {
TRes: Type<ResourceModel>(),
TBody: Type<Partial<ResourceModel>>(),
},
deleteResourceRecord: {
path: "/api/v1/resource/{id}/",
method: "DELETE",
TRes: Type<{
detail?: string;
}>(),
},
listResourceRequests: {
path: "/api/v1/resource/",
method: "GET",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const SearchInput = ({
className={className}
leading={
props.leading || (
<CareIcon icon="l-search-alt" className="text-secondary-600" />
<CareIcon icon="l-search-alt" className="text-secondary-600 z-10" />
)
}
trailing={
Expand Down
46 changes: 0 additions & 46 deletions src/components/Resource/ResourceDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand All @@ -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 (
<div className="mt-2 h-full rounded-lg border bg-white p-4 text-black shadow">
Expand Down Expand Up @@ -329,28 +305,6 @@ export default function ResourceDetails(props: { id: string }) {
<div className="break-words">{data.reason || "--"}</div>
</div>
</div>

<div className="mt-4 flex justify-end">
<div>
<ButtonV2
className="w-full"
variant="danger"
onClick={() => setOpenDeleteResourceDialog(true)}
>
Delete Record
</ButtonV2>

<ConfirmDialog
title="Authorize resource delete"
description="Are you sure you want to delete this record?"
action="Delete"
variant="danger"
show={openDeleteResourceDialog}
onClose={() => setOpenDeleteResourceDialog(false)}
onConfirm={handleResourceDelete}
/>
</div>
</div>
</div>
<h4 className="mt-8">Audit Log</h4>

Expand Down
43 changes: 0 additions & 43 deletions src/components/Shifting/ShiftDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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
Expand All @@ -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 (
<a href="#">
Expand Down Expand Up @@ -732,25 +708,6 @@ export default function ShiftDetails(props: { id: string }) {
time={data?.modified_date}
/>
</div>

<div className="mt-4 flex justify-end">
<div>
<ButtonV2
variant="danger"
onClick={() => setOpenDeleteShiftDialog(true)}
>
{t("delete_record")}
</ButtonV2>
<ConfirmDialog
title={t("authorize_shift_delete")}
description={t("record_delete_confirm")}
action="Confirm"
show={openDeleteShiftDialog}
onClose={() => setOpenDeleteShiftDialog(false)}
onConfirm={handleShiftDelete}
/>
</div>
</div>
</div>

<div className="grid-cols-5 gap-2 md:grid">
Expand Down

0 comments on commit fc4f94d

Please sign in to comment.