- {kasp_enabled && (
+ {careConfig.kasp.enabled && (
- {kasp_string}
+
+ {careConfig.kasp.string}
+
- o ? `Show ${kasp_string}` : `Show Non ${kasp_string}`
+ o
+ ? `Show ${careConfig.kasp.string}`
+ : `Show Non ${careConfig.kasp.string}`
}
value={filterState.is_kasp}
onChange={(v) => setFilterState({ ...filterState, is_kasp: v })}
diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx
index 005c93521d6..f301db6333e 100644
--- a/src/Components/Patient/PatientInfoCard.tsx
+++ b/src/Components/Patient/PatientInfoCard.tsx
@@ -12,7 +12,6 @@ import { Switch, MenuItem, Field, Label } from "@headlessui/react";
import { Link, navigate } from "raviger";
import { useState } from "react";
import CareIcon from "../../CAREUI/icons/CareIcon.js";
-import useConfig from "../../Common/hooks/useConfig.js";
import dayjs from "../../Utils/dayjs.js";
import {
classNames,
@@ -43,6 +42,7 @@ import useQuery from "../../Utils/request/useQuery.js";
import FetchRecordsModal from "../ABDM/FetchRecordsModal.js";
import { SkillModel } from "../Users/models.js";
import { AuthorizedForConsultationRelatedActions } from "../../CAREUI/misc/AuthorizedChild.js";
+import careConfig from "@careConfig";
const formatSkills = (arr: SkillModel[]) => {
const skills = arr.map((skill) => skill.skill_object.name);
@@ -73,8 +73,6 @@ export default function PatientInfoCard(props: {
const [openDischargeSummaryDialog, setOpenDischargeSummaryDialog] =
useState(false);
const [openDischargeDialog, setOpenDischargeDialog] = useState(false);
-
- const { enable_hcx, enable_abdm } = useConfig();
const [showLinkCareContext, setShowLinkCareContext] = useState(false);
const patient = props.patient;
@@ -665,7 +663,7 @@ export default function PatientInfoCard(props: {
],
]
.concat(
- enable_hcx
+ careConfig.hcx.enabled
? [
[
`/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/claims`,
@@ -735,7 +733,7 @@ export default function PatientInfoCard(props: {
- {enable_abdm &&
+ {careConfig.abdm.enabled &&
(patient.abha_number ? (
<>
- {enable_abdm && (
+ {careConfig.abdm.enabled && (
ABHA Details
diff --git a/src/Components/Patient/ShiftCreate.tsx b/src/Components/Patient/ShiftCreate.tsx
index 7307727d372..c3b01ad189d 100644
--- a/src/Components/Patient/ShiftCreate.tsx
+++ b/src/Components/Patient/ShiftCreate.tsx
@@ -20,7 +20,6 @@ import { navigate } from "raviger";
import { parsePhoneNumber } from "../../Utils/utils.js";
import { phonePreg } from "../../Common/validation";
import useAppHistory from "../../Common/hooks/useAppHistory";
-import useConfig from "../../Common/hooks/useConfig";
import { useTranslation } from "react-i18next";
import Page from "../Common/components/Page.js";
import Card from "../../CAREUI/display/Card.js";
@@ -30,6 +29,7 @@ import { PhoneNumberValidator } from "../Form/FieldValidators.js";
import useQuery from "../../Utils/request/useQuery.js";
import routes from "../../Redux/api.js";
import request from "../../Utils/request/request.js";
+import careConfig from "@careConfig";
const Loading = lazy(() => import("../Common/Loading"));
@@ -44,7 +44,6 @@ export const ShiftCreate = (props: patientShiftProps) => {
const [isLoading, setIsLoading] = useState(false);
const [patientCategory, setPatientCategory] = useState();
const { t } = useTranslation();
- const { wartime_shifting } = useConfig();
const initForm: any = {
shifting_approving_facility: null,
@@ -79,7 +78,7 @@ export const ShiftCreate = (props: patientShiftProps) => {
},
};
- if (wartime_shifting) {
+ if (careConfig.wartimeShifting) {
requiredFields = {
...requiredFields,
shifting_approving_facility: {
@@ -200,7 +199,7 @@ export const ShiftCreate = (props: patientShiftProps) => {
setIsLoading(true);
const data = {
- status: wartime_shifting ? "PENDING" : "APPROVED",
+ status: careConfig.wartimeShifting ? "PENDING" : "APPROVED",
origin_facility: props.facilityId,
shifting_approving_facility: state.form.shifting_approving_facility?.id,
assigned_facility: state.form?.assigned_facility?.id,
@@ -282,7 +281,7 @@ export const ShiftCreate = (props: patientShiftProps) => {
types={["mobile", "landline"]}
/>
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
Name of shifting approving facility
@@ -336,7 +335,7 @@ export const ShiftCreate = (props: patientShiftProps) => {
label="Patient Category"
/>
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
<>
= ({ form, onFormUpdate }) => {
- const { enable_scribe } = useConfig();
const [open, setOpen] = useState(false);
const [_progress, setProgress] = useState(0);
const [stage, setStage] = useState("start");
@@ -120,21 +119,20 @@ export const Scribe: React.FC = ({ form, onFormUpdate }) => {
return;
}
const newFile = new File([f], `${internal_name}`, { type: f.type });
- const config = {
- headers: {
- "Content-type": newFile?.type?.split(";")?.[0],
- "Content-disposition": "inline",
- },
+ const headers = {
+ "Content-type": newFile?.type?.split(";")?.[0],
+ "Content-disposition": "inline",
};
- axios
- .put(url, newFile, config)
- .then(() => {
- resolve();
- })
- .catch((error) => {
- reject(error);
- });
+ uploadFile(
+ url,
+ newFile,
+ "PUT",
+ headers,
+ (xhr: XMLHttpRequest) => (xhr.status === 200 ? resolve() : reject()),
+ null,
+ reject,
+ );
});
};
@@ -546,7 +544,7 @@ export const Scribe: React.FC = ({ form, onFormUpdate }) => {
}
}
- if (!enable_scribe) return null;
+ if (!careConfig.scribe.enabled) return null;
return (
diff --git a/src/Components/Scribe/formDetails.ts b/src/Components/Scribe/formDetails.ts
index 736ab971744..6300ac7e3c2 100644
--- a/src/Components/Scribe/formDetails.ts
+++ b/src/Components/Scribe/formDetails.ts
@@ -270,7 +270,7 @@ const DAILY_ROUND_FORM_SCRIBE_DATA: Field[] = [
});
return true;
},
- },
+ } /*
{
friendlyName: "Prescriptions",
id: "prescriptions",
@@ -330,7 +330,7 @@ const DAILY_ROUND_FORM_SCRIBE_DATA: Field[] = [
return true;
},
},
- /*{
+ {
friendlyName: "Round Type",
id: "rounds_type",
type: "string",
@@ -355,7 +355,7 @@ const DAILY_ROUND_FORM_SCRIBE_DATA: Field[] = [
"A string to store the date and time at which the round was taken or measured. 'The round was taken yesterday/today' would amount to yesterday/today's date.",
validator: (value) => typeof value === "string",
},
-*/
+*/,
];
export const SCRIBE_FORMS: { [key: string]: ScribeForm } = {
diff --git a/src/Components/Shifting/BoardView.tsx b/src/Components/Shifting/BoardView.tsx
index a974e0da79f..f4fb45093aa 100644
--- a/src/Components/Shifting/BoardView.tsx
+++ b/src/Components/Shifting/BoardView.tsx
@@ -12,7 +12,6 @@ import { downloadShiftRequests } from "../../Redux/actions";
import { formatFilter } from "./Commons";
import { navigate } from "raviger";
-import useConfig from "../../Common/hooks/useConfig";
import useFilters from "../../Common/hooks/useFilters";
import { lazy, useLayoutEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
@@ -21,6 +20,7 @@ import ButtonV2 from "../Common/components/ButtonV2";
import { AdvancedFilterButton } from "../../CAREUI/interactive/FiltersSlideover";
import CareIcon from "../../CAREUI/icons/CareIcon";
import Tabs from "../Common/components/Tabs";
+import careConfig from "@careConfig";
const Loading = lazy(() => import("../Common/Loading"));
const PageTitle = lazy(() => import("../Common/PageTitle"));
@@ -31,13 +31,12 @@ export default function BoardView() {
limit: -1,
cacheBlacklist: ["patient_name"],
});
- const { wartime_shifting } = useConfig();
- const shiftStatusOptions = wartime_shifting
+ const shiftStatusOptions = careConfig.wartimeShifting
? SHIFTING_CHOICES_WARTIME
: SHIFTING_CHOICES_PEACETIME;
- const COMPLETED = wartime_shifting
+ const COMPLETED = careConfig.wartimeShifting
? [
"COMPLETED",
"REJECTED",
diff --git a/src/Components/Shifting/ListFilter.tsx b/src/Components/Shifting/ListFilter.tsx
index 12bb17db09c..17692ac8f35 100644
--- a/src/Components/Shifting/ListFilter.tsx
+++ b/src/Components/Shifting/ListFilter.tsx
@@ -17,7 +17,6 @@ import DateRangeFormField from "../Form/FormFields/DateRangeFormField";
import FiltersSlideover from "../../CAREUI/interactive/FiltersSlideover";
import { SelectFormField } from "../Form/FormFields/SelectFormField";
import PhoneNumberFormField from "../Form/FormFields/PhoneNumberFormField";
-import useConfig from "../../Common/hooks/useConfig";
import useMergeState from "../../Common/hooks/useMergeState";
import { useTranslation } from "react-i18next";
@@ -26,18 +25,20 @@ import { dateQueryString, parsePhoneNumber } from "../../Utils/utils";
import dayjs from "dayjs";
import useQuery from "../../Utils/request/useQuery";
import routes from "../../Redux/api";
+import careConfig from "@careConfig";
const getDate = (value: any) =>
value && dayjs(value).isValid() && dayjs(value).toDate();
export default function ListFilter(props: any) {
- const { kasp_enabled, kasp_string, wartime_shifting } = useConfig();
const { filter, onChange, closeFilter, removeFilters } = props;
const { t } = useTranslation();
const shiftStatusOptions = (
- wartime_shifting ? SHIFTING_CHOICES_WARTIME : SHIFTING_CHOICES_PEACETIME
+ careConfig.wartimeShifting
+ ? SHIFTING_CHOICES_WARTIME
+ : SHIFTING_CHOICES_PEACETIME
).map((option) => option.text);
const [filterState, setFilterState] = useMergeState({
@@ -227,7 +228,7 @@ export default function ListFilter(props: any) {
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
{t("shifting_approving_facility")}
@@ -308,12 +309,12 @@ export default function ListFilter(props: any) {
errorClassName="hidden"
/>
- {kasp_enabled && (
+ {careConfig.kasp.enabled && (
option}
diff --git a/src/Components/Shifting/ListView.tsx b/src/Components/Shifting/ListView.tsx
index cfffcef7377..b05795f934d 100644
--- a/src/Components/Shifting/ListView.tsx
+++ b/src/Components/Shifting/ListView.tsx
@@ -11,11 +11,7 @@ import SearchInput from "../Form/SearchInput";
import { formatDateTime, formatPatientAge } from "../../Utils/utils";
import { formatFilter } from "./Commons";
import { navigate } from "raviger";
-
-import useConfig from "../../Common/hooks/useConfig";
-
import useFilters from "../../Common/hooks/useFilters";
-
import { useTranslation } from "react-i18next";
import { AdvancedFilterButton } from "../../CAREUI/interactive/FiltersSlideover";
import CareIcon from "../../CAREUI/icons/CareIcon";
@@ -24,11 +20,11 @@ import useAuthUser from "../../Common/hooks/useAuthUser";
import request from "../../Utils/request/request";
import routes from "../../Redux/api";
import useQuery from "../../Utils/request/useQuery";
+import careConfig from "@careConfig";
const Loading = lazy(() => import("../Common/Loading"));
export default function ListView() {
- const { wartime_shifting } = useConfig();
const {
qParams,
updateQuery,
@@ -127,7 +123,7 @@ export default function ListView() {
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
import("../Common/Loading"));
export default function ShiftDetails(props: { id: string }) {
- const { header_logo, kasp_full_string, wartime_shifting, kasp_enabled } =
- useConfig();
-
const [isPrintMode, setIsPrintMode] = useState(false);
const [isCopied, setIsCopied] = useState(false);
const [openDeleteShiftDialog, setOpenDeleteShiftDialog] = useState(false);
const { t } = useTranslation();
- const shiftStatusOptions = wartime_shifting
+ const shiftStatusOptions = careConfig.wartimeShifting
? SHIFTING_CHOICES_WARTIME
: SHIFTING_CHOICES_PEACETIME;
@@ -113,7 +110,7 @@ export default function ShiftDetails(props: { id: string }) {
t("reason") +
":" +
data?.reason;
- if (wartime_shifting) {
+ if (careConfig.wartimeShifting) {
formattedText +=
t("facility_preference") + ": " + data?.assigned_facility_type + "\n";
}
@@ -304,7 +301,9 @@ export default function ShiftDetails(props: { id: string }) {
return (
-
{data.is_kasp &&
}
+
+ {data.is_kasp &&
}
+
@@ -571,7 +570,7 @@ export default function ShiftDetails(props: { id: string }) {
{data?.origin_facility_object?.name || "--"}
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
{t("shifting_approving_facility")}:{" "}
@@ -635,10 +634,10 @@ export default function ShiftDetails(props: { id: string }) {
data?.patient_object.last_consultation?.category}
- {kasp_enabled && (
+ {careConfig.kasp.enabled && (
- {kasp_full_string}:{" "}
+ {careConfig.kasp.fullString}:{" "}
{" "}
@@ -646,11 +645,11 @@ export default function ShiftDetails(props: { id: string }) {
)}
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
<>
- {kasp_full_string}:{" "}
+ {careConfig.kasp.fullString}:{" "}
{" "}
@@ -813,7 +812,7 @@ export default function ShiftDetails(props: { id: string }) {
{showFacilityCard(data?.assigned_facility_object)}
)}
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
{t("details_of_shifting_approving_facility")}
diff --git a/src/Components/Shifting/ShiftDetailsUpdate.tsx b/src/Components/Shifting/ShiftDetailsUpdate.tsx
index 37adecaedcd..8e6fb582906 100644
--- a/src/Components/Shifting/ShiftDetailsUpdate.tsx
+++ b/src/Components/Shifting/ShiftDetailsUpdate.tsx
@@ -11,7 +11,6 @@ import {
USER_TYPES,
} from "../../Common/constants";
import { Cancel, Submit } from "../Common/components/ButtonV2";
-
import { navigate, useQueryParams } from "raviger";
import { lazy, useReducer, useState } from "react";
import { ConsultationModel } from "../Facility/models.js";
@@ -26,8 +25,6 @@ import TextAreaFormField from "../Form/FormFields/TextAreaFormField";
import TextFormField from "../Form/FormFields/TextFormField";
import { parsePhoneNumber } from "../../Utils/utils.js";
import useAppHistory from "../../Common/hooks/useAppHistory";
-import useConfig from "../../Common/hooks/useConfig";
-
import { useTranslation } from "react-i18next";
import CircularProgress from "../Common/components/CircularProgress.js";
import Card from "../../CAREUI/display/Card";
@@ -41,6 +38,7 @@ import { IShift } from "./models.js";
import request from "../../Utils/request/request.js";
import { PatientModel } from "../Patient/models.js";
import useAuthUser from "../../Common/hooks/useAuthUser.js";
+import careConfig from "@careConfig";
const Loading = lazy(() => import("../Common/Loading"));
@@ -51,9 +49,6 @@ interface patientShiftProps {
export const ShiftDetailsUpdate = (props: patientShiftProps) => {
const { goBack } = useAppHistory();
const { user_type, home_facility } = useAuthUser();
-
- const { kasp_full_string, kasp_enabled, wartime_shifting } = useConfig();
-
const [qParams, _] = useQueryParams();
const [isLoading, setIsLoading] = useState(true);
@@ -137,7 +132,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => {
},
};
- if (wartime_shifting) {
+ if (careConfig.wartimeShifting) {
requiredFields = {
...requiredFields,
shifting_approving_facility_object: {
@@ -336,7 +331,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => {
label={t("status")}
required
options={
- wartime_shifting
+ careConfig.wartimeShifting
? SHIFTING_CHOICES_WARTIME
: SHIFTING_CHOICES_PEACETIME
}
@@ -355,7 +350,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => {
className="w-full bg-white md:col-span-1 md:leading-5"
/>
- {wartime_shifting &&
+ {careConfig.wartimeShifting &&
(assignedUserLoading ? (
) : (
@@ -369,7 +364,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => {
/>
))}
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
{t("name_of_shifting_approving_facility")}
@@ -429,11 +424,11 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => {
optionValue={(option) => option.value}
/>
- {kasp_enabled && (
+ {careConfig.kasp.enabled && (
{
error={state.errors.patient_category}
/>
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
<>
{
- const { wartime_shifting } = useConfig();
const [modalFor, setModalFor] = useState({
externalId: undefined,
loading: false,
@@ -110,7 +108,7 @@ const ShiftCard = ({ shift, filter }: any) => {
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
{
plausible("pageview");
});
@@ -17,11 +15,11 @@ export default function Plausible() {
return (
);
}
diff --git a/src/Integrations/Sentry.tsx b/src/Integrations/Sentry.tsx
index 466f93487c4..90a8e78f3a9 100644
--- a/src/Integrations/Sentry.tsx
+++ b/src/Integrations/Sentry.tsx
@@ -1,25 +1,20 @@
+import careConfig from "@careConfig";
import { useEffect } from "react";
-import useConfig from "../Common/hooks/useConfig";
interface Props {
disabled?: boolean;
}
export default function Sentry({ disabled }: Props) {
- const { sentry_dsn, sentry_environment } = useConfig();
-
useEffect(() => {
- if (disabled || !sentry_dsn) {
+ if (disabled || !careConfig.sentry.dsn) {
return;
}
import("@sentry/browser").then((Sentry) => {
- Sentry.init({
- environment: sentry_environment,
- dsn: sentry_dsn,
- });
+ Sentry.init(careConfig.sentry);
});
- }, [sentry_dsn, sentry_environment, disabled]);
+ }, [disabled]);
return null;
}
diff --git a/src/Locale/en/Asset.json b/src/Locale/en/Asset.json
index f24549ee0b6..182bb25a4fe 100644
--- a/src/Locale/en/Asset.json
+++ b/src/Locale/en/Asset.json
@@ -11,5 +11,10 @@
"update_asset_service_record": "Update Asset Service Record",
"eg_details_on_functionality_service_etc": "Eg. Details on functionality, service, etc.",
"updating": "Updating",
- "update": "Update"
-}
+ "update": "Update",
+ "are_you_still_watching": "Are you still watching?",
+ "stream_stop_due_to_inativity": "The live feed will stop streaming due to inactivity",
+ "stream_stopped_due_to_inativity": "The live feed has stopped streaming due to inactivity",
+ "continue_watching": "Continue watching",
+ "resume": "Resume"
+}
\ No newline at end of file
diff --git a/src/Locale/en/Common.json b/src/Locale/en/Common.json
index c5d6d76564e..24855e05d70 100644
--- a/src/Locale/en/Common.json
+++ b/src/Locale/en/Common.json
@@ -176,6 +176,7 @@
"ration_card__NO_CARD": "Non-card holder",
"ration_card__BPL": "BPL",
"ration_card__APL": "APL",
+ "empty_date_time": "--:-- --; --/--/----",
"caution": "Caution",
"feed_optimal_experience_for_phones": "For optimal viewing experience, consider rotating your device.",
"feed_optimal_experience_for_apple_phones": "For optimal viewing experience, consider rotating your device. Ensure auto-rotate is enabled in your device settings.",
@@ -183,6 +184,7 @@
"GENDER__1": "Male",
"GENDER__2": "Female",
"GENDER__3": "Non-binary",
+ "normal": "Normal",
"done": "Done",
"view": "View",
"rename": "Rename",
@@ -192,5 +194,11 @@
"live": "Live",
"discharged": "Discharged",
"archived": "Archived",
- "no_changes_made": "No changes made"
-}
\ No newline at end of file
+ "no_changes_made": "No changes made",
+ "user_deleted_successfuly": "User Deleted Successfuly",
+ "users": "Users",
+ "are_you_sure_want_to_delete": "Are you sure you want to delete {{name}}?",
+ "oxygen_information": "Oxygen Information",
+ "deleted_successfully": "{{name}} deleted successfully",
+ "delete_item": "Delete {{name}}"
+}
diff --git a/src/Locale/en/Facility.json b/src/Locale/en/Facility.json
index 16bc6610631..d19c889a98f 100644
--- a/src/Locale/en/Facility.json
+++ b/src/Locale/en/Facility.json
@@ -55,10 +55,65 @@
"discharged_patients": "Discharged Patients",
"discharged_patients_empty": "No discharged patients present in this facility",
"update_facility_middleware_success": "Facility middleware updated successfully",
+ "treatment_summary__head_title": "Treatment Summary",
+ "treatment_summary__print": "Print Treatment Summary",
+ "treatment_summary__heading": "INTERIM TREATMENT SUMMARY",
+ "patient_registration__name": "Name",
+ "patient_registration__address": "Address",
+ "patient_registration__age": "Age",
+ "patient_consultation__op": "OP",
+ "patient_consultation__ip": "IP",
+ "patient_consultation__dc_admission": "Date of domiciliary care commenced",
+ "patient_consultation__admission": "Date of admission",
+ "patient_registration__gender": "Gender",
+ "patient_registration__contact": "Emergency Contact",
+ "patient_registration__comorbidities": "Comorbidities",
+ "patient_registration__comorbidities__disease": "Disease",
+ "patient_registration__comorbidities__details": "Details",
+ "patient_consultation__consultation_notes": "General Instructions",
+ "patient_consultation__special_instruction": "Special Instructions",
+ "suggested_investigations": "Suggested Investigations",
+ "investigations__date": "Date",
+ "investigations__name": "Name",
+ "investigations__result": "Result",
+ "investigations__ideal_value": "Ideal Value",
+ "investigations__range": "Value Range",
+ "investigations__unit": "Unit",
+ "patient_consultation__treatment__plan": "Plan",
+ "patient_consultation__treatment__summary": "Summary",
+ "patient_consultation__treatment__summary__date": "Date",
+ "patient_consultation__treatment__summary__spo2": "SpO2",
+ "patient_consultation__treatment__summary__temperature": "Temperature",
+ "diagnosis": "Diagnosis",
+ "diagnosis__principal": "Principal",
+ "diagnosis__confirmed": "Confirmed",
+ "diagnosis__provisional": "Provisional",
+ "diagnosis__unconfirmed": "Unconfirmed",
+ "diagnosis__differential": "Differential",
+ "active_prescriptions": "Active Prescriptions",
+ "prescriptions__medicine": "Medicine",
+ "prescriptions__route": "Route",
+ "prescriptions__dosage_frequency": "Dosage & Frequency",
+ "prescriptions__start_date": "Prescribed On",
"select_facility_for_discharged_patients_warning": "Facility needs to be selected to view discharged patients.",
"duplicate_patient_record_confirmation": "Admit the patient record to your facility by adding the year of birth",
"duplicate_patient_record_rejection": "I confirm that the suspect / patient I want to create is not on the list.",
"duplicate_patient_record_birth_unknown": "Please contact your district care coordinator, the shifting facility or the patient themselves if you are not sure about the patient's year of birth.",
"patient_transfer_birth_match_note": "Note: Year of birth must match the patient to process the transfer request.",
- "cover_image_updated_note": "It could take a while to see the updated cover image"
-}
\ No newline at end of file
+ "cover_image_updated_note": "It could take a while to see the updated cover image",
+ "available_features": "Available Features",
+ "update_facility": "Update Facility",
+ "configure_facility": "Configure Facility",
+ "inventory_management": "Inventory Management",
+ "location_management": "Location Management",
+ "resource_request": "Resource Request",
+ "view_asset": "View Assets",
+ "view_users": "View Users",
+ "view_abdm_records": "View ABDM Records",
+ "delete_facility": "Delete Facility",
+ "central_nursing_station": "Central Nursing Station",
+ "add_details_of_patient": "Add Details of Patient",
+ "choose_location": "Choose Location",
+ "live_monitoring": "Live Monitoring",
+ "open_live_monitoring": "Open Live Monitoring"
+}
diff --git a/src/Locale/en/LogUpdate.json b/src/Locale/en/LogUpdate.json
index 319a87bd8d8..080e2fc979a 100644
--- a/src/Locale/en/LogUpdate.json
+++ b/src/Locale/en/LogUpdate.json
@@ -52,5 +52,22 @@
"NURSING_CARE_PROCEDURE__chest_tube_care": "Chest Tube Care",
"NURSING_CARE_PROCEDURE__tracheostomy_care": "Tracheostomy Care",
"NURSING_CARE_PROCEDURE__stoma_care": "Stoma Care",
- "NURSING_CARE_PROCEDURE__catheter_care": "Catheter Care"
+ "NURSING_CARE_PROCEDURE__catheter_care": "Catheter Care",
+ "HEARTBEAT_RHYTHM__REGULAR": "Regular",
+ "HEARTBEAT_RHYTHM__IRREGULAR": "Irregular",
+ "HEARTBEAT_RHYTHM__UNKNOWN": "Unknown",
+ "heartbeat_rhythm": "Heartbeat Rhythm",
+ "heartbeat_description": "Heartbeat Description",
+ "blood_pressure": "Blood Pressure",
+ "map_acronym": "M.A.P.",
+ "systolic": "Systolic",
+ "diastolic": "Diastolic",
+ "temperature": "Temperature",
+ "resipiratory_rate": "Respiratory Rate",
+ "pain": "Pain",
+ "pain_chart_description": "Mark region and intensity of pain",
+ "pulse": "Pulse",
+ "bradycardia": "Bradycardia",
+ "tachycardia": "Tachycardia",
+ "spo2": "SpO₂"
}
\ No newline at end of file
diff --git a/src/Locale/en/Users.json b/src/Locale/en/Users.json
index 01fe031c61a..035ed8933a5 100644
--- a/src/Locale/en/Users.json
+++ b/src/Locale/en/Users.json
@@ -4,11 +4,13 @@
"add_new_user": "Add New User",
"no_users_found": "No Users Found",
"home_facility": "Home Facility",
- "no_home_facility" : "No home facility assigned",
+ "no_home_facility": "No home facility assigned",
"clear_home_facility": "Clear Home Facility",
"linked_facilities": "Linked Facilities",
"no_linked_facilities": "No Linked Facilities",
"average_weekly_working_hours": "Average weekly working hours",
"set_average_weekly_working_hours_for": "Set Average weekly working hours for",
- "search_by_username": "Search by username"
+ "search_by_username": "Search by username",
+ "last_online": "Last Online",
+ "total_users": "Total Users"
}
diff --git a/src/Providers/AppConfigProvider.tsx b/src/Providers/AppConfigProvider.tsx
deleted file mode 100644
index 7492a83c126..00000000000
--- a/src/Providers/AppConfigProvider.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import { AppConfigContext } from "../Common/hooks/useConfig";
-import Loading from "../Components/Common/Loading";
-import routes from "../Redux/api";
-import useQuery from "../Utils/request/useQuery";
-
-interface Props {
- children: React.ReactNode;
-}
-
-export default function AppConfigProvider({ children }: Props) {
- const { data, loading } = useQuery(routes.config, {
- refetchOnWindowFocus: false,
- prefetch: true,
- });
-
- if (loading || data === undefined) {
- return ;
- }
-
- return (
-
- {children}
-
- );
-}
diff --git a/src/Providers/AuthUserProvider.tsx b/src/Providers/AuthUserProvider.tsx
index c3e15b670cc..df2997abe2e 100644
--- a/src/Providers/AuthUserProvider.tsx
+++ b/src/Providers/AuthUserProvider.tsx
@@ -5,8 +5,8 @@ import routes from "../Redux/api";
import useQuery from "../Utils/request/useQuery";
import { LocalStorageKeys } from "../Common/constants";
import request from "../Utils/request/request";
-import useConfig from "../Common/hooks/useConfig";
import { navigate } from "raviger";
+import careConfig from "@careConfig";
interface Props {
children: React.ReactNode;
@@ -14,9 +14,6 @@ interface Props {
}
export default function AuthUserProvider({ children, unauthorized }: Props) {
- const { jwt_token_refresh_interval } = useConfig();
- const tokenRefreshInterval = jwt_token_refresh_interval ?? 5 * 60 * 1000;
-
const {
res,
data: user,
@@ -30,8 +27,11 @@ export default function AuthUserProvider({ children, unauthorized }: Props) {
}
updateRefreshToken(true);
- setInterval(() => updateRefreshToken(), tokenRefreshInterval);
- }, [user, tokenRefreshInterval]);
+ setInterval(
+ () => updateRefreshToken(),
+ careConfig.auth.tokenRefreshInterval,
+ );
+ }, [user]);
const signIn = useCallback(
async (creds: { username: string; password: string }) => {
diff --git a/src/Providers/index.tsx b/src/Providers/index.tsx
deleted file mode 100644
index 728ee9e1f91..00000000000
--- a/src/Providers/index.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import AppConfigProvider from "./AppConfigProvider";
-import AuthUserProvider from "./AuthUserProvider";
-import HistoryAPIProvider from "./HistoryAPIProvider";
-
-export { AppConfigProvider, AuthUserProvider, HistoryAPIProvider };
diff --git a/src/Redux/Reducer.tsx b/src/Redux/Reducer.tsx
index 2c5335e6d7c..c7d4698b694 100644
--- a/src/Redux/Reducer.tsx
+++ b/src/Redux/Reducer.tsx
@@ -1,26 +1,6 @@
-import { IConfig } from "../Common/hooks/useConfig";
import { actions } from "./fireRequest";
-export const getCachedConfig = () => {
- const localConfig = localStorage.getItem("config");
- if (localConfig) {
- try {
- const config = JSON.parse(localConfig) as IConfig;
- return config;
- } catch (_) {
- return undefined;
- }
- }
-};
-
-const cachedConfig = getCachedConfig();
-
-const reducer = (
- state = {
- config: cachedConfig,
- },
- changeAction: any,
-) => {
+const reducer = (state = {}, changeAction: any) => {
switch (changeAction.type) {
case actions.FETCH_REQUEST: {
const obj: any = Object.assign({}, state);
diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx
index b03faf07e5a..e72f7766bbe 100644
--- a/src/Redux/api.tsx
+++ b/src/Redux/api.tsx
@@ -1,4 +1,3 @@
-import { IConfig } from "../Common/hooks/useConfig";
import {
ConsentRequestModel,
CreateConsentTBody,
@@ -132,13 +131,6 @@ export interface LoginCredentials {
}
const routes = {
- config: {
- path: import.meta.env.REACT_APP_CONFIG ?? "/config.json",
- method: "GET",
- noAuth: true,
- TRes: Type(),
- },
-
createScribe: {
path: "/api/care_scribe/scribe/",
method: "POST",
diff --git a/src/Redux/fireRequest.tsx b/src/Redux/fireRequest.tsx
index fb1a7746167..fe72b2af0d2 100644
--- a/src/Redux/fireRequest.tsx
+++ b/src/Redux/fireRequest.tsx
@@ -3,6 +3,7 @@ import * as Notification from "../Utils/Notifications.js";
import { LocalStorageKeys } from "../Common/constants";
import api from "./api";
import axios from "axios";
+import careConfig from "@careConfig";
const requestMap: any = api;
export const actions = {
@@ -90,6 +91,7 @@ export const fireRequest = (
// set authorization header in the request header
const config: any = {
headers: {},
+ baseURL: careConfig.apiUrl,
};
if (!request.noAuth) {
const access_token = localStorage.getItem(LocalStorageKeys.accessToken);
diff --git a/src/Routers/AppRouter.tsx b/src/Routers/AppRouter.tsx
index bba3bd04899..60e0f9411d5 100644
--- a/src/Routers/AppRouter.tsx
+++ b/src/Routers/AppRouter.tsx
@@ -11,7 +11,6 @@ import {
SidebarShrinkContext,
} from "../Components/Common/Sidebar/Sidebar";
import { BLACKLISTED_PATHS } from "../Common/constants";
-import useConfig from "../Common/hooks/useConfig";
import SessionExpired from "../Components/ErrorPages/SessionExpired";
import HealthInformation from "../Components/ABDM/HealthInformation";
import ABDMFacilityRecords from "../Components/ABDM/ABDMFacilityRecords";
@@ -28,6 +27,7 @@ import ResourceRoutes from "./routes/ResourceRoutes";
import ExternalResultRoutes from "./routes/ExternalResultRoutes";
import { DetailRoute } from "./types";
import useAuthUser from "../Common/hooks/useAuthUser";
+import careConfig from "@careConfig";
const Routes = {
"/": () => ,
@@ -59,11 +59,10 @@ const Routes = {
export default function AppRouter() {
const authUser = useAuthUser();
- const { main_logo, enable_hcx } = useConfig();
let routes = Routes;
- if (enable_hcx) {
+ if (careConfig.hcx.enabled) {
routes = { ...routes, ...HCXRoutes };
}
@@ -144,7 +143,7 @@ export default function AppRouter() {
>
diff --git a/src/Routers/routes/ConsultationRoutes.tsx b/src/Routers/routes/ConsultationRoutes.tsx
index 9209b50e97e..598fd06adc3 100644
--- a/src/Routers/routes/ConsultationRoutes.tsx
+++ b/src/Routers/routes/ConsultationRoutes.tsx
@@ -5,7 +5,9 @@ import ManagePrescriptions from "../../Components/Medicine/ManagePrescriptions";
import { DailyRoundListDetails } from "../../Components/Patient/DailyRoundListDetails";
import { DailyRounds } from "../../Components/Patient/DailyRounds";
import { ConsultationDetails } from "../../Components/Facility/ConsultationDetails";
-import TreatmentSummary from "../../Components/Facility/TreatmentSummary";
+import TreatmentSummary, {
+ ITreatmentSummaryProps,
+} from "../../Components/Facility/TreatmentSummary";
import ConsultationDoctorNotes from "../../Components/Facility/ConsultationDoctorNotes";
import PatientConsentRecords from "../../Components/Patient/PatientConsentRecords";
import CriticalCareEditor from "../../Components/LogUpdate/CriticalCareEditor";
@@ -129,12 +131,11 @@ export default {
),
"/facility/:facilityId/patient/:patientId/consultation/:consultationId/treatment-summary":
- ({ facilityId, patientId, consultationId }: any) => (
+ ({ facilityId, patientId, consultationId }: ITreatmentSummaryProps) => (
),
"/facility/:facilityId/patient/:patientId/consultation/:consultationId/notes":
diff --git a/src/Utils/request/handleResponse.ts b/src/Utils/request/handleResponse.ts
index 9f85b50a68d..905417ad0e2 100644
--- a/src/Utils/request/handleResponse.ts
+++ b/src/Utils/request/handleResponse.ts
@@ -20,14 +20,15 @@ export default function handleResponse(
// Other Errors between 400-599 (inclusive)
if (res.status >= 400 && res.status < 600) {
- // Invalid token
- if (!silent && error?.code === "token_not_valid") {
- navigate(`/session-expired?redirect=${window.location.href}`);
- }
-
- // Handle session expiry
- if (error?.detail === "Authentication credentials were not provided.") {
- notify?.Error({ msg: "Session expired. Please Login again." });
+ // Handle invalid token / session expiry
+ if (
+ !silent &&
+ (error?.code === "token_not_valid" ||
+ error?.detail === "Authentication credentials were not provided.")
+ ) {
+ if (!location.pathname.startsWith("/session-expired")) {
+ navigate(`/session-expired?redirect=${window.location.href}`);
+ }
return;
}
diff --git a/src/Utils/request/request.ts b/src/Utils/request/request.ts
index 9dd803148bb..151cc30c460 100644
--- a/src/Utils/request/request.ts
+++ b/src/Utils/request/request.ts
@@ -1,3 +1,4 @@
+import careConfig from "@careConfig";
import handleResponse from "./handleResponse";
import { RequestOptions, RequestResult, Route } from "./types";
import { makeHeaders, makeUrl } from "./utils";
@@ -34,7 +35,7 @@ export default async function request(
}
const signal = controller?.signal ?? controllerRef?.current?.signal;
- const url = makeUrl(path, query, pathParams);
+ const url = `${careConfig.apiUrl}${makeUrl(path, query, pathParams)}`;
const options: RequestInit = { method, signal };
diff --git a/src/Utils/useFileUpload.tsx b/src/Utils/useFileUpload.tsx
index 49e4f9d99bd..fdd69c45765 100644
--- a/src/Utils/useFileUpload.tsx
+++ b/src/Utils/useFileUpload.tsx
@@ -84,11 +84,13 @@ export default function useFileUpload(
const f = e.target.files[0];
const fileName = f.name;
setFile(e.target.files[0]);
- setUploadFileName(
- uploadFileName ||
- fileName.substring(0, fileName.lastIndexOf(".")) ||
- fileName,
- );
+
+ // This is commented out to prompt users to input valid file names. See https://github.com/ohcnetwork/care_fe/issues/7942#issuecomment-2324391329
+ //setUploadFileName(
+ // uploadFileName ||
+ // fileName.substring(0, fileName.lastIndexOf(".")) ||
+ // fileName,
+ //);
const ext: string = fileName.split(".")[1];
@@ -248,7 +250,7 @@ export default function useFileUpload(
type="file"
accept={
"allowedExtensions" in options
- ? options.allowedExtensions?.join(",")
+ ? options.allowedExtensions?.map((e) => "." + e).join(",")
: "allowAllExtensions" in options
? "*"
: DEFAULT_ALLOWED_EXTENSIONS.join(",")
diff --git a/src/Utils/useTimer.tsx b/src/Utils/useTimer.tsx
index f7157f65b86..6a8d8320c5e 100644
--- a/src/Utils/useTimer.tsx
+++ b/src/Utils/useTimer.tsx
@@ -22,8 +22,8 @@ import { useEffect, useState } from "react";
* // To display the timer in your component:
* {time}
*/
-export const useTimer = () => {
- const [running, setRunning] = useState(false);
+export const useTimer = (autoStart = false) => {
+ const [running, setRunning] = useState(autoStart);
const [time, setTime] = useState(0);
useEffect(() => {
@@ -39,7 +39,7 @@ export const useTimer = () => {
}, [running]);
return {
- seconds: time,
+ seconds: time / 100,
time: (
{("0" + Math.floor((time / 6000) % 60)).slice(-2)}:
@@ -48,5 +48,6 @@ export const useTimer = () => {
),
start: () => setRunning(true),
stop: () => setRunning(false),
+ reset: () => setTime(0),
};
};
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index c899d453626..7a50ebe49db 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -1,14 +1,45 @@
///
///
interface ImportMetaEnv {
+ readonly CARE_CDN_URL?: string;
+
readonly REACT_APP_TITLE: string;
readonly REACT_APP_META_DESCRIPTION: string;
readonly REACT_APP_COVER_IMAGE: string;
readonly REACT_APP_COVER_IMAGE_ALT: string;
- readonly REACT_APP_CONFIG: string | undefined;
readonly REACT_PUBLIC_URL: string;
- readonly REACT_APP_SITE_URL: string;
- readonly REACT_APP_ANALYTICS_SERVER_URL: string;
+ readonly REACT_CARE_API_URL: string;
+ readonly REACT_DASHBOARD_URL?: string;
+ readonly REACT_GITHUB_URL?: string;
+ readonly REACT_OHCN_URL?: string;
+ readonly REACT_HEADER_LOGO?: string;
+ readonly REACT_MAIN_LOGO?: string;
+ readonly REACT_STATE_LOGO?: string;
+ readonly REACT_CUSTOM_LOGO?: string;
+ readonly REACT_CUSTOM_LOGO_ALT?: string;
+ readonly REACT_CUSTOM_DESCRIPTION?: string;
+ readonly REACT_GMAPS_API_KEY?: string;
+ readonly REACT_GOV_DATA_API_KEY?: string;
+ readonly REACT_RECAPTCHA_SITE_KEY?: string;
+ readonly REACT_KASP_ENABLED?: string;
+ readonly REACT_KASP_STRING?: string;
+ readonly REACT_KASP_FULL_STRING?: string;
+ readonly REACT_SAMPLE_FORMAT_ASSET_IMPORT?: string;
+ readonly REACT_SAMPLE_FORMAT_EXTERNAL_RESULT_IMPORT?: string;
+ readonly REACT_WARTIME_SHIFTING?: string;
+ readonly REACT_STILL_WATCHING_IDLE_TIMEOUT?: string;
+ readonly REACT_STILL_WATCHING_PROMPT_DURATION?: string;
+ readonly REACT_JWT_TOKEN_REFRESH_INTERVAL?: string;
+ readonly REACT_MIN_ENCOUNTER_DATE?: string;
+
+ // Plugins related envs...
+ readonly REACT_PLAUSIBLE_SERVER_URL?: string;
+ readonly REACT_PLAUSIBLE_SITE_DOMAIN?: string;
+ readonly REACT_SENTRY_DSN?: string;
+ readonly REACT_SENTRY_ENVIRONMENT?: string;
+ readonly REACT_ENABLE_HCX?: string;
+ readonly REACT_ENABLE_ABDM?: string;
+ readonly REACT_ENABLE_SCRIBE?: string;
}
interface ImportMeta {
diff --git a/tsconfig.json b/tsconfig.json
index 23f7ab14d4a..61e8476b152 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -15,10 +15,11 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
- "types": ["vite/client", "vite-plugin-pwa/client"]
+ "types": ["vite/client", "vite-plugin-pwa/client"],
+ "paths": {
+ "@careConfig": ["./care.config.ts"]
+ }
},
- "include": ["src"],
- "exclude": [
- "src/**/*.gen.tsx"
- ]
+ "include": ["src", "care.config.ts"],
+ "exclude": ["src/**/*.gen.tsx"]
}
diff --git a/vite.config.mts b/vite.config.mts
index a8f946c3e75..39ff4b4e99e 100644
--- a/vite.config.mts
+++ b/vite.config.mts
@@ -84,6 +84,11 @@ export default {
},
}),
],
+ resolve: {
+ alias: {
+ "@careConfig": path.resolve(__dirname, "./care.config.ts"),
+ },
+ },
build: {
outDir: "build",
assetsDir: "bundle",
@@ -100,12 +105,6 @@ export default {
},
server: {
port: 4000,
- proxy: {
- "/api": {
- target: process.env.CARE_API ?? "https://careapi.ohc.network",
- changeOrigin: true,
- },
- },
},
preview: {
headers: {
@@ -117,11 +116,5 @@ export default {
object-src 'self' ${cdnUrls};`,
},
port: 4000,
- proxy: {
- "/api": {
- target: process.env.CARE_API ?? "https://careapi.ohc.network",
- changeOrigin: true,
- },
- },
},
};