diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 18f8f554490..ce4bd271cf7 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -28,4 +28,4 @@ jobs: run: npm ci - name: Run lint - run: npm run lint --quiet + run: npm run lint -- --quiet diff --git a/src/Components/Assets/AssetFilter.tsx b/src/Components/Assets/AssetFilter.tsx index 8b250088d1a..98f7f52e1e1 100644 --- a/src/Components/Assets/AssetFilter.tsx +++ b/src/Components/Assets/AssetFilter.tsx @@ -3,7 +3,7 @@ import { navigate, useQueryParams } from "raviger"; import { FacilitySelect } from "../Common/FacilitySelect"; import { FacilityModel } from "../Facility/models"; import { LocationSelect } from "../Common/LocationSelect"; -import { AssetClass, AssetLocationObject } from "./AssetTypes"; +import { AssetClass } from "./AssetTypes"; import { FieldLabel } from "../Form/FormFields/FormField"; import { SelectFormField } from "../Form/FormFields/SelectFormField"; import FiltersSlideover from "../../CAREUI/interactive/FiltersSlideover"; @@ -15,24 +15,12 @@ import { FieldChangeEvent } from "../Form/FormFields/Utils"; import { DateRange } from "../Common/DateRangeInputV2"; import { dateQueryString } from "../../Utils/utils"; -const initialLocation = { - id: "", - name: "", - description: "", - facility: { - id: "", - name: "", - }, -}; - const getDate = (value: any) => value && dayjs(value).isValid() && dayjs(value).toDate(); function AssetFilter(props: any) { const { filter, onChange, closeFilter } = props; const [facility, setFacility] = useState({ name: "" }); - const [location, setLocation] = - useState(initialLocation); const [asset_type, setAssetType] = useState( filter.asset_type ? filter.asset_type : "" ); @@ -58,28 +46,14 @@ function AssetFilter(props: any) { prefetch: !!facilityId, }); - useQuery(routes.getFacilityAssetLocation, { - pathParams: { - facilityId: String(facilityId), - locationId: String(locationId), - }, - onResponse: ({ res, data }) => { - if (res?.status === 200 && data) { - setLocation(data); - } - }, - prefetch: !!(facilityId && locationId), - }); - useEffect(() => { setFacilityId(facility?.id ? `${facility?.id}` : ""); setLocationId( facility?.id === qParams.facility ? qParams.location ?? "" : "" ); - }, [facility, location]); + }, [facility.id, qParams.facility, qParams.location]); const clearFilter = useCallback(() => { - setLocation(initialLocation); setFacility({ name: "" }); setAssetType(""); setAssetStatus(""); @@ -98,7 +72,7 @@ function AssetFilter(props: any) { asset_type: asset_type ?? "", asset_class: asset_class ?? "", status: asset_status ?? "", - location: locationId, + location: locationId ?? "", warranty_amc_end_of_validity_before: dateQueryString( warrantyExpiry.before ), diff --git a/src/Components/Assets/AssetsList.tsx b/src/Components/Assets/AssetsList.tsx index 4bcb2698a9a..593afdb137c 100644 --- a/src/Components/Assets/AssetsList.tsx +++ b/src/Components/Assets/AssetsList.tsx @@ -46,7 +46,6 @@ const AssetsList = () => { const [facility, setFacility] = useState(); const [asset_type, setAssetType] = useState(); const [status, setStatus] = useState(); - const [facilityName, setFacilityName] = useState(); const [asset_class, setAssetClass] = useState(); const [importAssetModalOpen, setImportAssetModalOpen] = useState(false); const assetsExist = assets.length > 0 && Object.keys(assets[0]).length > 0; @@ -76,13 +75,12 @@ const AssetsList = () => { }, }); - useQuery(routes.getAnyFacility, { + const { data: facilityObject } = useQuery(routes.getAnyFacility, { pathParams: { id: qParams.facility }, onResponse: ({ res, data }) => { if (res?.status === 200 && data) { setFacility(data); setSelectedFacility(data); - setFacilityName(data.name); } }, prefetch: !!qParams.facility, @@ -100,7 +98,7 @@ const AssetsList = () => { setAssetClass(qParams.asset_class); }, [qParams.asset_class]); - const { data: location } = useQuery(routes.getFacilityAssetLocation, { + const { data: locationObject } = useQuery(routes.getFacilityAssetLocation, { pathParams: { facility_external_id: String(qParams.facility), external_id: String(qParams.location), @@ -365,12 +363,20 @@ const AssetsList = () => { <> [ - value("Facility", "facility", facilityName ?? ""), + value( + "Facility", + "facility", + qParams.facility && facilityObject?.name + ), badge("Name/Serial No./QR ID", "search"), value("Asset Type", "asset_type", asset_type ?? ""), value("Asset Class", "asset_class", asset_class ?? ""), value("Status", "status", status?.replace(/_/g, " ") ?? ""), - value("Location", "location", location?.name ?? ""), + value( + "Location", + "location", + qParams.location && locationObject?.name + ), value( "Warranty AMC End Of Validity Before", "warranty_amc_end_of_validity_before", diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx index 4fc6fef7fbe..57a06877269 100644 --- a/src/Components/Patient/PatientRegister.tsx +++ b/src/Components/Patient/PatientRegister.tsx @@ -918,12 +918,12 @@ export const PatientRegister = (props: PatientRegisterProps) => { if (mobile) { field("phone_number").onChange({ name: "phone_number", - value: parsePhoneNumber(mobile), + value: parsePhoneNumber(mobile, "IN"), }); field("emergency_phone_number").onChange({ name: "emergency_phone_number", - value: parsePhoneNumber(mobile), + value: parsePhoneNumber(mobile, "IN"), }); } diff --git a/vite.config.ts b/vite.config.ts index 7aafe6e1d5c..ecd6a2676d3 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -54,6 +54,7 @@ export default defineConfig({ ], build: { outDir: "build", + assetsDir: "bundle", rollupOptions: { output: { manualChunks(id) {