diff --git a/cypress/e2e/patient_spec/patient_consultation.cy.ts b/cypress/e2e/patient_spec/patient_consultation.cy.ts
index 36c3ebdcb40..d851e08ed14 100644
--- a/cypress/e2e/patient_spec/patient_consultation.cy.ts
+++ b/cypress/e2e/patient_spec/patient_consultation.cy.ts
@@ -193,6 +193,7 @@ describe("Patient Consultation in multiple combination", () => {
cy.verifyNotification(
"Create Diagnoses - Atleast one diagnosis is required"
);
+ cy.closeNotification();
patientConsultationPage.selectPatientDiagnosis(
diagnosis4,
"add-icd11-diagnosis-as-confirmed"
diff --git a/cypress/e2e/patient_spec/patient_logupdate.cy.ts b/cypress/e2e/patient_spec/patient_logupdate.cy.ts
index 57f31980679..143be363efc 100644
--- a/cypress/e2e/patient_spec/patient_logupdate.cy.ts
+++ b/cypress/e2e/patient_spec/patient_logupdate.cy.ts
@@ -42,6 +42,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
cy.submitButton("Update Consultation");
cy.verifyNotification("Consultation updated successfully");
+ cy.closeNotification();
patientLogupdate.clickLogupdate();
patientLogupdate.typePhysicalExamination(physicalExamination);
patientLogupdate.typeOtherDetails(otherExamination);
@@ -79,6 +80,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
cy.submitButton("Update Consultation");
cy.verifyNotification("Consultation updated successfully");
+ cy.closeNotification();
patientLogupdate.clickLogupdate();
patientLogupdate.typePhysicalExamination(physicalExamination);
patientLogupdate.typeOtherDetails(otherExamination);
@@ -95,6 +97,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.verifyNotification("Consultation Updates details created successfully");
+ cy.closeNotification();
// edit the card and verify the data.
patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory);
cy.verifyContentPresence("#consultation-preview", [
diff --git a/cypress/e2e/users_spec/user_creation.cy.ts b/cypress/e2e/users_spec/user_creation.cy.ts
index d9b3e52ddaf..33fd7cb958d 100644
--- a/cypress/e2e/users_spec/user_creation.cy.ts
+++ b/cypress/e2e/users_spec/user_creation.cy.ts
@@ -37,7 +37,7 @@ describe("User Creation", () => {
"Please select the User Type",
"Please enter valid phone number",
"Please enter the username",
- "Please enter date in YYYY/MM/DD format",
+ "Please enter date in DD/MM/YYYY format",
"Please enter the password",
"Confirm password is required",
"First Name is required",
@@ -52,10 +52,7 @@ describe("User Creation", () => {
const EXPECTED_PROFILE_ERROR_MESSAGES = [
"Field is required",
"Field is required",
- "This field is required",
"Please enter valid phone number",
- "This field is required",
- "This field is required",
];
before(() => {
@@ -81,7 +78,6 @@ describe("User Creation", () => {
"District Editted"
);
userCreationPage.typeIntoElementByIdPostClear("lastName", "Cypress");
- userCreationPage.typeIntoElementByIdPostClear("age", "22");
userCreationPage.selectDropdownOption("gender", "Male");
userCreationPage.typeIntoElementByIdPostClear(
"phoneNumber",
@@ -93,6 +89,10 @@ describe("User Creation", () => {
);
userCreationPage.typeIntoElementByIdPostClear("email", "test@test.com");
userCreationPage.typeIntoElementByIdPostClear("weekly_working_hours", "14");
+ userCreationPage.typeIntoElementByIdPostClearDob(
+ "date_of_birth",
+ "01011998"
+ );
userCreationPage.clickElementById("submit");
userCreationPage.verifyElementContainsText(
"contactno-profile-details",
@@ -110,7 +110,10 @@ describe("User Creation", () => {
"lastname-profile-details",
"Cypress"
);
- userCreationPage.verifyElementContainsText("age-profile-details", "22");
+ userCreationPage.verifyElementContainsText(
+ "date_of_birth-profile-details",
+ "01/01/1998"
+ );
userCreationPage.verifyElementContainsText(
"emailid-profile-details",
"test@test.com"
@@ -130,7 +133,6 @@ describe("User Creation", () => {
userCreationPage.clickElementById("edit-cancel-profile-button");
userCreationPage.clearIntoElementById("firstName");
userCreationPage.clearIntoElementById("lastName");
- userCreationPage.clearIntoElementById("age");
userCreationPage.clearIntoElementById("phoneNumber");
userCreationPage.clearIntoElementById("altPhoneNumber");
userCreationPage.clearIntoElementById("weekly_working_hours");
diff --git a/cypress/e2e/users_spec/user_profile.cy.ts b/cypress/e2e/users_spec/user_profile.cy.ts
index 3f3202eb423..3cbc2e91404 100644
--- a/cypress/e2e/users_spec/user_profile.cy.ts
+++ b/cypress/e2e/users_spec/user_profile.cy.ts
@@ -8,7 +8,7 @@ describe("Manage User Profile", () => {
const userProfilePage = new UserProfilePage();
const manageUserPage = new ManageUserPage();
- const age = "30";
+ const date_of_birth = "01011999";
const gender = "Male";
const email = "test@example.com";
const phone = "+918899887788";
@@ -32,10 +32,10 @@ describe("Manage User Profile", () => {
cy.awaitUrl("/user/profile");
});
- it("Set Age, Gender, Email, Phone and Working Hours for a user and verify its reflection in user profile", () => {
+ it("Set Dob, Gender, Email, Phone and Working Hours for a user and verify its reflection in user profile", () => {
userProfilePage.clickEditProfileButton();
- userProfilePage.typeAge(age);
+ userProfilePage.typedate_of_birth(date_of_birth);
userProfilePage.selectGender(gender);
userProfilePage.typeEmail(email);
userProfilePage.typePhone(phone);
@@ -49,7 +49,7 @@ describe("Manage User Profile", () => {
cy.verifyNotification("Details updated successfully");
- userProfilePage.assertAge(age);
+ userProfilePage.assertdate_of_birth("01/01/1999");
userProfilePage.assertGender(gender);
userProfilePage.assertEmail(email);
userProfilePage.assertPhone(phone);
diff --git a/cypress/pageobject/Users/UserCreation.ts b/cypress/pageobject/Users/UserCreation.ts
index 32127ffcb90..c10d853f706 100644
--- a/cypress/pageobject/Users/UserCreation.ts
+++ b/cypress/pageobject/Users/UserCreation.ts
@@ -17,7 +17,10 @@ export class UserCreationPage {
.click()
.type(value);
}
-
+ typeIntoElementByIdPostClearDob(elementId: string, value: string) {
+ cy.get("#" + elementId).click();
+ cy.get("#date-input").clear().type(value);
+ }
clearIntoElementById(elementId: string) {
cy.get("#" + elementId)
.click()
diff --git a/cypress/pageobject/Users/UserProfilePage.ts b/cypress/pageobject/Users/UserProfilePage.ts
index 3f71a29181b..cb5f6d11f1c 100644
--- a/cypress/pageobject/Users/UserProfilePage.ts
+++ b/cypress/pageobject/Users/UserProfilePage.ts
@@ -1,3 +1,5 @@
+import { cy } from "local-cypress";
+
export default class UserProfilePage {
assertVideoConnectLink(link: string) {
cy.get("#videoconnectlink-profile-details").should("contain.text", link);
@@ -15,8 +17,10 @@ export default class UserProfilePage {
cy.get("#submit").click();
}
- typeAge(age: string) {
- cy.get("#age").click().clear().type(age);
+ typedate_of_birth(date_of_birth: string) {
+ //check
+ cy.get("#date_of_birth").click();
+ cy.get("#date-input").clear().type(date_of_birth);
}
selectGender(gender: string) {
@@ -55,8 +59,11 @@ export default class UserProfilePage {
.type(medicalCouncilRegistration);
};
- assertAge(age: string) {
- cy.get("#age-profile-details").should("contain.text", age);
+ assertdate_of_birth(date_of_birth: string) {
+ cy.get("#date_of_birth-profile-details").should(
+ "contain.text",
+ date_of_birth
+ );
}
assertGender(gender: string) {
diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts
index f4b7becdcae..94af548f6cd 100644
--- a/cypress/support/commands.ts
+++ b/cypress/support/commands.ts
@@ -78,8 +78,7 @@ Cypress.Commands.add(
);
Cypress.Commands.add("verifyNotification", (text) => {
- cy.get(".pnotify-container").should("exist").contains(text);
- return cy.get(".pnotify-container").contains(text).click({ force: true });
+ return cy.get(".pnotify-container").should("exist").contains(text);
});
Cypress.on("uncaught:exception", () => {
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/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 c5e8880cb50..f1aed577cea 100644
--- a/src/Common/constants.tsx
+++ b/src/Common/constants.tsx
@@ -742,7 +742,7 @@ export const GENDER: { [key: number]: string } = GENDER_TYPES.reduce(
);
export type CameraPTZ = {
- icon?: string;
+ icon?: IconName;
label: string;
action: string;
loadingLabel?: string;
@@ -1172,6 +1172,21 @@ export const IN_LANDLINE_AREA_CODES = [
"891",
"4822",
];
+
+export const CONSENT_TYPE_CHOICES = [
+ { id: 1, text: "Consent for admission" },
+ { id: 2, text: "Patient Code Status" },
+ { id: 3, text: "Consent for procedure" },
+ { id: 4, text: "High risk consent" },
+ { id: 5, text: "Others" },
+];
+
+export const CONSENT_PATIENT_CODE_STATUS_CHOICES = [
+ { id: 1, text: "Do Not Hospitalise (DNH)" },
+ { id: 2, text: "Do Not Resuscitate (DNR)" },
+ { id: 3, text: "Comfort Care Only" },
+ { id: 4, text: "Active treatment (Default)" },
+];
export const OCCUPATION_TYPES = [
{ id: 1, text: "Student", value: "STUDENT" },
{
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..cf2989423d8 100644
--- a/src/Components/Assets/AssetManage.tsx
+++ b/src/Components/Assets/AssetManage.tsx
@@ -271,7 +271,7 @@ const AssetManage = (props: AssetManageProps) => {
@@ -332,7 +332,7 @@ const AssetManage = (props: AssetManageProps) => {
ghost
border
>
-
+
Export as JSON
}
@@ -357,7 +357,8 @@ const AssetManage = (props: AssetManageProps) => {
{assetClassProp.name}
@@ -387,6 +388,13 @@ const AssetManage = (props: AssetManageProps) => {
{warrantyAmcValidityChip(
asset?.warranty_amc_end_of_validity as string
)}
+ {asset?.latest_status === "Down" && (
+
+ )}
@@ -397,17 +405,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 +433,7 @@ const AssetManage = (props: AssetManageProps) => {
data-testid="asset-update-button"
authorizeFor={NonReadOnlyUsers}
>
-
+
{t("update")}
{asset?.asset_class &&
@@ -442,7 +450,7 @@ const AssetManage = (props: AssetManageProps) => {
id="configure-asset"
data-testid="asset-configure-button"
>
-
+
{t("configure")}
)}
@@ -454,7 +462,7 @@ const AssetManage = (props: AssetManageProps) => {
data-testid="asset-delete-button"
className="inline-flex"
>
-
+
{t("delete")}
)}
@@ -467,14 +475,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) {
-
+
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 6714d8bdb08..e94a2826398 100644
--- a/src/Components/Common/Export.tsx
+++ b/src/Components/Common/Export.tsx
@@ -63,7 +63,7 @@ export const ExportMenu = ({
}
+ icon={}
className="tooltip border-primary-500 bg-white text-primary-500 hover:bg-primary-100 enabled:border"
>
{exportItems.map((item) => (
@@ -103,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/PageTitle.tsx b/src/Components/Common/PageTitle.tsx
index 4f29ca892e3..6fb38a36f08 100644
--- a/src/Components/Common/PageTitle.tsx
+++ b/src/Components/Common/PageTitle.tsx
@@ -26,6 +26,7 @@ export interface PageTitleProps {
};
focusOnLoad?: boolean;
isInsidePage?: boolean;
+ changePageMetadata?: boolean;
}
export default function PageTitle({
@@ -40,6 +41,7 @@ export default function PageTitle({
justifyContents = "justify-start",
focusOnLoad = false,
isInsidePage = false,
+ changePageMetadata = true,
}: PageTitleProps) {
const divRef = useRef();
@@ -56,7 +58,7 @@ export default function PageTitle({
ref={divRef}
className={isInsidePage ? "" : `mb-2 pt-4 md:mb-4 ${className}`}
>
-
+ {changePageMetadata && }
{!hideBack && (
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/Page.tsx b/src/Components/Common/components/Page.tsx
index ce5e84deefe..437a4ef21f7 100644
--- a/src/Components/Common/components/Page.tsx
+++ b/src/Components/Common/components/Page.tsx
@@ -6,6 +6,7 @@ import { SidebarShrinkContext } from "../Sidebar/Sidebar";
interface PageProps extends PageTitleProps {
children: React.ReactNode | React.ReactNode[];
options?: React.ReactNode | React.ReactNode[];
+ changePageMetadata?: boolean;
className?: string;
noImplicitPadding?: boolean;
ref?: RefObject;
@@ -39,6 +40,7 @@ export default function Page(props: PageProps) {
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/Diagnosis/ConsultationDiagnosisBuilder/AddICD11Diagnosis.tsx b/src/Components/Diagnosis/ConsultationDiagnosisBuilder/AddICD11Diagnosis.tsx
index 4cf55a82b13..d405a0611d8 100644
--- a/src/Components/Diagnosis/ConsultationDiagnosisBuilder/AddICD11Diagnosis.tsx
+++ b/src/Components/Diagnosis/ConsultationDiagnosisBuilder/AddICD11Diagnosis.tsx
@@ -22,7 +22,7 @@ export default function AddICD11Diagnosis(props: AddICD11DiagnosisProps) {
const { t } = useTranslation();
const [selected, setSelected] = useState
();
const [adding, setAdding] = useState(false);
- const hasError = !!props.disallowed.find((d) => d.id === selected?.id);
+ const hasError = !!props.disallowed.find((d) => d?.id === selected?.id);
const { fetchOptions, isLoading, options } =
useAsyncOptions("id");
diff --git a/src/Components/ExternalResult/ResultList.tsx b/src/Components/ExternalResult/ResultList.tsx
index 88a385394aa..3cedd0fc109 100644
--- a/src/Components/ExternalResult/ResultList.tsx
+++ b/src/Components/ExternalResult/ResultList.tsx
@@ -245,7 +245,7 @@ export default function ResultList() {
label: "Import Results",
action: () => navigate("/external_results/upload"),
options: {
- icon: ,
+ icon: ,
},
},
]
@@ -259,7 +259,7 @@ export default function ResultList() {
),
filePrefix: "external_results",
options: {
- icon: ,
+ icon: ,
},
},
]}
diff --git a/src/Components/Facility/AddInventoryForm.tsx b/src/Components/Facility/AddInventoryForm.tsx
index 5188f50d088..b9f6c4c7bae 100644
--- a/src/Components/Facility/AddInventoryForm.tsx
+++ b/src/Components/Facility/AddInventoryForm.tsx
@@ -160,6 +160,9 @@ export const AddInventoryForm = (props: any) => {
if (!state.form[field]?.length) {
errors[field] = "Please select a quantity";
invalidForm = true;
+ } else if (state.form[field] <= 0) {
+ errors[field] = "Quantity must be more than 0";
+ invalidForm = true;
}
return;
case "unit":
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 e8a64b5310d..6b9848ad898 100644
--- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx
+++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx
@@ -7,7 +7,12 @@ import { BedModel } from "../models";
import HL7PatientVitalsMonitor from "../../VitalsMonitor/HL7PatientVitalsMonitor";
import VentilatorPatientVitalsMonitor from "../../VitalsMonitor/VentilatorPatientVitalsMonitor";
import useVitalsAspectRatioConfig from "../../VitalsMonitor/useVitalsAspectRatioConfig";
-import { DISCHARGE_REASONS, SYMPTOM_CHOICES } from "../../../Common/constants";
+import {
+ CONSENT_PATIENT_CODE_STATUS_CHOICES,
+ CONSENT_TYPE_CHOICES,
+ DISCHARGE_REASONS,
+ SYMPTOM_CHOICES,
+} from "../../../Common/constants";
import PrescriptionsTable from "../../Medicine/PrescriptionsTable";
import Chip from "../../../CAREUI/display/Chip";
import { formatAge, formatDate, formatDateTime } from "../../../Utils/utils";
@@ -16,6 +21,7 @@ import DailyRoundsList from "../Consultations/DailyRoundsList";
import EventsList from "./Events/EventsList";
import SwitchTabs from "../../Common/components/SwitchTabs";
import { getVitalsMonitorSocketUrl } from "../../VitalsMonitor/utils";
+import { FileUpload } from "../../Patient/FileUpload";
const PageTitle = lazy(() => import("../../Common/PageTitle"));
@@ -669,6 +675,47 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
+ {(
+ props.consultationData.consent_records?.filter(
+ (record) => record.deleted !== true
+ ) || []
+ ).length > 0 && (
+ <>
+
+
+ Consent Records
+
+ {props.consultationData.consent_records
+ ?.filter((record) => record.deleted !== true)
+ ?.map((record, i) => (
+
+
+ {
+ CONSENT_TYPE_CHOICES.find(
+ (c) => c.id === record.type
+ )?.text
+ }{" "}
+ {record.patient_code_status &&
+ `( ${
+ CONSENT_PATIENT_CODE_STATUS_CHOICES.find(
+ (c) => c.id === record.patient_code_status
+ )?.text
+ } )`}
+
+
+
+ ))}
+
+ >
+ )}
diff --git a/src/Components/Facility/ConsultationDetails/index.tsx b/src/Components/Facility/ConsultationDetails/index.tsx
index b422fc8867d..6ce75c6ed70 100644
--- a/src/Components/Facility/ConsultationDetails/index.tsx
+++ b/src/Components/Facility/ConsultationDetails/index.tsx
@@ -228,7 +228,7 @@ export const ConsultationDetails = (props: any) => {
//
{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..4d2d58457e5 100644
--- a/src/Components/Facility/ConsultationForm.tsx
+++ b/src/Components/Facility/ConsultationForm.tsx
@@ -8,6 +8,8 @@ import {
PATIENT_CATEGORIES,
REVIEW_AT_CHOICES,
TELEMEDICINE_ACTIONS,
+ CONSENT_TYPE_CHOICES,
+ CONSENT_PATIENT_CODE_STATUS_CHOICES,
} from "../../Common/constants";
import { Cancel, Submit } from "../Common/components/ButtonV2";
import { DraftSection, useAutoSaveReducer } from "../../Utils/AutoSave";
@@ -30,6 +32,7 @@ import {
createConsultation,
getConsultation,
getPatient,
+ partialUpdateConsultation,
updateConsultation,
} from "../../Redux/actions";
import { statusType, useAbortableEffect } from "../../Common/utils";
@@ -74,12 +77,21 @@ import {
CreateDiagnosesBuilder,
EditDiagnosesBuilder,
} from "../Diagnosis/ConsultationDiagnosisBuilder/ConsultationDiagnosisBuilder.js";
+import { FileUpload } from "../Patient/FileUpload.js";
+import ConfirmDialog from "../Common/ConfirmDialog.js";
const Loading = lazy(() => import("../Common/Loading"));
const PageTitle = lazy(() => import("../Common/PageTitle"));
type BooleanStrings = "true" | "false";
+export type ConsentRecord = {
+ id: string;
+ type: (typeof CONSENT_TYPE_CHOICES)[number]["id"];
+ patient_code_status?: (typeof CONSENT_PATIENT_CODE_STATUS_CHOICES)[number]["id"];
+ deleted?: boolean;
+};
+
type FormDetails = {
symptoms: number[];
other_symptoms: string;
@@ -128,6 +140,7 @@ type FormDetails = {
death_confirmed_doctor: string;
InvestigationAdvice: InvestigationType[];
procedures: ProcedureType[];
+ consent_records: ConsentRecord[];
};
const initForm: FormDetails = {
@@ -178,6 +191,7 @@ const initForm: FormDetails = {
death_confirmed_doctor: "",
InvestigationAdvice: [],
procedures: [],
+ consent_records: [],
};
const initError = Object.assign(
@@ -228,6 +242,7 @@ type ConsultationFormSection =
| "Consultation Details"
| "Diagnosis"
| "Treatment Plan"
+ | "Consent Records"
| "Bed Status";
type Props = {
@@ -261,38 +276,51 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
const [diagnosisVisible, diagnosisRef] = useVisibility(-300);
const [treatmentPlanVisible, treatmentPlanRef] = useVisibility(-300);
const [bedStatusVisible, bedStatusRef] = useVisibility(-300);
+ const [consentRecordsVisible, consentRecordsRef] = useVisibility(-300);
const [disabledFields, setDisabledFields] = useState([]);
+ const [collapsedConsentRecords, setCollapsedConsentRecords] = useState<
+ number[]
+ >([]);
+ const [showDeleteConsent, setShowDeleteConsent] = useState(
+ null
+ );
const { min_encounter_date } = useConfig();
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,
},
+ "Consent Records": {
+ iconClass: "care-l-file-alt",
+ visible: consentRecordsVisible,
+ ref: consentRecordsRef,
+ },
"Bed Status": {
- iconClass: "care-l-bed",
+ iconClass: "l-bed",
visible: bedStatusVisible,
ref: bedStatusRef,
},
- };
+ } as const;
useEffect(() => {
setCurrentSection((prev) => {
if (consultationDetailsVisible) return "Consultation Details";
if (diagnosisVisible) return "Diagnosis";
if (treatmentPlanVisible) return "Treatment Plan";
+ if (consentRecordsVisible) return "Consent Records";
if (bedStatusVisible) return "Bed Status";
return prev;
});
@@ -300,6 +328,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
consultationDetailsVisible,
diagnosisVisible,
treatmentPlanVisible,
+ consentRecordsVisible,
bedStatusVisible,
]);
@@ -762,6 +791,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
height: Number(state.form.height),
bed: bed && bed instanceof Array ? bed[0]?.id : bed?.id,
patient_no: state.form.patient_no || null,
+ consent_records: state.form.consent_records || [],
};
const res = await dispatchAction(
@@ -838,7 +868,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}
>
-
+
diff --git a/src/Components/Facility/Consultations/components/LinePlot.tsx b/src/Components/Facility/Consultations/components/LinePlot.tsx
index 92e3afcec61..667240428e5 100644
--- a/src/Components/Facility/Consultations/components/LinePlot.tsx
+++ b/src/Components/Facility/Consultations/components/LinePlot.tsx
@@ -13,6 +13,7 @@ import {
import * as echarts from "echarts/core";
import { CanvasRenderer } from "echarts/renderers";
+import { properRoundOf } from "../../../../Utils/utils";
echarts.use([
BarChart,
LineChart,
@@ -46,7 +47,9 @@ export const LinePlot = (props: any) => {
containLabel: true,
},
title: {
- text: `${title} [ {0|${yData[yData.length - 1]?.toFixed(2) || "NA"}} ]`,
+ text: `${title} [ {0|${
+ yData[yData.length - 1] ? properRoundOf(yData[yData.length - 1]) : "NA"
+ }} ]`,
textStyle: {
fontSize: 14,
rich: {
@@ -225,11 +228,18 @@ export const LinePlot = (props: any) => {
}
return (
-
+ <>
+ {yData.map((value: any, idx: any) => (
+
+ {value ? properRoundOf(value) : "NA"}
+
+ ))}
+
+ >
);
};
diff --git a/src/Components/Facility/CoverImageEditModal.tsx b/src/Components/Facility/CoverImageEditModal.tsx
index 5e6e505617f..e2aef8cd0d4 100644
--- a/src/Components/Facility/CoverImageEditModal.tsx
+++ b/src/Components/Facility/CoverImageEditModal.tsx
@@ -252,7 +252,7 @@ const CoverImageEditModal = ({
id="upload-cover-image"
className="flex w-full cursor-pointer items-center justify-center gap-1 rounded-lg border border-primary-500 bg-white px-4 py-2 text-sm font-medium text-primary-500 transition-all hover:border-primary-400 hover:text-primary-400"
>
-
+
{t("upload_an_image")}
{isUploading ? (
-
+
) : (
-
+
)}
{isUploading ? `${t("uploading")}...` : `${t("save")}`}
@@ -371,7 +371,10 @@ const CoverImageEditModal = ({
{isCaptureImgBeingUploaded && (
-
+
)}
{t("submit")}
@@ -397,7 +400,7 @@ const CoverImageEditModal = ({
-
+
{`${t("switch")} ${t("camera")}`}
@@ -412,7 +415,7 @@ const CoverImageEditModal = ({
captureImage();
}}
>
-
+
{t("capture")}
@@ -430,7 +433,10 @@ const CoverImageEditModal = ({
{isCaptureImgBeingUploaded ? (
<>
-
+
{`${t("submitting")}...`}
>
) : (
diff --git a/src/Components/Facility/DischargeModal.tsx b/src/Components/Facility/DischargeModal.tsx
index 892be2e916b..e3952ed0825 100644
--- a/src/Components/Facility/DischargeModal.tsx
+++ b/src/Components/Facility/DischargeModal.tsx
@@ -182,7 +182,7 @@ const DischargeModal = ({
Discharge patient from CARE
-
+
Caution: this action is irreversible.
diff --git a/src/Components/Facility/DischargeSummaryModal.tsx b/src/Components/Facility/DischargeSummaryModal.tsx
index 36e2de8a591..2a9dc9fce15 100644
--- a/src/Components/Facility/DischargeSummaryModal.tsx
+++ b/src/Components/Facility/DischargeSummaryModal.tsx
@@ -155,7 +155,10 @@ export default function DischargeSummaryModal(props: Props) {
{t("email_discharge_summary_description")}
-
+
{`${t("disclaimer")}: ${t("generated_summary_caution")}`}
@@ -178,9 +181,9 @@ export default function DischargeSummaryModal(props: Props) {
{downloading ? (
-
+
) : (
-
+
)}
{generating
@@ -192,9 +195,9 @@ export default function DischargeSummaryModal(props: Props) {
{emailing ? (
-
+
) : (
-
+
)}
{t("send_email")}
diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx
index 1ebbbca67a6..a8732f959eb 100644
--- a/src/Components/Facility/DoctorVideoSlideover.tsx
+++ b/src/Components/Facility/DoctorVideoSlideover.tsx
@@ -1,7 +1,5 @@
import React, { useEffect, useState } from "react";
-import { useDispatch } from "react-redux";
import SlideOver from "../../CAREUI/interactive/SlideOver";
-import { getFacilityUsers } from "../../Redux/actions";
import { UserAssignedModel } from "../Users/models";
import { SkillObjectModel } from "../Users/models";
import CareIcon, { IconName } from "../../CAREUI/icons/CareIcon";
@@ -9,6 +7,19 @@ import { relativeTime } from "../../Utils/utils";
import useAuthUser from "../../Common/hooks/useAuthUser";
import { triggerGoal } from "../../Integrations/Plausible";
import { Warn } from "../../Utils/Notifications";
+import Switch from "../../CAREUI/interactive/Switch";
+import useQuery from "../../Utils/request/useQuery";
+import routes from "../../Redux/api";
+
+enum FilterTypes {
+ ALL = "All",
+ DOCTOR = "Doctor",
+ NURSE = "Nurse",
+ TELEICU = "TeleICU Hub",
+}
+
+const isHomeUser = (user: UserAssignedModel, facilityId: string) =>
+ user.home_facility_object?.id === facilityId;
export default function DoctorVideoSlideover(props: {
show: boolean;
@@ -16,90 +27,84 @@ export default function DoctorVideoSlideover(props: {
setShow: (show: boolean) => void;
}) {
const { show, facilityId, setShow } = props;
- const [doctors, setDoctors] = useState([]);
+ const [filteredDoctors, setFilteredDoctors] = useState(
+ []
+ );
+ const [filter, setFilter] = useState(FilterTypes.ALL);
+
+ const { data: users, loading } = useQuery(routes.getFacilityUsers, {
+ prefetch: show,
+ pathParams: { facility_id: facilityId },
+ query: { limit: 50 },
+ });
- const dispatchAction: any = useDispatch();
useEffect(() => {
- const fetchUsers = async () => {
- if (facilityId) {
- const res = await dispatchAction(
- getFacilityUsers(facilityId, { limit: 50 })
- );
- if (res?.data) {
- setDoctors(
- res.data.results
- .filter(
- (user: any) => user.alt_phone_number || user.video_connect_link
- )
- .sort((a: any, b: any) => {
- return Number(a.last_login) - Number(b.last_login);
- })
- );
- }
- } else {
- setDoctors([]);
- }
+ const filterDoctors = (users: UserAssignedModel[]) => {
+ return users.filter(
+ (user: UserAssignedModel) =>
+ (user.alt_phone_number || user.video_connect_link) &&
+ (user.user_type === "Doctor" || user.user_type === "Nurse") &&
+ (filter === FilterTypes.ALL ||
+ (filter === FilterTypes.DOCTOR &&
+ isHomeUser(user, facilityId) &&
+ user.user_type === "Doctor") ||
+ (filter === FilterTypes.NURSE &&
+ isHomeUser(user, facilityId) &&
+ user.user_type === "Nurse") ||
+ (filter === FilterTypes.TELEICU && !isHomeUser(user, facilityId)))
+ );
};
- if (show) {
- fetchUsers();
+ if (users?.results && !loading) {
+ setFilteredDoctors(
+ filterDoctors(users.results).sort(
+ (a: UserAssignedModel, b: UserAssignedModel) => {
+ const aIsHomeUser = isHomeUser(a, facilityId);
+ const bIsHomeUser = isHomeUser(b, facilityId);
+ return aIsHomeUser === bIsHomeUser ? 0 : aIsHomeUser ? -1 : 1;
+ }
+ )
+ );
}
- }, [show, facilityId]);
+ }, [facilityId, filter, loading, users?.results]);
return (
{/* Title and close button */}
Select a doctor to connect via video
- {[
- {
- title: "Doctors",
- user_type: "Doctor",
- home: true,
- },
- {
- title: "Nurse",
- user_type: "Nurse",
- home: true,
- },
- {
- title: "TeleICU Hub",
- user_type: "Doctor",
- home: false,
- },
- ].map((type, i) => (
+
+ ({ ...acc, [type]: type }),
+ {}
+ ) as Record
+ }
+ selected={filter}
+ onChange={(tab) => setFilter(tab)}
+ size="md"
+ />
+
+ {filteredDoctors.map((doctor, i) => (
-
- {type.title}
-
-
-
- {doctors
- .filter((doc) => {
- const isHomeUser =
- (doc.home_facility_object?.id || "") === facilityId;
- return (
- doc.user_type === type.user_type && isHomeUser === type.home
- );
- })
- .map((doctor) => {
- return ;
- })}
+
))}
@@ -107,11 +112,11 @@ export default function DoctorVideoSlideover(props: {
);
}
-function UserListItem(props: { user: UserAssignedModel }) {
+function UserListItem(props: { user: UserAssignedModel; facilityId: string }) {
const user = props.user;
+ const facilityId = props.facilityId;
const icon: IconName =
user.user_type === "Doctor" ? "l-user-md" : "l-user-nurse";
- const authUser = useAuthUser();
function connectOnWhatsApp(e: React.MouseEvent) {
e.stopPropagation();
@@ -172,99 +177,63 @@ function UserListItem(props: { user: UserAssignedModel }) {
}
return (
-
-
-
-
- {
- // Show online icon based on last_login
- user.last_login &&
- Number(new Date()) - Number(new Date(user.last_login)) < 60000 ? (
-
- ) : (
-
- )
- }
-
- */}
diff --git a/src/Components/Facility/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/SetInventoryForm.tsx b/src/Components/Facility/SetInventoryForm.tsx
index c963aa05f5f..e580b297a0f 100644
--- a/src/Components/Facility/SetInventoryForm.tsx
+++ b/src/Components/Facility/SetInventoryForm.tsx
@@ -16,8 +16,13 @@ const initForm = {
id: "",
quantity: "",
};
+const initError = Object.assign(
+ {},
+ ...Object.keys(initForm).map((k) => ({ [k]: "" }))
+);
const initialState = {
form: { ...initForm },
+ errors: { ...initError },
};
const inventoryFormReducer = (state = initialState, action: any) => {
@@ -99,8 +104,32 @@ export const SetInventoryForm = (props: any) => {
}
}, [state.form.id]);
+ const validateForm = () => {
+ const errors = { ...initError };
+ let invalidForm = false;
+
+ Object.keys(state.form).forEach((field) => {
+ switch (field) {
+ case "quantity":
+ if (!state.form[field]?.length) {
+ errors[field] = "Please select a quantity";
+ invalidForm = true;
+ } else if (state.form[field] < 0) {
+ errors[field] = "Quantity can't be negative";
+ invalidForm = true;
+ }
+ return;
+ }
+ });
+
+ dispatch({ type: "set_error", errors });
+ return !invalidForm;
+ };
+
const handleSubmit = async (e: any) => {
e.preventDefault();
+ const validated = validateForm();
+ if (!validated) return;
await request(routes.setMinQuantity, {
pathParams: { facilityId },
body: {
@@ -159,6 +188,7 @@ export const SetInventoryForm = (props: any) => {
type="number"
value={state.form.quantity}
onChange={handleChange}
+ error={state.errors.quantity}
/>
{
-
+
A Triage already exist on this date
}
diff --git a/src/Components/Facility/models.tsx b/src/Components/Facility/models.tsx
index 58386bef3a4..1e590797f83 100644
--- a/src/Components/Facility/models.tsx
+++ b/src/Components/Facility/models.tsx
@@ -7,6 +7,7 @@ import { ConsultationDiagnosis, CreateDiagnosis } from "../Diagnosis/types";
import { NormalPrescription, PRNPrescription } from "../Medicine/models";
import { AssignedToObjectModel, DailyRoundsModel } from "../Patient/models";
import { UserBareMinimum } from "../Users/models";
+import { ConsentRecord } from "./ConsultationForm";
export interface LocalBodyModel {
id: number;
@@ -164,6 +165,7 @@ export interface ConsultationModel {
is_readmission?: boolean;
medico_legal_case?: boolean;
investigation?: InvestigationType[];
+ consent_records?: ConsentRecord[];
}
export interface PatientStatsModel {
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/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/FileUpload.tsx b/src/Components/Patient/FileUpload.tsx
index 804dedcde10..0c8cad60005 100644
--- a/src/Components/Patient/FileUpload.tsx
+++ b/src/Components/Patient/FileUpload.tsx
@@ -104,11 +104,15 @@ interface FileUploadProps {
patientId?: any;
facilityId?: any;
consultationId?: any;
+ consentId?: string;
hideBack: boolean;
audio?: boolean;
unspecified: boolean;
sampleId?: string;
claimId?: string;
+ className?: string;
+ hideUpload?: boolean;
+ changePageMetadata?: boolean;
}
interface URLS {
@@ -144,12 +148,14 @@ export const FileUpload = (props: FileUploadProps) => {
facilityId,
consultationId,
patientId,
+ consentId,
type,
hideBack,
audio,
unspecified,
sampleId,
claimId,
+ changePageMetadata,
} = props;
const id = patientId;
const [isLoading, setIsLoading] = useState(false);
@@ -302,6 +308,8 @@ export const FileUpload = (props: FileUploadProps) => {
switch (type) {
case "PATIENT":
return patientId;
+ case "CONSENT_RECORD":
+ return consentId;
case "CONSULTATION":
return consultationId;
case "SAMPLE_MANAGEMENT":
@@ -559,7 +567,10 @@ export const FileUpload = (props: FileUploadProps) => {
const renderFileUpload = (item: FileUploadModel) => {
const isPreviewSupported = previewExtensions.includes(item.extension ?? "");
return (
-
+
{!item.is_archived ? (
<>
{item.file_category === "AUDIO" ? (
@@ -629,7 +640,10 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="m-1 w-full sm:w-auto"
>
-
{" "}
+
{" "}
DOWNLOAD
{item?.uploaded_by?.username === authUser.username ||
@@ -647,7 +661,7 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="m-1 w-full sm:w-auto"
>
-
+
RENAME
>
@@ -669,7 +683,7 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="m-1 w-full sm:w-auto"
>
-
+
ARCHIVE
>
@@ -762,7 +776,7 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="m-1 w-full sm:w-auto"
>
-
+
RENAME
>
@@ -782,7 +796,7 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="m-1 w-full sm:w-auto"
>
-
+
ARCHIVE
>
@@ -872,7 +886,8 @@ export const FileUpload = (props: FileUploadProps) => {
{" "}
- FILE ARCHIVED
+ FILE
+ ARCHIVED
{
@@ -886,7 +901,7 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="m-1 w-full sm:w-auto"
>
-
+
MORE DETAILS
@@ -1128,7 +1143,7 @@ export const FileUpload = (props: FileUploadProps) => {
};
return (
-
+
{
title={
-
+
Camera
@@ -1239,7 +1257,7 @@ export const FileUpload = (props: FileUploadProps) => {
-
+
{`${t("switch")} ${t("camera")}`}
@@ -1254,7 +1272,7 @@ export const FileUpload = (props: FileUploadProps) => {
captureImage();
}}
>
-
+
{t("capture")}
@@ -1299,7 +1317,10 @@ export const FileUpload = (props: FileUploadProps) => {
title={
-
+
Rename File
@@ -1343,7 +1364,10 @@ export const FileUpload = (props: FileUploadProps) => {
title={
-
+
Archive File
@@ -1390,7 +1414,10 @@ export const FileUpload = (props: FileUploadProps) => {
title={
-
+
File Details
@@ -1422,169 +1449,186 @@ export const FileUpload = (props: FileUploadProps) => {
-
-
- {audio ? (
-
-
Record and Upload Audio File
-
{
- setAudioName(e.value);
- }}
- error={audioFileError}
- />
- {audiouploadStarted ? (
-
- ) : (
-
- {audioBlobExists && (
-
+ {!props.hideUpload && (
+
+
+ {audio ? (
+
+
Record and Upload Audio File
+
{
+ setAudioName(e.value);
+ }}
+ error={audioFileError}
+ />
+ {audiouploadStarted ? (
+
+ ) : (
+
+ {audioBlobExists && (
+
+ {
+ deleteAudioBlob();
+ }}
+ >
+ Delete
+
+
+ )}
+
+
+ {!audioBlobExists && (
+
+
+ Please allow browser permission before you start
+ speaking
+
+ )}
+
+ {audioBlobExists && (
+
+ {
+ handleAudioUpload();
+ }}
+ className="w-full"
+ >
+
+ Save
+
+
+ )}
+
+ )}
+
+ ) : null}
+ {unspecified ? (
+
+
+
Upload New File
+
+
{
+ setUploadFileName(e.value);
+ }}
+ error={uploadFileError}
+ />
+
+ {uploadStarted ? (
+
+ ) : (
+
)}
-
-
- {!audioBlobExists && (
-
-
- Please allow browser permission before you start
- speaking
-
- )}
-
- {audioBlobExists && (
-
-
+ {file?.name}
+
+
+
)}
- )}
-
- ) : null}
- {unspecified ? (
-
-
-
Upload New File
-
{
- setUploadFileName(e.value);
- }}
- error={uploadFileError}
- />
-
- {uploadStarted ? (
-
- ) : (
-
-
- {({ isAuthorized }) =>
- isAuthorized ? (
-
- ) : (
- <>>
- )
- }
-
-
setModalOpenForCamera(true)}
- className="w-full"
- >
-
- Open Camera
-
-
-
- {t("upload")}
-
-
- )}
- {file && (
-
- {file?.name}
-
-
- )}
-
-
- ) : null}
-
-
-
-
+ ) : null}
+
+
+ )}
+
{
) : patient.last_consultation?.suggestion === "DC" ? (
-
+
Domiciliary Care
@@ -747,7 +750,7 @@ export const PatientManager = () => {
}}
className="w-full lg:w-fit"
>
-
+
Add Patient Details
@@ -793,7 +796,7 @@ export const PatientManager = () => {
setShowDoctors(true);
}}
>
-
+
Doctor Connect
)}
@@ -823,7 +826,7 @@ export const PatientManager = () => {
}}
className="mr-5 w-full lg:w-fit"
>
-
+
Export
) : (
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 59ec27b3c36..5c151553379 100644
--- a/src/Components/Patient/PatientHome.tsx
+++ b/src/Components/Patient/PatientHome.tsx
@@ -649,7 +649,7 @@ export const PatientHome = (props: any) => {
)
}
>
-
+
Update Details
@@ -666,7 +666,7 @@ export const PatientHome = (props: any) => {
}
authorizeFor={NonReadOnlyUsers}
>
-
+
{patientData.allow_transfer
? "Disable Transfer"
: "Allow Transfer"}
@@ -686,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}
@@ -739,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}
@@ -750,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"
>
-
+
{
(
@@ -766,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"}
@@ -786,7 +798,10 @@ export const PatientHome = (props: any) => {
: "rounded p-1 font-normal text-red-600")
}
>
-
+
{formatDateTime(shift.modified_date) || "--"}
@@ -802,7 +817,7 @@ export const PatientHome = (props: any) => {
navigate(`/shifting/${shift.external_id}`)
}
>
-
+
All Details
@@ -1030,7 +1045,10 @@ export const PatientHome = (props: any) => {
)}
>
-
+
@@ -1048,7 +1066,7 @@ export const PatientHome = (props: any) => {
-
+
@@ -1069,7 +1087,7 @@ export const PatientHome = (props: any) => {
-
+
@@ -1102,7 +1120,7 @@ export const PatientHome = (props: any) => {
} text-center `}
>
-
+
@@ -1144,7 +1162,7 @@ export const PatientHome = (props: any) => {
} text-center `}
>
-
+
@@ -1170,7 +1188,7 @@ export const PatientHome = (props: any) => {
-
+
@@ -1205,7 +1223,7 @@ export const PatientHome = (props: any) => {
)}
>
-
+
@@ -1244,7 +1262,7 @@ export const PatientHome = (props: any) => {
}
>
-
+
Add Consultation
@@ -1257,7 +1275,7 @@ export const PatientHome = (props: any) => {
}
>
-
+
Investigations Summary
@@ -1272,7 +1290,7 @@ export const PatientHome = (props: any) => {
}
>
-
+
View/Upload Patient Files
@@ -1289,7 +1307,7 @@ export const PatientHome = (props: any) => {
authorizeFor={NonReadOnlyUsers}
>
-
+
Shift Patient
@@ -1306,7 +1324,7 @@ export const PatientHome = (props: any) => {
authorizeFor={NonReadOnlyUsers}
>
-
+
Request Sample Test
@@ -1321,7 +1339,7 @@ export const PatientHome = (props: any) => {
}
>
-
+
View Patient Notes
@@ -1334,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 e91ce645626..eab3cd5f28f 100644
--- a/src/Components/Patient/PatientInfoCard.tsx
+++ b/src/Components/Patient/PatientInfoCard.tsx
@@ -324,7 +324,10 @@ export default function PatientInfoCard(props: {
@@ -525,7 +528,7 @@ export default function PatientInfoCard(props: {
className="w-full"
>
-
+
Log Update
@@ -537,8 +540,8 @@ export default function PatientInfoCard(props: {
<>
- {" "}
- No update filed in the last 24 hours
+ No update
+ filed in the last 24 hours
>
@@ -558,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,
@@ -566,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,
],
]
@@ -582,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,
],
]
@@ -623,7 +626,8 @@ export default function PatientInfoCard(props: {
}}
>
{action[1]}
@@ -658,7 +662,10 @@ export default function PatientInfoCard(props: {
});
}}
>
-
+
Show ABHA Profile
-
+
Link Care Context
>
@@ -691,7 +701,10 @@ export default function PatientInfoCard(props: {
}}
>
-
+
Link ABHA Number
@@ -719,7 +732,10 @@ export default function PatientInfoCard(props: {
}}
>
-
+
Track Shifting
@@ -734,7 +750,10 @@ export default function PatientInfoCard(props: {
}}
>
-
+
Shift Patient
@@ -753,7 +772,10 @@ export default function PatientInfoCard(props: {
}}
>
-
+
{t("discharge_summary")}
@@ -775,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 eb6c7104c04..85a5002f8da 100644
--- a/src/Components/Patient/PatientRegister.tsx
+++ b/src/Components/Patient/PatientRegister.tsx
@@ -1074,7 +1074,10 @@ export const PatientRegister = (props: PatientRegisterProps) => {
- {" "}
+ {" "}
Please enter the correct date of birth for the patient
@@ -1176,7 +1179,7 @@ export const PatientRegister = (props: PatientRegisterProps) => {
setQuery({ extId: "" }, { replace: true });
}}
>
-
+
Import From External Results
@@ -1560,7 +1563,10 @@ export const PatientRegister = (props: PatientRegisterProps) => {
+
}
title={
@@ -1894,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/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..421fab4ab06 100644
--- a/src/Components/Resource/ResourceBoardView.tsx
+++ b/src/Components/Resource/ResourceBoardView.tsx
@@ -76,7 +76,7 @@ export default function BoardView() {
/>
-
+
{t("list_view")}
-
-
+
+
{isLoading ? (
) : (
diff --git a/src/Components/Shifting/BoardView.tsx b/src/Components/Shifting/BoardView.tsx
index 6f6af362166..c08a7ffdfdd 100644
--- a/src/Components/Shifting/BoardView.tsx
+++ b/src/Components/Shifting/BoardView.tsx
@@ -113,7 +113,7 @@ export default function BoardView() {
isIconEnable && (
navigate("/shifting/list", { query: qParams })}
>
-
+
{t("list_view")}
{renderArrowIcons("left")}
{boardFilter.map((board) => (
diff --git a/src/Components/Shifting/ListView.tsx b/src/Components/Shifting/ListView.tsx
index 228732f9ced..e1f0a0545e2 100644
--- a/src/Components/Shifting/ListView.tsx
+++ b/src/Components/Shifting/ListView.tsx
@@ -276,7 +276,7 @@ export default function ListView() {
className="py-[11px]"
onClick={() => navigate("/shifting/board", { query: qParams })}
>
-
+
{t("board_view")}
diff --git a/src/Components/Users/ManageUsers.tsx b/src/Components/Users/ManageUsers.tsx
index dbfca3a815a..d25d6ec1d6c 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
@@ -638,7 +638,16 @@ function UserFacilities(props: { user: any }) {
pathParams: { username },
body: { home_facility: facility.id.toString() },
});
- if (res && res.status === 200) user.home_facility_object = facility;
+ if (!res?.ok) {
+ Notification.Error({
+ msg: "Error while updating Home facility",
+ });
+ } else {
+ user.home_facility_object = facility;
+ Notification.Success({
+ msg: "Home Facility updated successfully",
+ });
+ }
await refetchUserFacilities();
setIsLoading(false);
};
@@ -649,12 +658,31 @@ function UserFacilities(props: { user: any }) {
const { res } = await request(routes.clearHomeFacility, {
pathParams: { username },
});
- if (res && res.status === 204) user.home_facility_object = null;
+
+ if (!res?.ok) {
+ Notification.Error({
+ msg: "Error while clearing home facility",
+ });
+ } else {
+ user.home_facility_object = null;
+ Notification.Success({
+ msg: "Home Facility cleared successfully",
+ });
+ }
} else {
- await request(routes.deleteUserFacility, {
+ const { res } = await request(routes.deleteUserFacility, {
pathParams: { username },
body: { facility: unlinkFacilityData?.facility?.id?.toString() },
});
+ if (!res?.ok) {
+ Notification.Error({
+ msg: "Error while unlinking home facility",
+ });
+ } else {
+ Notification.Success({
+ msg: "Facility unlinked successfully",
+ });
+ }
}
await refetchUserFacilities();
hideUnlinkFacilityModal();
@@ -667,10 +695,15 @@ function UserFacilities(props: { user: any }) {
pathParams: { username },
body: { facility: facility.id.toString() },
});
- if (res?.status !== 201) {
+
+ if (!res?.ok) {
Notification.Error({
msg: "Error while linking facility",
});
+ } else {
+ Notification.Success({
+ msg: "Facility linked successfully",
+ });
}
await refetchUserFacilities();
setIsLoading(false);
@@ -736,7 +769,7 @@ function UserFacilities(props: { user: any }) {
})
}
>
-
+
{t("clear_home_facility")}
@@ -791,7 +824,7 @@ function UserFacilities(props: { user: any }) {
}
}}
>
-
+
Set as home facility
@@ -808,7 +841,7 @@ function UserFacilities(props: { user: any }) {
})
}
>
-
+
Unlink Facility
diff --git a/src/Components/Users/SkillsSlideOver.tsx b/src/Components/Users/SkillsSlideOver.tsx
index 616dbb6404d..e7af920a533 100644
--- a/src/Components/Users/SkillsSlideOver.tsx
+++ b/src/Components/Users/SkillsSlideOver.tsx
@@ -45,6 +45,7 @@ export default ({ show, setShow, username }: IProps) => {
pathParams: { username },
body: { skill: skill.id },
});
+
if (!res?.ok) {
Notification.Error({
msg: "Error while adding skill",
@@ -70,6 +71,10 @@ export default ({ show, setShow, username }: IProps) => {
Notification.Error({
msg: "Error while unlinking skill",
});
+ } else {
+ Notification.Success({
+ msg: "Skill unlinked successfully",
+ });
}
setDeleteSkill(null);
await refetchUserSkills();
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/UserAdd.tsx b/src/Components/Users/UserAdd.tsx
index b4d9e9fbca6..c6de6c18fa4 100644
--- a/src/Components/Users/UserAdd.tsx
+++ b/src/Components/Users/UserAdd.tsx
@@ -67,7 +67,6 @@ type UserForm = {
phone_number: string;
alt_phone_number: string;
phone_number_is_whatsapp: boolean;
- age: number;
date_of_birth: Date | null;
state: number;
district: number;
@@ -91,7 +90,6 @@ const initForm: UserForm = {
phone_number: "+91",
alt_phone_number: "+91",
phone_number_is_whatsapp: true,
- age: 0,
date_of_birth: null,
state: 0,
district: 0,
@@ -471,7 +469,12 @@ export const UserAdd = (props: UserProps) => {
return;
case "date_of_birth":
if (!state.form[field]) {
- errors[field] = "Please enter date in YYYY/MM/DD format";
+ errors[field] = "Please enter date in DD/MM/YYYY format";
+ invalidForm = true;
+ } else if (
+ dayjs(state.form[field]).isAfter(dayjs().subtract(1, "year"))
+ ) {
+ errors[field] = "Enter a valid date of birth";
invalidForm = true;
}
return;
@@ -543,7 +546,6 @@ export const UserAdd = (props: UserProps) => {
: state.form.alt_phone_number
) ?? "",
date_of_birth: dateQueryString(state.form.date_of_birth),
- age: Number(dayjs().diff(state.form.date_of_birth, "years", false)),
doctor_qualification:
state.form.user_type === "Doctor"
? state.form.doctor_qualification
diff --git a/src/Components/Users/UserProfile.tsx b/src/Components/Users/UserProfile.tsx
index d1c23a9db64..43949165a55 100644
--- a/src/Components/Users/UserProfile.tsx
+++ b/src/Components/Users/UserProfile.tsx
@@ -5,7 +5,13 @@ import * as Notification from "../../Utils/Notifications.js";
import LanguageSelector from "../../Components/Common/LanguageSelector";
import TextFormField from "../Form/FormFields/TextFormField";
import ButtonV2, { Submit } from "../Common/components/ButtonV2";
-import { classNames, isValidUrl, parsePhoneNumber } from "../../Utils/utils";
+import {
+ classNames,
+ dateQueryString,
+ formatDate,
+ isValidUrl,
+ parsePhoneNumber,
+} from "../../Utils/utils";
import CareIcon from "../../CAREUI/icons/CareIcon";
import PhoneNumberFormField from "../Form/FormFields/PhoneNumberFormField";
import { FieldChangeEvent } from "../Form/FormFields/Utils";
@@ -18,13 +24,13 @@ import { PhoneNumberValidator } from "../Form/FieldValidators";
import useQuery from "../../Utils/request/useQuery";
import routes from "../../Redux/api";
import request from "../../Utils/request/request";
-
+import DateFormField from "../Form/FormFields/DateFormField";
const Loading = lazy(() => import("../Common/Loading"));
type EditForm = {
firstName: string;
lastName: string;
- age: string;
+ date_of_birth: Date | null | string;
gender: GenderType;
email: string;
video_connect_link: string | undefined;
@@ -34,12 +40,12 @@ type EditForm = {
doctor_qualification: string | undefined;
doctor_experience_commenced_on: number | string | undefined;
doctor_medical_council_registration: string | undefined;
- weekly_working_hours: string | null;
+ weekly_working_hours: string | null | undefined;
};
type ErrorForm = {
firstName: string;
lastName: string;
- age: string;
+ date_of_birth: string | null;
gender: string;
email: string;
video_connect_link: string | undefined;
@@ -62,7 +68,7 @@ type Action =
const initForm: EditForm = {
firstName: "",
lastName: "",
- age: "",
+ date_of_birth: null,
gender: "Male",
video_connect_link: "",
email: "",
@@ -145,7 +151,7 @@ export default function UserProfile() {
const formData: EditForm = {
firstName: result.data.first_name,
lastName: result.data.last_name,
- age: result.data.age?.toString() || "",
+ date_of_birth: result.data.date_of_birth || null,
gender: result.data.gender || "Male",
email: result.data.email,
video_connect_link: result.data.video_connect_link,
@@ -188,15 +194,15 @@ export default function UserProfile() {
invalidForm = true;
}
return;
- case "age":
+ case "date_of_birth":
if (!states.form[field]) {
- errors[field] = "This field is required";
+ errors[field] = "Enter a valid date of birth";
invalidForm = true;
} else if (
- Number(states.form[field]) <= 0 ||
- !/^\d+$/.test(states.form[field])
+ !dayjs(states.form[field]).isValid() ||
+ dayjs(states.form[field]).isAfter(dayjs().subtract(17, "year"))
) {
- errors[field] = "Age must be a number greater than 0";
+ errors[field] = "Enter a valid date of birth";
invalidForm = true;
}
return;
@@ -298,6 +304,9 @@ export default function UserProfile() {
});
};
+ const getDate = (value: any) =>
+ value && dayjs(value).isValid() && dayjs(value).toDate();
+
const fieldProps = (name: string) => {
return {
name,
@@ -321,7 +330,7 @@ export default function UserProfile() {
phone_number: parsePhoneNumber(states.form.phoneNumber) ?? "",
alt_phone_number: parsePhoneNumber(states.form.altPhoneNumber) ?? "",
gender: states.form.gender,
- age: +states.form.age,
+ date_of_birth: dateQueryString(states.form.date_of_birth),
doctor_qualification:
states.form.user_type === "Doctor"
? states.form.doctor_qualification
@@ -443,7 +452,7 @@ export default function UserProfile() {
{showEdit ? "Cancel" : "Edit User Profile"}
-
+
Sign out
@@ -520,12 +529,17 @@ export default function UserProfile() {
{userData?.last_name || "-"}
-
+
- Age
+ Date of Birth
- {userData?.age || "-"}
+ {userData?.date_of_birth
+ ? formatDate(userData?.date_of_birth)
+ : "-"}
@@ -649,13 +663,14 @@ export default function UserProfile() {
label="Last name"
className="col-span-6 sm:col-span-3"
/>
-
-
+
Update available
@@ -849,8 +864,9 @@ export default function UserProfile() {
{" "}
diff --git a/src/Components/Users/models.tsx b/src/Components/Users/models.tsx
index c31901b74ad..b0ef2b909cd 100644
--- a/src/Components/Users/models.tsx
+++ b/src/Components/Users/models.tsx
@@ -32,7 +32,7 @@ export type UserModel = UserBareMinimum & {
phone_number?: string;
alt_phone_number?: string;
gender?: GenderType;
- age?: number;
+ date_of_birth: Date | null | string;
is_superuser?: boolean;
verified?: boolean;
home_facility?: string;
@@ -65,7 +65,7 @@ export interface UserAssignedModel extends UserBareMinimum {
alt_phone_number?: string;
video_connect_link: string;
gender?: number;
- age?: number;
+ date_of_birth: Date | null;
is_superuser?: boolean;
verified?: boolean;
home_facility?: string;
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
-
+
@@ -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/Redux/actions.tsx b/src/Redux/actions.tsx
index 73e1a839519..edecb7a8c77 100644
--- a/src/Redux/actions.tsx
+++ b/src/Redux/actions.tsx
@@ -107,6 +107,9 @@ export const getConsultation = (id: string) => {
export const updateConsultation = (id: string, params: object) => {
return fireRequest("updateConsultation", [], params, { id: id });
};
+export const partialUpdateConsultation = (id: string, params: object) => {
+ return fireRequest("partialUpdateConsultation", [], params, { id: id });
+};
export const generateDischargeSummary = (pathParams: object) => {
return fireRequest("dischargeSummaryGenerate", [], {}, pathParams);
diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx
index 33b6a69e057..4f19d0cb696 100644
--- a/src/Redux/api.tsx
+++ b/src/Redux/api.tsx
@@ -86,6 +86,7 @@ import {
SkillModel,
SkillObjectModel,
UpdatePasswordForm,
+ UserAssignedModel,
UserModel,
} from "../Components/Users/models";
import { PaginatedResponse } from "../Utils/request/types";
@@ -354,7 +355,7 @@ const routes = {
getFacilityUsers: {
path: "/api/v1/facility/{facility_id}/get_users/",
- TRes: Type>(),
+ TRes: Type>(),
},
listFacilityAssetLocation: {
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/src/Utils/utils.ts b/src/Utils/utils.ts
index 4e1d1626a59..4bbc6317d2d 100644
--- a/src/Utils/utils.ts
+++ b/src/Utils/utils.ts
@@ -479,3 +479,10 @@ export const mergeQueryOptions = (
),
];
};
+
+export const properRoundOf = (value: number) => {
+ if (value % 1 === 0) {
+ return value.toFixed();
+ }
+ return value.toFixed(2);
+};
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",