diff --git a/frontend/micro-ui/web/micro-ui-internals/example/package.json b/frontend/micro-ui/web/micro-ui-internals/example/package.json index 2ce9fef12d7..c73c5986178 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/example/package.json @@ -12,7 +12,7 @@ "@egovernments/digit-ui-module-bills": "1.7.24", "@egovernments/digit-ui-module-common": "1.7.24", "@egovernments/digit-ui-module-engagement": "1.7.24", - "@egovernments/digit-ui-module-fsm": "1.7.27", + "@egovernments/digit-ui-module-fsm": "1.7.28", "@egovernments/digit-ui-module-mcollect": "1.7.24", "@egovernments/digit-ui-module-noc": "1.7.24", "@egovernments/digit-ui-module-obps": "1.7.25", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/package.json index 3d42e372a58..870537ee1d7 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/package.json @@ -1,6 +1,6 @@ { "name": "@egovernments/digit-ui-module-fsm", - "version": "1.7.27", + "version": "1.7.28", "license": "MIT", "main": "dist/index.js", "description": "Digit FSM Module", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/FSMSelectAddress.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/FSMSelectAddress.js index 599f0ef044c..839b1da0371 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/FSMSelectAddress.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/FSMSelectAddress.js @@ -3,19 +3,16 @@ import { FormStep, CardLabel, Dropdown, RadioButtons, LabelFieldPair, RadioOrSel import Timeline from "../components/TLTimelineInFSM"; import { useLocation } from "react-router-dom"; -// const Digit = window.Digit; - const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { const allCities = Digit.Hooks.fsm.useTenants(); let tenantId = Digit.ULBService.getCurrentTenantId(); - + if (userType !== "employee") { tenantId = Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code; } const location = useLocation(); const isNewVendor = location.pathname.includes("new-vendor"); const isEditVendor = location.pathname.includes("modify-vendor"); - const inputs = [ { active: true, @@ -48,13 +45,9 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { : allCities; const [selectedCity, setSelectedCity] = useState( - () => - formData?.address?.city || - Digit.SessionStorage.get("fsm.file.address.city") || - Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY") + () => formData?.address?.city || Digit.SessionStorage.get("fsm.file.address.city") || Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY") ); const [newLocality, setNewLocality] = useState(); - const { data: fetchedLocalities } = Digit.Hooks.useBoundaryLocalities( selectedCity?.code, "revenue", @@ -63,18 +56,17 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { }, t ); + const { data: urcConfig } = Digit.Hooks.fsm.useMDMS(tenantId, "FSM", "UrcConfig"); - const isUrcEnable = - urcConfig && urcConfig.length > 0 && urcConfig[0].URCEnable; + const isUrcEnable = urcConfig && urcConfig.length > 0 && urcConfig[0].URCEnable; + const [selectLocation, setSelectLocation] = useState(() => + formData?.address?.propertyLocation + ? formData?.address?.propertyLocation + : Digit.SessionStorage.get("locationType") + ? Digit.SessionStorage.get("locationType") + : inputs[0] + ); - const [selectLocation, setSelectLocation] = useState(() => - formData?.address?.propertyLocation - ? formData?.address?.propertyLocation - : Digit.SessionStorage.get("locationType") - ? Digit.SessionStorage.get("locationType") - : inputs[0] - ); - const [localities, setLocalities] = useState(); const [selectedLocality, setSelectedLocality] = useState(); @@ -85,7 +77,7 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { } } }, [cities]); - + useEffect(() => { if (selectedCity && selectLocation) { if (userType === "employee") { @@ -96,11 +88,7 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { }); } } - if ( - (!isUrcEnable || isNewVendor || isEditVendor) && - selectedCity && - fetchedLocalities - ) { + if ((!isUrcEnable || isNewVendor || isEditVendor) && selectedCity && fetchedLocalities) { let __localityList = fetchedLocalities; let filteredLocalityList = []; @@ -109,25 +97,18 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { } if (formData?.address?.pincode) { - filteredLocalityList = __localityList.filter((obj) => - obj.pincode?.find((item) => item == formData.address.pincode) - ); + filteredLocalityList = __localityList.filter((obj) => obj.pincode?.find((item) => item == formData.address.pincode)); if (!formData?.address?.locality) setSelectedLocality(); } if (userType === "employee") { onSelect(config.key, { ...formData[config.key], city: selectedCity }); } - setLocalities(() => - filteredLocalityList.length > 0 ? filteredLocalityList : __localityList - ); + setLocalities(() => (filteredLocalityList.length > 0 ? filteredLocalityList : __localityList)); if (filteredLocalityList.length === 1) { setSelectedLocality(filteredLocalityList[0]); if (userType === "employee") { - onSelect(config.key, { - ...formData[config.key], - locality: filteredLocalityList[0], - }); + onSelect(config.key, { ...formData[config.key], locality: filteredLocalityList[0] }); } } } @@ -180,9 +161,7 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { function onSubmit() { onSelect(config.key, { city: selectedCity, - propertyLocation: Digit.SessionStorage.get("locationType") - ? Digit.SessionStorage.get("locationType") - : selectLocation, + propertyLocation: Digit.SessionStorage.get("locationType") ? Digit.SessionStorage.get("locationType") : selectLocation, }); } @@ -199,7 +178,7 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { isMandatory selected={cities?.length === 1 ? cities[0] : selectedCity} disable={cities?.length === 1} - option={cities?.sort((a, b) => a.name.localeCompare(b.name))} + option={cities} select={selectCity} optionKey="code" t={t} @@ -209,36 +188,27 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => {
- {`${t("CS_CREATECOMPLAINT_MOHALLA")} *`} - {/* {config.isMandatory ? " * " : null} */} + {t("ES_NEW_APPLICATION_LOCATION_MOHALLA")} + {config.isMandatory ? " * " : null} - a.name.localeCompare(b.name) - )} + option={localities} select={selectLocality} optionKey="i18nkey" t={t} /> {!isNewVendor && !isEditVendor && !isUrcEnable && formData?.address?.locality?.name === "Other" && ( - - {`${t( - "ES_INBOX_PLEASE_SPECIFY_LOCALITY" - )} *`} -
- onNewLocality(e.target.value)} - /> -
-
- )} + + {`${t("ES_INBOX_PLEASE_SPECIFY_LOCALITY")} *`} +
+ onNewLocality(e.target.value)} /> +
+
+ )}
) : ( @@ -264,26 +234,20 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { {isUrcEnable && ( - <> + {`${t("CS_PROPERTY_LOCATION")} *`} - + )} {`${t("MYCITY_CODE_LABEL")} *`} - a.name.localeCompare(b.name))} - selectedOption={cities?.length === 1 ? cities[0] : selectedCity} - optionKey="i18nKey" - onSelect={selectCity} - t={t} - /> + ); diff --git a/frontend/micro-ui/web/package.json b/frontend/micro-ui/web/package.json index 1d4d5dd68d7..57885105cff 100644 --- a/frontend/micro-ui/web/package.json +++ b/frontend/micro-ui/web/package.json @@ -18,7 +18,7 @@ "@egovernments/digit-ui-module-core": "1.7.24", "@egovernments/digit-ui-module-engagement": "1.7.24", "@egovernments/digit-ui-module-dss": "1.7.24", - "@egovernments/digit-ui-module-fsm": "1.7.27", + "@egovernments/digit-ui-module-fsm": "1.7.28", "@egovernments/digit-ui-module-hrms": "1.7.24", "@egovernments/digit-ui-module-mcollect": "1.7.24", "@egovernments/digit-ui-module-commonpt":"1.7.24",