diff --git a/cypress/e2e/patient_spec/patient_consultation.cy.ts b/cypress/e2e/patient_spec/patient_consultation.cy.ts index 99565a24cc4..36c3ebdcb40 100644 --- a/cypress/e2e/patient_spec/patient_consultation.cy.ts +++ b/cypress/e2e/patient_spec/patient_consultation.cy.ts @@ -376,7 +376,6 @@ describe("Patient Consultation in multiple combination", () => { it("Edit created consultation to existing patient", () => { patientPage.visitPatient("Dummy Patient 13"); patientConsultationPage.clickEditConsultationButton(); - cy.wait(5000); patientConsultationPage.typePatientIllnessHistory("editted"); patientConsultationPage.selectPatientDiagnosis( diagnosis5, diff --git a/cypress/e2e/patient_spec/patient_logupdate.cy.ts b/cypress/e2e/patient_spec/patient_logupdate.cy.ts new file mode 100644 index 00000000000..57f31980679 --- /dev/null +++ b/cypress/e2e/patient_spec/patient_logupdate.cy.ts @@ -0,0 +1,156 @@ +import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress"; +import LoginPage from "../../pageobject/Login/LoginPage"; +import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation"; +import { PatientPage } from "../../pageobject/Patient/PatientCreation"; +import PatientLogupdate from "../../pageobject/Patient/PatientLogupdate"; + +describe("Patient Log Update in Normal, Critical and TeleIcu", () => { + const loginPage = new LoginPage(); + const patientConsultationPage = new PatientConsultationPage(); + const patientPage = new PatientPage(); + const patientLogupdate = new PatientLogupdate(); + const domicilaryPatient = "Dummy Patient 11"; + const patientCategory = "Abnormal"; + const additionalSymptoms = "ASYMPTOMATIC"; + const physicalExamination = "physical examination details"; + const otherExamination = "Other"; + const patientSystolic = "119"; + const patientDiastolic = "150"; + const patientModifiedSystolic = "120"; + const patientModifiedDiastolic = "145"; + const patientPulse = "152"; + const patientTemperature = "96.6"; + const patientRespiratory = "140"; + const patientSpo2 = "15"; + const patientRhythmType = "Regular"; + const patientRhythm = "Normal Rhythm"; + + before(() => { + loginPage.loginAsDisctrictAdmin(); + cy.saveLocalStorage(); + }); + + beforeEach(() => { + cy.restoreLocalStorage(); + cy.clearLocalStorage(/filters--.+/); + cy.awaitUrl("/patients"); + }); + + it("Create a new log teleicu update for a domicilary care patient and verify the copy previous value function", () => { + patientPage.visitPatient("Dummy Patient 11"); + patientConsultationPage.clickEditConsultationButton(); + patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); + cy.submitButton("Update Consultation"); + cy.verifyNotification("Consultation updated successfully"); + patientLogupdate.clickLogupdate(); + patientLogupdate.typePhysicalExamination(physicalExamination); + patientLogupdate.typeOtherDetails(otherExamination); + patientLogupdate.typeAdditionalSymptoms(additionalSymptoms); + patientLogupdate.selectPatientCategory(patientCategory); + patientLogupdate.typeSystolic(patientSystolic); + patientLogupdate.typeDiastolic(patientDiastolic); + patientLogupdate.typePulse(patientPulse); + patientLogupdate.typeTemperature(patientTemperature); + patientLogupdate.typeRespiratory(patientRespiratory); + patientLogupdate.typeSpo2(patientSpo2); + patientLogupdate.selectRhythm(patientRhythmType); + patientLogupdate.typeRhythm(patientRhythm); + cy.get("#consciousness_level-2").click(); + cy.submitButton("Save"); + cy.verifyNotification("Consultation Updates details created successfully"); + // verify the copied previous value + cy.closeNotification(); + patientLogupdate.clickLogupdate(); + patientLogupdate.clickCopyPreviousValue(); + patientLogupdate.selectPatientCategory(patientCategory); + cy.submitButton("Save"); + cy.closeNotification(); + cy.verifyContentPresence("#physical_examination_info", [ + physicalExamination, + ]); + cy.verifyContentPresence("#rhythm_detail", [patientRhythm]); + cy.submitButton("Continue"); + cy.verifyNotification("Consultation Updates details updated successfully"); + }); + + it("Create a new log normal update for a domicilary care patient and edit it", () => { + patientPage.visitPatient(domicilaryPatient); + patientConsultationPage.clickEditConsultationButton(); + patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); + cy.submitButton("Update Consultation"); + cy.verifyNotification("Consultation updated successfully"); + patientLogupdate.clickLogupdate(); + patientLogupdate.typePhysicalExamination(physicalExamination); + patientLogupdate.typeOtherDetails(otherExamination); + patientLogupdate.typeAdditionalSymptoms(additionalSymptoms); + patientLogupdate.selectPatientCategory(patientCategory); + patientLogupdate.typeSystolic(patientSystolic); + patientLogupdate.typeDiastolic(patientDiastolic); + patientLogupdate.typePulse(patientPulse); + patientLogupdate.typeTemperature(patientTemperature); + patientLogupdate.typeRespiratory(patientRespiratory); + patientLogupdate.typeSpo2(patientSpo2); + patientLogupdate.selectRhythm(patientRhythmType); + patientLogupdate.typeRhythm(patientRhythm); + cy.get("#consciousness_level-2").click(); + cy.submitButton("Save"); + cy.verifyNotification("Consultation Updates details created successfully"); + // edit the card and verify the data. + patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory); + cy.verifyContentPresence("#consultation-preview", [ + patientCategory, + patientDiastolic, + patientSystolic, + physicalExamination, + otherExamination, + patientPulse, + patientTemperature, + patientRespiratory, + patientSpo2, + patientRhythm, + ]); + patientLogupdate.clickUpdateDetail(); + patientLogupdate.clickClearButtonInElement("#systolic"); + patientLogupdate.typeSystolic(patientModifiedSystolic); + patientLogupdate.clickClearButtonInElement("#diastolic"); + patientLogupdate.typeDiastolic(patientModifiedDiastolic); + cy.submitButton("Continue"); + cy.verifyNotification("Consultation Updates details updated successfully"); + patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory); + cy.verifyContentPresence("#consultation-preview", [ + patientModifiedDiastolic, + patientModifiedSystolic, + ]); + }); + + it("Create a new log normal update for a admission patient and verify its reflection in cards", () => { + patientPage.visitPatient("Dummy Patient 13"); + patientLogupdate.clickLogupdate(); + cy.verifyNotification("Please assign a bed to the patient"); + patientLogupdate.selectBed("Dummy Bed 6"); + cy.closeNotification(); + patientLogupdate.clickLogupdate(); + patientLogupdate.typePhysicalExamination(physicalExamination); + patientLogupdate.typeOtherDetails(otherExamination); + patientLogupdate.typeAdditionalSymptoms(additionalSymptoms); + patientLogupdate.selectPatientCategory(patientCategory); + patientLogupdate.typeSystolic(patientSystolic); + patientLogupdate.typeDiastolic(patientDiastolic); + patientLogupdate.typePulse(patientPulse); + patientLogupdate.typeTemperature(patientTemperature); + patientLogupdate.typeRespiratory(patientRespiratory); + patientLogupdate.typeSpo2(patientSpo2); + patientLogupdate.selectRhythm(patientRhythmType); + patientLogupdate.typeRhythm(patientRhythm); + cy.get("#consciousness_level-2").click(); + cy.submitButton("Save"); + cy.verifyNotification("Consultation Updates details created successfully"); + // Verify the card content + cy.get("#basic-information").scrollIntoView(); + cy.verifyContentPresence("#basic-information", [additionalSymptoms]); + }); + + afterEach(() => { + cy.saveLocalStorage(); + }); +}); diff --git a/cypress/e2e/patient_spec/patient_registration.cy.ts b/cypress/e2e/patient_spec/patient_registration.cy.ts index eb6bfc079f1..d0ec3d75486 100644 --- a/cypress/e2e/patient_spec/patient_registration.cy.ts +++ b/cypress/e2e/patient_spec/patient_registration.cy.ts @@ -59,6 +59,7 @@ describe("Patient Creation with consultation", () => { const patientTransferFacility = "Dummy Shifting Center"; const patientTransferName = "Dummy Patient 10"; const patientExternalName = "Patient 20"; + const patientOccupation = "Student"; before(() => { loginPage.loginAsDisctrictAdmin(); @@ -88,6 +89,7 @@ describe("Patient Creation with consultation", () => { facilityPage.selectDistrictOnPincode(patientOneDistrict); facilityPage.selectLocalBody(patientOneLocalbody); facilityPage.selectWard(patientOneWard); + patientPage.selectPatientOccupation(patientOccupation); // Patient Medical History patientMedicalHistory.typePatientPresentHealth(patientOnePresentHealth); patientMedicalHistory.typePatientOngoingMedication( @@ -115,7 +117,8 @@ describe("Patient Creation with consultation", () => { phone_number, emergency_phone_number, yearOfBirth, - patientOneBloodGroup + patientOneBloodGroup, + patientOccupation ); patientMedicalHistory.verifyPatientMedicalDetails( patientOnePresentHealth, @@ -202,7 +205,8 @@ describe("Patient Creation with consultation", () => { phone_number, emergency_phone_number, yearOfBirth, - patientOneUpdatedBloodGroup + patientOneUpdatedBloodGroup, + patientOccupation ); // Verify No medical history patientMedicalHistory.verifyNoSymptosPresent("Diabetes"); diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index d88c79dafd7..db72765444f 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -120,6 +120,7 @@ export class PatientConsultationPage { "#consultation-buttons", "Edit Consultation Details" ); + cy.wait(3000); } visitShiftRequestPage() { diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 07d87e024a1..833cd95a3fd 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -21,13 +21,8 @@ export class PatientPage { } selectFacility(facilityName: string) { - cy.get("input[name='facilities']") - .type(facilityName) - .then(() => { - cy.get("[role='option']").contains(facilityName).click(); - }); - cy.get("button").should("contain", "Select"); - cy.get("button").get("#submit").click(); + cy.searchAndSelectOption("input[name='facilities']", facilityName); + cy.submitButton("Select"); } interceptCreatePatientAPI() { @@ -85,19 +80,15 @@ export class PatientPage { } selectPatientGender(gender: string) { - cy.get("[data-testid=Gender] button") - .click() - .then(() => { - cy.get("[role='option']").contains(gender).click(); - }); + cy.clickAndSelectOption("[data-testid=Gender] button", gender); } selectPatientBloodGroup(bloodgroup: string) { - cy.get("#blood_group") - .click() - .then(() => { - cy.get("[role='option']").contains(bloodgroup).click(); - }); + cy.clickAndSelectOption("#blood_group", bloodgroup); + } + + selectPatientOccupation(occupation: string) { + cy.clickAndSelectOption("#occupation", occupation); } clickCreatePatient() { @@ -146,7 +137,8 @@ export class PatientPage { phoneNumber, emergencyPhoneNumber, yearOfBirth, - bloodGroup + bloodGroup, + occupation ) { cy.url().should("include", "/facility/"); cy.get("[data-testid=patient-dashboard]").then(($dashboard) => { @@ -157,6 +149,7 @@ export class PatientPage { expect($dashboard).to.contain(emergencyPhoneNumber); expect($dashboard).to.contain(yearOfBirth); expect($dashboard).to.contain(bloodGroup); + expect($dashboard).to.contain(occupation); }); } diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts new file mode 100644 index 00000000000..8b15e4dd4fe --- /dev/null +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -0,0 +1,88 @@ +class PatientLogupdate { + clickLogupdate() { + cy.get("#log-update").scrollIntoView(); + cy.verifyAndClickElement("#log-update", "Log Update"); + cy.wait(2000); + } + + selectBed(bed: string) { + cy.searchAndSelectOption("input[name='bed']", bed); + cy.submitButton("Move to bed"); + cy.wait(2000); + } + + selectPatientCategory(category: string) { + cy.clickAndSelectOption("#patient_category", category); + } + + typePhysicalExamination(examination: string) { + cy.get("#physical_examination_info").click().type(examination); + cy.get("#physical_examination_info").should("contain", examination); + } + + typeOtherDetails(details: string) { + cy.get("#other_details").click().type(details); + } + + typeAdditionalSymptoms(symptoms: string) { + cy.clickAndSelectOption("#additional_symptoms", symptoms); + } + + typeSystolic(systolic: string) { + cy.searchAndSelectOption("#systolic", systolic); + } + + typeDiastolic(diastolic: string) { + cy.searchAndSelectOption("#diastolic", diastolic); + } + + typePulse(pulse: string) { + cy.searchAndSelectOption("#pulse", pulse); + } + + typeTemperature(temperature: string) { + cy.searchAndSelectOption("#temperature", temperature); + } + + typeRespiratory(respiratory: string) { + cy.searchAndSelectOption("#resp", respiratory); + } + + typeSpo2(spo: string) { + cy.searchAndSelectOption("#ventilator_spo2", spo); + } + + selectRhythm(rhythm: string) { + cy.clickAndSelectOption("#rhythm", rhythm); + } + + typeRhythm(rhythm: string) { + cy.get("#rhythm_detail").click().type(rhythm); + } + + clickLogupdateCard(element, patientCategory) { + cy.get(element).scrollIntoView(); + cy.verifyContentPresence(element, [patientCategory]); + cy.get(element).first().contains("View Details").click(); + cy.wait(3000); + } + + clickUpdateDetail() { + cy.verifyAndClickElement("#consultation-preview", "Update Details"); + cy.wait(3000); + } + + clickClearButtonInElement(elementId) { + cy.get(elementId).find("#clear-button").click(); + } + + clickVitals() { + cy.get("#consultation_tab_nav").scrollIntoView(); + cy.verifyAndClickElement("#consultation_tab_nav", "Vitals"); + } + + clickCopyPreviousValue() { + cy.get("#clone_last").click(); + } +} +export default PatientLogupdate; diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 5170635647e..f4b7becdcae 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -181,3 +181,11 @@ Cypress.Commands.add("closeNotification", () => { cy.wrap($div).click(); }); }); + +Cypress.Commands.add("verifyContentPresence", (selector, texts) => { + cy.get(selector).then(($el) => { + texts.forEach((text) => { + cy.wrap($el).should("contain", text); + }); + }); +}); diff --git a/cypress/support/index.ts b/cypress/support/index.ts index 46e695b6507..fbaaa4f18ea 100644 --- a/cypress/support/index.ts +++ b/cypress/support/index.ts @@ -34,6 +34,10 @@ declare global { ): Chainable; preventPrint(): Chainable; closeNotification(): Chainable; + verifyContentPresence( + selector: string, + texts: string[] + ): Chainable; } } } diff --git a/package-lock.json b/package-lock.json index cf12b803136..6d0c8e57f91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -86,7 +86,7 @@ "@typescript-eslint/parser": "^5.61.0", "@vitejs/plugin-react-swc": "^3.6.0", "autoprefixer": "^10.4.14", - "cypress": "^13.5.0", + "cypress": "^13.7.0", "cypress-localstorage-commands": "^2.2.3", "cypress-split": "^1.20.1", "eslint": "^8.44.0", @@ -8844,21 +8844,20 @@ "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" }, "node_modules/cypress": { - "version": "13.5.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.5.0.tgz", - "integrity": "sha512-oh6U7h9w8wwHfzNDJQ6wVcAeXu31DlIYlNOBvfd6U4CcB8oe4akawQmH+QJVOMZlM42eBoCne015+svVqdwdRQ==", + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.7.0.tgz", + "integrity": "sha512-UimjRSJJYdTlvkChcdcfywKJ6tUYuwYuk/n1uMMglrvi+ZthNhoRYcxnWgTqUtkl17fXrPAsD5XT2rcQYN1xKA==", "dev": true, "hasInstallScript": true, "dependencies": { "@cypress/request": "^3.0.0", "@cypress/xvfb": "^1.2.4", - "@types/node": "^18.17.5", "@types/sinonjs__fake-timers": "8.1.1", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", "blob-util": "^2.0.2", "bluebird": "^3.7.2", - "buffer": "^5.6.0", + "buffer": "^5.7.1", "cachedir": "^2.3.0", "chalk": "^4.1.0", "check-more-types": "^2.24.0", @@ -8876,7 +8875,7 @@ "figures": "^3.2.0", "fs-extra": "^9.1.0", "getos": "^3.2.1", - "is-ci": "^3.0.0", + "is-ci": "^3.0.1", "is-installed-globally": "~0.4.0", "lazy-ass": "^1.6.0", "listr2": "^3.8.3", @@ -8932,15 +8931,6 @@ "cypress-split-preview": "bin/preview.js" } }, - "node_modules/cypress/node_modules/@types/node": { - "version": "18.18.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz", - "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==", - "dev": true, - "dependencies": { - "undici-types": "~5.26.4" - } - }, "node_modules/cypress/node_modules/fs-extra": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", diff --git a/package.json b/package.json index 7e54836df05..dcb0b432c77 100644 --- a/package.json +++ b/package.json @@ -126,7 +126,7 @@ "@typescript-eslint/parser": "^5.61.0", "@vitejs/plugin-react-swc": "^3.6.0", "autoprefixer": "^10.4.14", - "cypress": "^13.5.0", + "cypress": "^13.7.0", "cypress-localstorage-commands": "^2.2.3", "cypress-split": "^1.20.1", "eslint": "^8.44.0", diff --git a/plugins/treeShakeCareIcons.mts b/plugins/treeShakeCareIcons.mts new file mode 100644 index 00000000000..bf1713a0625 --- /dev/null +++ b/plugins/treeShakeCareIcons.mts @@ -0,0 +1,94 @@ +import { Plugin } from "vite"; +import * as fs from "fs"; +import * as path from "path"; +import * as glob from "glob"; + +/** + * Interface defining options for the treeShakeUniconPathsPlugin. + * + * @interface TreeShakeUniconPathsPluginOptions + * @property {string[]} iconWhitelist - An array of icon names to always include, even if not found in code. + */ + +export interface TreeShakeCareIconsOptions { + iconWhitelist: string[]; +} + +/** + * Creates a Webpack plugin that tree-shakes unused Unicon paths from UniconPaths.json in production builds. + * + * @param {TreeShakeCareIconsOptions} [options] - Optional configuration options. Defaults to an empty iconWhitelist. + * @returns {Plugin} Webpack plugin object. + */ + +export function treeShakeCareIcons( + options: TreeShakeCareIconsOptions = { iconWhitelist: [] } +): Plugin { + const rootDir = path.resolve(__dirname, ".."); // update this if moving this code to a different file + const lineIconNameRegex = /"l-[a-z]+(?:-[a-z]+)*"/g; + const allUniconPaths = JSON.parse( + fs.readFileSync( + path.resolve(rootDir, "src/CAREUI/icons/UniconPaths.json"), + "utf8" + ) + ); + + // Extracts icon names from a given file's content. + // Returns an array of icon names like ["l-eye", "l-sync", "l-hearbeat"] + function extractCareIconNames(file: string): string[] { + const fileContent = fs.readFileSync(file, "utf8"); + + const lineIconNameMatches = fileContent.match(lineIconNameRegex) || []; + + const lineIconNames = lineIconNameMatches.map( + (lineIconName) => lineIconName.slice(1, -1) // remove quotes + ); + + return lineIconNames; + } + // Finds all used icon names within the project's source files (`.tsx` or `.res` extensions). + function getAllUsedIconNames() { + const files = glob.sync(path.resolve(rootDir, "src/**/*.{tsx,res}")); + const usedIconsArray: string[] = []; + + files.forEach((file) => { + const iconNames = extractCareIconNames(file); + usedIconsArray.push(...iconNames); + }); + + return new Set(usedIconsArray); + } + // Generates a map of used icon names to their paths from UniconPaths.json, including any whitelisted icons. + function getTreeShakenUniconPaths() { + const usedIcons = [...getAllUsedIconNames(), ...options.iconWhitelist]; + const treeshakenCareIconPaths = {}; + + for (const iconName of usedIcons) { + const path = allUniconPaths[iconName]; + if (path === undefined) { + throw new Error(`Icon ${iconName} is not found in UniconPaths.json`); + } else { + treeshakenCareIconPaths[iconName] = path; + } + } + + return treeshakenCareIconPaths; + } + + return { + name: "tree-shake-care-icons", + transform(_src, id) { + if (process.env.NODE_ENV !== "production") { + return; + } + + // Replace the UniconPaths with the tree-shaken version + if (id.endsWith("UniconPaths.json")) { + return { + code: `export default ${JSON.stringify(getTreeShakenUniconPaths())}`, + map: null, + }; + } + }, + }; +} diff --git a/src/CAREUI/display/RecordMeta.tsx b/src/CAREUI/display/RecordMeta.tsx index 5e1e117f9d6..662c61fd73f 100644 --- a/src/CAREUI/display/RecordMeta.tsx +++ b/src/CAREUI/display/RecordMeta.tsx @@ -44,7 +44,7 @@ const RecordMeta = ({ {user && !inlineUser && ( by - + {formatName(user)} {isOnline && (
@@ -61,7 +61,7 @@ const RecordMeta = ({ {prefix} {child} {user && inlineUser && by} - {user && !inlineUser && } + {user && !inlineUser && } {user && inlineUser && ( {formatName(user)} )} diff --git a/src/CAREUI/display/SubHeading.tsx b/src/CAREUI/display/SubHeading.tsx index 75d8710fdef..a9024e83687 100644 --- a/src/CAREUI/display/SubHeading.tsx +++ b/src/CAREUI/display/SubHeading.tsx @@ -18,7 +18,7 @@ export default function SubHeading(props: Props) { {props.lastModified && (
- +
)} diff --git a/src/CAREUI/display/Timeline.tsx b/src/CAREUI/display/Timeline.tsx index 49ace78bd88..f8e7991d3bf 100644 --- a/src/CAREUI/display/Timeline.tsx +++ b/src/CAREUI/display/Timeline.tsx @@ -23,7 +23,7 @@ const TimelineContext = createContext(""); export default function Timeline({ className, children, name }: TimelineProps) { return ( -
+
    {children} diff --git a/src/CAREUI/icons/CareIcon.tsx b/src/CAREUI/icons/CareIcon.tsx index 27a4abe97b4..90a59d972cb 100644 --- a/src/CAREUI/icons/CareIcon.tsx +++ b/src/CAREUI/icons/CareIcon.tsx @@ -6,7 +6,7 @@ import iconData from "./UniconPaths.json"; export type IconName = keyof typeof iconData; export interface CareIconProps { - icon?: IconName; + icon: IconName; className?: string | undefined; onClick?: React.MouseEventHandler | undefined; id?: string; @@ -16,7 +16,7 @@ export interface CareIconProps { * ### CARE's Official Icon Library. * @param className icon class name * @returns icon component - * @example ``` ``` + * @example ``` ``` * * @see [icon library](https://iconscout.com/unicons/) */ diff --git a/src/CAREUI/interactive/FiltersSlideover.tsx b/src/CAREUI/interactive/FiltersSlideover.tsx index 9b2e5a29c29..83f92e2bd90 100644 --- a/src/CAREUI/interactive/FiltersSlideover.tsx +++ b/src/CAREUI/interactive/FiltersSlideover.tsx @@ -36,7 +36,7 @@ export default function FiltersSlideover({ onClick={onClear} id="clear-filter" > - + {t("clear")} @@ -62,7 +62,7 @@ export const AdvancedFilterButton = ({ onClick }: { onClick: () => void }) => { onClick={onClick} id="advanced-filter" > - + {t("advanced_filters")} ); diff --git a/src/CAREUI/interactive/LegendInput.tsx b/src/CAREUI/interactive/LegendInput.tsx index 789412d7635..b057e7772c5 100644 --- a/src/CAREUI/interactive/LegendInput.tsx +++ b/src/CAREUI/interactive/LegendInput.tsx @@ -144,7 +144,8 @@ export default function LegendInput(props: InputProps) { onClick={() => setShowPassword(!showPassword)} > )} diff --git a/src/CAREUI/interactive/SlideOver.tsx b/src/CAREUI/interactive/SlideOver.tsx index 9fae2588fca..a92344c41ba 100644 --- a/src/CAREUI/interactive/SlideOver.tsx +++ b/src/CAREUI/interactive/SlideOver.tsx @@ -116,7 +116,7 @@ export default function SlideOver({ onCloseClick && onCloseClick(); }} > - +

    {title}

    diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 9231a258463..3ead71c6e1e 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -743,7 +743,7 @@ export const GENDER: { [key: number]: string } = GENDER_TYPES.reduce( ); export type CameraPTZ = { - icon?: string; + icon?: IconName; label: string; action: string; loadingLabel?: string; @@ -1248,3 +1248,15 @@ export const IN_LANDLINE_AREA_CODES = [ "891", "4822", ]; +export const OCCUPATION_TYPES = [ + { id: 1, text: "Student", value: "STUDENT" }, + { + id: 2, + text: "Businessman", + value: "BUSINESSMAN", + }, + { id: 3, text: "Healthcare Worker", value: "HEALTH_CARE_WORKER" }, + { id: 4, text: "Healthcare Lab Worker", value: "HEALTH_CARE_LAB_WORKER" }, + { id: 5, text: "Animal Handler", value: "ANIMAL_HANDLER" }, + { id: 6, text: "Others", value: "OTHERS" }, +]; diff --git a/src/Common/hooks/useRangePagination.ts b/src/Common/hooks/useRangePagination.ts index 7652ae546c1..b7c8b8510a5 100644 --- a/src/Common/hooks/useRangePagination.ts +++ b/src/Common/hooks/useRangePagination.ts @@ -19,7 +19,7 @@ const useRangePagination = ({ bounds, perPage, ...props }: Props) => { useEffect(() => { setCurrentRange(getInitialBounds(bounds, perPage, props.defaultEnd)); - }, [bounds, perPage, props.defaultEnd]); + }, [JSON.stringify(bounds), perPage, props.defaultEnd]); const next = () => { const { end } = currentRange; diff --git a/src/Components/ABDM/ABHAProfileModal.tsx b/src/Components/ABDM/ABHAProfileModal.tsx index cc16fd45b8d..be991bb8f55 100644 --- a/src/Components/ABDM/ABHAProfileModal.tsx +++ b/src/Components/ABDM/ABHAProfileModal.tsx @@ -54,11 +54,13 @@ const ABHAProfileModal = ({ patientId, show, onClose, abha }: IProps) => {
    downloadAbhaCard("pdf")} - className="care-l-print cursor-pointer" + icon="l-print" + className="cursor-pointer" /> downloadAbhaCard("png")} - className="care-l-import cursor-pointer" + icon="l-import" + className="cursor-pointer" />
    diff --git a/src/Components/ABDM/LinkABHANumberModal.tsx b/src/Components/ABDM/LinkABHANumberModal.tsx index 6297b11152f..4aed5e0ee8f 100644 --- a/src/Components/ABDM/LinkABHANumberModal.tsx +++ b/src/Components/ABDM/LinkABHANumberModal.tsx @@ -59,7 +59,7 @@ export default function LinkABHANumberModal({ const title = (
    - +

    {currentStep === "ScanExistingQR" ? "Link Existing ABHA Number" @@ -752,7 +752,7 @@ const VerifyMobileSection = ({ /> ) : (

    - OTP is + OTP is generated if the above phone number is not linked with given Aadhaar number.

    @@ -833,7 +833,7 @@ const CreateHealthIDSection = ({ />

    - Existing + Existing ABHA Address is used if ABHA Number already exists.

    diff --git a/src/Components/Assets/AssetManage.tsx b/src/Components/Assets/AssetManage.tsx index 661043ba697..3e199c9d34e 100644 --- a/src/Components/Assets/AssetManage.tsx +++ b/src/Components/Assets/AssetManage.tsx @@ -271,7 +271,7 @@ const AssetManage = (props: AssetManageProps) => {
    - +
    {item.label}
    @@ -332,7 +332,7 @@ const AssetManage = (props: AssetManageProps) => { ghost border > - + Export as JSON } @@ -357,7 +357,8 @@ const AssetManage = (props: AssetManageProps) => {
    {assetClassProp.name}
    @@ -397,17 +398,17 @@ const AssetManage = (props: AssetManageProps) => { {[ { label: asset?.location_object.facility.name, - icon: "location-pin-alt", + icon: "l-location-pin-alt", content: asset?.location_object.name, }, { label: "Asset QR Code ID", - icon: "qrcode-scan", + icon: "l-qrcode-scan", content: asset?.qr_code_id, }, { label: "Not working reason", - icon: "exclamation-circle", + icon: "l-exclamation-circle", content: asset?.not_working_reason, hide: asset?.is_working, }, @@ -425,7 +426,7 @@ const AssetManage = (props: AssetManageProps) => { data-testid="asset-update-button" authorizeFor={NonReadOnlyUsers} > - + {t("update")} {asset?.asset_class && @@ -442,7 +443,7 @@ const AssetManage = (props: AssetManageProps) => { id="configure-asset" data-testid="asset-configure-button" > - + {t("configure")} )} @@ -454,7 +455,7 @@ const AssetManage = (props: AssetManageProps) => { data-testid="asset-delete-button" className="inline-flex" > - + {t("delete")} )} @@ -467,14 +468,14 @@ const AssetManage = (props: AssetManageProps) => { {[ { label: "Last serviced on", - icon: "wrench", + icon: "l-wrench", content: asset?.last_service?.serviced_on && formatDate(asset?.last_service?.serviced_on), }, { label: "Notes", - icon: "notes", + icon: "l-notes", content: asset?.last_service?.note, }, ].map(detailBlock)} diff --git a/src/Components/Assets/AssetType/HL7Monitor.tsx b/src/Components/Assets/AssetType/HL7Monitor.tsx index cca0a7571b8..6583157018d 100644 --- a/src/Components/Assets/AssetType/HL7Monitor.tsx +++ b/src/Components/Assets/AssetType/HL7Monitor.tsx @@ -116,7 +116,7 @@ const HL7Monitor = (props: HL7MonitorProps) => { error={ipadrdress_error} /> - + Save Configuration
    diff --git a/src/Components/Assets/AssetTypes.tsx b/src/Components/Assets/AssetTypes.tsx index 39fff240efb..e3dee31bb7f 100644 --- a/src/Components/Assets/AssetTypes.tsx +++ b/src/Components/Assets/AssetTypes.tsx @@ -1,3 +1,4 @@ +import { IconName } from "../../CAREUI/icons/CareIcon"; import { BedModel } from "../Facility/models"; import { PerformedByModel } from "../HCX/misc"; import { PatientModel } from "../Patient/models"; @@ -42,25 +43,31 @@ export const AssetStatus = { maintenance: "Under Maintenance", }; -export const assetClassProps = { +export const assetClassProps: { + [key in AssetClass]: { + name: string; + description?: string; + icon: IconName; + }; +} = { ONVIF: { name: "ONVIF Camera", description: "", - icon: "camera", + icon: "l-camera", }, HL7MONITOR: { name: "HL7 Vitals Monitor", description: "", - icon: "monitor-heart-rate", + icon: "l-monitor-heart-rate", }, VENTILATOR: { name: "Ventilator", description: "", - icon: "lungs", + icon: "l-lungs", }, NONE: { name: "N/A", - icon: "box", + icon: "l-box", }, }; diff --git a/src/Components/Assets/AssetWarrantyCard.tsx b/src/Components/Assets/AssetWarrantyCard.tsx index 2e5fa74b9c6..63636fea694 100644 --- a/src/Components/Assets/AssetWarrantyCard.tsx +++ b/src/Components/Assets/AssetWarrantyCard.tsx @@ -1,6 +1,6 @@ -import CareIcon from "../../CAREUI/icons/CareIcon"; +import CareIcon, { IconName } from "../../CAREUI/icons/CareIcon"; import { AssetData } from "./AssetTypes"; -import { classNames, formatDate } from "../../Utils/utils"; +import { formatDate } from "../../Utils/utils"; import CopyToClipboard from "react-copy-to-clipboard"; import { t } from "i18next"; import { useEffect, useState } from "react"; @@ -52,7 +52,7 @@ export default function AssetWarrantyCard(props: { asset: AssetData }) { {t("copied_to_clipboard")} ) : ( - + )} Copy to clipboard @@ -72,8 +72,8 @@ export default function AssetWarrantyCard(props: { asset: AssetData }) {

    {[ - ["Phone", asset.support_phone, "phone"], - ["Email", asset.support_email, "envelope"], + ["Phone", asset.support_phone, "l-phone"], + ["Email", asset.support_email, "l-envelope"], ].map((item) => (
    {item[1] && ( @@ -85,9 +85,7 @@ export default function AssetWarrantyCard(props: { asset: AssetData }) { } className="border-b border-primary-300 text-primary-300 hover:text-primary-400" > - + {item[1]} diff --git a/src/Components/Assets/AssetsList.tsx b/src/Components/Assets/AssetsList.tsx index 228e940de29..9596ceb7faa 100644 --- a/src/Components/Assets/AssetsList.tsx +++ b/src/Components/Assets/AssetsList.tsx @@ -200,13 +200,14 @@ const AssetsList = () => {

    {

    - + {asset?.location_object?.name} - + {asset?.location_object?.facility?.name}

    @@ -272,7 +279,10 @@ const AssetsList = () => { label: "Import Assets", options: { icon: ( - + ), onClick: () => setImportAssetModalOpen(true), }, @@ -289,7 +299,7 @@ const AssetsList = () => { type: "json", filePrefix: `assets_${facility?.name ?? "all"}`, options: { - icon: , + icon: , disabled: totalCount === 0 || !authorizedForImportExport, id: "export-json-option", }, @@ -306,7 +316,7 @@ const AssetsList = () => { type: "csv", filePrefix: `assets_${facility?.name ?? "all"}`, options: { - icon: , + icon: , disabled: totalCount === 0 || !authorizedForImportExport, id: "export-csv-option", }, @@ -364,7 +374,7 @@ const AssetsList = () => { } }} > - + {t("create_asset")}
    diff --git a/src/Components/Auth/Login.tsx b/src/Components/Auth/Login.tsx index 9e2e4f6686a..4c88e6e5aea 100644 --- a/src/Components/Auth/Login.tsx +++ b/src/Components/Auth/Login.tsx @@ -368,7 +368,7 @@ export const Login = (props: { forgot?: boolean }) => { className="mb-4 text-sm text-primary-400 hover:text-primary-500" >
    - + {t("back_to_login")}
    diff --git a/src/Components/CameraFeed/CentralLiveMonitoring/LiveMonitoringFilters.tsx b/src/Components/CameraFeed/CentralLiveMonitoring/LiveMonitoringFilters.tsx index 628518191de..e2931a816bc 100644 --- a/src/Components/CameraFeed/CentralLiveMonitoring/LiveMonitoringFilters.tsx +++ b/src/Components/CameraFeed/CentralLiveMonitoring/LiveMonitoringFilters.tsx @@ -7,7 +7,6 @@ import useFilters from "../../../Common/hooks/useFilters"; import { Fragment } from "react"; import CareIcon from "../../../CAREUI/icons/CareIcon"; import useSlug from "../../../Common/hooks/useSlug"; -import { classNames } from "../../../Utils/utils"; interface Props { perPageLimit: number; @@ -27,7 +26,7 @@ const LiveMonitoringFilters = (props: Props) => { - + Settings and Filters @@ -112,12 +111,12 @@ const LiveMonitoringFilters = (props: Props) => { className="tooltip !h-11" > {props.isFullscreen ? "Exit Fullscreen" : "Fullscreen"} diff --git a/src/Components/Common/Breadcrumbs.tsx b/src/Components/Common/Breadcrumbs.tsx index b6c39a38ef1..c0f6ab9b349 100644 --- a/src/Components/Common/Breadcrumbs.tsx +++ b/src/Components/Common/Breadcrumbs.tsx @@ -55,7 +55,7 @@ export default function Breadcrumbs(props: any) {
  1. - + Home
    diff --git a/src/Components/Common/DateInputV2.tsx b/src/Components/Common/DateInputV2.tsx index bce5f24b11c..47ac41f5d71 100644 --- a/src/Components/Common/DateInputV2.tsx +++ b/src/Components/Common/DateInputV2.tsx @@ -249,7 +249,10 @@ const DateInputV2: React.FC = ({ value={value && dayjs(value).format("DD/MM/YYYY")} />
    - +
    @@ -296,7 +299,7 @@ const DateInputV2: React.FC = ({ className="inline-flex aspect-square cursor-pointer items-center justify-center rounded p-2 transition duration-100 ease-in-out hover:bg-gray-300" onClick={decrement} > - +
    @@ -329,7 +332,7 @@ const DateInputV2: React.FC = ({ className="inline-flex aspect-square cursor-pointer items-center justify-center rounded p-2 transition duration-100 ease-in-out hover:bg-gray-300" onClick={increment} > - +
diff --git a/src/Components/Common/Export.tsx b/src/Components/Common/Export.tsx index 7ddaca115bd..e94a2826398 100644 --- a/src/Components/Common/Export.tsx +++ b/src/Components/Common/Export.tsx @@ -39,12 +39,31 @@ export const ExportMenu = ({ }: ExportMenuProps) => { const { isExporting, exportFile } = useExport(); + if (exportItems.length === 1) { + const item = exportItems[0]; + + return ( + + exportFile(item.action, item.filePrefix, item.type, item.parse) + } + border + ghost + className="py-2.5" + > + + {isExporting ? "Exporting..." : label} + + ); + } + return (
} + icon={} className="tooltip border-primary-500 bg-white text-primary-500 hover:bg-primary-100 enabled:border" > {exportItems.map((item) => ( @@ -84,9 +103,9 @@ export const ExportButton = ({ circle > {isExporting ? ( - + ) : ( - + )} {props.tooltip || "Export"} diff --git a/src/Components/Common/GLocationPicker.tsx b/src/Components/Common/GLocationPicker.tsx index fc121b8519f..6fc1a4c2b6c 100644 --- a/src/Components/Common/GLocationPicker.tsx +++ b/src/Components/Common/GLocationPicker.tsx @@ -220,7 +220,10 @@ const Map: React.FC = ({ ref={mapCloseRef} onClick={handleOnClose} > - +
)} @@ -235,7 +238,10 @@ const Map: React.FC = ({ ) } > - +
)} diff --git a/src/Components/Common/LanguageSelector.tsx b/src/Components/Common/LanguageSelector.tsx index 4a4f67b993e..8ae1b187c89 100644 --- a/src/Components/Common/LanguageSelector.tsx +++ b/src/Components/Common/LanguageSelector.tsx @@ -38,7 +38,10 @@ export const LanguageSelector = (props: any) => { ))}
- +
); diff --git a/src/Components/Common/Pagination.tsx b/src/Components/Common/Pagination.tsx index e86c9b7a491..0f988874257 100644 --- a/src/Components/Common/Pagination.tsx +++ b/src/Components/Common/Pagination.tsx @@ -94,12 +94,12 @@ const Pagination = ({ tooltip="Previous" onClick={() => goToPage(currentPage - 1)} disabled={currentPage - 1 <= 0} - children={} + children={} /> } + children={} onClick={() => goToPage(currentPage + 1)} disabled={currentPage + 1 > totalPage} /> @@ -110,7 +110,7 @@ const Pagination = ({ } + children={} onClick={() => goToPage(1)} disabled={currentPage === 1} /> @@ -119,7 +119,7 @@ const Pagination = ({ tooltip="Previous" onClick={() => goToPage(currentPage - 1)} disabled={currentPage - 1 <= 0} - children={} + children={} /> {pageNumbers.map((page) => ( @@ -137,14 +137,16 @@ const Pagination = ({ } + children={} onClick={() => goToPage(currentPage + 1)} disabled={currentPage + 1 > totalPage} /> } + children={ + + } onClick={() => goToPage(totalPage)} disabled={totalPage === 0 || currentPage === totalPage} /> diff --git a/src/Components/Common/QRScanner.tsx b/src/Components/Common/QRScanner.tsx index b4d618ec7dc..4b744ba2eeb 100644 --- a/src/Components/Common/QRScanner.tsx +++ b/src/Components/Common/QRScanner.tsx @@ -73,8 +73,9 @@ const QRScanner = ({ setShowScanner(true)} - className="care-l-focus z-50 cursor-pointer text-black" + className="z-50 cursor-pointer text-black" /> } error={error} diff --git a/src/Components/Common/RelativeDateUserMention.tsx b/src/Components/Common/RelativeDateUserMention.tsx index 2af92268987..70eadc5b7ed 100644 --- a/src/Components/Common/RelativeDateUserMention.tsx +++ b/src/Components/Common/RelativeDateUserMention.tsx @@ -33,7 +33,10 @@ function RelativeDateUserMention(props: {

{props.user.user_type}

- + )} diff --git a/src/Components/Common/Sidebar/Sidebar.tsx b/src/Components/Common/Sidebar/Sidebar.tsx index 747fa3949da..c611b26f2e5 100644 --- a/src/Components/Common/Sidebar/Sidebar.tsx +++ b/src/Components/Common/Sidebar/Sidebar.tsx @@ -3,7 +3,7 @@ import { SidebarItem, ShrinkedSidebarItem } from "./SidebarItem"; import SidebarUserCard from "./SidebarUserCard"; import NotificationItem from "../../Notifications/NotificationsList"; import useActiveLink from "../../../Common/hooks/useActiveLink"; -import CareIcon from "../../../CAREUI/icons/CareIcon"; +import CareIcon, { IconName } from "../../../CAREUI/icons/CareIcon"; import useConfig from "../../../Common/hooks/useConfig"; import SlideOver from "../../../CAREUI/interactive/SlideOver"; import { classNames } from "../../../Utils/utils"; @@ -36,26 +36,30 @@ const StatelessSidebar = ({ }: StatelessSidebarProps) => { const authUser = useAuthUser(); - const NavItems = [ - { text: "Facilities", to: "/facility", icon: "care-l-hospital" }, - { text: "Patients", to: "/patients", icon: "care-l-user-injured" }, - { text: "Assets", to: "/assets", icon: "care-l-shopping-cart-alt" }, - { text: "Sample Test", to: "/sample", icon: "care-l-medkit" }, - { text: "Shifting", to: "/shifting", icon: "care-l-ambulance" }, - { text: "Resource", to: "/resource", icon: "care-l-heart-medical" }, + const NavItems: { + text: string; + to: string; + icon: IconName; + }[] = [ + { text: "Facilities", to: "/facility", icon: "l-hospital" }, + { text: "Patients", to: "/patients", icon: "l-user-injured" }, + { text: "Assets", to: "/assets", icon: "l-shopping-cart-alt" }, + { text: "Sample Test", to: "/sample", icon: "l-medkit" }, + { text: "Shifting", to: "/shifting", icon: "l-ambulance" }, + { text: "Resource", to: "/resource", icon: "l-heart-medical" }, ...(!["Nurse", "NurseReadOnly", "Staff", "StaffReadOnly"].includes( authUser.user_type ) - ? [ + ? ([ { text: "External Results", to: "/external_results", - icon: "care-l-clipboard-notes", + icon: "l-clipboard-notes", }, - ] + ] as const) : []), - { text: "Users", to: "/users", icon: "care-l-users-alt" }, - { text: "Notice Board", to: "/notice_board", icon: "care-l-meeting-board" }, + { text: "Users", to: "/users", icon: "l-users-alt" }, + { text: "Notice Board", to: "/notice_board", icon: "l-meeting-board" }, ]; const { main_logo } = useConfig(); @@ -134,7 +138,7 @@ const StatelessSidebar = ({ ref={i.to === activeLink ? activeLinkRef : undefined} key={i.text} {...i} - icon={} + icon={} selected={i.to === activeLink} do={() => onItemClick && onItemClick(false)} handleOverflow={handleOverflow} @@ -151,7 +155,7 @@ const StatelessSidebar = ({ } + icon={} external handleOverflow={handleOverflow} /> diff --git a/src/Components/Common/Sidebar/SidebarItem.tsx b/src/Components/Common/Sidebar/SidebarItem.tsx index 20ffec4217e..90698aa3bbc 100644 --- a/src/Components/Common/Sidebar/SidebarItem.tsx +++ b/src/Components/Common/Sidebar/SidebarItem.tsx @@ -66,7 +66,7 @@ const SidebarItemBase = forwardRef( {t(props.text)} {external && !shrinked && ( - + )} diff --git a/src/Components/Common/Sidebar/SidebarUserCard.tsx b/src/Components/Common/Sidebar/SidebarUserCard.tsx index 75cf2d9ce43..d083867738c 100644 --- a/src/Components/Common/Sidebar/SidebarUserCard.tsx +++ b/src/Components/Common/Sidebar/SidebarUserCard.tsx @@ -16,11 +16,12 @@ const SidebarUserCard = ({ shrinked }: { shrinked: boolean }) => { } transition-all duration-200 ease-in-out`} > - +
@@ -44,9 +45,8 @@ const SidebarUserCard = ({ shrinked }: { shrinked: boolean }) => { onClick={signOut} >

{t("sign_out")}

diff --git a/src/Components/Common/SortDropdown.tsx b/src/Components/Common/SortDropdown.tsx index e979d89375e..b29662de0a7 100644 --- a/src/Components/Common/SortDropdown.tsx +++ b/src/Components/Common/SortDropdown.tsx @@ -24,7 +24,7 @@ export default function SortDropdownMenu(props: Props) { title={props.label ?? t("sort_by")} variant="secondary" className="border border-primary-500 bg-white" - icon={} + icon={} > {props.options.map(({ isAscending, value }) => ( props.onSelect({ ordering: value })} icon={ } > diff --git a/src/Components/Common/Steps.tsx b/src/Components/Common/Steps.tsx index 497682c3bf8..e0b1e03af3f 100644 --- a/src/Components/Common/Steps.tsx +++ b/src/Components/Common/Steps.tsx @@ -29,7 +29,8 @@ export default function Steps(props: { steps: Step[] }) { diff --git a/src/Components/Common/SymptomsSelect.tsx b/src/Components/Common/SymptomsSelect.tsx index e96c8070e3a..f16744b7343 100644 --- a/src/Components/Common/SymptomsSelect.tsx +++ b/src/Components/Common/SymptomsSelect.tsx @@ -51,7 +51,7 @@ export const SymptomsSelect = (props: FormFieldBaseProps) => { if (value.includes(ASYMPTOMATIC_ID) && id !== ASYMPTOMATIC_ID) return (
- + also unselects Asymptomatic @@ -61,7 +61,7 @@ export const SymptomsSelect = (props: FormFieldBaseProps) => { if (!value.includes(ASYMPTOMATIC_ID) && id === ASYMPTOMATIC_ID) return ( - + {`also unselects the other ${value.length} option(s)`} ); diff --git a/src/Components/Common/TemperatureFormField.tsx b/src/Components/Common/TemperatureFormField.tsx index 4a40781a141..2d81ab3d8df 100644 --- a/src/Components/Common/TemperatureFormField.tsx +++ b/src/Components/Common/TemperatureFormField.tsx @@ -3,7 +3,6 @@ import { FormFieldBaseProps } from "../Form/FormFields/Utils"; import RangeAutocompleteFormField from "../Form/FormFields/RangeAutocompleteFormField"; import CareIcon from "../../CAREUI/icons/CareIcon"; import ButtonV2 from "./components/ButtonV2"; -import { classNames } from "../../Utils/utils"; type TemperatureUnit = "celsius" | "fahrenheit"; @@ -24,31 +23,31 @@ export default function TemperatureFormField(props: Props) { { value: 95, label: "Low", - icon: , + icon: , className: "text-danger-500", }, { value: 96.6, label: "Low", - icon: , + icon: , className: "text-warning-500", }, { value: 97.6, label: "Normal", - icon: , + icon: , className: "text-primary-500", }, { value: 99.6, label: "High", - icon: , + icon: , className: "text-warning-500", }, { value: 101.6, label: "High", - icon: , + icon: , className: "text-danger-500", }, ]} @@ -66,7 +65,10 @@ export default function TemperatureFormField(props: Props) { border onClick={() => setUnit(unit === "celsius" ? "fahrenheit" : "celsius")} > - + } /> diff --git a/src/Components/Common/UpdatableApp.tsx b/src/Components/Common/UpdatableApp.tsx index 8b200d5da0e..1fd44da1672 100644 --- a/src/Components/Common/UpdatableApp.tsx +++ b/src/Components/Common/UpdatableApp.tsx @@ -121,6 +121,7 @@ const UpdateAppPopup = ({ onUpdate }: UpdateAppPopupProps) => {
{
- +

Updated successfully

diff --git a/src/Components/Common/components/ButtonV2.tsx b/src/Components/Common/components/ButtonV2.tsx index 2f3d3002451..4dc6c71ac82 100644 --- a/src/Components/Common/components/ButtonV2.tsx +++ b/src/Components/Common/components/ButtonV2.tsx @@ -171,7 +171,7 @@ export const Submit = ({ label = "Submit", ...props }: CommonButtonProps) => { type="submit" children={ <> - + {t(label)} } @@ -191,7 +191,7 @@ export const Cancel = ({ label = "Cancel", ...props }: CommonButtonProps) => { border children={ <> - + {t(label)} } diff --git a/src/Components/Common/components/ContactLink.tsx b/src/Components/Common/components/ContactLink.tsx index f78b32863c4..762558f5bb2 100644 --- a/src/Components/Common/components/ContactLink.tsx +++ b/src/Components/Common/components/ContactLink.tsx @@ -12,9 +12,8 @@ export default function ContactLink(props: ContactLinkProps) { className=" flex items-center gap-2 border-b border-blue-500 text-base font-medium tracking-wider text-blue-500" > {props.tel ? props.tel : props.mailto} diff --git a/src/Components/Common/components/SwitchTabs.tsx b/src/Components/Common/components/SwitchTabs.tsx index a7872d5a400..6bf510c085e 100644 --- a/src/Components/Common/components/SwitchTabs.tsx +++ b/src/Components/Common/components/SwitchTabs.tsx @@ -4,8 +4,8 @@ import { classNames } from "../../../Utils/utils"; export default function SwitchTabs(props: { className?: string; isTab2Active: boolean; - onClickTab1: () => void; - onClickTab2: () => void; + onClickTab1?: () => void; + onClickTab2?: () => void; tab1: ReactNode; tab2: ReactNode; }) { diff --git a/src/Components/Common/prescription-builder/InvestigationBuilder.tsx b/src/Components/Common/prescription-builder/InvestigationBuilder.tsx index 7cf7e3024ad..6ccef78e6ec 100644 --- a/src/Components/Common/prescription-builder/InvestigationBuilder.tsx +++ b/src/Components/Common/prescription-builder/InvestigationBuilder.tsx @@ -142,7 +142,7 @@ export default function InvestigationBuilder( } > Delete Investigation - +

diff --git a/src/Components/Common/prescription-builder/ProcedureBuilder.tsx b/src/Components/Common/prescription-builder/ProcedureBuilder.tsx index a42f2bab19d..1c773482464 100644 --- a/src/Components/Common/prescription-builder/ProcedureBuilder.tsx +++ b/src/Components/Common/prescription-builder/ProcedureBuilder.tsx @@ -60,7 +60,7 @@ export default function ProcedureBuilder(props: Props) { } > Delete Procedure - +
diff --git a/src/Components/CriticalCareRecording/Pain/CriticalCare__PainInputModal.res b/src/Components/CriticalCareRecording/Pain/CriticalCare__PainInputModal.res index eb4fd2b2376..5626adff453 100644 --- a/src/Components/CriticalCareRecording/Pain/CriticalCare__PainInputModal.res +++ b/src/Components/CriticalCareRecording/Pain/CriticalCare__PainInputModal.res @@ -138,8 +138,12 @@ let make = ( ?
-
+
, + icon: , onClick: () => setImportModalOpen(true), }, }, @@ -261,7 +261,7 @@ export default function ResultList() { ), filePrefix: "external_results", options: { - icon: , + icon: , }, }, ]} diff --git a/src/Components/Facility/AssetCreate.tsx b/src/Components/Facility/AssetCreate.tsx index eba5d89a0b3..a0fa23e74c4 100644 --- a/src/Components/Facility/AssetCreate.tsx +++ b/src/Components/Facility/AssetCreate.tsx @@ -390,7 +390,7 @@ const AssetCreate = (props: AssetProps) => {

- +

@@ -673,7 +673,10 @@ const AssetCreate = (props: AssetProps) => { className="ml-1 mt-1 flex h-10 cursor-pointer items-center justify-self-end rounded border border-gray-400 px-4 hover:bg-gray-200" onClick={() => setIsScannerActive(true)} > - +

diff --git a/src/Components/Facility/BedManagement.tsx b/src/Components/Facility/BedManagement.tsx index d8799f1fbc5..e0d7c99b3b6 100644 --- a/src/Components/Facility/BedManagement.tsx +++ b/src/Components/Facility/BedManagement.tsx @@ -120,7 +120,7 @@ const BedRow = (props: BedRowProps) => { border ghost > - + Edit { tooltip={isOccupied ? "Bed is occupied" : undefined} tooltipClassName="w-full lg:w-auto" > - + Delete
@@ -222,7 +222,7 @@ export const BedManagement = (props: BedManagementProps) => { href={`/facility/${facilityId}/location/${locationId}/beds/add`} authorizeFor={NonReadOnlyUsers} > - + Add New Bed(s)
diff --git a/src/Components/Facility/CentralNursingStation.tsx b/src/Components/Facility/CentralNursingStation.tsx index e063292cf2f..2b938d2af07 100644 --- a/src/Components/Facility/CentralNursingStation.tsx +++ b/src/Components/Facility/CentralNursingStation.tsx @@ -6,7 +6,6 @@ import Loading from "../Common/Loading"; import Page from "../Common/components/Page"; import ButtonV2 from "../Common/components/ButtonV2"; import CareIcon from "../../CAREUI/icons/CareIcon"; -import { classNames } from "../../Utils/utils"; import { LocationSelect } from "../Common/LocationSelect"; import Pagination from "../Common/Pagination"; import { Popover, Transition } from "@headlessui/react"; @@ -82,7 +81,7 @@ export default function CentralNursingStation({ facilityId }: Props) { - + Settings and Filters @@ -138,10 +137,10 @@ export default function CentralNursingStation({ facilityId }: Props) { optionLabel={({ value }) => t("SortOptions." + value)} optionIcon={({ isAscending }) => ( )} @@ -166,12 +165,12 @@ export default function CentralNursingStation({ facilityId }: Props) { className="tooltip !h-11" > {isFullscreen ? "Exit Fullscreen" : "Fullscreen"} diff --git a/src/Components/Facility/ConsultationDetails/ConsultationInvestigationsTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationInvestigationsTab.tsx index 69b11a30ed5..470658f4e52 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationInvestigationsTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationInvestigationsTab.tsx @@ -23,7 +23,7 @@ export const ConsultationInvestigationsTab = (props: ConsultationTabProps) => { ) } > - + {t("log_lab_results")} diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx index fdbf4846329..e8a64b5310d 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx @@ -130,7 +130,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { )}
-
+
{ //

{diagnosis.label}

//
// - // + // // //
//
diff --git a/src/Components/Facility/ConsultationDoctorNotes/index.tsx b/src/Components/Facility/ConsultationDoctorNotes/index.tsx index cf0f78a39bb..9d2af1461c1 100644 --- a/src/Components/Facility/ConsultationDoctorNotes/index.tsx +++ b/src/Components/Facility/ConsultationDoctorNotes/index.tsx @@ -143,7 +143,7 @@ const ConsultationDoctorNotes = (props: ConsultationDoctorNotesProps) => { disabled={!patientActive} authorizeFor={NonReadOnlyUsers} > - +
diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 70e78ccb3c8..ea49f24871b 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -267,26 +267,26 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { const sections = { "Consultation Details": { - iconClass: "care-l-medkit", + iconClass: "l-medkit", visible: consultationDetailsVisible, ref: consultationDetailsRef, }, Diagnosis: { - iconClass: "care-l-stethoscope", + iconClass: "l-stethoscope", visible: diagnosisVisible, ref: diagnosisRef, }, "Treatment Plan": { - iconClass: "care-l-clipboard-alt", + iconClass: "l-clipboard-alt", visible: treatmentPlanVisible, ref: treatmentPlanRef, }, "Bed Status": { - iconClass: "care-l-bed", + iconClass: "l-bed", visible: bedStatusVisible, ref: bedStatusRef, }, - }; + } as const; useEffect(() => { setCurrentSection((prev) => { @@ -838,7 +838,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { className="col-span-6 -ml-2 mb-6 flex flex-row items-center" ref={section.ref as LegacyRef} > - +
{" "} 0.85 ? "text-white" : "text-primary-600" @@ -241,7 +245,7 @@ export const FacilityCard = (props: { facility: any; userType: any }) => { className="h-[38px]" onClick={(_) => setNotifyModalFor(facility.id)} > - + Notify )} @@ -252,7 +256,7 @@ export const FacilityCard = (props: { facility: any; userType: any }) => { ghost className="h-[38px]" > - + {t("view_faciliy")} @@ -263,7 +267,7 @@ export const FacilityCard = (props: { facility: any; userType: any }) => { border ghost > - + {t("view_patients")} {/* */} diff --git a/src/Components/Facility/FacilityCreate.tsx b/src/Components/Facility/FacilityCreate.tsx index f52df5e95ee..ab711058204 100644 --- a/src/Components/Facility/FacilityCreate.tsx +++ b/src/Components/Facility/FacilityCreate.tsx @@ -752,7 +752,7 @@ export const FacilityCreate = (props: FacilityProps) => { /> {showAutoFilledPincode && (
- + State and district auto-filled from pincode @@ -930,7 +930,7 @@ export const FacilityCreate = (props: FacilityProps) => { id="facility-location-button" className="tooltip p-2" > - + Select location from map diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx index 1c6feee2383..0f068e72aed 100644 --- a/src/Components/Facility/FacilityHome.tsx +++ b/src/Components/Facility/FacilityHome.tsx @@ -38,7 +38,7 @@ export const getFacilityFeatureIcon = (featureId: number) => { const feature = FACILITY_FEATURE_TYPES.find((f) => f.id === featureId); if (!feature?.icon) return null; return typeof feature.icon === "string" ? ( - + ) : ( feature.icon ); @@ -315,13 +315,13 @@ export const FacilityHome = (props: any) => { } + icon={} > navigate(`/facility/${facilityId}/update`)} authorizeFor={NonReadOnlyUsers} - icon={} + icon={} > Update Facility @@ -329,14 +329,14 @@ export const FacilityHome = (props: any) => { id="configure-facility" onClick={() => navigate(`/facility/${facilityId}/configure`)} authorizeFor={NonReadOnlyUsers} - icon={} + icon={} > Configure Facility navigate(`/facility/${facilityId}/inventory`)} - icon={} + icon={} > Inventory Management @@ -344,7 +344,9 @@ export const FacilityHome = (props: any) => { id="location-management" onClick={() => navigate(`/facility/${facilityId}/location`)} authorizeFor={NonReadOnlyUsers} - icon={} + icon={ + + } > Location Management @@ -354,7 +356,7 @@ export const FacilityHome = (props: any) => { navigate(`/facility/${facilityId}/resource/new`) } authorizeFor={NonReadOnlyUsers} - icon={} + icon={} > Resource Request @@ -362,21 +364,21 @@ export const FacilityHome = (props: any) => { id="create-assets" onClick={() => navigate(`/facility/${facilityId}/assets/new`)} authorizeFor={NonReadOnlyUsers} - icon={} + icon={} > Create Asset navigate(`/assets?facility=${facilityId}`)} - icon={} + icon={} > View Assets navigate(`/facility/${facilityId}/users`)} - icon={} + icon={} > View Users @@ -386,7 +388,7 @@ export const FacilityHome = (props: any) => { variant="danger" onClick={() => setOpenDeleteDialog(true)} className="flex items-center gap-3" - icon={} + icon={} > Delete Facility @@ -402,7 +404,7 @@ export const FacilityHome = (props: any) => { className="mt-2 flex w-full flex-row justify-center md:w-auto" onClick={() => navigate(`/facility/${facilityId}/cns`)} > - + Central Nursing Station @@ -414,7 +416,7 @@ export const FacilityHome = (props: any) => { onClick={() => navigate(`/facility/${facilityId}/patient`)} authorizeFor={NonReadOnlyUsers} > - + Add Details of a Patient { className="mt-2 flex w-full flex-row justify-center md:w-auto" onClick={() => navigate(`/patients?facility=${facilityId}`)} > - + View Patients { navigate(`/facility/${facilityId}/discharged-patients`) } > - + View Discharged Patients
diff --git a/src/Components/Facility/FacilityUsers.tsx b/src/Components/Facility/FacilityUsers.tsx index 2985649a543..781dbad9e40 100644 --- a/src/Components/Facility/FacilityUsers.tsx +++ b/src/Components/Facility/FacilityUsers.tsx @@ -221,7 +221,7 @@ export default function FacilityUsers(props: any) { }) } > - + diff --git a/src/Components/Facility/InventoryLog.tsx b/src/Components/Facility/InventoryLog.tsx index 96dd564d53c..0d8673e6d01 100644 --- a/src/Components/Facility/InventoryLog.tsx +++ b/src/Components/Facility/InventoryLog.tsx @@ -139,7 +139,10 @@ export default function InventoryLog(props: any) { variant="primary" > - + UnMark @@ -150,7 +153,10 @@ export default function InventoryLog(props: any) { variant="danger" > - + Mark as Accident @@ -244,7 +250,10 @@ export default function InventoryLog(props: any) { disabled={saving} > - + Delete Last Entry diff --git a/src/Components/Facility/Investigations/InvestigationSuggestions.tsx b/src/Components/Facility/Investigations/InvestigationSuggestions.tsx index 5e43d13e07e..8bd884831b7 100644 --- a/src/Components/Facility/Investigations/InvestigationSuggestions.tsx +++ b/src/Components/Facility/Investigations/InvestigationSuggestions.tsx @@ -182,7 +182,7 @@ export default function ViewInvestigationSuggestions(props: { investigation.type?.join("_-_") } > - + Log Report @@ -305,7 +305,7 @@ export default function ViewInvestigationSuggestions(props: { investigation.type?.join("_-_") } > - + Log Report )} diff --git a/src/Components/Facility/Investigations/InvestigationTable.tsx b/src/Components/Facility/Investigations/InvestigationTable.tsx index d322698779d..7f56bff21ef 100644 --- a/src/Components/Facility/Investigations/InvestigationTable.tsx +++ b/src/Components/Facility/Investigations/InvestigationTable.tsx @@ -101,7 +101,7 @@ export const InvestigationTable = ({ setShowForm((prev) => !prev); }} > - {!showForm && } + {!showForm && } {showForm ? "Cancel" : "Update Details"} {showForm && ( diff --git a/src/Components/Facility/LocationManagement.tsx b/src/Components/Facility/LocationManagement.tsx index c6578958ac5..06e0de28d62 100644 --- a/src/Components/Facility/LocationManagement.tsx +++ b/src/Components/Facility/LocationManagement.tsx @@ -267,7 +267,7 @@ const Location = ({ className="mt-3 w-full" href={`location/${id}/beds`} > - + Manage Beds
@@ -280,7 +280,7 @@ const Location = ({ href={`location/${id}/update`} authorizeFor={NonReadOnlyUsers} > - + Edit
@@ -295,7 +295,7 @@ const Location = ({ } authorizeFor={NonReadOnlyUsers} > - + Delete diff --git a/src/Components/Facility/PatientNotesSlideover.tsx b/src/Components/Facility/PatientNotesSlideover.tsx index 2e04312d277..b3fe50f7c4c 100644 --- a/src/Components/Facility/PatientNotesSlideover.tsx +++ b/src/Components/Facility/PatientNotesSlideover.tsx @@ -140,7 +140,10 @@ export default function PatientNotesSlideover(props: PatientNotesProps) { className="flex h-8 w-8 cursor-pointer items-center justify-center rounded bg-primary-800 text-gray-100 text-opacity-70 hover:bg-primary-700 hover:text-opacity-100" href={`/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/notes`} > - + )}
setShow(!show)} > - +
setShowPatientNotesPopup(false)} > - +
); @@ -223,7 +232,7 @@ export default function PatientNotesSlideover(props: PatientNotesProps) { disabled={!patientActive} authorizeFor={NonReadOnlyUsers} > - + diff --git a/src/Components/Facility/TriageForm.tsx b/src/Components/Facility/TriageForm.tsx index 32971f1d302..b4d50a73cec 100644 --- a/src/Components/Facility/TriageForm.tsx +++ b/src/Components/Facility/TriageForm.tsx @@ -203,7 +203,10 @@ export const TriageForm = ({ facilityId, id }: Props) => { - +

A Triage already exist on this date

} diff --git a/src/Components/Form/AutoCompleteAsync.tsx b/src/Components/Form/AutoCompleteAsync.tsx index 4ad68e96d73..762c9f2d136 100644 --- a/src/Components/Form/AutoCompleteAsync.tsx +++ b/src/Components/Form/AutoCompleteAsync.tsx @@ -109,7 +109,8 @@ const AutoCompleteAsync = (props: Props) => { {hasSelection && !loading && !required && (
{ e.preventDefault(); onChange(null); @@ -121,9 +122,12 @@ const AutoCompleteAsync = (props: Props) => {
)} {loading ? ( - + ) : ( - + )} @@ -155,7 +159,7 @@ const AutoCompleteAsync = (props: Props) => { )} {selected && ( - + )} )} diff --git a/src/Components/Form/FormFields/Autocomplete.tsx b/src/Components/Form/FormFields/Autocomplete.tsx index bf3840b2c44..ec5c73024c3 100644 --- a/src/Components/Form/FormFields/Autocomplete.tsx +++ b/src/Components/Form/FormFields/Autocomplete.tsx @@ -121,7 +121,7 @@ export const Autocomplete = (props: AutocompleteProps) => { label: query, description: undefined, search: query.toLowerCase(), - icon: , + icon: , value: query, }, ...mappedOptions, @@ -168,7 +168,8 @@ export const Autocomplete = (props: AutocompleteProps) => { {value && !props.isLoading && !props.required && (
{ e.preventDefault(); props.onChange(undefined); @@ -181,9 +182,9 @@ export const Autocomplete = (props: AutocompleteProps) => { )} {props.isLoading ? ( - + ) : ( - + )}
diff --git a/src/Components/Form/FormFields/AutocompleteMultiselect.tsx b/src/Components/Form/FormFields/AutocompleteMultiselect.tsx index 9004dea939d..3dde6941795 100644 --- a/src/Components/Form/FormFields/AutocompleteMultiselect.tsx +++ b/src/Components/Form/FormFields/AutocompleteMultiselect.tsx @@ -123,9 +123,9 @@ export const AutocompleteMutliSelect = (
{props.isLoading ? ( - + ) : ( - + )}
@@ -162,7 +162,7 @@ export const AutocompleteMutliSelect = (
Select All {value.length === filteredOptions.length && ( - + )}
@@ -178,7 +178,7 @@ export const AutocompleteMutliSelect = (
{option.label} {selected && ( - + )}
)} @@ -187,7 +187,7 @@ export const AutocompleteMutliSelect = ( ) : ( - {!query && } + {!query && } {query ? "No results" : "Type to search"} )} @@ -202,7 +202,7 @@ export const AutocompleteMutliSelect = ( const Searching = () => { return (
- + Searching...
); diff --git a/src/Components/Form/FormFields/PhoneNumberFormField.tsx b/src/Components/Form/FormFields/PhoneNumberFormField.tsx index 93ff4cf21eb..e86076d62af 100644 --- a/src/Components/Form/FormFields/PhoneNumberFormField.tsx +++ b/src/Components/Form/FormFields/PhoneNumberFormField.tsx @@ -14,7 +14,7 @@ import { PhoneNumberValidator, PhoneNumberType, } from "../FieldValidators"; -import CareIcon from "../../../CAREUI/icons/CareIcon"; +import CareIcon, { IconName } from "../../../CAREUI/icons/CareIcon"; const phoneCodes: Record = phoneCodesJson; @@ -115,9 +115,15 @@ export default function PhoneNumberFormField(props: Props) { {country?.flag ?? "🇮🇳"} {isOpen ? ( - + ) : ( - + )} @@ -146,12 +152,12 @@ export default function PhoneNumberFormField(props: Props) { ); } -const phoneNumberTypeIcons: Record = { - international_mobile: "globe", - indian_mobile: "mobile-android", - mobile: "mobile-android", - landline: "phone", - support: "headset", +const phoneNumberTypeIcons: Record = { + international_mobile: "l-globe", + indian_mobile: "l-mobile-android", + mobile: "l-mobile-android", + landline: "l-phone", + support: "l-headset", }; const PhoneNumberTypesHelp = ({ types }: { types: PhoneNumberType[] }) => ( @@ -159,10 +165,8 @@ const PhoneNumberTypesHelp = ({ types }: { types: PhoneNumberType[] }) => ( {types.map((type) => ( {type.replace("_", " ")} diff --git a/src/Components/Form/FormFields/TextFormField.tsx b/src/Components/Form/FormFields/TextFormField.tsx index 773dddc034b..3f814f27fc1 100644 --- a/src/Components/Form/FormFields/TextFormField.tsx +++ b/src/Components/Form/FormFields/TextFormField.tsx @@ -76,7 +76,7 @@ const TextFormField = forwardRef((props: TextFormFieldProps, ref) => { className="z-5 absolute right-0 top-0 flex h-full items-center px-3 text-xl" onClick={() => setShowPassword(!showPassword)} > - + ); diff --git a/src/Components/Form/MultiSelectMenuV2.tsx b/src/Components/Form/MultiSelectMenuV2.tsx index 7a976b86bb7..96d7f65f8d0 100644 --- a/src/Components/Form/MultiSelectMenuV2.tsx +++ b/src/Components/Form/MultiSelectMenuV2.tsx @@ -122,7 +122,10 @@ const MultiSelectMenuV2 = (props: Props) => { )} - + @@ -142,7 +145,7 @@ const MultiSelectMenuV2 = (props: Props) => { {option.label} {(option.icon || option.isSelected) && (option.isSelected ? ( - + ) : ( option.icon ))} @@ -186,7 +189,7 @@ export const MultiSelectOptionChip = (props: MultiSelectOptionChipProps) => { className="cursor-pointer rounded-full hover:bg-white" onClick={props.onRemove} > - +

)}
diff --git a/src/Components/Form/SearchInput.tsx b/src/Components/Form/SearchInput.tsx index 40855b8b9a6..146cd0d9b4b 100644 --- a/src/Components/Form/SearchInput.tsx +++ b/src/Components/Form/SearchInput.tsx @@ -73,7 +73,7 @@ const SearchInput = ({ className={className} leading={ props.leading || ( - + ) } trailing={ diff --git a/src/Components/Form/SelectMenuV2.tsx b/src/Components/Form/SelectMenuV2.tsx index 2e277b40b4f..640f3163b9d 100644 --- a/src/Components/Form/SelectMenuV2.tsx +++ b/src/Components/Form/SelectMenuV2.tsx @@ -106,7 +106,10 @@ const SelectMenuV2 = (props: SelectMenuProps) => {

{showChevronIcon && ( - + )} @@ -132,7 +135,10 @@ const SelectMenuV2 = (props: SelectMenuProps) => { {props.optionIcon ? option.icon : selected && ( - + )} {option.description && ( diff --git a/src/Components/HCX/ClaimCreatedModal.tsx b/src/Components/HCX/ClaimCreatedModal.tsx index 0b2e4703177..5148792e09e 100644 --- a/src/Components/HCX/ClaimCreatedModal.tsx +++ b/src/Components/HCX/ClaimCreatedModal.tsx @@ -41,7 +41,7 @@ export default function ClaimCreatedModal({ claim, ...props }: Props) { titleAction={ {isMakingClaim && ( - + )} {isMakingClaim ? `Requesting ${use === "Claim" ? "Claim" : "Pre-Authorization"}...` diff --git a/src/Components/HCX/ClaimsItemsBuilder.tsx b/src/Components/HCX/ClaimsItemsBuilder.tsx index 867f302a89e..42f1bc08cc8 100644 --- a/src/Components/HCX/ClaimsItemsBuilder.tsx +++ b/src/Components/HCX/ClaimsItemsBuilder.tsx @@ -70,7 +70,7 @@ export default function ClaimsItemsBuilder(props: Props) { disabled={props.disabled} > Delete - + )} diff --git a/src/Components/HCX/CreateClaimCard.tsx b/src/Components/HCX/CreateClaimCard.tsx index 755c2865747..1d3b3dc4933 100644 --- a/src/Components/HCX/CreateClaimCard.tsx +++ b/src/Components/HCX/CreateClaimCard.tsx @@ -153,7 +153,7 @@ export default function CreateClaimCard({ Check Insurance Policy Eligibility setShowAddPolicy(true)} ghost border> - + Edit Patient Insurance Details @@ -177,7 +177,7 @@ export default function CreateClaimCard({ setItems([...(items ?? []), { name: "", id: "", price: 0 }]) } > - + Add Item @@ -229,7 +229,7 @@ export default function CreateClaimCard({ onClick={handleSubmit} className="min-w-[200px]" > - {isCreating && } + {isCreating && } {isCreating ? `Creating ${use === "claim" ? "Claim" : "Pre-Authorization"}...` : "Proceed"} diff --git a/src/Components/HCX/InsuranceDetailsBuilder.tsx b/src/Components/HCX/InsuranceDetailsBuilder.tsx index 36713e317a2..c507566a259 100644 --- a/src/Components/HCX/InsuranceDetailsBuilder.tsx +++ b/src/Components/HCX/InsuranceDetailsBuilder.tsx @@ -105,7 +105,7 @@ const InsuranceDetailEditCard = ({ Policy Delete - + diff --git a/src/Components/HCX/PatientInsuranceDetailsEditor.tsx b/src/Components/HCX/PatientInsuranceDetailsEditor.tsx index c11d2266aba..952ee29e6e7 100644 --- a/src/Components/HCX/PatientInsuranceDetailsEditor.tsx +++ b/src/Components/HCX/PatientInsuranceDetailsEditor.tsx @@ -111,7 +111,7 @@ export default function PatientInsuranceDetailsEditor({ ]) } > - + Add Insurance Details
@@ -119,7 +119,7 @@ export default function PatientInsuranceDetailsEditor({ {isUpdating ? ( <> - + Updating... ) : ( diff --git a/src/Components/HCX/PolicyEligibilityCheck.tsx b/src/Components/HCX/PolicyEligibilityCheck.tsx index 42aa3caa87d..a21b3ce611a 100644 --- a/src/Components/HCX/PolicyEligibilityCheck.tsx +++ b/src/Components/HCX/PolicyEligibilityCheck.tsx @@ -160,7 +160,7 @@ export default function HCXPolicyEligibilityCheck({ > {isChecking ? ( <> - + Checking ... ) : ( @@ -179,9 +179,7 @@ const EligibilityChip = ({ eligible }: { eligible: boolean }) => { eligible ? "bg-primary-100 text-primary-500" : "bg-red-500 text-white" }`} > - + {eligible ? "Eligible" : "Not Eligible"} diff --git a/src/Components/Medicine/AdministerMedicine.tsx b/src/Components/Medicine/AdministerMedicine.tsx index 12b7be3e0da..f7353051ea7 100644 --- a/src/Components/Medicine/AdministerMedicine.tsx +++ b/src/Components/Medicine/AdministerMedicine.tsx @@ -37,16 +37,16 @@ export default function AdministerMedicine({ prescription, ...props }: Props) { - + {t("administer_medicine")} } title={t("administer_medicine")} description={
- Last administered + Last administered - {" "} + {" "} {prescription.last_administration?.administered_date ? formatDateTime( prescription.last_administration.administered_date @@ -55,12 +55,12 @@ export default function AdministerMedicine({ prescription, ...props }: Props) { {prescription.dosage_type === "TITRATED" && ( - {t("dosage")} + {t("dosage")} {":"} {prescription.last_administration?.dosage ?? "NA"} )} - Administered by:{" "} + Administered by:{" "} {prescription.last_administration?.administered_by?.username ?? "NA"} diff --git a/src/Components/Medicine/ManagePrescriptions.tsx b/src/Components/Medicine/ManagePrescriptions.tsx index 16e8ffedcb2..12ed0712533 100644 --- a/src/Components/Medicine/ManagePrescriptions.tsx +++ b/src/Components/Medicine/ManagePrescriptions.tsx @@ -33,11 +33,11 @@ export default function ManagePrescriptions() { onClick={() => goBack()} data-testid="return-to-patient-dashboard" > - + {t("return_to_patient_dashboard")} - + {t("all_changes_have_been_saved")}
diff --git a/src/Components/Medicine/MedicineAdministration.tsx b/src/Components/Medicine/MedicineAdministration.tsx index 23aef4b4dd1..44bbe436618 100644 --- a/src/Components/Medicine/MedicineAdministration.tsx +++ b/src/Components/Medicine/MedicineAdministration.tsx @@ -126,7 +126,7 @@ export default function MedicineAdministration(props: Props) { errorClassName="hidden" />
- {" "} + {" "} {t("last_administered")} {obj.last_administration?.administered_date @@ -135,7 +135,7 @@ export default function MedicineAdministration(props: Props) { {obj.dosage_type === "TITRATED" && ( - {t("dosage")} + {t("dosage")} {":"} {obj.last_administration?.dosage ?? "NA"} )} @@ -224,7 +224,7 @@ export default function MedicineAdministration(props: Props) { ))}
- + {t("administer_selected_medicines")}{" "} {selectedCount > 0 && `(${selectedCount})`} diff --git a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx index 7a1542b43ae..98bffe81804 100644 --- a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx +++ b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx @@ -129,7 +129,7 @@ export default function MedicineAdministrationTableRow({ } onClick={() => setShowAdminister(true)} > - + {t("administer")}
diff --git a/src/Components/Medicine/MedicineAdministrationSheet/index.tsx b/src/Components/Medicine/MedicineAdministrationSheet/index.tsx index 48c7e2aaff8..fd3d50272a3 100644 --- a/src/Components/Medicine/MedicineAdministrationSheet/index.tsx +++ b/src/Components/Medicine/MedicineAdministrationSheet/index.tsx @@ -83,7 +83,7 @@ const MedicineAdministrationSheet = ({ readonly, is_prn }: Props) => { prescription.last_administered_on) + .filter((prescription) => prescription.last_administration?.created_date) .reduce( (latest, curr) => - curr.last_administered_on && curr.last_administered_on > latest - ? curr.last_administered_on + curr.last_administration?.created_date && + curr.last_administration?.created_date > latest + ? curr.last_administration?.created_date : latest, prescriptions[0]?.created_date ?? new Date() ) diff --git a/src/Components/Medicine/PrescriptionBuilder.tsx b/src/Components/Medicine/PrescriptionBuilder.tsx index 998b96f3315..4dcc2603122 100644 --- a/src/Components/Medicine/PrescriptionBuilder.tsx +++ b/src/Components/Medicine/PrescriptionBuilder.tsx @@ -83,7 +83,7 @@ export default function PrescriptionBuilder({ disabled={disabled} >
- + {t(is_prn ? "add_prn_prescription" : "add_prescription_medication")} @@ -98,7 +98,7 @@ export default function PrescriptionBuilder({ )} description={
- + {t("modification_caution_note")}
} diff --git a/src/Components/Medicine/PrescriptionDetailCard.tsx b/src/Components/Medicine/PrescriptionDetailCard.tsx index 7112f75d598..773c5df6d33 100644 --- a/src/Components/Medicine/PrescriptionDetailCard.tsx +++ b/src/Components/Medicine/PrescriptionDetailCard.tsx @@ -66,7 +66,7 @@ export default function PrescriptionDetailCard({ ghost border > - + {t("administer")} - + {t("discontinue")}
diff --git a/src/Components/Medicine/PrescriptionsTable.tsx b/src/Components/Medicine/PrescriptionsTable.tsx index 6cedc4ec29c..79ddac3e5cb 100644 --- a/src/Components/Medicine/PrescriptionsTable.tsx +++ b/src/Components/Medicine/PrescriptionsTable.tsx @@ -119,7 +119,7 @@ export default function PrescriptionsTable({ variant="danger" onClick={() => setShowDiscontinueFor(detailedViewFor)} > - + {t("discontinue")} setShowAdministerFor(detailedViewFor)} > - + {t("administer")}
@@ -142,7 +142,7 @@ export default function PrescriptionsTable({ {is_prn ? "PRN Prescriptions" : "Prescriptions"}
- + {lastModified && formatDateTime(lastModified)} @@ -157,7 +157,7 @@ export default function PrescriptionsTable({ href="prescriptions" className="w-full lg:w-auto" > - + {t("edit_prescriptions")} {t("edit")} @@ -168,7 +168,7 @@ export default function PrescriptionsTable({ onClick={() => setShowBulkAdminister(true)} className="w-full lg:w-auto" > - + {t("administer_medicines")} @@ -225,7 +225,7 @@ export default function PrescriptionsTable({ if (med.discontinued) { return (
- + {t("discontinued")}
); @@ -244,7 +244,7 @@ export default function PrescriptionsTable({ setShowAdministerFor(med); }} > - + {t("administer")} - + {t("discontinue")}
diff --git a/src/Components/Notifications/NoticeBoard.tsx b/src/Components/Notifications/NoticeBoard.tsx index 8ad3afba0f8..7835f8576b7 100644 --- a/src/Components/Notifications/NoticeBoard.tsx +++ b/src/Components/Notifications/NoticeBoard.tsx @@ -42,7 +42,7 @@ export const NoticeBoard = () => { notices = (
- +
No Notice Available
diff --git a/src/Components/Notifications/NotificationsList.tsx b/src/Components/Notifications/NotificationsList.tsx index 1ce23dafdbc..95093743080 100644 --- a/src/Components/Notifications/NotificationsList.tsx +++ b/src/Components/Notifications/NotificationsList.tsx @@ -121,11 +121,8 @@ const NotificationTile = ({ }} > {t("mark_as_read")} @@ -134,7 +131,7 @@ const NotificationTile = ({ ghost className="shrink-0 bg-white px-2 py-1 font-semibold hover:bg-secondary-300" > - + {t("open")}
@@ -212,21 +209,21 @@ export default function NotificationsList({ if (status === "NotSubscribed") { return ( <> - + {t("subscribe")} ); } else if (status === "SubscribedOnAnotherDevice") { return ( <> - + {t("subscribe_on_this_device")} ); } else { return ( <> - + {t("unsubscribe")} ); @@ -414,7 +411,7 @@ export default function NotificationsList({ setOpen(!open)} - icon={} + icon={} badgeCount={unreadCount} handleOverflow={handleOverflow} /> @@ -438,7 +435,7 @@ export default function NotificationsList({ setOffset(0); }} > - + {t("reload")} {t("mark_all_as_read")} @@ -470,9 +464,7 @@ export default function NotificationsList({ variant="secondary" onClick={() => setShowUnread(!showUnread)} > - + {showUnread diff --git a/src/Components/Patient/DailyRoundListDetails.tsx b/src/Components/Patient/DailyRoundListDetails.tsx index 02ad9aa47fa..0896cb5310c 100644 --- a/src/Components/Patient/DailyRoundListDetails.tsx +++ b/src/Components/Patient/DailyRoundListDetails.tsx @@ -58,7 +58,10 @@ export const DailyRoundListDetails = (props: any) => { title={`Consultation Update #${id}`} backUrl={`/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/daily-rounds`} > -
+
diff --git a/src/Components/Patient/FileUpload.tsx b/src/Components/Patient/FileUpload.tsx index 1b1ee8f67dd..6e6d289d187 100644 --- a/src/Components/Patient/FileUpload.tsx +++ b/src/Components/Patient/FileUpload.tsx @@ -629,7 +629,10 @@ export const FileUpload = (props: FileUploadProps) => { }} className="m-1 w-full sm:w-auto" > - {" "} + {" "} DOWNLOAD {item?.uploaded_by?.username === authUser.username || @@ -647,7 +650,7 @@ export const FileUpload = (props: FileUploadProps) => { }} className="m-1 w-full sm:w-auto" > - + RENAME @@ -669,7 +672,7 @@ export const FileUpload = (props: FileUploadProps) => { }} className="m-1 w-full sm:w-auto" > - + ARCHIVE @@ -762,7 +765,7 @@ export const FileUpload = (props: FileUploadProps) => { }} className="m-1 w-full sm:w-auto" > - + RENAME @@ -782,7 +785,7 @@ export const FileUpload = (props: FileUploadProps) => { }} className="m-1 w-full sm:w-auto" > - + ARCHIVE @@ -872,7 +875,8 @@ export const FileUpload = (props: FileUploadProps) => {
{" "} - FILE ARCHIVED + FILE + ARCHIVED { @@ -886,7 +890,7 @@ export const FileUpload = (props: FileUploadProps) => { }} className="m-1 w-full sm:w-auto" > - + MORE DETAILS
@@ -905,8 +909,8 @@ export const FileUpload = (props: FileUploadProps) => { } const onFileChange = (e: ChangeEvent): any => { - if (e.target.files == null) { - throw new Error("Error finding e.target.files"); + if (!e.target.files?.length) { + return; } const f = e.target.files[0]; const fileName = f.name; @@ -1144,7 +1148,10 @@ export const FileUpload = (props: FileUploadProps) => { title={
- +

Camera

@@ -1239,7 +1246,7 @@ export const FileUpload = (props: FileUploadProps) => { @@ -1299,7 +1306,10 @@ export const FileUpload = (props: FileUploadProps) => { title={
- +

Rename File

@@ -1343,7 +1353,10 @@ export const FileUpload = (props: FileUploadProps) => { title={
- +

Archive File

@@ -1390,7 +1403,10 @@ export const FileUpload = (props: FileUploadProps) => { title={
- +

File Details

@@ -1410,10 +1426,10 @@ export const FileUpload = (props: FileUploadProps) => { Reason: {modalDetails?.reason}
- Archived_by: {modalDetails?.userArchived} + Archived by: {modalDetails?.userArchived}
- Time of Archive: + Time of Archive: {formatDateTime(modalDetails?.archiveTime)}
@@ -1464,11 +1480,11 @@ export const FileUpload = (props: FileUploadProps) => { deleteAudioBlob(); }} > - Delete + Delete
)} -
+
{ /> {!audioBlobExists && ( - + Please allow browser permission before you start speaking @@ -1491,7 +1510,7 @@ export const FileUpload = (props: FileUploadProps) => { }} className="w-full" > - + Save
@@ -1526,7 +1545,10 @@ export const FileUpload = (props: FileUploadProps) => { {({ isAuthorized }) => isAuthorized ? (
diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx index 220165e9e4c..ff3dede4072 100644 --- a/src/Components/Patient/ManagePatients.tsx +++ b/src/Components/Patient/ManagePatients.tsx @@ -103,7 +103,7 @@ export const PatientManager = () => { }); const authUser = useAuthUser(); const [diagnoses, setDiagnoses] = useState([]); - const [showDialog, setShowDialog] = useState(false); + const [showDialog, setShowDialog] = useState<"create" | "list-discharged">(); const [showDoctors, setShowDoctors] = useState(false); const [showDoctorConnect, setShowDoctorConnect] = useState(false); const [phone_number, setPhoneNumber] = useState(""); @@ -406,7 +406,9 @@ export const PatientManager = () => { const { data: permittedFacilities } = useQuery( routes.getPermittedFacilities, - {} + { + query: { limit: 1 }, + } ); const LastAdmittedToTypeBadges = () => { @@ -503,7 +505,10 @@ export const PatientManager = () => { ) : patient.last_consultation?.suggestion === "DC" ? (
- + Domiciliary Care @@ -723,6 +728,9 @@ export const PatientManager = () => { }; }; + const onlyAccessibleFacility = + permittedFacilities?.count === 1 ? permittedFacilities.results[0] : null; + return ( { onClick={() => { if (qParams.facility) navigate(`/facility/${qParams.facility}/patient`); - else if (permittedFacilities?.results.length === 1) - navigate( - `/facility/${permittedFacilities?.results[0].id}/patient` - ); - else setShowDialog(true); + else if (onlyAccessibleFacility) + navigate(`/facility/${onlyAccessibleFacility.id}/patient`); + else setShowDialog("create"); }} className="w-full lg:w-fit" > - +

Add Patient Details

- {(authUser.user_type === "StateAdmin" || - authUser.user_type === "StateReadOnlyAdmin") && ( - updateQuery({ is_active: "True" })} - onClickTab2={() => updateQuery({ is_active: "False" })} - isTab2Active={tabValue ? true : false} - /> - )} + updateQuery({ is_active: "True" })} + onClickTab2={() => { + // Navigate to dedicated discharged list page if filtered by a facility or user has access only to one facility. + const id = qParams.facility || onlyAccessibleFacility?.id; + if (id) { + navigate(`facility/${id}/discharged-patients`); + return; + } + + if ( + authUser.user_type === "StateAdmin" || + authUser.user_type === "StateReadOnlyAdmin" + ) { + updateQuery({ is_active: "False" }); + return; + } + + Notification.Warn({ + msg: "Facility needs to be selected to view discharged patients.", + }); + setShowDialog("list-discharged"); + }} + isTab2Active={!!tabValue} + /> {showDoctorConnect && ( { setShowDoctors(true); }} > - +

Doctor Connect

)} @@ -803,7 +826,7 @@ export const PatientManager = () => { }} className="mr-5 w-full lg:w-fit" > - + Export ) : ( @@ -811,18 +834,10 @@ export const PatientManager = () => { disabled={!isExportAllowed} exportItems={[ { - label: - tabValue === 0 - ? "Live patients" - : "Discharged patients", + label: "Export Live patients", action: exportPatients(true), parse: preventDuplicatePatientsDuetoPolicyId, }, - { - label: "All patients", - action: exportPatients(false), - parse: preventDuplicatePatientsDuetoPolicyId, - }, ]} /> )} @@ -838,12 +853,21 @@ export const PatientManager = () => { } > setSelectedFacility(e)} selectedFacility={selectedFacility} - handleOk={() => navigate(`facility/${selectedFacility.id}/patient`)} + handleOk={() => { + switch (showDialog) { + case "create": + navigate(`facility/${selectedFacility.id}/patient`); + break; + case "list-discharged": + navigate(`facility/${selectedFacility.id}/discharged-patients`); + break; + } + }} handleCancel={() => { - setShowDialog(false); + setShowDialog(undefined); setSelectedFacility({ name: "" }); }} /> diff --git a/src/Components/Patient/PatientFilter.tsx b/src/Components/Patient/PatientFilter.tsx index 6392c5c4d45..0275710444a 100644 --- a/src/Components/Patient/PatientFilter.tsx +++ b/src/Components/Patient/PatientFilter.tsx @@ -599,7 +599,7 @@ export default function PatientFilter(props: any) { setFilterState({ ...filterState, facility_type: v }) } optionIcon={() => ( - + )} />
@@ -675,7 +675,7 @@ export default function PatientFilter(props: any) { optionValue={({ id }) => id} optionIcon={({ id }) => ( <> - + {id} )} diff --git a/src/Components/Patient/PatientHome.tsx b/src/Components/Patient/PatientHome.tsx index 841a8d31ddf..5c151553379 100644 --- a/src/Components/Patient/PatientHome.tsx +++ b/src/Components/Patient/PatientHome.tsx @@ -5,6 +5,7 @@ import { DISCHARGE_REASONS, GENDER_TYPES, SAMPLE_TEST_STATUS, + OCCUPATION_TYPES, } from "../../Common/constants"; import * as Notification from "../../Utils/Notifications"; @@ -39,6 +40,10 @@ import PaginatedList from "../../CAREUI/misc/PaginatedList"; const Loading = lazy(() => import("../Common/Loading")); +export const parseOccupation = (occupation: string | undefined) => { + return OCCUPATION_TYPES.find((i) => i.value === occupation)?.text; +}; + export const PatientHome = (props: any) => { const { facilityId, id } = props; const [showShifts, setShowShifts] = useState(false); @@ -419,7 +424,7 @@ export const PatientHome = (props: any) => { {patientGender} | {patientData.blood_group || "-"}

-
+
Date of Birth @@ -530,6 +535,14 @@ export const PatientHome = (props: any) => {
)} +
+
+ Occupation +
+
+ {parseOccupation(patientData.meta_info?.occupation) || "-"} +
+
@@ -636,7 +649,7 @@ export const PatientHome = (props: any) => { ) } > - + Update Details
@@ -653,7 +666,7 @@ export const PatientHome = (props: any) => { } authorizeFor={NonReadOnlyUsers} > - + {patientData.allow_transfer ? "Disable Transfer" : "Allow Transfer"} @@ -673,9 +686,9 @@ export const PatientHome = (props: any) => { >
Shifting
{showShifts ? ( - + ) : ( - + )}
{ title="Shifting status" className="flex items-center text-sm font-semibold leading-5 text-zinc-400" > - +
{shift.status}
@@ -726,7 +742,10 @@ export const PatientHome = (props: any) => { title=" Origin facility" className="flex items-center text-sm font-semibold leading-5 text-zinc-400" > - +
{(shift.origin_facility_object || {})?.name}
@@ -737,7 +756,10 @@ export const PatientHome = (props: any) => { title="Shifting approving facility" className="flex items-center text-sm font-semibold leading-5 text-zinc-400" > - +
{ ( @@ -753,7 +775,10 @@ export const PatientHome = (props: any) => { title=" Assigned facility" className="flex items-center text-sm font-semibold leading-5 text-zinc-400" > - +
{(shift.assigned_facility_object || {})?.name || "Yet to be decided"} @@ -773,7 +798,10 @@ export const PatientHome = (props: any) => { : "rounded p-1 font-normal text-red-600") } > - +
{formatDateTime(shift.modified_date) || "--"}
@@ -789,7 +817,7 @@ export const PatientHome = (props: any) => { navigate(`/shifting/${shift.external_id}`) } > - + All Details
@@ -1017,7 +1045,10 @@ export const PatientHome = (props: any) => { )} > - +
@@ -1035,7 +1066,7 @@ export const PatientHome = (props: any) => {
- +
@@ -1056,7 +1087,7 @@ export const PatientHome = (props: any) => {
- +
@@ -1089,7 +1120,7 @@ export const PatientHome = (props: any) => { } text-center `} > - +
@@ -1131,7 +1162,7 @@ export const PatientHome = (props: any) => { } text-center `} > - +
@@ -1157,7 +1188,7 @@ export const PatientHome = (props: any) => {
- +
@@ -1192,7 +1223,7 @@ export const PatientHome = (props: any) => { )} > - +
@@ -1231,7 +1262,7 @@ export const PatientHome = (props: any) => { } > - + Add Consultation @@ -1244,7 +1275,7 @@ export const PatientHome = (props: any) => { } > - + Investigations Summary @@ -1259,7 +1290,7 @@ export const PatientHome = (props: any) => { } > - + View/Upload Patient Files @@ -1276,7 +1307,7 @@ export const PatientHome = (props: any) => { authorizeFor={NonReadOnlyUsers} > - + Shift Patient @@ -1293,7 +1324,7 @@ export const PatientHome = (props: any) => { authorizeFor={NonReadOnlyUsers} > - + Request Sample Test @@ -1308,7 +1339,7 @@ export const PatientHome = (props: any) => { } > - + View Patient Notes @@ -1321,7 +1352,7 @@ export const PatientHome = (props: any) => { authorizeFor={NonReadOnlyUsers} > - + Assign to a volunteer diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx index 1d9be149be6..eab3cd5f28f 100644 --- a/src/Components/Patient/PatientInfoCard.tsx +++ b/src/Components/Patient/PatientInfoCard.tsx @@ -324,7 +324,10 @@ export default function PatientInfoCard(props: {
- + Domiciliary Care
@@ -492,7 +495,10 @@ export default function PatientInfoCard(props: { {patient.is_active && consultation?.id && !consultation?.discharge_date && ( -
+
- +

Log Update

@@ -534,8 +540,8 @@ export default function PatientInfoCard(props: { <>

- {" "} - No update filed in the last 24 hours + No update + filed in the last 24 hours

@@ -555,7 +561,7 @@ export default function PatientInfoCard(props: { [ `/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/update`, "Edit Consultation Details", - "pen", + "l-pen", patient.is_active && consultation?.id && !consultation?.discharge_date, @@ -563,13 +569,13 @@ export default function PatientInfoCard(props: { [ `/patient/${patient.id}/investigation_reports`, "Investigation Summary", - "align-alt", + "l-align-alt", true, ], [ `/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/treatment-summary`, "Treatment Summary", - "file-medical", + "l-file-medical", consultation?.id, ], ] @@ -579,7 +585,7 @@ export default function PatientInfoCard(props: { [ `/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/claims`, "Claims", - "copy-landscape", + "l-copy-landscape", consultation?.id, ], ] @@ -620,7 +626,8 @@ export default function PatientInfoCard(props: { }} > {action[1]} @@ -655,7 +662,10 @@ export default function PatientInfoCard(props: { }); }} > - + Show ABHA Profile
- + Link Care Context
@@ -688,7 +701,10 @@ export default function PatientInfoCard(props: { }} > - +

Link ABHA Number

@@ -716,7 +732,10 @@ export default function PatientInfoCard(props: { }} > - +

Track Shifting

@@ -731,7 +750,10 @@ export default function PatientInfoCard(props: { }} > - +

Shift Patient

@@ -750,7 +772,10 @@ export default function PatientInfoCard(props: { }} > - +

{t("discharge_summary")}

@@ -772,7 +797,8 @@ export default function PatientInfoCard(props: { > { disabled={!patientActive} authorizeFor={NonReadOnlyUsers} > - +
diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx index efc269fa00c..85a5002f8da 100644 --- a/src/Components/Patient/PatientRegister.tsx +++ b/src/Components/Patient/PatientRegister.tsx @@ -5,6 +5,7 @@ import { DISEASE_STATUS, GENDER_TYPES, MEDICAL_HISTORY_CHOICES, + OCCUPATION_TYPES, TEST_TYPE, VACCINES, } from "../../Common/constants"; @@ -41,7 +42,7 @@ import { HCXPolicyModel } from "../HCX/models"; import HCXPolicyValidator from "../HCX/validators"; import InsuranceDetailsBuilder from "../HCX/InsuranceDetailsBuilder"; import LinkABHANumberModal from "../ABDM/LinkABHANumberModal"; -import { PatientModel } from "./models"; +import { PatientModel, Occupation } from "./models"; import PhoneNumberFormField from "../Form/FormFields/PhoneNumberFormField"; import RadioFormField from "../Form/FormFields/RadioFormField"; import { SelectFormField } from "../Form/FormFields/SelectFormField"; @@ -84,6 +85,7 @@ const medicalHistoryChoices = MEDICAL_HISTORY_CHOICES.reduce( const genderTypes = GENDER_TYPES; const diseaseStatus = [...DISEASE_STATUS]; const bloodGroups = [...BLOOD_GROUPS]; +const occupationTypes = OCCUPATION_TYPES; const testType = [...TEST_TYPE]; const vaccines = ["Select", ...VACCINES]; @@ -168,6 +170,12 @@ const patientFormReducer = (state = initialState, action: any) => { return state; } }; +export const parseOccupationFromExt = (occupation: Occupation) => { + const occupationObject = OCCUPATION_TYPES.find( + (item) => item.value === occupation + ); + return occupationObject?.id; +}; export const PatientRegister = (props: PatientRegisterProps) => { const authUser = useAuthUser(); @@ -304,6 +312,10 @@ export const PatientRegister = (props: PatientRegisterProps) => { ? parseGenderFromExt(data.gender, state.form.gender) : state.form.gender, }); + field.onChange({ + name: "occupation", + value: data.meta_info?.occupation ?? state.form.occupation, + }); field.onChange({ name: "test_id", value: data.test_id ? data.test_id : state.form.test_id, @@ -421,6 +433,10 @@ export const PatientRegister = (props: PatientRegisterProps) => { data.instituion_of_health_care_worker ? data.instituion_of_health_care_worker : "", + meta_info: data.meta_info ?? {}, + occupation: data.meta_info?.occupation + ? parseOccupationFromExt(data.meta_info.occupation) + : null, number_of_primary_contacts: data.number_of_primary_contacts ? data.number_of_primary_contacts @@ -745,6 +761,10 @@ export const PatientRegister = (props: PatientRegisterProps) => { local_body: formData.nationality === "India" ? formData.local_body : undefined, ward: formData.ward, + meta_info: { + ...state.form?.meta_info, + occupation: formData.occupation ?? null, + }, village: formData.village, address: formData.address ? formData.address : undefined, permanent_address: formData.sameAddress @@ -1054,7 +1074,10 @@ export const PatientRegister = (props: PatientRegisterProps) => {
- {" "} + {" "} Please enter the correct date of birth for the patient

@@ -1156,7 +1179,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { setQuery({ extId: "" }, { replace: true }); }} > - + Import From External Results

@@ -1516,6 +1539,14 @@ export const PatientRegister = (props: PatientRegisterProps) => { /> )}
+ o.text} + optionValue={(o) => o.id} + /> ) : (
@@ -1532,7 +1563,10 @@ export const PatientRegister = (props: PatientRegisterProps) => { + } title={

@@ -1866,7 +1900,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { } data-testid="add-insurance-button" > - + Add Insurance Details

diff --git a/src/Components/Patient/SampleViewAdmin.tsx b/src/Components/Patient/SampleViewAdmin.tsx index 122f82aa7e2..431fc09a317 100644 --- a/src/Components/Patient/SampleViewAdmin.tsx +++ b/src/Components/Patient/SampleViewAdmin.tsx @@ -199,7 +199,10 @@ export default function SampleViewAdmin() { Contact:{" "} Confirmed carrier - +
)} {item.patient_has_suspected_contact && @@ -209,7 +212,10 @@ export default function SampleViewAdmin() { Contact:{" "} Suspected carrier - +
)} {item.has_sari && ( @@ -218,14 +224,20 @@ export default function SampleViewAdmin() { SARI:{" "} Severe Acute Respiratory illness - +
)} {item.has_ari && !item.has_sari && (
ARI: Acute Respiratory illness - +
)}
diff --git a/src/Components/Patient/UpdateStatusDialog.tsx b/src/Components/Patient/UpdateStatusDialog.tsx index 064e19ff2ee..c547a1b85ff 100644 --- a/src/Components/Patient/UpdateStatusDialog.tsx +++ b/src/Components/Patient/UpdateStatusDialog.tsx @@ -215,7 +215,7 @@ const UpdateStatusDialog = (props: Props) => { ) : (
diff --git a/src/Components/Patient/models.tsx b/src/Components/Patient/models.tsx index 05eb780069d..7648ea18c5e 100644 --- a/src/Components/Patient/models.tsx +++ b/src/Components/Patient/models.tsx @@ -1,5 +1,6 @@ import { ConsultationModel, PatientCategory } from "../Facility/models"; import { PerformedByModel } from "../HCX/misc"; +import { OCCUPATION_TYPES } from "../../Common/constants"; export interface FlowModel { id?: number; @@ -127,6 +128,11 @@ export interface PatientModel { created_by?: PerformedByModel; assigned_to?: { first_name?: string; username?: string; last_name?: string }; assigned_to_object?: AssignedToObjectModel; + occupation?: Occupation; + meta_info?: { + id: number; + occupation: Occupation; + }; // ABDM related abha_number?: string; @@ -370,3 +376,5 @@ export interface FileUploadModel { archived_by?: PerformedByModel; archived_datetime?: string; } + +export type Occupation = (typeof OCCUPATION_TYPES)[number]["value"]; diff --git a/src/Components/Resource/ListView.tsx b/src/Components/Resource/ListView.tsx index 2cf8b9eb26d..680015b16f2 100644 --- a/src/Components/Resource/ListView.tsx +++ b/src/Components/Resource/ListView.tsx @@ -181,7 +181,7 @@ export default function ListView() {
- + {t("board_view")} diff --git a/src/Components/Resource/ResourceBoardView.tsx b/src/Components/Resource/ResourceBoardView.tsx index 558cd77c1f0..6c02d932f77 100644 --- a/src/Components/Resource/ResourceBoardView.tsx +++ b/src/Components/Resource/ResourceBoardView.tsx @@ -76,7 +76,7 @@ export default function BoardView() { />
- + {t("list_view")} navigate("/shifting/list", { query: qParams })} > - + {t("list_view")} navigate("/shifting/board", { query: qParams })} > - + {t("board_view")} diff --git a/src/Components/Users/ManageUsers.tsx b/src/Components/Users/ManageUsers.tsx index dbfca3a815a..ef3d4f00a3f 100644 --- a/src/Components/Users/ManageUsers.tsx +++ b/src/Components/Users/ManageUsers.tsx @@ -392,7 +392,7 @@ export default function ManageUsers() { setSelectedUser(user); }} > - +

Linked Facilities

- +

Linked Skills

@@ -420,7 +420,7 @@ export default function ManageUsers() { setWeeklyHours(user.weekly_working_hours); }} > - +

Set Average weekly working hours

@@ -736,7 +736,7 @@ function UserFacilities(props: { user: any }) { }) } > - + {t("clear_home_facility")} @@ -791,7 +791,7 @@ function UserFacilities(props: { user: any }) { } }} > - + Set as home facility @@ -808,7 +808,7 @@ function UserFacilities(props: { user: any }) { }) } > - + Unlink Facility diff --git a/src/Components/Users/SkillsSlideOverComponents.tsx b/src/Components/Users/SkillsSlideOverComponents.tsx index d03de928c74..428c5cac5aa 100644 --- a/src/Components/Users/SkillsSlideOverComponents.tsx +++ b/src/Components/Users/SkillsSlideOverComponents.tsx @@ -52,7 +52,7 @@ export const SkillsArray = ({ disabled={isLoading || !authorizeForAddSkill} onClick={() => setDeleteSkill(skill)} > - +
diff --git a/src/Components/Users/UserProfile.tsx b/src/Components/Users/UserProfile.tsx index 34452a367de..da5b7b9639b 100644 --- a/src/Components/Users/UserProfile.tsx +++ b/src/Components/Users/UserProfile.tsx @@ -249,10 +249,12 @@ export default function UserProfile() { errors[field] = "Field is required"; invalidForm = true; } else if ( - states.form.user_type === "Doctor" && - Number(states.form.doctor_experience_commenced_on) > 100 + (states.form.user_type === "Doctor" && + Number(states.form.doctor_experience_commenced_on) >= 100) || + Number(states.form.doctor_experience_commenced_on) < 0 ) { - errors[field] = "Doctor experience should be less than 100 years"; + errors[field] = + "Doctor experience should be at least 0 years and less than 100 years."; invalidForm = true; } return; @@ -441,7 +443,7 @@ export default function UserProfile() { {showEdit ? "Cancel" : "Edit User Profile"} - + Sign out
@@ -832,7 +834,7 @@ export default function UserProfile() {
- + Update available
@@ -847,8 +849,9 @@ export default function UserProfile() { {" "}
diff --git a/src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx b/src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx index 268e6c91ffa..9bd01fea4e6 100644 --- a/src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx +++ b/src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx @@ -149,7 +149,10 @@ export default function HL7PatientVitalsMonitor(props: IVitalsComponentProps) { )} style={waveformCanvas.size} > - + No incoming data from HL7 Monitor
- + No incoming data from Ventilator
- +

{asset?.name}

@@ -64,7 +68,7 @@ const VitalsMonitorAssetPopover = ({ id="configure-asset" data-testid="asset-configure-button" > - + {t("configure")}
diff --git a/src/Components/VitalsMonitor/VitalsMonitorHeader.tsx b/src/Components/VitalsMonitor/VitalsMonitorHeader.tsx index 2f9df8607b0..8fa272d4058 100644 --- a/src/Components/VitalsMonitor/VitalsMonitorHeader.tsx +++ b/src/Components/VitalsMonitor/VitalsMonitorHeader.tsx @@ -21,7 +21,7 @@ const VitalsMonitorHeader = ({ patientAssetBed }: VitalsMonitorHeaderProps) => { ) : ( - + No Patient )} @@ -39,11 +39,14 @@ const VitalsMonitorHeader = ({ patientAssetBed }: VitalsMonitorHeaderProps) => { href={`/facility/${patient?.facility_object?.id}/location/${bed?.location_object?.id}/beds`} > - + {bed.name} - + {bed.location_object?.name} diff --git a/src/Locale/en/Facility.json b/src/Locale/en/Facility.json index aefc9c3b4a8..3c22a9ab460 100644 --- a/src/Locale/en/Facility.json +++ b/src/Locale/en/Facility.json @@ -51,5 +51,7 @@ "last_serviced_on": "Last Serviced On", "notes": "Notes", "create_asset": "Create Asset", - "create_add_more": "Create & Add More" + "create_add_more": "Create & Add More", + "discharged_patients": "Discharged Patients", + "discharged_patients_empty": "No discharged patients present in this facility" } \ No newline at end of file diff --git a/src/Utils/VoiceRecorder.tsx b/src/Utils/VoiceRecorder.tsx index f816a700154..ab14738df89 100644 --- a/src/Utils/VoiceRecorder.tsx +++ b/src/Utils/VoiceRecorder.tsx @@ -42,7 +42,10 @@ export const VoiceRecorder = (props: any) => { <>
- + {t("recording") + "..."}
{ confirmAudioBlobExists(); }} > - + {t("stop")}
@@ -68,7 +71,7 @@ export const VoiceRecorder = (props: any) => { authorizeFor={NonReadOnlyUsers} className="w-full md:w-fit" > - + {t("record")} )} diff --git a/vite.config.mts b/vite.config.mts index c8eb11c53cf..9285f495850 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -1,6 +1,7 @@ import { VitePWA } from "vite-plugin-pwa"; import { defineConfig } from "vite"; import react from "@vitejs/plugin-react-swc"; +import { treeShakeCareIcons } from "./plugins/treeShakeCareIcons.mts"; const cdnUrls = process.env.CARE_CDN_URL ?? @@ -14,6 +15,9 @@ export default defineConfig({ envPrefix: "REACT_", plugins: [ react(), + treeShakeCareIcons({ + iconWhitelist: ["default"], + }), VitePWA({ strategies: "injectManifest", srcDir: "src",