Skip to content

Commit

Permalink
Merge branch 'develop' into issue/9063/investigation_record_error
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaJ2305 authored Nov 11, 2024
2 parents 9b8748b + 25c8e0b commit 9a060ca
Show file tree
Hide file tree
Showing 10 changed files with 255 additions and 183 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ ESLINT_NO_DEV_ERRORS=true
CARE_CDN_URL="https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com http://localhost:4566"
REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn"

REACT_ENABLED_APPS=""
REACT_ENABLED_APPS=""
1 change: 1 addition & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@
"consultation_not_filed_description": "Please file a consultation for this patient to continue.",
"consultation_notes": "General Instructions (Advice)",
"consultation_updates": "Consultation updates",
"contact_info": "Contact Info",
"contact_number": "Contact Number",
"contact_person": "Name of Contact Person at Facility",
"contact_person_at_the_facility": "Contact person at the current facility",
Expand Down
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
4 changes: 3 additions & 1 deletion src/components/Facility/DischargeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ const DischargeModal = ({
setPreDischargeForm((form) => ({ ...form, ...updates }));
}}
required
min={new Date(consultationData?.encounter_date)}
min={dayjs(consultationData?.encounter_date)
.subtract(1, "day")
.toDate()}
max={new Date()}
error={
discharge_reason ===
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ export default function MedicineAdministrationTable({
<thead className="sticky top-0 z-10 bg-secondary-50 text-xs font-medium text-black">
<tr>
<th className="sticky left-0 z-20 bg-secondary-50 py-3 pl-4 text-left">
<div className="flex justify-between gap-2">
<span className="text-sm">{t("medicine")}</span>
<span className="hidden px-2 text-center text-xs leading-none lg:block">
<p>Dosage &</p>
<p>
{prescriptions[0]?.dosage_type !== "PRN"
? "Frequency"
: "Indicator"}
</p>
</span>
</div>
<span className="text-sm">{t("medicine")}</span>
</th>
<th>
<span className="hidden px-2 text-center text-xs leading-none lg:block">
<p>{t("dosage")} &</p>
<p>
{prescriptions[0]?.dosage_type !== "PRN"
? t("frequency")
: t("indicator")}
</p>
</span>
</th>

<th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,25 @@ export default function MedicineAdministrationTableRow({
key: `${prescription.last_administration?.administered_date}`,
},
);
const DosageFrequencyInfo = () => (
<div className="flex justify-center">
<div className="flex gap-1 text-xs font-semibold text-secondary-900 lg:flex-col lg:px-2 lg:text-center">
{prescription.dosage_type !== "TITRATED" ? (
<p>{prescription.base_dosage}</p>
) : (
<p>
{prescription.base_dosage} - {prescription.target_dosage}
</p>
)}

<p className="max-w-[6rem] truncate">
{prescription.dosage_type !== "PRN"
? t("PRESCRIPTION_FREQUENCY_" + prescription.frequency)
: prescription.indicator}
</p>
</div>
</div>
);

return (
<>
Expand Down Expand Up @@ -216,24 +235,14 @@ export default function MedicineAdministrationTableRow({
{prescription.medicine_object?.generic}
</span>
</div>

<div className="flex gap-1 text-xs font-semibold text-secondary-900 lg:flex-col lg:px-2 lg:text-center">
{prescription.dosage_type !== "TITRATED" ? (
<p>{prescription.base_dosage}</p>
) : (
<p>
{prescription.base_dosage} - {prescription.target_dosage}
</p>
)}

<p>
{prescription.dosage_type !== "PRN"
? t("PRESCRIPTION_FREQUENCY_" + prescription.frequency)
: prescription.indicator}
</p>
<div className="block lg:hidden">
<DosageFrequencyInfo />
</div>
</div>
</td>
<td className="hidden lg:table-cell">
<DosageFrequencyInfo />
</td>

<td />

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
Loading

0 comments on commit 9a060ca

Please sign in to comment.