diff --git a/cypress/e2e/facility_spec/FacilityLocation.cy.ts b/cypress/e2e/facility_spec/FacilityLocation.cy.ts index d29ee95e873..b700f5c75ae 100644 --- a/cypress/e2e/facility_spec/FacilityLocation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityLocation.cy.ts @@ -1,10 +1,11 @@ +import { v4 as uuidv4 } from "uuid"; + import { AssetPage } from "../../pageobject/Asset/AssetCreation"; -import { UserCreationPage } from "../../pageobject/Users/UserCreation"; -import FacilityPage from "../../pageobject/Facility/FacilityCreation"; -import FacilityLocation from "../../pageobject/Facility/FacilityLocation"; import { AssetPagination } from "../../pageobject/Asset/AssetPagination"; +import FacilityPage from "../../pageobject/Facility/FacilityCreation"; import FacilityHome from "../../pageobject/Facility/FacilityHome"; -import { v4 as uuidv4 } from "uuid"; +import FacilityLocation from "../../pageobject/Facility/FacilityLocation"; +import { UserCreationPage } from "../../pageobject/Users/UserCreation"; describe("Location Management Section", () => { const assetPage = new AssetPage(); diff --git a/cypress/e2e/users_spec/UsersProfile.cy.ts b/cypress/e2e/users_spec/UsersProfile.cy.ts index 3073cebe7ce..35771024180 100644 --- a/cypress/e2e/users_spec/UsersProfile.cy.ts +++ b/cypress/e2e/users_spec/UsersProfile.cy.ts @@ -1,6 +1,6 @@ import LoginPage from "../../pageobject/Login/LoginPage"; -import UserProfilePage from "../../pageobject/Users/UserProfilePage"; import ManageUserPage from "../../pageobject/Users/ManageUserPage"; +import UserProfilePage from "../../pageobject/Users/UserProfilePage"; describe("Manage User Profile", () => { const loginPage = new LoginPage(); diff --git a/cypress/pageobject/Patient/PatientPredefined.ts b/cypress/pageobject/Patient/PatientPredefined.ts index f0a005ec97b..a3eb41cb86c 100644 --- a/cypress/pageobject/Patient/PatientPredefined.ts +++ b/cypress/pageobject/Patient/PatientPredefined.ts @@ -1,11 +1,10 @@ // PatientPredefined.js - -import { PatientPage } from "../../pageobject/Patient/PatientCreation"; import FacilityPage from "../../pageobject/Facility/FacilityCreation"; +import { PatientPage } from "../../pageobject/Patient/PatientCreation"; import PatientMedicalHistory from "../../pageobject/Patient/PatientMedicalHistory"; import { - generatePhoneNumber, generateEmergencyPhoneNumber, + generatePhoneNumber, } from "../utils/constants"; class PatientPredefined { diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index 114000b60f0..3fbb7b08f69 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -2,9 +2,18 @@ "compilerOptions": { "baseUrl": "./", "target": "es5", - "lib": ["es5", "dom", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020"], + "lib": [ + "es5", + "dom", + "es2015", + "es2016", + "es2017", + "es2018", + "es2019", + "es2020" + ], "typeRoots": ["./support"], "resolveJsonModule": true }, - "include": ["**/*.cy.ts", "support/commands.ts","**/*.ts"], -} \ No newline at end of file + "include": ["**/*.cy.ts", "support/commands.ts", "**/*.ts"] +} diff --git a/package.json b/package.json index cc088dd125f..6b2273e341f 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "prepare": "husky", "lint": "eslint ./src", "lint-fix": "eslint ./src --fix", - "format": "prettier ./src --write", + "format": "prettier ./src ./cypress --write", "sort-locales": "node ./scripts/sort-locales.js" }, "dependencies": { @@ -166,7 +166,7 @@ "eslint --fix", "git update-index --again" ], - "src/Locale/*.json": [ + "public/locale/*.json": [ "npm run sort-locales" ] }, @@ -174,4 +174,4 @@ "node": ">=22.11.0" }, "packageManager": "npm@10.9.0" -} +} \ No newline at end of file diff --git a/scripts/sort-locales.js b/scripts/sort-locales.js index adff586a93b..62c3e3d8ba1 100644 --- a/scripts/sort-locales.js +++ b/scripts/sort-locales.js @@ -1,7 +1,7 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires const fs = require("fs"); -const file = "src/Locale/en.json"; +const file = "public/locale/en.json"; const data = JSON.parse(fs.readFileSync(file, "utf8")); diff --git a/src/components/Common/UserAutocompleteFormField.tsx b/src/components/Common/UserAutocompleteFormField.tsx index f6e10e14870..47381414221 100644 --- a/src/components/Common/UserAutocompleteFormField.tsx +++ b/src/components/Common/UserAutocompleteFormField.tsx @@ -19,6 +19,8 @@ import { mergeQueryOptions, } from "@/Utils/utils"; +import { Avatar } from "./Avatar"; + type BaseProps = FormFieldBaseProps & { placeholder?: string; userType?: UserRole; @@ -67,6 +69,16 @@ export default function UserAutocomplete(props: UserSearchProps) { } }, [loading, field.required, data?.results, props.noResultsError]); + const getAvatar = (option: UserBareMinimum) => { + return ( + + ); + }; + return ( `${option.user_type} - ${option.username}` } diff --git a/src/components/Form/FormFields/Autocomplete.tsx b/src/components/Form/FormFields/Autocomplete.tsx index f66eafe6e36..37486974881 100644 --- a/src/components/Form/FormFields/Autocomplete.tsx +++ b/src/components/Form/FormFields/Autocomplete.tsx @@ -5,7 +5,7 @@ import { ComboboxOption, ComboboxOptions, } from "@headlessui/react"; -import { useEffect, useState } from "react"; +import { ReactNode, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import CareIcon from "@/CAREUI/icons/CareIcon"; @@ -29,6 +29,7 @@ type AutocompleteFormFieldProps = FormFieldBaseProps & { optionValue?: OptionCallback; optionDescription?: OptionCallback; optionIcon?: OptionCallback; + optionImage?: OptionCallback; optionDisabled?: OptionCallback; minQueryLength?: number; onQuery?: (query: string) => void; @@ -55,6 +56,7 @@ const AutocompleteFormField = ( placeholder={props.placeholder} optionLabel={props.optionLabel} optionIcon={props.optionIcon} + optionImage={props.optionImage} optionValue={props.optionValue} optionDescription={props.optionDescription} optionDisabled={props.optionDisabled} @@ -79,6 +81,7 @@ type AutocompleteProps = { placeholder?: string; optionLabel: OptionCallback; optionIcon?: OptionCallback; + optionImage?: OptionCallback; optionValue?: OptionCallback; optionDescription?: OptionCallback; optionDisabled?: OptionCallback; @@ -89,7 +92,6 @@ type AutocompleteProps = { isLoading?: boolean; allowRawInput?: boolean; error?: string; - avatar?: boolean; } & ( | { required?: false; @@ -124,6 +126,7 @@ export const Autocomplete = (props: AutocompleteProps) => { description, search: label.toLowerCase(), icon: props.optionIcon?.(option), + image: props.optionImage?.(option), value: props.optionValue ? props.optionValue(option) : option, disabled: props.optionDisabled?.(option), }; @@ -143,6 +146,7 @@ export const Autocomplete = (props: AutocompleteProps) => { description: undefined, search: query.toLowerCase(), icon: , + image: undefined, value: query, disabled: undefined, }, @@ -241,25 +245,28 @@ export const Autocomplete = (props: AutocompleteProps) => { disabled={option.disabled} > {({ focus }) => ( -
-
- {option.label} - {option.icon} -
- {option.description && ( -
- {option.description} +
+ {option?.image} +
+
+ {option.label} + {option.icon}
- )} + {option.description && ( +
+ {option.description} +
+ )} +
)}