From a769740a288bf99c2999891130325d6c68f78cb0 Mon Sep 17 00:00:00 2001 From: chinmoy-eGov Date: Wed, 20 Mar 2024 17:30:17 +0530 Subject: [PATCH] FSM HRMS MCOLLECT NOC module addded for 2.9 --- frontend/micro-ui/web/docker/Dockerfile | 6 +- .../example/devpackage.json | 4 +- .../micro-ui-internals/example/package.json | 6 +- .../micro-ui-internals/example/src/index.js | 10 +- .../libraries/src/hooks/fsm/useMDMS.js | 8 +- .../libraries/src/services/elements/MDMS.js | 7 + .../packages/modules/fsm/README.md | 77 ---- .../packages/modules/fsm/package.json | 6 +- .../packages/modules/fsm/src/Module.js | 5 +- .../fsm/src/components/ApplicationTimeline.js | 27 +- .../fsm/src/components/DesktopInbox.js | 2 +- .../modules/fsm/src/components/FsmCard.js | 136 ++++--- .../fsm/src/components/RegistryInbox.js | 41 ++ .../fsm/src/components/RegistrySearch.js | 4 +- .../fsm/src/components/TLTimelineInFSM.js | 2 +- .../fsm/src/components/inbox/FSMLink.js | 2 +- .../fsm/src/components/inbox/Filter.js | 24 +- .../fsm/src/components/inbox/search.js | 10 +- .../packages/modules/fsm/src/getPDFData.js | 11 + .../src/pageComponents/AdvanceCollection.js | 64 ++- .../fsm/src/pageComponents/CheckSlum.js | 5 +- .../src/pageComponents/FSMSelectAddress.js | 169 ++++++-- .../fsm/src/pageComponents/FSMSelectStreet.js | 1 + .../fsm/src/pageComponents/SelectGender.js | 4 +- .../SelectLocalityOrGramPanchayat.js | 369 ++++++++++++++++++ .../fsm/src/pageComponents/SelectName.js | 11 +- .../pageComponents/SelectPaymentPreference.js | 54 ++- .../fsm/src/pageComponents/SelectPincode.js | 3 +- .../fsm/src/pageComponents/SelectPitType.js | 13 +- .../src/pageComponents/SelectPropertyID.js | 17 +- .../pageComponents/SelectPropertySubtype.js | 20 +- .../src/pageComponents/SelectPropertyType.js | 38 +- .../src/pageComponents/SelectRoadDetails.js | 1 + .../fsm/src/pageComponents/SelectSlumName.js | 7 + .../fsm/src/pageComponents/SelectStreet.js | 19 + .../fsm/src/pageComponents/SelectTripData.js | 35 +- .../fsm/src/pageComponents/SelectTripNo.js | 11 +- .../fsm/src/pageComponents/SelectTrips.js | 20 +- .../src/pageComponents/SelectVehicleType.js | 16 +- .../modules/fsm/src/pages/Response.js | 2 +- .../src/pages/citizen/ApplicationDetails.js | 2 +- .../src/pages/citizen/MyApplications/index.js | 7 +- .../pages/citizen/NewApplication/CheckPage.js | 15 +- .../pages/citizen/NewApplication/Response.js | 67 +++- .../citizen/NewApplication/defaultConfig.js | 2 +- .../src/pages/citizen/NewApplication/index.js | 260 +----------- .../src/pages/citizen/Rating/SelectRating.js | 6 - .../modules/fsm/src/pages/citizen/index.js | 6 +- .../src/pages/employee/ApplicationAudit.js | 1 - .../ApplicationDetails/Modal/index.js | 56 ++- .../ApplicationDetails/config/AssignDso.js | 5 +- .../config/CompleteApplication.js | 31 +- .../config/RejectApplication.js | 11 +- .../ApplicationDetails/config/RejectFstpo.js | 2 +- .../employee/ApplicationDetails/index.js | 119 ++++-- .../employee/EditApplication/EditForm.js | 128 ++++-- .../employee/FSMRegistry/Driver/AddDriver.js | 6 +- .../FSMRegistry/Driver/DriverDetails.js | 2 + .../employee/FSMRegistry/Driver/EditDriver.js | 2 +- .../FSMRegistry/Vehicle/AddVehicle.js | 35 +- .../FSMRegistry/Vehicle/EditVehicle.js | 34 +- .../FSMRegistry/Vehicle/VehicleDetails.js | 2 + .../employee/FSMRegistry/Vendor/EditVendor.js | 2 + .../FSMRegistry/Vendor/VendorDetails.js | 6 +- .../src/pages/employee/FSMRegistry/index.js | 55 ++- .../fsm/src/pages/employee/FstpAddVehicle.js | 6 +- .../src/pages/employee/FstpOperatorDetails.js | 367 ++++++++++++++++- .../src/pages/employee/FstpServiceRequest.js | 5 +- .../pages/employee/NewApplication/index.js | 38 +- .../pages/employee/configs/DriverConfig.js | 4 +- .../pages/employee/configs/VehicleConfig.js | 49 ++- .../packages/modules/hrms/README.md | 77 ---- .../packages/modules/hrms/package.json | 6 +- .../packages/modules/mCollect/README.md | 77 ---- .../packages/modules/mCollect/package.json | 6 +- .../packages/modules/noc/README.md | 77 ---- .../packages/modules/noc/package.json | 6 +- frontend/micro-ui/web/package.json | 8 +- frontend/micro-ui/web/src/App.js | 6 +- 79 files changed, 1842 insertions(+), 1019 deletions(-) delete mode 100644 frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/README.md create mode 100644 frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectLocalityOrGramPanchayat.js delete mode 100644 frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/README.md delete mode 100644 frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/README.md delete mode 100644 frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/README.md diff --git a/frontend/micro-ui/web/docker/Dockerfile b/frontend/micro-ui/web/docker/Dockerfile index ebd6437d645..14632eb97a3 100644 --- a/frontend/micro-ui/web/docker/Dockerfile +++ b/frontend/micro-ui/web/docker/Dockerfile @@ -7,11 +7,11 @@ RUN yarn add @upyog/digit-ui-module-pt RUN yarn add @upyog/digit-ui-module-fsm RUN yarn add @upyog/digit-ui-module-tl RUN yarn add @upyog/digit-ui-module-dss -RUN yarn add @egovernments/digit-ui-module-mcollect +RUN yarn add @upyog/digit-ui-module-mcollect RUN yarn add @upyog/digit-ui-module-pgr -RUN yarn add @egovernments/digit-ui-module-noc +RUN yarn add @upyog/digit-ui-module-noc RUN yarn add @upyog/digit-ui-module-engagement -RUN yarn add @egovernments/digit-ui-module-hrms +RUN yarn add @upyog/digit-ui-module-hrms RUN yarn add @egovernments/digit-ui-module-core RUN yarn add @upyog/digit-ui-module-obps RUN yarn add @egovernments/digit-ui-module-common diff --git a/frontend/micro-ui/web/micro-ui-internals/example/devpackage.json b/frontend/micro-ui/web/micro-ui-internals/example/devpackage.json index f9ec309dca4..ed123581feb 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/devpackage.json +++ b/frontend/micro-ui/web/micro-ui-internals/example/devpackage.json @@ -13,8 +13,8 @@ "@egovernments/digit-ui-module-common":"^1.4.0", "@upyog/digit-ui-module-engagement":"^1.4.0", "@upyog/digit-ui-module-fsm":"^1.4.0", - "@egovernments/digit-ui-module-mcollect":"^1.4.0", - "@egovernments/digit-ui-module-noc":"^1.4.0", + "@upyog/digit-ui-module-mcollect":"^1.4.0", + "@upyog/digit-ui-module-noc":"^1.4.0", "@upyog/digit-ui-module-obps":"^1.4.0", "@upyog/digit-ui-module-pgr":"^1.4.0", "@upyog/digit-ui-module-pt":"^1.4.0", 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 0bd55efcc0e..6230dfb65c8 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/example/package.json @@ -12,9 +12,9 @@ "@egovernments/digit-ui-libraries": "1.7.2", "@egovernments/digit-ui-module-common": "1.7.2", "@upyog/digit-ui-module-engagement": "1.7.2", - "@upyog/digit-ui-module-fsm": "1.7.2", - "@egovernments/digit-ui-module-mcollect": "1.7.2", - "@egovernments/digit-ui-module-noc": "1.7.2", + "@upyog/digit-ui-module-fsm": "1.7.3", + "@upyog/digit-ui-module-mcollect": "1.7.3", + "@upyog/digit-ui-module-noc": "1.7.3", "@upyog/digit-ui-module-obps": "1.7.2", "@upyog/digit-ui-module-pgr": "1.7.3", "@upyog/digit-ui-module-pt": "1.7.2", diff --git a/frontend/micro-ui/web/micro-ui-internals/example/src/index.js b/frontend/micro-ui/web/micro-ui-internals/example/src/index.js index 1302fbeef9d..bfd2bc1b91a 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/src/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/example/src/index.js @@ -4,21 +4,21 @@ import ReactDOM from "react-dom"; import { initLibraries } from "@egovernments/digit-ui-libraries"; import { PGRReducers } from "@upyog/digit-ui-module-pgr"; import { PTModule, PTLinks, PTComponents } from "@upyog/digit-ui-module-pt"; -import { MCollectModule, MCollectLinks } from "@egovernments/digit-ui-module-mcollect"; +import { MCollectModule, MCollectLinks } from "@upyog/digit-ui-module-mcollect"; // import { TLModule, TLLinks } from "@upyog/digit-ui-module-tl"; import { initFSMComponents } from "@upyog/digit-ui-module-fsm"; import { initPGRComponents } from "@upyog/digit-ui-module-pgr"; import { initDSSComponents } from "@upyog/digit-ui-module-dss"; -import { initHRMSComponents } from "@egovernments/digit-ui-module-hrms"; +import { initHRMSComponents } from "@upyog/digit-ui-module-hrms"; import { initReceiptsComponents, ReceiptsModule } from "@egovernments/digit-ui-module-receipts"; // import { initReportsComponents } from "@egovernments/digit-ui-module-reports"; -import { initMCollectComponents } from "@egovernments/digit-ui-module-mcollect"; +import { initMCollectComponents } from "@upyog/digit-ui-module-mcollect"; import { initTLComponents } from "@upyog/digit-ui-module-tl"; import { PaymentModule, PaymentLinks, paymentConfigs } from "@egovernments/digit-ui-module-common"; -import { HRMSModule } from "@egovernments/digit-ui-module-hrms"; +import { HRMSModule } from "@upyog/digit-ui-module-hrms"; import { initOBPSComponents } from "@upyog/digit-ui-module-obps"; import { initEngagementComponents } from "@upyog/digit-ui-module-engagement"; -import { initNOCComponents } from "@egovernments/digit-ui-module-noc"; +import { initNOCComponents } from "@upyog/digit-ui-module-noc"; import { initWSComponents } from "@upyog/digit-ui-module-ws"; import { DigitUI } from "@egovernments/digit-ui-module-core"; import { initCommonPTComponents } from "@egovernments/digit-ui-module-commonpt"; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/fsm/useMDMS.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/fsm/useMDMS.js index a8ed40e0605..72210e8db12 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/fsm/useMDMS.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/fsm/useMDMS.js @@ -24,6 +24,10 @@ const useMDMS = (tenantId, moduleCode, type, config = {}, payload = []) => { return useQuery("FSM_APPLICATION_EDIT_APPLICATION_CHANNEL", () => onlyEmployeeChannels(), queryConfig); }; + const useUrcConfig = () => { + return useQuery("FSM_APPLICATION_NEW_URC_CONFIG", () => MdmsService.getUrcConfig(tenantId, moduleCode, type), queryConfig); + }; + const usePropertyType = () => { return useQuery("FSM_PROPERTY_TYPE", () => MdmsService.getPropertyType(tenantId, moduleCode, type), queryConfig); }; @@ -146,7 +150,9 @@ const useMDMS = (tenantId, moduleCode, type, config = {}, payload = []) => { case "ReceivedPaymentType": return useReceivedPaymentType(); case "WSTaxHeadMaster": - return useWSTaxHeadMaster() + return useWSTaxHeadMaster(); + case "UrcConfig": + return useUrcConfig(); default: return null; } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js index 31850ae0944..b4de3a3d14f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js @@ -1004,6 +1004,8 @@ const GetApplicationChannel = (MdmsRes) => i18nKey: `ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_${channel.code}`, })); +const getUrcConfig = (MdmsRes) => MdmsRes["FSM"].UrcConfig; + const GetPropertyType = (MdmsRes) => MdmsRes["FSM"].PropertyType.filter((property) => property.active && !property.propertyType).map((item) => ({ ...item, @@ -1407,6 +1409,8 @@ const transformResponse = (type, MdmsRes, moduleCode, tenantId) => { return GetTripNumber(MdmsRes); case "ReceivedPaymentType": return GetReceivedPaymentType(MdmsRes); + case "UrcConfig": + return getUrcConfig(MdmsRes); default: return MdmsRes; } @@ -1522,6 +1526,9 @@ export const MdmsService = { getApplicationChannel: (tenantId, moduleCode) => { return MdmsService.getDataByCriteria(tenantId, getApplicationChannelCriteria(tenantId, moduleCode), moduleCode); }, + getUrcConfig: (tenantId, moduleCode, type) => { + return MdmsService.getDataByCriteria(tenantId, getUrcConfigCriteria(tenantId, moduleCode, type), moduleCode); + }, getPropertyType: (tenantId, moduleCode, type) => { return MdmsService.getDataByCriteria(tenantId, getPropertyTypeCriteria(tenantId, moduleCode, type), moduleCode); }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/README.md b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/README.md deleted file mode 100644 index a8831d99042..00000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/README.md +++ /dev/null @@ -1,77 +0,0 @@ - -# digit-ui-module-fsm - -## Install - -```bash -npm install --save @egovernments/digit-ui-module-fsm -``` - -## Limitation - -```bash -This Package is more specific to DIGIT-UI's can be used across mission's -``` - -## Usage - -After adding the dependency make sure you have this dependency in - -```bash -frontend/micro-ui/web/package.json -``` - -```json -"@egovernments/digit-ui-module-fsm":"^1.5.0", -``` - -then navigate to App.js - -```bash - frontend/micro-ui/web/src/App.js -``` - - -```jsx -/** add this import **/ - -import { initfsmComponents } from "@egovernments/digit-ui-module-fsm"; - -/** inside enabledModules add this new module key **/ - -const enabledModules = ["fsm"]; - -/** inside init Function call this function **/ - -const initDigitUI = () => { - initfsmComponents(); -}; -``` - - - - -### Changelog - -```bash -1.7.1 UPYOG Base version -``` - -### Contributors - -[jagankumar-egov] [Tulika-eGov] [vamshikrishnakole-wtt-egov] - -## Documentation - -Documentation Site (https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui) - -## Maintainer - -- [jagankumar-egov](https://www.github.com/jagankumar-egov) - - -### Published from DIGIT Frontend -DIGIT Frontend Repo (https://github.com/upyog/UPYOG/tree/develop) - - -![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png) \ No newline at end of file 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 41a0afc746b..72ead973433 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": "@upyog/digit-ui-module-fsm", - "version": "1.7.2", + "version": "1.7.3", "license": "MIT", "main": "dist/index.js", "description": "Digit FSM Module", @@ -19,8 +19,8 @@ "react-router-dom": "5.3.0" }, "dependencies": { - "@egovernments/digit-ui-react-components": "1.7.2", - "microbundle-crl": "0.13.11", + "@egovernments/digit-ui-react-components": "^1.7.0-beta.2", + "microbundle-crl": "0.13.11", "react": "17.0.2", "react-dom": "17.0.2", "react-hook-form": "6.15.8", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/Module.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/Module.js index b77e725dd76..ec6be4dfc49 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/Module.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/Module.js @@ -21,12 +21,13 @@ import SelectRoadDetails from "./pageComponents/SelectRoadDetails"; import SelectPropertySubtype from "./pageComponents/SelectPropertySubtype"; import SelectPropertyType from "./pageComponents/SelectPropertyType"; import SelectPropertyID from "./pageComponents/SelectPropertyID"; +import SelectTripNo from "./pageComponents/SelectTripNo"; import SelectSlumName from "./pageComponents/SelectSlumName"; // import SelectStreet from "./pageComponents/SelectStreet"; import FSMSelectStreet from "./pageComponents/FSMSelectStreet"; import SelectTankSize from "./pageComponents/SelectTankSize"; import SelectTripData from "./pageComponents/SelectTripData"; -import SelectTripNo from "./pageComponents/SelectTripNo"; +// import SelectTripNo from "./pageComponents/SelectTripNo"; import SelectPaymentPreference from "./pageComponents/SelectPaymentPreference"; import SelectVehicle from "./pageComponents/SelectVehicleType"; import CitizenApp from "./pages/citizen"; @@ -60,6 +61,7 @@ import AdvanceCollection from "./pageComponents/AdvanceCollection"; import SelectTrips from "./pageComponents/SelectTrips"; import PlusMinusInput from "./pageComponents/PlusMinusInput"; import ConfirmationBox from "./components/Confirmation"; +import SelectLocalityOrGramPanchayat from "./pageComponents/SelectLocalityOrGramPanchayat"; const FSMModule = ({ stateCode, userType, tenants }) => { const moduleCode = "FSM"; @@ -216,6 +218,7 @@ const componentsToRegister = { SelectTrips, PlusMinusInput, ConfirmationBox, + SelectLocalityOrGramPanchayat, }; export const initFSMComponents = () => { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/ApplicationTimeline.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/ApplicationTimeline.js index 476133bc5cf..61e49d3bb69 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/ApplicationTimeline.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/ApplicationTimeline.js @@ -2,19 +2,19 @@ import React, { Fragment } from "react"; import { useTranslation } from "react-i18next"; import { Link, useHistory, useParams } from "react-router-dom"; import { - Header, + // Header, ActionLinks, - Card, + // Card, CardSectionHeader, ConnectingCheckPoints, CheckPoint, - KeyNote, + // KeyNote, SubmitBar, - LinkButton, + // LinkButton, Loader, Rating, } from "@egovernments/digit-ui-react-components"; -import _ from "lodash"; +// import _ from "lodash"; import TLCaption from "./TLCaption"; export const ApplicationTimeline = (props) => { @@ -85,15 +85,15 @@ export const ApplicationTimeline = (props) => { if (checkpoint?.numberOfTrips) caption.comment = `${t("NUMBER_OF_TRIPS")}: ${checkpoint?.numberOfTrips}`; return ; } - else if (checkpoint.status === "PENDING_PAYYY") { + /* else if (checkpoint.status === "PENDING_PAYYY") { const caption = { name: checkpoint?.assigner, mobileNumber: checkpoint?.assigner?.mobileNumber, date: `${t("CS_FSM_EXPECTED_DATE")} ${Digit.DateUtils.ConvertTimestampToDate(props.application?.possibleServiceDate)}`, }; - return ; + return ; */ }; -} +// } const showNextActions = (nextAction) => { switch (nextAction?.action) { @@ -106,7 +106,7 @@ export const ApplicationTimeline = (props) => { state: { tenantId: props.application.tenantId }, }} > - {window.location.href.includes("citizen/fsm/") && } + ); @@ -125,7 +125,7 @@ export const ApplicationTimeline = (props) => { return ; } - +/* let deepCopy = _.cloneDeep( data ) let index1 =0 deepCopy?.timeline.map((check,index) => { @@ -137,7 +137,7 @@ deepCopy?.timeline.map((check,index) => { data.timeline[index].status ="ASSING_DSO_PAY" data.timeline.splice(index, 0, obj); } -}) +}) */ return ( {!isLoading && ( @@ -148,7 +148,8 @@ deepCopy?.timeline.map((check,index) => { )} {data?.timeline && data?.timeline?.length === 1 ? ( - + + ) : ( {data?.timeline && @@ -158,7 +159,7 @@ deepCopy?.timeline.map((check,index) => { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/DesktopInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/DesktopInbox.js index 170819ecc0e..7d322a63806 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/DesktopInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/DesktopInbox.js @@ -135,7 +135,7 @@ const DesktopInbox = (props) => { let citizen_info = props?.fstprequest?.find((i) => row.original.tripDetails[0].referenceNo === i.applicationNo); return (
- {t(`${citizen_info?.address?.locality?.code}`)} + {t(`${citizen_info?.address?.locality?.name}`)}
); }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/FsmCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/FsmCard.js index 6e0e69b516e..d7753817547 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/FsmCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/FsmCard.js @@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react"; import { Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { ArrowRightInbox, ShippingTruck, EmployeeModuleCard, AddNewIcon, ViewReportIcon, InboxIcon } from "@egovernments/digit-ui-react-components"; -import { checkForEmployee } from "../utils"; +// import { checkForEmployee } from "../utils"; const ArrowRight = ({ to }) => ( @@ -18,6 +18,8 @@ const FSMCard = () => { const FSM_CREATOR = Digit.UserService.hasAccess("FSM_CREATOR_EMP") || false; const isFSTPOperator = Digit.UserService.hasAccess("FSM_EMP_FSTPO") || false; + const [total, setTotal] = useState("-"); + // Septage ready for Disposal ( 10 KL) // Septage disposed today ( 50 KL) const tenantId = Digit.ULBService.getCurrentTenantId(); @@ -61,7 +63,7 @@ const FSMCard = () => { else return { uuid: { code: "ASSIGNED_TO_ME", name: t("ES_INBOX_ASSIGNED_TO_ME") } }; }; - const { data: inbox, isFetching: pendingApprovalRefetching, isLoading: isInboxLoading } = Digit.Hooks.fsm.useInbox( + const { data: inbox, isFetching: pendingApprovalRefetching } = Digit.Hooks.fsm.useInbox( tenantId, { ...filters, limit: 10, offset: 0, ...getUUIDFilter() }, { @@ -69,16 +71,33 @@ const FSMCard = () => { } ); + useEffect(() => { + if (inbox) { + const total = inbox?.totalCount || 0; + setTotal(total); + } + }, [inbox]); + + const moduleForSomeFSMAdmin = FSM_ADMIN + ? [ + { + link: "/digit-ui/employee/fsm/registry", + label: t("ES_TITLE_FSM_REGISTRY"), + icon: , + }, + ] + : []; + const propsForFSTPO = { Icon: , - moduleName: t("ES_COMMON_FSTP_OPERATION"), + moduleName: t("ES_TITLE_VEHICLE_LOG"), // kpis: isSuccess ? Object.keys(info).map((key, index) => ({ // label: t(key), // count: t(info[key]), // link: "/digit-ui/employee/fsm/fstp-inbox" // })): [], links: [ - { + /*{ label: t("ES_COMMON_INBOX"), link: "/digit-ui/employee/fsm/fstp-inbox", }, @@ -90,64 +109,69 @@ const FSMCard = () => { label: t("ES_FSM_VIEW_REPORTS_BUTTON"), link: "/employee/report/fsm/FSMFSTPPlantWithVehicleLogReport", hyperlink: true, + }, */ + { + label: t("ES_COMMON_HOME"), + link: "/digit-ui/employee/fsm/fstp-operations", }, ], }; - let links = [ - { - link: "/employee/report/fsm/FSMDailyDesludingReport", - hyperlink: true, - label: t("ES_FSM_VIEW_REPORTS_BUTTON"), - roles: ["FSM_ADMIN"], - }, - { - label: t("ES_TITLE_FSM_REGISTRY"), - link: `/digit-ui/employee/fsm/registry`, - roles: ["FSM_ADMIN"], - }, - { - label: t("ES_TITLE_NEW_DESULDGING_APPLICATION"), - link: `/digit-ui/employee/fsm/new-application`, - roles: ["FSM_CREATOR_EMP", "FSM_ADMIN"], - }, - { - label: t("ES_TITILE_SEARCH_APPLICATION"), - link: `/digit-ui/employee/fsm/search`, - }, - ]; + if (isFSTPOperator && isSuccess) { + return ; + } - links = links.filter((link) => (link.roles ? checkForEmployee(link.roles) : true)); + const linksForSomeFSMEmployees = + !DSO && !COLLECTOR && !FSM_EDITOR + ? [ + { + label: t("ES_TITLE_NEW_DESULDGING_APPLICATION"), + link: `/digit-ui/employee/fsm/new-application`, + }, + ] + : []; - const propsForModuleCard = { - Icon: , - moduleName: t("ES_TITLE_FAECAL_SLUDGE_MGMT"), - kpis: [ - { - count: isInboxLoading ? "-" : inbox?.totalCount, - label: t("TOTAL_FSM"), - link: `/digit-ui/employee/fsm/inbox`, - }, - { - count: isInboxLoading ? "-" : inbox?.nearingSlaCount, - label: t("TOTAL_NEARING_SLA"), - link: `/digit-ui/employee/fsm/inbox`, - }, - ], - links: [ - { - count: isInboxLoading ? "-" : inbox?.totalCount, - link: "/digit-ui/employee/fsm/inbox", - label: t("ES_COMMON_INBOX"), - }, - ...links, - ], - }; + const propsForModuleCard = isFSTPOperator + ? { + Icon: , + moduleName: t("ES_TITLE_VEHICLE_LOG"), + // kpis: isSuccess ? Object.keys(info).map((key, index) => ({ + // label: t(key), + // count: t(info[key]), + // link: "/digit-ui/employee/fsm/fstp-inbox" + // })): [], + links: [ + { + label: t("ES_COMMON_HOME"), + link: "/digit-ui/employee/fsm/fstp-operations", + }, + ], + } + : { + Icon: , + moduleName: t("ES_TITLE_FAECAL_SLUDGE_MGMT"), + kpis: [ + { + count: total, + label: t("TOTAL_FSM"), + link: `/digit-ui/employee/fsm/inbox`, + }, + { + label: t("TOTAL_NEARING_SLA"), + link: `/digit-ui/employee/fsm/inbox`, + }, + ], + links: [ + { + count: total, + label: t("ES_COMMON_INBOX"), + link: `/digit-ui/employee/fsm/inbox`, + }, + ...linksForSomeFSMEmployees, + ...moduleForSomeFSMAdmin, + ], + }; - return isFSTPOperator ? ( - - ) : ( - - ); + return ; }; export default FSMCard; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistryInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistryInbox.js index d429fd76e42..e1a63964a36 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistryInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistryInbox.js @@ -200,6 +200,47 @@ const RegisryInbox = (props) => { }); }; + const onVendorVehicleSelect = (row, selectedOption) => { + let vehicleData = row.original; + let formDetails = row.original.dsoDetails; + let existingVendor = vehicleData?.vendor; + let selectedVendor = selectedOption; + delete vehicleData.vendor; + vehicleData.vendorVehicleStatus = "ACTIVE"; + if (existingVendor) { + const vehicles = existingVendor?.vehicles; + vehicles.splice( + vehicles.findIndex((ele) => ele.id === vehicleData.id), + 1 + ); + const formData = { + vendor: { + ...formDetails, + vehicles: vehicles, + }, + }; + } + const formData = { + vendor: { + ...selectedVendor, + vehicles: selectedVendor.vehicles ? [...selectedVendor.vehicles, vehicleData] : [vehicleData], + }, + }; + + mutateVendor(formData, { + onError: (error, variables) => { + setShowToast({ key: "error", action: error }); + setTimeout(closeToast, 5000); + }, + onSuccess: (data, variables) => { + setShowToast({ key: "success", action: "VENDOR" }); + queryClient.invalidateQueries("DSO_SEARCH"); + props.refetchData(); + setTimeout(closeToast, 3000); + }, + }); + }; + const onCellClick = (row, column, length) => { setTableData((old) => old.map((data, index) => { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistrySearch.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistrySearch.js index 2c94330e716..b5891626081 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistrySearch.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistrySearch.js @@ -182,14 +182,14 @@ const SearchApplication = ({ onSearch, type, onClose, onTabChange, isFstpOperato {showAddMenu && ( - + )}
{searchFields?.map((input, index) => ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/TLTimelineInFSM.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/TLTimelineInFSM.js index f3bc3234a53..46368270571 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/TLTimelineInFSM.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/TLTimelineInFSM.js @@ -10,7 +10,7 @@ const getAction = (flow) => { break; case "APPLY": actions = [ 'FSM_TIMELINE_PROPERTY_DETAILS', - // 'FSM_GENDER_DETAILS', + 'FSM_GENDER_DETAILS', 'FSM_PAYMENT_DETAILS', 'FSM_TIMELINE_SUMMARY', ] diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/FSMLink.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/FSMLink.js index fcd4fe0b1ba..6e854af7a02 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/FSMLink.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/FSMLink.js @@ -60,7 +60,7 @@ const FSMLink = ({ parentRoute, isMobile, data }) => { {links.map(({ link, text, hyperlink = false, accessTo = [] }, index) => { return ( - {hyperlink ? {text} : {text}} + {hyperlink ? {t(text)} : {t(text)}} ); })} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/Filter.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/Filter.js index b2b9166f6d7..a2806b67d6f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/Filter.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/Filter.js @@ -46,16 +46,13 @@ const Filter = ({ searchParams, paginationParms, onFilterChange, onSearch, remov const clearAll = () => { if (isFstpOperator) return onFilterChange(); - onFilterChange({ applicationStatus: [], locality: [] }); + // onFilterChange({ applicationStatus: [], locality: [] }); // props?.onClose?.(); }; return ( - {((!DSO && !isFstpOperator && searchParams && (searchParams?.applicationStatus?.length > 0 || searchParams?.locality?.length > 0)) || - mergedRoleDetails?.statuses?.length > 0 || - isFstpOperatorRequest) && ( -
+ {((!DSO && !isFstpOperator && searchParams) || (mergedRoleDetails?.statuses?.length > 0) || (isFstpOperatorRequest)) &&
{t("ES_COMMON_FILTER_BY")}:
@@ -73,15 +70,15 @@ const Filter = ({ searchParams, paginationParms, onFilterChange, onSearch, remov )}
- {/*
+
{!DSO && !isFstpOperator && searchParams && ( )} -
*/} - {/* {GetSelectOptions(t("ES_INBOX_LOCALITY"), localities, selectedLocality, onSelectLocality, "code", onRemove, "locality", "name")} */} - {/*
*/} +
+ {/* {GetSelectOptions(t("ES_INBOX_LOCALITY"), localities, selectedLocality, onSelectLocality, "code", onRemove, "locality", "name")} */} +
{/* */} - {/*
*/} +
{mergedRoleDetails?.statuses?.length > 0 || isFstpOperatorRequest ? (
@@ -119,8 +116,8 @@ const Filter = ({ searchParams, paginationParms, onFilterChange, onSearch, remov
- )} - {props.type === "mobile" && ( + } + {props.type === "mobile" && props.onClose && ( { - onSearch(); + if (props.type === "mobile") onSearch({ delete: ["applicationNos"] }); + else onSearch(); }} style={{ flex: 1 }} /> diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/search.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/search.js index 7f9b866dc98..fbee5fa218f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/search.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/search.js @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useState,useEffect } from "react"; import { useForm, Controller } from "react-hook-form"; import { TextInput, @@ -27,6 +27,8 @@ const SearchApplication = ({ onSearch, type, onClose, isFstpOperator, searchFiel const mobileView = innerWidth <= 640; const FSTP = Digit.UserService.hasAccess("FSM_EMP_FSTPO") || false; const watchSearch = watch(["applicationNos", "mobileNumber", "fromDate", "toDate"]); + const [isReady, setIsReady] = useState(false); + const onSubmitInput = (data) => { if (!data.mobileNumber) { @@ -131,10 +133,12 @@ const SearchApplication = ({ onSearch, type, onClose, isFstpOperator, searchFiel
)} -
+
{searchFields?.map((input, index) => ( - + {getFields(input)}{" "} ))} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/getPDFData.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/getPDFData.js index 2bee8d7d134..02728f7e06a 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/getPDFData.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/getPDFData.js @@ -9,6 +9,17 @@ const getSlumName = (application, t) => { } return application?.slum?.i18nKey ? t(`${application?.slum?.i18nKey}`) : "N/A"; }; +/* +const getDistanceofPitFromRoad = (distancefromroad) => { + if (!distancefromroad) + return "N/A"; + return distancefromroad;}; + +const getRoadWidth = (roadWidth) => { + if (!roadWidth) + return "N/A"; + return roadWidth;}; +*/ const getApplicationVehicleCapacity = (vehicleCapacity) => { if (!vehicleCapacity) return "N/A"; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/AdvanceCollection.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/AdvanceCollection.js index 7ee2f3ab84b..42c53147432 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/AdvanceCollection.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/AdvanceCollection.js @@ -38,7 +38,7 @@ const AdvanceCollection = ({ t, config, onSelect, formData, userType, FSMTextFie title: t("ES_NEW_APPLICATION_AMOUNT_INVALID"), }, - default: formData?.advanceAmount, + default: url.includes("modify") ? applicationData?.advanceAmount : formData?.advanceAmount, isMandatory: true, }, ]; @@ -56,7 +56,13 @@ const AdvanceCollection = ({ t, config, onSelect, formData, userType, FSMTextFie setVehicle({ label: formData?.tripData?.vehicleType?.capacity }); } - if (formData?.propertyType && formData?.subtype && formData?.address && formData?.tripData?.vehicleType?.capacity) { + if ( + formData?.propertyType && + formData?.subtype && + formData?.address && + formData?.tripData?.vehicleType?.capacity && + formData?.address?.propertyLocation?.code === "WITHIN_ULB_LIMITS" + ) { const capacity = formData?.tripData?.vehicleType.capacity; const { slum: slumDetails } = formData.address; const slum = slumDetails ? "YES" : "NO"; @@ -78,11 +84,11 @@ const AdvanceCollection = ({ t, config, onSelect, formData, userType, FSMTextFie Digit.SessionStorage.set("advance_amount", advanceBalanceAmount); setTotalAmount(totaltripAmount); setAdvanceAmounts(advanceBalanceAmount); - !url.includes("modify") || (url.includes("modify") && advanceBalanceAmount > formData?.advancepaymentPreference?.advanceAmount) - ? setValue({ - advanceAmount: advanceBalanceAmount, - }) - : null; + if (!url.includes("modify") || (url.includes("modify") && advanceBalanceAmount > formData?.advancepaymentPreference?.advanceAmount)) { + setValue({ + advanceAmount: advanceBalanceAmount, + }); + } setError(false); } else { sessionStorage.removeItem("Digit.total_amount"); @@ -92,6 +98,37 @@ const AdvanceCollection = ({ t, config, onSelect, formData, userType, FSMTextFie } })(); }, [formData?.propertyType, formData?.subtype, formData?.address?.slum, formData?.tripData?.vehicleType?.capacity, formData?.tripData?.noOfTrips]); + + useEffect(() => { + (async () => { + if (formData?.address?.propertyLocation?.code === "FROM_GRAM_PANCHAYAT" && formData.tripData.noOfTrips && formData.tripData.amountPerTrip) { + const totaltripAmount = formData.tripData.amountPerTrip * formData.tripData.noOfTrips; + + const { advanceAmount: advanceBalanceAmount } = await Digit.FSMService.advanceBalanceCalculate(tenantId, { + totalTripAmount: totaltripAmount, + }); + Digit.SessionStorage.set("total_amount", totaltripAmount); + Digit.SessionStorage.set("advance_amount", advanceBalanceAmount); + setTotalAmount(totaltripAmount); + setAdvanceAmounts(advanceBalanceAmount); + if (formData?.address?.propertyLocation?.code === "FROM_GRAM_PANCHAYAT" && url.includes("modify")) { + setValue({ + advanceAmount: 0, + }); + } else if ( + !url.includes("modify") || + url.includes("modify") || + (formData?.advancepaymentPreference?.advanceAmount > 0 && advanceBalanceAmount > formData?.advancepaymentPreference?.advanceAmount) + ) { + setValue({ + advanceAmount: advanceBalanceAmount, + }); + } + + setError(false); + } + })(); + }, [formData.tripData.noOfTrips, formData.tripData.amountPerTrip]); return isVehicleMenuLoading && isDsoLoading ? ( ) : ( @@ -99,7 +136,6 @@ const AdvanceCollection = ({ t, config, onSelect, formData, userType, FSMTextFie {formData?.tripData?.amountPerTrip !== 0 && inputs?.map((input, index) => { let currentValue = formData && formData[config.key] && formData[config.key][input.name]; - return ( @@ -110,15 +146,17 @@ const AdvanceCollection = ({ t, config, onSelect, formData, userType, FSMTextFie
0 + ? false + : true : false } type={input.type} key={input.name} style={FSMTextFieldStyle} onChange={(e) => setAdvanceAmount(e.target.value)} - value={input.default ? input.default : formData && formData[config.key] ? formData[config.key][input.name] : null} + value={formData && formData[config.key] ? formData[config.key][input.name] : applicationData?.advanceAmount} {...input.validation} /> {currentValue > TotalAmount && ( @@ -132,11 +170,11 @@ const AdvanceCollection = ({ t, config, onSelect, formData, userType, FSMTextFie )} {url.includes("modify-application") && - Number(AdvanceAmount) === 0 && applicationData?.advanceAmount > 0 && + Number(formData?.tripData?.amountPerTrip) > 0 && Number(currentValue) === 0 && ( - {t("FSM_ADVANCE_AMOUNT_NOT_ZERO")} + {t("FSM_ADVANCE_AMOUNT_LESS_THAN_AMOUNT_PER_TRIP")} )}
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/CheckSlum.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/CheckSlum.js index 9f0eed0a632..841104b71a2 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/CheckSlum.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/CheckSlum.js @@ -13,9 +13,12 @@ const CheckSlum = ({ t, config, onSelect, userType, formData }) => { const onSkip = () => onSelect(); function goNext() { - sessionStorage.removeItem("Digit.total_amount") + sessionStorage.removeItem("Digit.total_amount"); onSelect(config.key, { slumArea }); } + useEffect(() => { + if (formData?.address?.propertyLocation?.code === "FROM_GRAM_PANCHAYAT") onSkip(); + }, [formData]); return ( 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 7f14a804c36..4464a06ec60 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 @@ -1,11 +1,33 @@ import React, { useEffect, useState } from "react"; import { FormStep, CardLabel, Dropdown, RadioButtons, LabelFieldPair, RadioOrSelect } from "@egovernments/digit-ui-react-components"; import Timeline from "../components/TLTimelineInFSM"; +import { useLocation } from "react-router-dom"; 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, + code: "WITHIN_ULB_LIMITS", + i18nKey: "WITHIN_ULB_LIMITS", + name: "Witnin ULB Limits", + }, + { + active: true, + code: "FROM_GRAM_PANCHAYAT", + i18nKey: "FROM_GRAM_PANCHAYAT", + name: "From Gram Panchayat", + }, + ]; + const { pincode, city } = formData?.address || ""; const cities = userType === "employee" @@ -14,7 +36,10 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { ? allCities.filter((city) => city?.pincode?.some((pin) => pin == pincode)) : allCities; - const [selectedCity, setSelectedCity] = useState(() => formData?.address?.city || Digit.SessionStorage.get("fsm.file.address.city") || null); + const [selectedCity, setSelectedCity] = useState( + () => 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", @@ -23,6 +48,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 [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(); @@ -35,7 +71,16 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { }, [cities]); useEffect(() => { - if (selectedCity && fetchedLocalities) { + if (selectedCity && selectLocation) { + if (userType === "employee") { + onSelect(config.key, { + ...formData[config.key], + city: selectedCity, + propertyLocation: selectLocation, + }); + } + } + if ((!isUrcEnable || isNewVendor || isEditVendor) && selectedCity && fetchedLocalities) { let __localityList = fetchedLocalities; let filteredLocalityList = []; @@ -59,7 +104,7 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { } } } - }, [selectedCity, formData?.address?.pincode, fetchedLocalities]); + }, [selectedCity, selectLocation, fetchedLocalities]); function selectCity(city) { setSelectedLocality(null); @@ -68,6 +113,29 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { setSelectedCity(city); } + function selectedValue(value) { + setSelectLocation(value); + Digit.SessionStorage.set("locationType", value); + if (userType === "employee") { + if (value.code === "FROM_GRAM_PANCHAYAT") { + onSelect("tripData", { + ...formData["tripData"], + amountPerTrip: "", + amount: "", + }); + onSelect(config.key, { + ...formData[config.key], + propertyLocation: value, + }); + } else { + onSelect(config.key, { + ...formData[config.key], + propertyLocation: value, + }); + } + } + } + function selectLocality(locality) { setSelectedLocality(locality); if (userType === "employee") { @@ -75,8 +143,18 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { } } + const onNewLocality = (value) => { + setNewLocality(value); + if (userType === "employee") { + onSelect(config.key, { ...formData[config.key], newLocality: value }); + } + }; + function onSubmit() { - onSelect(config.key, { city: selectedCity, locality: selectedLocality }); + onSelect(config.key, { + city: selectedCity, + propertyLocation: Digit.SessionStorage.get("locationType") ? Digit.SessionStorage.get("locationType") : selectLocation, + }); } if (userType === "employee") { @@ -98,41 +176,70 @@ const FSMSelectAddress = ({ t, config, onSelect, userType, formData }) => { t={t} />
- - - {t("ES_NEW_APPLICATION_LOCATION_MOHALLA")} - {config.isMandatory ? " * " : null} - - - + {!isUrcEnable || isNewVendor || isEditVendor ? ( +
+ + + {t("ES_NEW_APPLICATION_LOCATION_MOHALLA")} + {config.isMandatory ? " * " : null} + + + + {!isNewVendor && !isEditVendor && !isUrcEnable && formData?.address?.locality?.name === "Other" && ( + + {`${t("ES_INBOX_PLEASE_SPECIFY_LOCALITY")} *`} +
+ onNewLocality(e.target.value)} /> +
+
+ )} +
+ ) : ( + + {`${t("CS_PROPERTY_LOCATION")} *`} +
+ +
+
+ )}
); } return ( - + + {isUrcEnable && ( + + {`${t("CS_PROPERTY_LOCATION")} *`} + + + )} {`${t("MYCITY_CODE_LABEL")} *`} - {selectedCity && localities && {`${t("CS_CREATECOMPLAINT_MOHALLA")} *`}} - {selectedCity && localities && ( - - )} ); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/FSMSelectStreet.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/FSMSelectStreet.js index 4aaf07aafef..ba718c1dafd 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/FSMSelectStreet.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/FSMSelectStreet.js @@ -208,6 +208,7 @@ const FSMSelectStreet = ({ t, config, onSelect, userType, formData, formState, s _defaultValues={{ street: formData?.address.street, doorNo: formData?.address.doorNo }} onChange={handleSkip} onSelect={(data) => onSelect(config.key, data)} + onSkip={onSkip} isDisabled={doorNo || street ? false : true} t={t} /> diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectGender.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectGender.js index 8c2467c7f8e..83f6281d478 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectGender.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectGender.js @@ -44,7 +44,7 @@ const SelectGender = ({ config, onSelect, t, userType, formData }) => { className="payment-form-text-input-correction" isMandatory={config.isMandatory} selected={genderType} - option={GenderData} + option={GenderData?.sort((a, b) => a.code.localeCompare(b.code))} select={selectGenderType} optionKey="i18nKey" disable={config.disable} @@ -58,7 +58,7 @@ const SelectGender = ({ config, onSelect, t, userType, formData }) => { a.code.localeCompare(b.code))} selectedOption={genderType} optionKey="i18nKey" onSelect={selectGenderType} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectLocalityOrGramPanchayat.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectLocalityOrGramPanchayat.js new file mode 100644 index 00000000000..144d413b404 --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectLocalityOrGramPanchayat.js @@ -0,0 +1,369 @@ +import { CardLabel, Dropdown, FormStep, LabelFieldPair, TextInput } from "@egovernments/digit-ui-react-components"; +import _ from "lodash"; +import React, { useEffect, useState } from "react"; +import { useForm } from "react-hook-form"; +import Timeline from "../components/TLTimelineInFSM"; + +const SelectLocalityOrGramPanchayat = ({ t, config, onSelect, userType, formData, formState }) => { + const allCities = Digit.Hooks.fsm.useTenants(); + let tenantId = Digit.ULBService.getCurrentTenantId(); + if (userType !== "employee") { + tenantId = Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code; + } + const { data: urcConfig } = Digit.Hooks.fsm.useMDMS(tenantId, "FSM", "UrcConfig"); + const isUrcEnable = urcConfig && urcConfig.length > 0 && urcConfig[0].URCEnable; + const { pincode, city, propertyLocation } = formData?.address || ""; + const cities = + userType === "employee" + ? allCities.filter((city) => city?.code === tenantId) + : pincode + ? allCities.filter((city) => city?.pincode?.some((pin) => pin == pincode)) + : allCities; + const [selectedLocality, setSelectedLocality] = useState(); + const [localities, setLocalities] = useState(); + const [gramPanchayats, setGramPanchayats] = useState(); + const [selectedGp, setSelectedGp] = useState(() => + formData?.address?.additionalDetails?.gramPanchayat ? formData?.address?.additionalDetails?.gramPanchayat : {} + ); + const [villages, setVillages] = useState([]); + const [selectedVillage, setSelectedVillage] = useState(() => + formData?.address?.additionalDetails?.village ? formData?.address?.additionalDetails?.village : {} + ); + const [newVillage, setNewVillage] = useState(); + const [newGp, setNewGp] = useState(); + const [newLocality, setNewLocality] = useState(); + const [selectedCity, setSelectedCity] = useState(() => formData?.address?.city || Digit.SessionStorage.get("fsm.file.address.city") || null); + useEffect(() => { + if (cities) { + if (cities.length === 1) { + setSelectedCity(cities[0]); + } + } + }, [cities]); + var { data: fetchedGramPanchayats } = Digit.Hooks.useBoundaryLocalities( + selectedCity?.code, + "gramPanchayats", + { + enabled: !!selectedCity, + }, + t + ); + + var { data: fetchedLocalities } = Digit.Hooks.useBoundaryLocalities( + selectedCity?.code, + "revenue", + { + enabled: !!selectedCity, + }, + t + ); + + useEffect(() => { + if (selectedCity && fetchedLocalities) { + let __localityList = fetchedLocalities; + let filteredLocalityList = []; + + if (formData?.address?.locality && formData?.address?.additionalDetails?.boundaryType === "Locality") { + setSelectedLocality(formData.address.locality); + setNewLocality(formData?.address?.additionalDetails?.newLocality); + } + + if (formData?.address?.pincode) { + filteredLocalityList = __localityList.filter((obj) => obj.pincode?.find((item) => item == formData.address.pincode)); + if (!formData?.address?.locality) setSelectedLocality(); + } + 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], + }); + } + } + } + }, [selectedCity, fetchedLocalities]); + + useEffect(() => { + if (fetchedGramPanchayats) { + if (fetchedGramPanchayats && fetchedGramPanchayats.length > 0) { + setGramPanchayats(fetchedGramPanchayats); + } + if (formData?.address?.additionalDetails?.gramPanchayat?.code) { + const filteredGramPanchayat = fetchedGramPanchayats.filter( + (obj) => obj?.code === formData?.address?.additionalDetails?.gramPanchayat?.code + )[0]; + setSelectedGp(filteredGramPanchayat); + setNewGp(formData?.address?.additionalDetails?.newGp); + var villageUnderGp = filteredGramPanchayat?.children.filter((obj) => obj?.code === formData?.address?.additionalDetails?.village?.code); + if (villageUnderGp.length > 0) { + villageUnderGp[0].i18nkey = tenantId.replace(".", "_").toUpperCase() + "_REVENUE_" + villageUnderGp[0]?.code; + setSelectedVillage(villageUnderGp[0]); + setVillages(villageUnderGp); + } else { + setNewVillage(typeof formData?.address?.additionalDetails?.village === "string" ? formData?.address?.additionalDetails?.village : ""); + } + } + } + }, [fetchedGramPanchayats, formData?.address?.additionalDetails?.gramPanchayat?.code]); + if (userType !== "employee" && propertyLocation?.code === "FROM_GRAM_PANCHAYAT") { + config.texts.cardText = "CS_FILE_APPLICATION_PROPERTY_LOCATION_GRAM_PANCHAYAT_TEXT"; + } + + function selectLocality(locality) { + setSelectedLocality(locality); + if (userType === "employee") { + onSelect(config.key, { ...formData[config.key], locality: locality }); + } + } + + function selectGramPanchayat(value) { + setSelectedGp(value); + const filteredVillages = fetchedGramPanchayats.filter((items) => items?.code === value?.code)[0].children; + const localitiesWithLocalizationKeys = filteredVillages?.map((obj) => ({ + ...obj, + i18nkey: tenantId.replace(".", "_").toUpperCase() + "_REVENUE_" + obj?.code, + })); + if (localitiesWithLocalizationKeys?.length > 0) { + setVillages(localitiesWithLocalizationKeys); + } + if (userType === "employee") { + onSelect(config.key, { ...formData[config.key], gramPanchayat: value }); + } + Digit.SessionStorage.del("locationType"); + } + + function selectVillage(value) { + setSelectedVillage(value); + if (userType === "employee") { + onSelect(config.key, { ...formData[config.key], village: value }); + } + } + + const onChangeVillage = (value) => { + setNewVillage(value); + if (userType === "employee") { + onSelect(config.key, { ...formData[config.key], newVillage: value }); + } + }; + const onNewGpChange = (value) => { + setNewGp(value); + if (userType === "employee") { + onSelect(config.key, { ...formData[config.key], newGp: value }); + } + }; + const onNewLocality = (value) => { + setNewLocality(value); + if (userType === "employee") { + onSelect(config.key, { ...formData[config.key], newLocality: value }); + } + }; + function onSubmit() { + if (propertyLocation?.code === "FROM_GRAM_PANCHAYAT") { + onSelect(config.key, { + gramPanchayat: selectedGp, + village: selectedVillage, + newGramPanchayat: newGp, + newVillage: newVillage, + }); + } else { + onSelect(config.key, { + locality: selectedLocality, + newLocality: newLocality, + }); + } + } + if (userType === "employee") { + return ( +
+ {propertyLocation?.code === "FROM_GRAM_PANCHAYAT" ? ( +
+ + + {t("CS_GRAM_PANCHAYAT")} + {config.isMandatory ? " * " : null} + + a.name.localeCompare(b.name))} + select={selectGramPanchayat} + optionKey="i18nkey" + t={t} + /> + + {selectedGp?.name === "Other" && ( + + {`${t("ES_INBOX_PLEASE_SPECIFY_GRAM_PANCHAYAT")} *`} +
+ onNewGpChange(e.target.value)} /> +
+
+ )} + {villages.length > 0 && ( + + {t("CS_VILLAGE_NAME")} + a.name.localeCompare(b.name))} + select={selectVillage} + optionKey="i18nkey" + t={t} + /> + + )} + {villages.length === 0 && ( + + {t("CS_VILLAGE_NAME")} +
+ onChangeVillage(e.target.value)} /> +
+
+ )} +
+ ) : ( + isUrcEnable && ( +
+ + + {t("CS_CREATECOMPLAINT_MOHALLA")} + {config.isMandatory ? " * " : null} + + a.name.localeCompare(b.name))} + select={selectLocality} + optionKey="i18nkey" + t={t} + /> + + {formData?.address?.locality?.name === "Other" && ( + + {`${t("ES_INBOX_PLEASE_SPECIFY_LOCALITY")} *`} +
+ onNewLocality(e.target.value)} /> +
+
+ )} +
+ ) + )} +
+ ); + } + return ( + + + + {propertyLocation?.code === "WITHIN_ULB_LIMITS" ? ( +
+ + + {`${t("CS_CREATECOMPLAINT_MOHALLA")} *`} + {/* {config.isMandatory ? " * " : null} */} + + a.name.localeCompare(b.name))} + select={selectLocality} + optionKey="i18nkey" + t={t} + /> + + {selectedLocality?.name === "Other" && ( + + {`${t("ES_INBOX_PLEASE_SPECIFY_LOCALITY")} *`} + onNewLocality(e.target.value)} + /> + + )} +
+ ) : ( +
+ + + {`${t("CS_GRAM_PANCHAYAT")} *`} + {/* {config.isMandatory ? " * " : null} */} + + a.name.localeCompare(b.name))} + select={selectGramPanchayat} + optionKey="i18nkey" + t={t} + /> + + {selectedGp?.name === "Other" && ( + + {`${t("ES_INBOX_PLEASE_SPECIFY_GRAM_PANCHAYAT")} *`} + onNewGpChange(e.target.value)} + /> + + )} + {villages.length > 0 && ( + + {t("CS_VILLAGE_NAME")} + a.name.localeCompare(b.name))} + select={selectVillage} + optionKey="i18nkey" + t={t} + /> + + )} + {villages.length === 0 && ( + + {t("CS_VILLAGE_NAME")} + onChangeVillage(e.target.value)} + /> + + )} +
+ )} +
+
+ ); +}; + +export default SelectLocalityOrGramPanchayat; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectName.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectName.js index a1413119307..a2e379ebe8b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectName.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectName.js @@ -33,7 +33,14 @@ const SelectName = ({ t, config, onSelect, formData = {}, userType, register, er }, componentInFront:
+91
, isMandatory: true, - } + }, + { + label: "COMMON_APPLICANT_GENDER", + type: "dropdown", + name: "applicantGender", + options: genderTypes, + isMandatory: false, + }, ]; useEffect(() => { @@ -84,7 +91,7 @@ const SelectName = ({ t, config, onSelect, formData = {}, userType, register, er
a.code.localeCompare(b.code))} optionKey="i18nKey" id="dropdown" selected={formData && formData[config.key] ? input.options.find((data) => data.code === formData[config.key][input.name]) : null} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPaymentPreference.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPaymentPreference.js index e81896e27f9..218958e515c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPaymentPreference.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPaymentPreference.js @@ -49,24 +49,34 @@ const SelectPaymentPreference = ({ config, formData, t, onSelect, userType }) => useEffect(() => { (async () => { - if (formData?.propertyType && formData?.subtype && formData?.address && formData?.selectTripNo?.vehicleCapacity.capacity) { + if (formData?.propertyType && formData?.subtype && formData?.address && formData?.selectTripNo?.vehicleCapacity.capacity && + formData?.address?.propertyLocation?.code === "WITHIN_ULB_LIMITS") { const capacity = formData?.selectTripNo?.vehicleCapacity.capacity; const { slum: slumDetails } = formData.address; const slum = slumDetails ? "YES" : "NO"; - const billingDetails = await Digit.FSMService.billingSlabSearch(tenantId, { - propertyType: formData?.subtype?.code, - capacity, - slum, - }); + const billingDetails = await Digit.FSMService.billingSlabSearch( + tenantId === formData?.address?.city?.code + ? tenantId + : formData?.address?.city?.code, + { + propertyType: formData?.subtype?.code, + capacity, + slum, + }); const billSlab = billingDetails?.billingSlab?.length && billingDetails?.billingSlab[0]; Digit.SessionStorage.set("amount_per_trip", billSlab.price); if (billSlab?.price) { let totaltripAmount = billSlab.price * formData?.selectTripNo?.tripNo?.code; - const { advanceAmount: advanceBalanceAmount } = await Digit.FSMService.advanceBalanceCalculate(tenantId, { - totalTripAmount: totaltripAmount, - }); + const { advanceAmount: advanceBalanceAmount } = + await Digit.FSMService.advanceBalanceCalculate( + tenantId === formData?.address?.city?.code + ? tenantId + : formData?.address?.city?.code, + { + totalTripAmount: totaltripAmount, + }); setMinAmount(advanceBalanceAmount); setTotalAmount(totaltripAmount); Digit.SessionStorage.set("total_amount", totaltripAmount); @@ -84,6 +94,10 @@ const SelectPaymentPreference = ({ config, formData, t, onSelect, userType }) => sessionStorage.removeItem("Digit.advance_amount"); setError(true); } + } else { + setAdvanceAmount(0); + Digit.SessionStorage.set("advance_amount", 0); + Digit.SessionStorage.set("amount_per_trip", null); } })(); }, [ @@ -115,7 +129,27 @@ const SelectPaymentPreference = ({ config, formData, t, onSelect, userType }) => isDisabled={currentValue > max ? true : false || currentValue < min ? true : false} t={t} > - + + {formData?.address?.propertyLocation?.code === + "FROM_GRAM_PANCHAYAT" && ( + + {t("FSM_TOTAL_AMOUNT_NOTE")} + + )} {inputs?.map((input, index) => { return ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPincode.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPincode.js index 51e92511cfa..8984065b620 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPincode.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPincode.js @@ -23,6 +23,7 @@ const SelectPincode = ({ t, config, onSelect, formData = {}, userType, register, max: "9999999", title: t("CORE_COMMON_PINCODE_INVALID"), }, + disable: true, }, ]; @@ -79,7 +80,7 @@ const SelectPincode = ({ t, config, onSelect, formData = {}, userType, register, {config.isMandatory ? " * " : null}
- +
{pincodeServicability && ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPitType.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPitType.js index 187a5c1eb28..bc7af913d00 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPitType.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPitType.js @@ -29,7 +29,16 @@ const SelectPitType = ({ t, formData, config, onSelect, userType }) => { return ; } if (userType === "employee") { - return ; + return ( + a.name.localeCompare(b.name))} + optionKey="i18nKey" + select={selectPitType} + selected={pitType} + t={t} + /> + ); } return ( @@ -38,7 +47,7 @@ const SelectPitType = ({ t, formData, config, onSelect, userType }) => { {t("CS_FILE_APPLICATION_PIT_TYPE_LABEL")} a.name.localeCompare(b.name))} selectedOption={pitType} optionKey="i18nKey" onSelect={selectPitType} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPropertyID.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPropertyID.js index 663792097ea..3acb6dbdb12 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPropertyID.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPropertyID.js @@ -3,8 +3,7 @@ import { TextArea, LabelFieldPair, CardLabel, TextInput } from "@egovernments/di import FormStep from "../../../../react-components/src/molecules/FormStep" import Timeline from "../components/TLTimelineInFSM"; const SelectPropertyID = ({ t, config, onSelect, formData, userType, setError: setFormError, clearErrors: clearFormErrors }) => { -const [propertyID, setPropertyID] = useState(formData?.propertyID?.propertyID|| formData.propertyID ||""); -const [disable,setDisable]=useState(false) +const [propertyID, setPropertyID] = useState(formData?.propertyID?.propertyID|| ""); const [error, setError] = useState(""); const inputs = [ { @@ -13,23 +12,13 @@ const inputs = [ placeholder:"Enter a valid property ID", validation: { maxLength: 256, + }, }, ]; const goNext=()=>{ onSelect(config.key, { ...formData[config.key], ...data }) } - useEffect(()=>{ - -if(window.location.href.includes("employee/fsm/new-application")) -{ - setDisable(false) -} -else if(window.location.href.includes("employee")) -{ - setDisable(true) -} - },[]) useEffect(() => { setPropertyID(formData?.additionalDetails?.propertyID); }, [formData?.additionalDetails?.propertyID]); @@ -41,7 +30,7 @@ else if(window.location.href.includes("employee")) } if (userType === "employee") { return ( - + ); } const onSkip = () => onSelect(); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPropertySubtype.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPropertySubtype.js index 05f00aa3cf0..64a9db85ea1 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPropertySubtype.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPropertySubtype.js @@ -60,14 +60,30 @@ const SelectPropertySubtype = ({ config, onSelect, t, userType, formData }) => { // }, [propertyType]) if (userType === "employee") { - return ; + return ( + a.name.localeCompare(b.name))} + optionKey="i18nKey" + id="propertySubType" + selected={subtype} + select={selectedSubType} + t={t} + disable={url.includes("/modify-application/") || url.includes("/new-application") ? false : true} + /> + ); } else { return ( {`${t("CS_FILE_APPLICATION_PROPERTY_SUBTYPE_LABEL")} *`} - + a.name.localeCompare(b.name))} + selectedOption={subtype} + optionKey="i18nKey" + onSelect={selectedValue} + t={t} + /> ); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPropertyType.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPropertyType.js index ec4ccdf4c59..8937d5d7ef3 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPropertyType.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectPropertyType.js @@ -33,23 +33,55 @@ const SelectPropertyType = ({ config, onSelect, t, userType, formData }) => { onSelect(config.key, value.code); } + const getInfoContent = () => { + let content = t("CS_DEFAULT_INFO_TEXT"); + if (formData && formData.selectPaymentPreference && formData.selectPaymentPreference.code === "PRE_PAY") { + content = t("CS_CHECK_INFO_PAY_NOW"); + } else { + content = t("CS_CHECK_INFO_PAY_LATER"); + } + return content; + }; + if (propertyTypesData.isLoading) { return ; } if (userType === "employee") { - return ; + return ( + a.name.localeCompare(b.name))} + optionKey="i18nKey" + id="propertyType" + selected={propertyType} + select={selectedType} + t={t} + disable={url.includes("/modify-application/") || url.includes("/new-application") ? false : true} + /> + ); } else { return ( {`${t("CS_FILE_APPLICATION_PROPERTY_LABEL")} *`} - + a.name.localeCompare(b.name))} + selectedOption={propertyType} + optionKey="i18nKey" + onSelect={selectedValue} + t={t} + /> - {propertyType && } + {propertyType && ( + + )} ); } }; export default SelectPropertyType; + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectRoadDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectRoadDetails.js index e988a5ed161..0df0d9dd83e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectRoadDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectRoadDetails.js @@ -102,6 +102,7 @@ console.log("formData",formData) onSelect={(data) => onSelect(config.key, data)} isDisabled={roadWidth && distance ? false : true} t={t} + onSkip={onSkip} /> ); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectSlumName.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectSlumName.js index c190ecdd968..fca3dbbe30e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectSlumName.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectSlumName.js @@ -66,6 +66,11 @@ const SelectSlumName = ({ config, onSelect, t, userType, formData }) => { } }, [slumDataLoading, formData?.address?.locality?.code]); + useEffect(() => { + if (formData?.address?.propertyLocation?.code === "FROM_GRAM_PANCHAYAT") + onSkip(); + }, [formData?.address?.propertyLocation?.code]); + function selectSlum(value) { setSlum(value); onSelect(config.key, { ...formData[config.key], slum: value.code }); @@ -83,10 +88,12 @@ const SelectSlumName = ({ config, onSelect, t, userType, formData }) => { if (slumDataLoading) return ; return userType === "employee" ? ( + formData?.address?.propertyLocation !== "FROM_GRAM_PANCHAYAT" && ( {t("ES_NEW_APPLICATION_SLUM_NAME")} + ) ) : ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectStreet.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectStreet.js index 75745167896..44c681ddce5 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectStreet.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectStreet.js @@ -78,10 +78,28 @@ const SelectStreet = ({ t, config, onSelect, userType, formData, formState, setE return {}; }; + useEffect(() => { + if(window.location.href.includes("employee/tl/") && formData?.cpt?.details) + { + setValue("doorNo", formData?.cpt?.details?.address?.doorNo); + setValue("street", formData?.cpt?.details?.address?.street); + } + },[formData]) + useEffect(() => { trigger(); }, []); + useEffect(()=>{ + if(formData?.address?.doorNo) setDoorNo(formData?.address?.doorNo) + if(formData?.address?.street) setStreet(formData?.address?.street) + },[formData?.address]) + + useEffect(() => { + if (formData?.address?.doorNo) setDoorNo(formData?.address?.doorNo); + if (formData?.address?.street) setStreet(formData?.address?.street); + }, [formData?.address]); + useEffect(() => { if (formData?.address?.doorNo) setDoorNo(formData?.address?.doorNo); if (formData?.address?.street) setStreet(formData?.address?.street); @@ -199,6 +217,7 @@ const SelectStreet = ({ t, config, onSelect, userType, formData, formState, setE _defaultValues={{ street: formData?.address.street, doorNo: formData?.address.doorNo }} onChange={handleSkip} onSelect={(data) => onSelect(config.key, data)} + onSkip={onSkip} isDisabled={doorNo || street ? false : true} t={t} /> diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectTripData.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectTripData.js index 7016d596a69..f1a7d4755b8 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectTripData.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectTripData.js @@ -54,7 +54,9 @@ const SelectTripData = ({ t, config, onSelect, formData = {}, userType }) => { title: t("ES_APPLICATION_BILL_SLAB_ERROR"), }, default: formData?.tripData?.amountPerTrip, - disable: true, + disable: formData?.address?.propertyLocation?.code === "FROM_GRAM_PANCHAYAT" + ? false + : true, isMandatory: true, }, { @@ -75,6 +77,14 @@ const SelectTripData = ({ t, config, onSelect, formData = {}, userType }) => { onSelect(config.key, { ...formData[config.key], noOfTrips: value }); } + function setAmount(value) { + onSelect(config.key, { + ...formData[config.key], + amountPerTrip: value, + amount: value * formData.tripData.noOfTrips, + }); + } + function selectVehicle(value) { setVehicle({ label: value.capacity }); onSelect(config.key, { ...formData[config.key], vehicleType: value }); @@ -89,7 +99,8 @@ const SelectTripData = ({ t, config, onSelect, formData = {}, userType }) => { setVehicle({ label: formData?.tripData?.vehicleType?.capacity }); } - if (formData?.propertyType && formData?.subtype && formData?.address && formData?.tripData?.vehicleType?.capacity) { + if (formData?.propertyType && formData?.subtype && formData?.address && formData?.tripData?.vehicleType?.capacity && + formData?.address?.propertyLocation?.code === "WITHIN_ULB_LIMITS") { const capacity = formData?.tripData?.vehicleType.capacity; const { slum: slumDetails } = formData.address; const slum = slumDetails ? "YES" : "NO"; @@ -112,10 +123,18 @@ const SelectTripData = ({ t, config, onSelect, formData = {}, userType }) => { amount: "", }); setError(true); - } + } + } else if ( + formData?.address?.propertyLocation?.code === "FROM_GRAM_PANCHAYAT" && + formData.tripData.noOfTrips && + formData.tripData.amountPerTrip + ) { + setValue({ + amount: formData.tripData.amountPerTrip * formData.tripData.noOfTrips, + }); } })(); - }, [formData?.propertyType, formData?.subtype, formData?.address?.slum, formData?.tripData?.vehicleType?.capacity, formData?.tripData?.noOfTrips]); + }, [formData?.propertyType, formData?.subtype, formData?.address?.slum, formData?.tripData?.vehicleType?.capacity, formData?.tripData?.noOfTrips && formData?.address?.propertyLocation?.code]); return isVehicleMenuLoading && isDsoLoading ? ( @@ -130,7 +149,13 @@ const SelectTripData = ({ t, config, onSelect, formData = {}, userType }) => {
setTripNum(e.target.value)} + onChange={(e) => + index === 0 && + formData.address.propertyLocation?.code === + "FROM_GRAM_PANCHAYAT" + ? setAmount(e.target.value) + : setTripNum(e.target.value) + } key={input.name} value={input.default ? input.default : formData && formData[config.key] ? formData[config.key][input.name] : null} {...input.validation} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectTripNo.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectTripNo.js index dbb84a5bdc8..3149b69ad12 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectTripNo.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectTripNo.js @@ -5,12 +5,15 @@ const SelectTripNo = ({ config, formData, t, onSelect, userType }) => { const state = Digit.ULBService.getStateId(); const tenantId = Digit.ULBService.getCurrentTenantId(); const stateId = Digit.ULBService.getStateId(); + const selectedCity = Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code; const { data: tripNumberData, isLoading } = Digit.Hooks.fsm.useMDMS(stateId, "FSM", "TripNumber"); - const { data: dsoData, isLoading: isDsoLoading, isSuccess: isDsoSuccess, error: dsoError } = Digit.Hooks.fsm.useDsoSearch(tenantId, { + const { data: dsoData, isLoading: isDsoLoading, isSuccess: isDsoSuccess, error: dsoError } = Digit.Hooks.fsm.useDsoSearch(selectedCity, { limit: -1, status: "ACTIVE", }); - const { isLoading: isVehicleMenuLoading, data: vehicleData } = Digit.Hooks.fsm.useMDMS(state, "Vehicle", "VehicleType", { staleTime: Infinity }); + const { isLoading: isVehicleMenuLoading, data: vehicleData } = Digit.Hooks.fsm.useMDMS(state, "Vehicle", "VehicleType", { + staleTime: Infinity, + }); const [tripNo, setTripNo] = useState(formData?.tripNo); const [vehicleCapacity, setVehicleCapacity] = useState(formData?.capacity); const [vehicleMenu, setVehicleMenu] = useState([]); @@ -47,14 +50,14 @@ const SelectTripNo = ({ config, formData, t, onSelect, userType }) => { const SelectTrip = (value) => { setTripNo(value); if (userType === "employee") { - null; + return null; } }; const selectVehicle = (value) => { setVehicleCapacity(value); if (userType === "employee") { - null; + return null; } }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectTrips.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectTrips.js index e4fd2ecbee2..23de5a1837d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectTrips.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectTrips.js @@ -82,7 +82,7 @@ const SelectTrips = ({ t, config, onSelect, formData = {}, userType, styles, FSM } //console.log(formdata) function setValue(value, input) { - onSelect(config.key, { ...formData[config.key], [input]: value }); + value && input && onSelect(config.key, { ...formData[config.key], [input]: value }); } useEffect(() => { (async () => { @@ -90,7 +90,21 @@ const SelectTrips = ({ t, config, onSelect, formData = {}, userType, styles, FSM setVehicle({ label: formData?.tripData?.vehicleType?.capacity }); } - if (formData?.propertyType && formData?.subtype && formData?.address && formData?.tripData?.vehicleType?.capacity) { + if ( + formData?.address?.propertyLocation?.code === "FROM_GRAM_PANCHAYAT" && + formData.tripData.noOfTrips && + formData.tripData.amountPerTrip + ) { + setValue({ + amount: formData.tripData.amountPerTrip * formData.tripData.noOfTrips, + }); + } else if ( + formData?.propertyType && + formData?.subtype && + formData?.address && + formData?.tripData?.vehicleType?.capacity && + formData?.address?.propertyLocation?.code === "WITHIN_ULB_LIMITS" + ) { const capacity = formData?.tripData?.vehicleType.capacity; const { slum: slumDetails } = formData.address; const slum = slumDetails ? "YES" : "NO"; @@ -116,7 +130,7 @@ const SelectTrips = ({ t, config, onSelect, formData = {}, userType, styles, FSM } } })(); - }, [formData?.propertyType, formData?.subtype, formData?.address, formData?.tripData?.vehicleType?.capacity, formData?.tripData?.noOfTrips]); + }, [formData?.propertyType, formData?.subtype, formData?.address, formData?.tripData?.vehicleType?.capacity, formData?.tripData?.noOfTrips, formData?.address?.propertyLocation?.code]); return isVehicleMenuLoading && isDsoLoading ? ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectVehicleType.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectVehicleType.js index 210f516b574..3d705f281a6 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectVehicleType.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pageComponents/SelectVehicleType.js @@ -20,7 +20,7 @@ const SelectVehicleType = ({ t, config, onSelect, userType, formData, setValue } setSelectedType(...vehicleType); setSelectedCapacity(formData?.vehicle?.tankCapacity); } - }, [formData?.vehicle, vehicleData]); + }, [vehicleData]); useEffect(() => { if (selectedModal?.code && selectedModal?.code !== formData?.vehicle?.modal) { @@ -37,6 +37,8 @@ const SelectVehicleType = ({ t, config, onSelect, userType, formData, setValue } useEffect(() => { if (vehicleData) { const vehicleModals = vehicleData.filter((vehicle) => vehicle.make === undefined); + const types = vehicleData.filter((vehicle) => formData?.vehicle?.modal != undefined && vehicle?.make === formData?.vehicle?.modal?.code); + setTypes(types); setModals(vehicleModals); } }, [vehicleData]); @@ -66,7 +68,7 @@ const SelectVehicleType = ({ t, config, onSelect, userType, formData, setValue } isMandatory selected={selectedModal} disable={false} - option={modals} + option={modals?.sort((a, b) => a.name.localeCompare(b.name))} select={selectModal} optionKey="name" t={t} @@ -77,7 +79,15 @@ const SelectVehicleType = ({ t, config, onSelect, userType, formData, setValue } {t("ES_FSM_REGISTRY_VEHICLE_TYPE")} {config.isMandatory ? " * " : null} - + a.name.localeCompare(b.name))} + select={selectType} + optionKey="name" + t={t} + /> diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/Response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/Response.js index dca73360a50..e350c7d6a8e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/Response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/Response.js @@ -29,7 +29,7 @@ const DisplayText = (action, isSuccess, isEmployee, t, data) => { }; const BannerPicker = (props) => { - let actionMessage = props?.action ? props.action : "CREATE"; + let actionMessage = props?.action ? props.action : props.data?.fsm?.[0].applicationStatus; let labelMessage = GetLabel(props.data?.fsm?.[0].applicationStatus || props.action, props.isSuccess, props.isEmployee, props.t); if (props.errorInfo && props.errorInfo !== null && props.errorInfo !== "" && typeof props.errorInfo === "string" && props.action !== "SCHEDULE") { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/ApplicationDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/ApplicationDetails.js index 91f60fdb6f1..86a1924641a 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/ApplicationDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/ApplicationDetails.js @@ -101,4 +101,4 @@ const ApplicationDetails = () => { ); }; -export default ApplicationDetails; \ No newline at end of file +export default ApplicationDetails; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/MyApplications/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/MyApplications/index.js index d2201406f77..f640cb4c195 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/MyApplications/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/MyApplications/index.js @@ -1,5 +1,5 @@ import React from "react"; -import { Header, Loader } from "@egovernments/digit-ui-react-components"; +import { Header, Loader, Card } from "@egovernments/digit-ui-react-components"; import MyApplication from "./MyApplication"; import { useTranslation } from "react-i18next"; @@ -27,6 +27,11 @@ export const MyApplications = () => {
))} + {applicationsList.length === 0 && ( + +

{`${t("FSM_NO_APPLICATION")} ${userInfo.mobileNumber}`}

+
+ )}
); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/NewApplication/CheckPage.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/NewApplication/CheckPage.js index 235fee85fe2..4951ad39837 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/NewApplication/CheckPage.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/NewApplication/CheckPage.js @@ -43,7 +43,6 @@ const CheckPage = ({ onSubmit, value }) => { return previous + current + "m x "; } }, ""); - return ( @@ -69,7 +68,7 @@ const CheckPage = ({ onSubmit, value }) => { {selectGender && ( } /> )} @@ -80,19 +79,19 @@ const CheckPage = ({ onSubmit, value }) => { /> } /> } /> } /> {address?.landmark?.trim() && ( @@ -157,4 +156,4 @@ const CheckPage = ({ onSubmit, value }) => { ); }; -export default CheckPage; \ No newline at end of file +export default CheckPage; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/NewApplication/Response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/NewApplication/Response.js index 4c72f53c897..c45af3d50a3 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/NewApplication/Response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/NewApplication/Response.js @@ -14,7 +14,7 @@ const BannerPicker = (props) => { return ( @@ -52,13 +52,27 @@ const Response = ({ data, onSuccess }) => { }, [mutation.data]); useEffect(() => { - console.log("errorInfoerrorInfo",errorInfo) if (!mutationHappened && !errorInfo) { try { const amount = Digit.SessionStorage.get("total_amount"); const amountPerTrip = Digit.SessionStorage.get("amount_per_trip"); const { subtype, propertyID, pitDetail, address, pitType, source, selectGender, selectPaymentPreference, selectTripNo } = data; - const { city, locality, geoLocation, pincode, street, doorNo, landmark, slum } = address; + const { + city, + locality, + geoLocation, + pincode, + street, + doorNo, + landmark, + slum, + gramPanchayat, + village, + propertyLocation, + newLocality, + newGramPanchayat, + newVillage, + } = address; setPaymentPreference(selectPaymentPreference?.code); const advanceAmount = amount === 0 ? null : selectPaymentPreference?.advanceAmount; amount === 0 ? setZeroPay(true) : setZeroPay(false); @@ -68,21 +82,35 @@ const Response = ({ data, onSuccess }) => { citizen: { gender: selectGender?.code, }, - tenantId: city.code, + tenantId: city?.code, additionalDetails: {}, - propertyUsage: subtype.code, + propertyUsage: subtype?.code, address: { - tenantId: city.code, - additionalDetails: null, + tenantId: city?.code, + additionalDetails: { + boundaryType: propertyLocation?.code === "FROM_GRAM_PANCHAYAT" ? "GP" : "Locality", + gramPanchayat: { + code: gramPanchayat?.code, + name: gramPanchayat?.name, + }, + village: village?.code + ? { + code: village?.code ? village?.code : "", + name: village?.name ? village?.name : "", + } + : newVillage, + newLocality: newLocality, + newGramPanchayat: newGramPanchayat, + }, street: street?.trim(), doorNo: doorNo?.trim(), landmark: landmark?.trim(), slumName: slum, - city: city.name, + city: city?.name, pincode, locality: { - code: locality.code, - name: locality.name, + code: propertyLocation?.code === "WITHIN_ULB_LIMITS" ? locality?.code : gramPanchayat?.code, + name: propertyLocation?.code === "WITHIN_ULB_LIMITS" ? locality?.name : gramPanchayat?.name, }, geoLocation: { latitude: geoLocation?.latitude, @@ -104,12 +132,12 @@ const Response = ({ data, onSuccess }) => { vehicleCapacity: selectTripNo ? selectTripNo?.vehicleCapacity?.capacity : "", additionalDetails: { totalAmount: amount, - tripAmount: amountPerTrip, + tripAmount: typeof amountPerTrip === "number" ? JSON.stringify(amountPerTrip) : amountPerTrip, propertyID : propertyID?.propertyID, - distancefromroad : data.roadWidth.distancefromroad, - roadWidth: data.roadWidth.roadWidth, + distancefromroad : data?.roadWidth?.distancefromroad, + roadWidth: data?.roadWidth?.roadWidth, }, - advanceAmount, + advanceAmount: typeof advanceAmount === "number" ? JSON.stringify(advanceAmount) : advanceAmount, }, workflow: null, }; @@ -121,6 +149,7 @@ const Response = ({ data, onSuccess }) => { }, }); sessionStorage.removeItem("Digit.total_amount"); + sessionStorage.removeItem("Digit.fsm.file.address.city"); } catch (err) {} } }, []); @@ -134,14 +163,20 @@ const Response = ({ data, onSuccess }) => { Digit.Utils.pdf.generate(data); }; const isSuccess = !successData ? mutation?.isSuccess : true; -console.log("mutation",mutation,mutationHappened) + return mutation.isLoading || (mutation.isIdle && !mutationHappened) ? ( ) : ( - {t((paymentPreference && paymentPreference == "POST_PAY") || advancePay ? "CS_FILE_PROPERTY_RESPONSE_POST_PAY" : zeroPay ? "CS_FSM_RESPONSE_CREATE_DISPLAY_ZERO_PAY" : "CS_FILE_PROPERTY_RESPONSE")} + {t( + (paymentPreference && paymentPreference == "POST_PAY") || advancePay + ? "CS_FILE_PROPERTY_RESPONSE_POST_PAY" + : zeroPay + ? "CS_FSM_RESPONSE_CREATE_DISPLAY_ZERO_PAY" + : "CS_FILE_PROPERTY_RESPONSE" + )} {isSuccess && ( { configs = [...config] configs.indexRoute = "select-trip-number"; -let newConfig=[ - { - "label": "ES_NEW_APPLICATION_PROPERTY_ID", - "isMandatory": true, - "type": "component", - "route": "property-id", - "key": "propertyID", - "component": "SelectPropertyID", - "texts": { - "headerCaption": "", - "header": "CS_FILE_APPLICATION_PROPERTY_ID_LABEL", - "cardText": "CS_FILE_APPLICATION_PROPERTY_ID_TEXT", - "submitBarLabel": "CS_COMMON_NEXT" - }, - "nextStep": "property-type" - }, - { - "label": "ES_NEW_APPLICATION_PROPERTY_TYPE", - "isMandatory": true, - "type": "component", - "route": "property-type", - "key": "propertyType", - "component": "SelectPropertyType", - "texts": { - "headerCaption": "", - "header": "CS_FILE_APPLICATION_PROPERTY_LABEL", - "cardText": "CS_FILE_APPLICATION_PROPERTY_TEXT", - "submitBarLabel": "CS_COMMON_NEXT" - }, - "nextStep": "property-subtype" - }, - { - "label": "ES_NEW_APPLICATION_PROPERTY_SUB-TYPE", - "isMandatory": true, - "type": "component", - "route": "property-subtype", - "key": "subtype", - "component": "SelectPropertySubtype", - "texts": { - "headerCaption": "", - "header": "CS_FILE_APPLICATION_PROPERTY_SUBTYPE_LABEL", - "cardText": "CS_FILE_APPLICATION_PROPERTY_SUBTYPE_TEXT", - "submitBarLabel": "CS_COMMON_NEXT" - }, - "nextStep": "map" - }, - { - "route": "map", - "component": "FSMSelectGeolocation", - "nextStep": "pincode", - "hideInEmployee": true, - "key": "address" - }, - { - "route": "pincode", - "component": "FSMSelectPincode", - "texts": { - "headerCaption": "", - "header": "CS_FILE_APPLICATION_PINCODE_LABEL", - "cardText": "CS_FILE_APPLICATION_PINCODE_TEXT", - "submitBarLabel": "CS_COMMON_NEXT", - "skipText": "CORE_COMMON_SKIP_CONTINUE" - }, - "withoutLabel": true, - "key": "address", - "nextStep": "address", - "type": "component" - }, - { - "route": "address", - "component": "FSMSelectAddress", - "withoutLabel": true, - "texts": { - "headerCaption": "CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL", - "header": "CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT", - "cardText": "CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT", - "submitBarLabel": "CS_COMMON_NEXT" - }, - "key": "address", - "nextStep": "check-slum", - "isMandatory": true, - "type": "component" - }, - { - "type": "component", - "route": "check-slum", - "isMandatory": true, - "component": "CheckSlum", - "texts": { - "header": "ES_NEW_APPLICATION_SLUM_CHECK", - "submitBarLabel": "CS_COMMON_NEXT" - }, - "key": "address", - "withoutLabel": true, - "nextStep": "slum-details", - "hideInEmployee": true - }, - { - "type": "component", - "route": "slum-details", - "isMandatory": true, - "component": "SelectSlumName", - "texts": { - "header": "CS_NEW_APPLICATION_SLUM_NAME", - "cardText": "CS_NEW_APPLICATION_SLUM_TEXT", - "submitBarLabel": "CS_COMMON_NEXT" - }, - "withoutLabel": true, - "key": "address", - "nextStep": "street" - }, - { - "type": "component", - "route": "street", - "component": "FSMSelectStreet", - "key": "address", - "withoutLabel": true, - "texts": { - "headerCaption": "CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL", - "header": "CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT", - "cardText": "CS_FILE_APPLICATION_PROPERTY_LOCATION_STREET_DOOR_NO_LABEL", - "submitBarLabel": "CS_COMMON_NEXT" - }, - "nextStep": "landmark" - }, - { - "type": "component", - "route": "landmark", - "component": "FSMSelectLandmark", - "withoutLabel": true, - "texts": { - "headerCaption": "CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL", - "header": "CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TITLE", - "cardText": "CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TEXT", - "submitBarLabel": "CS_COMMON_NEXT", - "skipText": "CORE_COMMON_SKIP_CONTINUE" - }, - "key": "address", - "nextStep": "pit-type" - }, - { - "label": "ES_NEW_APPLICATION_ROAD_WIDTH", - "isMandatory": true, - "type": "component", - "route": "road-details", - "key": "roadWidth", - "hideInEmployee": true, - "component": "SelectRoadDetails", - "texts": { - "header": "CS_FILE_PROPERTY_ROAD_WIDTH", - "cardText": "CS_FILE_PROPERTY_ROAD_WIDTH_TEXT", - "submitBarLabel": "CS_COMMON_NEXT" - - }, - "nextStep": "tank-size" - }, - { - "label": "ES_NEW_APPLICATION_PIT_TYPE", - "isMandatory": true, - "type": "component", - "route": "pit-type", - "key": "pitType", - "component": "SelectPitType", - "texts": { - "header": "CS_FILE_PROPERTY_PIT_TYPE", - "cardText": "CS_FILE_PROPERTY_PIT_TYPE_TEXT", - "submitBarLabel": "CS_COMMON_NEXT" - }, - "nextStep": "road-details" - }, - { - "route": "tank-size", - "component": "SelectTankSize", - "isMandatory": false, - "texts": { - "headerCaption": "", - "header": "CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TITLE", - "cardText": "CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TEXT", - "submitBarLabel": "CS_COMMON_NEXT", - "skipText": "CORE_COMMON_SKIP_CONTINUE" - }, - "type": "component", - "key": "pitDetail", - "nextStep": "select-payment-preference", - "label": "ES_NEW_APPLICATION_PIT_DIMENSION" - }, - { - "type": "component", - "key": "tripData", - "withoutLabel": true, - "component": "SelectTrips" - }, - { - "label": "a", - "isMandatory": true, - "type": "component", - "route": "select-trip-number", - "key": "selectTripNo", - "component": "SelectTripNo", - "hideInEmployee": true, - "texts": { - "headerCaption": "", - "header": "ES_FSM_SERVICE_REQUEST", - "cardText": "ES_FSM_SERVICE_REQUEST_TEXT", - "skipText": "CORE_COMMON_SKIP_CONTINUE", - "submitBarLabel": "CS_COMMON_NEXT", - "skipLabel": "CS_COMMON_SERVICE_SKIP_INFO" - }, - "nextStep": "property-id" - }, - { - "label": "a", - "isMandatory": false, - "type": "component", - "route": "select-gender", - "hideInEmployee": true, - "key": "selectGender", - "component": "SelectGender", - "texts": { - "headerCaption": "", - "header": "CS_COMMON_CHOOSE_GENDER", - "cardText": "CS_COMMON_SELECT_GENDER", - "submitBarLabel": "CS_COMMON_NEXT", - "skipText": "CORE_COMMON_SKIP_CONTINUE" - }, - "nextStep": "select-payment-preference" - }, - { - "label": "a", - "isMandatory": false, - "type": "component", - "route": "select-payment-preference", - "key": "selectPaymentPreference", - "hideInEmployee": true, - "component": "SelectPaymentPreference", - "texts": { - "headerCaption": "", - "header": "ES_FSM_PAYMENT_PREFERENCE_LABEL", - "cardText": "ES_FSM_PAYMENT_PREFERENCE_TEXT", - "submitBarLabel": "CS_COMMON_NEXT", - "skipText": "CORE_COMMON_SKIP_CONTINUE" - }, - "nextStep": null - }, - { - "type": "component", - "key": "tripData", - "withoutLabel": true, - "component": "SelectTripData" - }, - { - "type": "component", - "key": "advancepaymentPreference", - "withoutLabel": true, - "component": "AdvanceCollection" - } -] + return ( - {newConfig.map((routeObj, index) => { + {configs.map((routeObj, index) => { const { component, texts, inputs, key } = routeObj; const Component = typeof component === "string" ? Digit.ComponentRegistryService.getComponent(component) : component; return ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/Rating/SelectRating.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/Rating/SelectRating.js index a7b317f238c..ff3b856f0e8 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/Rating/SelectRating.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/Rating/SelectRating.js @@ -140,12 +140,6 @@ const SelectRating = ({ parentRoute }) => { name: "comments", className: "Hello", }, - { - type: "text", - label: t("CS_NO_TRIPS"), - name: "noOfTrips", - className: "Hello", - }, ], }; return ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/index.js index 179fa3174d0..0f60d94c0a9 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/citizen/index.js @@ -19,7 +19,11 @@ const CitizenApp = ({ path }) => { return (
- {location.pathname.includes("/response") || location.pathname.split("/").includes("check") ? null : {t("CS_COMMON_BACK")}} + {location.pathname.includes("/response") || location.pathname.split("/").includes("check") ? null : location.pathname.includes("/street") ? ( + -4}>{t("CS_COMMON_BACK")} + ) : ( + {t("CS_COMMON_BACK")} + )} { const uuids = auditResponse?.fsmAudit?.map((e) => e.who); const userList = Digit.Hooks.useUserSearch( - // tenantId.includes(".") ? tenantId.split(".")[0] : tenantId, null, { uuid: uuids }, {}, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/Modal/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/Modal/index.js index 90977c59f0f..f182881a6f4 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/Modal/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/Modal/index.js @@ -63,8 +63,6 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, const client = useQueryClient(); const stateCode = Digit.ULBService.getStateId(); - const { data: ReceivedPaymentTypeData, isLoading: receivedPaymentLoad } = Digit.Hooks.fsm.useMDMS(stateCode, "FSM", "ReceivedPaymentType"); - const { data: vehicleList, isLoading: isVehicleData, isSuccess: isVehicleDataLoaded } = Digit.Hooks.fsm.useMDMS( stateCode, "Vehicle", @@ -131,25 +129,16 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, const [pitDetail, setPitDetail] = useState(); const [fstpoRejectionReason, setFstpoRejectionReason] = useState(); const [noOfTrips, setNoOfTrips] = useState(null); - const [receivedPaymentType, setReceivedPaymentType] = useState(null); + const [defaultValues, setDefautValue] = useState({ capacity: vehicle?.capacity, wasteCollected: vehicle?.capacity, - propertyID : applicationData?.additionalDetails?.propertyID, - distancefromroad: applicationData?.additionalDetails?.distancefromroad, - roadWidth: applicationData?.additionalDetails?.roadWidth, propertyType: applicationData?.propertyUsage.split('.')[0], subtype: applicationData?.propertyUsage, pitType: applicationData?.sanitationtype, pitDetail: applicationData?.pitDetail, }); - useEffect(() => { - if (!receivedPaymentLoad) { - setReceivedPaymentType(ReceivedPaymentTypeData) - } - }, [receivedPaymentLoad, ReceivedPaymentTypeData]); - useEffect(() => { if (isSuccess && isVehicleDataLoaded && applicationData) { const [vehicle] = vehicleList.filter((item) => item.code === applicationData.vehicleType); @@ -207,7 +196,8 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, useEffect(() => { if (isSuccess && isDsoSuccess && applicationData && applicationData.dsoId) { const [dso] = dsoData.filter((dso) => dso.id === applicationData.dsoId); - const vehicleNoList = dso?.vehicles?.filter((vehicle) => vehicle.capacity == applicationData?.vehicleCapacity); + const tempList = dso?.vehicles?.filter((vehicle) => vehicle.capacity == applicationData?.vehicleCapacity); + const vehicleNoList = tempList.sort((a,b) => (a.registrationNumber > b.registrationNumber ? 1 : -1 )); setVehicleNoList(vehicleNoList); } }, [isSuccess, isDsoSuccess]); @@ -287,7 +277,6 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, if (data.subtype && typeof (data.subtype) === "object") applicationData.propertyUsage = data.subtype.code; if (data.subtype && typeof (data.subtype) === "string") applicationData.propertyUsage = data.subtype; if (data.noOfTrips) applicationData.noOfTrips = data.noOfTrips; - if (data.paymentMode) applicationData.additionalDetails.receivedPayment = data.paymentMode.code; if (fileStoreId) { if (applicationData.pitDetail.additionalDetails && applicationData.pitDetail.additionalDetails.fileStoreId) { @@ -305,13 +294,14 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, if (cancelReason) addCommentToWorkflow(cancelReason, workflow, data); if (fstpoRejectionReason && data.comments) workflow.comments = data.comments; if (fstpoRejectionReason) workflow.fstpoRejectionReason = fstpoRejectionReason?.code; - if (data.distancefromroad) applicationData.additionalDetails.distancefromroad = data?.distancefromroad; - if (data.roadWidth) applicationData.additionalDetails.roadWidth = data?.roadWidth; + submitAction({ fsm: applicationData, workflow }); } useEffect(() => { switch (action) { case "UPDATE": + case "SCHEDULE": + case "ES_FSM_SCHEDULE": setFormValve(true); return setConfig( configUpdateTrips({ @@ -384,7 +374,7 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, case "COMPLETE": case "COMPLETED": setFormValve(true); - return setConfig(configCompleteApplication({ t, vehicle, vehicleCapacity: applicationData?.vehicleCapacity, noOfTrips: applicationData?.noOfTrips, applicationCreatedTime: applicationData?.auditDetails?.createdTime, receivedPaymentType: ReceivedPaymentTypeData, action, module })); + return setConfig(configCompleteApplication({ t, vehicle, vehicleCapacity: applicationData?.vehicleCapacity, noOfTrips: applicationData?.noOfTrips, applicationCreatedTime: applicationData?.auditDetails?.createdTime, action, module })); case "SUBMIT": case "FSM_SUBMIT": return history.push("/digit-ui/employee/fsm/modify-application/" + applicationNumber); @@ -427,22 +417,22 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, action, }) ); - case "SCHEDULE": - case "ES_FSM_SCHEDULE": - setFormValve(true); - return setConfig( - configScheduleDso({ - t, - rejectMenu: Reason?.DeclineReason, - setReason: setDeclineReason, - reason: declineReason, - applicationCreatedTime: applicationData?.auditDetails?.createdTime, - vehicle, - vehicleCapacity: applicationData?.vehicleCapacity, - action, - noOfTrips: applicationData?.noOfTrips - }) - ); + // case "SCHEDULE": + // case "ES_FSM_SCHEDULE": + // setFormValve(true); + // return setConfig( + // configScheduleDso({ + // t, + // rejectMenu: Reason?.DeclineReason, + // setReason: setDeclineReason, + // reason: declineReason, + // applicationCreatedTime: applicationData?.auditDetails?.createdTime, + // vehicle, + // vehicleCapacity: applicationData?.vehicleCapacity, + // action, + // noOfTrips: applicationData?.noOfTrips + // }) + // ); case "PAY": case "ADDITIONAL_PAY_REQUEST": diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/AssignDso.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/AssignDso.js index aecbdc14e61..89fd250e111 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/AssignDso.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/AssignDso.js @@ -104,7 +104,10 @@ export const configAssignDso = ({ t, dsoData, dso, selectDSO, vehicleMenu, vehic validation: { required: true, }, - customProps: { min: Digit.Utils.date.getDate() }, + customProps: { + min: Digit.Utils.date.getDate(), + max: Digit.Utils.date.getDate(Date.now() + 10 * 24 * 60 * 60 * 1000), + }, defaultValue: Digit.Utils.date.getDate(), component: (props, customProps) => , }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/CompleteApplication.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/CompleteApplication.js index 7be1c215f01..01244431bca 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/CompleteApplication.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/CompleteApplication.js @@ -3,10 +3,9 @@ import { DatePicker } from "@egovernments/digit-ui-react-components"; import { RadioButtons } from "@egovernments/digit-ui-react-components"; -export const configCompleteApplication = ({ t, vehicle, vehicleCapacity, noOfTrips, applicationCreatedTime = 0, receivedPaymentType, action, module }) => ({ +export const configCompleteApplication = ({ t, vehicle, vehicleCapacity, noOfTrips, applicationCreatedTime = 0, action, module }) => ({ label: { - heading: `ES_FSM_ACTION_TITLE_${action}`, submit: `CS_COMMON_${action}`, cancel: "CS_COMMON_CLOSE", }, @@ -71,30 +70,6 @@ export const configCompleteApplication = ({ t, vehicle, vehicleCapacity, noOfTri }, nextStep: "property-type", }, - { - label: t("ES_FSM_ACTION_ROAD_WIDTH"), - type: "number", - isMandatory: true, - populators: { - name: "roadWidth", - validation: { - required: true, - }, - }, - disable: false, - }, - { - label: t("ES_FSM_ACTION_DISTANCE_FROM_ROAD"), - type: "number", - isMandatory: true, - populators: { - name: "distancefromroad", - validation: { - required: true, - }, - }, - disable: false, - }, { label: "ES_NEW_APPLICATION_PROPERTY_TYPE", isMandatory: true, @@ -172,7 +147,7 @@ export const configCompleteApplication = ({ t, vehicle, vehicleCapacity, noOfTri disable: true, // disable: customizationConfig ? !customizationConfig?.noOfTrips?.override : true, }, - module !== "FSM_ZERO_PAY_SERVICE" && { + /*module !== "FSM_ZERO_PAY_SERVICE" && { label: "FSM_PAYMENT_RECEIVED", isMandatory: true, type: "custom", @@ -199,7 +174,7 @@ export const configCompleteApplication = ({ t, vehicle, vehicleCapacity, noOfTri /> ), }, - }, + }, */ ], }, ], diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/RejectApplication.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/RejectApplication.js index d6a41117ed8..c706cdc0992 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/RejectApplication.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/RejectApplication.js @@ -14,7 +14,16 @@ export const configRejectApplication = ({ t, rejectMenu, setReason, reason, acti { label: t(`ES_FSM_ACTION_${action.toUpperCase()}_REASON`), type: "dropdown", - populators: , + populators: ( + a.name.localeCompare(b.name))} + id="reason" + optionKey="i18nKey" + selected={reason} + select={setReason} + /> + ), isMandatory: true, }, { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/RejectFstpo.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/RejectFstpo.js index 75d099111f3..86a641c5b2e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/RejectFstpo.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/config/RejectFstpo.js @@ -17,7 +17,7 @@ export const configRejectFstpo = ({ t, rejectMenu, selectReason, reason, action type: "dropdown", populators: ( a.name.localeCompare(b.name))} autoComplete="off" optionKey="i18nKey" id="Reason" diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/index.js index af4a1aa6632..9cf9adfeaf4 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/index.js @@ -20,6 +20,7 @@ import { ActionLinks, Header, ImageViewer, + MultiLink, } from "@egovernments/digit-ui-react-components"; import ActionModal from "./Modal"; @@ -29,7 +30,8 @@ import { useQueryClient } from "react-query"; import { Link, useHistory, useParams } from "react-router-dom"; import { ViewImages } from "../../../components/ViewImages"; -import _ from "lodash"; +import getPDFData from "../../../getPDFData"; + const ApplicationDetails = (props) => { const tenantId = Digit.ULBService.getCurrentTenantId(); const state = Digit.ULBService.getStateId(); @@ -44,6 +46,12 @@ const ApplicationDetails = (props) => { const [showToast, setShowToast] = useState(null); const [imageZoom, setImageZoom] = useState(null); const DSO = Digit.UserService.hasAccess(["FSM_DSO"]) || false; + const [showOptions, setShowOptions] = useState(false); + const { data: storeData } = Digit.Hooks.useStore.getInitData(); + + const { tenants } = storeData || {}; + + const { data: paymentsHistory } = Digit.Hooks.fsm.usePaymentHistory(tenantId, applicationNumber); const { isLoading, isError, data: applicationDetails, error } = Digit.Hooks.fsm.useApplicationDetail( t, @@ -75,10 +83,9 @@ const ApplicationDetails = (props) => { : applicationData?.advanceAmount === 0 ? "PAY_LATER_SERVICE" : applicationData?.advanceAmount > 0 - ? "FSM_ADVANCE_PAY_SERVICE_V1" + ? "FSM_ADVANCE_PAY_SERVICE" : applicationData?.paymentPreference === null && applicationData?.additionalDetails?.tripAmount === 0 && - applicationData?.additionalDetails?.propertyID===0 && applicationData?.advanceAmount === null ? "FSM_ZERO_PAY_SERVICE" : "FSM", @@ -100,7 +107,7 @@ const ApplicationDetails = (props) => { useEffect(() => { switch (selectedAction) { - case DSO && "SCHEDULE": + case "SCHEDULE": case "DSO_ACCEPT": case "ACCEPT": case "ASSIGN": @@ -119,7 +126,7 @@ const ApplicationDetails = (props) => { return setShowModal(true); case "SUBMIT": case "FSM_SUBMIT": - case !DSO && "SCHEDULE": + // case !DSO && "SCHEDULE": return history.push("/digit-ui/employee/fsm/modify-application/" + applicationNumber); case "PAY": case "FSM_PAY": @@ -196,15 +203,7 @@ const ApplicationDetails = (props) => { date: `${t("CS_FSM_EXPECTED_DATE")} ${Digit.DateUtils.ConvertTimestampToDate(applicationData?.possibleServiceDate)}`, }; return ; - } - else if (checkpoint.status === "PENDING_PAYYY") { - const caption = { - name: checkpoint?.assigner, - mobileNumber: checkpoint?.assigner?.mobileNumber, - date: `${t("CS_FSM_EXPECTED_DATE")} ${Digit.DateUtils.ConvertTimestampToDate(applicationData?.possibleServiceDate)}`, - }; - return ; - }else if (checkpoint.status === "COMPLETED") { + } else if (checkpoint.status === "COMPLETED") { return (
@@ -227,42 +226,84 @@ const ApplicationDetails = (props) => { if (checkpoint?.numberOfTrips) caption.comment = `${t("NUMBER_OF_TRIPS")}: ${checkpoint?.numberOfTrips}`; return ; } - else if(checkpoint.status === "ASSING_DSO_PAY") - { - const caption = { - name: checkpoint?.assigner, - mobileNumber: checkpoint?.assigner?.mobileNumber, - date: `${t("CS_FSM_EXPECTED_DATE")} ${Digit.DateUtils.ConvertTimestampToDate(applicationData?.possibleServiceDate)}`, - }; - return ; - } }; + const handleDownloadPdf = async () => { + const tenantInfo = tenants.find((tenant) => tenant.code === applicationDetails?.tenantId); + const data = getPDFData({ ...applicationDetails?.applicationDetailsResponse }, tenantInfo, t); + Digit.Utils.pdf.generate(data); + setShowOptions(false); + }; + + const downloadPaymentReceipt = async () => { + const receiptFile = { + filestoreIds: [paymentsHistory.Payments[0]?.fileStoreId], + }; + + if (!receiptFile?.fileStoreIds?.[0]) { + const newResponse = await Digit.PaymentService.generatePdf(state, { Payments: [paymentsHistory.Payments[0]] }, "fsm-receipt"); + const fileStore = await Digit.PaymentService.printReciept(state, { + fileStoreIds: newResponse.filestoreIds[0], + }); + window.open(fileStore[newResponse.filestoreIds[0]], "_blank"); + setShowOptions(false); + } else { + const fileStore = await Digit.PaymentService.printReciept(state, { + fileStoreIds: receiptFile.filestoreIds[0], + }); + window.open(fileStore[receiptFile.filestoreIds[0]], "_blank"); + setShowOptions(false); + } + }; + const [isDisplayDownloadMenu, setIsDisplayDownloadMenu] = useState(false); + + let dowloadOptions = + paymentsHistory?.Payments?.length > 0 + ? [ + { + label: t("CS_COMMON_APPLICATION_ACKNOWLEDGEMENT"), + onClick: handleDownloadPdf, + }, + { + label: t("CS_DOWNLOAD_RECEIPT"), + onClick: downloadPaymentReceipt, + }, + ] + : [ + { + label: t("CS_COMMON_APPLICATION_ACKNOWLEDGEMENT"), + onClick: handleDownloadPdf, + }, + ]; + if (isLoading) { return ; } -let deepCopy = _.cloneDeep( workflowDetails ) -let index1 =0 -deepCopy?.data?.timeline.map((check,index) => { - if (check.status == "ASSING_DSO" && index1 ==0) - { - let obj= check - obj.status = "PENDING_PAYYY" - index1 +=1 - workflowDetails.data.timeline[index].status ="ASSING_DSO_PAY" - workflowDetails.data.timeline.splice(index, 0, obj); - } -}) return ( {!isLoading ? ( -
{t("ES_TITLE_APPLICATION_DETAILS")}
+
+
{t("ES_TITLE_APPLICATION_DETAILS")}
+ setIsDisplayDownloadMenu(!isDisplayDownloadMenu)} + style={{ marginTop: "10px" }} + downloadBtnClassName={"employee-download-btn-className"} + optionsClassName={"employee-options-btn-className"} + options={dowloadOptions} + displayOptions={isDisplayDownloadMenu} + + // displayOptions={showOptions} + // options={dowloadOptions} + /> +
+ {/* {!DSO && ( {t("ES_APPLICATION_DETAILS_VIEW_AUDIT_TRAIL")}} + label={{t("ES_APPLICATION_DETAILS_VIEW_AUDIT_TRAIL")}} style={{ position: "absolute", top: 0, right: 20 }} onClick={() => { history.push(props.parentRoute + "/application-audit/" + applicationNumber); @@ -369,7 +410,7 @@ deepCopy?.data?.timeline.map((check,index) => { onClose={closeToast} /> )} - {!workflowDetails?.isLoading && workflowDetails?.data?.nextActions?.length === 1 && ( + {!workflowDetails?.isLoading && workflowDetails?.data?.nextActions?.length === 1 && workflowDetails?.data?.nextActions?.[0]?.action !== "RATE" && ( { ); }; -export default ApplicationDetails; \ No newline at end of file +export default ApplicationDetails; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/EditApplication/EditForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/EditApplication/EditForm.js index 67ead7e8999..c79adecc714 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/EditApplication/EditForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/EditApplication/EditForm.js @@ -1,6 +1,6 @@ -import React, { useState, useEffect, Fragment } from "react"; +import React, { useState, useEffect } from "react"; import { useHistory } from "react-router-dom"; -import { FormComposer, Header, Loader } from "@egovernments/digit-ui-react-components"; +import { FormComposer, Loader } from "@egovernments/digit-ui-react-components"; import { useTranslation } from "react-i18next"; const isConventionalSpecticTank = (tankDimension) => tankDimension === "lbd"; @@ -22,8 +22,7 @@ const EditForm = ({ tenantId, applicationData, channelMenu, vehicleMenu, sanitat clearSuccessData(); clearError(); }, []); - - const defaultValues = { + var defaultValues = { channel: channelMenu.filter((channel) => channel.code === applicationData.source)[0], applicationData: { applicantName: applicationData.citizen.name, @@ -32,21 +31,21 @@ const EditForm = ({ tenantId, applicationData, channelMenu, vehicleMenu, sanitat }, tripData: { noOfTrips: applicationData.noOfTrips, - amountPerTrip: applicationData.additionalDetails.tripAmount, - amount: applicationData.noOfTrips * applicationData.additionalDetails.tripAmount || undefined, + amountPerTrip: applicationData.additionalDetails.tripAmount !== "null" ? applicationData.additionalDetails.tripAmount : "", + amount: + applicationData.additionalDetails.tripAmount !== "null" + ? applicationData.noOfTrips * applicationData.additionalDetails.tripAmount + : undefined, vehicleType: { capacity: applicationData?.vehicleCapacity }, vehicleCapacity: applicationData?.vehicleCapacity, - distancefromroad:applicationData.additionalDetails.distancefromroad, - roadWidth:applicationData.additionalDetails.roadWidth, }, propertyType: applicationData.propertyUsage.split(".")[0], subtype: applicationData.propertyUsage, - propertyID : applicationData.additionalDetails.propertyID, address: { pincode: applicationData.address.pincode, locality: { ...applicationData.address.locality, - i18nkey: `${applicationData.tenantId.toUpperCase().split(".").join("_")}_REVENUE_${applicationData.address.locality.code}`, + i18nkey: `${applicationData.tenantId.toUpperCase().split(".").join("_")}_REVENUE_${applicationData?.address?.locality?.code}`, }, slum: applicationData.address.slumName, street: applicationData.address.street, @@ -56,20 +55,57 @@ const EditForm = ({ tenantId, applicationData, channelMenu, vehicleMenu, sanitat pitType: sanitationMenu.filter((type) => type.code === applicationData.sanitationtype)[0], pitDetail: applicationData.pitDetail, paymentPreference: applicationData.paymentPreference, - advancepaymentPreference: { advanceAmount: applicationData?.advanceAmount }, + advanceAmount: applicationData.advanceAmount, }; - console.log("applicationData",defaultValues) + + if ( + (applicationData && applicationData?.address?.additionalDetails?.boundaryType === "Village") || + applicationData?.address?.additionalDetails?.boundaryType === "GP" + ) { + defaultValues.address = { + ...defaultValues.address, + propertyLocation: { + active: true, + code: "FROM_GRAM_PANCHAYAT", + i18nKey: "FROM_GRAM_PANCHAYAT", + name: "From Gram Panchayat", + }, + additionalDetails: { + boundaryType: applicationData?.address?.additionalDetails?.boundaryType, + gramPanchayat: applicationData?.address?.additionalDetails?.gramPanchayat, + village: applicationData?.address?.additionalDetails?.village, + newGp: applicationData?.address?.additionalDetails?.newGramPanchayat, + }, + }; + } else if (applicationData && applicationData?.address?.additionalDetails?.boundaryType === "Locality") { + defaultValues.address = { + ...defaultValues.address, + propertyLocation: { + active: true, + code: "WITHIN_ULB_LIMITS", + i18nKey: "WITHIN_ULB_LIMITS", + name: "Witnin ULB Limits", + }, + additionalDetails: { + boundaryType: applicationData?.address?.additionalDetails?.boundaryType, + newLocality: applicationData?.address?.additionalDetails?.newLocality, + }, + }; + } + const onFormValueChange = (setValue, formData) => { if ( formData?.propertyType && formData?.subtype && - formData?.address?.locality?.code && + (formData?.address?.locality?.code || + (formData?.address?.propertyLocation?.code === "FROM_GRAM_PANCHAYAT" && + (formData?.address?.gramPanchayat?.code || formData?.address?.additionalDetails?.gramPanchayat?.code))) && formData?.tripData?.vehicleType && (formData?.tripData?.amountPerTrip || formData?.tripData?.amountPerTrip === 0) ) { setSubmitValve(true); const pitDetailValues = formData?.pitDetail ? Object.values(formData?.pitDetail).filter((value) => value > 0) : null; - let min = Digit.SessionStorage.get("advance_amount"); + // let min = Digit.SessionStorage.get("advance_amount"); if (formData?.pitType) { if (pitDetailValues === null || pitDetailValues?.length === 0) { setSubmitValve(true); @@ -79,12 +115,12 @@ const EditForm = ({ tenantId, applicationData, channelMenu, vehicleMenu, sanitat setSubmitValve(true); } else setSubmitValve(false); } - if (formData?.tripData?.amountPerTrip !== 0 && (formData?.advancepaymentPreference?.advanceAmount > formData?.tripData?.amount || formData?.advancepaymentPreference?.advanceAmount < min)) { + /*if (formData?.tripData?.amountPerTrip !== 0 && (formData?.advancepaymentPreference?.advanceAmount > formData?.tripData?.amount || formData?.advancepaymentPreference?.advanceAmount < min)) { setSubmitValve(false); } if (applicationData?.advanceAmount > 0 && formData?.advancepaymentPreference?.advanceAmount <= 0) { setSubmitValve(false); - } + } */ } else { setSubmitValve(false); } @@ -115,18 +151,32 @@ const EditForm = ({ tenantId, applicationData, channelMenu, vehicleMenu, sanitat const localityCode = data?.address?.locality?.code; const localityName = data?.address?.locality?.name; const propertyUsage = data?.subtype; - const advanceAmount = amount === 0 ? null : data?.advancepaymentPreference?.advanceAmount; + // const advanceAmount = amount === 0 ? null : data?.advancepaymentPreference?.advanceAmount; const { height, length, width, diameter } = pitDimension; + const advanceAmount = + amount === 0 + ? null + : data?.advancepaymentPreference?.advanceAmount + ? data?.advancepaymentPreference?.advanceAmount + : applicationData.advanceAmount; + const totalAmount = amount * noOfTrips; + const gramPanchayat = data?.address?.gramPanchayat || data?.address?.additionalDetails?.gramPanchayat; + const village = data?.address?.village || data?.address?.additionalDetails?.village; + const propertyLocation = data?.address?.propertyLocation?.code; + const newGp = data?.address?.newGp || data?.address?.additionalDetails?.newGramPanchayat; + const newVillage = data?.address?.newVillage || data?.address?.additionalDetails?.village; + const newLocality = data?.address?.newLocality || data?.address?.additionalDetails?.newLocality; + + const formData = { ...applicationData, sanitationtype: sanitationtype, source: applicationChannel.code, additionalDetails: { ...applicationData.additionalDetails, - tripAmount: amount, - distancefromroad:data.tripData.distancefromroad, - roadWidth:data.tripData.roadWidth, + tripAmount: typeof amount === "number" ? JSON.stringify(amount) : amount, + totalAmount: typeof totalAmount === "number" ? JSON.stringify(totalAmount) : totalAmount, }, propertyUsage, vehicleType: data.tripData.vehicleType.type, @@ -150,16 +200,31 @@ const EditForm = ({ tenantId, applicationData, channelMenu, vehicleMenu, sanitat slumName: slum, locality: { ...applicationData.address.locality, - code: localityCode, - name: localityName, + code: propertyLocation === "FROM_GRAM_PANCHAYAT" ? gramPanchayat?.code : localityCode, + name: propertyLocation === "FROM_GRAM_PANCHAYAT" ? gramPanchayat?.name : localityName, }, geoLocation: { ...applicationData.address.geoLocation, latitude: data?.address?.latitude ? data?.address?.latitude : applicationData.address.geoLocation.latitude, longitude: data?.address?.longitude ? data?.address?.longitude : applicationData.address.geoLocation.longitude, }, + additionalDetails: { + boundaryType: propertyLocation === "FROM_GRAM_PANCHAYAT" ? (village?.code ? "Village" : "GP") : "Locality", + gramPanchayat: { + code: gramPanchayat?.code, + name: gramPanchayat?.name, + }, + village: village?.code + ? { + code: village?.code ? village?.code : "", + code: village?.code ? village?.code : "", + } + : newVillage, + newGramPanchayat: newGp, + newLocality: newLocality, + }, }, - advanceAmount, + advanceAmount: typeof advanceAmount === "number" ? JSON.stringify(advanceAmount) : advanceAmount, }; delete formData["responseInfo"]; @@ -181,11 +246,12 @@ const EditForm = ({ tenantId, applicationData, channelMenu, vehicleMenu, sanitat } const configs = [...preFields, ...commonFields]; + return ( - <> -
-
{t("ES_TITLE_MODIFY_DESULDGING_APPLICATION")}
-
+ // <> + //
+ //
{t("ES_TITLE_MODIFY_DESULDGING_APPLICATION")}
+ //
- + // ); }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/AddDriver.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/AddDriver.js index cbbe57d1ac7..0d171e35f60 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/AddDriver.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/AddDriver.js @@ -41,7 +41,7 @@ const AddDriver = ({ parentUrl, heading }) => { }; const onFormValueChange = (setValue, formData) => { - if (formData?.driverName && formData?.phone && formData?.selectGender) { + if (formData?.driverName && formData?.selectGender) { setSubmitValve(true); } else { setSubmitValve(false); @@ -57,7 +57,7 @@ const AddDriver = ({ parentUrl, heading }) => { const license = data?.license; const gender = data?.selectGender?.code; const emailId = data?.emailId; - const phone = data?.phone; + // const phone = data?.phone; const dob = new Date(`${data.dob}`).getTime() || new Date(`1/1/1970`).getTime(); const additionalDetails = data?.additionalDetails; const formData = { @@ -75,7 +75,7 @@ const AddDriver = ({ parentUrl, heading }) => { gender: gender, dob: dob, emailId: emailId || "abc@egov.com", - mobileNumber: phone, + // mobileNumber: phone, }, vendorDriverStatus: "INACTIVE", }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/DriverDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/DriverDetails.js index 0252dcef5d9..8082ec9d382 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/DriverDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/DriverDetails.js @@ -111,6 +111,8 @@ const DriverDetails = (props) => { return setShowModal(true); case "EDIT": return history.push("/digit-ui/employee/fsm/registry/modify-driver/" + dsoId); + case "HOME": + return history.push("/digit-ui/employee/fsm/registry?selectedTabs=DRIVER"); default: break; } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/EditDriver.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/EditDriver.js index 5a2cfd2bf11..6b74298355b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/EditDriver.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/EditDriver.js @@ -45,7 +45,7 @@ const EditDriver = ({ parentUrl, heading }) => { selectGender: driverDetails?.driverData?.owner?.gender, dob: driverDetails?.driverData?.owner?.dob && Digit.DateUtils.ConvertTimestampToDate(driverDetails?.driverData?.owner?.dob, "yyyy-MM-dd"), emailId: driverDetails?.driverData?.owner?.emailId === "abc@egov.com" ? "" : driverDetails?.driverData?.owner?.emailId, - phone: driverDetails?.driverData?.owner?.mobileNumber, + // phone: driverDetails?.driverData?.owner?.mobileNumber, additionalDetails: driverDetails?.driverData?.additionalDetails?.description, }; setDefaultValues(values); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/AddVehicle.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/AddVehicle.js index 1cc541fc6b2..52725caf268 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/AddVehicle.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/AddVehicle.js @@ -1,6 +1,6 @@ import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import { FormComposer, Toast, Header } from "@egovernments/digit-ui-react-components"; +import { FormComposer, Toast, Header, InfoIcon } from "@egovernments/digit-ui-react-components"; import { useHistory } from "react-router-dom"; import VehicleConfig from "../../configs/VehicleConfig"; import { useQueryClient } from "react-query"; @@ -30,6 +30,19 @@ const AddVehicle = ({ parentUrl, heading }) => { const Config = VehicleConfig(t); + Config[0].body.forEach((item) => { + if (item.label === "ES_FSM_REGISTRY_VEHICLE_NUMBER") { + item.labelChildren = ( +
+ + + {t(item.populators.validation.title)} + +
+ ); + } + }); + const [canSubmit, setSubmitValve] = useState(false); const defaultValues = { @@ -41,7 +54,14 @@ const AddVehicle = ({ parentUrl, heading }) => { }; const onFormValueChange = (setValue, formData) => { - if (formData?.registrationNumber && formData?.ownerName && formData?.phone && formData?.vehicle?.modal && formData?.vehicle?.type) { + if ( + formData?.registrationNumber && + formData?.ownerName && + formData?.phone && + formData?.vehicle?.modal && + formData?.vehicle?.type && + formData?.selectGender + ) { setSubmitValve(true); } else { setSubmitValve(false); @@ -64,6 +84,10 @@ const AddVehicle = ({ parentUrl, heading }) => { const ownerName = data?.ownerName; const phone = data?.phone; const additionalDetails = data?.additionalDetails; + const gender = data?.selectGender?.code; + const emailId = data?.emailId; + const dob = new Date(`${data.dob}`).getTime() || new Date(`1/1/1970`).getTime(); + const formData = { vehicle: { tenantId: tenantId, @@ -84,10 +108,13 @@ const AddVehicle = ({ parentUrl, heading }) => { fatherOrHusbandName: ownerName, relationship: "OTHER", gender: "OTHERS", - dob: new Date(`1/1/1970`).getTime(), + dob: dob, emailId: "abc@egov.com", correspondenceAddress: "", mobileNumber: phone, + gender: gender, + dob: dob, + emailId: emailId || "abc@egov.com", }, additionalDetails: { description: additionalDetails, @@ -106,7 +133,7 @@ const AddVehicle = ({ parentUrl, heading }) => { queryClient.invalidateQueries("FSM_VEICLES_SEARCH"); setTimeout(() => { closeToast(); - history.push(`/digit-ui/employee/fsm/registry`); + history.push(`/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE`); }, 5000); }, }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/EditVehicle.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/EditVehicle.js index 57ec101841b..0e1ee15074c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/EditVehicle.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/EditVehicle.js @@ -1,6 +1,6 @@ import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import { FormComposer, Loader, Toast, Header } from "@egovernments/digit-ui-react-components"; +import { FormComposer, Loader, Toast, Header, InfoIcon } from "@egovernments/digit-ui-react-components"; import { useHistory, useParams } from "react-router-dom"; import { useQueryClient } from "react-query"; import VehicleConfig from "../../configs/VehicleConfig"; @@ -60,6 +60,9 @@ const EditVehicle = ({ parentUrl, heading }) => { Digit.DateUtils.ConvertTimestampToDate(vehicleDetails?.vehicleData?.fitnessValidTill, "yyyy-MM-dd"), phone: vehicleDetails?.vehicleData?.owner?.mobileNumber, ownerName: vehicleDetails?.vehicleData?.owner?.name, + selectGender: vehicleDetails?.vehicleData?.owner?.gender, + dob: vehicleDetails?.vehicleData?.owner?.dob && Digit.DateUtils.ConvertTimestampToDate(vehicleDetails?.vehicleData?.owner?.dob, "yyyy-MM-dd"), + emailId: vehicleDetails?.vehicleData?.owner?.emailId === "abc@egov.com" ? "" : vehicleDetails?.vehicleData?.owner?.emailId, additionalDetails: vehicleDetails?.vehicleData?.additionalDetails?.description, }; setDefaultValues(values); @@ -71,6 +74,19 @@ const EditVehicle = ({ parentUrl, heading }) => { const Config = VehicleConfig(t, true); + Config[0].body.forEach((item) => { + if (item.label === "ES_FSM_REGISTRY_VEHICLE_NUMBER") { + item.labelChildren = ( +
+ + + {t(item.populators.validation.title)} + +
+ ); + } + }); + const onFormValueChange = (setValue, formData) => { if (formData?.registrationNumber && formData?.ownerName && formData?.phone && formData?.vehicle?.modal && formData?.vehicle?.type) { setSubmitValve(true); @@ -87,10 +103,10 @@ const EditVehicle = ({ parentUrl, heading }) => { const vehicleType = data?.vehicle?.type?.code || data?.vehicle?.type; const vehicleModal = data?.vehicle?.modal?.code || data?.vehicle?.modal; const tankCapacity = data?.vehicle?.type?.capacity || data?.vehicle?.tankCapacity; - const pollutionCert = new Date(`${data?.pollutionCert}`).getTime(); - const insurance = new Date(`${data?.insurance}`).getTime(); - const roadTax = new Date(`${data?.roadTax}`).getTime(); - const fitnessValidity = new Date(`${data?.fitnessValidity}`).getTime(); + const pollutionCert = data?.pollutionCert > 0 || data?.pollutionCert?.length > 0 ? new Date(`${data?.pollutionCert}`).getTime() : null; + const insurance = data?.insurance > 0 || data?.insurance?.length > 0 ? new Date(`${data?.insurance}`).getTime() : null; + const roadTax = data?.roadTax > 0 || data?.roadTax?.length > 0 ? new Date(`${data?.roadTax}`).getTime() : null; + const fitnessValidity = data?.fitnessValidity > 0 || data?.fitnessValidity?.length > 0 ? new Date(`${data?.fitnessValidity}`).getTime() : null; const additionalDetails = data?.additionalDetails; const formData = { vehicle: { @@ -106,6 +122,14 @@ const EditVehicle = ({ parentUrl, heading }) => { ...vehicleDetails.additionalDetails, description: additionalDetails, }, + owner: { + ...vehicleDetails.owner, + gender: gender || vehicleDetails.owner?.gender || "OTHER", + dob: dob, + emailId: emailId || "abc@egov.com", + name: vehicleOwnerName, + mobileNumber: phone, + }, }, }; mutate(formData, { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/VehicleDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/VehicleDetails.js index 285f5abf990..44c13032169 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/VehicleDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/VehicleDetails.js @@ -118,6 +118,8 @@ const VehicleDetails = (props) => { return setShowModal(true); case "EDIT": return history.push("/digit-ui/employee/fsm/registry/modify-vehicle/" + vehicleNumber); + case "HOME": + return history.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE"); default: break; } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/EditVendor.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/EditVendor.js index 56949b40960..10d14d4bb5b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/EditVendor.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/EditVendor.js @@ -89,6 +89,7 @@ const EditVendor = ({ parentUrl, heading }) => { const onSubmit = (data) => { const name = data?.vendorName; + const phone = data?.phone; const pincode = data?.pincode; const street = data?.street?.trim(); const doorNo = data?.doorNo?.trim(); @@ -141,6 +142,7 @@ const EditVendor = ({ parentUrl, heading }) => { gender: gender || dsoDetails.owner?.gender || "OTHER", dob: dob, emailId: emailId || "abc@egov.com", + mobileNumber: phone, relationship: dsoDetails.owner?.relationship || "OTHER", }, additionalDetails: { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/VendorDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/VendorDetails.js index 2ec10e4c61f..ad2785d3a2d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/VendorDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/VendorDetails.js @@ -117,6 +117,8 @@ const VendorDetails = (props) => { return setShowModal(true); case "EDIT": return history.push("/digit-ui/employee/fsm/registry/modify-vendor/" + dsoId); + case "HOME": + return history.push("/digit-ui/employee/fsm/registry?selectedTabs=VENDOR"); default: break; } @@ -388,7 +390,9 @@ const VendorDetails = (props) => { /> )} - {displayMenu ? : null} + {displayMenu ? ( + + ) : null} setDisplayMenu(!displayMenu)} /> diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/index.js index a039fc0e046..ebdd412f4bb 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/index.js @@ -1,6 +1,8 @@ import React, { useState, useCallback, useEffect } from "react"; import { useTranslation } from "react-i18next"; -import { Header } from "@egovernments/digit-ui-react-components"; +import { Header, InfoIcon } from "@egovernments/digit-ui-react-components"; +import { useParams, useHistory, useLocation } from "react-router-dom"; + import RegisryInbox from "../../../components/RegistryInbox"; const FSMRegistry = () => { @@ -14,12 +16,17 @@ const FSMRegistry = () => { const [vehicleIds, setVehicleIds] = useState(""); const [driverIds, setDriverIds] = useState(""); const [tableData, setTableData] = useState([]); + const history = useHistory(); + const location = useLocation(); + const queryParams = new URLSearchParams(location.search); + const selectedTabs = queryParams.get("selectedTabs"); + const [loaded, setLoaded] = useState(false); const userInfo = Digit.UserService.getUser(); let paginationParms = { limit: pageSize, offset: pageOffset, sortBy: sortParams?.[0]?.id, sortOrder: sortParams?.[0]?.desc ? "DESC" : "ASC" }; const { data: dsoData, isLoading: isLoading, isSuccess: isDsoSuccess, error: dsoError, refetch } = - tab === "VEHICLE" + selectedTabs === "VEHICLE" ? Digit.Hooks.fsm.useVehiclesSearch({ tenantId, filters: { @@ -29,7 +36,7 @@ const FSMRegistry = () => { }, config: { enabled: false }, }) - : tab === "DRIVER" + : selectedTabs === "DRIVER" ? Digit.Hooks.fsm.useDriverSearch({ tenantId, filters: { @@ -60,31 +67,35 @@ const FSMRegistry = () => { { vehicleIds: vehicleIds, driverIds: driverIds, - status: "ACTIVE", + // status: "ACTIVE", }, { enabled: false } ); - const inboxTotalCount = dsoData?.totalCount || 50; useEffect(() => { refetch(); }, []); + useEffect(() => { + setPageOffset(0); + refetch(); + }, [searchParams]); + useEffect(() => { refetch(); }, [searchParams, sortParams, pageOffset, pageSize]); useEffect(() => { - if (dsoData?.vehicle && tab === "VEHICLE") { + if (dsoData?.vehicle && selectedTabs === "VEHICLE") { let vehicleIds = ""; dsoData.vehicle.map((data) => { vehicleIds += `${data.id},`; }); setVehicleIds(vehicleIds); - setTableData(dsoData.vehicle); + setTableData(dsoData?.vehicle); } - if (dsoData?.driver && tab === "DRIVER") { + if (dsoData?.driver && selectedTabs === "DRIVER") { let driverIds = ""; dsoData.driver.map((data) => { driverIds += `${data.id},`; @@ -92,7 +103,7 @@ const FSMRegistry = () => { setDriverIds(driverIds); setTableData(dsoData?.driver); } - if (dsoData?.vendor && tab === "VENDOR") { + if (dsoData?.vendor && selectedTabs === "VENDOR") { const tableData = dsoData.vendor.map((dso) => ({ mobileNumber: dso.owner?.mobileNumber, name: dso.name, @@ -124,7 +135,7 @@ const FSMRegistry = () => { useEffect(() => { if (vendorData) { - if (tab === "VEHICLE") { + if (selectedTabs === "VEHICLE") { const vehicles = dsoData?.vehicle.map((data) => { let vendor = vendorData.find((ele) => ele.dsoDetails?.vehicles?.find((vehicle) => vehicle.id === data.id)); if (vendor) { @@ -135,7 +146,7 @@ const FSMRegistry = () => { setTableData(vehicles); setVehicleIds(""); } - if (tab === "DRIVER") { + if (selectedTabs === "DRIVER") { const drivers = dsoData?.driver.map((data) => { let vendor = vendorData.find((ele) => ele.dsoDetails?.drivers?.find((driver) => driver.id === data.id)); if (vendor) { @@ -167,17 +178,23 @@ const FSMRegistry = () => { const handleFilterChange = () => {}; - const searchFields = - tab === "VEHICLE" + let searchFields = + selectedTabs === "VEHICLE" ? [ { label: t("ES_FSM_REGISTRY_SEARCH_VEHICLE_NUMBER"), name: "registrationNumber", - pattern: `[A-Z]{2}\\s{1}[0-9]{2}\\s{0,1}[A-Z]{1,2}\\s{1}[0-9]{4}`, - title: t("ES_FSM_VEHICLE_FORMAT_TIP"), + labelChildren: ( +
+ + + {t("ES_FSM_VEHICLE_FORMAT_TIP")} + +
+ ), }, ] - : tab === "DRIVER" + : selectedTabs === "DRIVER" ? [ { label: t("ES_FSM_REGISTRY_SEARCH_DRIVER_NAME"), @@ -190,7 +207,6 @@ const FSMRegistry = () => { name: "name", }, ]; - const handleSort = useCallback((args) => { if (args?.length === 0) return; setSortParams(args); @@ -198,6 +214,9 @@ const FSMRegistry = () => { const onTabChange = (tab) => { setTab(tab); + if (selectedTabs !== tab) { + history.push(`/digit-ui/employee/fsm/registry?selectedTabs=${tab}`); + } }; const refetchData = () => { @@ -233,7 +252,7 @@ const FSMRegistry = () => { onPageSizeChange={handlePageSizeChange} totalRecords={inboxTotalCount || 0} onTabChange={onTabChange} - selectedTab={tab} + selectedTab={selectedTabs} refetchData={refetchData} refetchVendor={refetchVendorData} /> diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpAddVehicle.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpAddVehicle.js index 5d8c912dbc9..2071e6100f1 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpAddVehicle.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpAddVehicle.js @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import { FormStep, TextInput, LabelFieldPair, CardLabel, Header } from "@egovernments/digit-ui-react-components"; +import { FormStep, TextInput, LabelFieldPair, CardLabel, Header, InfoIcon } from "@egovernments/digit-ui-react-components"; import { useForm, Controller } from "react-hook-form"; import _ from "lodash"; import { useTranslation } from "react-i18next"; @@ -23,7 +23,7 @@ const FstpAddVehicle = ({ onSelect }) => { name: "vehicleNumber", validation: { // "pattern": "[a-zA-Z0-9 ]{1,20}", - pattern: `[A-Z]{2}\\s{1}[0-9]{2}\\s{0,1}[A-Z]{1,2}\\s{1}[0-9]{4}`, + pattern: `[A-Z]{2}[0-9]{2}[A-Z]{0,2}[0-9]{4}`, title: t("ES_FSM_VEHICLE_FORMAT_TIP"), }, }, @@ -36,7 +36,7 @@ const FstpAddVehicle = ({ onSelect }) => { }; function onChange(e) { - e.target.value.trim().length != 0 ? setVehicleNumber(e.target.value) : null; + return e.target.value.trim().length != 0 ? setVehicleNumber(e.target.value) : null; } const isMobile = window.Digit.Utils.browser.isMobile(); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpOperatorDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpOperatorDetails.js index f3b191b791a..3dc2713855b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpOperatorDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpOperatorDetails.js @@ -1,7 +1,7 @@ import React, { Fragment, useState, useEffect, useRef } from "react"; import { useParams, useHistory, useLocation } from "react-router-dom"; import TimePicker from "react-time-picker"; -import { Dropdown, Header, MultiUploadWrapper, TextArea } from "@egovernments/digit-ui-react-components"; +import { Dropdown, Header, MultiUploadWrapper, RadioButtons, TextArea } from "@egovernments/digit-ui-react-components"; import { Card, CardLabel, @@ -41,8 +41,49 @@ const FstpOperatorDetails = () => { const history = useHistory(); const queryClient = useQueryClient(); const tenantId = Digit.ULBService.getCurrentTenantId(); + const allCities = Digit.Hooks.fsm.useTenants(); const state = Digit.ULBService.getStateId(); let { id: applicationNos } = useParams(); + const isNew = history.location.pathname.includes("new") ? true : false; + const { data: urcConfig } = Digit.Hooks.fsm.useMDMS(tenantId, "FSM", "UrcConfig"); + const isUrcEnable = urcConfig && urcConfig.length > 0 && urcConfig[0].URCEnable; + const [selectedCity, setSelectedCity] = useState(() => allCities.filter((city) => city?.code === tenantId)[0] || null); + let inputs = [ + { + active: true, + code: "WITHIN_ULB_LIMITS", + i18nKey: "WITHIN_ULB_LIMITS", + name: "Witnin ULB Limits", + }, + { + active: true, + code: "FROM_GRAM_PANCHAYAT", + i18nKey: "FROM_GRAM_PANCHAYAT", + name: "From Gram Panchayat", + }, + { + active: true, + code: "FROM_OTHER_ULB", + i18nKey: "FROM_OTHER_ULB", + name: "From Other/Outside ULBs", + }, + ]; + const { data: fetchedLocalities } = Digit.Hooks.useBoundaryLocalities( + selectedCity?.code, + "revenue", + { + enabled: !!selectedCity, + }, + t + ); + var { data: fetchedGramPanchayats } = Digit.Hooks.useBoundaryLocalities( + selectedCity?.code, + "gramPanchayats", + { + enabled: !!selectedCity, + }, + t + ); const [filters, setFilters] = useState(applicationNos != undefined ? { applicationNos } : { applicationNos: "null" }); const [isVehicleSearchCompleted, setIsVehicleSearchCompleted] = useState(false); const [searchParams, setSearchParams] = useState({}); @@ -76,6 +117,15 @@ const FstpOperatorDetails = () => { const [newDsoName, setNewDsoName] = useState(null); const [comments, setComments] = useState(); const location = useLocation(); + const [selectLocation, setSelectLocation] = useState(isNew ? inputs[0] : null); + const [gramPanchayats, setGramPanchayats] = useState(); + const [selectedGp, setSelectedGp] = useState(); + const [villages, setVillages] = useState([]); + const [selectedVillage, setSelectedVillage] = useState(); + const [newGramPanchayat, setNewGramPanchayat] = useState(null); + const [newVillage, setNewVillage] = useState(); + const [selectedLocality, setSelectedLocality] = useState(); + const [localities, setLocalities] = useState(); const onChangeVehicleNumber = (value) => { setNewVehicleNumber(value); @@ -102,7 +152,16 @@ const FstpOperatorDetails = () => { enabled: !!isVehicleSearchCompleted, } ); - + useEffect(() => { + if (fetchedLocalities && fetchedLocalities.length > 0) { + setLocalities(fetchedLocalities); + } + }, [fetchedLocalities]); + useEffect(() => { + if (fetchedGramPanchayats && fetchedGramPanchayats.length > 0) { + setGramPanchayats(fetchedGramPanchayats); + } + }, [fetchedGramPanchayats]); useEffect(() => { filterVehicle?.length == 0 ? setCurrentTrip(1) : setCurrentTrip(tripNo - filterVehicle?.length + 1); }, [tripNo, filterVehicle, totalvehicle, totalsuccess, isSuccess]); @@ -151,7 +210,6 @@ const FstpOperatorDetails = () => { history.location.pathname.includes("new") ? handleCreate() : handleSubmit(); default: setSelectedAction(); - console.debug("default case"); break; } }, [selectedAction]); @@ -218,7 +276,9 @@ const FstpOperatorDetails = () => { }; const handleCreate = () => { - const re = new RegExp("^[A-Z]{2}\\s{1}[0-9]{2}\\s{0,1}[A-Z]{1,2}\\s{1}[0-9]{4}$"); + const re = new RegExp("[A-Z]{2}\\s{0,1}[0-9]{2}\\s{0,1}[A-Z]{0,2}\\s{0,1}[0-9]{4}"); + const dsoName = new RegExp(/^[A-Za-z0-9 ]*$/); + const locality = new RegExp(/^[A-Za-z0-9 ]*$/); if (!re.test(newVehicleNumber)) { setShowToast({ key: "error", action: `ES_FSM_VEHICLE_FORMAT_TIP` }); setTimeout(() => { @@ -226,20 +286,35 @@ const FstpOperatorDetails = () => { }, 5000); return; } - if (newDsoName === null || newDsoName?.trim()?.length === 0) { + if (newDsoName === null || newDsoName?.trim()?.length === 0 || !dsoName.test(newDsoName)) { setShowToast({ key: "error", action: `ES_FSTP_INVALID_DSO_NAME` }); setTimeout(() => { closeToast(); }, 2000); return; } - if (newLocality === null || newLocality?.trim()?.length === 0) { + if ( + selectLocation?.code !== "FROM_GRAM_PANCHAYAT" && + (selectedLocality === undefined || selectedLocality?.name === "Other") && + (newLocality === null || newLocality?.trim()?.length === 0 || !locality.test(newLocality)) + ) { setShowToast({ key: "error", action: `ES_FSTP_INVALID_LOCALITY` }); setTimeout(() => { closeToast(); }, 2000); return; } + if ( + selectLocation?.code === "FROM_GRAM_PANCHAYAT" && + (selectedGp === undefined || selectedGp?.name === "Other") && + (newGramPanchayat === null || newGramPanchayat?.trim()?.length === 0) + ) { + setShowToast({ key: "error", action: `ES_FSTP_SELECT_GRAMPANCHAYAT` }); + setTimeout(() => { + closeToast(); + }, 2000); + return; + } if (tripStartTime === null) { setErrors({ tripStartTime: "ES_FSTP_INVALID_START_TIME" }); tripStartTimeRef.current.scrollIntoView({ behavior: "smooth", block: "center" }); @@ -285,6 +360,13 @@ const FstpOperatorDetails = () => { vehiclecapacity : vehicleCapacity, fileStoreId: uploadedFile, comments: comments, + gramPanchayat: selectedGp, + village: selectedVillage, + newGramPanchayat: newGramPanchayat, + newVillage: newVillage, + boundaryType: selectLocation?.code === "FROM_GRAM_PANCHAYAT" ? "GP" : "Locality", + propertyLocation: selectLocation?.code, + newLocality: newLocality, }; temp.businessService = "FSM_VEHICLE_TRIP"; temp.tripDetails = [ @@ -335,7 +417,7 @@ const FstpOperatorDetails = () => { setShowToast({ key: "success", action: `ES_FSM_DISPOSE_UPDATE_SUCCESS` }); setTimeout(() => { closeToast(); - history.push(`/digit-ui/employee/fsm/fstp-operations`); + history.push(`/digit-ui/employee`); }, 5000); }; @@ -382,16 +464,6 @@ const FstpOperatorDetails = () => { /> ), }, - { - title: `${t("ES_INBOX_LOCALITY")} *`, - value: (tripDetails && tripDetails[0]?.address?.locality?.name) || ( - onChangeLocality(e.target.value)} - value={newLocality} - /> - ), - }, ]; const handleTimeChange = (value, cb) => { @@ -424,6 +496,44 @@ const FstpOperatorDetails = () => { selectfile(newArr[newArr.length - 1]); }; + function selectedValue(value) { + setSelectLocation(value); + } + + function selectGramPanchayat(value) { + setSelectedGp(value); + if (value.name !== "Other") { + const filteredVillages = gramPanchayats.filter((items) => items.code === value.code)[0]?.children; + var localitiesWithLocalizationKeys = filteredVillages.map((obj) => ({ + ...obj, + i18nkey: tenantId.replace(".", "_").toUpperCase() + "_" + obj.code, + })); + if (localitiesWithLocalizationKeys.length > 0) { + localitiesWithLocalizationKeys.push({ + code: "OTHER", + name: "Other", + i18nkey: tenantId.replace(".", "_").toUpperCase() + "_OTHER", + }); + setVillages(localitiesWithLocalizationKeys); + } + } + } + + function selectVillage(value) { + setSelectedVillage(value); + } + + const onChangeGramPanchayat = (value) => { + setNewGramPanchayat(value); + }; + + const onChangeVillage = (value) => { + setNewVillage(value); + }; + function selectLocality(locality) { + setSelectedLocality(locality); + } + return (
{t("ES_INBOX_VEHICLE_LOG")}
@@ -442,6 +552,227 @@ const FstpOperatorDetails = () => { labelStyle={{ fontWeight: "normal" }} /> ))} + {isNew && isUrcEnable && ( +
+ {`${t("CS_PROPERTY_LOCATION")} *`} +
+ +
+
+ )} + {(selectLocation?.code === "FROM_GRAM_PANCHAYAT" || + (tripDetails && tripDetails.length > 0 && tripDetails[0]?.address?.additionalDetails?.boundaryType === "Village") || + (tripDetails && tripDetails.length > 0 && tripDetails[0]?.address?.additionalDetails?.boundaryType === "GP")) && ( +
+ 0 ? ( + tripDetails[0]?.address?.additionalDetails?.gramPanchayat?.name + ) : ( + + ) + } + last={false} + labelStyle={{ fontWeight: "normal" }} + /> + {selectedGp?.name === "Other" && ( +
+ 0 ? ( + tripDetails[0]?.address?.locality?.name + ) : ( + onChangeGramPanchayat(e.target.value)} value={newGramPanchayat} /> + ) + } + last={false} + labelStyle={{ fontWeight: "normal" }} + /> + 0 ? ( + tripDetails[0]?.address?.locality?.name + ) : ( + onChangeVillage(e.target.value)} value={newVillage} /> + ) + } + last={false} + labelStyle={{ fontWeight: "normal" }} + /> +
+ )} + {selectedGp?.name !== "Other" && ( + 0 ? ( + tripDetails[0]?.address?.additionalDetails?.village?.name ? ( + tripDetails[0]?.address?.additionalDetails?.village?.name + ) : ( + "N/A" + ) + ) : villages.length > 0 ? ( + + ) : ( + onChangeVillage(e.target.value)} value={newVillage} /> + ) + } + last={false} + labelStyle={{ fontWeight: "normal" }} + /> + )} + {selectedVillage?.code === "OTHER" && ( + 0 ? ( + tripDetails[0]?.address?.locality?.name + ) : ( + onChangeVillage(e.target.value)} value={newVillage} /> + ) + } + last={false} + labelStyle={{ fontWeight: "normal" }} + /> + )} +
+ )} + {(selectLocation?.code === "WITHIN_ULB_LIMITS" || + (tripDetails && tripDetails.length > 0 && tripDetails[0]?.address?.additionalDetails?.boundaryType === "Locality")) && ( +
+ 0 ? ( + tripDetails[0]?.address?.locality?.name + ) : ( + a.name.localeCompare(b.name))} + select={selectLocality} + optionKey="i18nkey" + style={{ width: "100%" }} + t={t} + /> + ) + } + last={false} + labelStyle={{ fontWeight: "normal" }} + /> + {selectedLocality?.name === "Other" && ( + 0 ? ( + tripDetails[0]?.address?.locality?.name + ) : ( + onChangeLocality(e.target.value)} value={newLocality} /> + ) + } + last={false} + labelStyle={{ fontWeight: "normal" }} + /> + )} +
+ )} + {selectLocation?.code === "FROM_OTHER_ULB" && ( +
+ 0 ? ( + tripDetails[0]?.address?.locality?.name + ) : ( + onChangeLocality(e.target.value)} value={newLocality} /> + ) + } + last={false} + labelStyle={{ fontWeight: "normal" }} + /> +
+ )}
{t(errors.tripStartTime)}
@@ -525,7 +856,7 @@ const FstpOperatorDetails = () => { className="form-field" onChange={(e) => { if (e.target.value.length > 1024) { - null; + return null; } else { setComments(e.target.value); } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpServiceRequest.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpServiceRequest.js index 5d81ca6cbc4..6312b294caa 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpServiceRequest.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpServiceRequest.js @@ -142,7 +142,10 @@ const FstpServiceRequest = () => { let citizenInfo = []; tripDetail?.map((vehicle) => { - citizenInfo.push(vehicleLog?.find((i) => i?.tripDetails[0]?.referenceNo === vehicle?.applicationNo)); + const info = vehicleLog?.find((i) => i?.tripDetails[0]?.referenceNo === vehicle?.applicationNo); + if (info !== undefined) { + citizenInfo.push(info); + } }); if (isMobile) { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/NewApplication/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/NewApplication/index.js index 5558e734ba5..55e93b754be 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/NewApplication/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/NewApplication/index.js @@ -47,7 +47,9 @@ export const NewApplication = ({ parentUrl, heading }) => { formData?. propertyID && formData?.propertyType && formData?.subtype && - formData?.address?.locality?.code && + ((formData?.address?.locality?.name === "Other" ? formData?.address?.newLocality : formData?.address?.locality?.code) || + (formData?.address?.propertyLocation?.code === "FROM_GRAM_PANCHAYAT" && + (formData?.address?.gramPanchayat?.name === "Other" ? formData?.address?.newGp : formData?.address?.gramPanchayat?.code))) && formData?.tripData?.vehicleType && formData?.channel && formData?.pitType && @@ -106,9 +108,17 @@ export const NewApplication = ({ parentUrl, heading }) => { const localityName = data?.address?.locality?.name; const gender = data.applicationData.applicantGender; const paymentPreference = amount === 0 ? null : data?.paymentPreference ? data?.paymentPreference : null; - const advanceAmount = amount === 0 ? null : data?.advancepaymentPreference?.advanceAmount; + const advanceAmount = + amount === 0 ? null : data?.advancepaymentPreference?.advanceAmount === null ? 0 : data?.advancepaymentPreference?.advanceAmount; const distancefromroad=data?.tripData?.distancefromroad; const roadWidth= data?.tripData?.roadWidth; + const gramPanchayat = data?.address.gramPanchayat; + const village = data?.address.village; + const propertyLocation = data?.address?.propertyLocation?.code; + const newLocality = data?.address?.newLocality; + const newGp = data?.address?.newGp; + const newVillage = data?.address?.newVillage; + const formData = { fsm: { citizen: { @@ -120,7 +130,7 @@ export const NewApplication = ({ parentUrl, heading }) => { sanitationtype: sanitationtype, source: applicationChannel.code, additionalDetails: { - tripAmount: amount, + tripAmount: typeof amount === "number" ? JSON.stringify(amount) : amount, distancefromroad:distancefromroad, roadWidth:roadWidth, propertyID : propertyID, @@ -141,17 +151,32 @@ export const NewApplication = ({ parentUrl, heading }) => { pincode, slumName: slum, locality: { - code: localityCode, - name: localityName, + code: propertyLocation === "FROM_GRAM_PANCHAYAT" ? gramPanchayat?.code : localityCode, + name: propertyLocation === "FROM_GRAM_PANCHAYAT" ? gramPanchayat?.name : localityName, }, geoLocation: { latitude: data?.address?.latitude, longitude: data?.address?.longitude, }, + additionalDetails: { + boundaryType: propertyLocation === "FROM_GRAM_PANCHAYAT" ? "GP" : "Locality", + gramPanchayat: { + code: gramPanchayat?.code, + name: gramPanchayat?.name, + }, + village: village?.code + ? { + code: village?.code ? village?.code : "", + name: village?.name ? village?.name : "", + } + : newVillage, + newLocality: newLocality, + newGramPanchayat: newGp, + }, }, noOfTrips, paymentPreference, - advanceAmount, + advanceAmount: typeof advanceAmount === "number" ? JSON.stringify(advanceAmount) : advanceAmount, }, workflow: null, }; @@ -169,6 +194,7 @@ export const NewApplication = ({ parentUrl, heading }) => { } const configs = [...preFields, ...commonFields]; + return (
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/configs/DriverConfig.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/configs/DriverConfig.js index 63c5bbddb0e..dd3264fbfb6 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/configs/DriverConfig.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/configs/DriverConfig.js @@ -97,7 +97,7 @@ const DriverConfig = (t, disabled = false) => { className: "payment-form-text-input-correction", }, }, - { + /* { label: "ES_FSM_REGISTRY_DRIVER_PHONE", isMandatory: true, type: "mobileNumber", @@ -114,7 +114,7 @@ const DriverConfig = (t, disabled = false) => { className: "payment-form-text-input-correction", labelStyle: { border: "1px solid black", borderRight: "none" }, }, - }, + }, */ ], }, ]; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/configs/VehicleConfig.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/configs/VehicleConfig.js index 4698b54412d..4973ecb54fa 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/configs/VehicleConfig.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/configs/VehicleConfig.js @@ -1,5 +1,6 @@ import React from "react"; const { DatePicker, Dropdown } = require("@egovernments/digit-ui-react-components"); +import { convertEpochToDate } from "../../../utils"; const VehicleConfig = (t, disabled = false) => { return [ @@ -15,7 +16,7 @@ const VehicleConfig = (t, disabled = false) => { name: "registrationNumber", ValidationRequired: true, validation: { - pattern: `[A-Z]{2}\\s{1}[0-9]{2}\\s{0,1}[A-Z]{1,2}\\s{1}[0-9]{4}`, + pattern: `[A-Z]{2}[0-9]{2}[A-Z]{0,2}[0-9]{4}`, title: t("ES_FSM_VEHICLE_FORMAT_TIP"), }, error: t("FSM_REGISTRY_INVALID_REGISTRATION_NUMBER"), @@ -117,6 +118,52 @@ const VehicleConfig = (t, disabled = false) => { labelStyle: { border: "1px solid black", borderRight: "none" }, }, }, + { + label: "ES_FSM_REGISTRY_NEW_GENDER", + isMandatory: true, + type: "component", + route: "select-gender", + hideInEmployee: false, + key: "selectGender", + component: "SelectGender", + // disable: disabled, + }, + { + label: t("ES_FSM_REGISTRY_NEW_DOB"), + isMandatory: false, + type: "custom", + key: "dob", + populators: { + name: "dob", + validation: { + required: true, + }, + component: (props, customProps) => ( + + ), + }, + }, + { + label: "ES_FSM_REGISTRY_NEW_EMAIL", + isMandatory: false, + type: "text", + key: "emailId", + populators: { + name: "emailId", + validation: { + required: false, + pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/, + }, + error: t("FSM_REGISTRY_INVALID_EMAIL"), + defaultValue: "", + className: "payment-form-text-input-correction", + }, + }, { label: "ES_FSM_REGISTRY_NEW_VENDOR_ADDITIONAL_DETAILS", isMandatory: false, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/README.md b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/README.md deleted file mode 100644 index 30648df8c6e..00000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/README.md +++ /dev/null @@ -1,77 +0,0 @@ - -# digit-ui-module-hrms - -## Install - -```bash -npm install --save @egovernments/digit-ui-module-hrms -``` - -## Limitation - -```bash -This Package is more specific to DIGIT-UI's can be used across mission's -``` - -## Usage - -After adding the dependency make sure you have this dependency in - -```bash -frontend/micro-ui/web/package.json -``` - -```json -"@egovernments/digit-ui-module-hrms":"^1.5.0", -``` - -then navigate to App.js - -```bash - frontend/micro-ui/web/src/App.js -``` - - -```jsx -/** add this import **/ - -import { inithrmsComponents } from "@egovernments/digit-ui-module-hrms"; - -/** inside enabledModules add this new module key **/ - -const enabledModules = ["hrms"]; - -/** inside init Function call this function **/ - -const initDigitUI = () => { - inithrmsComponents(); -}; -``` - - - - -### Changelog - -```bash -1.7.1 UPYOG Base version -``` - -### Contributors - -[jagankumar-egov] [Tulika-eGov] [vamshikrishnakole-wtt-egov] - -## Documentation - -Documentation Site (https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui) - -## Maintainer - -- [jagankumar-egov](https://www.github.com/jagankumar-egov) - - -### Published from DIGIT Frontend -DIGIT Frontend Repo (https://github.com/upyog/UPYOG/tree/develop) - - -![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png) \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/package.json index 5c13e09d03b..2cafd580586 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/package.json @@ -1,6 +1,6 @@ { - "name": "@egovernments/digit-ui-module-hrms", - "version": "1.7.2", + "name": "@upyog/digit-ui-module-hrms", + "version": "1.7.3", "description": "Digit HRMS Module", "license": "MIT", "main": "dist/index.js", @@ -15,7 +15,7 @@ "prepublish": "yarn build" }, "dependencies": { - "@egovernments/digit-ui-react-components": "1.7.2", + "@egovernments/digit-ui-react-components": "^1.7.0-beta.2", "react": "17.0.2", "react-dom": "17.0.2", "react-hook-form": "6.15.8", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/README.md b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/README.md deleted file mode 100644 index 7738203ecef..00000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/README.md +++ /dev/null @@ -1,77 +0,0 @@ - -# digit-ui-module-mcollect - -## Install - -```bash -npm install --save @egovernments/digit-ui-module-mcollect -``` - -## Limitation - -```bash -This Package is more specific to DIGIT-UI's can be used across mission's -``` - -## Usage - -After adding the dependency make sure you have this dependency in - -```bash -frontend/micro-ui/web/package.json -``` - -```json -"@egovernments/digit-ui-module-mcollect":"^1.5.0", -``` - -then navigate to App.js - -```bash - frontend/micro-ui/web/src/App.js -``` - - -```jsx -/** add this import **/ - -import { initmcollectComponents } from "@egovernments/digit-ui-module-mcollect"; - -/** inside enabledModules add this new module key **/ - -const enabledModules = ["mcollect"]; - -/** inside init Function call this function **/ - -const initDigitUI = () => { - initmcollectComponents(); -}; -``` - - - - -### Changelog - -```bash -1.7.1 UPYOG Base version -``` - -### Contributors - -[jagankumar-egov] [Tulika-eGov] [vamshikrishnakole-wtt-egov] - -## Documentation - -Documentation Site (https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui) - -## Maintainer - -- [jagankumar-egov](https://www.github.com/jagankumar-egov) - - -### Published from DIGIT Frontend -DIGIT Frontend Repo (https://github.com/upyog/UPYOG/tree/develop) - - -![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png) \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/package.json index a1ffdcbab31..fa2e25ca38d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/package.json @@ -1,6 +1,6 @@ { - "name": "@egovernments/digit-ui-module-mcollect", - "version": "1.7.2", + "name": "@upyog/digit-ui-module-mcollect", + "version": "1.7.3", "license": "MIT", "description": "Digit Misc Collections Module", "main": "dist/index.js", @@ -19,7 +19,7 @@ "react-router-dom": "5.3.0" }, "dependencies": { - "@egovernments/digit-ui-react-components": "1.7.2", + "@egovernments/digit-ui-react-components": "^1.7.0-beta.2", "lodash.merge": "^4.6.2", "react": "17.0.2", "react-dom": "17.0.2", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/README.md b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/README.md deleted file mode 100644 index ccc1c414b68..00000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/README.md +++ /dev/null @@ -1,77 +0,0 @@ - -# digit-ui-module-noc - -## Install - -```bash -npm install --save @egovernments/digit-ui-module-noc -``` - -## Limitation - -```bash -This Package is more specific to DIGIT-UI's can be used across mission's -``` - -## Usage - -After adding the dependency make sure you have this dependency in - -```bash -frontend/micro-ui/web/package.json -``` - -```json -"@egovernments/digit-ui-module-noc":"^1.5.0", -``` - -then navigate to App.js - -```bash - frontend/micro-ui/web/src/App.js -``` - - -```jsx -/** add this import **/ - -import { initnocComponents } from "@egovernments/digit-ui-module-noc"; - -/** inside enabledModules add this new module key **/ - -const enabledModules = ["noc"]; - -/** inside init Function call this function **/ - -const initDigitUI = () => { - initnocComponents(); -}; -``` - - - - -### Changelog - -```bash -1.7.1 UPYOG Base version -``` - -### Contributors - -[jagankumar-egov] [Tulika-eGov] [vamshikrishnakole-wtt-egov] - -## Documentation - -Documentation Site (https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui) - -## Maintainer - -- [jagankumar-egov](https://www.github.com/jagankumar-egov) - - -### Published from DIGIT Frontend -DIGIT Frontend Repo (https://github.com/upyog/UPYOG/tree/develop) - - -![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png) \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/package.json index 5d7cd1685b7..7205460227b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/package.json @@ -1,6 +1,6 @@ { - "name": "@egovernments/digit-ui-module-noc", - "version": "1.7.2", + "name": "@upyog/digit-ui-module-noc", + "version": "1.7.3", "description": "", "main": "dist/index.js", "module": "dist/index.modern.js", @@ -18,7 +18,7 @@ "react-router-dom": "5.3.0" }, "dependencies": { - "@egovernments/digit-ui-react-components": "1.7.2", + "@egovernments/digit-ui-react-components": "^1.7.0-beta.2", "react": "17.0.2", "react-dom": "17.0.2", "react-hook-form": "6.15.8", diff --git a/frontend/micro-ui/web/package.json b/frontend/micro-ui/web/package.json index dfb73d19bdf..113e16629bf 100644 --- a/frontend/micro-ui/web/package.json +++ b/frontend/micro-ui/web/package.json @@ -18,12 +18,12 @@ "@egovernments/digit-ui-module-core": "1.7.2", "@upyog/digit-ui-module-engagement": "1.7.2", "@upyog/digit-ui-module-dss": "1.7.3", - "@upyog/digit-ui-module-fsm": "1.7.2", - "@egovernments/digit-ui-module-hrms": "1.7.2", - "@egovernments/digit-ui-module-mcollect": "1.7.2", + "@upyog/digit-ui-module-fsm": "1.7.3", + "@upyog/digit-ui-module-hrms": "1.7.3", + "@upyog/digit-ui-module-mcollect": "1.7.3", "@egovernments/digit-ui-module-commonpt":"1.7.2", "@upyog/digit-ui-module-obps": "1.7.2", - "@egovernments/digit-ui-module-noc": "1.7.2", + "@upyog/digit-ui-module-noc": "1.7.3", "@upyog/digit-ui-module-pgr": "1.7.3", "@upyog/digit-ui-module-pt": "1.7.2", "@egovernments/digit-ui-module-receipts": "1.7.2", diff --git a/frontend/micro-ui/web/src/App.js b/frontend/micro-ui/web/src/App.js index deca173773a..87c94c55a8a 100644 --- a/frontend/micro-ui/web/src/App.js +++ b/frontend/micro-ui/web/src/App.js @@ -10,7 +10,7 @@ import { PTLinks, PTComponents, } from "@upyog/digit-ui-module-pt"; -import { MCollectModule, MCollectLinks, initMCollectComponents } from "@egovernments/digit-ui-module-mcollect"; +import { MCollectModule, MCollectLinks, initMCollectComponents } from "@upyog/digit-ui-module-mcollect"; import { initDSSComponents } from "@upyog/digit-ui-module-dss"; import { PaymentModule, @@ -22,7 +22,7 @@ import { initLibraries } from "@egovernments/digit-ui-libraries"; import { HRMSModule, initHRMSComponents, -} from "@egovernments/digit-ui-module-hrms"; +} from "@upyog/digit-ui-module-hrms"; import { TLModule, TLLinks, @@ -30,7 +30,7 @@ import { } from "@upyog/digit-ui-module-tl"; import { initReceiptsComponents, ReceiptsModule } from "@egovernments/digit-ui-module-receipts"; import { initOBPSComponents } from "@upyog/digit-ui-module-obps"; -import { initNOCComponents } from "@egovernments/digit-ui-module-noc"; +import { initNOCComponents } from "@upyog/digit-ui-module-noc"; import { initEngagementComponents } from "@upyog/digit-ui-module-engagement"; import { initWSComponents } from "@upyog/digit-ui-module-ws"; // import { initCustomisationComponents } from "./Customisations";