Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed search icon and removed delete option #9059

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, {
nithish1018 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading