+
);
diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx
index ada2fc6e2bf..1d3e8c8db40 100644
--- a/src/Common/constants.tsx
+++ b/src/Common/constants.tsx
@@ -547,77 +547,83 @@ export const DESIGNATION_HEALTH_CARE_WORKER = [
"OTHERS",
];
-export const NOTIFICATION_EVENTS = [
- { id: "MESSAGE", text: "Notice", icon: "fa-regular fa-message" },
+type NotificationEvent = {
+ id: string;
+ text: string;
+ icon: IconName;
+};
+
+export const NOTIFICATION_EVENTS: NotificationEvent[] = [
+ { id: "MESSAGE", text: "Notice", icon: "l-comment-alt-message" },
{
id: "PATIENT_CREATED",
text: "Patient Created",
- icon: "fa-solid fa-user-plus",
+ icon: "l-user-plus",
},
{
id: "PATIENT_UPDATED",
text: "Patient Updated",
- icon: "fa-solid fa-user-pen",
+ icon: "l-edit",
},
{
id: "PATIENT_DELETED",
text: "Patient Deleted",
- icon: "fa-solid fa-user-minus",
+ icon: "l-user-minus",
},
{
id: "PATIENT_CONSULTATION_CREATED",
text: "Patient Consultation Created",
- icon: "fa-solid fa-heart-circle-check",
+ icon: "l-heart",
},
{
id: "PATIENT_CONSULTATION_UPDATED",
text: "Patient Consultation Updated",
- icon: "fa-solid fa-heart-circle-plus",
+ icon: "l-heart-medical",
},
{
id: "PATIENT_CONSULTATION_DELETED",
text: "Patient Consultation Deleted",
- icon: "fa-solid fa-heart-circle-minus",
+ icon: "l-heartbeat",
},
{
id: "INVESTIGATION_SESSION_CREATED",
text: "Investigation Session Created",
- icon: "fa-solid fa-magnifying-glass",
+ icon: "l-search",
},
{
id: "INVESTIGATION_UPDATED",
text: "Investigation Updated",
- icon: "fa-solid fa-magnifying-glass-plus",
+ icon: "l-search-plus",
},
{
id: "PATIENT_FILE_UPLOAD_CREATED",
text: "Patient File Upload Created",
- icon: "fa-solid fa-file-medical",
+ icon: "l-file-medical",
},
{
id: "CONSULTATION_FILE_UPLOAD_CREATED",
text: "Consultation File Upload Created",
- icon: "fa-solid fa-file-waveform",
+ icon: "l-file-upload",
},
{
id: "PATIENT_CONSULTATION_UPDATE_CREATED",
text: "Patient Consultation Update Created",
- icon: "fa-solid fa-file-circle-check",
+ icon: "l-heart",
},
{
id: "PATIENT_CONSULTATION_UPDATE_UPDATED",
text: "Patient Consultation Update Updated",
- icon: "fa-solid fa-file-circle-plus",
+ icon: "l-heart-medical",
},
{
id: "SHIFTING_UPDATED",
text: "Shifting Updated",
- icon: "fa-solid fa-truck-medical",
+ icon: "l-ambulance",
},
{
id: "PATIENT_NOTE_ADDED",
text: "Patient Note Added",
- icon: "fa-solid fa-message",
+ icon: "l-notes",
},
];
diff --git a/src/Common/hooks/useConfig.ts b/src/Common/hooks/useConfig.ts
index 4e1cb806e3f..03d9dada9b9 100644
--- a/src/Common/hooks/useConfig.ts
+++ b/src/Common/hooks/useConfig.ts
@@ -14,14 +14,23 @@ export interface IConfig {
site_url: string;
analytics_server_url: string;
- header_logo: ILogo;
+ /**
+ * The main logo of the app displayed on login and sidebar header.
+ */
main_logo: ILogo;
-
/**
- * Logo and description for custom deployment. (This overrides the state logo)
+ * If present, the image will be displayed on the login page before the main logo.
+ */
+ state_logo?: ILogo;
+ /**
+ * if present, this replaces the state logo on the login page only.
*/
custom_logo?: ILogo;
+ /**
+ * if present, this replaces the main logo on the login page only.
+ */
custom_logo_alt?: ILogo;
+
custom_description?: string;
/**
@@ -41,13 +50,15 @@ export interface IConfig {
* SENTRY_ENVIRONMENT
*/
sentry_environment: string;
+
+ /**
+ * The header banner is displayed on the top of
+ * the shift print form if the facility is kasp.
+ */
+ header_logo: ILogo;
kasp_enabled: boolean;
kasp_string: string;
kasp_full_string: string;
- /**
- * If present, the image will be displayed in the login page.
- */
- state_logo?: ILogo;
/**
* URL of the sample format for asset import.
*/
diff --git a/src/Components/ABDM/LinkABHANumberModal.tsx b/src/Components/ABDM/LinkABHANumberModal.tsx
index 5d1f7469efc..6297b11152f 100644
--- a/src/Components/ABDM/LinkABHANumberModal.tsx
+++ b/src/Components/ABDM/LinkABHANumberModal.tsx
@@ -22,9 +22,9 @@ export const validateRule = (
return (
{condition ? (
-
+
) : (
-
+
)}{" "}
{
className="focus:ring-blue mx-auto mt-4 max-w-xs items-center rounded-md border border-primary-500 bg-white px-3 py-2 text-sm font-medium leading-4 text-primary-700 transition duration-150 ease-in-out hover:text-primary-500 hover:shadow focus:border-primary-300 focus:outline-none active:bg-gray-50 active:text-primary-800"
href={sample_format_asset_import}
>
- {" "}
+ {" "}
Sample Format
@@ -328,7 +333,8 @@ const AssetImportModal = ({ open, onClose, facility, onUpdate }: Props) => {
- Upload a file
+
+ Upload a file
{
data-testid="asset-import-btn"
>
{isImporting ? (
-
+
) : (
-
+
)}
{isImporting ? "Importing..." : "Import"}
diff --git a/src/Components/Assets/AssetManage.tsx b/src/Components/Assets/AssetManage.tsx
index 77bb88da3a8..b7197dd0562 100644
--- a/src/Components/Assets/AssetManage.tsx
+++ b/src/Components/Assets/AssetManage.tsx
@@ -115,13 +115,14 @@ const AssetManage = (props: AssetManageProps) => {
onClick={(_) => window.print()}
className="btn btn-primary mr-2"
>
- Print QR Code
+
+ Print QR Code
setIsPrintMode(false)}
className="btn btn-default"
>
- Close
+ Close
Print Preview
diff --git a/src/Components/Assets/AssetsList.tsx b/src/Components/Assets/AssetsList.tsx
index f210bf04535..228e940de29 100644
--- a/src/Components/Assets/AssetsList.tsx
+++ b/src/Components/Assets/AssetsList.tsx
@@ -153,7 +153,8 @@ const AssetsList = () => {
onClick={() => setIsScannerActive(false)}
className="btn btn-default mb-2"
>
-
Close Scanner
+
+ Close Scanner
{
className="w-full py-[11px]"
onClick={() => setIsScannerActive(true)}
>
- Scan Asset QR
+ Scan Asset
+ QR
{
await request(routes.createAssetBed, {
@@ -76,7 +77,7 @@ export default function MonitorConfigure({ asset }: { asset: AssetData }) {
/>
-
+
{updateLink ? "Update Bed" : "Save Bed"}
diff --git a/src/Components/Auth/Login.tsx b/src/Components/Auth/Login.tsx
index 8dcae9bafc0..62c9d632769 100644
--- a/src/Components/Auth/Login.tsx
+++ b/src/Components/Auth/Login.tsx
@@ -252,160 +252,161 @@ export const Login = (props: { forgot?: boolean }) => {
-
-
-
+
+
+
{(custom_logo || state_logo) && (
<>
-
+
>
)}
-
{" "}
-
- {t("auth_login_title")}
-
diff --git a/src/Components/Common/TopBar.tsx b/src/Components/Common/TopBar.tsx
deleted file mode 100644
index 2dd9c55609d..00000000000
--- a/src/Components/Common/TopBar.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import useConfig from "../../Common/hooks/useConfig";
-import LanguageSelector from "./LanguageSelector";
-
-const TopBar = () => {
- const { main_logo } = useConfig();
- return (
-
- );
-};
-
-export default TopBar;
diff --git a/src/Components/Common/prescription-builder/PrescriptionDropdown.tsx b/src/Components/Common/prescription-builder/PrescriptionDropdown.tsx
index 38df147c0bd..60da9a65e87 100644
--- a/src/Components/Common/prescription-builder/PrescriptionDropdown.tsx
+++ b/src/Components/Common/prescription-builder/PrescriptionDropdown.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from "react";
import { classNames } from "../../../Utils/utils";
+import CareIcon from "../../../CAREUI/icons/CareIcon";
export function PrescriptionDropdown(props: {
options: string[] | number[];
@@ -13,6 +14,7 @@ export function PrescriptionDropdown(props: {
onFocus?: () => void;
onBlur?: () => void;
}) {
+ props.tips = [];
const { options, tips, value, setValue } = props;
const [open, setOpen] = useState(false);
@@ -77,7 +79,7 @@ export function PrescriptionDropdown(props: {
{tips[option]}
-
+
)}
diff --git a/src/Components/Common/prescription-builder/PrescriptionMultiselect.tsx b/src/Components/Common/prescription-builder/PrescriptionMultiselect.tsx
index 6eae36a1233..4fd0e5bada9 100644
--- a/src/Components/Common/prescription-builder/PrescriptionMultiselect.tsx
+++ b/src/Components/Common/prescription-builder/PrescriptionMultiselect.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from "react";
import { classNames } from "../../../Utils/utils";
+import CareIcon from "../../../CAREUI/icons/CareIcon";
export function PrescriptionMultiDropdown(props: {
options: string[];
@@ -51,7 +52,7 @@ export function PrescriptionMultiDropdown(props: {
);
}}
>
-
+
);
diff --git a/src/Components/Common/prescription-builder/components/Prescription__Builder.res b/src/Components/Common/prescription-builder/components/Prescription__Builder.res
deleted file mode 100644
index 302f77f817d..00000000000
--- a/src/Components/Common/prescription-builder/components/Prescription__Builder.res
+++ /dev/null
@@ -1,106 +0,0 @@
-let str = React.string
-
-let medicines = %raw(`require("../assets/medicines.json")`)
-let dosages = ["Stat", "od", "hs", "bd", "tid", "qid", "q4h", "qod", "qwk"]
-type prescriptions = array
-
-let findAndReplace = (index, f, array) =>
- array |> Array.mapi((i, prescription) => i == index ? f(prescription) : prescription)
-
-type action =
- | UpdateMedicine(string, int)
- | UpdateDosage(string, int)
- | UpdateDays(int, int)
- | DeletePescription(int)
- | AddPescription
-
-let reducer = (prescriptions, action) =>
- switch action {
- | UpdateMedicine(medicine, index) =>
- prescriptions |> findAndReplace(index, Prescription__Prescription.updateMedicine(medicine))
-
- | UpdateDosage(dosage, index) =>
- prescriptions |> findAndReplace(index, Prescription__Prescription.updateDosage(dosage))
-
- | UpdateDays(days, index) =>
- prescriptions |> findAndReplace(index, Prescription__Prescription.updateDays(days |> abs))
-
- | AddPescription => prescriptions |> Js.Array.concat([Prescription__Prescription.empty()])
-
- | DeletePescription(index) => prescriptions |> Js.Array.filteri((_, i) => i != index)
- }
-
-let showPrescriptionForm = (item, index, send) =>
- string_of_int}>
-
-
string_of_int)}
- value={item |> Prescription__Prescription.medicine}
- updateCB={medicine => send(UpdateMedicine(medicine, index))}
- placeholder="Select a Medicine"
- selectables=medicines
- />
-
-
-
string_of_int)}
- value={item |> Prescription__Prescription.dosage}
- updateCB={dosage => send(UpdateDosage(dosage, index))}
- placeholder="Dosage"
- selectables=dosages
- />
-
-
- string_of_int)}
- className="appearance-none h-10 mt-1 block w-full border border-gray-400 rounded py-2 px-4 text-sm bg-gray-100 hover:bg-gray-200 focus:outline-none focus:bg-white focus:ring-primary-500"
- placeholder="Days"
- onChange={e => send(UpdateDays(ReactEvent.Form.target(e)["value"], index))}
- value={item |> Prescription__Prescription.days |> string_of_int}
- type_="number"
- required=true
- />
-
-
send(DeletePescription(index))}
- className="appearance-none h-10 mt-1 block border border-gray-400 rounded py-2 px-4 text-sm bg-gray-100 hover:bg-gray-200 focus:outline-none focus:bg-white focus:border-gray-600 text-gray-600 font-bold">
- {"x" |> str}
-
-
-
-@react.component
-let make = (~prescriptions, ~selectCB) => {
- let send = action => reducer(prescriptions, action) |> selectCB
-
-
{"Prescription" |> str}
-
-
-
- {"Medicine" |> str}
-
-
-
-
- {"Dosage" |> str}
-
-
-
-
- {"Days" |> str}
-
-
-
- {prescriptions
- |> Array.mapi((index, item) => showPrescriptionForm(item, index, send))
- |> React.array}
-
- send(AddPescription)}
- className="w-full font-bold block px-4 py-2 text-sm leading-5 text-left text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900">
- {"+ Add medicine" |> str}
-
-
-
-}
diff --git a/src/Components/Common/prescription-builder/components/Prescription__Picker.res b/src/Components/Common/prescription-builder/components/Prescription__Picker.res
deleted file mode 100644
index aec60a0dba6..00000000000
--- a/src/Components/Common/prescription-builder/components/Prescription__Picker.res
+++ /dev/null
@@ -1,95 +0,0 @@
-let str = React.string
-
-open Webapi.Dom
-
-let onWindowClick = (showDropdown, setShowDropdown, _event) =>
- if showDropdown {
- setShowDropdown(_ => false)
- } else {
- ()
- }
-
-let toggleDropdown = (setShowDropdown, event) => {
- event |> ReactEvent.Mouse.stopPropagation
- setShowDropdown(showDropdown => !showDropdown)
-}
-
-let search = (searchString, selectables) =>
- (selectables |> Js.Array.filter(selection =>
- selection
- |> String.lowercase_ascii
- |> Js.String.includes(searchString |> String.lowercase_ascii) && selection != searchString
- ))->Belt.SortArray.stableSortBy((x, y) => String.compare(x, y))
-
-let renderSelectables = (selections, updateCB) =>
- selections |> Array.mapi((index, selection) =>
- string_of_int}
- onClick={_ => updateCB(selection)}
- className="w-full block px-4 py-2 text-sm leading-5 text-left text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900">
- {selection |> str}
-
- )
-
-let searchResult = (searchInput, updateCB, selectables) => {
- // Remove all excess space characters from the user input.
- let normalizedString =
- searchInput
- |> Js.String.trim
- |> Js.String.replaceByRe(Js.Re.fromStringWithFlags("\\s+", ~flags="g"), " ")
- switch normalizedString {
- | "" => []
- | searchString =>
- let matchingSelections = search(searchString, selectables)
- renderSelectables(matchingSelections, updateCB)
- }
-}
-
-let renderDropdown = results =>
-
-
-
{results |> React.array}
-
-
-
-@react.component
-let make = (~id, ~value, ~updateCB, ~placeholder, ~selectables) => {
- let results = searchResult(value, updateCB, selectables)
- let (showDropdown, setShowDropdown) = React.useState(_ => false)
- React.useEffect1(() => {
- let curriedFunction = onWindowClick(showDropdown, setShowDropdown)
-
- let removeEventListener = () => Window.removeEventListener(window, "click", curriedFunction)
-
- if showDropdown {
- Window.addEventListener(window, "click", curriedFunction)
- Some(removeEventListener)
- } else {
- removeEventListener()
- None
- }
- }, [showDropdown])
-
-
- setShowDropdown(_ => !showDropdown)}
- onChange={e => updateCB(ReactEvent.Form.target(e)["value"])}
- className="appearance-none h-10 mt-1 block w-full border border-gray-400 rounded py-2 px-4 text-sm bg-gray-100 hover:bg-gray-200 focus:outline-none focus:bg-white focus:ring-primary-500"
- placeholder
- required=true
- />
- {results |> Array.length == 0
- ? switch showDropdown {
- | true => renderDropdown(renderSelectables(selectables, updateCB))
- | false => React.null
- }
- : switch showDropdown {
- | true => renderDropdown(results)
- | false => React.null
- }}
-
-}
diff --git a/src/Components/CriticalCareRecording/CriticalCare__Index.res b/src/Components/CriticalCareRecording/CriticalCare__Index.res
index 131b92df7e5..56bc5623264 100644
--- a/src/Components/CriticalCareRecording/CriticalCare__Index.res
+++ b/src/Components/CriticalCareRecording/CriticalCare__Index.res
@@ -11,17 +11,17 @@ let renderLine = (title, value) => {
let renderIndicators = (title, value, isMin, isMax, minText, maxText) => {
let indicator = if isMax {
- {str(maxText)}
+ {str(maxText)}
} else if isMin {
- {str(minText)}
+ {str(minText)}
} else {
- {str("Normal")}
+ {str("Normal")}
}
diff --git a/src/Components/CriticalCareRecording/HemodynamicParameters/CriticalCare__HemodynamicParametersEditor.res b/src/Components/CriticalCareRecording/HemodynamicParameters/CriticalCare__HemodynamicParametersEditor.res
index 1148706683b..829df2aa078 100644
--- a/src/Components/CriticalCareRecording/HemodynamicParameters/CriticalCare__HemodynamicParametersEditor.res
+++ b/src/Components/CriticalCareRecording/HemodynamicParameters/CriticalCare__HemodynamicParametersEditor.res
@@ -280,13 +280,13 @@ let make = (~hemodynamicParameter, ~updateCB, ~id, ~consultationId) => {
send(SetResp(int_of_string(s)))}
getLabel={getStatus(12.0, "Low", 16.0, "High")}
- hasError={ValidationUtils.isInputInRangeInt(0, 70, state.resp)}
+ hasError={ValidationUtils.isInputInRangeInt(0, 150, state.resp)}
/>
diff --git a/src/Components/CriticalCareRecording/Pain/CriticalCare__PainEditor.res b/src/Components/CriticalCareRecording/Pain/CriticalCare__PainEditor.res
index 9b4ec646ae8..da041231265 100644
--- a/src/Components/CriticalCareRecording/Pain/CriticalCare__PainEditor.res
+++ b/src/Components/CriticalCareRecording/Pain/CriticalCare__PainEditor.res
@@ -280,8 +280,9 @@ let renderBody = (state, send, title, partPaths, substr) => {
{switch selectedPart {
| Some(p) =>
-
getIntoView(Pain.regionToString(regionType), false)
: _ => send(RemoveFromSelectedParts(p))}
diff --git a/src/Components/CriticalCareRecording/PressureSore/CriticalCare__PressureSoreEditor.res b/src/Components/CriticalCareRecording/PressureSore/CriticalCare__PressureSoreEditor.res
index 9b8f614f3ef..de3062edeb0 100644
--- a/src/Components/CriticalCareRecording/PressureSore/CriticalCare__PressureSoreEditor.res
+++ b/src/Components/CriticalCareRecording/PressureSore/CriticalCare__PressureSoreEditor.res
@@ -274,8 +274,9 @@ let renderBody = (state, send, title, partPaths, substr) => {
{state.previewMode ? React.null :
{switch selectedPart {
| Some(p) =>
-
getIntoView(PressureSore.regionToString(regionType), false)
: _ => send(RemoveFromSelectedParts(p))}
diff --git a/src/Components/CriticalCareRecording/Recording/CriticalCare__Recording.res b/src/Components/CriticalCareRecording/Recording/CriticalCare__Recording.res
index 0316430dcd3..2903ab3e406 100644
--- a/src/Components/CriticalCareRecording/Recording/CriticalCare__Recording.res
+++ b/src/Components/CriticalCareRecording/Recording/CriticalCare__Recording.res
@@ -35,10 +35,11 @@ let basicEditor = (~facilityId, ~patientId, ~consultationId, ~id) => {
className={`rounded-lg border px-4 py-2 mt-4 mx-auto cursor-pointer flex justify-between items-center bg-green-100 border-green-500`}
href={`/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/daily-rounds/${id}/update`}>
-
+
+
{str("Basic Editor")}
-
+
}
let editorNameToString = editor => {
@@ -67,8 +68,9 @@ let editorToggle = (editorName, state, send) => {
: "bg-green-100 border-green-500"}`}
onClick={_ => showEditor(editorName, send)}>
-
@@ -81,8 +83,8 @@ let editorToggle = (editorName, state, send) => {
{Belt.Option.isNone(editorUpdated)
- ?
- : }
+ ?
+ : }
}
diff --git a/src/Components/CriticalCareRecording/components/CriticalCare__InputGroupError.res b/src/Components/CriticalCareRecording/components/CriticalCare__InputGroupError.res
index f4304cc9b4e..47b842e7e53 100644
--- a/src/Components/CriticalCareRecording/components/CriticalCare__InputGroupError.res
+++ b/src/Components/CriticalCareRecording/components/CriticalCare__InputGroupError.res
@@ -5,7 +5,7 @@ let make = (~message, ~active) =>
if active {
-
+
{message |> str}
} else {
diff --git a/src/Components/DeathReport/DeathReport.tsx b/src/Components/DeathReport/DeathReport.tsx
index 3901996e119..d4fd7d43f10 100644
--- a/src/Components/DeathReport/DeathReport.tsx
+++ b/src/Components/DeathReport/DeathReport.tsx
@@ -14,6 +14,7 @@ import { navigate } from "raviger";
import dayjs from "dayjs";
import useQuery from "../../Utils/request/useQuery";
import routes from "../../Redux/api";
+import CareIcon from "../../CAREUI/icons/CareIcon";
type DeathReport = {
name?: string;
@@ -140,13 +141,14 @@ export default function PrintDeathReport(props: { id: string }) {
onClick={(_) => window.print()}
className="btn btn-primary mr-2"
>
- Print Death Report
+ Print Death
+ Report
setIsPrintMode(false)}
className="btn btn-default"
>
- Close
+ Close
diff --git a/src/Components/ExternalResult/ExternalResultUpload.tsx b/src/Components/ExternalResult/ExternalResultUpload.tsx
index a8f9e339254..2f5337a242b 100644
--- a/src/Components/ExternalResult/ExternalResultUpload.tsx
+++ b/src/Components/ExternalResult/ExternalResultUpload.tsx
@@ -146,7 +146,11 @@ export default function ExternalResultUpload() {
target="_blank"
download
>
- {" "}
+ {" "}
{t("sample_format")}
diff --git a/src/Components/ExternalResult/ResultItem.tsx b/src/Components/ExternalResult/ResultItem.tsx
index 0954f704176..88f906a220c 100644
--- a/src/Components/ExternalResult/ResultItem.tsx
+++ b/src/Components/ExternalResult/ResultItem.tsx
@@ -7,6 +7,7 @@ import ConfirmDialog from "../Common/ConfirmDialog";
import useQuery from "../../Utils/request/useQuery";
import routes from "../../Redux/api";
import request from "../../Utils/request/request";
+import CareIcon from "../../CAREUI/icons/CareIcon.js";
const Loading = lazy(() => import("../Common/Loading"));
@@ -63,14 +64,14 @@ export default function ResultItem(props: any) {
navigate(`/external_results/${resultItemData.id}/update`)
}
>
-
+
{t("update_record")}
setShowDeleteAlert(true)}
>
-
+
{t("delete_record")}
diff --git a/src/Components/ExternalResult/ResultList.tsx b/src/Components/ExternalResult/ResultList.tsx
index 82a49e3a8e3..88a385394aa 100644
--- a/src/Components/ExternalResult/ResultList.tsx
+++ b/src/Components/ExternalResult/ResultList.tsx
@@ -115,8 +115,9 @@ export default function ResultList() {
className="inline-flex h-full items-center rounded-full border bg-white px-3 py-1 text-xs font-medium leading-4 text-gray-600"
>
{`${key}: ${value.name}`}
-
paramKey === "local_bodies"
? removeLSGFilter(paramKey, value.id)
@@ -124,7 +125,7 @@ export default function ResultList() {
? removeWardFilter(paramKey, value.id)
: null
}
- >
+ />
)
);
diff --git a/src/Components/Facility/AssetCreate.tsx b/src/Components/Facility/AssetCreate.tsx
index 0c422d1f646..eba5d89a0b3 100644
--- a/src/Components/Facility/AssetCreate.tsx
+++ b/src/Components/Facility/AssetCreate.tsx
@@ -4,6 +4,7 @@ import { AssetClass, AssetType } from "../Assets/AssetTypes";
import { Cancel, Submit } from "../Common/components/ButtonV2";
import {
LegacyRef,
+ MutableRefObject,
RefObject,
createRef,
lazy,
@@ -12,7 +13,7 @@ import {
useState,
} from "react";
-import CareIcon from "../../CAREUI/icons/CareIcon";
+import CareIcon, { IconName } from "../../CAREUI/icons/CareIcon";
import { FieldErrorText, FieldLabel } from "../Form/FormFields/FormField";
import { LocationSelect } from "../Common/LocationSelect";
import Page from "../Common/components/Page";
@@ -132,19 +133,25 @@ const AssetCreate = (props: AssetProps) => {
const [warrantyDetailsVisible, warrantyDetailsRef] = useVisibility(-300);
const [serviceDetailsVisible, serviceDetailsRef] = useVisibility(-300);
- const sections = {
+ const sections: {
+ [key in AssetFormSection]: {
+ icon: IconName;
+ isVisible: boolean;
+ ref: MutableRefObject
;
+ };
+ } = {
"General Details": {
- iconClass: "fa-solid fa-circle-info",
+ icon: "l-info-circle",
isVisible: generalDetailsVisible,
ref: generalDetailsRef,
},
"Warranty Details": {
- iconClass: "fa-solid fa-barcode",
+ icon: "l-qrcode-scan",
isVisible: warrantyDetailsVisible,
ref: warrantyDetailsRef,
},
"Service Details": {
- iconClass: "fas fa-tools",
+ icon: "l-wrench",
isVisible: serviceDetailsVisible,
ref: serviceDetailsRef,
},
@@ -393,7 +400,7 @@ const AssetCreate = (props: AssetProps) => {
className="btn-primary btn mt-5"
onClick={() => navigate(`/facility/${facilityId}/location/add`)}
>
-
+
{t("add_location")}
@@ -408,7 +415,7 @@ const AssetCreate = (props: AssetProps) => {
onClick={() => setIsScannerActive(false)}
className="btn btn-default mb-2"
>
-
+
{t("close_scanner")}
{
className="col-span-6 -ml-2 mb-6 flex flex-row items-center"
ref={section.ref as LegacyRef}
>
-
+
{sectionTitle}
@@ -483,7 +490,7 @@ const AssetCreate = (props: AssetProps) => {
setCurrentSection(sectionTitle as AssetFormSection);
}}
>
-
+
{sectionTitle}
);
diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx
index 615d7b6ae49..949f2f77895 100644
--- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx
+++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx
@@ -684,7 +684,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
isTab2Active={showEvents}
/>
{showEvents ? (
-
+
) : (
)}
diff --git a/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx b/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx
index 82a806dfc6b..36991333888 100644
--- a/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx
+++ b/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx
@@ -1,6 +1,5 @@
import { useTranslation } from "react-i18next";
import { useSlugs } from "../../../../Common/hooks/useSlug";
-import { ConsultationModel } from "../../models";
import PaginatedList from "../../../../CAREUI/misc/PaginatedList";
import routes from "../../../../Redux/api";
import { TimelineNode } from "../../../../CAREUI/display/Timeline";
@@ -9,15 +8,10 @@ import GenericEvent from "./GenericEvent";
import { EventGeneric } from "./types";
import { getEventIcon } from "./iconMap";
-interface Props {
- consultation: ConsultationModel;
-}
-
-export default function EventsList({ consultation }: Props) {
+export default function EventsList() {
const [consultationId] = useSlugs("consultation");
const { t } = useTranslation();
-
return (
{() => (
diff --git a/src/Components/Facility/Consultations/Beds.tsx b/src/Components/Facility/Consultations/Beds.tsx
index 518121e6e69..32023bc9f5f 100644
--- a/src/Components/Facility/Consultations/Beds.tsx
+++ b/src/Components/Facility/Consultations/Beds.tsx
@@ -225,7 +225,7 @@ const Beds = (props: BedsProps) => {
-
+
Move to bed
diff --git a/src/Components/Facility/Consultations/LiveFeed.tsx b/src/Components/Facility/Consultations/LiveFeed.tsx
index 8cf3d00836b..3cd731c6253 100644
--- a/src/Components/Facility/Consultations/LiveFeed.tsx
+++ b/src/Components/Facility/Consultations/LiveFeed.tsx
@@ -586,13 +586,13 @@ const LiveFeed = (props: any) => {
onClick={() => setToUpdate(preset)}
className="flex w-1/2 items-center justify-center gap-2 bg-green-200 py-1 text-sm text-green-800 hover:bg-green-800 hover:text-green-200 "
>
-
+
setToDelete(preset)}
className="flex w-1/2 items-center justify-center gap-2 bg-red-200 py-1 text-sm text-red-800 hover:bg-red-800 hover:text-red-200 "
>
-
+
@@ -610,7 +610,7 @@ const LiveFeed = (props: any) => {
setPresetsPage(presetsPage - 10);
}}
>
-
+
{
setPresetsPage(presetsPage + 10);
}}
>
-
+
) : (
@@ -631,7 +631,7 @@ const LiveFeed = (props: any) => {
handlePagination(page.offset - page.limit);
}}
>
-
+
{
handlePagination(page.offset + page.limit);
}}
>
-
+
)}
diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx
index c2cd94e0ded..6457d4d42bc 100644
--- a/src/Components/Facility/DoctorVideoSlideover.tsx
+++ b/src/Components/Facility/DoctorVideoSlideover.tsx
@@ -4,7 +4,7 @@ import SlideOver from "../../CAREUI/interactive/SlideOver";
import { getFacilityUsers } from "../../Redux/actions";
import { UserAssignedModel } from "../Users/models";
import { SkillObjectModel } from "../Users/models";
-import CareIcon from "../../CAREUI/icons/CareIcon";
+import CareIcon, { IconName } from "../../CAREUI/icons/CareIcon";
import { relativeTime } from "../../Utils/utils";
import useAuthUser from "../../Common/hooks/useAuthUser";
import { triggerGoal } from "../../Integrations/Plausible";
@@ -108,8 +108,8 @@ export default function DoctorVideoSlideover(props: {
function UserListItem(props: { user: UserAssignedModel }) {
const user = props.user;
- const icon =
- user.user_type === "Doctor" ? "fa-user-doctor " : " fa-user-nurse";
+ const icon: IconName =
+ user.user_type === "Doctor" ? "l-user-md" : "l-user-nurse";
const authUser = useAuthUser();
return (
@@ -145,9 +145,9 @@ function UserListItem(props: { user: UserAssignedModel }) {
// Show online icon based on last_login
user.last_login &&
Number(new Date()) - Number(new Date(user.last_login)) < 60000 ? (
-
+
) : (
-
+
)
}
diff --git a/src/Components/Facility/FacilityBedCapacity.tsx b/src/Components/Facility/FacilityBedCapacity.tsx
index 30d67bfcf33..2f7e5217fba 100644
--- a/src/Components/Facility/FacilityBedCapacity.tsx
+++ b/src/Components/Facility/FacilityBedCapacity.tsx
@@ -8,6 +8,7 @@ import ButtonV2 from "../Common/components/ButtonV2";
import { BedCapacity } from "./BedCapacity";
import BedTypeCard from "./BedTypeCard";
import useConfig from "../../Common/hooks/useConfig";
+import CareIcon from "../../CAREUI/icons/CareIcon";
export const FacilityBedCapacity = (props: any) => {
const [bedCapacityModalOpen, setBedCapacityModalOpen] = useState(false);
@@ -92,7 +93,7 @@ export const FacilityBedCapacity = (props: any) => {
onClick={() => setBedCapacityModalOpen(true)}
authorizeFor={NonReadOnlyUsers}
>
-
+
Add More Bed Types
diff --git a/src/Components/Facility/FacilityCard.tsx b/src/Components/Facility/FacilityCard.tsx
index 8e8dd6da601..6305fec69cf 100644
--- a/src/Components/Facility/FacilityCard.tsx
+++ b/src/Components/Facility/FacilityCard.tsx
@@ -61,7 +61,10 @@ export const FacilityCard = (props: { facility: any; userType: any }) => {
className="h-full max-h-32 w-full object-cover"
/>
)) || (
-
+
)}
@@ -79,7 +82,10 @@ export const FacilityCard = (props: { facility: any; userType: any }) => {
className="h-full w-full rounded-md object-cover"
/>
)) || (
-
+
)}
diff --git a/src/Components/Facility/FacilityDoctorList.tsx b/src/Components/Facility/FacilityDoctorList.tsx
index fddc1973aa3..efff861d2b7 100644
--- a/src/Components/Facility/FacilityDoctorList.tsx
+++ b/src/Components/Facility/FacilityDoctorList.tsx
@@ -9,6 +9,7 @@ import routes from "../../Redux/api";
import { DoctorModal } from "./models";
import DoctorsCountCard from "./DoctorsCountCard";
import { DoctorIcon } from "../TeleIcu/Icons/DoctorIcon";
+import CareIcon from "../../CAREUI/icons/CareIcon";
export const FacilityDoctorList = (props: any) => {
const [doctorCapacityModalOpen, setDoctorCapacityModalOpen] = useState(false);
@@ -94,7 +95,7 @@ export const FacilityDoctorList = (props: any) => {
disabled={doctorList.length === DOCTOR_SPECIALIZATION.length}
authorizeFor={NonReadOnlyUsers}
>
-
+
Add Doctor Types
diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx
index 4b4754b894c..4120f4a5469 100644
--- a/src/Components/Facility/FacilityHome.tsx
+++ b/src/Components/Facility/FacilityHome.tsx
@@ -108,7 +108,7 @@ export const FacilityHome = (props: any) => {
id="facility-coverimage"
className="absolute right-0 top-0 z-10 flex h-full w-full flex-col items-center justify-center bg-black text-sm text-gray-300 opacity-0 transition-[opacity] hover:opacity-60 md:h-[88px]"
>
-
+
{`${hasCoverImage ? "Edit" : "Upload"}`}
);
@@ -171,10 +171,11 @@ export const FacilityHome = (props: any) => {
hasPermissionToEditCoverImage && setEditCoverImage(true)
}
>
-
+ />
{editCoverImageTooltip}
)}
diff --git a/src/Components/Facility/FacilityHomeTriage.tsx b/src/Components/Facility/FacilityHomeTriage.tsx
index ba1cd199044..41bf40a4904 100644
--- a/src/Components/Facility/FacilityHomeTriage.tsx
+++ b/src/Components/Facility/FacilityHomeTriage.tsx
@@ -3,6 +3,7 @@ import ButtonV2 from "../Common/components/ButtonV2";
import Table from "../Common/components/Table";
import useQuery from "../../Utils/request/useQuery";
import routes from "../../Redux/api";
+import CareIcon from "../../CAREUI/icons/CareIcon";
export const FacilityHomeTriage = (props: any) => {
const triageQuery = useQuery(routes.getTriage, {
@@ -58,7 +59,10 @@ export const FacilityHomeTriage = (props: any) => {
onClick={() => navigate(`/facility/${props.facilityId}/triage`)}
authorizeFor={props.NonReadOnlyUsers}
>
-
+
Add Triage
diff --git a/src/Components/Facility/FacilityUsers.tsx b/src/Components/Facility/FacilityUsers.tsx
index f18b9578192..2985649a543 100644
--- a/src/Components/Facility/FacilityUsers.tsx
+++ b/src/Components/Facility/FacilityUsers.tsx
@@ -301,13 +301,6 @@ export default function FacilityUsers(props: any) {
className="mt-2 flex gap-3 text-2xl font-bold capitalize"
>
{`${user.first_name} ${user.last_name}`}
-
- {user.last_login && isUserOnline(user) ? (
-
- ) : null}
{showUserDelete(authUser, user) && (
import("../Common/Loading"));
@@ -139,7 +140,7 @@ export const HospitalList = () => {
className="border-grey-500 mt-4 cursor-pointer whitespace-nowrap rounded-md border bg-white p-16 text-center text-sm font-semibold shadow hover:bg-gray-300"
onClick={() => navigate("/facility/create")}
>
-
+
{t("create_facility")}
{t("no_duplicate_facility")}
diff --git a/src/Components/Facility/InventoryLog.tsx b/src/Components/Facility/InventoryLog.tsx
index 474de009f76..96dd564d53c 100644
--- a/src/Components/Facility/InventoryLog.tsx
+++ b/src/Components/Facility/InventoryLog.tsx
@@ -94,7 +94,10 @@ export default function InventoryLog(props: any) {
{inventoryItem.quantity_in_default_unit}{" "}
{inventoryItem.item_object?.default_unit?.name}
{inventoryItem.probable_accident && (
-
+
)}
diff --git a/src/Components/Facility/Investigations/InvestigationSuggestions.tsx b/src/Components/Facility/Investigations/InvestigationSuggestions.tsx
index 4d614d224e6..3be01b5d7e8 100644
--- a/src/Components/Facility/Investigations/InvestigationSuggestions.tsx
+++ b/src/Components/Facility/Investigations/InvestigationSuggestions.tsx
@@ -128,7 +128,7 @@ export default function ViewInvestigationSuggestions(props: {
{type}
{investigationMissed && (
-
+
Investigation Missed!
@@ -136,7 +136,7 @@ export default function ViewInvestigationSuggestions(props: {
)}
{investigated && !investigationMissed && (
-
+
Investigation Recorded
diff --git a/src/Components/Facility/LocationManagement.tsx b/src/Components/Facility/LocationManagement.tsx
index 93a08794c82..985d6a029fe 100644
--- a/src/Components/Facility/LocationManagement.tsx
+++ b/src/Components/Facility/LocationManagement.tsx
@@ -1,5 +1,5 @@
-import { lazy } from "react";
-import ButtonV2 from "../Common/components/ButtonV2";
+import { lazy, useState } from "react";
+import ButtonV2, { Cancel } from "../Common/components/ButtonV2";
import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor";
import CareIcon from "../../CAREUI/icons/CareIcon";
import Page from "../Common/components/Page";
@@ -7,6 +7,10 @@ import routes from "../../Redux/api";
import PaginatedList from "../../CAREUI/misc/PaginatedList";
import { LocationModel } from "./models";
import RecordMeta from "../../CAREUI/display/RecordMeta";
+import request from "../../Utils/request/request";
+import * as Notification from "../../Utils/Notifications.js";
+import ConfirmDialog from "../Common/ConfirmDialog";
+import DialogModal from "../Common/Dialog";
const Loading = lazy(() => import("../Common/Loading"));
@@ -14,13 +18,62 @@ interface Props {
facilityId: string;
}
+interface LocationProps extends LocationModel {
+ setShowDeletePopup: (e: { open: boolean; name: string; id: string }) => void;
+}
+
export default function LocationManagement({ facilityId }: Props) {
+ const [showDeleteFailModal, setShowDeleteFailModal] = useState({
+ open: false,
+ id: "",
+ reason: "",
+ });
+ const [showDeletePopup, setShowDeletePopup] = useState({
+ open: false,
+ name: "",
+ id: "",
+ });
+
+ const closeDeleteFailModal = () => {
+ setShowDeleteFailModal({ ...showDeleteFailModal, open: false });
+ };
+
+ const deleteAssetLocation = async () => {
+ const { res, error } = await request(routes.deleteFacilityAssetLocation, {
+ pathParams: {
+ facility_external_id: facilityId,
+ external_id: showDeletePopup.id,
+ },
+ });
+ if (res?.ok) {
+ Notification.Success({
+ msg: `Location ${showDeletePopup.name} deleted successfully`,
+ });
+ } else if (res?.status === 400 && error?.length) {
+ const errorMessage: string = (error as unknown as string[])[0];
+ if (errorMessage.includes("Asset")) {
+ setShowDeleteFailModal({
+ open: true,
+ id: showDeletePopup.id,
+ reason: "assets",
+ });
+ } else {
+ setShowDeleteFailModal({
+ open: true,
+ id: showDeletePopup.id,
+ reason: "beds",
+ });
+ }
+ }
+ setShowDeletePopup({ ...showDeletePopup, open: false });
+ };
+
return (
- {() => (
+ {({ refetch }) => (
className="my-8 grid gap-3 @4xl:grid-cols-2 @6xl:grid-cols-3 @[100rem]:grid-cols-4 lg:mx-8">
- {(item) => }
+ {(item) => (
+
+ )}
+
+
+ setShowDeletePopup({ ...showDeletePopup, open: false })
+ }
+ onConfirm={async () => {
+ await deleteAssetLocation();
+ refetch();
+ }}
+ />
+
+
+
+ Delete Location
+
+ }
+ show={showDeleteFailModal.open}
+ onClose={() =>
+ setShowDeleteFailModal({ ...showDeleteFailModal, open: false })
+ }
+ >
+
+ {showDeleteFailModal.reason === "beds" ? (
+
+
+ There are Beds associated with this location that need to be
+ deleted first before the location can be removed
+
+
+ {
+ closeDeleteFailModal();
+ }}
+ />
+
+ Manage Beds
+
+
+
+ ) : (
+
+
+ There are Assets associated with this location that need to
+ be deleted first before the location can be removed
+
+
+ {
+ closeDeleteFailModal();
+ }}
+ />
+
+ Manage Assets
+
+
+
+ )}
+
+
)}
@@ -76,19 +207,17 @@ const Location = ({
created_date,
modified_date,
id,
-}: LocationModel) => (
+ setShowDeletePopup,
+}: LocationProps) => (
-
-
-
+
+
+
{name}
@@ -96,16 +225,6 @@ const Location = ({
-
-
- Edit
-
Manage Beds
+
+
+
+
+ Edit
+
+
+
+
+ setShowDeletePopup({ open: true, name: name ?? "", id: id ?? "" })
+ }
+ authorizeFor={NonReadOnlyUsers}
+ >
+
+ Delete
+
+
+
diff --git a/src/Components/Facility/PatientNotesSlideover.tsx b/src/Components/Facility/PatientNotesSlideover.tsx
index 8943d7fe21a..2e04312d277 100644
--- a/src/Components/Facility/PatientNotesSlideover.tsx
+++ b/src/Components/Facility/PatientNotesSlideover.tsx
@@ -12,6 +12,8 @@ import routes from "../../Redux/api";
import { PatientNoteStateType } from "./models";
import useKeyboardShortcut from "use-keyboard-shortcut";
import AutoExpandingTextInputFormField from "../Form/FormFields/AutoExpandingTextInputFormField.js";
+import * as Sentry from "@sentry/browser";
+import useAuthUser from "../../Common/hooks/useAuthUser";
interface PatientNotesProps {
patientId: string;
@@ -26,6 +28,33 @@ export default function PatientNotesSlideover(props: PatientNotesProps) {
const [reload, setReload] = useState(false);
const [focused, setFocused] = useState(false);
+ const { username } = useAuthUser();
+
+ const intialSubscriptionState = async () => {
+ try {
+ const res = await request(routes.getUserPnconfig, {
+ pathParams: { username },
+ });
+ const reg = await navigator.serviceWorker.ready;
+ const subscription = await reg.pushManager.getSubscription();
+ if (!subscription && !res.data?.pf_endpoint) {
+ Notification.Warn({
+ msg: "Please subscribe to notifications to get live updates on doctor notes.",
+ });
+ } else if (subscription?.endpoint !== res.data?.pf_endpoint) {
+ Notification.Warn({
+ msg: "Please subscribe to notifications on this device to get live updates on doctor notes.",
+ });
+ }
+ } catch (error) {
+ Sentry.captureException(error);
+ }
+ };
+
+ useEffect(() => {
+ intialSubscriptionState();
+ }, []);
+
const initialData: PatientNoteStateType = {
notes: [],
cPage: 1,
diff --git a/src/Components/Facility/TreatmentSummary.tsx b/src/Components/Facility/TreatmentSummary.tsx
index b6caebc750e..b55c86216a7 100644
--- a/src/Components/Facility/TreatmentSummary.tsx
+++ b/src/Components/Facility/TreatmentSummary.tsx
@@ -4,6 +4,7 @@ import useSlug from "../../Common/hooks/useSlug";
import useAppHistory from "../../Common/hooks/useAppHistory";
import routes from "../../Redux/api";
import useQuery from "../../Utils/request/useQuery";
+import CareIcon from "../../CAREUI/icons/CareIcon";
const TreatmentSummary = (props: any) => {
const { consultationId, patientId } = props;
@@ -35,10 +36,10 @@ const TreatmentSummary = (props: any) => {
onClick={(_) => window.print()}
className="btn btn-primary mr-2"
>
- Print Treatment Summary
+ Print Treatment Summary
goBack(url)} className="btn btn-default">
- Close
+ Close
diff --git a/src/Components/Notifications/NotificationsList.tsx b/src/Components/Notifications/NotificationsList.tsx
index 6066bf6c66b..1ce23dafdbc 100644
--- a/src/Components/Notifications/NotificationsList.tsx
+++ b/src/Components/Notifications/NotificationsList.tsx
@@ -4,7 +4,7 @@ import Spinner from "../Common/Spinner";
import { NOTIFICATION_EVENTS } from "../../Common/constants";
import { Error } from "../../Utils/Notifications.js";
import { classNames, formatDateTime } from "../../Utils/utils";
-import CareIcon from "../../CAREUI/icons/CareIcon";
+import CareIcon, { IconName } from "../../CAREUI/icons/CareIcon";
import * as Sentry from "@sentry/browser";
import {
ShrinkedSidebarItem,
@@ -73,8 +73,9 @@ const NotificationTile = ({
const getNotificationTitle = (id: string) =>
NOTIFICATION_EVENTS.find((notification) => notification.id === id)?.text;
- const getNotificationIcon = (id: string) =>
- NOTIFICATION_EVENTS.find((notification) => notification.id === id)?.icon;
+ const getNotificationIcon = (id: string): IconName =>
+ NOTIFICATION_EVENTS.find((notification) => notification.id === id)?.icon ||
+ "default";
return (
{
@@ -93,7 +94,10 @@ const NotificationTile = ({
{getNotificationTitle(result.event)}
-
+
{result.message}
@@ -479,13 +483,13 @@ export default function NotificationsList({
o.text}
optionValue={(o) => o.id}
- optionIcon={(o) => }
+ optionIcon={(o) => }
onChange={(v) => setEventFilter(v || "")}
/>
diff --git a/src/Components/Patient/DailyRounds.tsx b/src/Components/Patient/DailyRounds.tsx
index 56e26dff022..288d46f7359 100644
--- a/src/Components/Patient/DailyRounds.tsx
+++ b/src/Components/Patient/DailyRounds.tsx
@@ -575,7 +575,7 @@ export const DailyRounds = (props: any) => {
label="Respiratory Rate"
unit="bpm"
start={0}
- end={50}
+ end={150}
step={1}
thresholds={[
{
diff --git a/src/Components/Patient/FileUpload.tsx b/src/Components/Patient/FileUpload.tsx
index 77c67abeadd..4976bb0c91f 100644
--- a/src/Components/Patient/FileUpload.tsx
+++ b/src/Components/Patient/FileUpload.tsx
@@ -3,21 +3,12 @@ import CircularProgress from "../Common/components/CircularProgress";
import {
useCallback,
useState,
- useEffect,
useRef,
lazy,
ChangeEvent,
+ useEffect,
} from "react";
-import { useDispatch } from "react-redux";
-import { statusType, useAbortableEffect } from "../../Common/utils";
-import {
- viewUpload,
- retrieveUpload,
- createUpload,
- getPatient,
- editUpload,
-} from "../../Redux/actions";
-import { FileUploadModel } from "./models";
+import { CreateFileResponse, FileUploadModel } from "./models";
import * as Notification from "../../Utils/Notifications.js";
import { VoiceRecorder } from "../../Utils/VoiceRecorder";
import Pagination from "../Common/Pagination";
@@ -39,6 +30,9 @@ import AuthorizedChild from "../../CAREUI/misc/AuthorizedChild";
import Page from "../Common/components/Page";
import FilePreviewDialog from "../Common/FilePreviewDialog";
import useAuthUser from "../../Common/hooks/useAuthUser";
+import useQuery from "../../Utils/request/useQuery";
+import routes from "../../Redux/api";
+import request from "../../Utils/request/request";
const Loading = lazy(() => import("../Common/Loading"));
@@ -145,7 +139,6 @@ export const FileUpload = (props: FileUploadProps) => {
claimId,
} = props;
const id = patientId;
- const dispatch: any = useDispatch();
const [isLoading, setIsLoading] = useState(false);
const [uploadedArchievedFiles, setuploadedArchievedFiles] = useState<
Array
@@ -157,7 +150,6 @@ export const FileUpload = (props: FileUploadProps) => {
useState>([{}]);
const [uploadStarted, setUploadStarted] = useState(false);
const [audiouploadStarted, setAudioUploadStarted] = useState(false);
- const [reload, setReload] = useState(false);
const [uploadPercent, setUploadPercent] = useState(0);
const [uploadFileName, setUploadFileName] = useState("");
const [uploadFileError, setUploadFileError] = useState("");
@@ -204,8 +196,6 @@ export const FileUpload = (props: FileUploadProps) => {
const [totalDischargeSummaryFilesCount, setTotalDischargeSummaryFilesCount] =
useState(0);
const [offset, setOffset] = useState(0);
- const [facilityName, setFacilityName] = useState("");
- const [patientName, setPatientName] = useState("");
const [modalOpenForEdit, setModalOpenForEdit] = useState(false);
const [modalOpenForCamera, setModalOpenForCamera] = useState(false);
const [modalOpenForArchive, setModalOpenForArchive] = useState(false);
@@ -219,28 +209,15 @@ export const FileUpload = (props: FileUploadProps) => {
const [sortFileState, setSortFileState] = useState("UNARCHIVED");
const authUser = useAuthUser();
const limit = RESULTS_PER_PAGE_LIMIT;
- const [isActive, setIsActive] = useState(true);
const [tabs, setTabs] = useState([
{ name: "Unarchived Files", value: "UNARCHIVED" },
{ name: "Archived Files", value: "ARCHIVED" },
]);
- useEffect(() => {
- async function fetchPatientName() {
- if (patientId) {
- const res = await dispatch(getPatient({ id: patientId }));
- if (res.data) {
- setPatientName(res.data.name);
- setFacilityName(res.data.facility_object.name);
- setIsActive(res.data.is_active);
- }
- } else {
- setPatientName("");
- setFacilityName("");
- }
- }
- fetchPatientName();
- }, [dispatch, patientId]);
+ const { data: patient } = useQuery(routes.getPatient, {
+ pathParams: { id: patientId },
+ prefetch: !!patientId,
+ });
const captureImage = () => {
setPreviewImage(webRef.current.getScreenshot());
@@ -298,104 +275,93 @@ export const FileUpload = (props: FileUploadProps) => {
}
};
- const fetchData = useCallback(
- async (status: statusType) => {
- setIsLoading(true);
- const unarchivedFileData = {
+ const fetchData = useCallback(async () => {
+ setIsLoading(true);
+
+ const unarchivedQuery = await request(routes.viewUpload, {
+ query: {
file_type: type,
associating_id: getAssociatedId(),
is_archived: false,
limit: limit,
offset: offset,
- };
- let res = await dispatch(viewUpload(unarchivedFileData));
- if (!status.aborted) {
- if (res?.data) {
- audio_urls(res.data.results);
- setuploadedUnarchievedFiles(
- res?.data?.results?.filter(
- (file: FileUploadModel) =>
- file.upload_completed || file.file_category === "AUDIO"
- )
- );
- setTotalUnarchievedFilesCount(res.data.count);
- }
- setIsLoading(false);
- }
- const archivedFileData = {
+ },
+ });
+
+ if (unarchivedQuery.data) {
+ audio_urls(unarchivedQuery.data.results);
+ setuploadedUnarchievedFiles(
+ unarchivedQuery.data.results?.filter(
+ (file) => file.upload_completed || file.file_category === "AUDIO"
+ )
+ );
+ setTotalUnarchievedFilesCount(unarchivedQuery.data.count);
+ }
+
+ const archivedQuery = await request(routes.viewUpload, {
+ query: {
file_type: type,
associating_id: getAssociatedId(),
is_archived: true,
limit: limit,
offset: offset,
- };
- res = await dispatch(viewUpload(archivedFileData));
- if (!status.aborted) {
- if (res?.data) {
- setuploadedArchievedFiles(res.data.results);
- setTotalArchievedFilesCount(res.data.count);
- }
- setIsLoading(false);
- }
- if (type === "CONSULTATION") {
- const dischargeSummaryFileData = {
+ },
+ });
+
+ if (archivedQuery.data) {
+ setuploadedArchievedFiles(archivedQuery.data.results);
+ setTotalArchievedFilesCount(archivedQuery.data.count);
+ }
+
+ if (type === "CONSULTATION") {
+ const dischargeSummaryQuery = await request(routes.viewUpload, {
+ query: {
file_type: "DISCHARGE_SUMMARY",
associating_id: getAssociatedId(),
is_archived: false,
limit: limit,
offset: offset,
- };
- res = await dispatch(viewUpload(dischargeSummaryFileData));
- if (!status.aborted) {
- if (res?.data) {
- setuploadedDischargeSummaryFiles(res.data.results);
- setTotalDischargeSummaryFilesCount(res.data.count);
- if (res?.data?.results?.length > 0) {
- setTabs([
- ...tabs,
- {
- name: "Discharge Summary",
- value: "DISCHARGE_SUMMARY",
- },
- ]);
- }
- }
+ },
+ });
+ if (dischargeSummaryQuery.data) {
+ setuploadedDischargeSummaryFiles(dischargeSummaryQuery.data.results);
+ setTotalDischargeSummaryFilesCount(dischargeSummaryQuery.data.count);
+ if (dischargeSummaryQuery.data?.results?.length) {
+ setTabs([
+ ...tabs,
+ {
+ name: "Discharge Summary",
+ value: "DISCHARGE_SUMMARY",
+ },
+ ]);
}
- setIsLoading(false);
}
- },
- [dispatch, id, offset]
- );
+ }
- // Store all audio urls for each audio file
- const audio_urls = (files: any) => {
- let audio_files = files || [];
- audio_files = audio_files.filter(
- (x: FileUploadModel) => x.file_category === "AUDIO"
- );
+ setIsLoading(false);
+ }, [id, offset]);
- const getURL = async (audio_files: any) => {
- const data = { file_type: type, associating_id: getAssociatedId() };
- const all_urls: any = {};
+ useEffect(() => {
+ fetchData();
+ }, [fetchData]);
- for (const x of audio_files) {
- if (x.id) {
- const responseData = await dispatch(retrieveUpload(data, x.id));
- all_urls[`${x.id}`] = responseData.data.read_signed_url;
- }
- }
- seturl(all_urls);
- };
- getURL(audio_files);
+ // Store all audio urls for each audio file
+ const audio_urls = async (files: FileUploadModel[]) => {
+ const audioFiles = files.filter((x) => x.file_category === "AUDIO");
+ const query = { file_type: type, associating_id: getAssociatedId() };
+ const urls = await Promise.all(
+ audioFiles.map(async (file) => {
+ const id = file.id as string;
+ const { data } = await request(routes.retrieveUpload, {
+ query,
+ pathParams: { id: id as string },
+ });
+ return [id, data?.read_signed_url];
+ })
+ );
+ seturl(Object.fromEntries(urls));
};
- useAbortableEffect(
- (status: statusType) => {
- fetchData(status);
- },
- [dispatch, fetchData, id, reload]
- );
-
// Function to extract the extension of the file
const getExtension = (url: string) => {
const div1 = url.split("?")[0].split(".");
@@ -404,6 +370,7 @@ export const FileUpload = (props: FileUploadProps) => {
};
const getIconClassName = (extensionName: string | undefined) => {
+ if (!extensionName) return "l-file-medical";
// check for image files
if (
[
@@ -421,9 +388,9 @@ export const FileUpload = (props: FileUploadProps) => {
".pjp",
".svg",
".webp",
- ].some((ext) => ext === extensionName)
+ ].includes(extensionName)
) {
- return "fa-solid fa-file-image";
+ return "l-image";
}
// check for video files
if (
@@ -443,58 +410,46 @@ export const FileUpload = (props: FileUploadProps) => {
".qt",
".flv",
".swf",
- ].some((ext) => ext === extensionName)
+ ].includes(extensionName)
) {
- return "fa-solid fa-file-video";
- }
- // check for compressed files
- if (extensionName === ".zip" || extensionName === ".rar") {
- return "fa-solid fa-file-zipper";
- }
- // check for misclaneous files whose icons are available freely in fontawesome
- if (extensionName === ".pdf") {
- return "fa-solid fa-file-pdf";
- }
- if (extensionName === ".docx") {
- return "fa-solid fa-file-word";
- }
- if (extensionName === ".csv") {
- return "fa-solid fa-file-csv";
- }
- if (extensionName === ".xlsx") {
- return "fa-solid fa-file-excel";
- }
- if (extensionName === ".txt") {
- return "fa-solid fa-file-lines";
+ return "l-video";
}
+
if (extensionName === ".pptx") {
- return "fa-solid fa-file-powerpoint";
+ return "l-presentation-play";
}
- return "fa-solid fa-file-medical";
+ return "l-file-medical";
};
- const loadFile = async (id: any) => {
+ const loadFile = async (id: string) => {
setFileUrl("");
setFileState({ ...file_state, open: true });
- const data = {
- file_type: sortFileState === "DISCHARGE_SUMMARY" ? sortFileState : type,
- associating_id: getAssociatedId(),
- };
- const responseData = await dispatch(retrieveUpload(data, id));
- const file_extension = getExtension(responseData.data.read_signed_url);
- if (file_extension === "pdf") {
- window.open(responseData.data.read_signed_url, "_blank");
+ const { data } = await request(routes.retrieveUpload, {
+ query: {
+ file_type: sortFileState === "DISCHARGE_SUMMARY" ? sortFileState : type,
+ associating_id: getAssociatedId(),
+ },
+ pathParams: { id },
+ });
+
+ if (!data) return;
+
+ const signedUrl = data.read_signed_url as string;
+ const extension = getExtension(signedUrl);
+
+ if (extension === "pdf") {
+ window.open(signedUrl, "_blank");
setFileState({ ...file_state, open: false });
} else {
setFileState({
...file_state,
open: true,
- name: responseData.data.name,
- extension: file_extension,
- isImage: ExtImage.includes(file_extension),
+ name: data.name as string,
+ extension,
+ isImage: ExtImage.includes(extension),
});
- downloadFileUrl(responseData.data.read_signed_url);
- setFileUrl(responseData.data.read_signed_url);
+ downloadFileUrl(signedUrl);
+ setFileUrl(signedUrl);
}
};
@@ -518,63 +473,54 @@ export const FileUpload = (props: FileUploadProps) => {
}
};
- const partialupdateFileName = async (id: any, name: string) => {
- const data = {
- file_type: sortFileState === "DISCHARGE_SUMMARY" ? sortFileState : type,
- name: name,
- associating_id: getAssociatedId(),
- };
- if (validateEditFileName(name)) {
- const res = await dispatch(
- editUpload({ name: data.name }, id, data.file_type, data.associating_id)
- );
- if (res && res.status === 200) {
- fetchData(res.status);
- Notification.Success({
- msg: "File name changed successfully",
- });
- setbtnloader(false);
- setModalOpenForEdit(false);
- } else {
- setbtnloader(false);
- }
- } else {
+ const partialupdateFileName = async (id: string, name: string) => {
+ if (!validateEditFileName(name)) {
setbtnloader(false);
+ return;
}
+
+ const fileType =
+ sortFileState === "DISCHARGE_SUMMARY" ? sortFileState : type;
+
+ const { res } = await request(routes.editUpload, {
+ body: { name },
+ pathParams: {
+ id,
+ fileType,
+ associatingId: getAssociatedId(),
+ },
+ });
+
+ if (res?.ok) {
+ fetchData();
+ Notification.Success({ msg: "File name changed successfully" });
+ setModalOpenForEdit(false);
+ }
+ setbtnloader(false);
};
- const archiveFile = async (id: any, archiveReason: string) => {
- const data = {
- file_type: type,
- is_archived: true,
- archive_reason: archiveReason,
- associating_id: getAssociatedId(),
- };
- if (validateArchiveReason(archiveReason)) {
- const res = await dispatch(
- editUpload(
- {
- is_archived: data.is_archived,
- archive_reason: data.archive_reason,
- },
- id,
- data.file_type,
- data.associating_id
- )
- );
- if (res && res.status === 200) {
- fetchData(res.status);
- Notification.Success({
- msg: "File archived successfully",
- });
- setbtnloader(false);
- setModalOpenForArchive(false);
- } else {
- setbtnloader(false);
- }
- } else {
+ const archiveFile = async (id: string, archive_reason: string) => {
+ if (!validateArchiveReason(archiveReason)) {
setbtnloader(false);
+ return;
}
+
+ const { res } = await request(routes.editUpload, {
+ body: { is_archived: true, archive_reason },
+ pathParams: {
+ id,
+ fileType: type,
+ associatingId: getAssociatedId(),
+ },
+ });
+
+ if (res?.ok) {
+ fetchData();
+ Notification.Success({ msg: "File archived successfully" });
+ setModalOpenForArchive(false);
+ }
+
+ setbtnloader(false);
};
const renderFileUpload = (item: FileUploadModel) => {
@@ -590,7 +536,10 @@ export const FileUpload = (props: FileUploadProps) => {
-
+
@@ -703,11 +652,10 @@ export const FileUpload = (props: FileUploadProps) => {
-
+
@@ -739,7 +687,7 @@ export const FileUpload = (props: FileUploadProps) => {
{
- loadFile(item.id);
+ loadFile(item.id!);
}}
className="m-1 w-full sm:w-auto"
>
@@ -813,7 +761,10 @@ export const FileUpload = (props: FileUploadProps) => {
/>
-
+
) : (
@@ -832,11 +783,10 @@ export const FileUpload = (props: FileUploadProps) => {
/>
-
+
)}
@@ -932,9 +882,9 @@ export const FileUpload = (props: FileUploadProps) => {
setFile(f);
};
- const uploadfile = (response: any) => {
- const url = response.data.signed_url;
- const internal_name = response.data.internal_name;
+ const uploadfile = async (data: CreateFileResponse) => {
+ const url = data.signed_url;
+ const internal_name = data.internal_name;
const f = file;
if (!f) return;
const newFile = new File([f], `${internal_name}`);
@@ -951,6 +901,7 @@ export const FileUpload = (props: FileUploadProps) => {
setUploadPercent(percentCompleted);
},
};
+
return new Promise
((resolve, reject) => {
axios
.put(url, newFile, config)
@@ -959,13 +910,12 @@ export const FileUpload = (props: FileUploadProps) => {
// setUploadSuccess(true);
setFile(null);
setUploadFileName("");
- setReload(!reload);
- fetchData({ aborted: false });
+ fetchData();
Notification.Success({
msg: "File Uploaded Successfully",
});
setUploadFileError("");
- resolve(response);
+ resolve();
})
.catch((e) => {
Notification.Error({
@@ -994,18 +944,18 @@ export const FileUpload = (props: FileUploadProps) => {
}
return true;
};
- const markUploadComplete = async (response: any) => {
- return dispatch(
- editUpload(
- { upload_completed: true },
- response.data.id,
- type,
- getAssociatedId()
- )
- );
+ const markUploadComplete = (data: CreateFileResponse) => {
+ return request(routes.editUpload, {
+ body: { upload_completed: true },
+ pathParams: {
+ id: data.id,
+ fileType: type,
+ associatingId: getAssociatedId(),
+ },
+ });
};
- const handleUpload = async (status: any) => {
+ const handleUpload = async () => {
if (!validateFileUpload()) return;
const f = file;
@@ -1013,24 +963,23 @@ export const FileUpload = (props: FileUploadProps) => {
const filename = uploadFileName === "" && f ? f.name : uploadFileName;
const name = f?.name;
setUploadStarted(true);
- // setUploadSuccess(false);
- const requestData = {
- original_name: name,
- file_type: type,
- name: filename,
- associating_id: getAssociatedId(),
- file_category: category,
- mime_type: f?.type,
- };
- dispatch(createUpload(requestData))
- .then(uploadfile)
- .then(markUploadComplete)
- .catch(() => {
- setUploadStarted(false);
- })
- .then(() => {
- fetchData(status);
- });
+
+ const { data } = await request(routes.createUpload, {
+ body: {
+ original_name: name,
+ file_type: type,
+ name: filename,
+ associating_id: getAssociatedId(),
+ file_category: category,
+ mime_type: f?.type,
+ },
+ });
+
+ if (data) {
+ await uploadfile(data);
+ await markUploadComplete(data);
+ await fetchData();
+ }
};
const createAudioBlob = (createdBlob: Blob) => {
@@ -1071,7 +1020,7 @@ export const FileUpload = (props: FileUploadProps) => {
setAudioUploadStarted(false);
// setUploadSuccess(true);
setAudioName("");
- setReload(!reload);
+ fetchData();
Notification.Success({
msg: "File Uploaded Successfully",
});
@@ -1102,16 +1051,17 @@ export const FileUpload = (props: FileUploadProps) => {
const filename =
audioName.trim().length === 0 ? Date.now().toString() : audioName.trim();
setAudioUploadStarted(true);
- // setUploadSuccess(false);
- const requestData = {
- original_name: name,
- file_type: type,
- name: filename,
- associating_id: getAssociatedId(),
- file_category: category,
- mime_type: audioBlob?.type,
- };
- dispatch(createUpload(requestData))
+
+ request(routes.createUpload, {
+ body: {
+ original_name: name,
+ file_type: type,
+ name: filename,
+ associating_id: getAssociatedId(),
+ file_category: category,
+ mime_type: audioBlob?.type,
+ },
+ })
.then(uploadAudiofile)
.catch(() => {
setAudioUploadStarted(false);
@@ -1318,7 +1268,7 @@ export const FileUpload = (props: FileUploadProps) => {
onSubmit={(event: any) => {
event.preventDefault();
setbtnloader(true);
- partialupdateFileName(modalDetails?.id, editFileName);
+ partialupdateFileName(modalDetails!.id!, editFileName);
}}
className="flex w-full flex-col"
>
@@ -1364,7 +1314,7 @@ export const FileUpload = (props: FileUploadProps) => {
onSubmit={(event: any) => {
event.preventDefault();
setbtnloader(true);
- archiveFile(modalDetails?.id, archiveReason);
+ archiveFile(modalDetails!.id!, archiveReason);
}}
className="mx-2 my-4 flex w-full flex-col"
>
@@ -1433,8 +1383,8 @@ export const FileUpload = (props: FileUploadProps) => {
hideBack={hideBack}
breadcrumbs={false}
crumbsReplacements={{
- [facilityId]: { name: facilityName },
- [patientId]: { name: patientName },
+ [facilityId]: { name: patient?.facility_object?.name },
+ [patientId]: { name: patient?.name },
}}
backUrl={
type === "CONSULTATION"
@@ -1558,8 +1508,12 @@ export const FileUpload = (props: FileUploadProps) => {
handleUpload({ status })}
+ disabled={
+ !file ||
+ !uploadFileName ||
+ (patient && !patient.is_active)
+ }
+ onClick={handleUpload}
className="w-full"
>
@@ -1576,7 +1530,7 @@ export const FileUpload = (props: FileUploadProps) => {
setUploadFileName("");
}}
>
-
+
)}
diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx
index 534a3e876a1..d853a5cf71a 100644
--- a/src/Components/Patient/ManagePatients.tsx
+++ b/src/Components/Patient/ManagePatients.tsx
@@ -511,7 +511,10 @@ export const PatientManager = () => {
) : (
-
+
)}
diff --git a/src/Components/Patient/PatientHome.tsx b/src/Components/Patient/PatientHome.tsx
index 22dc86117f4..1e74b1ac566 100644
--- a/src/Components/Patient/PatientHome.tsx
+++ b/src/Components/Patient/PatientHome.tsx
@@ -284,7 +284,7 @@ export const PatientHome = (props: any) => {
target="_blank"
rel="noreferrer"
>
-
Video Call
+
Video Call
)}
@@ -308,7 +308,7 @@ export const PatientHome = (props: any) => {
-
+
You have not created a consultation for the patient in{" "}
{patientData.facility_object?.name || "-"}
@@ -409,7 +409,10 @@ export const PatientHome = (props: any) => {
-
+
{patientData.facility_object?.name || "-"}
@@ -445,7 +448,7 @@ export const PatientHome = (props: any) => {
className="text-sm font-normal text-sky-600 hover:text-sky-300"
rel="noreferrer"
>
- Chat on WhatsApp
+ Chat on WhatsApp
@@ -470,7 +473,7 @@ export const PatientHome = (props: any) => {
className="text-sm font-normal text-sky-600 hover:text-sky-300"
rel="noreferrer"
>
-
Chat on WhatsApp
+
Chat on WhatsApp
@@ -548,7 +551,7 @@ export const PatientHome = (props: any) => {
: " bg-red-600/5 p-1 text-sm font-normal text-red-600")
}
>
-
+
{(dayjs().isBefore(patientData.review_time)
? "Review before: "
@@ -616,7 +619,7 @@ export const PatientHome = (props: any) => {
name="death_report"
onClick={() => navigate(`/death_report/${id}`)}
>
-
+
Death Report
diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx
index 101d11113d1..fe6c7b64895 100644
--- a/src/Components/Patient/PatientInfoCard.tsx
+++ b/src/Components/Patient/PatientInfoCard.tsx
@@ -185,7 +185,10 @@ export default function PatientInfoCard(props: {
) : (
-
+
)}
@@ -218,10 +221,11 @@ export default function PatientInfoCard(props: {
href={`/facility/${consultation?.facility}`}
className="mt-2 items-center justify-center text-sm font-semibold text-black hover:text-primary-600 lg:hidden"
>
-
+ />
{consultation?.facility_name}
@@ -234,10 +238,11 @@ export default function PatientInfoCard(props: {
href={`/facility/${consultation?.facility}`}
className="hidden font-semibold text-black hover:text-primary-600 lg:block"
>
-
+ />
{consultation?.facility_name}
@@ -301,7 +306,7 @@ export default function PatientInfoCard(props: {
: " bg-red-400 text-white")
}
>
-
+
{dayjs().isBefore(patient.review_time)
? "Review before: "
: "Review Missed: "}
@@ -432,7 +437,10 @@ export default function PatientInfoCard(props: {
{consultation?.treating_physician_object
? `${consultation?.treating_physician_object.first_name} ${consultation?.treating_physician_object.last_name}`
: consultation?.deprecated_verified_by}
-
+
)}
diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx
index 2f18ef36dbb..c6b260efe87 100644
--- a/src/Components/Patient/PatientRegister.tsx
+++ b/src/Components/Patient/PatientRegister.tsx
@@ -1387,7 +1387,10 @@ export const PatientRegister = (props: PatientRegisterProps) => {
/>
{showAutoFilledPincode && (
-
+
State and District auto-filled from Pincode
diff --git a/src/Components/Patient/UpdateStatusDialog.tsx b/src/Components/Patient/UpdateStatusDialog.tsx
index 11f442b7a65..c302aa1b957 100644
--- a/src/Components/Patient/UpdateStatusDialog.tsx
+++ b/src/Components/Patient/UpdateStatusDialog.tsx
@@ -5,10 +5,8 @@ import {
SAMPLE_TEST_RESULT,
SAMPLE_FLOW_RULES,
} from "../../Common/constants";
-import { SampleTestModel } from "./models";
+import { CreateFileResponse, SampleTestModel } from "./models";
import * as Notification from "../../Utils/Notifications.js";
-import { createUpload, editUpload } from "../../Redux/actions";
-import { useDispatch } from "react-redux";
import { header_content_type, LinearProgressWithLabel } from "./FileUpload";
import { Submit } from "../Common/components/ButtonV2";
import CareIcon from "../../CAREUI/icons/CareIcon";
@@ -18,6 +16,8 @@ import { FieldChangeEvent } from "../Form/FormFields/Utils";
import TextFormField from "../Form/FormFields/TextFormField";
import CheckBoxFormField from "../Form/FormFields/CheckBoxFormField";
import { useTranslation } from "react-i18next";
+import request from "../../Utils/request/request";
+import routes from "../../Redux/api";
interface Props {
sample: SampleTestModel;
@@ -62,7 +62,6 @@ const UpdateStatusDialog = (props: Props) => {
const [uploadPercent, setUploadPercent] = useState(0);
const [uploadStarted, setUploadStarted] = useState(false);
const [uploadDone, setUploadDone] = useState(false);
- const redux_dispatch: any = useDispatch();
const currentStatus = SAMPLE_TEST_STATUS.find(
(i) => i.text === sample.status
@@ -97,9 +96,10 @@ const UpdateStatusDialog = (props: Props) => {
dispatch({ type: "set_form", form });
};
- const uploadfile = (response: any) => {
- const url = response.data.signed_url;
- const internal_name = response.data.internal_name;
+ const uploadfile = (data: CreateFileResponse) => {
+ const url = data.signed_url;
+ const internal_name = data.internal_name;
+
const f = file;
if (f === undefined) return;
const newFile = new File([f], `${internal_name}`);
@@ -116,29 +116,27 @@ const UpdateStatusDialog = (props: Props) => {
setUploadPercent(percentCompleted);
},
};
+
axios
.put(url, newFile, config)
.then(() => {
setUploadStarted(false);
setUploadDone(true);
- redux_dispatch(
- editUpload(
- { upload_completed: true },
- response.data.id,
- "SAMPLE_MANAGEMENT",
- sample.id?.toString() ?? ""
- )
- );
- Notification.Success({
- msg: "File Uploaded Successfully",
+ request(routes.editUpload, {
+ pathParams: {
+ id: data.id,
+ fileType: "SAMPLE_MANAGEMENT",
+ associatingId: sample.id?.toString() ?? "",
+ },
+ body: { upload_completed: true },
});
+
+ Notification.Success({ msg: "File Uploaded Successfully" });
})
- .catch(() => {
- setUploadStarted(false);
- });
+ .catch(() => setUploadStarted(false));
};
- const onFileChange = (e: React.ChangeEvent): any => {
+ const onFileChange = (e: React.ChangeEvent) => {
if (e.target.files == null) {
throw new Error("Error finding e.target.files");
}
@@ -155,19 +153,21 @@ const UpdateStatusDialog = (props: Props) => {
const name = f.name;
setUploadStarted(true);
setUploadDone(false);
- const requestData = {
- original_name: name,
- file_type: "SAMPLE_MANAGEMENT",
- name: `${sample.patient_name} Sample Report`,
- associating_id: sample.id,
- file_category: category,
- mime_type: contentType,
- };
- redux_dispatch(createUpload(requestData))
- .then(uploadfile)
- .catch(() => {
- setUploadStarted(false);
- });
+
+ const { data } = await request(routes.createUpload, {
+ body: {
+ original_name: name,
+ file_type: "SAMPLE_MANAGEMENT",
+ name: `${sample.patient_name} Sample Report`,
+ associating_id: sample.id,
+ file_category: category,
+ mime_type: contentType,
+ },
+ });
+
+ if (data) {
+ uploadfile(data);
+ }
};
return (
diff --git a/src/Components/Patient/models.tsx b/src/Components/Patient/models.tsx
index fc87bedcb14..05eb780069d 100644
--- a/src/Components/Patient/models.tsx
+++ b/src/Components/Patient/models.tsx
@@ -147,7 +147,7 @@ export interface SampleTestModel {
is_unusual_course?: boolean;
sample_type?: string;
sample_type_other?: string;
- id?: number;
+ id?: string;
status?: string;
result?: string;
icmr_category?: string;
@@ -337,16 +337,36 @@ export interface FacilityNameModel {
// File Upload Models
+type FileCategory = "UNSPECIFIED" | "XRAY" | "AUDIO" | "IDENTITY_PROOF";
+
+export interface CreateFileRequest {
+ file_type: string;
+ file_category: FileCategory;
+ name: string;
+ associating_id: string;
+ original_name: string;
+ mime_type: string;
+}
+
+export interface CreateFileResponse {
+ id: string;
+ file_type: string;
+ file_category: FileCategory;
+ signed_url: string;
+ internal_name: string;
+}
+
export interface FileUploadModel {
id?: string;
name?: string;
created_date?: string;
upload_completed?: boolean;
- uploaded_by?: { username?: string };
- file_category?: string;
+ uploaded_by?: PerformedByModel;
+ file_category?: FileCategory;
+ read_signed_url?: string;
is_archived?: boolean;
archive_reason?: string;
extension?: string;
- archived_by?: { username?: string };
+ archived_by?: PerformedByModel;
archived_datetime?: string;
}
diff --git a/src/Components/Resource/ListView.tsx b/src/Components/Resource/ListView.tsx
index 05b2ce2f4bb..2cf8b9eb26d 100644
--- a/src/Components/Resource/ListView.tsx
+++ b/src/Components/Resource/ListView.tsx
@@ -77,7 +77,7 @@ export default function ListView() {
title="Resource status"
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{resource.status}
@@ -88,7 +88,7 @@ export default function ListView() {
title=" Origin facility"
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{(resource.origin_facility_object || {}).name}
@@ -99,7 +99,7 @@ export default function ListView() {
title="Resource approving facility"
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{(resource.approving_facility_object || {}).name}
@@ -110,7 +110,7 @@ export default function ListView() {
title=" Assigned facility"
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{(resource.assigned_facility_object || {}).name ||
@@ -131,7 +131,7 @@ export default function ListView() {
: "rounded bg-red-400 p-1 text-white")
}
>
-
+
{formatDateTime(resource.modified_date) || "--"}
@@ -146,7 +146,7 @@ export default function ListView() {
onClick={(_) => navigate(`/resource/${resource.id}`)}
className="btn btn-default mr-2 w-full bg-white"
>
- All Details
+ All Details
@@ -204,7 +204,11 @@ export default function ListView() {
className="text-xs hover:text-blue-800"
onClick={() => refetch()}
>
-
+
{t("refresh_list")}
diff --git a/src/Components/Resource/ResourceBoard.tsx b/src/Components/Resource/ResourceBoard.tsx
index 0f16391b9ab..0cedb5a46c7 100644
--- a/src/Components/Resource/ResourceBoard.tsx
+++ b/src/Components/Resource/ResourceBoard.tsx
@@ -11,6 +11,7 @@ import routes from "../../Redux/api";
import { PaginatedResponse } from "../../Utils/request/types";
import { IResource } from "./models";
import request from "../../Utils/request/request";
+import CareIcon from "../../CAREUI/icons/CareIcon";
interface boardProps {
board: string;
@@ -67,7 +68,7 @@ const ResourceCard = ({ resource }: any) => {
title=" Origin facility"
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{(resource.origin_facility_object || {}).name}
@@ -78,7 +79,7 @@ const ResourceCard = ({ resource }: any) => {
title="Resource approving facility"
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{(resource.approving_facility_object || {}).name}
@@ -90,7 +91,7 @@ const ResourceCard = ({ resource }: any) => {
title=" Assigned facility"
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{(resource.assigned_facility_object || {}).name ||
@@ -111,7 +112,7 @@ const ResourceCard = ({ resource }: any) => {
: "rounded bg-red-400 p-1 text-white")
}
>
-
+
{formatDateTime(resource.modified_date) || "--"}
@@ -123,7 +124,7 @@ const ResourceCard = ({ resource }: any) => {
title="Assigned to"
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{resource.assigned_to_object.first_name}{" "}
{resource.assigned_to_object.last_name} -{" "}
@@ -140,7 +141,7 @@ const ResourceCard = ({ resource }: any) => {
onClick={(_) => navigate(`/resource/${resource.id}`)}
className="btn btn-default mr-2 w-full bg-white"
>
- All Details
+ All Details
diff --git a/src/Components/Resource/ResourceDetails.tsx b/src/Components/Resource/ResourceDetails.tsx
index c42cd79b8e5..952554c61ef 100644
--- a/src/Components/Resource/ResourceDetails.tsx
+++ b/src/Components/Resource/ResourceDetails.tsx
@@ -9,6 +9,7 @@ import ConfirmDialog from "../Common/ConfirmDialog";
import useQuery from "../../Utils/request/useQuery";
import routes from "../../Redux/api";
import request from "../../Utils/request/request";
+import CareIcon from "../../CAREUI/icons/CareIcon";
const Loading = lazy(() => import("../Common/Loading"));
export default function ResourceDetails(props: { id: string }) {
@@ -217,10 +218,11 @@ export default function ResourceDetails(props: { id: string }) {
window.print()}>
- Print Approval Letter
+ Print
+ Approval Letter
setIsPrintMode(false)} variant="secondary">
- Close
+ Close
{ApprovalLetter(data)}
@@ -229,7 +231,8 @@ export default function ResourceDetails(props: { id: string }) {
setIsPrintMode(true)}>
- Approval Letter
+ Approval
+ Letter
{data.assigned_to_object && (
diff --git a/src/Components/Shifting/ListView.tsx b/src/Components/Shifting/ListView.tsx
index 45a484af933..228732f9ced 100644
--- a/src/Components/Shifting/ListView.tsx
+++ b/src/Components/Shifting/ListView.tsx
@@ -110,7 +110,7 @@ export default function ListView() {
title={t("shifting_status")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{shift.status}
@@ -121,7 +121,7 @@ export default function ListView() {
title={t("phone_number")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{shift.patient_object.phone_number || ""}
@@ -132,7 +132,7 @@ export default function ListView() {
title={t("origin_facility")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{(shift.origin_facility_object || {}).name}
@@ -144,7 +144,7 @@ export default function ListView() {
title={t("shifting_approving_facility")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{(shift.shifting_approving_facility_object || {}).name}
@@ -156,7 +156,7 @@ export default function ListView() {
title={t("assigned_facility")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{shift.assigned_facility_external ||
@@ -178,7 +178,7 @@ export default function ListView() {
: "rounded bg-red-400 p-1 text-white")
}
>
-
+
{formatDateTime(shift.modified_date) || "--"}
@@ -190,7 +190,7 @@ export default function ListView() {
title={t("patient_address")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{shift.patient_object.address || "--"}
@@ -206,7 +206,7 @@ export default function ListView() {
border
className="w-full"
>
- {t("all_details")}
+ {t("all_details")}
{shift.status === "COMPLETED" && shift.assigned_facility && (
@@ -298,7 +298,11 @@ export default function ListView() {
className="text-xs hover:text-blue-800"
onClick={() => fetchData()}
>
-
+
{t("refresh_list")}
diff --git a/src/Components/Shifting/ShiftDetails.tsx b/src/Components/Shifting/ShiftDetails.tsx
index 493c56e71c0..acc3565487a 100644
--- a/src/Components/Shifting/ShiftDetails.tsx
+++ b/src/Components/Shifting/ShiftDetails.tsx
@@ -23,6 +23,7 @@ import useQuery from "../../Utils/request/useQuery.js";
import routes from "../../Redux/api.js";
import request from "../../Utils/request/request.js";
import { ConsultationModel } from "../Facility/models.js";
+import CareIcon from "../../CAREUI/icons/CareIcon.js";
const Loading = lazy(() => import("../Common/Loading"));
@@ -73,7 +74,7 @@ export default function ShiftDetails(props: { id: string }) {
{t("copied_to_clipboard")}
) : (
-
+
)}
@@ -519,13 +520,15 @@ export default function ShiftDetails(props: { id: string }) {
window.print()}>
- {t("print_referral_letter")}
+ {" "}
+ {t("print_referral_letter")}
setIsPrintMode(false)}
variant="secondary"
>
- {t("close")}
+ {" "}
+ {t("close")}
{printData(data)}
@@ -554,7 +557,8 @@ export default function ShiftDetails(props: { id: string }) {
setIsPrintMode(true)}>
- {t("referral_letter")}
+ {" "}
+ {t("referral_letter")}
}
diff --git a/src/Components/Shifting/ShiftingBoard.tsx b/src/Components/Shifting/ShiftingBoard.tsx
index 70b3374935a..ae94514e6e9 100644
--- a/src/Components/Shifting/ShiftingBoard.tsx
+++ b/src/Components/Shifting/ShiftingBoard.tsx
@@ -24,6 +24,7 @@ import routes from "../../Redux/api";
import useQuery from "../../Utils/request/useQuery";
import { PaginatedResponse } from "../../Utils/request/types";
import { IShift } from "./models";
+import CareIcon from "../../CAREUI/icons/CareIcon";
interface boardProps {
board: string;
@@ -107,7 +108,7 @@ const ShiftCard = ({ shift, filter }: any) => {
title={t("phone_number")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{shift.patient_object.phone_number || ""}
@@ -118,7 +119,7 @@ const ShiftCard = ({ shift, filter }: any) => {
title={t("origin_facility")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{(shift.origin_facility_object || {}).name}
@@ -130,7 +131,7 @@ const ShiftCard = ({ shift, filter }: any) => {
title={t("shifting_approving_facility")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{(shift.shifting_approving_facility_object || {}).name}
@@ -142,7 +143,7 @@ const ShiftCard = ({ shift, filter }: any) => {
title={t("assigned_facility")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{shift.assigned_facility_external ||
@@ -162,7 +163,7 @@ const ShiftCard = ({ shift, filter }: any) => {
: "rounded bg-red-400 p-1 text-white")
}
>
-
+
{formatDateTime(shift.modified_date) || "--"}
@@ -174,7 +175,7 @@ const ShiftCard = ({ shift, filter }: any) => {
title={t("patient_address")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{shift.patient_object.address || "--"}
@@ -187,7 +188,7 @@ const ShiftCard = ({ shift, filter }: any) => {
title={t("assigned_to")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{shift.assigned_to_object.first_name}{" "}
{shift.assigned_to_object.last_name} -{" "}
@@ -202,7 +203,7 @@ const ShiftCard = ({ shift, filter }: any) => {
title={t("patient_state")}
className="flex items-center text-sm font-medium leading-5 text-gray-500"
>
-
+
{shift.patient_object.state_object.name || "--"}
@@ -216,7 +217,8 @@ const ShiftCard = ({ shift, filter }: any) => {
onClick={(_) => navigate(`/shifting/${shift.external_id}`)}
className="btn btn-default mr-2 w-full bg-white"
>
- {t("all_details")}
+ {" "}
+ {t("all_details")}
{filter === "COMPLETED" && shift.assigned_facility && (
diff --git a/src/Components/Users/ManageUsers.tsx b/src/Components/Users/ManageUsers.tsx
index 15f4ba4ed81..1a39b57ec53 100644
--- a/src/Components/Users/ManageUsers.tsx
+++ b/src/Components/Users/ManageUsers.tsx
@@ -198,12 +198,14 @@ export default function ManageUsers() {
{user.last_login && cur_online ? (
{" "}
- Currently Online
+ {" "}
+ Currently Online
) : (
<>
- Last Online:{" "}
+ Last
+ Online:{" "}
{`${user.first_name} ${user.last_name}`}
{user.last_login && cur_online ? (
-
+ />
) : null}
{showUserDelete(authUser, user) && (
import("../Common/Loading"));
@@ -150,9 +151,9 @@ export const validateRule = (
return (
{condition ? (
-
+
) : (
-
+
)}{" "}
{
className="inline-block rounded border border-gray-600 bg-gray-50 px-4 py-2 text-gray-600 transition hover:bg-gray-100"
target="_blank"
>
- Need Help?
+ Need Help?
}
backUrl="/users"
@@ -727,20 +728,30 @@ export const UserAdd = (props: UserProps) => {
<>
{usernameExists === userExistsEnums.checking ? (
- checking...
+ {" "}
+ checking...
) : (
<>
{usernameExists === userExistsEnums.exists ? (
- {" "}
+ {" "}
Username is not available
) : (
- {" "}
+ {" "}
Username is available
diff --git a/src/Components/Users/UserProfile.tsx b/src/Components/Users/UserProfile.tsx
index 767fc9b73b8..34452a367de 100644
--- a/src/Components/Users/UserProfile.tsx
+++ b/src/Components/Users/UserProfile.tsx
@@ -531,7 +531,7 @@ export default function UserProfile() {
Access Level
- {" "}
+ {" "}
{userData?.user_type || "-"}
diff --git a/src/Redux/actions.tsx b/src/Redux/actions.tsx
index cfe298bda82..c11a5f9de59 100644
--- a/src/Redux/actions.tsx
+++ b/src/Redux/actions.tsx
@@ -175,33 +175,6 @@ export const externalResult = (pathParam: object) => {
return fireRequest("externalResult", [], {}, pathParam);
};
-// FileUpload
-
-export const createUpload = (params: object) => {
- return fireRequest("createUpload", [], params);
-};
-
-export const viewUpload = (params: object) => {
- return fireRequest("viewUpload", [], params);
-};
-
-export const retrieveUpload = (params: object, fileId: string) => {
- return fireRequest("retrieveUpload", [], params, { fileId: fileId });
-};
-
-export const editUpload = (
- params: object,
- fileId: string,
- fileType: string,
- associatingId: string
-) => {
- return fireRequest("editUpload", [], params, {
- fileId,
- fileType,
- associatingId,
- });
-};
-
// Investigation
export const listInvestigations = (
diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx
index eb75f23c77c..35a878adabc 100644
--- a/src/Redux/api.tsx
+++ b/src/Redux/api.tsx
@@ -75,7 +75,10 @@ import {
} from "../Components/Users/models";
import { Prescription } from "../Components/Medicine/models";
import {
+ CreateFileRequest,
+ CreateFileResponse,
DailyRoundsModel,
+ FileUploadModel,
PatientModel,
SampleReportModel,
SampleTestModel,
@@ -378,6 +381,11 @@ const routes = {
path: "/api/v1/facility/{facility_external_id}/asset_location/{external_id}/",
method: "PATCH",
},
+ deleteFacilityAssetLocation: {
+ path: "/api/v1/facility/{facility_external_id}/asset_location/{external_id}/",
+ method: "DELETE",
+ TRes: Type>(),
+ },
getFacilityAssetLocationAvailability: {
path: "/api/v1/facility/{facility_external_id}/asset_location/{external_id}/availability/",
method: "GET",
@@ -1015,18 +1023,24 @@ const routes = {
createUpload: {
path: "/api/v1/files/",
method: "POST",
+ TBody: Type(),
+ TRes: Type(),
},
viewUpload: {
path: "/api/v1/files/",
method: "GET",
+ TRes: Type>(),
},
retrieveUpload: {
- path: "/api/v1/files/{fileId}/",
+ path: "/api/v1/files/{id}/",
method: "GET",
+ TRes: Type(),
},
editUpload: {
- path: "/api/v1/files/{fileId}/?file_type={fileType}&associating_id={associatingId}",
+ path: "/api/v1/files/{id}/?file_type={fileType}&associating_id={associatingId}",
method: "PATCH",
+ TBody: Type>(),
+ TRes: Type(),
},
// Investigation
diff --git a/src/Routers/SessionRouter.tsx b/src/Routers/SessionRouter.tsx
index 8a4f2c2dd68..4e546d51b6c 100644
--- a/src/Routers/SessionRouter.tsx
+++ b/src/Routers/SessionRouter.tsx
@@ -2,7 +2,6 @@ import { Login, ResetPassword } from "../Components/Auth";
import { useRoutes } from "raviger";
import SessionExpired from "../Components/ErrorPages/SessionExpired";
import InvalidReset from "../Components/ErrorPages/InvalidReset";
-import TopBar from "../Components/Common/TopBar";
const routes = {
"/": () => ,
@@ -14,21 +13,5 @@ const routes = {
};
export default function SessionRouter() {
- const content = useRoutes(routes) || ;
- const path =
- content &&
- content.props &&
- content.props.children &&
- content.props.children.props &&
- content.props.children.props.value;
- const login =
- !path || path === "/" || path === "/login" || path === "/login/";
- return (
-
- {!login &&
}
-
- {content}
-
-
- );
+ return useRoutes(routes) || ;
}
diff --git a/src/service-worker.ts b/src/service-worker.ts
index 76501ea21f1..da153ac41db 100644
--- a/src/service-worker.ts
+++ b/src/service-worker.ts
@@ -8,13 +8,9 @@
// You can also remove this file if you'd prefer not to use a
// service worker, and the Workbox build step will be skipped.
-import { ExpirationPlugin } from "workbox-expiration";
-import { StaleWhileRevalidate } from "workbox-strategies";
import { clientsClaim } from "workbox-core";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { precacheAndRoute } from "workbox-precaching";
-// import { createHandlerBoundToURL } from "workbox-precaching";
-import { registerRoute } from "workbox-routing";
declare const self: ServiceWorkerGlobalScope;
@@ -25,73 +21,6 @@ const _ignored = self.__WB_MANIFEST.map((_) => {
clientsClaim();
-// const toPrecache = self.__WB_MANIFEST.filter((file) => {
-// // Check if file is a string
-// if (typeof file === "string") {
-// return !file.includes("index.html");
-// } else {
-// return !file.url.includes("index.html");
-// }
-// });
-
-// Precache all of the assets generated by your build process.
-// Their URLs are injected into the manifest variable below.
-// This variable must be present somewhere in your service worker file,
-// even if you decide not to use precaching. See https://cra.link/PWA
-// precacheAndRoute(self.__WB_MANIFEST);
-// precacheAndRoute(toPrecache);
-
-// Set up App Shell-style routing, so that all navigation requests
-// are fulfilled with your index.html shell. Learn more at
-// https://developers.google.com/web/fundamentals/architecture/app-shell
-// const fileExtensionRegexp = new RegExp("/[^/?]+\\.[^/]+$");
-// registerRoute(
-// // Return false to exempt requests from being fulfilled by index.html.
-// ({ request, url }: { request: Request; url: URL }) => {
-// // If this isn't a navigation, skip.
-// if (request.mode !== "navigate") {
-// return false;
-// }
-
-// // If this is a URL that starts with /_, skip.
-// if (url.pathname.startsWith("/_")) {
-// return false;
-// }
-
-// // If this looks like a URL for a resource, because it contains
-// // a file extension, skip.
-// if (url.pathname.match(fileExtensionRegexp)) {
-// return false;
-// }
-
-// // Return true to signal that we want to use the handler.
-// return true;
-// },
-// createHandlerBoundToURL(import.meta.env.REACT_PUBLIC_URL + "/index.html")
-// );
-
-// registerRoute(
-// ({ url }) => url.pathname.includes("index.html"),
-// new NetworkFirst()
-// );
-
-// An example runtime caching route for requests that aren't handled by the
-// precache, in this case same-origin .png requests like those from in public/
-registerRoute(
- // Add in any other file extensions or routing criteria as needed.
- ({ url }) =>
- url.origin === self.location.origin && url.pathname.endsWith(".png"),
- // Customize this strategy as needed, e.g., by changing to CacheFirst.
- new StaleWhileRevalidate({
- cacheName: "images",
- plugins: [
- // Ensure that once this runtime cache reaches a maximum size the
- // least-recently used images are removed.
- new ExpirationPlugin({ maxEntries: 50 }),
- ],
- })
-);
-
// This allows the web app to trigger skipWaiting via
// registration.waiting.postMessage({type: 'SKIP_WAITING'})
self.addEventListener("message", (event) => {
diff --git a/src/style/index.css b/src/style/index.css
index 95f11ac8732..6bc1f8d9b76 100644
--- a/src/style/index.css
+++ b/src/style/index.css
@@ -7,10 +7,6 @@
@import "@fontsource/inter/700.css";
@import "@fontsource/inter/800.css";
@import "@fontsource/inter/900.css";
-@import "@fortawesome/fontawesome-free/css/all.min.css";
-@import "@fortawesome/fontawesome-free/css/v4-shims.min.css";
-@import "@fortawesome/fontawesome-free/css/v4-font-face.min.css";
-@import "@fortawesome/fontawesome-free/css/v5-font-face.min.css";
@import "@pnotify/core/dist/PNotify.css";
@import "@pnotify/mobile/dist/PNotifyMobile.css";
diff --git a/tsconfig.json b/tsconfig.json
index 12ba5a5dc56..ab2b142d3a4 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -15,7 +15,7 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
- "types": ["google.maps", "vite/client", "vite-plugin-pwa/client"]
+ "types": ["vite/client", "vite-plugin-pwa/client"]
},
"include": ["src"]
}
diff --git a/vite.config.ts b/vite.config.mts
similarity index 67%
rename from vite.config.ts
rename to vite.config.mts
index 65cbfa296d7..c8eb11c53cf 100644
--- a/vite.config.ts
+++ b/vite.config.mts
@@ -1,6 +1,5 @@
import { VitePWA } from "vite-plugin-pwa";
import { defineConfig } from "vite";
-import { promises as fs } from "fs";
import react from "@vitejs/plugin-react-swc";
const cdnUrls =
@@ -19,7 +18,7 @@ export default defineConfig({
strategies: "injectManifest",
srcDir: "src",
filename: "service-worker.ts",
- // injectRegister: null,
+ injectRegister: "script-defer",
devOptions: {
enabled: true,
type: "module",
@@ -63,6 +62,7 @@ export default defineConfig({
build: {
outDir: "build",
assetsDir: "bundle",
+ sourcemap: true,
rollupOptions: {
output: {
manualChunks(id) {
@@ -72,22 +72,6 @@ export default defineConfig({
},
},
},
- commonjsOptions: {
- // workaround for react-phone-input-2 https://github.com/vitejs/vite/issues/2139#issuecomment-1405624744
- defaultIsModuleExports(id) {
- try {
- // eslint-disable-next-line @typescript-eslint/no-var-requires
- const module = require(id);
- if (module?.default) {
- return false;
- }
- return "auto";
- } catch (error) {
- return "auto";
- }
- },
- transformMixedEsModules: true,
- },
},
server: {
port: 4000,
@@ -115,30 +99,4 @@ export default defineConfig({
},
},
},
- esbuild: {
- loader: "tsx",
- include: [/src\/.*\.[tj]sx?$/],
- exclude: [/src\/stories/],
- },
-
- define: {
- // for unconventional usage of global by third party libraries
- global: "window",
- },
- optimizeDeps: {
- esbuildOptions: {
- plugins: [
- // again thanks to thirdparty libraries for using jsx in js files
- {
- name: "load-js-files-as-jsx",
- setup(build) {
- build.onLoad({ filter: /src\/.*\.js$/ }, async (args) => ({
- loader: "jsx",
- contents: await fs.readFile(args.path, "utf8"),
- }));
- },
- },
- ],
- },
- },
});