diff --git a/src/Components/ABDM/ConfigureHealthFacility.tsx b/src/Components/ABDM/ConfigureHealthFacility.tsx
index c0a74ccf106..025a3f0e862 100644
--- a/src/Components/ABDM/ConfigureHealthFacility.tsx
+++ b/src/Components/ABDM/ConfigureHealthFacility.tsx
@@ -6,6 +6,7 @@ import * as Notification from "../../Utils/Notifications.js";
import { navigate } from "raviger";
import { Cancel, Submit } from "../Common/components/ButtonV2";
import TextFormField from "../Form/FormFields/TextFormField";
+import { classNames } from "../../Utils/utils";
const Loading = lazy(() => import("../Common/Loading"));
const initForm = {
@@ -47,7 +48,7 @@ export const ConfigureHealthFacility = (props: any) => {
setIsLoading(true);
const res = await dispatchAction(healthFacilityActions.read(facilityId));
- if (res.status === 200 && res?.data) {
+ if (res?.status === 200 && res?.data) {
const formData = {
...state.form,
hf_id: res.data.hf_id,
@@ -84,6 +85,32 @@ export const ConfigureHealthFacility = (props: any) => {
hf_id: state.form.hf_id,
})
);
+ } else if (state.form.hf_id === state.form.health_facility?.hf_id) {
+ res = await dispatchAction(
+ healthFacilityActions.registerService(facilityId)
+ );
+
+ if (res?.status === 200 && res?.data) {
+ if (res.data?.registered) {
+ dispatch({
+ type: "set_form",
+ form: {
+ ...state.form,
+ health_facility: {
+ ...state.form?.health_facility,
+ registered: res.data.registered,
+ },
+ },
+ });
+
+ return;
+ }
+ }
+
+ Notification.Error({
+ msg: "Service registration failed, please try again later",
+ });
+ return;
} else {
res = await dispatchAction(
healthFacilityActions.create({
@@ -127,6 +154,49 @@ export const ConfigureHealthFacility = (props: any) => {
+ {state.form.health_facility?.registered ? (
+ <>
+
+
+ The ABDM health facility is successfully linked with
+ care{" "}
+ and registered as a service in bridge
+
+
+ No Action Required.
+
+
+ Registered
+ >
+ ) : (
+ <>
+
+
+ The ABDM health facility is successfully linked with
+ care{" "}
+
+ but not registered as a service in bridge
+
+
+
+ Click on Link Health Facility to
+ register the service
+
+
+ Not Registered
+ >
+ )}
+
+ }
required
value={state.form.hf_id}
onChange={(e) => handleChange(e)}
@@ -136,7 +206,14 @@ export const ConfigureHealthFacility = (props: any) => {
navigate(`/facility/${facilityId}`)} />
-
+
diff --git a/src/Components/Facility/UpdateFacilityMiddleware.tsx b/src/Components/Facility/UpdateFacilityMiddleware.tsx
index 4fd5a4f24b0..211d8cf458a 100644
--- a/src/Components/Facility/UpdateFacilityMiddleware.tsx
+++ b/src/Components/Facility/UpdateFacilityMiddleware.tsx
@@ -11,7 +11,6 @@ import { navigate } from "raviger";
import { Cancel, Submit } from "../Common/components/ButtonV2";
import TextFormField from "../Form/FormFields/TextFormField";
import Page from "../Common/components/Page";
-import useConfig from "../../Common/hooks/useConfig";
import { ConfigureHealthFacility } from "../ABDM/ConfigureHealthFacility";
const Loading = lazy(() => import("../Common/Loading"));
@@ -52,7 +51,6 @@ export const UpdateFacilityMiddleware = (props: any) => {
const { facilityId } = props;
const dispatchAction: any = useDispatch();
const [isLoading, setIsLoading] = useState(false);
- const config = useConfig();
const fetchData = useCallback(
async (status: statusType) => {
@@ -169,11 +167,8 @@ export const UpdateFacilityMiddleware = (props: any) => {
- {config.enable_abdm ? (
-
- ) : (
- <>>
- )}
+
+
);
};
diff --git a/src/Redux/actions.tsx b/src/Redux/actions.tsx
index 0ea1270f741..3255e228cbc 100644
--- a/src/Redux/actions.tsx
+++ b/src/Redux/actions.tsx
@@ -975,6 +975,15 @@ export const healthFacilityActions = {
facility_id: id,
});
},
+
+ registerService: (id: string) => {
+ return fireRequest(
+ "registerHealthFacilityAsService",
+ [],
+ {},
+ { facility_id: id }
+ );
+ },
};
export const listAssetAvailability = (params: object) =>
diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx
index 3efff35689e..393b9372ca5 100644
--- a/src/Redux/api.tsx
+++ b/src/Redux/api.tsx
@@ -931,6 +931,11 @@ const routes: Routes = {
method: "PATCH",
},
+ registerHealthFacilityAsService: {
+ path: "/api/v1/abdm/health_facility/{facility_id}/register_service/",
+ method: "POST",
+ },
+
// Asset Availability endpoints
listAssetAvailability: {