From 5c1f1e51c63d3c6171583180d02595eacaa5be05 Mon Sep 17 00:00:00 2001 From: Aakash Singh Date: Mon, 26 Jun 2023 20:24:45 +0530 Subject: [PATCH] Rename all instances of orgin_facility to origin_facility Fixes coronasafe/care#1279 --- cypress/e2e/resource_spec/filter.cy.ts | 2 +- cypress/e2e/shifting_spec/filter.cy.ts | 4 ++-- src/Components/Patient/PatientHome.tsx | 2 +- src/Components/Patient/ShiftCreate.tsx | 2 +- src/Components/Resource/BadgesList.tsx | 8 +++---- src/Components/Resource/Commons.tsx | 4 ++-- src/Components/Resource/ListFilter.tsx | 24 +++++++++---------- src/Components/Resource/ListView.tsx | 4 ++-- src/Components/Resource/ResourceBoard.tsx | 4 ++-- src/Components/Resource/ResourceCreate.tsx | 2 +- src/Components/Resource/ResourceDetails.tsx | 12 +++++----- .../Resource/ResourceDetailsUpdate.tsx | 2 +- src/Components/Shifting/BadgesList.tsx | 8 +++---- src/Components/Shifting/Commons.tsx | 4 ++-- src/Components/Shifting/ListFilter.tsx | 24 +++++++++---------- src/Components/Shifting/ListView.tsx | 4 ++-- src/Components/Shifting/ShiftDetails.tsx | 8 +++---- .../Shifting/ShiftDetailsUpdate.tsx | 2 +- src/Components/Shifting/ShiftingBoard.tsx | 4 ++-- 19 files changed, 62 insertions(+), 62 deletions(-) diff --git a/cypress/e2e/resource_spec/filter.cy.ts b/cypress/e2e/resource_spec/filter.cy.ts index 1e19fb1dd5b..e4db00050e1 100644 --- a/cypress/e2e/resource_spec/filter.cy.ts +++ b/cypress/e2e/resource_spec/filter.cy.ts @@ -14,7 +14,7 @@ describe("Resource filter", () => { it("filter by origin facility", () => { cy.intercept(/\/api\/v1\/getallfacilities/).as("facilities_filter"); - cy.get("[name='orgin_facility']") + cy.get("[name='origin_facility']") .type("Dummy Facility 1") .wait("@facilities_filter"); cy.get("[role='option']").first().click(); diff --git a/cypress/e2e/shifting_spec/filter.cy.ts b/cypress/e2e/shifting_spec/filter.cy.ts index 996ddc600ea..f12aeec2760 100644 --- a/cypress/e2e/shifting_spec/filter.cy.ts +++ b/cypress/e2e/shifting_spec/filter.cy.ts @@ -14,11 +14,11 @@ describe("Shifting section filter", () => { it("filter by origin facility", () => { cy.intercept(/\/api\/v1\/getallfacilities/).as("facilities_filter"); - cy.get("[name='orgin_facility']") + cy.get("[name='origin_facility']") .wait(100) .type("Dummy") .wait("@facilities_filter"); - cy.get("[name='orgin_facility']").wait(100).type("{downarrow}{enter}"); + cy.get("[name='origin_facility']").wait(100).type("{downarrow}{enter}"); cy.contains("Apply").click(); }); diff --git a/src/Components/Patient/PatientHome.tsx b/src/Components/Patient/PatientHome.tsx index 15c4a7c52ac..373354ab648 100644 --- a/src/Components/Patient/PatientHome.tsx +++ b/src/Components/Patient/PatientHome.tsx @@ -868,7 +868,7 @@ export const PatientHome = (props: any) => { >
- {(shift.orgin_facility_object || {})?.name} + {(shift.origin_facility_object || {})?.name}
diff --git a/src/Components/Patient/ShiftCreate.tsx b/src/Components/Patient/ShiftCreate.tsx index e88f360ac7b..c8b802152fa 100644 --- a/src/Components/Patient/ShiftCreate.tsx +++ b/src/Components/Patient/ShiftCreate.tsx @@ -201,7 +201,7 @@ export const ShiftCreate = (props: patientShiftProps) => { const data = { status: wartime_shifting ? "PENDING" : "APPROVED", - orgin_facility: props.facilityId, + origin_facility: props.facilityId, shifting_approving_facility: ( state.form.shifting_approving_facility || {} ).id, diff --git a/src/Components/Resource/BadgesList.tsx b/src/Components/Resource/BadgesList.tsx index f5aeccb064c..217322c746d 100644 --- a/src/Components/Resource/BadgesList.tsx +++ b/src/Components/Resource/BadgesList.tsx @@ -12,14 +12,14 @@ export default function BadgesList(props: any) { useEffect(() => { async function fetchData() { - if (!appliedFilters.orgin_facility) return setOrginFacilityName(""); + if (!appliedFilters.origin_facility) return setOrginFacilityName(""); const res = await dispatch( - getAnyFacility(appliedFilters.orgin_facility, "orgin_facility") + getAnyFacility(appliedFilters.origin_facility, "origin_facility") ); setOrginFacilityName(res?.data?.name); } fetchData(); - }, [dispatch, appliedFilters.orgin_facility]); + }, [dispatch, appliedFilters.origin_facility]); useEffect(() => { async function fetchData() { @@ -69,7 +69,7 @@ export default function BadgesList(props: any) { }), ...dateRange("Modified", "modified_date"), ...dateRange("Created", "created_date"), - value("Origin facility", "orgin_facility", orginFacilityName), + value("Origin facility", "origin_facility", orginFacilityName), value( "Approving facility", "approving_facility", diff --git a/src/Components/Resource/Commons.tsx b/src/Components/Resource/Commons.tsx index 1a10156a8d0..0162f34d02c 100644 --- a/src/Components/Resource/Commons.tsx +++ b/src/Components/Resource/Commons.tsx @@ -1,7 +1,7 @@ export const initialFilterData = { status: "--", facility: "", - orgin_facility: "", + origin_facility: "", approving_facility: "", assigned_facility: "", emergency: "--", @@ -19,7 +19,7 @@ export const formatFilter = (params: any) => { return { status: filter.status === "--" ? null : filter.status, facility: "", - orgin_facility: filter.orgin_facility || undefined, + origin_facility: filter.origin_facility || undefined, approving_facility: filter.approving_facility || undefined, assigned_facility: filter.assigned_facility || undefined, emergency: diff --git a/src/Components/Resource/ListFilter.tsx b/src/Components/Resource/ListFilter.tsx index 06a7139f8b1..f57dd4b0f41 100644 --- a/src/Components/Resource/ListFilter.tsx +++ b/src/Components/Resource/ListFilter.tsx @@ -16,8 +16,8 @@ import { DateRange } from "../Common/DateRangeInputV2"; import DateRangeFormField from "../Form/FormFields/DateRangeFormField"; const clearFilterState = { - orgin_facility: "", - orgin_facility_ref: "", + origin_facility: "", + origin_facility_ref: "", approving_facility: "", approving_facility_ref: "", assigned_facility: "", @@ -40,8 +40,8 @@ export default function ListFilter(props: any) { const [isResourceLoading, setResourceLoading] = useState(false); const [isAssignedLoading, setAssignedLoading] = useState(false); const [filterState, setFilterState] = useMergeState({ - orgin_facility: filter.orgin_facility || "", - orgin_facility_ref: null, + origin_facility: filter.origin_facility || "", + origin_facility_ref: null, approving_facility: filter.approving_facility || "", approving_facility_ref: null, assigned_facility: filter.assigned_facility || "", @@ -58,13 +58,13 @@ export default function ListFilter(props: any) { useEffect(() => { async function fetchData() { - if (filter.orgin_facility) { + if (filter.origin_facility) { setOriginLoading(true); const res = await dispatch( - getAnyFacility(filter.orgin_facility, "orgin_facility") + getAnyFacility(filter.origin_facility, "origin_facility") ); if (res && res.data) { - setFilterState({ orgin_facility_ref: res.data }); + setFilterState({ origin_facility_ref: res.data }); } setOriginLoading(false); } @@ -118,7 +118,7 @@ export default function ListFilter(props: any) { const applyFilter = () => { const { - orgin_facility, + origin_facility, approving_facility, assigned_facility, emergency, @@ -130,7 +130,7 @@ export default function ListFilter(props: any) { status, } = filterState; const data = { - orgin_facility: orgin_facility || "", + origin_facility: origin_facility || "", approving_facility: approving_facility || "", assigned_facility: assigned_facility || "", emergency: emergency || "", @@ -194,9 +194,9 @@ export default function ListFilter(props: any) { ) : ( setFacility(obj, "orgin_facility")} + name="origin_facility" + selected={filterState.origin_facility_ref} + setSelected={(obj) => setFacility(obj, "origin_facility")} className="resource-page-filter-dropdown" errors={""} /> diff --git a/src/Components/Resource/ListView.tsx b/src/Components/Resource/ListView.tsx index 15c5bd4baba..ea82a6e2ee7 100644 --- a/src/Components/Resource/ListView.tsx +++ b/src/Components/Resource/ListView.tsx @@ -62,7 +62,7 @@ export default function ListView() { }, [ qParams.status, qParams.facility, - qParams.orgin_facility, + qParams.origin_facility, qParams.approving_facility, qParams.assigned_facility, qParams.emergency, @@ -122,7 +122,7 @@ export default function ListView() { >
- {(resource.orgin_facility_object || {}).name} + {(resource.origin_facility_object || {}).name}
diff --git a/src/Components/Resource/ResourceBoard.tsx b/src/Components/Resource/ResourceBoard.tsx index 3f42e82e2e0..afe076ab37f 100644 --- a/src/Components/Resource/ResourceBoard.tsx +++ b/src/Components/Resource/ResourceBoard.tsx @@ -70,7 +70,7 @@ const ResourceCard = ({ resource }: any) => { >
- {(resource.orgin_facility_object || {}).name} + {(resource.origin_facility_object || {}).name}
@@ -194,7 +194,7 @@ export default function ResourceBoard({ board, dispatch, filterProp.facility, - filterProp.orgin_facility, + filterProp.origin_facility, filterProp.approving_facility, filterProp.assigned_facility, filterProp.emergency, diff --git a/src/Components/Resource/ResourceCreate.tsx b/src/Components/Resource/ResourceCreate.tsx index 6bed5cacee1..e906c4a30df 100644 --- a/src/Components/Resource/ResourceCreate.tsx +++ b/src/Components/Resource/ResourceCreate.tsx @@ -186,7 +186,7 @@ export default function ResourceCreate(props: resourceProps) { status: "PENDING", category: state.form.category, sub_category: state.form.sub_category, - orgin_facility: props.facilityId, + origin_facility: props.facilityId, approving_facility: (state.form.approving_facility || {}).id, assigned_facility: (state.form.assigned_facility || {}).id, emergency: state.form.emergency === "true", diff --git a/src/Components/Resource/ResourceDetails.tsx b/src/Components/Resource/ResourceDetails.tsx index af51f1d0683..ccb1ae43dc6 100644 --- a/src/Components/Resource/ResourceDetails.tsx +++ b/src/Components/Resource/ResourceDetails.tsx @@ -118,18 +118,18 @@ export default function ResourceDetails(props: { id: string }) {
-
{data.orgin_facility_object?.name || "--"}
+
{data.origin_facility_object?.name || "--"}
- {data.orgin_facility_object?.facility_type?.name || "--"} + {data.origin_facility_object?.facility_type?.name || "--"}
- {data.orgin_facility_object?.district_object?.name || "--"} + {data.origin_facility_object?.district_object?.name || "--"}
- {data.orgin_facility_object?.local_body_object?.name || "--"} + {data.origin_facility_object?.local_body_object?.name || "--"}
- {data.orgin_facility_object?.state_object?.name || "--"} + {data.origin_facility_object?.state_object?.name || "--"}
{data.status === "REJECTED" || @@ -410,7 +410,7 @@ export default function ResourceDetails(props: { id: string }) {

Origin Facility

- {showFacilityCard(data.orgin_facility_object)} + {showFacilityCard(data.origin_facility_object)}

Resource Approving Facility

diff --git a/src/Components/Resource/ResourceDetailsUpdate.tsx b/src/Components/Resource/ResourceDetailsUpdate.tsx index ff1d0ff1338..cc07fa281b5 100644 --- a/src/Components/Resource/ResourceDetailsUpdate.tsx +++ b/src/Components/Resource/ResourceDetailsUpdate.tsx @@ -163,7 +163,7 @@ export const ResourceDetailsUpdate = (props: resourceProps) => { const data = { category: "OXYGEN", status: state.form.status, - orgin_facility: state.form.orgin_facility_object?.id, + origin_facility: state.form.origin_facility_object?.id, approving_facility: state.form?.approving_facility_object?.id, assigned_facility: state.form?.assigned_facility_object?.id, emergency: [true, "true"].includes(state.form.emergency), diff --git a/src/Components/Shifting/BadgesList.tsx b/src/Components/Shifting/BadgesList.tsx index ff6144776f2..eafe25405e9 100644 --- a/src/Components/Shifting/BadgesList.tsx +++ b/src/Components/Shifting/BadgesList.tsx @@ -31,14 +31,14 @@ export default function BadgesList(props: any) { useEffect(() => { async function fetchData() { - if (!qParams.orgin_facility) return setOriginFacilityName(""); + if (!qParams.origin_facility) return setOriginFacilityName(""); const res = await dispatch( - getAnyFacility(qParams.orgin_facility, "orgin_facility") + getAnyFacility(qParams.origin_facility, "origin_facility") ); setOriginFacilityName(res?.data?.name); } fetchData(); - }, [dispatch, qParams.orgin_facility]); + }, [dispatch, qParams.origin_facility]); useEffect(() => { async function fetchData() { @@ -102,7 +102,7 @@ export default function BadgesList(props: any) { "assigned_facility", assignedFacilityName ), - value(t("origin_facility"), "orgin_facility", originFacilityName), + value(t("origin_facility"), "origin_facility", originFacilityName), value( t("shifting_approval_facility"), "shifting_approving_facility", diff --git a/src/Components/Shifting/Commons.tsx b/src/Components/Shifting/Commons.tsx index 7de79b4baa5..db0e557f86c 100644 --- a/src/Components/Shifting/Commons.tsx +++ b/src/Components/Shifting/Commons.tsx @@ -3,7 +3,7 @@ export const limit = 14; export const initialFilterData = { status: "", facility: "", - orgin_facility: "", + origin_facility: "", shifting_approving_facility: "", assigned_facility: "", emergency: "", @@ -29,7 +29,7 @@ export const formatFilter = (params: any) => { return { status: filter.status === "" ? null : filter.status, facility: "", - orgin_facility: filter.orgin_facility || undefined, + origin_facility: filter.origin_facility || undefined, shifting_approving_facility: filter.shifting_approving_facility || undefined, assigned_facility: filter.assigned_facility || undefined, diff --git a/src/Components/Shifting/ListFilter.tsx b/src/Components/Shifting/ListFilter.tsx index 10bea4e68c3..e551c117db2 100644 --- a/src/Components/Shifting/ListFilter.tsx +++ b/src/Components/Shifting/ListFilter.tsx @@ -28,8 +28,8 @@ import { useTranslation } from "react-i18next"; import UserAutocompleteFormField from "../Common/UserAutocompleteFormField"; const clearFilterState = { - orgin_facility: "", - orgin_facility_ref: "", + origin_facility: "", + origin_facility_ref: "", shifting_approving_facility: "", shifting_approving_facility_ref: "", assigned_facility: "", @@ -67,8 +67,8 @@ export default function ListFilter(props: any) { ).map((option) => option.text); const [filterState, setFilterState] = useMergeState({ - orgin_facility: filter.orgin_facility || "", - orgin_facility_ref: null, + origin_facility: filter.origin_facility || "", + origin_facility_ref: null, shifting_approving_facility: filter.shifting_approving_facility || "", shifting_approving_facility_ref: null, assigned_facility: filter.assigned_facility || "", @@ -93,13 +93,13 @@ export default function ListFilter(props: any) { useEffect(() => { async function fetchData() { - if (filter.orgin_facility) { + if (filter.origin_facility) { setOriginLoading(true); const res = await dispatch( - getAnyFacility(filter.orgin_facility, "orgin_facility") + getAnyFacility(filter.origin_facility, "origin_facility") ); if (res && res.data) { - setFilterState({ orgin_facility_ref: res.data }); + setFilterState({ origin_facility_ref: res.data }); } setOriginLoading(false); } @@ -182,7 +182,7 @@ export default function ListFilter(props: any) { const applyFilter = () => { const { - orgin_facility, + origin_facility, shifting_approving_facility, assigned_facility, emergency, @@ -201,7 +201,7 @@ export default function ListFilter(props: any) { breathlessness_level, } = filterState; const data = { - orgin_facility: orgin_facility || "", + origin_facility: origin_facility || "", shifting_approving_facility: shifting_approving_facility || "", assigned_facility: assigned_facility || "", emergency: emergency || "", @@ -275,9 +275,9 @@ export default function ListFilter(props: any) { ) : ( setFacility(obj, "orgin_facility")} + name="origin_facility" + selected={filterState.origin_facility_ref} + setSelected={(obj) => setFacility(obj, "origin_facility")} className="shifting-page-filter-dropdown" errors={""} /> diff --git a/src/Components/Shifting/ListView.tsx b/src/Components/Shifting/ListView.tsx index a90f66b41c4..67e254c3d22 100644 --- a/src/Components/Shifting/ListView.tsx +++ b/src/Components/Shifting/ListView.tsx @@ -87,7 +87,7 @@ export default function ListView() { }, [ qParams.status, qParams.facility, - qParams.orgin_facility, + qParams.origin_facility, qParams.shifting_approving_facility, qParams.assigned_facility, qParams.emergency, @@ -170,7 +170,7 @@ export default function ListView() { >
- {(shift.orgin_facility_object || {}).name} + {(shift.origin_facility_object || {}).name}
diff --git a/src/Components/Shifting/ShiftDetails.tsx b/src/Components/Shifting/ShiftDetails.tsx index 8305f06b9a9..fac605f1155 100644 --- a/src/Components/Shifting/ShiftDetails.tsx +++ b/src/Components/Shifting/ShiftDetails.tsx @@ -120,7 +120,7 @@ export default function ShiftDetails(props: { id: string }) { "\n" + t("origin_facility") + ":" + - data?.orgin_facility_object?.name + + data?.origin_facility_object?.name + "\n" + t("contact_number") + ":" + @@ -352,7 +352,7 @@ export default function ShiftDetails(props: { id: string }) { {data.is_kasp ? t("district_program_management_supporting_unit") - : data.orgin_facility_object?.name || "--"} + : data.origin_facility_object?.name || "--"} {/* Made static based on #757 */}
@@ -618,7 +618,7 @@ export default function ShiftDetails(props: { id: string }) { {t("origin_facility")}:{" "} - {data.orgin_facility_object?.name || "--"} + {data.origin_facility_object?.name || "--"}
{wartime_shifting && (
@@ -856,7 +856,7 @@ export default function ShiftDetails(props: { id: string }) {

{t("details_of_origin_facility")}

- {showFacilityCard(data.orgin_facility_object)} + {showFacilityCard(data.origin_facility_object)}
{!data.assigned_facility_external && (
diff --git a/src/Components/Shifting/ShiftDetailsUpdate.tsx b/src/Components/Shifting/ShiftDetailsUpdate.tsx index 36c64efbd45..02fa1811f2d 100644 --- a/src/Components/Shifting/ShiftDetailsUpdate.tsx +++ b/src/Components/Shifting/ShiftDetailsUpdate.tsx @@ -197,7 +197,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { setIsLoading(true); const data: any = { - orgin_facility: state.form.orgin_facility_object?.id, + origin_facility: state.form.origin_facility_object?.id, shifting_approving_facility: state.form?.shifting_approving_facility_object?.id, assigned_facility: diff --git a/src/Components/Shifting/ShiftingBoard.tsx b/src/Components/Shifting/ShiftingBoard.tsx index cdd5b8dce65..403770f4c6a 100644 --- a/src/Components/Shifting/ShiftingBoard.tsx +++ b/src/Components/Shifting/ShiftingBoard.tsx @@ -109,7 +109,7 @@ const ShiftCard = ({ shift, filter }: any) => { >
- {(shift.orgin_facility_object || {}).name} + {(shift.origin_facility_object || {}).name}
@@ -288,7 +288,7 @@ export default function ShiftingBoard({ board, dispatch, filterProp.facility, - filterProp.orgin_facility, + filterProp.origin_facility, filterProp.shifting_approving_facility, filterProp.assigned_facility, filterProp.emergency,