diff --git a/cypress/e2e/facility_spec/facility_creation.cy.ts b/cypress/e2e/facility_spec/facility_creation.cy.ts index a092d23390e..ef309af2c24 100644 --- a/cypress/e2e/facility_spec/facility_creation.cy.ts +++ b/cypress/e2e/facility_spec/facility_creation.cy.ts @@ -37,7 +37,7 @@ describe("Facility Creation", () => { const totalOccupancy = "10"; const doctorCapacity = "5"; const totalDoctor = "10"; - const facilityName = "cypress facility"; + const facilityName = "Cypress Facility"; const facilityName2 = "Dummy Facility 40"; const facilityAddress = "cypress address"; const facilityUpdateAddress = "cypress updated address"; diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx index 50edef824c8..a0dcf06026f 100644 --- a/src/Components/Facility/FacilityHome.tsx +++ b/src/Components/Facility/FacilityHome.tsx @@ -88,7 +88,7 @@ export const FacilityHome = ({ facilityId }: Props) => { onResponse: ({ res }) => { if (res?.ok) { Notification.Success({ - msg: "Facility deleted successfully", + msg: t("deleted_successfully", { name: facilityData?.name }), }); } navigate("/facility"); @@ -150,11 +150,10 @@ export const FacilityHome = ({ facilityId }: Props) => { backUrl="/facility" > - Are you sure you want to delete{" "} - {facilityData?.name} + {t("are_you_sure_want_to_delete", { name: facilityData?.name })} } action="Delete" @@ -247,7 +246,7 @@ export const FacilityHome = ({ facilityId }: Props) => {

- Address + {t("address")}

{facilityData?.address} @@ -257,7 +256,7 @@ export const FacilityHome = ({ facilityId }: Props) => {

- Local Body + {t("local_body")}

{facilityData?.local_body_object?.name} @@ -266,7 +265,7 @@ export const FacilityHome = ({ facilityId }: Props) => {

- Ward + {t("ward")}

{facilityData?.ward_object?.number + @@ -276,7 +275,7 @@ export const FacilityHome = ({ facilityId }: Props) => {

- District + {t("district")}

{facilityData?.district_object?.name} @@ -286,7 +285,7 @@ export const FacilityHome = ({ facilityId }: Props) => {

- Phone Number + {t("phone_number")}

{ {facilityData?.features?.some((feature) => FACILITY_FEATURE_TYPES.some((f) => f.id === feature), ) && ( -

Available features

+

+ {t("available_features")} +

)}
{ authorizeFor={NonReadOnlyUsers} icon={} > - Update Facility + {t("update_facility")} { authorizeFor={NonReadOnlyUsers} icon={} > - Configure Facility + {t("configure_facility")} navigate(`/facility/${facilityId}/inventory`)} icon={} > - Inventory Management + {t("inventory_management")} { } > - Location Management + {t("location_management")} { authorizeFor={NonReadOnlyUsers} icon={} > - Resource Request + {t("resource_request")} { authorizeFor={NonReadOnlyUsers} icon={} > - Create Asset + {t("create_asset")} navigate(`/assets?facility=${facilityId}`)} icon={} > - View Assets + {t("view_asset")} navigate(`/facility/${facilityId}/users`)} icon={} > - View Users + {t("view_users")} navigate(`/facility/${facilityId}/abdm`)} icon={} > - View ABDM Records + {t("view_abdm_records")} {hasPermissionToDeleteFacility ? ( { className="flex items-center gap-3" icon={} > - Delete Facility + {t("delete_facility")} ) : ( <> @@ -437,7 +438,7 @@ export const FacilityHome = ({ facilityId }: Props) => { onClick={() => navigate(`/facility/${facilityId}/cns`)} > - Central Nursing Station + {t("central_nursing_station")} {CameraFeedPermittedUserTypes.includes(authUser.user_type) && ( @@ -451,7 +452,7 @@ export const FacilityHome = ({ facilityId }: Props) => { authorizeFor={NonReadOnlyUsers} > - Add Details of a Patient + {t("add_details_of_patient")} { onClick={() => navigate(`/patients?facility=${facilityId}`)} > - View Patients + {t("view_patients")}
@@ -472,7 +473,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
-

Oxygen Information

+

{t("oxygen_information")}

{ const facilityId = useSlug("facility"); const [location, setLocation] = useState(); + const { t } = useTranslation(); + return ( @@ -528,7 +531,7 @@ const LiveMonitoringButton = () => { id="facility-detailspage-livemonitoring" > - Live Monitoring + {t("live_monitoring")} @@ -545,7 +548,7 @@ const LiveMonitoringButton = () => {
- Choose a location + {t("choose_location")}
{ className="w-full" href={`/facility/${facilityId}/live-monitoring?location=${location}`} > - Open Live Monitoring + {t("open_live_monitoring")}
diff --git a/src/Components/Facility/TreatmentSummary.tsx b/src/Components/Facility/TreatmentSummary.tsx index e75eec5b80a..e719e859a4b 100644 --- a/src/Components/Facility/TreatmentSummary.tsx +++ b/src/Components/Facility/TreatmentSummary.tsx @@ -4,16 +4,34 @@ import { formatDateTime, formatPatientAge, } from "../../Utils/utils"; -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"; +import { ConsultationModel } from "./models"; +import { useMemo } from "react"; +import { + ActiveConditionVerificationStatuses, + ConsultationDiagnosis, +} from "../Diagnosis/types"; +import PageHeadTitle from "../Common/PageHeadTitle"; +import { useTranslation } from "react-i18next"; +import { PatientModel } from "../Patient/models"; +import MedicineRoutes from "../Medicine/routes"; + +export interface ITreatmentSummaryProps { + consultationId: string; + patientId: string; + facilityId: string; +} -const TreatmentSummary = (props: any) => { - const { consultationId, patientId } = props; +export default function TreatmentSummary({ + consultationId, + patientId, + facilityId, +}: ITreatmentSummaryProps) { + const { t } = useTranslation(); const date = new Date(); - const facilityId = useSlug("facility"); const { goBack } = useAppHistory(); const url = `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`; @@ -22,11 +40,6 @@ const TreatmentSummary = (props: any) => { prefetch: patientId !== undefined, }); - const { data: investigations } = useQuery(routes.getInvestigation, { - pathParams: { consultation_external_id: consultationId }, - prefetch: consultationId !== undefined, - }); - const { data: consultationData } = useQuery(routes.getConsultation, { pathParams: { id: consultationId }, prefetch: consultationId !== undefined, @@ -34,16 +47,19 @@ const TreatmentSummary = (props: any) => { return (
+
@@ -52,290 +68,463 @@ const TreatmentSummary = (props: any) => { {consultationData?.facility_name ?? ""} -

INTERIM TREATMENT SUMMARY

+

+ {t("treatment_summary__heading")} +

{formatDate(date)}
-
-
-
- Name : {patientData?.name ?? ""} -
-
- Address : {patientData?.address ?? ""} -
-
- -
-
-
- Age :{" "} - {patientData ? formatPatientAge(patientData, true) : ""} -
-
- OP : {consultationData?.patient_no ?? ""} -
-
+
+ -
- {consultationData?.suggestion === "DC" ? ( - Date of domiciliary care commenced : - ) : ( - Date of admission : - )} - - {consultationData?.encounter_date - ? formatDateTime(consultationData.encounter_date) - : " --/--/----"} - -
-
+ -
-
- Gender : - {GENDER_TYPES.find((i) => i.id === patientData?.gender)?.text} -
+ -
- Contact person : - - {" "} - {patientData?.emergency_phone_number - ? patientData.emergency_phone_number - : " -"} - -
-
- -
- Comorbidities : -
- - - - - - - - - {patientData?.medical_history && - patientData.medical_history.length > 0 ? ( - patientData.medical_history.map( - (obj: any, index: number) => { - return ( - - - - - ); - }, - ) - ) : ( - - - - - )} - -
DiseaseDetails
- {obj["disease"]} - - {obj["details"] ? obj["details"] : "---"} -
- --- - - --- -
-
-
- -
- Diagnosis : -
-
- History of present illness : - {consultationData?.history_of_present_illness - ? consultationData.history_of_present_illness - : " ---"} -
- -
- Examination details and clinical conditions : - {consultationData?.examination_details - ? consultationData.examination_details - : " ---"} -
- -
- Physical Examination info : - {consultationData?.last_daily_round?.physical_examination_info - ? consultationData.last_daily_round - ?.physical_examination_info - : " ---"} -
-
-
- -
- General Instructions : - {patientData?.last_consultation?.consultation_notes ? ( -
- {patientData.last_consultation.consultation_notes} -
- ) : ( - " ---" - )} -
- -
- Relevant investigations : - -
- - - - - - - - - - - - - - {investigations && investigations.results.length > 0 ? ( - investigations.results.map( - (value: any, index: number) => { - return ( - - - - - - - - - ); - }, - ) - ) : ( - - - - - - - - - )} - -
- Date - - Name - - Result - - Ideal value - - values range - - unit -
- {formatDate( - value["session_object"][ - "session_created_date" - ], - )} - - {value["investigation_object"]["name"]} - - {value["notes"] || value["value"]} - - {value["investigation_object"]["ideal_value"] || - "-"} - - {value["investigation_object"]["min_value"]} -{" "} - {value["investigation_object"]["max_value"]} - - {value["investigation_object"]["unit"] || "-"} -
- --- - - --- - - --- - - --- - - --- - - --- -
-
-
- -
- Treatment : - {consultationData?.treatment_plan ? ( -

{consultationData.treatment_plan}

- ) : ( -

---

- )} - Treatment summary/Treament Plan : - -
- - - - - - - - - - - {consultationData?.last_daily_round ? ( - - - - - - ) : ( - - - - - - )} - -
DateSpo2 - Temperature -
- {formatDateTime( - consultationData.last_daily_round.modified_date, - )} - - {consultationData.last_daily_round.ventilator_spo2 || - "-"} - - {consultationData.last_daily_round.temperature || "-"} -
- --- - - --- - - --- -
-
-
+ + + + + + +
); -}; +} + +interface IBasicDetailsSection { + patientData?: PatientModel; + consultationData?: ConsultationModel; +} + +function BasicDetailsSection({ + patientData, + consultationData, +}: IBasicDetailsSection) { + const { t } = useTranslation(); + + return ( + <> +
+
+ {t("patient_registration__name")} : {patientData?.name ?? ""} +
+
+ {t("patient_registration__address")} :{" "} + {patientData?.address ?? ""} +
+
+ +
+
+
+ {t("patient_registration__age")} :{" "} + {patientData ? formatPatientAge(patientData, true) : ""} +
+
+ + {consultationData?.suggestion === "A" + ? t("patient_consultation__ip") + : t("patient_consultation__op")}{" "} + : + {" "} + {consultationData?.patient_no ?? ""} +
+
+ +
+ {consultationData?.suggestion === "DC" ? ( + {t("patient_consultation__dc_admission")} : + ) : ( + {t("patient_consultation__admission")} : + )}{" "} + + {consultationData?.encounter_date + ? formatDateTime(consultationData.encounter_date) + : t("empty_date_time")} + +
+
+ +
+
+ {t("patient_registration__gender")} :{" "} + {GENDER_TYPES.find((i) => i.id === patientData?.gender)?.text} +
+ +
+ {t("patient_registration__contact")} :{" "} + {patientData?.emergency_phone_number ?? ""} +
+
+ + ); +} + +interface IComorbiditiesSection { + patientData?: PatientModel; +} + +function ComorbiditiesSection({ patientData }: IComorbiditiesSection) { + const { t } = useTranslation(); + + return patientData?.medical_history?.filter( + (comorbidities) => comorbidities.disease !== "NO", + ).length ? ( +
+ {t("patient_registration__comorbidities")} +
+ + + + + + + + + {patientData.medical_history.map((obj, index) => { + return ( + + + + + ); + })} + +
+ {t("patient_registration__comorbidities__disease")} + + {t("patient_registration__comorbidities__details")} +
+ {obj["disease"]} + + {obj["details"] || "---"} +
+
+
+ ) : null; +} + +interface IDiagnosisSection { + consultationData?: ConsultationModel; +} + +type DiagnosisType = + | (typeof ActiveConditionVerificationStatuses)[number] + | "principal"; + +function DiagnosisSection({ consultationData }: IDiagnosisSection) { + const { t } = useTranslation(); + + const diagnoses = useMemo(() => { + return consultationData?.diagnoses?.reduce( + (acc, curr) => { + if (curr.is_principal) { + acc.principal.push(curr); + } else if ( + ActiveConditionVerificationStatuses.includes( + curr.verification_status as (typeof ActiveConditionVerificationStatuses)[number], + ) + ) { + acc[curr.verification_status as keyof typeof acc].push(curr); + } + + return acc; + }, + { + principal: [], + confirmed: [], + provisional: [], + unconfirmed: [], + differential: [], + } as Record, + ); + }, [consultationData?.diagnoses]); + + if (!diagnoses) { + return null; + } + + return ( +
+ {t("diagnosis")} +
+ {( + [ + "principal", + "confirmed", + "provisional", + "unconfirmed", + "differential", + ] as DiagnosisType[] + ).map( + (type) => + !!diagnoses[type].length && ( +
+ + {t(`diagnosis__${type}`)} {t("diagnosis")} + +
    + {diagnoses[type].map((d) => ( +
  1. + {d.diagnosis_object.label} + {d.is_principal && ( + + {t(`diagnosis__${d.verification_status}`)} + + )} +
  2. + ))} +
+
+ ), + )} +
+
+ ); +} + +interface IInvestigationsSection { + consultationId: string; +} + +function InvestigationsSection({ consultationId }: IInvestigationsSection) { + const { t } = useTranslation(); + + const { data: investigations } = useQuery(routes.getInvestigation, { + pathParams: { consultation_external_id: consultationId }, + prefetch: consultationId !== undefined, + }); + + return investigations?.results.length ? ( +
+ {t("suggested_investigations")} + +
+ + + + + + + + + + + + + + {investigations?.results.map((value, index) => ( + + + + + + + + + ))} + +
+ {t("investigations__date")} + + {t("investigations__name")} + + {t("investigations__result")} + + {t("investigations__ideal_value")} + + {t("investigations__range")} + + {t("investigations__unit")} +
+ {formatDate(value["session_object"]["session_created_date"])} + + {value["investigation_object"]["name"]} + + {value["notes"] || value["value"]} + + {value["investigation_object"]["ideal_value"] || "-"} + + {value["investigation_object"]["min_value"]} -{" "} + {value["investigation_object"]["max_value"]} + + {value["investigation_object"]["unit"] || "-"} +
+
+
+ ) : null; +} + +interface ITreatmentSection { + consultationData?: ConsultationModel; +} + +function TreatmentSection({ consultationData }: ITreatmentSection) { + const { t } = useTranslation(); + + const isTreatmentSummaryAvailable = useMemo(() => { + return ( + consultationData?.last_daily_round && + (consultationData.last_daily_round.ventilator_spo2 || + consultationData.last_daily_round.temperature) + ); + }, [consultationData]); -export default TreatmentSummary; + return consultationData?.treatment_plan || isTreatmentSummaryAvailable ? ( +
+ {consultationData?.treatment_plan && ( + <> + {t("patient_consultation__treatment__plan")} +

{consultationData.treatment_plan}

+ + )} + + {isTreatmentSummaryAvailable && ( + <> + + {t("patient_consultation__treatment__summary")} + +
+ + + + + + + + + + + + + + + + +
+ {t("patient_consultation__treatment__summary__date")} + + {t("patient_consultation__treatment__summary__spo2")} + + {t("patient_consultation__treatment__summary__temperature")} +
+ {formatDateTime( + consultationData?.last_daily_round?.modified_date, + )} + + {consultationData?.last_daily_round?.ventilator_spo2 || "-"} + + {consultationData?.last_daily_round?.temperature || "-"} +
+
+ + )} +
+ ) : null; +} + +interface IPrescriptionsSection { + consultationId: string; +} + +function PrescriptionsSection({ consultationId }: IPrescriptionsSection) { + const { t } = useTranslation(); + + const { data: prescriptions } = useQuery(MedicineRoutes.listPrescriptions, { + pathParams: { consultation: consultationId }, + query: { discontinued: false }, + }); + + return prescriptions?.results.length ? ( +
+ {t("active_prescriptions")} + +
+ + + + + + + + + + + + {prescriptions?.results.map((prescription, index) => ( + + + + + + + ))} + +
+ {t("prescriptions__medicine")} + + {t("prescriptions__route")} + + {t("prescriptions__dosage_frequency")} + + {t("prescriptions__start_date")} +
+ {prescription.medicine_object?.name ?? "-"} + + {prescription.route ?? "-"} + + {prescription.dosage_type !== "TITRATED" ? ( +

{prescription.base_dosage}

+ ) : ( +

+ {prescription.base_dosage} - {prescription.target_dosage} +

+ )} + +

+ {prescription.dosage_type !== "PRN" + ? t("PRESCRIPTION_FREQUENCY_" + prescription.frequency) + : prescription.indicator} +

+
+ {formatDate(prescription.created_date)} +
+
+
+ ) : null; +} + +interface IInstructionsSection { + consultationData?: ConsultationModel; +} + +function InstructionsSection({ consultationData }: IInstructionsSection) { + const { t } = useTranslation(); + + return ( + <> + {consultationData?.consultation_notes && ( +
+ {t("patient_consultation__consultation_notes")} + +
{consultationData.consultation_notes}
+
+ )} + + {consultationData?.special_instruction && ( +
+ {t("patient_consultation__special_instruction")} + +
{consultationData.special_instruction}
+
+ )} + + ); +} diff --git a/src/Locale/en/Common.json b/src/Locale/en/Common.json index df83bbe152d..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.", @@ -195,5 +196,9 @@ "archived": "Archived", "no_changes_made": "No changes made", "user_deleted_successfuly": "User Deleted Successfuly", - "users": "Users" + "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/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/useFileUpload.tsx b/src/Utils/useFileUpload.tsx index ad8e185745c..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];