diff --git a/src/Components/Facility/FacilityBlock.tsx b/src/Components/Facility/FacilityBlock.tsx index d66bd2f8ec1..64c0a24d78d 100644 --- a/src/Components/Facility/FacilityBlock.tsx +++ b/src/Components/Facility/FacilityBlock.tsx @@ -1,3 +1,4 @@ +import { Link } from "raviger"; import CareIcon from "../../CAREUI/icons/CareIcon"; import { FacilityModel } from "./models"; @@ -5,8 +6,12 @@ export default function FacilityBlock(props: { facility: FacilityModel }) { const { facility } = props; return ( -
-
+ +
{facility.read_cover_image_url ? (
-
+ ); } diff --git a/src/Components/Facility/FacilityCreate.tsx b/src/Components/Facility/FacilityCreate.tsx index fc03d8b7e8c..678a356556d 100644 --- a/src/Components/Facility/FacilityCreate.tsx +++ b/src/Components/Facility/FacilityCreate.tsx @@ -851,7 +851,7 @@ export const FacilityCreate = (props: FacilityProps) => { types={["mobile", "landline"]} />
-

Spoke Facilities

+

{t("spokes")}

{facilityId && ( { }); }; + const spokesQuery = useQuery(routes.getFacilitySpokes, { + pathParams: { + id: facilityId, + }, + silent: true, + }); + if (isLoading) { return ; } @@ -293,6 +301,20 @@ export const FacilityHome = ({ facilityId }: Props) => { />
+ {!!spokesQuery.data?.results.length && ( +
+
+

+ {t("spokes")} +

+
+ {spokesQuery.data?.results.map((spoke) => ( + + ))} +
+
+
+ )} diff --git a/src/Components/Facility/SpokeFacilityEditor.tsx b/src/Components/Facility/SpokeFacilityEditor.tsx index 2af9da2b3d6..197d68da2bf 100644 --- a/src/Components/Facility/SpokeFacilityEditor.tsx +++ b/src/Components/Facility/SpokeFacilityEditor.tsx @@ -1,4 +1,3 @@ -//import { useTranslation } from "react-i18next"; import routes from "../../Redux/api"; import request from "../../Utils/request/request"; import useQuery from "../../Utils/request/useQuery"; @@ -15,6 +14,7 @@ import { FacilitySelect } from "../Common/FacilitySelect"; import { useEffect, useState } from "react"; import { SPOKE_RELATION_TYPES } from "../../Common/constants"; import FacilityBlock from "./FacilityBlock"; +import { useTranslation } from "react-i18next"; export interface SpokeFacilityEditorProps { facility: Omit & { id: string }; @@ -23,7 +23,7 @@ export interface SpokeFacilityEditorProps { export default function SpokeFacilityEditor(props: SpokeFacilityEditorProps) { const { facility } = props; - //const { t } = useTranslation(); + const { t } = useTranslation(); const spokesQuery = useQuery(routes.getFacilitySpokes, { pathParams: { @@ -85,7 +85,7 @@ export default function SpokeFacilityEditor(props: SpokeFacilityEditorProps) { }, [selectedFacility]); return ( - <> +
{"id" in item ? (
@@ -94,7 +94,7 @@ export default function SpokeFacilityEditor(props: SpokeFacilityEditorProps) { setItem({ ...item, relationship: v.value })} errorClassName="hidden" - className="shrink-0" + className="w-full shrink-0 md:w-auto" disabled={processing} /> - +
); }; diff --git a/src/Components/Form/ModelCrudEditor.tsx b/src/Components/Form/ModelCrudEditor.tsx index 6ca2e70d0c9..3ce4b15eba3 100644 --- a/src/Components/Form/ModelCrudEditor.tsx +++ b/src/Components/Form/ModelCrudEditor.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from "react"; import { classNames } from "../../Utils/utils"; import ButtonV2 from "../Common/components/ButtonV2"; import CareIcon from "../../CAREUI/icons/CareIcon"; +import { useTranslation } from "react-i18next"; interface Identifier { id: string; @@ -29,6 +30,8 @@ export interface ModelCrudEditorProps { export default function ModelCrudEditor( props: ModelCrudEditorProps, ) { + const { t } = useTranslation(); + const { onCreate, onUpdate, @@ -94,7 +97,7 @@ export default function ModelCrudEditor( }, [item]); return ( - <> +
{children(item, setItem, processing, errors)} {props.type === "creating" && ( ( )} - +
); }; diff --git a/src/Locale/en/Common.json b/src/Locale/en/Common.json index 8b263366934..3c8ed6258f2 100644 --- a/src/Locale/en/Common.json +++ b/src/Locale/en/Common.json @@ -175,6 +175,7 @@ "treating_doctor": "Treating Doctor", "hubs": "Hub Facilities", "spokes": "Spoke Facilities", + "add_spoke" : "Add Spoke Facility", "ration_card__NO_CARD": "Non-card holder", "ration_card__BPL": "BPL", "ration_card__APL": "APL",