@djb25/digit-ui-module-vendor 1.0.57 → 1.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- import React, { useState, useEffect, useCallback, useReducer, useMemo } from 'react';
1
+ import React, { useState, useEffect, useCallback, useReducer, useMemo, useRef } from 'react';
2
2
  import { useHistory, Link, useLocation, useParams, useRouteMatch, Switch, Route, Redirect } from 'react-router-dom';
3
3
  import { useTranslation } from 'react-i18next';
4
- import { VerticalTimeline, FormComposer, Toast, Card, ShippingTruck, Table, CheckBox, Loader, RadioButtons, CloseSvg, Localities, RemoveableTag, ActionBar, ApplyFilterBar, Dropdown, AddIcon, Menu, LinkLabel, SubmitBar, TextInput, DatePicker as DatePicker$4, ViewsIcon, ToggleSwitch, Modal, MdClose, CardSectionHeader, CardText, Row, EditIcon, DeleteIcon, Header, SearchForm, SearchField, MobileNumber, CardLabelError, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, HomeIcon, PropertyHouse, EmployeeModuleCard, FormStep, LabelFieldPair, CardLabel, CustomTooltip, UploadFile, RadioOrSelect, MultiSelectDropdown, CitizenHomeCard, CardHeader, CardSubHeader, StatusTable, LinkButton, Banner, InfoIcon } from '@djb25/digit-ui-react-components';
4
+ import { VerticalTimeline, FormComposer, Toast, Card, ShippingTruck, Table, CheckBox, Loader, RadioButtons, CloseSvg, Localities, RemoveableTag, ActionBar, ApplyFilterBar, Dropdown, AddIcon, Menu, LinkLabel, SubmitBar, TextInput, DatePicker as DatePicker$4, ViewsIcon, ToggleSwitch, Modal, MdClose, CardSectionHeader, CardText, Row, EditIcon, DeleteIcon, Header, SearchForm, SearchField, MobileNumber, CardLabelError, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, HomeIcon, PropertyHouse, EmployeeModuleCard, FormStep, LabelFieldPair, CardLabel, UploadFile, RadioOrSelect, MultiSelectDropdown, CitizenHomeCard, CardHeader, CardSubHeader, StatusTable, LinkButton, Banner, InfoIcon, CustomTooltip } from '@djb25/digit-ui-react-components';
5
5
  import { useQueryClient } from 'react-query';
6
6
  import { useForm, Controller } from 'react-hook-form';
7
7
 
@@ -904,6 +904,21 @@ const getSelectedVendorOption = function (row, vendors) {
904
904
  if (!selectedVendorId) return null;
905
905
  return vendors.find(vendor => (vendor === null || vendor === void 0 ? void 0 : vendor.id) === selectedVendorId) || ((_row25 = row) === null || _row25 === void 0 ? void 0 : _row25.vendor) || ((_row26 = row) === null || _row26 === void 0 ? void 0 : _row26.vendorData) || null;
906
906
  };
907
+ const getSelectedSupervisorOption = function (row, supervisorsList) {
908
+ var _row27;
909
+ if (row === void 0) {
910
+ row = {};
911
+ }
912
+ if (supervisorsList === void 0) {
913
+ supervisorsList = [];
914
+ }
915
+ const supervisorId = (_row27 = row) === null || _row27 === void 0 ? void 0 : _row27.supervisorId;
916
+ if (!supervisorId) return null;
917
+ return supervisorsList.find(s => {
918
+ var _s$owner;
919
+ return s.id === supervisorId || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid) === supervisorId;
920
+ }) || null;
921
+ };
907
922
  const getVendorFillingPoints = function (vendor) {
908
923
  var _vendor, _vendor2, _vendor3, _vendor4;
909
924
  if (vendor === void 0) {
@@ -942,14 +957,14 @@ const getVendorDriversForFillingPoint = (vendor, fillingPoint) => {
942
957
  });
943
958
  };
944
959
  const getSelectedDriverOption = function (row, drivers) {
945
- var _row27, _row27$driverData, _row28, _row28$driver;
960
+ var _row28, _row28$driverData, _row29, _row29$driver;
946
961
  if (row === void 0) {
947
962
  row = {};
948
963
  }
949
964
  if (drivers === void 0) {
950
965
  drivers = [];
951
966
  }
952
- const selectedDriverId = ((_row27 = row) === null || _row27 === void 0 ? void 0 : (_row27$driverData = _row27.driverData) === null || _row27$driverData === void 0 ? void 0 : _row27$driverData.id) || ((_row28 = row) === null || _row28 === void 0 ? void 0 : (_row28$driver = _row28.driver) === null || _row28$driver === void 0 ? void 0 : _row28$driver.id);
967
+ const selectedDriverId = ((_row28 = row) === null || _row28 === void 0 ? void 0 : (_row28$driverData = _row28.driverData) === null || _row28$driverData === void 0 ? void 0 : _row28$driverData.id) || ((_row29 = row) === null || _row29 === void 0 ? void 0 : (_row29$driver = _row29.driver) === null || _row29$driver === void 0 ? void 0 : _row29$driver.id);
953
968
  if (!selectedDriverId) return null;
954
969
  return drivers.find(driver => (driver === null || driver === void 0 ? void 0 : driver.id) === selectedDriverId) || null;
955
970
  };
@@ -1019,7 +1034,6 @@ const VendorInbox = props => {
1019
1034
  key: "error",
1020
1035
  action: "Failed to fetch document."
1021
1036
  });
1022
- setTimeout(closeToast, 5000);
1023
1037
  });
1024
1038
  return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
1025
1039
  } catch (e) {
@@ -1102,6 +1116,8 @@ const VendorInbox = props => {
1102
1116
  mutateVehicle = _Digit$Hooks$fsm$useU.mutate;
1103
1117
  const _Digit$Hooks$fsm$useD3 = Digit.Hooks.fsm.useDriverUpdate(tenantId),
1104
1118
  mutateDriver = _Digit$Hooks$fsm$useD3.mutate;
1119
+ const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorUpdate(tenantId),
1120
+ mutateSurveyor = _Digit$Hooks$fsm$useS.mutate;
1105
1121
  useEffect(() => {
1106
1122
  var _props$data;
1107
1123
  setTableData((props === null || props === void 0 ? void 0 : (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.table) || []);
@@ -1418,6 +1434,37 @@ const VendorInbox = props => {
1418
1434
  }
1419
1435
  });
1420
1436
  };
1437
+ const onSurveyorSupervisorSelect = (row, selectedSupervisor) => {
1438
+ var _selectedSupervisor$o, _formDetails$owner9, _formDetails$owner0, _formDetails$owner1, _formDetails$owner10;
1439
+ let formDetails = row.original;
1440
+ const formData = {
1441
+ surveyor: _extends({}, formDetails, {
1442
+ supervisorId: (selectedSupervisor === null || selectedSupervisor === void 0 ? void 0 : selectedSupervisor.id) || (selectedSupervisor === null || selectedSupervisor === void 0 ? void 0 : (_selectedSupervisor$o = selectedSupervisor.owner) === null || _selectedSupervisor$o === void 0 ? void 0 : _selectedSupervisor$o.uuid) || null,
1443
+ owner: _extends({}, formDetails === null || formDetails === void 0 ? void 0 : formDetails.owner, {
1444
+ gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner9 = formDetails.owner) === null || _formDetails$owner9 === void 0 ? void 0 : _formDetails$owner9.gender) || "OTHERS",
1445
+ dob: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner0 = formDetails.owner) === null || _formDetails$owner0 === void 0 ? void 0 : _formDetails$owner0.dob) || new Date("1/1/1970").getTime(),
1446
+ emailId: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner1 = formDetails.owner) === null || _formDetails$owner1 === void 0 ? void 0 : _formDetails$owner1.emailId) || "abc@egov.com",
1447
+ relationship: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner10 = formDetails.owner) === null || _formDetails$owner10 === void 0 ? void 0 : _formDetails$owner10.relationship) || "OTHER"
1448
+ })
1449
+ })
1450
+ };
1451
+ mutateSurveyor(formData, {
1452
+ onError: error => {
1453
+ setShowToast({
1454
+ key: "error",
1455
+ label: (error === null || error === void 0 ? void 0 : error.message) || error || t("ES_FSM_REGISTRY_INBOX_FAILED_TO_UPDATE_SUPERVISOR")
1456
+ });
1457
+ },
1458
+ onSuccess: () => {
1459
+ setShowToast({
1460
+ key: "success",
1461
+ label: t("ES_FSM_REGISTRY_INBOX_SUPERVISOR_MAPPED_SUCCESSFULLY")
1462
+ });
1463
+ queryClient.invalidateQueries(t("SURVEYOR_SEARCH"));
1464
+ props.refetchData();
1465
+ }
1466
+ });
1467
+ };
1421
1468
  const onSelectAdd = () => {
1422
1469
  switch (props.selectedTab) {
1423
1470
  case "VENDOR":
@@ -1462,6 +1509,21 @@ const VendorInbox = props => {
1462
1509
  allFillingPointsData = _Digit$Hooks$wt$useFi.data,
1463
1510
  isAllFillingPointsLoading = _Digit$Hooks$wt$useFi.isLoading;
1464
1511
  const allFillingPoints = (allFillingPointsData === null || allFillingPointsData === void 0 ? void 0 : allFillingPointsData.fillingPoints) || [];
1512
+ const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
1513
+ status: "ACTIVE"
1514
+ }, {
1515
+ enabled: props.selectedTab === "SURVEYOR"
1516
+ }),
1517
+ supervisorSearchResponse = _Digit$Hooks$fsm$useS2.data;
1518
+ const supervisors = React.useMemo(() => {
1519
+ const list = (supervisorSearchResponse === null || supervisorSearchResponse === void 0 ? void 0 : supervisorSearchResponse.supervisors) || (supervisorSearchResponse === null || supervisorSearchResponse === void 0 ? void 0 : supervisorSearchResponse.supervisor) || [];
1520
+ return list.map(s => {
1521
+ var _s$owner2, _s$owner3;
1522
+ return _extends({}, s, {
1523
+ displayName: (s.name || ((_s$owner2 = s.owner) === null || _s$owner2 === void 0 ? void 0 : _s$owner2.name) || "N/A") + " (" + (((_s$owner3 = s.owner) === null || _s$owner3 === void 0 ? void 0 : _s$owner3.mobileNumber) || s.mobileNo || "N/A") + ")"
1524
+ });
1525
+ });
1526
+ }, [supervisorSearchResponse]);
1465
1527
  const columns = React.useMemo(() => {
1466
1528
  switch (props.selectedTab) {
1467
1529
  case "VENDOR":
@@ -1853,28 +1915,41 @@ const VendorInbox = props => {
1853
1915
  }
1854
1916
  }] : []), ...(props.selectedTab === "SURVEYOR" ? [{
1855
1917
  Header: t("ES_FSM_REGISTRY_INBOX_SUPERVISOR_NAME"),
1918
+ id: "supervisor",
1856
1919
  accessor: row => {
1857
1920
  var _row$reportingManager;
1858
1921
  return row.supervisorName || ((_row$reportingManager = row.reportingManager) === null || _row$reportingManager === void 0 ? void 0 : _row$reportingManager.name) || "NA";
1859
1922
  },
1860
1923
  Cell: _ref29 => {
1861
- var _row$original19, _row$original20, _row$original20$repor;
1862
1924
  let row = _ref29.row;
1863
- return /*#__PURE__*/React.createElement("div", null, ((_row$original19 = row.original) === null || _row$original19 === void 0 ? void 0 : _row$original19.supervisorName) || ((_row$original20 = row.original) === null || _row$original20 === void 0 ? void 0 : (_row$original20$repor = _row$original20.reportingManager) === null || _row$original20$repor === void 0 ? void 0 : _row$original20$repor.name) || "NA");
1925
+ return /*#__PURE__*/React.createElement(Dropdown, {
1926
+ className: "fsm-registry-dropdown",
1927
+ selected: getSelectedSupervisorOption(row.original, supervisors),
1928
+ option: supervisors,
1929
+ select: value => onSurveyorSupervisorSelect(row, value),
1930
+ optionKey: "displayName",
1931
+ t: t,
1932
+ style: {
1933
+ textAlign: "left",
1934
+ width: "100%",
1935
+ minWidth: "250px"
1936
+ },
1937
+ disable: !supervisors.length
1938
+ });
1864
1939
  }
1865
1940
  }] : []), {
1866
1941
  Header: t("ES_FSM_REGISTRY_INBOX_DATE_CREATION"),
1867
1942
  accessor: "createdTime",
1868
1943
  Cell: _ref30 => {
1869
- var _row$original21, _row$original21$audit, _row$original22, _row$original22$audit;
1944
+ var _row$original19, _row$original19$audit, _row$original20, _row$original20$audit;
1870
1945
  let row = _ref30.row;
1871
- return GetCell((_row$original21 = row.original) !== null && _row$original21 !== void 0 && (_row$original21$audit = _row$original21.auditDetails) !== null && _row$original21$audit !== void 0 && _row$original21$audit.createdTime ? Digit.DateUtils.ConvertEpochToDate((_row$original22 = row.original) === null || _row$original22 === void 0 ? void 0 : (_row$original22$audit = _row$original22.auditDetails) === null || _row$original22$audit === void 0 ? void 0 : _row$original22$audit.createdTime) : "");
1946
+ return GetCell((_row$original19 = row.original) !== null && _row$original19 !== void 0 && (_row$original19$audit = _row$original19.auditDetails) !== null && _row$original19$audit !== void 0 && _row$original19$audit.createdTime ? Digit.DateUtils.ConvertEpochToDate((_row$original20 = row.original) === null || _row$original20 === void 0 ? void 0 : (_row$original20$audit = _row$original20.auditDetails) === null || _row$original20$audit === void 0 ? void 0 : _row$original20$audit.createdTime) : "");
1872
1947
  }
1873
1948
  }];
1874
1949
  default:
1875
1950
  return [];
1876
1951
  }
1877
- }, [props.selectedTab, vendors, drivers, tableData, additionalVendorData, allFillingPoints, t]);
1952
+ }, [props.selectedTab, vendors, drivers, tableData, additionalVendorData, allFillingPoints, supervisors, t]);
1878
1953
  const csvExportColumns = React.useMemo(() => {
1879
1954
  switch (props.selectedTab) {
1880
1955
  case "VENDOR":
@@ -1986,8 +2061,9 @@ const VendorInbox = props => {
1986
2061
  }, {
1987
2062
  Header: t("ES_FSM_REGISTRY_INBOX_SUPERVISOR_NAME"),
1988
2063
  exportAccessor: row => {
1989
- var _row$reportingManager2;
1990
- return (row === null || row === void 0 ? void 0 : row.supervisorName) || (row === null || row === void 0 ? void 0 : (_row$reportingManager2 = row.reportingManager) === null || _row$reportingManager2 === void 0 ? void 0 : _row$reportingManager2.name) || "NA";
2064
+ var _selectedSupervisor$o2, _row$reportingManager2;
2065
+ const selectedSupervisor = getSelectedSupervisorOption(row, supervisors);
2066
+ return selectedSupervisor ? selectedSupervisor.name || ((_selectedSupervisor$o2 = selectedSupervisor.owner) === null || _selectedSupervisor$o2 === void 0 ? void 0 : _selectedSupervisor$o2.name) : (row === null || row === void 0 ? void 0 : row.supervisorName) || (row === null || row === void 0 ? void 0 : (_row$reportingManager2 = row.reportingManager) === null || _row$reportingManager2 === void 0 ? void 0 : _row$reportingManager2.name) || "NA";
1991
2067
  }
1992
2068
  }, {
1993
2069
  Header: t("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),
@@ -2043,7 +2119,7 @@ const VendorInbox = props => {
2043
2119
  default:
2044
2120
  return [];
2045
2121
  }
2046
- }, [props.selectedTab, t]);
2122
+ }, [props.selectedTab, supervisors, t]);
2047
2123
  const getCSVExportData = React.useCallback(function () {
2048
2124
  return Promise.resolve(tableData);
2049
2125
  }, [tableData]);
@@ -2247,6 +2323,14 @@ const SearchVendor = () => {
2247
2323
  const _useState9 = useState(null),
2248
2324
  showToast = _useState9[0],
2249
2325
  setShowToast = _useState9[1];
2326
+ const _Digit$Hooks$useToast = Digit.Hooks.useToast(),
2327
+ consumeToast = _Digit$Hooks$useToast.consumeToast;
2328
+ useEffect(() => {
2329
+ const message = consumeToast();
2330
+ if (message) {
2331
+ setShowToast(message);
2332
+ }
2333
+ }, []);
2250
2334
  const isCitizen = (userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$info = userInfo.info) === null || _userInfo$info === void 0 ? void 0 : _userInfo$info.type) === "CITIZEN";
2251
2335
  const loggedInVendorId = userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$info2 = userInfo.info) === null || _userInfo$info2 === void 0 ? void 0 : _userInfo$info2.uuid;
2252
2336
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
@@ -2702,7 +2786,7 @@ const SupervisorDetails = props => {
2702
2786
  var _v$dsoDetails, _v$dsoDetails2;
2703
2787
  return ((_v$dsoDetails = v.dsoDetails) === null || _v$dsoDetails === void 0 ? void 0 : _v$dsoDetails.id) === data.vendorId || ((_v$dsoDetails2 = v.dsoDetails) === null || _v$dsoDetails2 === void 0 ? void 0 : _v$dsoDetails2.vendorId) === data.vendorId;
2704
2788
  });
2705
- const vendorName = (mappedVendor === null || mappedVendor === void 0 ? void 0 : (_mappedVendor$dsoDeta = mappedVendor.dsoDetails) === null || _mappedVendor$dsoDeta === void 0 ? void 0 : _mappedVendor$dsoDeta.name) || data.vendorId || "ES_FSM_REGISTRY_DETAILS_ADD_VENDOR";
2789
+ const vendorName = data.vendorName || (mappedVendor === null || mappedVendor === void 0 ? void 0 : (_mappedVendor$dsoDeta = mappedVendor.dsoDetails) === null || _mappedVendor$dsoDeta === void 0 ? void 0 : _mappedVendor$dsoDeta.name) || data.vendorId || "ES_FSM_REGISTRY_DETAILS_ADD_VENDOR";
2706
2790
  return {
2707
2791
  supervisorData: data,
2708
2792
  vendorDetails: {
@@ -3560,28 +3644,19 @@ const SurveyorDetails = props => {
3560
3644
  })));
3561
3645
  };
3562
3646
 
3563
- const Heading$2 = props => {
3564
- return /*#__PURE__*/React.createElement("h1", {
3565
- className: "heading-m"
3566
- }, props.label);
3567
- };
3568
- const CloseBtn$1 = props => {
3569
- return /*#__PURE__*/React.createElement("div", {
3570
- conClick: props.onClick
3571
- }, /*#__PURE__*/React.createElement(CloseSvg, null));
3572
- };
3573
3647
  const formatLabel = key => {
3574
3648
  const result = key.replace(/([A-Z])/g, " $1");
3575
3649
  return result.charAt(0).toUpperCase() + result.slice(1);
3576
3650
  };
3577
- const EditVendorDetails = props => {
3651
+ const VendorDetails = () => {
3578
3652
  var _dsoData$, _dsoData$$dsoDetails, _vendorAdditionalData, _vendorAdditionalData2, _vendorAdditionalData3, _parsedAdditionalDeta, _userInfo$info$type, _dsoData$5, _dsoData$5$employeeRe, _supervisorData$super, _surveyorData$surveyo;
3579
3653
  const tenantId = Digit.ULBService.getCurrentTenantId();
3580
3654
  const _useTranslation = useTranslation(),
3581
3655
  t = _useTranslation.t;
3582
3656
  const history = useHistory();
3583
3657
  const queryClient = useQueryClient();
3584
- let _useParams = useParams(),
3658
+ const vendorId = new URLSearchParams(location.search).get("vendorId");
3659
+ const _useParams = useParams(),
3585
3660
  dsoId = _useParams.id;
3586
3661
  const _useState = useState(false),
3587
3662
  displayMenu = _useState[0],
@@ -3687,9 +3762,9 @@ const EditVendorDetails = props => {
3687
3762
  case "ADD_DRIVER":
3688
3763
  return setShowModal(true);
3689
3764
  case "EDIT":
3690
- return history.push("/digit-ui/" + userType + "/fsm/registry/modify-vendor/" + dsoId);
3765
+ return history.push("/digit-ui/" + userType + "/vendor/registry/modify-vendor/" + (dsoId || vendorId));
3691
3766
  case "HOME":
3692
- return history.push("/digit-ui/" + userType + "/fsm/registry?selectedTabs=VENDOR");
3767
+ return history.push("/digit-ui/" + userType + "/vendor/registry?selectedTabs=VENDOR");
3693
3768
  }
3694
3769
  }, [selectedAction]);
3695
3770
  useEffect(() => {
@@ -3779,11 +3854,11 @@ const EditVendorDetails = props => {
3779
3854
  };
3780
3855
  const onEdit = (details, type, id) => {
3781
3856
  if (type === "ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER") {
3782
- history.push("/digit-ui/" + userType + "/fsm/registry/modify-driver/" + id);
3857
+ history.push("/digit-ui/" + userType + "/vendor/registry/modify-driver/" + id);
3783
3858
  } else {
3784
3859
  var _details$values, _details$values$find;
3785
3860
  let registrationNumber = details === null || details === void 0 ? void 0 : (_details$values = details.values) === null || _details$values === void 0 ? void 0 : (_details$values$find = _details$values.find(ele => ele.title === "ES_FSM_REGISTRY_VEHICLE_NUMBER")) === null || _details$values$find === void 0 ? void 0 : _details$values$find.value;
3786
- history.push("/digit-ui/" + userType + "/fsm/registry/modify-vehicle/" + registrationNumber);
3861
+ history.push("/digit-ui/" + userType + "/vendor/registry/modify-vehicle/" + registrationNumber);
3787
3862
  }
3788
3863
  };
3789
3864
  const onDelete = (details, type, id) => {
@@ -3832,7 +3907,6 @@ const EditVendorDetails = props => {
3832
3907
  key: "error",
3833
3908
  action: error
3834
3909
  });
3835
- setTimeout(closeToast, 5000);
3836
3910
  },
3837
3911
  onSuccess: (data, variables) => {
3838
3912
  setShowToast({
@@ -3843,9 +3917,6 @@ const EditVendorDetails = props => {
3843
3917
  refetchDso();
3844
3918
  refetchVehicle();
3845
3919
  refetchDriver();
3846
- setTimeout(() => {
3847
- closeToast();
3848
- }, 5000);
3849
3920
  }
3850
3921
  });
3851
3922
  };
@@ -3980,9 +4051,9 @@ const EditVendorDetails = props => {
3980
4051
  }, safeVal));
3981
4052
  })), /*#__PURE__*/React.createElement("div", {
3982
4053
  className: "add-details-link hover-button",
3983
- onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/additionaldetails/info?vendorId=" + dsoId)
4054
+ onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/additionaldetails/info?vendorId=" + (dsoId || vendorId))
3984
4055
  }, t("Edit Details"))) : userType !== "CITIZEN" && !isEkyc && /*#__PURE__*/React.createElement("div", {
3985
- onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/additionaldetails/vendor-details?vendorId=" + dsoId),
4056
+ onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/additionaldetails/modify-details?vendorId=" + (dsoId || vendorId)),
3986
4057
  className: "add-details-link hover-button"
3987
4058
  }, t("Add Additional Details")));
3988
4059
  }
@@ -3994,7 +4065,9 @@ const EditVendorDetails = props => {
3994
4065
  caption: value.caption,
3995
4066
  className: "border-none flex-box " + (!isMobile ? "vendor-details-row" : "")
3996
4067
  });
3997
- }), detail === null || detail === void 0 ? void 0 : (_detail$child = detail.child) === null || _detail$child === void 0 ? void 0 : _detail$child.map((data, index) => {
4068
+ }), /*#__PURE__*/React.createElement("div", {
4069
+ className: "flex-box flex-box-col flex-gap-2"
4070
+ }, detail === null || detail === void 0 ? void 0 : (_detail$child = detail.child) === null || _detail$child === void 0 ? void 0 : _detail$child.map((data, index) => {
3998
4071
  var _data$values;
3999
4072
  return /*#__PURE__*/React.createElement(Card, {
4000
4073
  className: "card-with-background",
@@ -4037,7 +4110,7 @@ const EditVendorDetails = props => {
4037
4110
  color: "green"
4038
4111
  } : {}
4039
4112
  }, value.value ? t(String(value.value)) : "N/A")))));
4040
- }), detail.type && /*#__PURE__*/React.createElement("div", {
4113
+ })), detail.type && /*#__PURE__*/React.createElement("div", {
4041
4114
  className: "add-details-link hover-button",
4042
4115
  onClick: () => onActionSelect(detail.type === "ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER" ? "ADD_DRIVER" : "ADD_VEHICLE")
4043
4116
  }, t(detail.type + "_ADD"))));
@@ -4056,7 +4129,7 @@ const EditVendorDetails = props => {
4056
4129
  t: t
4057
4130
  }), /*#__PURE__*/React.createElement("div", {
4058
4131
  className: "add-details-link hover-button",
4059
- onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/new-supervisor?vendorId=" + dsoId)
4132
+ onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/new-supervisor?vendorId=" + (dsoId || vendorId))
4060
4133
  }, t("ES_VENDOR_ADD_SUPERVISOR"))), /*#__PURE__*/React.createElement(CardSectionHeader, {
4061
4134
  style: {
4062
4135
  marginBottom: "16px",
@@ -4071,10 +4144,10 @@ const EditVendorDetails = props => {
4071
4144
  pageSizeLimit: 10,
4072
4145
  t: t
4073
4146
  })))), showModal && /*#__PURE__*/React.createElement(Modal, {
4074
- headerBarMain: /*#__PURE__*/React.createElement(Heading$2, {
4075
- label: t(selectedAction === "DELETE" ? "ES_FSM_REGISTRY_DELETE_POPUP_HEADER" : selectedAction === "ADD_VEHICLE" ? "ES_FSM_REGISTRY_ADD_VEHICLE_POPUP_HEADER" : "ES_FSM_REGISTRY_ADD_DRIVER_POPUP_HEADER")
4076
- }),
4077
- headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$1, {
4147
+ headerBarMain: /*#__PURE__*/React.createElement("h1", {
4148
+ className: "heading-m"
4149
+ }, t(selectedAction === "DELETE" ? "ES_FSM_REGISTRY_DELETE_POPUP_HEADER" : selectedAction === "ADD_VEHICLE" ? "ES_FSM_REGISTRY_ADD_VEHICLE_POPUP_HEADER" : "ES_FSM_REGISTRY_ADD_DRIVER_POPUP_HEADER")),
4150
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseSvg, {
4078
4151
  onClick: closeModal
4079
4152
  }),
4080
4153
  actionCancelLabel: t("CS_COMMON_CANCEL"),
@@ -4182,15 +4255,12 @@ const stringReplaceAll = function (str, searcher, replaceWith) {
4182
4255
  return str;
4183
4256
  };
4184
4257
 
4185
- const VendorConfig = function (t, disabled, formData) {
4186
- var _formData, _formData$serviceType;
4187
- if (disabled === void 0) {
4188
- disabled = false;
4189
- }
4190
- if (formData === void 0) {
4191
- formData = {};
4258
+ const VendorConfig = function (t, module, genderMenu, update) {
4259
+ var _module;
4260
+ if (module === void 0) {
4261
+ module = "";
4192
4262
  }
4193
- const isEkyc = ((_formData = formData) === null || _formData === void 0 ? void 0 : (_formData$serviceType = _formData.serviceType) === null || _formData$serviceType === void 0 ? void 0 : _formData$serviceType.code) === "EKYC";
4263
+ const isEkyc = ((_module = module) === null || _module === void 0 ? void 0 : _module.toLocaleUpperCase()) === "EKYC";
4194
4264
  return [{
4195
4265
  head: "ES_VRNDOR_NEW_VENDOR_DETAILS",
4196
4266
  isCollapsible: true,
@@ -4199,7 +4269,7 @@ const VendorConfig = function (t, disabled, formData) {
4199
4269
  label: "ES_FSM_REGISTRY_NEW_VENDOR_NAME",
4200
4270
  isMandatory: true,
4201
4271
  type: "text",
4202
- disable: disabled,
4272
+ disable: false,
4203
4273
  populators: {
4204
4274
  name: "vendorName",
4205
4275
  validation: {
@@ -4210,27 +4280,12 @@ const VendorConfig = function (t, disabled, formData) {
4210
4280
  defaultValue: "",
4211
4281
  className: "payment-form-text-input-correction"
4212
4282
  }
4213
- }, {
4214
- label: "ES_FSM_REGISTRY_NEW_EMAIL",
4215
- isMandatory: false,
4216
- type: "text",
4217
- key: "emailId",
4218
- populators: {
4219
- name: "emailId",
4220
- validation: {
4221
- required: false,
4222
- pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
4223
- },
4224
- error: t("FSM_REGISTRY_INVALID_EMAIL"),
4225
- defaultValue: "",
4226
- className: "payment-form-text-input-correction"
4227
- }
4228
4283
  }, {
4229
4284
  label: "ES_FSM_REGISTRY_NEW_VENDOR_PHONE",
4230
4285
  isMandatory: true,
4231
4286
  type: "mobileNumber",
4232
4287
  key: "phone",
4233
- disable: disabled,
4288
+ disable: false,
4234
4289
  populators: {
4235
4290
  name: "phone",
4236
4291
  validation: {
@@ -4245,13 +4300,28 @@ const VendorConfig = function (t, disabled, formData) {
4245
4300
  defaultValue: "",
4246
4301
  className: "payment-form-text-input-correction"
4247
4302
  }
4303
+ }, {
4304
+ label: "ES_FSM_REGISTRY_NEW_EMAIL",
4305
+ isMandatory: false,
4306
+ type: "text",
4307
+ key: "emailId",
4308
+ populators: {
4309
+ name: "emailId",
4310
+ validation: {
4311
+ required: false,
4312
+ pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
4313
+ },
4314
+ error: t("FSM_REGISTRY_INVALID_EMAIL"),
4315
+ defaultValue: "",
4316
+ className: "payment-form-text-input-correction"
4317
+ }
4248
4318
  }, {
4249
4319
  label: "ES_VENDOR_REGISTRY_SERVICE_TYPE",
4250
4320
  isMandatory: true,
4251
4321
  type: "component",
4252
4322
  key: "serviceType",
4253
4323
  component: "SelectServiceType",
4254
- disable: disabled,
4324
+ disable: update,
4255
4325
  populators: {
4256
4326
  name: "serviceType",
4257
4327
  defaultValue: {
@@ -4321,17 +4391,8 @@ const VendorConfig = function (t, disabled, formData) {
4321
4391
  component: "SelectEkycDropdown",
4322
4392
  populators: {
4323
4393
  name: "gender",
4324
- options: [{
4325
- code: "MALE",
4326
- name: "ES_COMMON_GENDER_MALE"
4327
- }, {
4328
- code: "FEMALE",
4329
- name: "ES_COMMON_GENDER_FEMALE"
4330
- }, {
4331
- code: "OTHER",
4332
- name: "ES_COMMON_GENDER_OTHER"
4333
- }],
4334
- optionsKey: "name"
4394
+ options: genderMenu,
4395
+ optionsKey: "i18nKey"
4335
4396
  }
4336
4397
  }, {
4337
4398
  label: "ES_FSM_REGISTRY_NEW_DOB",
@@ -4371,7 +4432,7 @@ const VendorConfig = function (t, disabled, formData) {
4371
4432
  };
4372
4433
 
4373
4434
  const AddVendor = () => {
4374
- var _Digit$UserService$ge, _formData$serviceType;
4435
+ var _Digit$UserService$ge, _formData$serviceType2;
4375
4436
  const tenantId = Digit.ULBService.getCurrentTenantId();
4376
4437
  const _useTranslation = useTranslation(),
4377
4438
  t = _useTranslation.t;
@@ -4384,12 +4445,30 @@ const AddVendor = () => {
4384
4445
  const _useState2 = useState(null),
4385
4446
  showToast = _useState2[0],
4386
4447
  setShowToast = _useState2[1];
4448
+ const _useState3 = useState([]),
4449
+ genderMenu = _useState3[0],
4450
+ setGenderMenu = _useState3[1];
4387
4451
  const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED", false),
4388
4452
  setMutationHappened = _Digit$Hooks$useSessi[1];
4389
4453
  const _Digit$Hooks$useSessi2 = Digit.Hooks.useSessionStorage("FSM_ERROR_DATA", false),
4390
4454
  clearError = _Digit$Hooks$useSessi2[2];
4391
4455
  const _Digit$Hooks$useSessi3 = Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA", false),
4392
4456
  clearSuccessData = _Digit$Hooks$useSessi3[2];
4457
+ const stateId = Digit.ULBService.getStateId();
4458
+ const _Digit$Hooks$obps$use = Digit.Hooks.obps.useMDMS(stateId, "common-masters", ["GenderType"]),
4459
+ genderTypeData = _Digit$Hooks$obps$use.data;
4460
+ useEffect(() => {
4461
+ var _genderTypeData$commo, _genderTypeData$commo2;
4462
+ if (genderTypeData && (_genderTypeData$commo = genderTypeData["common-masters"]) !== null && _genderTypeData$commo !== void 0 && (_genderTypeData$commo2 = _genderTypeData$commo.GenderType) !== null && _genderTypeData$commo2 !== void 0 && _genderTypeData$commo2.length) {
4463
+ var _genderTypeData$commo3, _genderTypeData$commo4;
4464
+ const menuItems = (_genderTypeData$commo3 = genderTypeData["common-masters"]) === null || _genderTypeData$commo3 === void 0 ? void 0 : (_genderTypeData$commo4 = _genderTypeData$commo3.GenderType) === null || _genderTypeData$commo4 === void 0 ? void 0 : _genderTypeData$commo4.filter(data => data.active).map(genderDetails => ({
4465
+ i18nKey: "COMMON_GENDER_" + genderDetails.code,
4466
+ code: "" + genderDetails.code,
4467
+ value: "" + genderDetails.code
4468
+ }));
4469
+ setGenderMenu(menuItems);
4470
+ }
4471
+ }, [genderTypeData]);
4393
4472
  const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVendorCreate(tenantId),
4394
4473
  mutate = _Digit$Hooks$fsm$useV.mutate;
4395
4474
  useEffect(() => {
@@ -4409,16 +4488,19 @@ const AddVendor = () => {
4409
4488
  amount: null
4410
4489
  }
4411
4490
  };
4412
- const _useState3 = useState(defaultValues),
4413
- formData = _useState3[0],
4414
- setFormData = _useState3[1];
4415
- const Config = React.useMemo(() => VendorConfig(t, false, formData), [t, (_formData$serviceType = formData.serviceType) === null || _formData$serviceType === void 0 ? void 0 : _formData$serviceType.code]);
4491
+ const _useState4 = useState(defaultValues),
4492
+ formData = _useState4[0],
4493
+ setFormData = _useState4[1];
4494
+ const Config = React.useMemo(() => {
4495
+ var _formData$serviceType;
4496
+ return VendorConfig(t, (_formData$serviceType = formData.serviceType) === null || _formData$serviceType === void 0 ? void 0 : _formData$serviceType.code, genderMenu);
4497
+ }, [t, formData === null || formData === void 0 ? void 0 : (_formData$serviceType2 = formData.serviceType) === null || _formData$serviceType2 === void 0 ? void 0 : _formData$serviceType2.i18nKey, genderMenu]);
4416
4498
  const onFormValueChange = (setValue, data) => {
4417
- var _data$zoneIds, _data$serviceType, _formData$serviceType2, _data$serviceType2;
4499
+ var _data$zoneIds, _data$serviceType, _formData$serviceType3, _data$serviceType2;
4418
4500
  const currentZoneCodes = (data === null || data === void 0 ? void 0 : (_data$zoneIds = data.zoneIds) === null || _data$zoneIds === void 0 ? void 0 : _data$zoneIds.map(item => item === null || item === void 0 ? void 0 : item.code)) || [];
4419
4501
  const previousZoneCodes = (formData === null || formData === void 0 ? void 0 : formData.zoneIds) || [];
4420
4502
  const zoneChanged = currentZoneCodes.join(",") !== previousZoneCodes.join(",");
4421
- if ((data === null || data === void 0 ? void 0 : (_data$serviceType = data.serviceType) === null || _data$serviceType === void 0 ? void 0 : _data$serviceType.code) !== (formData === null || formData === void 0 ? void 0 : (_formData$serviceType2 = formData.serviceType) === null || _formData$serviceType2 === void 0 ? void 0 : _formData$serviceType2.code) || zoneChanged) {
4503
+ if ((data === null || data === void 0 ? void 0 : (_data$serviceType = data.serviceType) === null || _data$serviceType === void 0 ? void 0 : _data$serviceType.code) !== (formData === null || formData === void 0 ? void 0 : (_formData$serviceType3 = formData.serviceType) === null || _formData$serviceType3 === void 0 ? void 0 : _formData$serviceType3.code) || zoneChanged) {
4422
4504
  setFormData(prev => _extends({}, prev, {
4423
4505
  serviceType: data === null || data === void 0 ? void 0 : data.serviceType
4424
4506
  }));
@@ -4551,10 +4633,7 @@ const AddVendor = () => {
4551
4633
  if (isEkyc) {
4552
4634
  var _mergedData$zoneIds, _mergedData$clusterId;
4553
4635
  vendorData = _extends({}, vendorData, {
4554
- zoneIds: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$zoneIds = mergedData.zoneIds) === null || _mergedData$zoneIds === void 0 ? void 0 : _mergedData$zoneIds.map(z => {
4555
- var _z$;
4556
- return z === null || z === void 0 ? void 0 : (_z$ = z[1]) === null || _z$ === void 0 ? void 0 : _z$.code;
4557
- })) || [],
4636
+ zoneIds: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$zoneIds = mergedData.zoneIds) === null || _mergedData$zoneIds === void 0 ? void 0 : _mergedData$zoneIds.map(z => z === null || z === void 0 ? void 0 : z.name)) || [],
4558
4637
  clusterIds: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$clusterId = mergedData.clusterIds) === null || _mergedData$clusterId === void 0 ? void 0 : _mergedData$clusterId.map(c => {
4559
4638
  var _c$;
4560
4639
  return c === null || c === void 0 ? void 0 : (_c$ = c[1]) === null || _c$ === void 0 ? void 0 : _c$.code;
@@ -5289,8 +5368,8 @@ const createConfig = [{
5289
5368
  nextStep: "vendor-details",
5290
5369
  key: "Documents"
5291
5370
  }, {
5292
- route: "vendor-details",
5293
- component: "VendorDetails",
5371
+ route: "modify-details",
5372
+ component: "AdditionalDetails",
5294
5373
  withoutLabel: true,
5295
5374
  key: "vendordet",
5296
5375
  type: "component",
@@ -5374,7 +5453,6 @@ const VENDORCreate = _ref => {
5374
5453
  nextStep = key;
5375
5454
  }
5376
5455
  if (nextStep === null) {
5377
- console.log("matchhhhh pathhhh", match.path);
5378
5456
  return redirectWithHistory(match.path + "/check");
5379
5457
  }
5380
5458
  if (!isNaN(nextStep.split("/").pop())) {
@@ -5425,8 +5503,7 @@ const VENDORCreate = _ref => {
5425
5503
  clearParams();
5426
5504
  queryClient.invalidateQueries("VENDOR_CREATE");
5427
5505
  };
5428
- let commonFields = createConfig;
5429
- commonFields.forEach(obj => {
5506
+ createConfig.forEach(obj => {
5430
5507
  config = config.concat(obj.body.filter(a => !a.hideInCitizen));
5431
5508
  });
5432
5509
  config.indexRoute = "info";
@@ -5468,447 +5545,314 @@ const VENDORCreate = _ref => {
5468
5545
  }))));
5469
5546
  };
5470
5547
 
5471
- const EmployeeApp = _ref => {
5472
- let path = _ref.path;
5548
+ const EditVendor = () => {
5549
+ var _Digit$UserService$ge, _defaultValues$servic2;
5550
+ const tenantId = Digit.ULBService.getCurrentTenantId();
5473
5551
  const _useTranslation = useTranslation(),
5474
5552
  t = _useTranslation.t;
5475
- const location = useLocation();
5476
- sessionStorage.removeItem("revalidateddone");
5477
- const AddDriver = Digit.ComponentRegistryService.getComponent("AddDriver");
5478
- const AddVehicle = Digit.ComponentRegistryService.getComponent("AddVehicle");
5479
- const DriverDetails = Digit.ComponentRegistryService.getComponent("DriverDetails");
5480
- const VehicleDetails = Digit.ComponentRegistryService.getComponent("VehicleDetails");
5481
- const EditDriver = Digit.ComponentRegistryService.getComponent("EditDriver");
5482
- const EditVehicle = Digit.ComponentRegistryService.getComponent("EditVehicle");
5483
- const getDynamicBreadcrumbs = () => {
5484
- const pathname = location.pathname;
5485
- let crumbs = [{
5486
- icon: HomeIcon,
5487
- path: "/digit-ui/employee"
5553
+ const history = useHistory();
5554
+ let _useParams = useParams(),
5555
+ dsoId = _useParams.id;
5556
+ const _useState = useState(null),
5557
+ showToast = _useState[0],
5558
+ setShowToast = _useState[1];
5559
+ const _useState2 = useState(false),
5560
+ canSubmit = _useState2[0],
5561
+ setCanSubmit = _useState2[1];
5562
+ const _useState3 = useState({}),
5563
+ defaultValues = _useState3[0],
5564
+ setDefaultValues = _useState3[1];
5565
+ const _useState4 = useState({}),
5566
+ dsoDetails = _useState4[0],
5567
+ setDsoDetails = _useState4[1];
5568
+ const queryClient = useQueryClient();
5569
+ const userInfo = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info;
5570
+ const userType = userInfo === null || userInfo === void 0 ? void 0 : userInfo.type;
5571
+ const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED", false),
5572
+ setMutationHappened = _Digit$Hooks$useSessi[1];
5573
+ const _Digit$Hooks$useSessi2 = Digit.Hooks.useSessionStorage("FSM_ERROR_DATA", false),
5574
+ clearError = _Digit$Hooks$useSessi2[2];
5575
+ const _Digit$Hooks$useSessi3 = Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA", false),
5576
+ clearSuccessData = _Digit$Hooks$useSessi3[2];
5577
+ const _useState5 = useState([]),
5578
+ genderMenu = _useState5[0],
5579
+ setGenderMenu = _useState5[1];
5580
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
5581
+ ids: dsoId
5488
5582
  }, {
5489
- label: t("TITLE_VENDOR_MANAGEMENT"),
5490
- path: "/digit-ui/employee/vendor/search-vendor"
5491
- }];
5492
- if (pathname.includes("/registry/new-vendor")) {
5493
- crumbs.push({
5494
- label: t("ES_FSM_REGISTRY_TITLE_NEW_VENDOR")
5495
- });
5496
- } else if (pathname.includes("/search-vendor")) {
5497
- crumbs.push({
5498
- label: t("SEARCH_VENDOR")
5499
- });
5500
- } else if (pathname.includes("/registry/new-driver")) {
5501
- crumbs.push({
5502
- label: t("ES_FSM_REGISTRY_TITLE_NEW_DRIVER")
5503
- });
5504
- } else if (pathname.includes("/registry/vendor-details") || pathname.includes("/registry/modify-vendor/")) {
5505
- crumbs.push({
5506
- label: t("VENDOR_VENDOR_DETAILS")
5507
- });
5508
- } else if (pathname.includes("/registry/vehicle-details") || pathname.includes("/registry/modify-vehicle/")) {
5509
- crumbs.push({
5510
- label: t("VENDOR_VEHICLE_DETAILS")
5511
- });
5512
- } else if (pathname.includes("/registry/new-vehicle")) {
5513
- crumbs.push({
5514
- label: t("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE")
5515
- });
5516
- } else if (pathname.includes("/registry/driver-details") || pathname.includes("/registry/modify-driver/")) {
5517
- crumbs.push({
5518
- label: t("VENDOR_DRIVER_DETAILS")
5519
- });
5520
- } else if (pathname.includes("/registry/additionaldetails")) {
5521
- crumbs.push({
5522
- label: t("VENDOR_ADDITIONAL_DETAILS")
5523
- });
5524
- } else if (pathname.includes("/registry/new-supervisor")) {
5525
- crumbs.push({
5526
- label: t("ES_FSM_REGISTRY_TITLE_NEW_SUPERVISOR")
5527
- });
5528
- } else if (pathname.includes("/registry/supervisor-details") || pathname.includes("/registry/modify-supervisor/")) {
5529
- crumbs.push({
5530
- label: t("VENDOR_SUPERVISOR_DETAILS")
5531
- });
5532
- } else if (pathname.includes("/registry/new-surveyor")) {
5533
- crumbs.push({
5534
- label: t("ES_FSM_REGISTRY_TITLE_NEW_SURVEYOR")
5535
- });
5536
- } else if (pathname.includes("/registry/surveyor-details") || pathname.includes("/registry/modify-surveyor/")) {
5537
- crumbs.push({
5538
- label: t("VENDOR_SURVEYOR_DETAILS")
5539
- });
5583
+ staleTime: Infinity
5584
+ }),
5585
+ dsoData = _Digit$Hooks$fsm$useD.data,
5586
+ daoDataLoading = _Digit$Hooks$fsm$useD.isLoading;
5587
+ const stateId = Digit.ULBService.getStateId();
5588
+ const _Digit$Hooks$obps$use = Digit.Hooks.obps.useMDMS(stateId, "common-masters", ["GenderType"]),
5589
+ genderTypeData = _Digit$Hooks$obps$use.data;
5590
+ const _useState6 = useState([]),
5591
+ zones = _useState6[0],
5592
+ setZones = _useState6[1];
5593
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
5594
+ boundaryData = _Digit$Hooks$useCommo.data,
5595
+ isLoading = _Digit$Hooks$useCommo.isLoading;
5596
+ useEffect(() => {
5597
+ var _boundaryData$egovLo, _boundaryData$egovLo$, _boundaryData$MdmsRes, _boundaryData$MdmsRes2, _boundaryData$MdmsRes3;
5598
+ const tenantBoundary = (boundaryData === null || boundaryData === void 0 ? void 0 : (_boundaryData$egovLo = boundaryData["egov-location"]) === null || _boundaryData$egovLo === void 0 ? void 0 : (_boundaryData$egovLo$ = _boundaryData$egovLo.TenantBoundary) === null || _boundaryData$egovLo$ === void 0 ? void 0 : _boundaryData$egovLo$[0]) || (boundaryData === null || boundaryData === void 0 ? void 0 : (_boundaryData$MdmsRes = boundaryData.MdmsRes) === null || _boundaryData$MdmsRes === void 0 ? void 0 : (_boundaryData$MdmsRes2 = _boundaryData$MdmsRes["egov-location"]) === null || _boundaryData$MdmsRes2 === void 0 ? void 0 : (_boundaryData$MdmsRes3 = _boundaryData$MdmsRes2.TenantBoundary) === null || _boundaryData$MdmsRes3 === void 0 ? void 0 : _boundaryData$MdmsRes3[0]);
5599
+ const boundaries = (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.boundary) || (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.children) || [];
5600
+ if (Array.isArray(boundaries === null || boundaries === void 0 ? void 0 : boundaries.children) && (boundaries === null || boundaries === void 0 ? void 0 : boundaries.children.length) > 0) {
5601
+ const allZones = boundaries.children.flatMap(assembly => ((assembly === null || assembly === void 0 ? void 0 : assembly.children) || []).map(zone => ({
5602
+ code: zone.code,
5603
+ name: zone.name
5604
+ })));
5605
+ const zonesList = [...new Map(allZones.map(zone => [zone.code, zone])).values()];
5606
+ setZones(zonesList);
5540
5607
  }
5541
- return crumbs;
5542
- };
5543
- return /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
5544
- className: "ground-container employee-app-container form-container"
5545
- }, /*#__PURE__*/React.createElement(ModuleHeader, {
5546
- leftContent: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ArrowLeft, {
5547
- className: "icon"
5548
- }), "Back"),
5549
- onLeftClick: () => window.history.back(),
5550
- breadcrumbs: getDynamicBreadcrumbs()
5551
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5552
- path: path + "/search-vendor",
5553
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5554
- layoutClass: "normal"
5555
- }, /*#__PURE__*/React.createElement(SearchVendor, _extends({}, props, {
5556
- parentRoute: path
5557
- })))
5558
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5559
- path: path + "/registry/new-driver",
5560
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5561
- layoutClass: "action"
5562
- }, /*#__PURE__*/React.createElement(AddDriver, _extends({}, props, {
5563
- parentRoute: path
5564
- })))
5565
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5566
- path: path + "/registry/new-vehicle",
5567
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5568
- layoutClass: "action"
5569
- }, /*#__PURE__*/React.createElement(AddVehicle, _extends({}, props, {
5570
- parentRoute: path
5571
- })))
5572
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5573
- path: path + "/registry/additionaldetails",
5574
- component: props => {
5575
- const isInfoPage = props.location.pathname.includes("/info");
5576
- return /*#__PURE__*/React.createElement(LayoutWrapper, {
5577
- layoutClass: isInfoPage ? "action" : "normal"
5578
- }, /*#__PURE__*/React.createElement(VENDORCreate, _extends({}, props, {
5579
- parentRoute: path
5580
- })));
5608
+ }, [boundaryData]);
5609
+ useEffect(() => {
5610
+ var _genderTypeData$commo, _genderTypeData$commo2;
5611
+ if (genderTypeData && (_genderTypeData$commo = genderTypeData["common-masters"]) !== null && _genderTypeData$commo !== void 0 && (_genderTypeData$commo2 = _genderTypeData$commo.GenderType) !== null && _genderTypeData$commo2 !== void 0 && _genderTypeData$commo2.length) {
5612
+ var _genderTypeData$commo3, _genderTypeData$commo4;
5613
+ const menuItems = (_genderTypeData$commo3 = genderTypeData["common-masters"]) === null || _genderTypeData$commo3 === void 0 ? void 0 : (_genderTypeData$commo4 = _genderTypeData$commo3.GenderType) === null || _genderTypeData$commo4 === void 0 ? void 0 : _genderTypeData$commo4.filter(data => data.active).map(genderDetails => ({
5614
+ i18nKey: "COMMON_GENDER_" + genderDetails.code,
5615
+ code: "" + genderDetails.code,
5616
+ value: "" + genderDetails.code
5617
+ }));
5618
+ setGenderMenu(menuItems);
5581
5619
  }
5582
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5583
- path: path + "/registry/driver-details/:id",
5584
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5585
- layoutClass: "action"
5586
- }, /*#__PURE__*/React.createElement(DriverDetails, _extends({}, props, {
5587
- parentRoute: path
5588
- })))
5589
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5590
- path: path + "/registry/modify-driver/:id",
5591
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5592
- layoutClass: "action"
5593
- }, /*#__PURE__*/React.createElement(EditDriver, _extends({}, props, {
5594
- parentRoute: path
5595
- })))
5596
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5597
- path: path + "/common-search/:id",
5598
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5599
- layoutClass: "normal"
5600
- }, /*#__PURE__*/React.createElement(SearchApp, _extends({}, props, {
5601
- parentRoute: path
5602
- })))
5603
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5604
- path: path + "/registry/new-vendor",
5605
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5606
- layoutClass: "action"
5607
- }, /*#__PURE__*/React.createElement(AddVendor, _extends({}, props, {
5608
- parentRoute: path
5609
- })))
5610
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5611
- path: path + "/registry/vendor-details/:id",
5612
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5613
- layoutClass: "action"
5614
- }, /*#__PURE__*/React.createElement(EditVendorDetails, _extends({}, props, {
5615
- parentRoute: path
5616
- })))
5617
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5618
- path: path + "/registry/vehicle-details/:id",
5619
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5620
- layoutClass: "action"
5621
- }, /*#__PURE__*/React.createElement(VehicleDetails, _extends({}, props, {
5622
- parentRoute: path
5623
- })))
5624
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5625
- path: path + "/registry/modify-vehicle/:id",
5626
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5627
- layoutClass: "action"
5628
- }, /*#__PURE__*/React.createElement(EditVehicle, _extends({}, props, {
5629
- parentRoute: path
5630
- })))
5631
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5632
- path: path + "/registry/new-supervisor",
5633
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5634
- layoutClass: "action"
5635
- }, /*#__PURE__*/React.createElement(AddSupervisor, _extends({}, props, {
5636
- parentRoute: path
5637
- })))
5638
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5639
- path: path + "/registry/supervisor-details/:id",
5640
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5641
- layoutClass: "action"
5642
- }, /*#__PURE__*/React.createElement(SupervisorDetails, _extends({}, props, {
5643
- parentRoute: path
5644
- })))
5645
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5646
- path: path + "/registry/modify-supervisor/:id",
5647
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5648
- layoutClass: "action"
5649
- }, /*#__PURE__*/React.createElement(EditSupervisor, _extends({}, props, {
5650
- parentRoute: path
5651
- })))
5652
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5653
- path: path + "/registry/new-surveyor",
5654
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5655
- layoutClass: "action"
5656
- }, /*#__PURE__*/React.createElement(AddSurveyor, _extends({}, props, {
5657
- parentRoute: path
5658
- })))
5659
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5660
- path: path + "/registry/surveyor-details/:id",
5661
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5662
- layoutClass: "action"
5663
- }, /*#__PURE__*/React.createElement(SurveyorDetails, _extends({}, props, {
5664
- parentRoute: path
5665
- })))
5666
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
5667
- path: path + "/registry/modify-surveyor/:id",
5668
- component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5669
- layoutClass: "action"
5670
- }, /*#__PURE__*/React.createElement(EditSurveyor, _extends({}, props, {
5671
- parentRoute: path
5672
- })))
5673
- })))));
5674
- };
5675
-
5676
- const VENDORCard = () => {
5677
- const _useTranslation = useTranslation(),
5678
- t = _useTranslation.t;
5679
- const history = useHistory();
5680
- const isCitizen = window.location.pathname.toLowerCase().includes("citizen");
5681
- let hasAccess = Digit.Utils.vendorAccess() || Digit.UserService.hasAccess(["WT_VENDOR", "MT_VENDOR"]);
5682
- if (isCitizen) {
5683
- hasAccess = Digit.UserService.hasAccess(["WT_VENDOR", "EKYC_VENDOR", "EKYC_SUPERVISOR"]);
5684
- }
5685
- if (!hasAccess) {
5686
- return null;
5687
- }
5688
- const links = [{
5689
- label: t("VENDOR_NEW_REGISTERATION"),
5690
- link: isCitizen ? "/digit-ui/citizen/vendor/registry/new-vendor" : "/digit-ui/employee/vendor/registry/new-vendor"
5691
- }, {
5692
- label: t("SEARCH_VENDOR"),
5693
- link: isCitizen ? "/digit-ui/citizen/vendor/search-vendor" : "/digit-ui/employee/vendor/search-vendor"
5694
- }];
5695
- const VENDORRole = Digit.UserService.hasAccess(["WT_VENDOR"]);
5696
- const propsForModuleCard = _extends({
5697
- Icon: /*#__PURE__*/React.createElement(PropertyHouse, null),
5698
- moduleName: t("TITLE_VENDOR_MANAGEMENT"),
5699
- kpis: [{
5700
- count: 0,
5701
- label: t("Inbox"),
5702
- link: isCitizen ? "/digit-ui/citizen/vendor/search-vendor" : "/digit-ui/employee/vendor/search-vendor"
5703
- }],
5704
- links: links.filter(link => !(link !== null && link !== void 0 && link.role) || VENDORRole)
5705
- }, isCitizen ? {
5706
- onDetailsClick: () => history.push("/digit-ui/citizen/vendor/search-vendor")
5707
- } : {});
5708
- if (isCitizen) {
5709
- return /*#__PURE__*/React.createElement("div", {
5710
- className: "wt-citizen-card-premium"
5711
- }, /*#__PURE__*/React.createElement(EmployeeModuleCard, propsForModuleCard));
5712
- }
5713
- return /*#__PURE__*/React.createElement(EmployeeModuleCard, propsForModuleCard);
5714
- };
5715
-
5716
- const VendorDetails = _ref => {
5717
- var _formData$ownerKey, _formData$ownerKey2, _formData$ownerKey3, _formData$ownerKey4;
5718
- let t = _ref.t,
5719
- config = _ref.config,
5720
- onSelect = _ref.onSelect,
5721
- userType = _ref.userType,
5722
- formData = _ref.formData;
5723
- let index = 0;
5724
- const user = Digit.UserService.getUser().info;
5725
- const applicantName = formData.ownerKey && formData.ownerKey[index] && formData.ownerKey[index].applicantName || (formData === null || formData === void 0 ? void 0 : (_formData$ownerKey = formData.ownerKey) === null || _formData$ownerKey === void 0 ? void 0 : _formData$ownerKey.applicantName) || "";
5726
- const emailId = formData.ownerKey && formData.ownerKey[index] && formData.ownerKey[index].emailId || (formData === null || formData === void 0 ? void 0 : (_formData$ownerKey2 = formData.ownerKey) === null || _formData$ownerKey2 === void 0 ? void 0 : _formData$ownerKey2.emailId) || "";
5727
- const mobileNumber = formData.ownerKey && formData.ownerKey[index] && formData.ownerKey[index].mobileNumber || (formData === null || formData === void 0 ? void 0 : (_formData$ownerKey3 = formData.ownerKey) === null || _formData$ownerKey3 === void 0 ? void 0 : _formData$ownerKey3.mobileNumber) || (user === null || user === void 0 ? void 0 : user.mobileNumber);
5728
- const altMobileNumber = formData.ownerKey && formData.ownerKey[index] && formData.ownerKey[index].altMobileNumber || (formData === null || formData === void 0 ? void 0 : (_formData$ownerKey4 = formData.ownerKey) === null || _formData$ownerKey4 === void 0 ? void 0 : _formData$ownerKey4.altmobileNumber) || "";
5729
- const _useState = useState(""),
5730
- VendorCategory = _useState[0],
5731
- setVendorCategory = _useState[1];
5732
- const _useState2 = useState(""),
5733
- VendorId = _useState2[0],
5734
- setVendorId = _useState2[1];
5735
- const _useState3 = useState(""),
5736
- userName = _useState3[0],
5737
- setUserName = _useState3[1];
5738
- const _useState4 = useState(""),
5739
- Bank = _useState4[0],
5740
- setBank = _useState4[1];
5741
- const _useState5 = useState(),
5742
- BankbranchName = _useState5[0],
5743
- setBankbranchName = _useState5[1];
5744
- const _useState6 = useState(""),
5745
- IFSC = _useState6[0],
5746
- setIFSC = _useState6[1];
5747
- const _useState7 = useState(""),
5748
- AccountNo = _useState7[0],
5749
- setAccountNo = _useState7[1];
5750
- const _useState8 = useState(""),
5751
- PanNo = _useState8[0],
5752
- setPanNo = _useState8[1];
5753
- const _useState9 = useState(""),
5754
- GstNo = _useState9[0],
5755
- setGstNo = _useState9[1];
5756
- const _useState0 = useState(""),
5757
- GstState = _useState0[0],
5758
- setGstState = _useState0[1];
5759
- const _useState1 = useState(""),
5760
- RegistrationNo = _useState1[0],
5761
- setRegistrationNo = _useState1[1];
5762
- const _useState10 = useState(""),
5763
- EpfNo = _useState10[0],
5764
- setEpfNo = _useState10[1];
5765
- const _useState11 = useState(""),
5766
- EsiNo = _useState11[0],
5767
- setEsiNo = _useState11[1];
5768
- const _useState12 = useState(""),
5769
- VendorType = _useState12[0],
5770
- setVendorType = _useState12[1];
5771
- const _useState13 = useState(""),
5772
- Status = _useState13[0],
5773
- setStatus = _useState13[1];
5774
- const _useState14 = useState(""),
5775
- micrNo = _useState14[0],
5776
- setmicrNo = _useState14[1];
5777
- const _useState15 = useState(""),
5778
- PhoneNo = _useState15[0],
5779
- setPhoneNo = _useState15[1];
5780
- const _useState16 = useState(""),
5781
- ContactPerson = _useState16[0],
5782
- setContactPerson = _useState16[1];
5620
+ }, [genderTypeData]);
5621
+ const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVendorUpdate(tenantId),
5622
+ mutate = _Digit$Hooks$fsm$useV.mutate;
5623
+ const _Digit$Hooks$useToast = Digit.Hooks.useToast(),
5624
+ setToast = _Digit$Hooks$useToast.setToast;
5783
5625
  useEffect(() => {
5784
- if (IFSC.length === 11 && !Bank && !BankbranchName && !micrNo) {
5785
- fetch("https://ifsc.razorpay.com/" + IFSC).then(response => response.json()).then(data => {
5786
- if (data && data.BANK && data.BRANCH && data.MICR) {
5787
- setBank(data.BANK);
5788
- setBankbranchName(data.BRANCH);
5789
- setmicrNo(data.MICR);
5790
- }
5791
- }).catch(() => {});
5626
+ setMutationHappened(false);
5627
+ clearSuccessData();
5628
+ clearError();
5629
+ }, []);
5630
+ useEffect(() => {
5631
+ if (dsoData && dsoData[0]) {
5632
+ var _dsoData$, _dsoDetails$additiona, _dsoDetails$additiona2, _dsoDetails$address, _dsoDetails$address2, _dsoDetails$address3, _dsoDetails$address4, _dsoDetails$address4$, _dsoDetails$address5, _dsoDetails$address6, _dsoDetails$address7, _dsoDetails$address8, _dsoDetails$address8$, _dsoDetails$address9, _dsoDetails$address9$, _dsoDetails$address$g, _dsoDetails$address$g2, _dsoDetails$owner, _dsoDetails$owner2, _dsoDetails$owner3, _dsoDetails$owner4, _dsoDetails$owner5, _dsoDetails$owner6, _dsoDetails$owner7, _dsoDetails$owner8, _dsoDetails$owner9, _dsoDetails$additiona3;
5633
+ const dsoDetails = (_dsoData$ = dsoData[0]) === null || _dsoData$ === void 0 ? void 0 : _dsoData$.dsoDetails;
5634
+ setDsoDetails(dsoDetails);
5635
+ const serviceType = {
5636
+ i18nKey: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$additiona = dsoDetails.additionalDetails) === null || _dsoDetails$additiona === void 0 ? void 0 : _dsoDetails$additiona.serviceType.toUpperCase(),
5637
+ code: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$additiona2 = dsoDetails.additionalDetails) === null || _dsoDetails$additiona2 === void 0 ? void 0 : _dsoDetails$additiona2.serviceType
5638
+ };
5639
+ const values = {
5640
+ vendorName: dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.name,
5641
+ propertyAddress: {
5642
+ pincode: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address = dsoDetails.address) === null || _dsoDetails$address === void 0 ? void 0 : _dsoDetails$address.pincode) || "",
5643
+ city: {
5644
+ code: tenantId,
5645
+ name: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address2 = dsoDetails.address) === null || _dsoDetails$address2 === void 0 ? void 0 : _dsoDetails$address2.city,
5646
+ i18nKey: "TENANT_TENANTS_" + tenantId.toUpperCase().replace(".", "_")
5647
+ },
5648
+ locality: _extends({}, dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address3 = dsoDetails.address) === null || _dsoDetails$address3 === void 0 ? void 0 : _dsoDetails$address3.locality, {
5649
+ i18nkey: (dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.tenantId.toUpperCase().split(".").join("_")) + "_REVENUE_" + (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address4 = dsoDetails.address) === null || _dsoDetails$address4 === void 0 ? void 0 : (_dsoDetails$address4$ = _dsoDetails$address4.locality) === null || _dsoDetails$address4$ === void 0 ? void 0 : _dsoDetails$address4$.code)
5650
+ }),
5651
+ houseNo: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address5 = dsoDetails.address) === null || _dsoDetails$address5 === void 0 ? void 0 : _dsoDetails$address5.doorNo) || "",
5652
+ streetName: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address6 = dsoDetails.address) === null || _dsoDetails$address6 === void 0 ? void 0 : _dsoDetails$address6.street) || "",
5653
+ landmark: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address7 = dsoDetails.address) === null || _dsoDetails$address7 === void 0 ? void 0 : _dsoDetails$address7.landmark) || "",
5654
+ latitude: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address8 = dsoDetails.address) === null || _dsoDetails$address8 === void 0 ? void 0 : (_dsoDetails$address8$ = _dsoDetails$address8.geoLocation) === null || _dsoDetails$address8$ === void 0 ? void 0 : _dsoDetails$address8$.latitude) || "",
5655
+ longitude: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address9 = dsoDetails.address) === null || _dsoDetails$address9 === void 0 ? void 0 : (_dsoDetails$address9$ = _dsoDetails$address9.geoLocation) === null || _dsoDetails$address9$ === void 0 ? void 0 : _dsoDetails$address9$.longitude) || ""
5656
+ },
5657
+ cpt: {
5658
+ details: {
5659
+ address: {
5660
+ pincode: dsoDetails.address.pincode,
5661
+ city: {
5662
+ code: tenantId,
5663
+ name: dsoDetails.address.city,
5664
+ i18nKey: "TENANT_TENANTS_" + tenantId.toUpperCase().replace(".", "_")
5665
+ },
5666
+ locality: _extends({}, dsoDetails.address.locality, {
5667
+ i18nKey: dsoDetails.tenantId.toUpperCase().replace(".", "_") + "_REVENUE_" + dsoDetails.address.locality.code
5668
+ }),
5669
+ houseNo: dsoDetails.address.doorNo,
5670
+ street: dsoDetails.address.street,
5671
+ landmark: dsoDetails.address.landmark,
5672
+ geoLocation: {
5673
+ latitude: (_dsoDetails$address$g = dsoDetails.address.geoLocation) === null || _dsoDetails$address$g === void 0 ? void 0 : _dsoDetails$address$g.latitude,
5674
+ longitude: (_dsoDetails$address$g2 = dsoDetails.address.geoLocation) === null || _dsoDetails$address$g2 === void 0 ? void 0 : _dsoDetails$address$g2.longitude
5675
+ }
5676
+ },
5677
+ additionalDetails: {
5678
+ assembly: "",
5679
+ block: "",
5680
+ zone: ""
5681
+ }
5682
+ }
5683
+ },
5684
+ phone: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner = dsoDetails.owner) === null || _dsoDetails$owner === void 0 ? void 0 : _dsoDetails$owner.mobileNumber,
5685
+ ownerName: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner2 = dsoDetails.owner) === null || _dsoDetails$owner2 === void 0 ? void 0 : _dsoDetails$owner2.name,
5686
+ contractEndDate: Digit.DateUtils.ConvertTimestampToDate(dsoDetails.contractEndDate, "yyyy-MM-dd"),
5687
+ contractStartDate: Digit.DateUtils.ConvertTimestampToDate(dsoDetails.contractStartDate, "yyyy-MM-dd"),
5688
+ fatherOrHusbandName: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner3 = dsoDetails.owner) === null || _dsoDetails$owner3 === void 0 ? void 0 : _dsoDetails$owner3.fatherOrHusbandName,
5689
+ relationship: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner4 = dsoDetails.owner) === null || _dsoDetails$owner4 === void 0 ? void 0 : _dsoDetails$owner4.relationship,
5690
+ gender: genderMenu.find(ele => ele.code === dsoDetails.owner.gender),
5691
+ dob: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner5 = dsoDetails.owner) === null || _dsoDetails$owner5 === void 0 ? void 0 : _dsoDetails$owner5.dob) && Digit.DateUtils.ConvertTimestampToDate(dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner6 = dsoDetails.owner) === null || _dsoDetails$owner6 === void 0 ? void 0 : _dsoDetails$owner6.dob, "yyyy-MM-dd"),
5692
+ emailId: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner7 = dsoDetails.owner) === null || _dsoDetails$owner7 === void 0 ? void 0 : _dsoDetails$owner7.emailId) === "abc@egov.com" ? "" : dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner8 = dsoDetails.owner) === null || _dsoDetails$owner8 === void 0 ? void 0 : _dsoDetails$owner8.emailId,
5693
+ correspondenceAddress: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner9 = dsoDetails.owner) === null || _dsoDetails$owner9 === void 0 ? void 0 : _dsoDetails$owner9.correspondenceAddress,
5694
+ additionalDetails: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$additiona3 = dsoDetails.additionalDetails) === null || _dsoDetails$additiona3 === void 0 ? void 0 : _dsoDetails$additiona3.description,
5695
+ vendorId: dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.vendor_id,
5696
+ serviceType: serviceType,
5697
+ zoneIds: dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.zoneIds
5698
+ };
5699
+ setDefaultValues(values);
5700
+ }
5701
+ }, [dsoData]);
5702
+ useEffect(() => {
5703
+ var _dsoDetails$zoneIds;
5704
+ if (!zones.length || !((_dsoDetails$zoneIds = dsoDetails.zoneIds) !== null && _dsoDetails$zoneIds !== void 0 && _dsoDetails$zoneIds.length)) return;
5705
+ if (typeof dsoDetails.zoneIds[0] === "object") return;
5706
+ setDefaultValues(prev => _extends({}, prev, {
5707
+ zoneIds: zones.filter(z => {
5708
+ var _prev$zoneIds;
5709
+ return prev === null || prev === void 0 ? void 0 : (_prev$zoneIds = prev.zoneIds) === null || _prev$zoneIds === void 0 ? void 0 : _prev$zoneIds.includes(z.name);
5710
+ })
5711
+ }));
5712
+ }, [dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.zoneIds, zones]);
5713
+ const onFormValueChange = (setValue, data) => {
5714
+ var _data$propertyAddress, _data$propertyAddress2, _data$serviceType, _data$serviceType2;
5715
+ const isAddressFilled = (data === null || data === void 0 ? void 0 : (_data$propertyAddress = data.propertyAddress) === null || _data$propertyAddress === void 0 ? void 0 : _data$propertyAddress.city) && (data === null || data === void 0 ? void 0 : (_data$propertyAddress2 = data.propertyAddress) === null || _data$propertyAddress2 === void 0 ? void 0 : _data$propertyAddress2.locality);
5716
+ const isVendorDetailsFilled = (data === null || data === void 0 ? void 0 : data.vendorName) && (data === null || data === void 0 ? void 0 : data.phone) && (data === null || data === void 0 ? void 0 : (_data$serviceType = data.serviceType) === null || _data$serviceType === void 0 ? void 0 : _data$serviceType.code);
5717
+ const isEkyc = (data === null || data === void 0 ? void 0 : (_data$serviceType2 = data.serviceType) === null || _data$serviceType2 === void 0 ? void 0 : _data$serviceType2.code) === "EKYC";
5718
+ let isEkycFieldsFilled = true;
5719
+ if (isEkyc) {
5720
+ var _data$zoneIds, _data$clusterIds;
5721
+ isEkycFieldsFilled = (data === null || data === void 0 ? void 0 : data.ownerName) && (data === null || data === void 0 ? void 0 : data.contractStartDate) && (data === null || data === void 0 ? void 0 : data.contractEndDate) && (data === null || data === void 0 ? void 0 : (_data$zoneIds = data.zoneIds) === null || _data$zoneIds === void 0 ? void 0 : _data$zoneIds.length) > 0 && (data === null || data === void 0 ? void 0 : (_data$clusterIds = data.clusterIds) === null || _data$clusterIds === void 0 ? void 0 : _data$clusterIds.length) > 0 && (data === null || data === void 0 ? void 0 : data.gender) && (data === null || data === void 0 ? void 0 : data.dob);
5722
+ }
5723
+ if (isVendorDetailsFilled && isAddressFilled && isEkycFieldsFilled) {
5724
+ setCanSubmit(true);
5792
5725
  } else {
5793
- if (IFSC.length === 11 && Bank && BankbranchName) {
5794
- setBank(Bank);
5795
- setBankbranchName(BankbranchName);
5796
- setmicrNo(micrNo);
5797
- } else {
5798
- setBank("");
5799
- setBankbranchName("");
5800
- setmicrNo("");
5801
- }
5726
+ setCanSubmit(false);
5802
5727
  }
5803
- }, [IFSC]);
5804
- function setvendorbank(e) {
5805
- setBank(e.target.value);
5806
- }
5807
- function setBankbranch(e) {
5808
- setBankbranchName(e.target.value);
5809
- }
5810
- function setvendorifsc(e) {
5811
- const input = e.target.value.replace(/[^a-zA-Z0-9]/g, "");
5812
- if (input.length <= 11) {
5813
- setIFSC(input);
5814
- }
5815
- }
5816
- function setvendoraccountno(e) {
5817
- setAccountNo(e.target.value);
5818
- }
5819
- function setpanno(e) {
5820
- setPanNo(e.target.value);
5821
- }
5822
- function setgstno(e) {
5823
- setGstNo(e.target.value);
5824
- }
5825
- function setgststate(e) {
5826
- setGstState(e.target.value);
5827
- }
5828
- function setregistrationno(e) {
5829
- setRegistrationNo(e.target.value);
5830
- }
5831
- function setepfno(e) {
5832
- setEpfNo(e.target.value);
5833
- }
5834
- function setesino(e) {
5835
- setEsiNo(e.target.value);
5836
- }
5837
- function setcontactperson(e) {
5838
- setContactPerson(e.target.value);
5839
- }
5840
- const tenantId = Digit.ULBService.getCurrentTenantId();
5841
- const _useForm = useForm(),
5842
- control = _useForm.control;
5843
- const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
5844
- staleTime: Infinity
5845
- }),
5846
- dsoData = _Digit$Hooks$fsm$useD.data;
5847
- useEffect(() => {
5848
- if (dsoData) {
5849
- const vendor = dsoData.find(item => item.id);
5850
- if (vendor) {
5851
- setUserName(vendor.name);
5852
- setVendorId(vendor.id);
5853
- }
5854
- }
5855
- }, [dsoData]);
5856
- const goNext = () => {
5857
- let owner = formData.ownerKey && formData.ownerKey[index];
5858
- let ownerStep;
5859
- if (userType === "citizen") {
5860
- ownerStep = _extends({}, owner, {
5861
- applicantName,
5862
- mobileNumber,
5863
- altMobileNumber,
5864
- emailId
5865
- });
5866
- onSelect(config.key, _extends({}, formData[config.key], ownerStep), false, index);
5867
- } else {
5868
- ownerStep = _extends({}, owner, {
5869
- VendorCategory,
5870
- name: userName,
5871
- VendorId: VendorId,
5872
- Bank,
5873
- BankbranchName,
5874
- IFSC,
5875
- AccountNo,
5876
- PanNo,
5877
- GstNo,
5878
- GstState,
5879
- RegistrationNo,
5880
- EpfNo,
5881
- EsiNo,
5882
- VendorType,
5883
- Status,
5884
- micrNo,
5885
- PhoneNo,
5886
- ContactPerson
5728
+ };
5729
+ const closeToast = () => {
5730
+ setShowToast(null);
5731
+ };
5732
+ const onSubmit = data => {
5733
+ var _address$city, _address$city2, _address$city3, _address$city4, _address$locality, _address$locality2, _address$ward, _address$ward2, _mergedData$plotNo, _mergedData$buildingN, _mergedData$serviceTy, _mergedData$address, _mergedData$address2, _mergedData$relations, _mergedData$gender, _mergedData$serviceTy2;
5734
+ const mergedData = data;
5735
+ const address = mergedData === null || mergedData === void 0 ? void 0 : mergedData.propertyAddress;
5736
+ const pincode = address === null || address === void 0 ? void 0 : address.pincode;
5737
+ const street = address === null || address === void 0 ? void 0 : address.streetName;
5738
+ const doorNo = address === null || address === void 0 ? void 0 : address.houseNo;
5739
+ const landmark = address === null || address === void 0 ? void 0 : address.landmark;
5740
+ const city = address === null || address === void 0 ? void 0 : (_address$city = address.city) === null || _address$city === void 0 ? void 0 : _address$city.name;
5741
+ const state = address === null || address === void 0 ? void 0 : (_address$city2 = address.city) === null || _address$city2 === void 0 ? void 0 : _address$city2.name;
5742
+ const district = address === null || address === void 0 ? void 0 : (_address$city3 = address.city) === null || _address$city3 === void 0 ? void 0 : _address$city3.name;
5743
+ const region = address === null || address === void 0 ? void 0 : (_address$city4 = address.city) === null || _address$city4 === void 0 ? void 0 : _address$city4.name;
5744
+ const localityCode = address === null || address === void 0 ? void 0 : (_address$locality = address.locality) === null || _address$locality === void 0 ? void 0 : _address$locality.code;
5745
+ const localityName = address === null || address === void 0 ? void 0 : (_address$locality2 = address.locality) === null || _address$locality2 === void 0 ? void 0 : _address$locality2.name;
5746
+ const localityArea = address === null || address === void 0 ? void 0 : address.subLocality;
5747
+ const wardCode = address === null || address === void 0 ? void 0 : (_address$ward = address.ward) === null || _address$ward === void 0 ? void 0 : _address$ward.code;
5748
+ const wardName = address === null || address === void 0 ? void 0 : (_address$ward2 = address.ward) === null || _address$ward2 === void 0 ? void 0 : _address$ward2.name;
5749
+ const name = mergedData === null || mergedData === void 0 ? void 0 : mergedData.vendorName;
5750
+ const plotNo = mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$plotNo = mergedData.plotNo) === null || _mergedData$plotNo === void 0 ? void 0 : _mergedData$plotNo.trim();
5751
+ const buildingName = mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$buildingN = mergedData.buildingName) === null || _mergedData$buildingN === void 0 ? void 0 : _mergedData$buildingN.trim();
5752
+ const emailId = mergedData === null || mergedData === void 0 ? void 0 : mergedData.emailId;
5753
+ const phone = mergedData === null || mergedData === void 0 ? void 0 : mergedData.phone;
5754
+ const isEkyc = (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$serviceTy = mergedData.serviceType) === null || _mergedData$serviceTy === void 0 ? void 0 : _mergedData$serviceTy.i18nKey) === "EKYC";
5755
+ let vendorData = _extends({}, dsoDetails, {
5756
+ tenantId: tenantId,
5757
+ name,
5758
+ agencyType: "ULB",
5759
+ paymentPreference: "post-service",
5760
+ address: _extends({}, dsoDetails.address, {
5761
+ tenantId: tenantId,
5762
+ landmark,
5763
+ doorNo,
5764
+ plotNo,
5765
+ street,
5766
+ city,
5767
+ district,
5768
+ region,
5769
+ state,
5770
+ country: "india",
5771
+ pincode,
5772
+ buildingName,
5773
+ locality: _extends({}, dsoDetails.address.locality, {
5774
+ code: localityCode || "",
5775
+ name: localityName || "",
5776
+ label: "Locality",
5777
+ area: localityArea || ""
5778
+ }),
5779
+ ward: wardCode ? {
5780
+ code: wardCode,
5781
+ name: wardName
5782
+ } : undefined,
5783
+ geoLocation: _extends({}, dsoDetails.address.geoLocation, {
5784
+ latitude: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$address = mergedData.address) === null || _mergedData$address === void 0 ? void 0 : _mergedData$address.latitude) || 28.6139,
5785
+ longitude: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$address2 = mergedData.address) === null || _mergedData$address2 === void 0 ? void 0 : _mergedData$address2.longitude) || 77.209
5786
+ })
5787
+ }),
5788
+ owner: _extends({}, dsoDetails.owner, {
5789
+ tenantId: "dl",
5790
+ name: (mergedData === null || mergedData === void 0 ? void 0 : mergedData.ownerName) || name,
5791
+ fatherOrHusbandName: (mergedData === null || mergedData === void 0 ? void 0 : mergedData.fatherOrHusbandName) || name,
5792
+ relationship: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$relations = mergedData.relationship) === null || _mergedData$relations === void 0 ? void 0 : _mergedData$relations.code) || "OTHER",
5793
+ gender: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$gender = mergedData.gender) === null || _mergedData$gender === void 0 ? void 0 : _mergedData$gender.code) || "MALE",
5794
+ dob: mergedData !== null && mergedData !== void 0 && mergedData.dob ? new Date(mergedData.dob).getTime() : new Date("1/1/1970").getTime(),
5795
+ emailId: emailId || "",
5796
+ mobileNumber: phone
5797
+ }),
5798
+ additionalDetails: {
5799
+ serviceType: isEkyc ? "ekyc" : mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$serviceTy2 = mergedData.serviceType) === null || _mergedData$serviceTy2 === void 0 ? void 0 : _mergedData$serviceTy2.code
5800
+ },
5801
+ vehicles: [],
5802
+ drivers: [],
5803
+ source: isEkyc ? "eKYC Portal" : "WhatsApp"
5804
+ });
5805
+ if (isEkyc) {
5806
+ var _mergedData$zoneIds, _mergedData$clusterId;
5807
+ vendorData = _extends({}, vendorData, {
5808
+ zoneIds: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$zoneIds = mergedData.zoneIds) === null || _mergedData$zoneIds === void 0 ? void 0 : _mergedData$zoneIds.map(z => z === null || z === void 0 ? void 0 : z.name)) || [],
5809
+ clusterIds: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$clusterId = mergedData.clusterIds) === null || _mergedData$clusterId === void 0 ? void 0 : _mergedData$clusterId.map(c => {
5810
+ var _c$;
5811
+ return c === null || c === void 0 ? void 0 : (_c$ = c[1]) === null || _c$ === void 0 ? void 0 : _c$.code;
5812
+ })) || [],
5813
+ contractStartDate: mergedData.contractStartDate ? new Date(mergedData.contractStartDate).getTime() : null,
5814
+ contractEndDate: mergedData.contractEndDate ? new Date(mergedData.contractEndDate).getTime() : null
5887
5815
  });
5888
- onSelect(config.key, ownerStep, false, index);
5889
5816
  }
5890
- };
5891
- useEffect(() => {
5892
- if (userType === "citizen") {
5893
- goNext();
5817
+ const payload = {
5818
+ vendor: vendorData
5819
+ };
5820
+ if (isEkyc) {
5821
+ payload.RequestInfo = {
5822
+ apiId: "Rainmaker",
5823
+ msgId: "ekyc-vendor-create"
5824
+ };
5894
5825
  }
5895
- }, [VendorCategory, VendorId, userName, Bank, BankbranchName, IFSC, AccountNo, PanNo, GstNo, GstState, RegistrationNo, EpfNo, EsiNo, VendorType, Status, micrNo, PhoneNo, ContactPerson, userType]);
5826
+ mutate(payload, {
5827
+ onError: error => {
5828
+ setShowToast({
5829
+ key: "error",
5830
+ action: error
5831
+ });
5832
+ },
5833
+ onSuccess: () => {
5834
+ queryClient.invalidateQueries("DSO_SEARCH");
5835
+ setToast({
5836
+ key: "success",
5837
+ action: "ES_VENDOR_UPDATE_VENDOR"
5838
+ });
5839
+ history.push("/digit-ui/" + userType + "/vendor/search-vendor");
5840
+ }
5841
+ });
5842
+ };
5843
+ const config = React.useMemo(() => {
5844
+ var _defaultValues$servic;
5845
+ return VendorConfig(t, (defaultValues === null || defaultValues === void 0 ? void 0 : (_defaultValues$servic = defaultValues.serviceType) === null || _defaultValues$servic === void 0 ? void 0 : _defaultValues$servic.i18nKey) || "", genderMenu, true);
5846
+ }, [t, defaultValues === null || defaultValues === void 0 ? void 0 : (_defaultValues$servic2 = defaultValues.serviceType) === null || _defaultValues$servic2 === void 0 ? void 0 : _defaultValues$servic2.i18nKey, genderMenu]);
5847
+ if (daoDataLoading || isLoading || Object.keys(defaultValues).length === 0) {
5848
+ return /*#__PURE__*/React.createElement(Loader, null);
5849
+ }
5896
5850
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VerticalTimeline, {
5897
5851
  config: [{
5898
5852
  timeLine: [{
5899
- actions: t("VENDOR_ADDITIONAL_DETAILS"),
5853
+ actions: t("ES_FSM_REGISTRY_TITLE_EDIT_VENDOR"),
5900
5854
  currentStep: 1
5901
5855
  }]
5902
- }, {
5903
- timeLine: [{
5904
- actions: t("VENDOR_DOCUMENT_DETAILS"),
5905
- currentStep: 2
5906
- }]
5907
- }, {
5908
- timeLine: [{
5909
- actions: t("VENDOR_SUMMARY"),
5910
- currentStep: 3
5911
- }]
5912
5856
  }],
5913
5857
  currentActiveIndex: 0,
5914
5858
  showFinalStep: false
@@ -5917,356 +5861,280 @@ const VendorDetails = _ref => {
5917
5861
  flex: "1",
5918
5862
  overflowY: "auto"
5919
5863
  }
5920
- }, /*#__PURE__*/React.createElement(FormStep, {
5921
- config: config,
5922
- onSelect: goNext,
5923
- t: t,
5924
- className: "formcomposer-grid-container-form"
5925
- }, /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
5926
- className: "card-label-smaller"
5927
- }, /*#__PURE__*/React.createElement(CustomTooltip, {
5928
- label: "" + t("IFSC_CODE"),
5929
- isMandatory: false,
5930
- message: t("INVALID_IFSC_CODE_ERROR_MESSAGE")
5931
- })), /*#__PURE__*/React.createElement(TextInput, {
5932
- t: t,
5933
- type: "text",
5934
- isMandatory: false,
5935
- optionKey: "i18nKey",
5936
- name: "IFSC",
5937
- value: IFSC,
5938
- placeholder: "Enter IFSC Code",
5939
- onChange: setvendorifsc,
5940
- style: {
5941
- width: "100%"
5942
- },
5943
- maxLength: 11,
5944
- ValidationRequired: true,
5945
- validation: {
5946
- isRequired: true,
5947
- pattern: "^[A-Z]{4}0[A-Z0-9]{6}$",
5948
- type: "text",
5949
- title: t("INVALID_IFSC_CODE_ERROR_MESSAGE")
5950
- }
5951
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("VENDOR_BANK_NAME"), " ", /*#__PURE__*/React.createElement("span", {
5952
- className: "check-page-link-button"
5953
- }, "*")), /*#__PURE__*/React.createElement(TextInput, {
5954
- t: t,
5955
- type: "text",
5956
- isMandatory: false,
5957
- optionKey: "i18nKey",
5958
- name: "bankName",
5959
- placeholder: "Bank Name Auto Select",
5960
- style: {
5961
- width: "100%"
5864
+ }, /*#__PURE__*/React.createElement(FormComposer, {
5865
+ isDisabled: !canSubmit,
5866
+ label: t("ES_COMMON_APPLICATION_SUBMIT"),
5867
+ config: config.filter(i => !i.hideInEmployee).map(config => {
5868
+ return _extends({}, config, {
5869
+ body: config.body.filter(a => !a.hideInEmployee)
5870
+ });
5871
+ }),
5872
+ fieldStyle: {
5873
+ marginRight: 0
5962
5874
  },
5963
- value: Bank,
5964
- onChange: setvendorbank,
5965
- disabled: true
5966
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("VENDOR_BANK_BRANCH_NAME"), " ", /*#__PURE__*/React.createElement("span", {
5967
- className: "check-page-link-button"
5968
- }, "*")), /*#__PURE__*/React.createElement(TextInput, {
5969
- t: t,
5970
- type: "text",
5971
- isMandatory: false,
5972
- optionKey: "i18nKey",
5973
- name: "BankbranchName",
5974
- value: BankbranchName,
5975
- style: {
5976
- width: "100%"
5977
- },
5978
- placeholder: "Bank Branch Name Auto Select",
5979
- onChange: setBankbranch,
5980
- disabled: false
5981
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("VENDOR_MICR_NO"), " ", /*#__PURE__*/React.createElement("span", {
5982
- className: "check-page-link-button"
5983
- }, "*")), /*#__PURE__*/React.createElement(TextInput, {
5984
- t: t,
5985
- type: "text",
5986
- isMandatory: false,
5987
- optionKey: "i18nKey",
5988
- name: "MicrNo",
5989
- value: micrNo,
5990
- style: {
5991
- width: "100%"
5992
- },
5993
- placeholder: "MICR No",
5994
- onChange: setmicrNo,
5995
- disabled: false
5996
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("ACCOUNT_NO")), /*#__PURE__*/React.createElement(TextInput, {
5997
- t: t,
5998
- type: "text",
5999
- isMandatory: false,
6000
- optionKey: "i18nKey",
6001
- name: "AccountNo",
6002
- value: AccountNo,
6003
- onChange: setvendoraccountno,
6004
- style: {
6005
- width: "100%"
6006
- },
6007
- ValidationRequired: true,
6008
- validation: {
6009
- isRequired: true,
6010
- pattern: "[0-9]{9,18}",
6011
- type: "text",
6012
- title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE")
6013
- }
6014
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("PHONE_NO")), /*#__PURE__*/React.createElement(MobileNumber, {
6015
- value: PhoneNo,
6016
- name: "PhoneNo",
6017
- onChange: setPhoneNo,
6018
- style: {
6019
- width: "100%"
6020
- }
6021
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("CONTACT_PERSON")), /*#__PURE__*/React.createElement(TextInput, {
6022
- t: t,
6023
- type: "text",
6024
- isMandatory: false,
6025
- optionKey: "i18nKey",
6026
- name: "ContactPerson",
6027
- value: ContactPerson,
6028
- onChange: setcontactperson,
6029
- style: {
6030
- width: "100%"
6031
- },
6032
- ValidationRequired: true,
6033
- validation: {
6034
- isRequired: true,
6035
- pattern: "^[a-zA-Z0-9/-]{1,20}$",
6036
- type: "text",
6037
- title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE")
6038
- }
6039
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("PAN_NO")), /*#__PURE__*/React.createElement(TextInput, {
6040
- t: t,
6041
- type: "text",
6042
- isMandatory: false,
6043
- optionKey: "i18nKey",
6044
- name: "PanNo",
6045
- value: PanNo,
6046
- onChange: setpanno,
6047
- style: {
6048
- width: "100%"
6049
- },
6050
- ValidationRequired: true,
6051
- validation: {
6052
- isRequired: true,
6053
- pattern: "[A-Z]{5}[0-9]{4}[A-Z]{1}",
6054
- type: "text",
6055
- title: t("INVALID_PAN_NO_ERROR_MESSAGE")
6056
- }
6057
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("GST_NO")), /*#__PURE__*/React.createElement(TextInput, {
6058
- t: t,
6059
- type: "text",
6060
- isMandatory: false,
6061
- optionKey: "i18nKey",
6062
- name: "GstNo",
6063
- value: GstNo,
6064
- onChange: setgstno,
6065
- style: {
6066
- width: "100%"
6067
- },
6068
- ValidationRequired: true,
6069
- validation: {
6070
- isRequired: true,
6071
- pattern: "^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[A-Z0-9]{1}[Z]{1}[A-Z0-9]{1}$",
6072
- type: "text",
6073
- title: t("INVALID_GST_NO_ERROR_MESSAGE")
6074
- }
6075
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("GST_REGISTERED_STATE/UT")), /*#__PURE__*/React.createElement(TextInput, {
6076
- t: t,
6077
- type: "text",
6078
- isMandatory: false,
6079
- optionKey: "i18nKey",
6080
- name: "GstState",
6081
- value: GstState,
6082
- onChange: setgststate,
6083
- style: {
6084
- width: "100%"
6085
- },
6086
- ValidationRequired: true,
6087
- validation: {
6088
- isRequired: true,
6089
- pattern: "^[a-zA-Z0-9/-]{1,20}$",
6090
- type: "text",
6091
- title: t("PT_NAME_ERROR_MESSAGE")
6092
- }
6093
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("REGISTRATION_NO")), /*#__PURE__*/React.createElement(TextInput, {
6094
- t: t,
6095
- type: "text",
6096
- isMandatory: false,
6097
- optionKey: "i18nKey",
6098
- name: "RegistrationNo",
6099
- value: RegistrationNo,
6100
- onChange: setregistrationno,
6101
- style: {
6102
- width: "100%"
6103
- },
6104
- ValidationRequired: true,
6105
- validation: {
6106
- isRequired: true,
6107
- pattern: "^[a-zA-Z0-9/-]{1,20}$",
6108
- type: "text",
6109
- title: t("INVALID_REGISTRATION_NO_ERROR_MESSAGE")
6110
- }
6111
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("EPF_NO")), /*#__PURE__*/React.createElement(TextInput, {
6112
- t: t,
6113
- type: "text",
6114
- isMandatory: false,
6115
- optionKey: "i18nKey",
6116
- name: "EpfNo",
6117
- value: EpfNo,
6118
- onChange: setepfno,
6119
- style: {
6120
- width: "100%"
6121
- },
6122
- ValidationRequired: true,
6123
- validation: {
6124
- isRequired: true,
6125
- pattern: "^[a-zA-Z0-9/-]{1,15}$",
6126
- type: "text",
6127
- title: t("INVALID_EPF_NO_ERROR_MESSAGE")
6128
- }
6129
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("ESI_NO")), /*#__PURE__*/React.createElement(TextInput, {
6130
- t: t,
6131
- type: "text",
6132
- isMandatory: false,
6133
- optionKey: "i18nKey",
6134
- name: "EsiNo",
6135
- value: EsiNo,
6136
- onChange: setesino,
6137
- style: {
6138
- width: "100%"
6139
- },
6140
- ValidationRequired: true,
6141
- validation: {
6142
- isRequired: true,
6143
- pattern: "^[a-zA-Z0-9/-]{1,20}$",
6144
- type: "text",
6145
- title: t("INVALID_ESI_NO_ERROR_MESSAGE")
6146
- }
6147
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement("div", null, t("VENDOR_TYPE"), /*#__PURE__*/React.createElement("div", {
6148
- className: "tooltip",
6149
- style: {
6150
- width: "12px",
6151
- height: "5px",
6152
- marginLeft: "10px",
6153
- display: "inline-flex",
6154
- alignItems: "center"
6155
- }
6156
- }, /*#__PURE__*/React.createElement("span", {
6157
- className: "tooltiptext",
6158
- style: {
6159
- whiteSpace: "pre-wrap",
6160
- fontSize: "small",
6161
- wordWrap: "break-word",
6162
- width: "300px",
6163
- marginLeft: "15px",
6164
- marginBottom: "-10px"
6165
- }
6166
- }, "" + t("AST_CLASSIFICATION_ASSET")))), /*#__PURE__*/React.createElement(Controller, {
6167
- control: control,
6168
- name: "VendorType",
6169
- defaultValue: VendorType,
6170
- rules: {
6171
- required: t("CORE_COMMON_REQUIRED_ERRMSG")
6172
- },
6173
- render: props => /*#__PURE__*/React.createElement(Dropdown, {
6174
- selected: VendorType,
6175
- select: setVendorType,
6176
- option: [{
6177
- i18nKey: "Supplier",
6178
- code: "SUPPLIER"
6179
- }, {
6180
- i18nKey: "Contractor",
6181
- code: "CONTRACTOR"
6182
- }],
6183
- optionKey: "i18nKey",
6184
- placeholder: "Select",
6185
- t: t
6186
- })
6187
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement("div", null, t("VENOR_CATEGORY"), /*#__PURE__*/React.createElement("div", {
6188
- className: "tooltip",
6189
- style: {
6190
- width: "12px",
6191
- height: "5px",
6192
- marginLeft: "10px",
6193
- display: "inline-flex",
6194
- alignItems: "center"
6195
- }
6196
- }, /*#__PURE__*/React.createElement("span", {
6197
- className: "tooltiptext",
6198
- style: {
6199
- whiteSpace: "pre-wrap",
6200
- fontSize: "small",
6201
- wordWrap: "break-word",
6202
- width: "300px",
6203
- marginLeft: "15px",
6204
- marginBottom: "-10px"
6205
- }
6206
- }))), /*#__PURE__*/React.createElement(Controller, {
6207
- control: control,
6208
- name: "VendorCategory",
6209
- defaultValue: VendorCategory,
6210
- rules: {
6211
- required: t("CORE_COMMON_REQUIRED_ERRMSG")
6212
- },
6213
- render: props => /*#__PURE__*/React.createElement(Dropdown, {
6214
- selected: VendorCategory,
6215
- select: setVendorCategory,
6216
- option: [{
6217
- i18nKey: "Firm",
6218
- code: "FIRM"
6219
- }, {
6220
- i18nKey: "Individual",
6221
- code: "Individual"
6222
- }],
6223
- optionKey: "i18nKey",
6224
- placeholder: "Select",
6225
- t: t
6226
- })
6227
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement("div", null, t("STATUS"), /*#__PURE__*/React.createElement("div", {
6228
- className: "tooltip",
6229
- style: {
6230
- width: "12px",
6231
- height: "5px",
6232
- marginLeft: "10px",
6233
- display: "inline-flex",
6234
- alignItems: "center"
5875
+ onSubmit: onSubmit,
5876
+ defaultValues: defaultValues,
5877
+ onFormValueChange: onFormValueChange,
5878
+ noBreakLine: true
5879
+ }), showToast && /*#__PURE__*/React.createElement(Toast, {
5880
+ error: showToast.key === "error" ? true : false,
5881
+ label: t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_SUCCESS" : showToast.action),
5882
+ onClose: closeToast
5883
+ })));
5884
+ };
5885
+
5886
+ const EmployeeApp = _ref => {
5887
+ let path = _ref.path;
5888
+ const _useTranslation = useTranslation(),
5889
+ t = _useTranslation.t;
5890
+ const location = useLocation();
5891
+ sessionStorage.removeItem("revalidateddone");
5892
+ const AddDriver = Digit.ComponentRegistryService.getComponent("AddDriver");
5893
+ const AddVehicle = Digit.ComponentRegistryService.getComponent("AddVehicle");
5894
+ const DriverDetails = Digit.ComponentRegistryService.getComponent("DriverDetails");
5895
+ const VehicleDetails = Digit.ComponentRegistryService.getComponent("VehicleDetails");
5896
+ const EditDriver = Digit.ComponentRegistryService.getComponent("EditDriver");
5897
+ const EditVehicle = Digit.ComponentRegistryService.getComponent("EditVehicle");
5898
+ const getDynamicBreadcrumbs = () => {
5899
+ const pathname = location.pathname;
5900
+ let crumbs = [{
5901
+ icon: HomeIcon,
5902
+ path: "/digit-ui/employee"
5903
+ }, {
5904
+ label: t("TITLE_VENDOR_MANAGEMENT"),
5905
+ path: "/digit-ui/employee/vendor/search-vendor"
5906
+ }];
5907
+ if (pathname.includes("/registry/new-vendor")) {
5908
+ crumbs.push({
5909
+ label: t("ES_FSM_REGISTRY_TITLE_NEW_VENDOR")
5910
+ });
5911
+ } else if (pathname.includes("/search-vendor")) {
5912
+ crumbs.push({
5913
+ label: t("SEARCH_VENDOR")
5914
+ });
5915
+ } else if (pathname.includes("/registry/new-driver")) {
5916
+ crumbs.push({
5917
+ label: t("ES_FSM_REGISTRY_TITLE_NEW_DRIVER")
5918
+ });
5919
+ } else if (pathname.includes("/registry/vendor-details") || pathname.includes("/registry/modify-vendor/")) {
5920
+ crumbs.push({
5921
+ label: t("VENDOR_VENDOR_DETAILS")
5922
+ });
5923
+ } else if (pathname.includes("/registry/vehicle-details") || pathname.includes("/registry/modify-vehicle/")) {
5924
+ crumbs.push({
5925
+ label: t("VENDOR_VEHICLE_DETAILS")
5926
+ });
5927
+ } else if (pathname.includes("/registry/new-vehicle")) {
5928
+ crumbs.push({
5929
+ label: t("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE")
5930
+ });
5931
+ } else if (pathname.includes("/registry/driver-details") || pathname.includes("/registry/modify-driver/")) {
5932
+ crumbs.push({
5933
+ label: t("VENDOR_DRIVER_DETAILS")
5934
+ });
5935
+ } else if (pathname.includes("/registry/additionaldetails")) {
5936
+ crumbs.push({
5937
+ label: t("VENDOR_ADDITIONAL_DETAILS")
5938
+ });
5939
+ } else if (pathname.includes("/registry/new-supervisor")) {
5940
+ crumbs.push({
5941
+ label: t("ES_FSM_REGISTRY_TITLE_NEW_SUPERVISOR")
5942
+ });
5943
+ } else if (pathname.includes("/registry/supervisor-details") || pathname.includes("/registry/modify-supervisor/")) {
5944
+ crumbs.push({
5945
+ label: t("VENDOR_SUPERVISOR_DETAILS")
5946
+ });
5947
+ } else if (pathname.includes("/registry/new-surveyor")) {
5948
+ crumbs.push({
5949
+ label: t("ES_FSM_REGISTRY_TITLE_NEW_SURVEYOR")
5950
+ });
5951
+ } else if (pathname.includes("/registry/surveyor-details") || pathname.includes("/registry/modify-surveyor/")) {
5952
+ crumbs.push({
5953
+ label: t("VENDOR_SURVEYOR_DETAILS")
5954
+ });
6235
5955
  }
6236
- }, /*#__PURE__*/React.createElement("span", {
6237
- className: "tooltiptext",
6238
- style: {
6239
- whiteSpace: "pre-wrap",
6240
- fontSize: "small",
6241
- wordWrap: "break-word",
6242
- width: "300px",
6243
- marginLeft: "15px",
6244
- marginBottom: "-10px"
5956
+ return crumbs;
5957
+ };
5958
+ return /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
5959
+ className: "ground-container employee-app-container form-container"
5960
+ }, /*#__PURE__*/React.createElement(ModuleHeader, {
5961
+ leftContent: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ArrowLeft, {
5962
+ className: "icon"
5963
+ }), "Back"),
5964
+ onLeftClick: () => window.history.back(),
5965
+ breadcrumbs: getDynamicBreadcrumbs()
5966
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
5967
+ path: path + "/search-vendor",
5968
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5969
+ layoutClass: "normal"
5970
+ }, /*#__PURE__*/React.createElement(SearchVendor, _extends({}, props, {
5971
+ parentRoute: path
5972
+ })))
5973
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
5974
+ path: path + "/registry/new-driver",
5975
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5976
+ layoutClass: "action"
5977
+ }, /*#__PURE__*/React.createElement(AddDriver, _extends({}, props, {
5978
+ parentRoute: path
5979
+ })))
5980
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
5981
+ path: path + "/registry/new-vehicle",
5982
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
5983
+ layoutClass: "action"
5984
+ }, /*#__PURE__*/React.createElement(AddVehicle, _extends({}, props, {
5985
+ parentRoute: path
5986
+ })))
5987
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
5988
+ path: path + "/registry/additionaldetails",
5989
+ component: props => {
5990
+ const isInfoPage = props.location.pathname.includes("/info");
5991
+ return /*#__PURE__*/React.createElement(LayoutWrapper, {
5992
+ layoutClass: isInfoPage ? "action" : "normal"
5993
+ }, /*#__PURE__*/React.createElement(VENDORCreate, _extends({}, props, {
5994
+ parentRoute: path
5995
+ })));
6245
5996
  }
6246
- }, "" + t("AST_CLASSIFICATION_ASSET")))), /*#__PURE__*/React.createElement(Controller, {
6247
- control: control,
6248
- name: "Status",
6249
- defaultValue: Status,
6250
- rules: {
6251
- required: t("CORE_COMMON_REQUIRED_ERRMSG")
6252
- },
6253
- render: props => /*#__PURE__*/React.createElement(Dropdown, {
6254
- selected: Status,
6255
- select: setStatus,
6256
- option: [{
6257
- i18nKey: "Active",
6258
- code: "ACTIVE"
6259
- }, {
6260
- i18nKey: "Inactive",
6261
- code: "INACTIVE"
6262
- }],
6263
- optionKey: "i18nKey",
6264
- placeholder: "Select",
6265
- t: t
6266
- })
5997
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
5998
+ path: path + "/registry/driver-details/:id",
5999
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6000
+ layoutClass: "action"
6001
+ }, /*#__PURE__*/React.createElement(DriverDetails, _extends({}, props, {
6002
+ parentRoute: path
6003
+ })))
6004
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6005
+ path: path + "/registry/modify-driver/:id",
6006
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6007
+ layoutClass: "action"
6008
+ }, /*#__PURE__*/React.createElement(EditDriver, _extends({}, props, {
6009
+ parentRoute: path
6010
+ })))
6011
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6012
+ path: path + "/common-search/:id",
6013
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6014
+ layoutClass: "normal"
6015
+ }, /*#__PURE__*/React.createElement(SearchApp, _extends({}, props, {
6016
+ parentRoute: path
6017
+ })))
6018
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6019
+ path: path + "/registry/new-vendor",
6020
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6021
+ layoutClass: "action"
6022
+ }, /*#__PURE__*/React.createElement(AddVendor, _extends({}, props, {
6023
+ parentRoute: path
6024
+ })))
6025
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6026
+ path: path + "/registry/vendor-details/:id",
6027
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6028
+ layoutClass: "action"
6029
+ }, /*#__PURE__*/React.createElement(VendorDetails, _extends({}, props, {
6030
+ parentRoute: path
6031
+ })))
6032
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6033
+ path: path + "/registry/modify-vendor/:id",
6034
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6035
+ layoutClass: "action"
6036
+ }, /*#__PURE__*/React.createElement(EditVendor, _extends({}, props, {
6037
+ parentRoute: path
6038
+ })))
6039
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6040
+ path: path + "/registry/vehicle-details/:id",
6041
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6042
+ layoutClass: "action"
6043
+ }, /*#__PURE__*/React.createElement(VehicleDetails, _extends({}, props, {
6044
+ parentRoute: path
6045
+ })))
6046
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6047
+ path: path + "/registry/modify-vehicle/:id",
6048
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6049
+ layoutClass: "action"
6050
+ }, /*#__PURE__*/React.createElement(EditVehicle, _extends({}, props, {
6051
+ parentRoute: path
6052
+ })))
6053
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6054
+ path: path + "/registry/new-supervisor",
6055
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6056
+ layoutClass: "action"
6057
+ }, /*#__PURE__*/React.createElement(AddSupervisor, _extends({}, props, {
6058
+ parentRoute: path
6059
+ })))
6060
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6061
+ path: path + "/registry/supervisor-details/:id",
6062
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6063
+ layoutClass: "action"
6064
+ }, /*#__PURE__*/React.createElement(SupervisorDetails, _extends({}, props, {
6065
+ parentRoute: path
6066
+ })))
6067
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6068
+ path: path + "/registry/modify-supervisor/:id",
6069
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6070
+ layoutClass: "action"
6071
+ }, /*#__PURE__*/React.createElement(EditSupervisor, _extends({}, props, {
6072
+ parentRoute: path
6073
+ })))
6074
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6075
+ path: path + "/registry/new-surveyor",
6076
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6077
+ layoutClass: "action"
6078
+ }, /*#__PURE__*/React.createElement(AddSurveyor, _extends({}, props, {
6079
+ parentRoute: path
6080
+ })))
6081
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6082
+ path: path + "/registry/surveyor-details/:id",
6083
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6084
+ layoutClass: "action"
6085
+ }, /*#__PURE__*/React.createElement(SurveyorDetails, _extends({}, props, {
6086
+ parentRoute: path
6087
+ })))
6088
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
6089
+ path: path + "/registry/modify-surveyor/:id",
6090
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
6091
+ layoutClass: "action"
6092
+ }, /*#__PURE__*/React.createElement(EditSurveyor, _extends({}, props, {
6093
+ parentRoute: path
6094
+ })))
6267
6095
  })))));
6268
6096
  };
6269
6097
 
6098
+ const VENDORCard = () => {
6099
+ const _useTranslation = useTranslation(),
6100
+ t = _useTranslation.t;
6101
+ const history = useHistory();
6102
+ const isCitizen = window.location.pathname.toLowerCase().includes("citizen");
6103
+ let hasAccess = Digit.Utils.vendorAccess() || Digit.UserService.hasAccess(["WT_VENDOR", "MT_VENDOR"]);
6104
+ if (isCitizen) {
6105
+ hasAccess = Digit.UserService.hasAccess(["WT_VENDOR", "EKYC_VENDOR", "EKYC_SUPERVISOR"]);
6106
+ }
6107
+ if (!hasAccess) {
6108
+ return null;
6109
+ }
6110
+ const links = [{
6111
+ label: t("VENDOR_NEW_REGISTERATION"),
6112
+ link: isCitizen ? "/digit-ui/citizen/vendor/registry/new-vendor" : "/digit-ui/employee/vendor/registry/new-vendor"
6113
+ }, {
6114
+ label: t("SEARCH_VENDOR"),
6115
+ link: isCitizen ? "/digit-ui/citizen/vendor/search-vendor" : "/digit-ui/employee/vendor/search-vendor"
6116
+ }];
6117
+ const VENDORRole = Digit.UserService.hasAccess(["WT_VENDOR"]);
6118
+ const propsForModuleCard = _extends({
6119
+ Icon: /*#__PURE__*/React.createElement(PropertyHouse, null),
6120
+ moduleName: t("TITLE_VENDOR_MANAGEMENT"),
6121
+ kpis: [{
6122
+ count: 0,
6123
+ label: t("Inbox"),
6124
+ link: isCitizen ? "/digit-ui/citizen/vendor/search-vendor" : "/digit-ui/employee/vendor/search-vendor"
6125
+ }],
6126
+ links: links.filter(link => !(link !== null && link !== void 0 && link.role) || VENDORRole)
6127
+ }, isCitizen ? {
6128
+ onDetailsClick: () => history.push("/digit-ui/citizen/vendor/search-vendor")
6129
+ } : {});
6130
+ if (isCitizen) {
6131
+ return /*#__PURE__*/React.createElement("div", {
6132
+ className: "wt-citizen-card-premium"
6133
+ }, /*#__PURE__*/React.createElement(EmployeeModuleCard, propsForModuleCard));
6134
+ }
6135
+ return /*#__PURE__*/React.createElement(EmployeeModuleCard, propsForModuleCard);
6136
+ };
6137
+
6270
6138
  const VendorDocuments = _ref => {
6271
6139
  var _formData$documents;
6272
6140
  let t = _ref.t,
@@ -7300,7 +7168,14 @@ const CitizenVendorApp = () => {
7300
7168
  path: path + "/registry/vendor-details/:id",
7301
7169
  component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
7302
7170
  layoutClass: "action"
7303
- }, /*#__PURE__*/React.createElement(EditVendorDetails, _extends({}, props, {
7171
+ }, /*#__PURE__*/React.createElement(VendorDetails, _extends({}, props, {
7172
+ parentRoute: path
7173
+ })))
7174
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
7175
+ path: path + "/registry/modify-vendor/:id",
7176
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
7177
+ layoutClass: "action"
7178
+ }, /*#__PURE__*/React.createElement(EditVendor, _extends({}, props, {
7304
7179
  parentRoute: path
7305
7180
  })))
7306
7181
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
@@ -7452,8 +7327,6 @@ const CheckPage = _ref2 => {
7452
7327
  t = _useTranslation2.t;
7453
7328
  const vendordet = value.vendordet,
7454
7329
  documents = value.documents;
7455
- console.log("vendordetailssppsss", vendordet);
7456
- console.log("documents", documents);
7457
7330
  const _useState = useState(false),
7458
7331
  agree = _useState[0],
7459
7332
  setAgree = _useState[1];
@@ -8045,12 +7918,12 @@ const AddDriver = () => {
8045
7918
  })));
8046
7919
  };
8047
7920
 
8048
- const Heading$3 = props => {
7921
+ const Heading$2 = props => {
8049
7922
  return /*#__PURE__*/React.createElement("h1", {
8050
7923
  className: "heading-m"
8051
7924
  }, props.label);
8052
7925
  };
8053
- const CloseBtn$2 = props => {
7926
+ const CloseBtn$1 = props => {
8054
7927
  return /*#__PURE__*/React.createElement("div", {
8055
7928
  onClick: props.onClick
8056
7929
  }, /*#__PURE__*/React.createElement(CloseSvg, null));
@@ -8392,10 +8265,10 @@ const DriverDetails = () => {
8392
8265
  }, t(value.value) || "N/A"));
8393
8266
  }))));
8394
8267
  }))), showModal && /*#__PURE__*/React.createElement(Modal, {
8395
- headerBarMain: /*#__PURE__*/React.createElement(Heading$3, {
8268
+ headerBarMain: /*#__PURE__*/React.createElement(Heading$2, {
8396
8269
  label: t(modalHeading())
8397
8270
  }),
8398
- headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$2, {
8271
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$1, {
8399
8272
  onClick: closeModal
8400
8273
  }),
8401
8274
  actionCancelLabel: t("CS_COMMON_CANCEL"),
@@ -8564,958 +8437,1516 @@ const VehicleConfig = function (t, disabled) {
8564
8437
  required: true,
8565
8438
  pattern: /^[6-9]\d{9}$/
8566
8439
  },
8567
- error: t("FSM_REGISTRY_INVALID_PHONE"),
8568
- defaultValue: ""
8569
- }
8570
- }, {
8571
- label: "ES_FSM_REGISTRY_NEW_GENDER",
8572
- isMandatory: true,
8573
- type: "component",
8574
- route: "select-gender",
8575
- hideInEmployee: false,
8576
- key: "selectGender",
8577
- component: "SelectGender"
8578
- }, {
8579
- label: t("ES_FSM_REGISTRY_NEW_DOB"),
8580
- isMandatory: true,
8581
- type: "custom",
8582
- key: "dob",
8583
- populators: {
8584
- name: "dob",
8585
- validation: {
8586
- required: true
8440
+ error: t("FSM_REGISTRY_INVALID_PHONE"),
8441
+ defaultValue: ""
8442
+ }
8443
+ }, {
8444
+ label: "ES_FSM_REGISTRY_NEW_GENDER",
8445
+ isMandatory: true,
8446
+ type: "component",
8447
+ route: "select-gender",
8448
+ hideInEmployee: false,
8449
+ key: "selectGender",
8450
+ component: "SelectGender"
8451
+ }, {
8452
+ label: t("ES_FSM_REGISTRY_NEW_DOB"),
8453
+ isMandatory: true,
8454
+ type: "custom",
8455
+ key: "dob",
8456
+ populators: {
8457
+ name: "dob",
8458
+ validation: {
8459
+ required: true
8460
+ },
8461
+ component: (props, customProps) => /*#__PURE__*/React.createElement(DatePicker$3, _extends({
8462
+ onChange: props.onChange,
8463
+ date: props.value
8464
+ }, customProps, {
8465
+ max: (() => {
8466
+ const date = new Date();
8467
+ date.setFullYear(date.getFullYear() - 18);
8468
+ return date.toISOString().split("T")[0];
8469
+ })()
8470
+ }))
8471
+ }
8472
+ }, {
8473
+ label: "ES_FSM_REGISTRY_NEW_EMAIL",
8474
+ isMandatory: false,
8475
+ type: "text",
8476
+ key: "emailId",
8477
+ populators: {
8478
+ name: "emailId",
8479
+ validation: {
8480
+ required: false,
8481
+ pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
8482
+ },
8483
+ error: t("FSM_REGISTRY_INVALID_EMAIL"),
8484
+ defaultValue: ""
8485
+ }
8486
+ }]
8487
+ }];
8488
+ };
8489
+
8490
+ const AddVehicle = _ref => {
8491
+ var _Digit$UserService$ge, _Digit$UserService$ge2;
8492
+ const tenantId = Digit.ULBService.getCurrentTenantId();
8493
+ const stateId = Digit.ULBService.getStateId();
8494
+ const _useState = useState(null),
8495
+ showToast = _useState[0],
8496
+ setShowToast = _useState[1];
8497
+ const history = useHistory();
8498
+ const _useTranslation = useTranslation(),
8499
+ t = _useTranslation.t;
8500
+ const queryClient = useQueryClient();
8501
+ const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED", false),
8502
+ setMutationHappened = _Digit$Hooks$useSessi[1];
8503
+ const _Digit$Hooks$useSessi2 = Digit.Hooks.useSessionStorage("FSM_ERROR_DATA", false),
8504
+ clearError = _Digit$Hooks$useSessi2[2];
8505
+ const _Digit$Hooks$useSessi3 = Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA", false),
8506
+ clearSuccessData = _Digit$Hooks$useSessi3[2];
8507
+ const isCitizen = Digit.UserService.getType() === "WT_VENDOR" || Digit.UserService.hasAccess(["WT_VENDOR"]);
8508
+ const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVehicleCreate(stateId),
8509
+ mutate = _Digit$Hooks$fsm$useV.mutate;
8510
+ const _Digit$Hooks$fsm$useV2 = Digit.Hooks.fsm.useVendorUpdate("dl.djb"),
8511
+ mutateVendor = _Digit$Hooks$fsm$useV2.mutate;
8512
+ const mobileNumber = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : (_Digit$UserService$ge2 = _Digit$UserService$ge.info) === null || _Digit$UserService$ge2 === void 0 ? void 0 : _Digit$UserService$ge2.mobileNumber;
8513
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
8514
+ mobileNumber: mobileNumber
8515
+ }, {
8516
+ enabled: !!(isCitizen && mobileNumber)
8517
+ }),
8518
+ vendorData = _Digit$Hooks$fsm$useD.data;
8519
+ useEffect(() => {
8520
+ setMutationHappened(false);
8521
+ clearSuccessData();
8522
+ clearError();
8523
+ }, []);
8524
+ const Config = VehicleConfig(t);
8525
+ Config[0].body.forEach(item => {
8526
+ if (item.label === "ES_FSM_REGISTRY_VEHICLE_NUMBER") {
8527
+ item.labelChildren = /*#__PURE__*/React.createElement("div", {
8528
+ className: "tooltip",
8529
+ style: {
8530
+ paddingLeft: "10px",
8531
+ marginBottom: "-3px"
8532
+ }
8533
+ }, /*#__PURE__*/React.createElement(InfoIcon, null), /*#__PURE__*/React.createElement("span", {
8534
+ className: "tooltiptext",
8535
+ style: {
8536
+ width: "320px",
8537
+ left: "230%",
8538
+ fontSize: "14px"
8539
+ }
8540
+ }, item.populators.validation.title));
8541
+ }
8542
+ });
8543
+ const _useState2 = useState(false),
8544
+ canSubmit = _useState2[0],
8545
+ setSubmitValve = _useState2[1];
8546
+ const defaultValues = {
8547
+ serviceType: {
8548
+ code: "WT",
8549
+ name: "WT",
8550
+ i18nKey: "WT"
8551
+ },
8552
+ tripData: {
8553
+ noOfTrips: 1,
8554
+ amountPerTrip: null,
8555
+ amount: null
8556
+ }
8557
+ };
8558
+ const formatVehicleNumber = input => {
8559
+ const cleaned = input.toUpperCase().replace(/[^A-Z0-9]/g, "");
8560
+ if (cleaned.length <= 2) return cleaned;
8561
+ const state = cleaned.slice(0, 2);
8562
+ const rest = cleaned.slice(2);
8563
+ if (!rest) return state;
8564
+ const rtoMatch = rest.match(/^(\d{1,2})/);
8565
+ if (!rtoMatch) return state + "-" + rest;
8566
+ const rtoDigits = rtoMatch[1];
8567
+ const afterRto = rest.slice(rtoDigits.length);
8568
+ const lettersMatch = afterRto.match(/^([A-Z]*)/);
8569
+ const middleLetters = lettersMatch ? lettersMatch[1] : "";
8570
+ const number = afterRto.slice(middleLetters.length);
8571
+ if (!number) {
8572
+ return state + "-" + rtoDigits + middleLetters;
8573
+ }
8574
+ if (middleLetters.length >= 3) {
8575
+ const splitAt = middleLetters.length <= 3 ? 1 : 2;
8576
+ const series = middleLetters.slice(0, splitAt);
8577
+ const subSeries = middleLetters.slice(splitAt);
8578
+ return state + "-" + rtoDigits + series + "-" + subSeries + "-" + number.slice(0, 4);
8579
+ }
8580
+ return state + "-" + rtoDigits + middleLetters + "-" + number.slice(0, 4);
8581
+ };
8582
+ const onFormValueChange = (setValue, formData) => {
8583
+ var _formData$vehicle, _formData$vehicle2;
8584
+ if (formData !== null && formData !== void 0 && formData.registrationNumber) {
8585
+ let updatedRegNo = formatVehicleNumber(formData.registrationNumber);
8586
+ if (updatedRegNo.length > 15) {
8587
+ updatedRegNo = updatedRegNo.slice(0, 15);
8588
+ }
8589
+ if (updatedRegNo !== formData.registrationNumber) {
8590
+ setValue("registrationNumber", updatedRegNo);
8591
+ }
8592
+ }
8593
+ if (formData !== null && formData !== void 0 && formData.registrationNumber && formData !== null && formData !== void 0 && formData.ownerName && formData !== null && formData !== void 0 && formData.phone && formData !== null && formData !== void 0 && (_formData$vehicle = formData.vehicle) !== null && _formData$vehicle !== void 0 && _formData$vehicle.modal && formData !== null && formData !== void 0 && (_formData$vehicle2 = formData.vehicle) !== null && _formData$vehicle2 !== void 0 && _formData$vehicle2.type && formData !== null && formData !== void 0 && formData.selectGender && formData !== null && formData !== void 0 && formData.dob && new Date(formData === null || formData === void 0 ? void 0 : formData.dob).getTime() <= new Date().setFullYear(new Date().getFullYear() - 18)) {
8594
+ setSubmitValve(true);
8595
+ } else {
8596
+ setSubmitValve(false);
8597
+ }
8598
+ };
8599
+ const closeToast = () => {
8600
+ setShowToast(null);
8601
+ };
8602
+ const onSubmit = data => {
8603
+ var _data$vehicle, _data$vehicle$type, _data$vehicle2, _data$vehicle2$modal, _data$vehicle3, _data$vehicle3$type, _data$serviceType, _data$selectGender;
8604
+ const registrationNumber = data === null || data === void 0 ? void 0 : data.registrationNumber;
8605
+ const vehicleType = data === null || data === void 0 ? void 0 : (_data$vehicle = data.vehicle) === null || _data$vehicle === void 0 ? void 0 : (_data$vehicle$type = _data$vehicle.type) === null || _data$vehicle$type === void 0 ? void 0 : _data$vehicle$type.code;
8606
+ const vehicleModal = data === null || data === void 0 ? void 0 : (_data$vehicle2 = data.vehicle) === null || _data$vehicle2 === void 0 ? void 0 : (_data$vehicle2$modal = _data$vehicle2.modal) === null || _data$vehicle2$modal === void 0 ? void 0 : _data$vehicle2$modal.code;
8607
+ const tankCapacity = data === null || data === void 0 ? void 0 : (_data$vehicle3 = data.vehicle) === null || _data$vehicle3 === void 0 ? void 0 : (_data$vehicle3$type = _data$vehicle3.type) === null || _data$vehicle3$type === void 0 ? void 0 : _data$vehicle3$type.capacity;
8608
+ const pollutionCert = new Date("" + (data === null || data === void 0 ? void 0 : data.pollutionCert)).getTime();
8609
+ const insurance = new Date("" + (data === null || data === void 0 ? void 0 : data.insurance)).getTime();
8610
+ const roadTax = new Date("" + (data === null || data === void 0 ? void 0 : data.roadTax)).getTime();
8611
+ const fitnessValidity = new Date("" + (data === null || data === void 0 ? void 0 : data.fitnessValidity)).getTime();
8612
+ const ownerName = data === null || data === void 0 ? void 0 : data.ownerName;
8613
+ const phone = data === null || data === void 0 ? void 0 : data.phone;
8614
+ const additionalDetails = data === null || data === void 0 ? void 0 : (_data$serviceType = data.serviceType) === null || _data$serviceType === void 0 ? void 0 : _data$serviceType.code;
8615
+ const gender = data === null || data === void 0 ? void 0 : (_data$selectGender = data.selectGender) === null || _data$selectGender === void 0 ? void 0 : _data$selectGender.code;
8616
+ const emailId = data === null || data === void 0 ? void 0 : data.emailId;
8617
+ const dob = new Date("" + data.dob).getTime() || new Date("1/1/1970").getTime();
8618
+ const formData = {
8619
+ vehicle: {
8620
+ tenantId: "dl.djb",
8621
+ registrationNumber: registrationNumber,
8622
+ model: vehicleModal,
8623
+ type: vehicleType,
8624
+ tankCapacity: tankCapacity,
8625
+ suctionType: "SEWER_SUCTION_MACHINE",
8626
+ pollutionCertiValidTill: pollutionCert,
8627
+ InsuranceCertValidTill: insurance,
8628
+ fitnessValidTill: fitnessValidity,
8629
+ roadTaxPaidTill: roadTax,
8630
+ gpsEnabled: true,
8631
+ source: "Municipal records",
8632
+ owner: {
8633
+ tenantId: stateId,
8634
+ name: ownerName,
8635
+ fatherOrHusbandName: ownerName,
8636
+ relationship: "OTHER",
8637
+ correspondenceAddress: "",
8638
+ mobileNumber: phone,
8639
+ gender: gender,
8640
+ dob: dob,
8641
+ emailId: emailId || "abc@egov.com"
8642
+ },
8643
+ additionalDetails: {
8644
+ serviceType: additionalDetails
8587
8645
  },
8588
- component: (props, customProps) => /*#__PURE__*/React.createElement(DatePicker$3, _extends({
8589
- onChange: props.onChange,
8590
- date: props.value
8591
- }, customProps, {
8592
- max: (() => {
8593
- const date = new Date();
8594
- date.setFullYear(date.getFullYear() - 18);
8595
- return date.toISOString().split("T")[0];
8596
- })()
8597
- }))
8646
+ vehicleOwner: "ULB"
8598
8647
  }
8599
- }, {
8600
- label: "ES_FSM_REGISTRY_NEW_EMAIL",
8601
- isMandatory: false,
8602
- type: "text",
8603
- key: "emailId",
8604
- populators: {
8605
- name: "emailId",
8606
- validation: {
8607
- required: false,
8608
- pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
8609
- },
8610
- error: t("FSM_REGISTRY_INVALID_EMAIL"),
8611
- defaultValue: ""
8648
+ };
8649
+ mutate(formData, {
8650
+ onError: (error, variables) => {
8651
+ var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
8652
+ const errorMessage = (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.Errors) === null || _error$response$data$ === void 0 ? void 0 : (_error$response$data$2 = _error$response$data$[0]) === null || _error$response$data$2 === void 0 ? void 0 : _error$response$data$2.message) || (error === null || error === void 0 ? void 0 : error.message) || "An error occurred";
8653
+ setShowToast({
8654
+ key: "error",
8655
+ action: errorMessage
8656
+ });
8657
+ setTimeout(closeToast, 5000);
8658
+ },
8659
+ onSuccess: (data, variables) => {
8660
+ var _data$Errors, _data$data, _data$data$Errors, _vendorData$;
8661
+ const isError = (data === null || data === void 0 ? void 0 : data.error) === true || (data === null || data === void 0 ? void 0 : (_data$Errors = data.Errors) === null || _data$Errors === void 0 ? void 0 : _data$Errors.length) > 0 || (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : (_data$data$Errors = _data$data.Errors) === null || _data$data$Errors === void 0 ? void 0 : _data$data$Errors.length) > 0;
8662
+ if (isError) {
8663
+ var _data$data2, _data$data2$Errors, _data$data2$Errors$, _data$Errors2, _data$Errors2$;
8664
+ const errorMessage = (data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : (_data$data2$Errors = _data$data2.Errors) === null || _data$data2$Errors === void 0 ? void 0 : (_data$data2$Errors$ = _data$data2$Errors[0]) === null || _data$data2$Errors$ === void 0 ? void 0 : _data$data2$Errors$.message) || (data === null || data === void 0 ? void 0 : (_data$Errors2 = data.Errors) === null || _data$Errors2 === void 0 ? void 0 : (_data$Errors2$ = _data$Errors2[0]) === null || _data$Errors2$ === void 0 ? void 0 : _data$Errors2$.message) || (data === null || data === void 0 ? void 0 : data.message) || "An error occurred";
8665
+ setShowToast({
8666
+ key: "error",
8667
+ action: errorMessage
8668
+ });
8669
+ setTimeout(closeToast, 5000);
8670
+ return;
8671
+ }
8672
+ setShowToast({
8673
+ key: "success",
8674
+ action: "ADD_VEHICLE"
8675
+ });
8676
+ queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
8677
+ if (isCitizen && vendorData !== null && vendorData !== void 0 && (_vendorData$ = vendorData[0]) !== null && _vendorData$ !== void 0 && _vendorData$.dsoDetails) {
8678
+ var _data$vehicle4;
8679
+ const newVehicle = (data === null || data === void 0 ? void 0 : (_data$vehicle4 = data.vehicle) === null || _data$vehicle4 === void 0 ? void 0 : _data$vehicle4.map(v => _extends({}, v, {
8680
+ vendorVehicleStatus: "ACTIVE",
8681
+ status: "ACTIVE"
8682
+ }))) || [];
8683
+ const vendor = vendorData[0].dsoDetails;
8684
+ const updatedVendor = {
8685
+ vendor: _extends({}, vendor, {
8686
+ vehicles: vendor.vehicles ? [...vendor.vehicles, ...newVehicle] : [...newVehicle]
8687
+ })
8688
+ };
8689
+ mutateVendor(updatedVendor, {
8690
+ onError: error => {
8691
+ var _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
8692
+ const errorMessage = (error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : (_error$response2$data2 = _error$response2$data.Errors) === null || _error$response2$data2 === void 0 ? void 0 : (_error$response2$data3 = _error$response2$data2[0]) === null || _error$response2$data3 === void 0 ? void 0 : _error$response2$data3.message) || (error === null || error === void 0 ? void 0 : error.message) || "An error occurred";
8693
+ setShowToast({
8694
+ key: "error",
8695
+ action: errorMessage
8696
+ });
8697
+ setTimeout(closeToast, 5000);
8698
+ },
8699
+ onSuccess: vendorDataRes => {
8700
+ var _vendorDataRes$Errors, _vendorDataRes$data, _vendorDataRes$data$E, _Digit$UserService$ge3, _Digit$UserService$ge4, _Digit$UserService$ge5;
8701
+ const isError = (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : vendorDataRes.error) === true || (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : (_vendorDataRes$Errors = vendorDataRes.Errors) === null || _vendorDataRes$Errors === void 0 ? void 0 : _vendorDataRes$Errors.length) > 0 || (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : (_vendorDataRes$data = vendorDataRes.data) === null || _vendorDataRes$data === void 0 ? void 0 : (_vendorDataRes$data$E = _vendorDataRes$data.Errors) === null || _vendorDataRes$data$E === void 0 ? void 0 : _vendorDataRes$data$E.length) > 0;
8702
+ if (isError) {
8703
+ var _vendorDataRes$data2, _vendorDataRes$data2$, _vendorDataRes$data2$2, _vendorDataRes$Errors2, _vendorDataRes$Errors3;
8704
+ const errorMessage = (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : (_vendorDataRes$data2 = vendorDataRes.data) === null || _vendorDataRes$data2 === void 0 ? void 0 : (_vendorDataRes$data2$ = _vendorDataRes$data2.Errors) === null || _vendorDataRes$data2$ === void 0 ? void 0 : (_vendorDataRes$data2$2 = _vendorDataRes$data2$[0]) === null || _vendorDataRes$data2$2 === void 0 ? void 0 : _vendorDataRes$data2$2.message) || (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : (_vendorDataRes$Errors2 = vendorDataRes.Errors) === null || _vendorDataRes$Errors2 === void 0 ? void 0 : (_vendorDataRes$Errors3 = _vendorDataRes$Errors2[0]) === null || _vendorDataRes$Errors3 === void 0 ? void 0 : _vendorDataRes$Errors3.message) || (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : vendorDataRes.message) || "An error occurred";
8705
+ setShowToast({
8706
+ key: "error",
8707
+ action: errorMessage
8708
+ });
8709
+ setTimeout(closeToast, 5000);
8710
+ return;
8711
+ }
8712
+ setShowToast({
8713
+ key: "success",
8714
+ action: "ADD_VEHICLE"
8715
+ });
8716
+ queryClient.invalidateQueries("DSO_SEARCH");
8717
+ const userType = ((_Digit$UserService$ge3 = Digit.UserService.getUser()) === null || _Digit$UserService$ge3 === void 0 ? void 0 : (_Digit$UserService$ge4 = _Digit$UserService$ge3.info) === null || _Digit$UserService$ge4 === void 0 ? void 0 : (_Digit$UserService$ge5 = _Digit$UserService$ge4.type) === null || _Digit$UserService$ge5 === void 0 ? void 0 : _Digit$UserService$ge5.toLowerCase()) || "citizen";
8718
+ setTimeout(() => {
8719
+ closeToast();
8720
+ history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=VEHICLE");
8721
+ }, 3000);
8722
+ }
8723
+ });
8724
+ } else {
8725
+ var _Digit$UserService$ge6, _Digit$UserService$ge7, _Digit$UserService$ge8;
8726
+ const userType = ((_Digit$UserService$ge6 = Digit.UserService.getUser()) === null || _Digit$UserService$ge6 === void 0 ? void 0 : (_Digit$UserService$ge7 = _Digit$UserService$ge6.info) === null || _Digit$UserService$ge7 === void 0 ? void 0 : (_Digit$UserService$ge8 = _Digit$UserService$ge7.type) === null || _Digit$UserService$ge8 === void 0 ? void 0 : _Digit$UserService$ge8.toLowerCase()) || "citizen";
8727
+ queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
8728
+ setTimeout(() => {
8729
+ closeToast();
8730
+ history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=VEHICLE");
8731
+ }, 3000);
8732
+ }
8612
8733
  }
8613
- }]
8614
- }];
8734
+ });
8735
+ };
8736
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VerticalTimeline, {
8737
+ config: [{
8738
+ route: "vendor-details",
8739
+ timeLine: [{
8740
+ actions: t("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE"),
8741
+ currentStep: 1
8742
+ }]
8743
+ }],
8744
+ currentActiveIndex: 0,
8745
+ showFinalStep: false
8746
+ }), /*#__PURE__*/React.createElement("div", {
8747
+ style: {
8748
+ flex: "1",
8749
+ overflowY: "auto"
8750
+ }
8751
+ }, /*#__PURE__*/React.createElement(FormComposer, {
8752
+ isDisabled: !canSubmit,
8753
+ label: t("ES_COMMON_APPLICATION_SUBMIT"),
8754
+ config: Config.filter(i => !i.hideInEmployee).map(config => {
8755
+ return _extends({}, config, {
8756
+ isCollapsible: true,
8757
+ isDefaultOpen: true,
8758
+ body: config.body.filter(a => !a.hideInEmployee)
8759
+ });
8760
+ }),
8761
+ fieldStyle: {
8762
+ marginRight: 0
8763
+ },
8764
+ onSubmit: onSubmit,
8765
+ defaultValues: defaultValues,
8766
+ onFormValueChange: onFormValueChange,
8767
+ noBreakLine: true,
8768
+ mode: "onChange",
8769
+ noCard: true
8770
+ }), showToast && /*#__PURE__*/React.createElement(Toast, {
8771
+ error: showToast.key === "error" ? true : false,
8772
+ label: t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_SUCCESS" : showToast.action),
8773
+ onClose: closeToast
8774
+ })));
8615
8775
  };
8616
8776
 
8617
- const AddVehicle = _ref => {
8618
- var _Digit$UserService$ge, _Digit$UserService$ge2;
8777
+ const Heading$3 = props => {
8778
+ return /*#__PURE__*/React.createElement("h1", {
8779
+ className: "heading-m"
8780
+ }, props.label);
8781
+ };
8782
+ const CloseBtn$2 = props => {
8783
+ return /*#__PURE__*/React.createElement("div", {
8784
+ onClick: props.onClick
8785
+ }, /*#__PURE__*/React.createElement(CloseSvg, null));
8786
+ };
8787
+ const VehicleDetails = props => {
8788
+ var _vehicleData$6, _vehicleData$6$employ;
8619
8789
  const tenantId = Digit.ULBService.getCurrentTenantId();
8620
- const stateId = Digit.ULBService.getStateId();
8621
- const _useState = useState(null),
8622
- showToast = _useState[0],
8623
- setShowToast = _useState[1];
8624
- const history = useHistory();
8625
8790
  const _useTranslation = useTranslation(),
8626
8791
  t = _useTranslation.t;
8792
+ const history = useHistory();
8627
8793
  const queryClient = useQueryClient();
8628
- const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED", false),
8629
- setMutationHappened = _Digit$Hooks$useSessi[1];
8630
- const _Digit$Hooks$useSessi2 = Digit.Hooks.useSessionStorage("FSM_ERROR_DATA", false),
8631
- clearError = _Digit$Hooks$useSessi2[2];
8632
- const _Digit$Hooks$useSessi3 = Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA", false),
8633
- clearSuccessData = _Digit$Hooks$useSessi3[2];
8634
- const isCitizen = Digit.UserService.getType() === "WT_VENDOR" || Digit.UserService.hasAccess(["WT_VENDOR"]);
8635
- const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVehicleCreate(stateId),
8636
- mutate = _Digit$Hooks$fsm$useV.mutate;
8637
- const _Digit$Hooks$fsm$useV2 = Digit.Hooks.fsm.useVendorUpdate("dl.djb"),
8638
- mutateVendor = _Digit$Hooks$fsm$useV2.mutate;
8639
- const mobileNumber = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : (_Digit$UserService$ge2 = _Digit$UserService$ge.info) === null || _Digit$UserService$ge2 === void 0 ? void 0 : _Digit$UserService$ge2.mobileNumber;
8640
- const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
8641
- mobileNumber: mobileNumber
8794
+ let _useParams = useParams(),
8795
+ vehicleNumber = _useParams.id;
8796
+ const _useState = useState(false),
8797
+ displayMenu = _useState[0],
8798
+ setDisplayMenu = _useState[1];
8799
+ const _useState2 = useState(null),
8800
+ selectedAction = _useState2[0],
8801
+ setSelectedAction = _useState2[1];
8802
+ const _useState3 = useState(false),
8803
+ showModal = _useState3[0],
8804
+ setShowModal = _useState3[1];
8805
+ const _useState4 = useState(null),
8806
+ showToast = _useState4[0],
8807
+ setShowToast = _useState4[1];
8808
+ const _useState5 = useState([]),
8809
+ vendors = _useState5[0],
8810
+ setVendors = _useState5[1];
8811
+ const _useState6 = useState({}),
8812
+ selectedOption = _useState6[0],
8813
+ setSelectedOption = _useState6[1];
8814
+ const _useState7 = useState(null),
8815
+ vehicleId = _useState7[0],
8816
+ setVehicleId = _useState7[1];
8817
+ const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVehicleDetails(tenantId, {
8818
+ registrationNumber: vehicleNumber
8642
8819
  }, {
8643
- enabled: !!(isCitizen && mobileNumber)
8820
+ staleTime: Infinity
8644
8821
  }),
8822
+ vehicleData = _Digit$Hooks$fsm$useV.data,
8823
+ isLoading = _Digit$Hooks$fsm$useV.isLoading,
8824
+ refetch = _Digit$Hooks$fsm$useV.refetch;
8825
+ useEffect(() => {
8826
+ if (!isLoading && vehicleData) {
8827
+ var _vehicleData$, _vehicleData$$vehicle;
8828
+ setVehicleId(vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$ = vehicleData[0]) === null || _vehicleData$ === void 0 ? void 0 : (_vehicleData$$vehicle = _vehicleData$.vehicleData) === null || _vehicleData$$vehicle === void 0 ? void 0 : _vehicleData$$vehicle.id);
8829
+ }
8830
+ }, [vehicleData, isLoading]);
8831
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
8832
+ sortBy: "name",
8833
+ sortOrder: "ASC",
8834
+ status: "ACTIVE"
8835
+ }, {}),
8645
8836
  vendorData = _Digit$Hooks$fsm$useD.data;
8646
8837
  useEffect(() => {
8647
- setMutationHappened(false);
8648
- clearSuccessData();
8649
- clearError();
8650
- }, []);
8651
- const Config = VehicleConfig(t);
8652
- Config[0].body.forEach(item => {
8653
- if (item.label === "ES_FSM_REGISTRY_VEHICLE_NUMBER") {
8654
- item.labelChildren = /*#__PURE__*/React.createElement("div", {
8655
- className: "tooltip",
8656
- style: {
8657
- paddingLeft: "10px",
8658
- marginBottom: "-3px"
8659
- }
8660
- }, /*#__PURE__*/React.createElement(InfoIcon, null), /*#__PURE__*/React.createElement("span", {
8661
- className: "tooltiptext",
8662
- style: {
8663
- width: "320px",
8664
- left: "230%",
8665
- fontSize: "14px"
8666
- }
8667
- }, item.populators.validation.title));
8838
+ if (vendorData) {
8839
+ let vendors = vendorData.map(data => data.dsoDetails);
8840
+ setVendors(vendors);
8668
8841
  }
8669
- });
8670
- const _useState2 = useState(false),
8671
- canSubmit = _useState2[0],
8672
- setSubmitValve = _useState2[1];
8673
- const defaultValues = {
8674
- serviceType: {
8675
- code: "WT",
8676
- name: "WT",
8677
- i18nKey: "WT"
8678
- },
8679
- tripData: {
8680
- noOfTrips: 1,
8681
- amountPerTrip: null,
8682
- amount: null
8842
+ }, [vendorData]);
8843
+ const _Digit$Hooks$fsm$useU = Digit.Hooks.fsm.useUpdateVehicle(tenantId),
8844
+ mutate = _Digit$Hooks$fsm$useU.mutate;
8845
+ const _Digit$Hooks$fsm$useV2 = Digit.Hooks.fsm.useVendorUpdate(tenantId),
8846
+ mutateVendor = _Digit$Hooks$fsm$useV2.mutate;
8847
+ function onActionSelect(action) {
8848
+ setDisplayMenu(false);
8849
+ setSelectedAction(action);
8850
+ }
8851
+ useEffect(() => {
8852
+ refetch();
8853
+ }, []);
8854
+ useEffect(() => {
8855
+ switch (selectedAction) {
8856
+ case "DELETE":
8857
+ case "ADD_VENDOR":
8858
+ case "EDIT_VENDOR":
8859
+ case "DELETE_VENDOR":
8860
+ return setShowModal(true);
8861
+ case "EDIT":
8862
+ return history.push("/digit-ui/employee/fsm/registry/modify-vehicle/" + vehicleNumber);
8863
+ case "HOME":
8864
+ return history.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE");
8683
8865
  }
8866
+ }, [selectedAction]);
8867
+ const closeToast = () => {
8868
+ setShowToast(null);
8684
8869
  };
8685
- const formatVehicleNumber = input => {
8686
- const cleaned = input.toUpperCase().replace(/[^A-Z0-9]/g, "");
8687
- if (cleaned.length <= 2) return cleaned;
8688
- const state = cleaned.slice(0, 2);
8689
- const rest = cleaned.slice(2);
8690
- if (!rest) return state;
8691
- const rtoMatch = rest.match(/^(\d{1,2})/);
8692
- if (!rtoMatch) return state + "-" + rest;
8693
- const rtoDigits = rtoMatch[1];
8694
- const afterRto = rest.slice(rtoDigits.length);
8695
- const lettersMatch = afterRto.match(/^([A-Z]*)/);
8696
- const middleLetters = lettersMatch ? lettersMatch[1] : "";
8697
- const number = afterRto.slice(middleLetters.length);
8698
- if (!number) {
8699
- return state + "-" + rtoDigits + middleLetters;
8700
- }
8701
- if (middleLetters.length >= 3) {
8702
- const splitAt = middleLetters.length <= 3 ? 1 : 2;
8703
- const series = middleLetters.slice(0, splitAt);
8704
- const subSeries = middleLetters.slice(splitAt);
8705
- return state + "-" + rtoDigits + series + "-" + subSeries + "-" + number.slice(0, 4);
8706
- }
8707
- return state + "-" + rtoDigits + middleLetters + "-" + number.slice(0, 4);
8870
+ const closeModal = () => {
8871
+ setSelectedAction(null);
8872
+ setSelectedOption({});
8873
+ setShowModal(false);
8708
8874
  };
8709
- const onFormValueChange = (setValue, formData) => {
8710
- var _formData$vehicle, _formData$vehicle2;
8711
- if (formData !== null && formData !== void 0 && formData.registrationNumber) {
8712
- let updatedRegNo = formatVehicleNumber(formData.registrationNumber);
8713
- if (updatedRegNo.length > 15) {
8714
- updatedRegNo = updatedRegNo.slice(0, 15);
8715
- }
8716
- if (updatedRegNo !== formData.registrationNumber) {
8717
- setValue("registrationNumber", updatedRegNo);
8875
+ const handleAddVendor = () => {
8876
+ var _vehicleData$2, _dsoDetails$owner;
8877
+ let dsoDetails = selectedOption;
8878
+ let vehicleDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$2 = vehicleData[0]) === null || _vehicleData$2 === void 0 ? void 0 : _vehicleData$2.vehicleData;
8879
+ vehicleDetails.vendorVehicleStatus = "ACTIVE";
8880
+ const formData = {
8881
+ vendor: _extends({}, dsoDetails, {
8882
+ owner: _extends({}, dsoDetails.owner, {
8883
+ gender: ((_dsoDetails$owner = dsoDetails.owner) === null || _dsoDetails$owner === void 0 ? void 0 : _dsoDetails$owner.gender) || "OTHERS"
8884
+ }),
8885
+ vehicles: dsoDetails.vehicles ? [...dsoDetails.vehicles, vehicleDetails] : [vehicleDetails]
8886
+ })
8887
+ };
8888
+ mutateVendor(formData, {
8889
+ onError: (error, variables) => {
8890
+ setShowToast({
8891
+ key: "error",
8892
+ action: error
8893
+ });
8894
+ setTimeout(closeToast, 5000);
8895
+ },
8896
+ onSuccess: (data, variables) => {
8897
+ setShowToast({
8898
+ key: "success",
8899
+ action: "EDIT_VENDOR"
8900
+ });
8901
+ refetch();
8902
+ queryClient.invalidateQueries("DSO_SEARCH");
8903
+ setTimeout(closeToast, 5000);
8718
8904
  }
8719
- }
8720
- if (formData !== null && formData !== void 0 && formData.registrationNumber && formData !== null && formData !== void 0 && formData.ownerName && formData !== null && formData !== void 0 && formData.phone && formData !== null && formData !== void 0 && (_formData$vehicle = formData.vehicle) !== null && _formData$vehicle !== void 0 && _formData$vehicle.modal && formData !== null && formData !== void 0 && (_formData$vehicle2 = formData.vehicle) !== null && _formData$vehicle2 !== void 0 && _formData$vehicle2.type && formData !== null && formData !== void 0 && formData.selectGender && formData !== null && formData !== void 0 && formData.dob && new Date(formData === null || formData === void 0 ? void 0 : formData.dob).getTime() <= new Date().setFullYear(new Date().getFullYear() - 18)) {
8721
- setSubmitValve(true);
8722
- } else {
8723
- setSubmitValve(false);
8724
- }
8725
- };
8726
- const closeToast = () => {
8727
- setShowToast(null);
8905
+ });
8906
+ setShowModal(false);
8907
+ setSelectedAction(null);
8728
8908
  };
8729
- const onSubmit = data => {
8730
- var _data$vehicle, _data$vehicle$type, _data$vehicle2, _data$vehicle2$modal, _data$vehicle3, _data$vehicle3$type, _data$serviceType, _data$selectGender;
8731
- const registrationNumber = data === null || data === void 0 ? void 0 : data.registrationNumber;
8732
- const vehicleType = data === null || data === void 0 ? void 0 : (_data$vehicle = data.vehicle) === null || _data$vehicle === void 0 ? void 0 : (_data$vehicle$type = _data$vehicle.type) === null || _data$vehicle$type === void 0 ? void 0 : _data$vehicle$type.code;
8733
- const vehicleModal = data === null || data === void 0 ? void 0 : (_data$vehicle2 = data.vehicle) === null || _data$vehicle2 === void 0 ? void 0 : (_data$vehicle2$modal = _data$vehicle2.modal) === null || _data$vehicle2$modal === void 0 ? void 0 : _data$vehicle2$modal.code;
8734
- const tankCapacity = data === null || data === void 0 ? void 0 : (_data$vehicle3 = data.vehicle) === null || _data$vehicle3 === void 0 ? void 0 : (_data$vehicle3$type = _data$vehicle3.type) === null || _data$vehicle3$type === void 0 ? void 0 : _data$vehicle3$type.capacity;
8735
- const pollutionCert = new Date("" + (data === null || data === void 0 ? void 0 : data.pollutionCert)).getTime();
8736
- const insurance = new Date("" + (data === null || data === void 0 ? void 0 : data.insurance)).getTime();
8737
- const roadTax = new Date("" + (data === null || data === void 0 ? void 0 : data.roadTax)).getTime();
8738
- const fitnessValidity = new Date("" + (data === null || data === void 0 ? void 0 : data.fitnessValidity)).getTime();
8739
- const ownerName = data === null || data === void 0 ? void 0 : data.ownerName;
8740
- const phone = data === null || data === void 0 ? void 0 : data.phone;
8741
- const additionalDetails = data === null || data === void 0 ? void 0 : (_data$serviceType = data.serviceType) === null || _data$serviceType === void 0 ? void 0 : _data$serviceType.code;
8742
- const gender = data === null || data === void 0 ? void 0 : (_data$selectGender = data.selectGender) === null || _data$selectGender === void 0 ? void 0 : _data$selectGender.code;
8743
- const emailId = data === null || data === void 0 ? void 0 : data.emailId;
8744
- const dob = new Date("" + data.dob).getTime() || new Date("1/1/1970").getTime();
8909
+ const handleEditVendor = () => {
8910
+ var _vehicleData$3, _dsoDetails$owner2;
8911
+ let dsoDetails = selectedOption;
8912
+ let vehicleDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$3 = vehicleData[0]) === null || _vehicleData$3 === void 0 ? void 0 : _vehicleData$3.vehicleData;
8913
+ vehicleDetails.vendorVehicleStatus = "ACTIVE";
8745
8914
  const formData = {
8746
- vehicle: {
8747
- tenantId: "dl.djb",
8748
- registrationNumber: registrationNumber,
8749
- model: vehicleModal,
8750
- type: vehicleType,
8751
- tankCapacity: tankCapacity,
8752
- suctionType: "SEWER_SUCTION_MACHINE",
8753
- pollutionCertiValidTill: pollutionCert,
8754
- InsuranceCertValidTill: insurance,
8755
- fitnessValidTill: fitnessValidity,
8756
- roadTaxPaidTill: roadTax,
8757
- gpsEnabled: true,
8758
- source: "Municipal records",
8759
- owner: {
8760
- tenantId: stateId,
8761
- name: ownerName,
8762
- fatherOrHusbandName: ownerName,
8763
- relationship: "OTHER",
8764
- correspondenceAddress: "",
8765
- mobileNumber: phone,
8766
- gender: gender,
8767
- dob: dob,
8768
- emailId: emailId || "abc@egov.com"
8769
- },
8770
- additionalDetails: {
8771
- serviceType: additionalDetails
8772
- },
8773
- vehicleOwner: "ULB"
8915
+ vendor: _extends({}, dsoDetails, {
8916
+ owner: _extends({}, dsoDetails.owner, {
8917
+ gender: ((_dsoDetails$owner2 = dsoDetails.owner) === null || _dsoDetails$owner2 === void 0 ? void 0 : _dsoDetails$owner2.gender) || "OTHERS"
8918
+ }),
8919
+ vehicles: dsoDetails.vehicles ? [...dsoDetails.vehicles, vehicleDetails] : [vehicleDetails]
8920
+ })
8921
+ };
8922
+ mutateVendor(formData, {
8923
+ onError: (error, variables) => {
8924
+ setShowToast({
8925
+ key: "error",
8926
+ action: error
8927
+ });
8928
+ setTimeout(closeToast, 5000);
8929
+ },
8930
+ onSuccess: (data, variables) => {
8931
+ setShowToast({
8932
+ key: "success",
8933
+ action: "EDIT_VENDOR"
8934
+ });
8935
+ refetch();
8936
+ queryClient.invalidateQueries("DSO_SEARCH");
8937
+ setTimeout(closeToast, 5000);
8938
+ }
8939
+ });
8940
+ setShowModal(false);
8941
+ setSelectedAction(null);
8942
+ };
8943
+ const handleDeleteVendor = () => {
8944
+ var _vehicleData$4, _vehicleData$4$vendor, _vehicleData$4$vendor2, _dsoDetails$owner3;
8945
+ let formData = {};
8946
+ let dsoDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$4 = vehicleData[0]) === null || _vehicleData$4 === void 0 ? void 0 : (_vehicleData$4$vendor = _vehicleData$4.vendorDetails) === null || _vehicleData$4$vendor === void 0 ? void 0 : (_vehicleData$4$vendor2 = _vehicleData$4$vendor.vendor) === null || _vehicleData$4$vendor2 === void 0 ? void 0 : _vehicleData$4$vendor2[0];
8947
+ let getVehicleVendorDetails = dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.vehicles;
8948
+ getVehicleVendorDetails = getVehicleVendorDetails.map(data => {
8949
+ if (data.id === vehicleId) {
8950
+ data.vendorVehicleStatus = "INACTIVE";
8951
+ }
8952
+ return data;
8953
+ });
8954
+ formData = {
8955
+ vendor: _extends({}, dsoDetails, {
8956
+ owner: _extends({}, dsoDetails.owner, {
8957
+ gender: ((_dsoDetails$owner3 = dsoDetails.owner) === null || _dsoDetails$owner3 === void 0 ? void 0 : _dsoDetails$owner3.gender) || "OTHERS"
8958
+ }),
8959
+ vehicles: getVehicleVendorDetails
8960
+ })
8961
+ };
8962
+ mutateVendor(formData, {
8963
+ onError: (error, variables) => {
8964
+ setShowToast({
8965
+ key: "error",
8966
+ action: error
8967
+ });
8968
+ setTimeout(closeToast, 5000);
8969
+ },
8970
+ onSuccess: (data, variables) => {
8971
+ setShowToast({
8972
+ key: "success",
8973
+ action: "DELETE_VENDOR"
8974
+ });
8975
+ queryClient.invalidateQueries("FSM_VENDOR_SEARCH");
8976
+ refetch();
8977
+ setTimeout(closeToast, 5000);
8774
8978
  }
8979
+ });
8980
+ setShowModal(false);
8981
+ };
8982
+ const handleModalAction = () => {
8983
+ switch (selectedAction) {
8984
+ case "DELETE":
8985
+ return handleDelete();
8986
+ case "DELETE_VENDOR":
8987
+ return handleDeleteVendor();
8988
+ case "ADD_VENDOR":
8989
+ return handleAddVendor();
8990
+ case "EDIT_VENDOR":
8991
+ return handleEditVendor();
8992
+ }
8993
+ };
8994
+ const handleDelete = () => {
8995
+ var _vehicleData$5;
8996
+ let vehicleDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$5 = vehicleData[0]) === null || _vehicleData$5 === void 0 ? void 0 : _vehicleData$5.vehicleData;
8997
+ const formData = {
8998
+ vehicle: _extends({}, vehicleDetails, {
8999
+ status: "INACTIVE"
9000
+ })
8775
9001
  };
8776
9002
  mutate(formData, {
8777
9003
  onError: (error, variables) => {
8778
- var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
8779
- const errorMessage = (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.Errors) === null || _error$response$data$ === void 0 ? void 0 : (_error$response$data$2 = _error$response$data$[0]) === null || _error$response$data$2 === void 0 ? void 0 : _error$response$data$2.message) || (error === null || error === void 0 ? void 0 : error.message) || "An error occurred";
8780
9004
  setShowToast({
8781
9005
  key: "error",
8782
- action: errorMessage
9006
+ action: error
8783
9007
  });
8784
9008
  setTimeout(closeToast, 5000);
8785
9009
  },
8786
9010
  onSuccess: (data, variables) => {
8787
- var _data$Errors, _data$data, _data$data$Errors, _vendorData$;
8788
- const isError = (data === null || data === void 0 ? void 0 : data.error) === true || (data === null || data === void 0 ? void 0 : (_data$Errors = data.Errors) === null || _data$Errors === void 0 ? void 0 : _data$Errors.length) > 0 || (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : (_data$data$Errors = _data$data.Errors) === null || _data$data$Errors === void 0 ? void 0 : _data$data$Errors.length) > 0;
8789
- if (isError) {
8790
- var _data$data2, _data$data2$Errors, _data$data2$Errors$, _data$Errors2, _data$Errors2$;
8791
- const errorMessage = (data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : (_data$data2$Errors = _data$data2.Errors) === null || _data$data2$Errors === void 0 ? void 0 : (_data$data2$Errors$ = _data$data2$Errors[0]) === null || _data$data2$Errors$ === void 0 ? void 0 : _data$data2$Errors$.message) || (data === null || data === void 0 ? void 0 : (_data$Errors2 = data.Errors) === null || _data$Errors2 === void 0 ? void 0 : (_data$Errors2$ = _data$Errors2[0]) === null || _data$Errors2$ === void 0 ? void 0 : _data$Errors2$.message) || (data === null || data === void 0 ? void 0 : data.message) || "An error occurred";
8792
- setShowToast({
8793
- key: "error",
8794
- action: errorMessage
8795
- });
8796
- setTimeout(closeToast, 5000);
8797
- return;
8798
- }
8799
9011
  setShowToast({
8800
9012
  key: "success",
8801
- action: "ADD_VEHICLE"
9013
+ action: "DELETE_VEHICLE"
8802
9014
  });
8803
9015
  queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
8804
- if (isCitizen && vendorData !== null && vendorData !== void 0 && (_vendorData$ = vendorData[0]) !== null && _vendorData$ !== void 0 && _vendorData$.dsoDetails) {
8805
- var _data$vehicle4;
8806
- const newVehicle = (data === null || data === void 0 ? void 0 : (_data$vehicle4 = data.vehicle) === null || _data$vehicle4 === void 0 ? void 0 : _data$vehicle4.map(v => _extends({}, v, {
8807
- vendorVehicleStatus: "ACTIVE",
8808
- status: "ACTIVE"
8809
- }))) || [];
8810
- const vendor = vendorData[0].dsoDetails;
8811
- const updatedVendor = {
8812
- vendor: _extends({}, vendor, {
8813
- vehicles: vendor.vehicles ? [...vendor.vehicles, ...newVehicle] : [...newVehicle]
8814
- })
8815
- };
8816
- mutateVendor(updatedVendor, {
8817
- onError: error => {
8818
- var _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
8819
- const errorMessage = (error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : (_error$response2$data2 = _error$response2$data.Errors) === null || _error$response2$data2 === void 0 ? void 0 : (_error$response2$data3 = _error$response2$data2[0]) === null || _error$response2$data3 === void 0 ? void 0 : _error$response2$data3.message) || (error === null || error === void 0 ? void 0 : error.message) || "An error occurred";
8820
- setShowToast({
8821
- key: "error",
8822
- action: errorMessage
8823
- });
8824
- setTimeout(closeToast, 5000);
8825
- },
8826
- onSuccess: vendorDataRes => {
8827
- var _vendorDataRes$Errors, _vendorDataRes$data, _vendorDataRes$data$E, _Digit$UserService$ge3, _Digit$UserService$ge4, _Digit$UserService$ge5;
8828
- const isError = (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : vendorDataRes.error) === true || (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : (_vendorDataRes$Errors = vendorDataRes.Errors) === null || _vendorDataRes$Errors === void 0 ? void 0 : _vendorDataRes$Errors.length) > 0 || (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : (_vendorDataRes$data = vendorDataRes.data) === null || _vendorDataRes$data === void 0 ? void 0 : (_vendorDataRes$data$E = _vendorDataRes$data.Errors) === null || _vendorDataRes$data$E === void 0 ? void 0 : _vendorDataRes$data$E.length) > 0;
8829
- if (isError) {
8830
- var _vendorDataRes$data2, _vendorDataRes$data2$, _vendorDataRes$data2$2, _vendorDataRes$Errors2, _vendorDataRes$Errors3;
8831
- const errorMessage = (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : (_vendorDataRes$data2 = vendorDataRes.data) === null || _vendorDataRes$data2 === void 0 ? void 0 : (_vendorDataRes$data2$ = _vendorDataRes$data2.Errors) === null || _vendorDataRes$data2$ === void 0 ? void 0 : (_vendorDataRes$data2$2 = _vendorDataRes$data2$[0]) === null || _vendorDataRes$data2$2 === void 0 ? void 0 : _vendorDataRes$data2$2.message) || (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : (_vendorDataRes$Errors2 = vendorDataRes.Errors) === null || _vendorDataRes$Errors2 === void 0 ? void 0 : (_vendorDataRes$Errors3 = _vendorDataRes$Errors2[0]) === null || _vendorDataRes$Errors3 === void 0 ? void 0 : _vendorDataRes$Errors3.message) || (vendorDataRes === null || vendorDataRes === void 0 ? void 0 : vendorDataRes.message) || "An error occurred";
8832
- setShowToast({
8833
- key: "error",
8834
- action: errorMessage
8835
- });
8836
- setTimeout(closeToast, 5000);
8837
- return;
8838
- }
8839
- setShowToast({
8840
- key: "success",
8841
- action: "ADD_VEHICLE"
8842
- });
8843
- queryClient.invalidateQueries("DSO_SEARCH");
8844
- const userType = ((_Digit$UserService$ge3 = Digit.UserService.getUser()) === null || _Digit$UserService$ge3 === void 0 ? void 0 : (_Digit$UserService$ge4 = _Digit$UserService$ge3.info) === null || _Digit$UserService$ge4 === void 0 ? void 0 : (_Digit$UserService$ge5 = _Digit$UserService$ge4.type) === null || _Digit$UserService$ge5 === void 0 ? void 0 : _Digit$UserService$ge5.toLowerCase()) || "citizen";
8845
- setTimeout(() => {
8846
- closeToast();
8847
- history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=VEHICLE");
8848
- }, 3000);
8849
- }
8850
- });
8851
- } else {
8852
- var _Digit$UserService$ge6, _Digit$UserService$ge7, _Digit$UserService$ge8;
8853
- const userType = ((_Digit$UserService$ge6 = Digit.UserService.getUser()) === null || _Digit$UserService$ge6 === void 0 ? void 0 : (_Digit$UserService$ge7 = _Digit$UserService$ge6.info) === null || _Digit$UserService$ge7 === void 0 ? void 0 : (_Digit$UserService$ge8 = _Digit$UserService$ge7.type) === null || _Digit$UserService$ge8 === void 0 ? void 0 : _Digit$UserService$ge8.toLowerCase()) || "citizen";
8854
- queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
8855
- setTimeout(() => {
8856
- closeToast();
8857
- history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=VEHICLE");
8858
- }, 3000);
8859
- }
9016
+ setTimeout(() => {
9017
+ closeToast();
9018
+ history.push("/digit-ui/employee/fsm/registry");
9019
+ }, 5000);
8860
9020
  }
8861
9021
  });
9022
+ setShowModal(false);
8862
9023
  };
8863
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VerticalTimeline, {
8864
- config: [{
8865
- route: "vendor-details",
8866
- timeLine: [{
8867
- actions: t("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE"),
8868
- currentStep: 1
8869
- }]
8870
- }],
8871
- currentActiveIndex: 0,
8872
- showFinalStep: false
8873
- }), /*#__PURE__*/React.createElement("div", {
9024
+ const renderModalContent = () => {
9025
+ if (selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR") {
9026
+ return /*#__PURE__*/React.createElement(ConfirmationBox, {
9027
+ t: t,
9028
+ title: "ES_FSM_REGISTRY_DELETE_TEXT"
9029
+ });
9030
+ }
9031
+ if (selectedAction === "ADD_VENDOR") {
9032
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t("ES_FSM_REGISTRY_SELECT_VENODOR")), /*#__PURE__*/React.createElement(Dropdown, {
9033
+ t: t,
9034
+ option: vendors,
9035
+ value: selectedOption,
9036
+ selected: selectedOption,
9037
+ select: setSelectedOption,
9038
+ optionKey: "name"
9039
+ }));
9040
+ }
9041
+ if (selectedAction === "EDIT_VENDOR") {
9042
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t("ES_FSM_REGISTRY_SELECT_VENODOR")), /*#__PURE__*/React.createElement(Dropdown, {
9043
+ t: t,
9044
+ option: vendors,
9045
+ value: selectedOption,
9046
+ selected: selectedOption,
9047
+ select: setSelectedOption,
9048
+ optionKey: "name"
9049
+ }));
9050
+ }
9051
+ };
9052
+ const modalHeading = () => {
9053
+ switch (selectedAction) {
9054
+ case "DELETE":
9055
+ case "DELETE_VENDOR":
9056
+ return "ES_FSM_REGISTRY_DELETE_POPUP_HEADER";
9057
+ case "ADD_VENDOR":
9058
+ return "ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER";
9059
+ case "EDIT_VENDOR":
9060
+ return "ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER";
9061
+ }
9062
+ };
9063
+ if (isLoading) {
9064
+ return /*#__PURE__*/React.createElement(Loader, null);
9065
+ }
9066
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !isLoading ? /*#__PURE__*/React.createElement("div", {
9067
+ className: "employee-form-content"
9068
+ }, /*#__PURE__*/React.createElement(Card, {
9069
+ className: "vehicle-details-card",
8874
9070
  style: {
8875
- flex: "1",
8876
- overflowY: "auto"
9071
+ position: "relative"
8877
9072
  }
8878
- }, /*#__PURE__*/React.createElement(FormComposer, {
8879
- isDisabled: !canSubmit,
8880
- label: t("ES_COMMON_APPLICATION_SUBMIT"),
8881
- config: Config.filter(i => !i.hideInEmployee).map(config => {
8882
- return _extends({}, config, {
8883
- isCollapsible: true,
8884
- isDefaultOpen: true,
8885
- body: config.body.filter(a => !a.hideInEmployee)
8886
- });
9073
+ }, vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$6 = vehicleData[0]) === null || _vehicleData$6 === void 0 ? void 0 : (_vehicleData$6$employ = _vehicleData$6.employeeResponse) === null || _vehicleData$6$employ === void 0 ? void 0 : _vehicleData$6$employ.map((detail, index) => {
9074
+ var _detail$values;
9075
+ return /*#__PURE__*/React.createElement(React.Fragment, {
9076
+ key: index
9077
+ }, index > 0 && /*#__PURE__*/React.createElement(CardSectionHeader, {
9078
+ style: {
9079
+ marginBottom: "16px",
9080
+ marginTop: "32px"
9081
+ }
9082
+ }, t(detail.title)), /*#__PURE__*/React.createElement(Card, {
9083
+ className: "card-with-background",
9084
+ style: {
9085
+ margin: "10px 16px",
9086
+ padding: "20px"
9087
+ }
9088
+ }, /*#__PURE__*/React.createElement("div", {
9089
+ className: "additional-grid"
9090
+ }, detail === null || detail === void 0 ? void 0 : (_detail$values = detail.values) === null || _detail$values === void 0 ? void 0 : _detail$values.map((value, index) => {
9091
+ return (value === null || value === void 0 ? void 0 : value.type) === "custom" ? /*#__PURE__*/React.createElement(React.Fragment, {
9092
+ key: index
9093
+ }, /*#__PURE__*/React.createElement("div", {
9094
+ className: "additional-label"
9095
+ }, t(value.title)), /*#__PURE__*/React.createElement("div", {
9096
+ className: "additional-value",
9097
+ style: {
9098
+ display: "flex",
9099
+ alignItems: "center",
9100
+ gap: "8px"
9101
+ }
9102
+ }, value.value === "ES_FSM_REGISTRY_DETAILS_ADD_VENDOR" && /*#__PURE__*/React.createElement("div", {
9103
+ onClick: () => onActionSelect("ADD_VENDOR"),
9104
+ style: {
9105
+ color: "#a82227",
9106
+ display: "flex",
9107
+ alignItems: "center",
9108
+ gap: "8px",
9109
+ cursor: "pointer"
9110
+ }
9111
+ }, /*#__PURE__*/React.createElement(AddIcon, {
9112
+ className: "",
9113
+ fill: "#a82227"
9114
+ }), " ", t(value.value) || "N/A"), value.value !== "ES_FSM_REGISTRY_DETAILS_ADD_VENDOR" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, value.value), /*#__PURE__*/React.createElement("div", {
9115
+ className: "add-details-link hover-button",
9116
+ onClick: () => onActionSelect("EDIT_VENDOR"),
9117
+ style: {
9118
+ cursor: "pointer"
9119
+ }
9120
+ }, /*#__PURE__*/React.createElement(EditIcon, {
9121
+ fill: "#a82227"
9122
+ })), /*#__PURE__*/React.createElement("div", {
9123
+ className: "add-details-link hover-button",
9124
+ onClick: () => onActionSelect("DELETE_VENDOR"),
9125
+ style: {
9126
+ cursor: "pointer"
9127
+ }
9128
+ }, /*#__PURE__*/React.createElement(DeleteIcon, {
9129
+ className: "delete",
9130
+ fill: "#a82227"
9131
+ }))))) : /*#__PURE__*/React.createElement(React.Fragment, {
9132
+ key: index
9133
+ }, /*#__PURE__*/React.createElement("div", {
9134
+ className: "additional-label"
9135
+ }, t(value.title)), /*#__PURE__*/React.createElement("div", {
9136
+ className: "additional-value",
9137
+ style: value.value === "ACTIVE" ? {
9138
+ color: "green"
9139
+ } : {}
9140
+ }, t(value.value) || "N/A"));
9141
+ }))));
9142
+ })), showModal && /*#__PURE__*/React.createElement(Modal, {
9143
+ headerBarMain: /*#__PURE__*/React.createElement(Heading$3, {
9144
+ label: t(modalHeading())
8887
9145
  }),
8888
- fieldStyle: {
8889
- marginRight: 0
8890
- },
8891
- onSubmit: onSubmit,
8892
- defaultValues: defaultValues,
8893
- onFormValueChange: onFormValueChange,
8894
- noBreakLine: true,
8895
- mode: "onChange",
8896
- noCard: true
8897
- }), showToast && /*#__PURE__*/React.createElement(Toast, {
9146
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$2, {
9147
+ onClick: closeModal
9148
+ }),
9149
+ actionCancelLabel: t("CS_COMMON_CANCEL"),
9150
+ actionCancelOnSubmit: closeModal,
9151
+ actionSaveLabel: t(selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? "ES_EVENT_DELETE" : "CS_COMMON_SUBMIT"),
9152
+ actionSaveOnSubmit: handleModalAction
9153
+ }, selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? renderModalContent() : /*#__PURE__*/React.createElement(Card, {
9154
+ style: {
9155
+ boxShadow: "none"
9156
+ }
9157
+ }, renderModalContent())), showToast && /*#__PURE__*/React.createElement(Toast, {
8898
9158
  error: showToast.key === "error" ? true : false,
8899
9159
  label: t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_SUCCESS" : showToast.action),
8900
9160
  onClose: closeToast
8901
- })));
9161
+ }), /*#__PURE__*/React.createElement(ActionBar, {
9162
+ style: {
9163
+ zIndex: "19"
9164
+ }
9165
+ }, displayMenu ? /*#__PURE__*/React.createElement(Menu, {
9166
+ localeKeyPrefix: "ES_FSM_REGISTRY_ACTION",
9167
+ options: ["EDIT", "DELETE"],
9168
+ t: t,
9169
+ onSelect: onActionSelect
9170
+ }) : null, /*#__PURE__*/React.createElement(SubmitBar, {
9171
+ label: t("ES_COMMON_TAKE_ACTION"),
9172
+ onSubmit: () => setDisplayMenu(!displayMenu)
9173
+ }))) : /*#__PURE__*/React.createElement(Loader, null));
8902
9174
  };
8903
9175
 
8904
- const Heading$4 = props => {
8905
- return /*#__PURE__*/React.createElement("h1", {
8906
- className: "heading-m"
8907
- }, props.label);
8908
- };
8909
- const CloseBtn$3 = props => {
8910
- return /*#__PURE__*/React.createElement("div", {
8911
- onClick: props.onClick
8912
- }, /*#__PURE__*/React.createElement(CloseSvg, null));
8913
- };
8914
- const VehicleDetails = props => {
8915
- var _vehicleData$6, _vehicleData$6$employ;
9176
+ const SelectEkycZones = _ref => {
9177
+ let config = _ref.config,
9178
+ onSelect = _ref.onSelect,
9179
+ t = _ref.t,
9180
+ formData = _ref.formData,
9181
+ _ref$isMultiSelect = _ref.isMultiSelect,
9182
+ isMultiSelect = _ref$isMultiSelect === void 0 ? true : _ref$isMultiSelect;
8916
9183
  const tenantId = Digit.ULBService.getCurrentTenantId();
8917
- const _useTranslation = useTranslation(),
8918
- t = _useTranslation.t;
8919
- const history = useHistory();
8920
- const queryClient = useQueryClient();
8921
- let _useParams = useParams(),
8922
- vehicleNumber = _useParams.id;
8923
- const _useState = useState(false),
8924
- displayMenu = _useState[0],
8925
- setDisplayMenu = _useState[1];
8926
- const _useState2 = useState(null),
8927
- selectedAction = _useState2[0],
8928
- setSelectedAction = _useState2[1];
8929
- const _useState3 = useState(false),
8930
- showModal = _useState3[0],
8931
- setShowModal = _useState3[1];
8932
- const _useState4 = useState(null),
8933
- showToast = _useState4[0],
8934
- setShowToast = _useState4[1];
8935
- const _useState5 = useState([]),
8936
- vendors = _useState5[0],
8937
- setVendors = _useState5[1];
8938
- const _useState6 = useState({}),
8939
- selectedOption = _useState6[0],
8940
- setSelectedOption = _useState6[1];
8941
- const _useState7 = useState(null),
8942
- vehicleId = _useState7[0],
8943
- setVehicleId = _useState7[1];
8944
- const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVehicleDetails(tenantId, {
8945
- registrationNumber: vehicleNumber
8946
- }, {
8947
- staleTime: Infinity
8948
- }),
8949
- vehicleData = _Digit$Hooks$fsm$useV.data,
8950
- isLoading = _Digit$Hooks$fsm$useV.isLoading,
8951
- refetch = _Digit$Hooks$fsm$useV.refetch;
9184
+ const _useState = useState([]),
9185
+ zones = _useState[0],
9186
+ setZones = _useState[1];
9187
+ const _useState2 = useState([]),
9188
+ selectedZones = _useState2[0],
9189
+ setSelectedZones = _useState2[1];
9190
+ const initialized = useRef(false);
9191
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
9192
+ boundaryData = _Digit$Hooks$useCommo.data,
9193
+ isLoading = _Digit$Hooks$useCommo.isLoading;
8952
9194
  useEffect(() => {
8953
- if (!isLoading && vehicleData) {
8954
- var _vehicleData$, _vehicleData$$vehicle;
8955
- setVehicleId(vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$ = vehicleData[0]) === null || _vehicleData$ === void 0 ? void 0 : (_vehicleData$$vehicle = _vehicleData$.vehicleData) === null || _vehicleData$$vehicle === void 0 ? void 0 : _vehicleData$$vehicle.id);
9195
+ var _boundaryData$egovLo, _boundaryData$egovLo$, _boundaryData$MdmsRes, _boundaryData$MdmsRes2, _boundaryData$MdmsRes3;
9196
+ const tenantBoundary = (boundaryData === null || boundaryData === void 0 ? void 0 : (_boundaryData$egovLo = boundaryData["egov-location"]) === null || _boundaryData$egovLo === void 0 ? void 0 : (_boundaryData$egovLo$ = _boundaryData$egovLo.TenantBoundary) === null || _boundaryData$egovLo$ === void 0 ? void 0 : _boundaryData$egovLo$[0]) || (boundaryData === null || boundaryData === void 0 ? void 0 : (_boundaryData$MdmsRes = boundaryData.MdmsRes) === null || _boundaryData$MdmsRes === void 0 ? void 0 : (_boundaryData$MdmsRes2 = _boundaryData$MdmsRes["egov-location"]) === null || _boundaryData$MdmsRes2 === void 0 ? void 0 : (_boundaryData$MdmsRes3 = _boundaryData$MdmsRes2.TenantBoundary) === null || _boundaryData$MdmsRes3 === void 0 ? void 0 : _boundaryData$MdmsRes3[0]);
9197
+ const boundaries = (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.boundary) || (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.children) || [];
9198
+ if (Array.isArray(boundaries === null || boundaries === void 0 ? void 0 : boundaries.children)) {
9199
+ const allZones = boundaries.children.flatMap(assembly => (assembly.children || []).map(zone => ({
9200
+ code: zone.code,
9201
+ name: zone.name
9202
+ })));
9203
+ const zonesList = [...new Map(allZones.map(z => [z.code, z])).values()];
9204
+ setZones(zonesList);
8956
9205
  }
8957
- }, [vehicleData, isLoading]);
8958
- const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
8959
- sortBy: "name",
8960
- sortOrder: "ASC",
8961
- status: "ACTIVE"
8962
- }, {}),
8963
- vendorData = _Digit$Hooks$fsm$useD.data;
9206
+ }, [boundaryData]);
8964
9207
  useEffect(() => {
8965
- if (vendorData) {
8966
- let vendors = vendorData.map(data => data.dsoDetails);
8967
- setVendors(vendors);
9208
+ if (!zones.length || !Array.isArray(formData === null || formData === void 0 ? void 0 : formData.zoneIds)) return;
9209
+ if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object") {
9210
+ setSelectedZones(formData.zoneIds);
9211
+ return;
8968
9212
  }
8969
- }, [vendorData]);
8970
- const _Digit$Hooks$fsm$useU = Digit.Hooks.fsm.useUpdateVehicle(tenantId),
8971
- mutate = _Digit$Hooks$fsm$useU.mutate;
8972
- const _Digit$Hooks$fsm$useV2 = Digit.Hooks.fsm.useVendorUpdate(tenantId),
8973
- mutateVendor = _Digit$Hooks$fsm$useV2.mutate;
8974
- function onActionSelect(action) {
8975
- setDisplayMenu(false);
8976
- setSelectedAction(action);
8977
- }
8978
- useEffect(() => {
8979
- refetch();
8980
- }, []);
8981
- useEffect(() => {
8982
- switch (selectedAction) {
8983
- case "DELETE":
8984
- case "ADD_VENDOR":
8985
- case "EDIT_VENDOR":
8986
- case "DELETE_VENDOR":
8987
- return setShowModal(true);
8988
- case "EDIT":
8989
- return history.push("/digit-ui/employee/fsm/registry/modify-vehicle/" + vehicleNumber);
8990
- case "HOME":
8991
- return history.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE");
9213
+ const selected = zones.filter(zone => formData.zoneIds.includes(zone.name));
9214
+ setSelectedZones(selected);
9215
+ if (!initialized.current) {
9216
+ initialized.current = true;
9217
+ onSelect(config.key, selected);
9218
+ }
9219
+ }, [zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, config.key, onSelect]);
9220
+ const handleSelect = value => {
9221
+ if (isMultiSelect) {
9222
+ const selected = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : [];
9223
+ setSelectedZones(selected);
9224
+ onSelect(config.key, selected);
9225
+ } else {
9226
+ const selectedZone = Array.isArray(value) ? Array.isArray(value[0]) ? value[0][1] : value[0] : value;
9227
+ setSelectedZones(selectedZone ? [selectedZone] : []);
9228
+ onSelect(config.key, (selectedZone === null || selectedZone === void 0 ? void 0 : selectedZone.code) || "");
8992
9229
  }
8993
- }, [selectedAction]);
8994
- const closeToast = () => {
8995
- setShowToast(null);
8996
- };
8997
- const closeModal = () => {
8998
- setSelectedAction(null);
8999
- setSelectedOption({});
9000
- setShowModal(false);
9001
- };
9002
- const handleAddVendor = () => {
9003
- var _vehicleData$2, _dsoDetails$owner;
9004
- let dsoDetails = selectedOption;
9005
- let vehicleDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$2 = vehicleData[0]) === null || _vehicleData$2 === void 0 ? void 0 : _vehicleData$2.vehicleData;
9006
- vehicleDetails.vendorVehicleStatus = "ACTIVE";
9007
- const formData = {
9008
- vendor: _extends({}, dsoDetails, {
9009
- owner: _extends({}, dsoDetails.owner, {
9010
- gender: ((_dsoDetails$owner = dsoDetails.owner) === null || _dsoDetails$owner === void 0 ? void 0 : _dsoDetails$owner.gender) || "OTHERS"
9011
- }),
9012
- vehicles: dsoDetails.vehicles ? [...dsoDetails.vehicles, vehicleDetails] : [vehicleDetails]
9013
- })
9014
- };
9015
- mutateVendor(formData, {
9016
- onError: (error, variables) => {
9017
- setShowToast({
9018
- key: "error",
9019
- action: error
9020
- });
9021
- setTimeout(closeToast, 5000);
9022
- },
9023
- onSuccess: (data, variables) => {
9024
- setShowToast({
9025
- key: "success",
9026
- action: "EDIT_VENDOR"
9027
- });
9028
- refetch();
9029
- queryClient.invalidateQueries("DSO_SEARCH");
9030
- setTimeout(closeToast, 5000);
9031
- }
9032
- });
9033
- setShowModal(false);
9034
- setSelectedAction(null);
9035
9230
  };
9036
- const handleEditVendor = () => {
9037
- var _vehicleData$3, _dsoDetails$owner2;
9038
- let dsoDetails = selectedOption;
9039
- let vehicleDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$3 = vehicleData[0]) === null || _vehicleData$3 === void 0 ? void 0 : _vehicleData$3.vehicleData;
9040
- vehicleDetails.vendorVehicleStatus = "ACTIVE";
9041
- const formData = {
9042
- vendor: _extends({}, dsoDetails, {
9043
- owner: _extends({}, dsoDetails.owner, {
9044
- gender: ((_dsoDetails$owner2 = dsoDetails.owner) === null || _dsoDetails$owner2 === void 0 ? void 0 : _dsoDetails$owner2.gender) || "OTHERS"
9045
- }),
9046
- vehicles: dsoDetails.vehicles ? [...dsoDetails.vehicles, vehicleDetails] : [vehicleDetails]
9047
- })
9048
- };
9049
- mutateVendor(formData, {
9050
- onError: (error, variables) => {
9051
- setShowToast({
9052
- key: "error",
9053
- action: error
9054
- });
9055
- setTimeout(closeToast, 5000);
9056
- },
9057
- onSuccess: (data, variables) => {
9058
- setShowToast({
9059
- key: "success",
9060
- action: "EDIT_VENDOR"
9231
+ if (isLoading) return /*#__PURE__*/React.createElement(Loader, null);
9232
+ return /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t(config.label), config.isMandatory ? " *" : ""), /*#__PURE__*/React.createElement("div", {
9233
+ className: "field",
9234
+ style: {
9235
+ position: "relative",
9236
+ zIndex: 10
9237
+ }
9238
+ }, /*#__PURE__*/React.createElement(MultiSelectDropdown, {
9239
+ options: zones,
9240
+ selected: selectedZones,
9241
+ onSelect: handleSelect,
9242
+ optionsKey: "name",
9243
+ t: t,
9244
+ multiple: isMultiSelect,
9245
+ isMultiSelect: isMultiSelect,
9246
+ showSelectedLabels: !isMultiSelect,
9247
+ ServerStyle: {
9248
+ backgroundColor: "#fff"
9249
+ },
9250
+ defaultLabel: isMultiSelect ? selectedZones.length + " Selected" : ""
9251
+ })), isMultiSelect && selectedZones.length > 0 && /*#__PURE__*/React.createElement("div", {
9252
+ className: "selected-zones"
9253
+ }, selectedZones.map(zone => /*#__PURE__*/React.createElement("span", {
9254
+ key: zone.code,
9255
+ className: "selected-zone-chip"
9256
+ }, zone.name))));
9257
+ };
9258
+
9259
+ const SelectEkycClusters = _ref => {
9260
+ let config = _ref.config,
9261
+ onSelect = _ref.onSelect,
9262
+ t = _ref.t,
9263
+ formData = _ref.formData;
9264
+ const tenantId = Digit.ULBService.getCurrentTenantId();
9265
+ const _useState = useState([]),
9266
+ clusters = _useState[0],
9267
+ setClusters = _useState[1];
9268
+ const _useState2 = useState(Array.isArray(formData === null || formData === void 0 ? void 0 : formData.clusterIds) ? formData.clusterIds : []),
9269
+ selectedClusters = _useState2[0],
9270
+ setSelectedClusters = _useState2[1];
9271
+ const selectedZones = React.useMemo(() => Array.isArray(formData === null || formData === void 0 ? void 0 : formData.zoneIds) ? formData.zoneIds : [], [formData === null || formData === void 0 ? void 0 : formData.zoneIds]);
9272
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
9273
+ boundaryData = _Digit$Hooks$useCommo.data;
9274
+ useEffect(() => {
9275
+ var _boundaryData$egovLo, _boundaryData$egovLo$, _boundaryData$MdmsRes, _boundaryData$MdmsRes2, _boundaryData$MdmsRes3;
9276
+ const tenantBoundary = (boundaryData === null || boundaryData === void 0 ? void 0 : (_boundaryData$egovLo = boundaryData["egov-location"]) === null || _boundaryData$egovLo === void 0 ? void 0 : (_boundaryData$egovLo$ = _boundaryData$egovLo.TenantBoundary) === null || _boundaryData$egovLo$ === void 0 ? void 0 : _boundaryData$egovLo$[0]) || (boundaryData === null || boundaryData === void 0 ? void 0 : (_boundaryData$MdmsRes = boundaryData.MdmsRes) === null || _boundaryData$MdmsRes === void 0 ? void 0 : (_boundaryData$MdmsRes2 = _boundaryData$MdmsRes["egov-location"]) === null || _boundaryData$MdmsRes2 === void 0 ? void 0 : (_boundaryData$MdmsRes3 = _boundaryData$MdmsRes2.TenantBoundary) === null || _boundaryData$MdmsRes3 === void 0 ? void 0 : _boundaryData$MdmsRes3[0]);
9277
+ const boundaries = (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.boundary) || (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.children) || [];
9278
+ let allClusters = [];
9279
+ if (selectedZones.length > 0 && Array.isArray(boundaries) && boundaries.length > 0) {
9280
+ selectedZones.forEach(zone => {
9281
+ const zoneBoundary = boundaries.find(b => b.code === ((zone === null || zone === void 0 ? void 0 : zone.code) || zone));
9282
+ const children = (zoneBoundary === null || zoneBoundary === void 0 ? void 0 : zoneBoundary.children) || (zoneBoundary === null || zoneBoundary === void 0 ? void 0 : zoneBoundary.boundary) || [];
9283
+ if (Array.isArray(children)) {
9284
+ children.forEach(child => {
9285
+ allClusters.push({
9286
+ code: child.code,
9287
+ name: child.name
9288
+ });
9289
+ });
9290
+ }
9291
+ });
9292
+ }
9293
+ if (allClusters.length === 0) {
9294
+ const staticClusters = {
9295
+ "ZONE-01": [{
9296
+ code: "CLUSTER-01",
9297
+ name: "CLUSTER-01"
9298
+ }],
9299
+ "ZONE-02": [{
9300
+ code: "CLUSTER-02",
9301
+ name: "CLUSTER-02"
9302
+ }],
9303
+ "ZONE-03": [{
9304
+ code: "CLUSTER-03",
9305
+ name: "CLUSTER-03"
9306
+ }],
9307
+ "ZONE-04": [{
9308
+ code: "CLUSTER-04",
9309
+ name: "CLUSTER-04"
9310
+ }],
9311
+ "ZONE-05": [{
9312
+ code: "CLUSTER-05",
9313
+ name: "CLUSTER-05"
9314
+ }]
9315
+ };
9316
+ if (selectedZones.length > 0) {
9317
+ selectedZones.forEach(z => {
9318
+ const zCode = (z === null || z === void 0 ? void 0 : z.code) || z;
9319
+ const zName = (z === null || z === void 0 ? void 0 : z.name) || z;
9320
+ if (staticClusters[zCode]) {
9321
+ allClusters = [...allClusters, ...staticClusters[zCode]];
9322
+ } else {
9323
+ allClusters.push({
9324
+ code: zCode + "-C1",
9325
+ name: zName + " Cluster 1"
9326
+ });
9327
+ }
9061
9328
  });
9062
- refetch();
9063
- queryClient.invalidateQueries("DSO_SEARCH");
9064
- setTimeout(closeToast, 5000);
9329
+ } else {
9330
+ allClusters = [{
9331
+ code: "CLUSTER-01",
9332
+ name: "CLUSTER-01"
9333
+ }, {
9334
+ code: "CLUSTER-02",
9335
+ name: "CLUSTER-02"
9336
+ }, {
9337
+ code: "CLUSTER-03",
9338
+ name: "CLUSTER-03"
9339
+ }];
9065
9340
  }
9066
- });
9067
- setShowModal(false);
9068
- setSelectedAction(null);
9341
+ }
9342
+ if (allClusters.length > 0) {
9343
+ allClusters = Array.from(new Map(allClusters.map(item => [item.code, item])).values());
9344
+ }
9345
+ setClusters(allClusters);
9346
+ }, [selectedZones, boundaryData]);
9347
+ const handleSelect = value => {
9348
+ const extractedValue = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : value;
9349
+ setSelectedClusters(extractedValue);
9350
+ onSelect(config.key, extractedValue);
9069
9351
  };
9070
- const handleDeleteVendor = () => {
9071
- var _vehicleData$4, _vehicleData$4$vendor, _vehicleData$4$vendor2, _dsoDetails$owner3;
9072
- let formData = {};
9073
- let dsoDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$4 = vehicleData[0]) === null || _vehicleData$4 === void 0 ? void 0 : (_vehicleData$4$vendor = _vehicleData$4.vendorDetails) === null || _vehicleData$4$vendor === void 0 ? void 0 : (_vehicleData$4$vendor2 = _vehicleData$4$vendor.vendor) === null || _vehicleData$4$vendor2 === void 0 ? void 0 : _vehicleData$4$vendor2[0];
9074
- let getVehicleVendorDetails = dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.vehicles;
9075
- getVehicleVendorDetails = getVehicleVendorDetails.map(data => {
9076
- if (data.id === vehicleId) {
9077
- data.vendorVehicleStatus = "INACTIVE";
9352
+ const isDisabled = selectedZones.length === 0;
9353
+ return /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t(config.label) + (config.isMandatory ? " *" : "")), /*#__PURE__*/React.createElement("div", {
9354
+ className: "field",
9355
+ style: {
9356
+ position: "relative",
9357
+ zIndex: 9
9358
+ }
9359
+ }, /*#__PURE__*/React.createElement(MultiSelectDropdown, {
9360
+ options: clusters,
9361
+ selected: selectedClusters,
9362
+ onSelect: handleSelect,
9363
+ optionsKey: "name",
9364
+ t: t,
9365
+ ServerStyle: {
9366
+ backgroundColor: "#fff"
9367
+ },
9368
+ disable: isDisabled
9369
+ })));
9370
+ };
9371
+
9372
+ const SelectEkycDropdown = _ref => {
9373
+ var _config$populators, _config$populators2;
9374
+ let config = _ref.config,
9375
+ onSelect = _ref.onSelect,
9376
+ t = _ref.t,
9377
+ formData = _ref.formData;
9378
+ const options = (config === null || config === void 0 ? void 0 : (_config$populators = config.populators) === null || _config$populators === void 0 ? void 0 : _config$populators.options) || [];
9379
+ const optionsKey = (config === null || config === void 0 ? void 0 : (_config$populators2 = config.populators) === null || _config$populators2 === void 0 ? void 0 : _config$populators2.optionsKey) || "name";
9380
+ const selected = formData === null || formData === void 0 ? void 0 : formData[config.key];
9381
+ const handleSelect = value => {
9382
+ onSelect(config.key, value);
9383
+ };
9384
+ return /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t(config.label)), /*#__PURE__*/React.createElement("div", {
9385
+ className: "field"
9386
+ }, /*#__PURE__*/React.createElement(Dropdown, {
9387
+ selected: selected,
9388
+ option: options,
9389
+ select: handleSelect,
9390
+ optionKey: optionsKey,
9391
+ t: t
9392
+ })));
9393
+ };
9394
+
9395
+ const AdditionalDetails = _ref => {
9396
+ var _formData$ownerKey, _formData$ownerKey2, _formData$ownerKey3, _formData$ownerKey4;
9397
+ let t = _ref.t,
9398
+ config = _ref.config,
9399
+ onSelect = _ref.onSelect,
9400
+ userType = _ref.userType,
9401
+ formData = _ref.formData;
9402
+ let index = 0;
9403
+ const user = Digit.UserService.getUser().info;
9404
+ const applicantName = formData.ownerKey && formData.ownerKey[index] && formData.ownerKey[index].applicantName || (formData === null || formData === void 0 ? void 0 : (_formData$ownerKey = formData.ownerKey) === null || _formData$ownerKey === void 0 ? void 0 : _formData$ownerKey.applicantName) || "";
9405
+ const emailId = formData.ownerKey && formData.ownerKey[index] && formData.ownerKey[index].emailId || (formData === null || formData === void 0 ? void 0 : (_formData$ownerKey2 = formData.ownerKey) === null || _formData$ownerKey2 === void 0 ? void 0 : _formData$ownerKey2.emailId) || "";
9406
+ const mobileNumber = formData.ownerKey && formData.ownerKey[index] && formData.ownerKey[index].mobileNumber || (formData === null || formData === void 0 ? void 0 : (_formData$ownerKey3 = formData.ownerKey) === null || _formData$ownerKey3 === void 0 ? void 0 : _formData$ownerKey3.mobileNumber) || (user === null || user === void 0 ? void 0 : user.mobileNumber);
9407
+ const altMobileNumber = formData.ownerKey && formData.ownerKey[index] && formData.ownerKey[index].altMobileNumber || (formData === null || formData === void 0 ? void 0 : (_formData$ownerKey4 = formData.ownerKey) === null || _formData$ownerKey4 === void 0 ? void 0 : _formData$ownerKey4.altmobileNumber) || "";
9408
+ const _useState = useState(""),
9409
+ VendorCategory = _useState[0],
9410
+ setVendorCategory = _useState[1];
9411
+ const _useState2 = useState(""),
9412
+ VendorId = _useState2[0],
9413
+ setVendorId = _useState2[1];
9414
+ const _useState3 = useState(""),
9415
+ userName = _useState3[0],
9416
+ setUserName = _useState3[1];
9417
+ const _useState4 = useState(""),
9418
+ Bank = _useState4[0],
9419
+ setBank = _useState4[1];
9420
+ const _useState5 = useState(),
9421
+ BankbranchName = _useState5[0],
9422
+ setBankbranchName = _useState5[1];
9423
+ const _useState6 = useState(""),
9424
+ IFSC = _useState6[0],
9425
+ setIFSC = _useState6[1];
9426
+ const _useState7 = useState(""),
9427
+ AccountNo = _useState7[0],
9428
+ setAccountNo = _useState7[1];
9429
+ const _useState8 = useState(""),
9430
+ PanNo = _useState8[0],
9431
+ setPanNo = _useState8[1];
9432
+ const _useState9 = useState(""),
9433
+ GstNo = _useState9[0],
9434
+ setGstNo = _useState9[1];
9435
+ const _useState0 = useState(""),
9436
+ GstState = _useState0[0],
9437
+ setGstState = _useState0[1];
9438
+ const _useState1 = useState(""),
9439
+ RegistrationNo = _useState1[0],
9440
+ setRegistrationNo = _useState1[1];
9441
+ const _useState10 = useState(""),
9442
+ EpfNo = _useState10[0],
9443
+ setEpfNo = _useState10[1];
9444
+ const _useState11 = useState(""),
9445
+ EsiNo = _useState11[0],
9446
+ setEsiNo = _useState11[1];
9447
+ const _useState12 = useState(""),
9448
+ VendorType = _useState12[0],
9449
+ setVendorType = _useState12[1];
9450
+ const _useState13 = useState(""),
9451
+ Status = _useState13[0],
9452
+ setStatus = _useState13[1];
9453
+ const _useState14 = useState(""),
9454
+ micrNo = _useState14[0],
9455
+ setmicrNo = _useState14[1];
9456
+ const _useState15 = useState(""),
9457
+ PhoneNo = _useState15[0],
9458
+ setPhoneNo = _useState15[1];
9459
+ const _useState16 = useState(""),
9460
+ ContactPerson = _useState16[0],
9461
+ setContactPerson = _useState16[1];
9462
+ useEffect(() => {
9463
+ if (IFSC.length === 11 && !Bank && !BankbranchName && !micrNo) {
9464
+ fetch("https://ifsc.razorpay.com/" + IFSC).then(response => response.json()).then(data => {
9465
+ if (data && data.BANK && data.BRANCH && data.MICR) {
9466
+ setBank(data.BANK);
9467
+ setBankbranchName(data.BRANCH);
9468
+ setmicrNo(data.MICR);
9469
+ }
9470
+ }).catch(() => {});
9471
+ } else {
9472
+ if (IFSC.length === 11 && Bank && BankbranchName) {
9473
+ setBank(Bank);
9474
+ setBankbranchName(BankbranchName);
9475
+ setmicrNo(micrNo);
9476
+ } else {
9477
+ setBank("");
9478
+ setBankbranchName("");
9479
+ setmicrNo("");
9078
9480
  }
9079
- return data;
9080
- });
9081
- formData = {
9082
- vendor: _extends({}, dsoDetails, {
9083
- owner: _extends({}, dsoDetails.owner, {
9084
- gender: ((_dsoDetails$owner3 = dsoDetails.owner) === null || _dsoDetails$owner3 === void 0 ? void 0 : _dsoDetails$owner3.gender) || "OTHERS"
9085
- }),
9086
- vehicles: getVehicleVendorDetails
9087
- })
9088
- };
9089
- mutateVendor(formData, {
9090
- onError: (error, variables) => {
9091
- setShowToast({
9092
- key: "error",
9093
- action: error
9094
- });
9095
- setTimeout(closeToast, 5000);
9096
- },
9097
- onSuccess: (data, variables) => {
9098
- setShowToast({
9099
- key: "success",
9100
- action: "DELETE_VENDOR"
9101
- });
9102
- queryClient.invalidateQueries("FSM_VENDOR_SEARCH");
9103
- refetch();
9104
- setTimeout(closeToast, 5000);
9481
+ }
9482
+ }, [IFSC]);
9483
+ function setvendorbank(e) {
9484
+ setBank(e.target.value);
9485
+ }
9486
+ function setBankbranch(e) {
9487
+ setBankbranchName(e.target.value);
9488
+ }
9489
+ function setvendorifsc(e) {
9490
+ const input = e.target.value.replace(/[^a-zA-Z0-9]/g, "");
9491
+ if (input.length <= 11) {
9492
+ setIFSC(input);
9493
+ }
9494
+ }
9495
+ function setvendoraccountno(e) {
9496
+ setAccountNo(e.target.value);
9497
+ }
9498
+ function setpanno(e) {
9499
+ setPanNo(e.target.value);
9500
+ }
9501
+ function setgstno(e) {
9502
+ setGstNo(e.target.value);
9503
+ }
9504
+ function setgststate(e) {
9505
+ setGstState(e.target.value);
9506
+ }
9507
+ function setregistrationno(e) {
9508
+ setRegistrationNo(e.target.value);
9509
+ }
9510
+ function setepfno(e) {
9511
+ setEpfNo(e.target.value);
9512
+ }
9513
+ function setesino(e) {
9514
+ setEsiNo(e.target.value);
9515
+ }
9516
+ function setcontactperson(e) {
9517
+ setContactPerson(e.target.value);
9518
+ }
9519
+ const tenantId = Digit.ULBService.getCurrentTenantId();
9520
+ const _useForm = useForm(),
9521
+ control = _useForm.control;
9522
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
9523
+ staleTime: Infinity
9524
+ }),
9525
+ dsoData = _Digit$Hooks$fsm$useD.data;
9526
+ useEffect(() => {
9527
+ if (dsoData) {
9528
+ const vendor = dsoData.find(item => item.id);
9529
+ if (vendor) {
9530
+ setUserName(vendor.name);
9531
+ setVendorId(vendor.id);
9105
9532
  }
9106
- });
9107
- setShowModal(false);
9108
- };
9109
- const handleModalAction = () => {
9110
- switch (selectedAction) {
9111
- case "DELETE":
9112
- return handleDelete();
9113
- case "DELETE_VENDOR":
9114
- return handleDeleteVendor();
9115
- case "ADD_VENDOR":
9116
- return handleAddVendor();
9117
- case "EDIT_VENDOR":
9118
- return handleEditVendor();
9119
9533
  }
9120
- };
9121
- const handleDelete = () => {
9122
- var _vehicleData$5;
9123
- let vehicleDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$5 = vehicleData[0]) === null || _vehicleData$5 === void 0 ? void 0 : _vehicleData$5.vehicleData;
9124
- const formData = {
9125
- vehicle: _extends({}, vehicleDetails, {
9126
- status: "INACTIVE"
9127
- })
9128
- };
9129
- mutate(formData, {
9130
- onError: (error, variables) => {
9131
- setShowToast({
9132
- key: "error",
9133
- action: error
9134
- });
9135
- setTimeout(closeToast, 5000);
9136
- },
9137
- onSuccess: (data, variables) => {
9138
- setShowToast({
9139
- key: "success",
9140
- action: "DELETE_VEHICLE"
9141
- });
9142
- queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
9143
- setTimeout(() => {
9144
- closeToast();
9145
- history.push("/digit-ui/employee/fsm/registry");
9146
- }, 5000);
9147
- }
9148
- });
9149
- setShowModal(false);
9150
- };
9151
- const renderModalContent = () => {
9152
- if (selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR") {
9153
- return /*#__PURE__*/React.createElement(ConfirmationBox, {
9154
- t: t,
9155
- title: "ES_FSM_REGISTRY_DELETE_TEXT"
9534
+ }, [dsoData]);
9535
+ const goNext = () => {
9536
+ let owner = formData.ownerKey && formData.ownerKey[index];
9537
+ let ownerStep;
9538
+ if (userType === "citizen") {
9539
+ ownerStep = _extends({}, owner, {
9540
+ applicantName,
9541
+ mobileNumber,
9542
+ altMobileNumber,
9543
+ emailId
9544
+ });
9545
+ onSelect(config.key, _extends({}, formData[config.key], ownerStep), false, index);
9546
+ } else {
9547
+ ownerStep = _extends({}, owner, {
9548
+ VendorCategory,
9549
+ name: userName,
9550
+ VendorId: VendorId,
9551
+ Bank,
9552
+ BankbranchName,
9553
+ IFSC,
9554
+ AccountNo,
9555
+ PanNo,
9556
+ GstNo,
9557
+ GstState,
9558
+ RegistrationNo,
9559
+ EpfNo,
9560
+ EsiNo,
9561
+ VendorType,
9562
+ Status,
9563
+ micrNo,
9564
+ PhoneNo,
9565
+ ContactPerson
9156
9566
  });
9567
+ onSelect(config.key, ownerStep, false, index);
9157
9568
  }
9158
- if (selectedAction === "ADD_VENDOR") {
9159
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t("ES_FSM_REGISTRY_SELECT_VENODOR")), /*#__PURE__*/React.createElement(Dropdown, {
9160
- t: t,
9161
- option: vendors,
9162
- value: selectedOption,
9163
- selected: selectedOption,
9164
- select: setSelectedOption,
9165
- optionKey: "name"
9166
- }));
9569
+ };
9570
+ useEffect(() => {
9571
+ if (userType === "citizen") {
9572
+ goNext();
9167
9573
  }
9168
- if (selectedAction === "EDIT_VENDOR") {
9169
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t("ES_FSM_REGISTRY_SELECT_VENODOR")), /*#__PURE__*/React.createElement(Dropdown, {
9170
- t: t,
9171
- option: vendors,
9172
- value: selectedOption,
9173
- selected: selectedOption,
9174
- select: setSelectedOption,
9175
- optionKey: "name"
9176
- }));
9574
+ }, [VendorCategory, VendorId, userName, Bank, BankbranchName, IFSC, AccountNo, PanNo, GstNo, GstState, RegistrationNo, EpfNo, EsiNo, VendorType, Status, micrNo, PhoneNo, ContactPerson, userType]);
9575
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VerticalTimeline, {
9576
+ config: [{
9577
+ timeLine: [{
9578
+ actions: t("VENDOR_ADDITIONAL_DETAILS"),
9579
+ currentStep: 1
9580
+ }]
9581
+ }, {
9582
+ timeLine: [{
9583
+ actions: t("VENDOR_DOCUMENT_DETAILS"),
9584
+ currentStep: 2
9585
+ }]
9586
+ }, {
9587
+ timeLine: [{
9588
+ actions: t("VENDOR_SUMMARY"),
9589
+ currentStep: 3
9590
+ }]
9591
+ }],
9592
+ currentActiveIndex: 0,
9593
+ showFinalStep: false
9594
+ }), /*#__PURE__*/React.createElement("div", {
9595
+ style: {
9596
+ flex: "1",
9597
+ overflowY: "auto"
9598
+ }
9599
+ }, /*#__PURE__*/React.createElement(FormStep, {
9600
+ config: config,
9601
+ onSelect: goNext,
9602
+ t: t,
9603
+ className: "formcomposer-grid-container-form"
9604
+ }, /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
9605
+ className: "card-label-smaller"
9606
+ }, /*#__PURE__*/React.createElement(CustomTooltip, {
9607
+ label: "" + t("IFSC_CODE"),
9608
+ isMandatory: false,
9609
+ message: t("INVALID_IFSC_CODE_ERROR_MESSAGE")
9610
+ })), /*#__PURE__*/React.createElement(TextInput, {
9611
+ t: t,
9612
+ type: "text",
9613
+ isMandatory: false,
9614
+ optionKey: "i18nKey",
9615
+ name: "IFSC",
9616
+ value: IFSC,
9617
+ placeholder: "Enter IFSC Code",
9618
+ onChange: setvendorifsc,
9619
+ style: {
9620
+ width: "100%"
9621
+ },
9622
+ maxLength: 11,
9623
+ ValidationRequired: true,
9624
+ validation: {
9625
+ isRequired: true,
9626
+ pattern: "^[A-Z]{4}0[A-Z0-9]{6}$",
9627
+ type: "text",
9628
+ title: t("INVALID_IFSC_CODE_ERROR_MESSAGE")
9629
+ }
9630
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("VENDOR_BANK_NAME"), " ", /*#__PURE__*/React.createElement("span", {
9631
+ className: "check-page-link-button"
9632
+ }, "*")), /*#__PURE__*/React.createElement(TextInput, {
9633
+ t: t,
9634
+ type: "text",
9635
+ isMandatory: false,
9636
+ optionKey: "i18nKey",
9637
+ name: "bankName",
9638
+ placeholder: "Bank Name Auto Select",
9639
+ style: {
9640
+ width: "100%"
9641
+ },
9642
+ value: Bank,
9643
+ onChange: setvendorbank,
9644
+ disabled: true
9645
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("VENDOR_BANK_BRANCH_NAME"), " ", /*#__PURE__*/React.createElement("span", {
9646
+ className: "check-page-link-button"
9647
+ }, "*")), /*#__PURE__*/React.createElement(TextInput, {
9648
+ t: t,
9649
+ type: "text",
9650
+ isMandatory: false,
9651
+ optionKey: "i18nKey",
9652
+ name: "BankbranchName",
9653
+ value: BankbranchName,
9654
+ style: {
9655
+ width: "100%"
9656
+ },
9657
+ placeholder: "Bank Branch Name Auto Select",
9658
+ onChange: setBankbranch,
9659
+ disabled: false
9660
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("VENDOR_MICR_NO"), " ", /*#__PURE__*/React.createElement("span", {
9661
+ className: "check-page-link-button"
9662
+ }, "*")), /*#__PURE__*/React.createElement(TextInput, {
9663
+ t: t,
9664
+ type: "text",
9665
+ isMandatory: false,
9666
+ optionKey: "i18nKey",
9667
+ name: "MicrNo",
9668
+ value: micrNo,
9669
+ style: {
9670
+ width: "100%"
9671
+ },
9672
+ placeholder: "MICR No",
9673
+ onChange: setmicrNo,
9674
+ disabled: false
9675
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("ACCOUNT_NO")), /*#__PURE__*/React.createElement(TextInput, {
9676
+ t: t,
9677
+ type: "text",
9678
+ isMandatory: false,
9679
+ optionKey: "i18nKey",
9680
+ name: "AccountNo",
9681
+ value: AccountNo,
9682
+ onChange: setvendoraccountno,
9683
+ style: {
9684
+ width: "100%"
9685
+ },
9686
+ ValidationRequired: true,
9687
+ validation: {
9688
+ isRequired: true,
9689
+ pattern: "[0-9]{9,18}",
9690
+ type: "text",
9691
+ title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE")
9692
+ }
9693
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("PHONE_NO")), /*#__PURE__*/React.createElement(MobileNumber, {
9694
+ value: PhoneNo,
9695
+ name: "PhoneNo",
9696
+ onChange: setPhoneNo,
9697
+ style: {
9698
+ width: "100%"
9699
+ }
9700
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("CONTACT_PERSON")), /*#__PURE__*/React.createElement(TextInput, {
9701
+ t: t,
9702
+ type: "text",
9703
+ isMandatory: false,
9704
+ optionKey: "i18nKey",
9705
+ name: "ContactPerson",
9706
+ value: ContactPerson,
9707
+ onChange: setcontactperson,
9708
+ style: {
9709
+ width: "100%"
9710
+ },
9711
+ ValidationRequired: true,
9712
+ validation: {
9713
+ isRequired: true,
9714
+ pattern: "^[a-zA-Z0-9/-]{1,20}$",
9715
+ type: "text",
9716
+ title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE")
9177
9717
  }
9178
- };
9179
- const modalHeading = () => {
9180
- switch (selectedAction) {
9181
- case "DELETE":
9182
- case "DELETE_VENDOR":
9183
- return "ES_FSM_REGISTRY_DELETE_POPUP_HEADER";
9184
- case "ADD_VENDOR":
9185
- return "ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER";
9186
- case "EDIT_VENDOR":
9187
- return "ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER";
9718
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("PAN_NO")), /*#__PURE__*/React.createElement(TextInput, {
9719
+ t: t,
9720
+ type: "text",
9721
+ isMandatory: false,
9722
+ optionKey: "i18nKey",
9723
+ name: "PanNo",
9724
+ value: PanNo,
9725
+ onChange: setpanno,
9726
+ style: {
9727
+ width: "100%"
9728
+ },
9729
+ ValidationRequired: true,
9730
+ validation: {
9731
+ isRequired: true,
9732
+ pattern: "[A-Z]{5}[0-9]{4}[A-Z]{1}",
9733
+ type: "text",
9734
+ title: t("INVALID_PAN_NO_ERROR_MESSAGE")
9188
9735
  }
9189
- };
9190
- if (isLoading) {
9191
- return /*#__PURE__*/React.createElement(Loader, null);
9192
- }
9193
- return /*#__PURE__*/React.createElement(React.Fragment, null, !isLoading ? /*#__PURE__*/React.createElement("div", {
9194
- className: "employee-form-content"
9195
- }, /*#__PURE__*/React.createElement(Card, {
9196
- className: "vehicle-details-card",
9736
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("GST_NO")), /*#__PURE__*/React.createElement(TextInput, {
9737
+ t: t,
9738
+ type: "text",
9739
+ isMandatory: false,
9740
+ optionKey: "i18nKey",
9741
+ name: "GstNo",
9742
+ value: GstNo,
9743
+ onChange: setgstno,
9197
9744
  style: {
9198
- position: "relative"
9745
+ width: "100%"
9746
+ },
9747
+ ValidationRequired: true,
9748
+ validation: {
9749
+ isRequired: true,
9750
+ pattern: "^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[A-Z0-9]{1}[Z]{1}[A-Z0-9]{1}$",
9751
+ type: "text",
9752
+ title: t("INVALID_GST_NO_ERROR_MESSAGE")
9199
9753
  }
9200
- }, vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$6 = vehicleData[0]) === null || _vehicleData$6 === void 0 ? void 0 : (_vehicleData$6$employ = _vehicleData$6.employeeResponse) === null || _vehicleData$6$employ === void 0 ? void 0 : _vehicleData$6$employ.map((detail, index) => {
9201
- var _detail$values;
9202
- return /*#__PURE__*/React.createElement(React.Fragment, {
9203
- key: index
9204
- }, index > 0 && /*#__PURE__*/React.createElement(CardSectionHeader, {
9205
- style: {
9206
- marginBottom: "16px",
9207
- marginTop: "32px"
9208
- }
9209
- }, t(detail.title)), /*#__PURE__*/React.createElement(Card, {
9210
- className: "card-with-background",
9211
- style: {
9212
- margin: "10px 16px",
9213
- padding: "20px"
9214
- }
9215
- }, /*#__PURE__*/React.createElement("div", {
9216
- className: "additional-grid"
9217
- }, detail === null || detail === void 0 ? void 0 : (_detail$values = detail.values) === null || _detail$values === void 0 ? void 0 : _detail$values.map((value, index) => {
9218
- return (value === null || value === void 0 ? void 0 : value.type) === "custom" ? /*#__PURE__*/React.createElement(React.Fragment, {
9219
- key: index
9220
- }, /*#__PURE__*/React.createElement("div", {
9221
- className: "additional-label"
9222
- }, t(value.title)), /*#__PURE__*/React.createElement("div", {
9223
- className: "additional-value",
9224
- style: {
9225
- display: "flex",
9226
- alignItems: "center",
9227
- gap: "8px"
9228
- }
9229
- }, value.value === "ES_FSM_REGISTRY_DETAILS_ADD_VENDOR" && /*#__PURE__*/React.createElement("div", {
9230
- onClick: () => onActionSelect("ADD_VENDOR"),
9231
- style: {
9232
- color: "#a82227",
9233
- display: "flex",
9234
- alignItems: "center",
9235
- gap: "8px",
9236
- cursor: "pointer"
9237
- }
9238
- }, /*#__PURE__*/React.createElement(AddIcon, {
9239
- className: "",
9240
- fill: "#a82227"
9241
- }), " ", t(value.value) || "N/A"), value.value !== "ES_FSM_REGISTRY_DETAILS_ADD_VENDOR" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, value.value), /*#__PURE__*/React.createElement("div", {
9242
- className: "add-details-link hover-button",
9243
- onClick: () => onActionSelect("EDIT_VENDOR"),
9244
- style: {
9245
- cursor: "pointer"
9246
- }
9247
- }, /*#__PURE__*/React.createElement(EditIcon, {
9248
- fill: "#a82227"
9249
- })), /*#__PURE__*/React.createElement("div", {
9250
- className: "add-details-link hover-button",
9251
- onClick: () => onActionSelect("DELETE_VENDOR"),
9252
- style: {
9253
- cursor: "pointer"
9254
- }
9255
- }, /*#__PURE__*/React.createElement(DeleteIcon, {
9256
- className: "delete",
9257
- fill: "#a82227"
9258
- }))))) : /*#__PURE__*/React.createElement(React.Fragment, {
9259
- key: index
9260
- }, /*#__PURE__*/React.createElement("div", {
9261
- className: "additional-label"
9262
- }, t(value.title)), /*#__PURE__*/React.createElement("div", {
9263
- className: "additional-value",
9264
- style: value.value === "ACTIVE" ? {
9265
- color: "green"
9266
- } : {}
9267
- }, t(value.value) || "N/A"));
9268
- }))));
9269
- })), showModal && /*#__PURE__*/React.createElement(Modal, {
9270
- headerBarMain: /*#__PURE__*/React.createElement(Heading$4, {
9271
- label: t(modalHeading())
9272
- }),
9273
- headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$3, {
9274
- onClick: closeModal
9275
- }),
9276
- actionCancelLabel: t("CS_COMMON_CANCEL"),
9277
- actionCancelOnSubmit: closeModal,
9278
- actionSaveLabel: t(selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? "ES_EVENT_DELETE" : "CS_COMMON_SUBMIT"),
9279
- actionSaveOnSubmit: handleModalAction
9280
- }, selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? renderModalContent() : /*#__PURE__*/React.createElement(Card, {
9754
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("GST_REGISTERED_STATE/UT")), /*#__PURE__*/React.createElement(TextInput, {
9755
+ t: t,
9756
+ type: "text",
9757
+ isMandatory: false,
9758
+ optionKey: "i18nKey",
9759
+ name: "GstState",
9760
+ value: GstState,
9761
+ onChange: setgststate,
9281
9762
  style: {
9282
- boxShadow: "none"
9763
+ width: "100%"
9764
+ },
9765
+ ValidationRequired: true,
9766
+ validation: {
9767
+ isRequired: true,
9768
+ pattern: "^[a-zA-Z0-9/-]{1,20}$",
9769
+ type: "text",
9770
+ title: t("PT_NAME_ERROR_MESSAGE")
9283
9771
  }
9284
- }, renderModalContent())), showToast && /*#__PURE__*/React.createElement(Toast, {
9285
- error: showToast.key === "error" ? true : false,
9286
- label: t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_SUCCESS" : showToast.action),
9287
- onClose: closeToast
9288
- }), /*#__PURE__*/React.createElement(ActionBar, {
9772
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("REGISTRATION_NO")), /*#__PURE__*/React.createElement(TextInput, {
9773
+ t: t,
9774
+ type: "text",
9775
+ isMandatory: false,
9776
+ optionKey: "i18nKey",
9777
+ name: "RegistrationNo",
9778
+ value: RegistrationNo,
9779
+ onChange: setregistrationno,
9289
9780
  style: {
9290
- zIndex: "19"
9781
+ width: "100%"
9782
+ },
9783
+ ValidationRequired: true,
9784
+ validation: {
9785
+ isRequired: true,
9786
+ pattern: "^[a-zA-Z0-9/-]{1,20}$",
9787
+ type: "text",
9788
+ title: t("INVALID_REGISTRATION_NO_ERROR_MESSAGE")
9291
9789
  }
9292
- }, displayMenu ? /*#__PURE__*/React.createElement(Menu, {
9293
- localeKeyPrefix: "ES_FSM_REGISTRY_ACTION",
9294
- options: ["EDIT", "DELETE"],
9790
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("EPF_NO")), /*#__PURE__*/React.createElement(TextInput, {
9295
9791
  t: t,
9296
- onSelect: onActionSelect
9297
- }) : null, /*#__PURE__*/React.createElement(SubmitBar, {
9298
- label: t("ES_COMMON_TAKE_ACTION"),
9299
- onSubmit: () => setDisplayMenu(!displayMenu)
9300
- }))) : /*#__PURE__*/React.createElement(Loader, null));
9301
- };
9302
-
9303
- const SelectEkycZones = _ref => {
9304
- var _formData$zoneIds;
9305
- let config = _ref.config,
9306
- onSelect = _ref.onSelect,
9307
- t = _ref.t,
9308
- formData = _ref.formData,
9309
- _ref$isMultiSelect = _ref.isMultiSelect,
9310
- isMultiSelect = _ref$isMultiSelect === void 0 ? true : _ref$isMultiSelect;
9311
- const tenantId = Digit.ULBService.getCurrentTenantId();
9312
- const _useState = useState([]),
9313
- zones = _useState[0],
9314
- setZones = _useState[1];
9315
- const _useState2 = useState([]),
9316
- selectedZones = _useState2[0],
9317
- setSelectedZones = _useState2[1];
9318
- const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
9319
- boundaryData = _Digit$Hooks$useCommo.data,
9320
- isLoading = _Digit$Hooks$useCommo.isLoading;
9321
- useEffect(() => {
9322
- if (!zones.length) return;
9323
- if (isMultiSelect) {
9324
- setSelectedZones(Array.isArray(formData === null || formData === void 0 ? void 0 : formData.zoneIds) ? zones.filter(ele => formData.zoneIds.includes(ele.code)) : []);
9325
- } else {
9326
- const selected = zones.find(ele => {
9327
- return ele.code === (formData === null || formData === void 0 ? void 0 : formData.zoneIds);
9328
- });
9329
- setSelectedZones(selected ? [selected] : []);
9792
+ type: "text",
9793
+ isMandatory: false,
9794
+ optionKey: "i18nKey",
9795
+ name: "EpfNo",
9796
+ value: EpfNo,
9797
+ onChange: setepfno,
9798
+ style: {
9799
+ width: "100%"
9800
+ },
9801
+ ValidationRequired: true,
9802
+ validation: {
9803
+ isRequired: true,
9804
+ pattern: "^[a-zA-Z0-9/-]{1,15}$",
9805
+ type: "text",
9806
+ title: t("INVALID_EPF_NO_ERROR_MESSAGE")
9330
9807
  }
9331
- }, [zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, isMultiSelect]);
9332
- useEffect(() => {
9333
- var _boundaryData$egovLo, _boundaryData$egovLo$, _boundaryData$MdmsRes, _boundaryData$MdmsRes2, _boundaryData$MdmsRes3;
9334
- const tenantBoundary = (boundaryData === null || boundaryData === void 0 ? void 0 : (_boundaryData$egovLo = boundaryData["egov-location"]) === null || _boundaryData$egovLo === void 0 ? void 0 : (_boundaryData$egovLo$ = _boundaryData$egovLo.TenantBoundary) === null || _boundaryData$egovLo$ === void 0 ? void 0 : _boundaryData$egovLo$[0]) || (boundaryData === null || boundaryData === void 0 ? void 0 : (_boundaryData$MdmsRes = boundaryData.MdmsRes) === null || _boundaryData$MdmsRes === void 0 ? void 0 : (_boundaryData$MdmsRes2 = _boundaryData$MdmsRes["egov-location"]) === null || _boundaryData$MdmsRes2 === void 0 ? void 0 : (_boundaryData$MdmsRes3 = _boundaryData$MdmsRes2.TenantBoundary) === null || _boundaryData$MdmsRes3 === void 0 ? void 0 : _boundaryData$MdmsRes3[0]);
9335
- const boundaries = (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.boundary) || (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.children) || [];
9336
- if (Array.isArray(boundaries === null || boundaries === void 0 ? void 0 : boundaries.children) && (boundaries === null || boundaries === void 0 ? void 0 : boundaries.children.length) > 0) {
9337
- const allZones = boundaries.children.flatMap(assembly => ((assembly === null || assembly === void 0 ? void 0 : assembly.children) || []).map(zone => ({
9338
- code: zone.code,
9339
- name: zone.name
9340
- })));
9341
- const zonesList = [...new Map(allZones.map(zone => [zone.code, zone])).values()];
9342
- setZones(zonesList);
9808
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, "" + t("ESI_NO")), /*#__PURE__*/React.createElement(TextInput, {
9809
+ t: t,
9810
+ type: "text",
9811
+ isMandatory: false,
9812
+ optionKey: "i18nKey",
9813
+ name: "EsiNo",
9814
+ value: EsiNo,
9815
+ onChange: setesino,
9816
+ style: {
9817
+ width: "100%"
9818
+ },
9819
+ ValidationRequired: true,
9820
+ validation: {
9821
+ isRequired: true,
9822
+ pattern: "^[a-zA-Z0-9/-]{1,20}$",
9823
+ type: "text",
9824
+ title: t("INVALID_ESI_NO_ERROR_MESSAGE")
9343
9825
  }
9344
- }, [boundaryData]);
9345
- const handleSelect = value => {
9346
- if (isMultiSelect) {
9347
- const extractedValue = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : [];
9348
- onSelect(config.key, extractedValue);
9349
- } else {
9350
- const selectedZone = Array.isArray(value) ? Array.isArray(value[0]) ? value[0][1] : value[0] : value;
9351
- setSelectedZones(selectedZone ? [selectedZone] : []);
9352
- onSelect(config.key, (selectedZone === null || selectedZone === void 0 ? void 0 : selectedZone.code) || "");
9826
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement("div", null, t("VENDOR_TYPE"), /*#__PURE__*/React.createElement("div", {
9827
+ className: "tooltip",
9828
+ style: {
9829
+ width: "12px",
9830
+ height: "5px",
9831
+ marginLeft: "10px",
9832
+ display: "inline-flex",
9833
+ alignItems: "center"
9353
9834
  }
9354
- };
9355
- if (isLoading) return /*#__PURE__*/React.createElement(Loader, null);
9356
- return /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t(config.label) + (config.isMandatory ? " *" : "")), /*#__PURE__*/React.createElement("div", {
9357
- className: "field",
9835
+ }, /*#__PURE__*/React.createElement("span", {
9836
+ className: "tooltiptext",
9358
9837
  style: {
9359
- position: "relative",
9360
- zIndex: 10
9838
+ whiteSpace: "pre-wrap",
9839
+ fontSize: "small",
9840
+ wordWrap: "break-word",
9841
+ width: "300px",
9842
+ marginLeft: "15px",
9843
+ marginBottom: "-10px"
9361
9844
  }
9362
- }, /*#__PURE__*/React.createElement(MultiSelectDropdown, {
9363
- options: zones,
9364
- selected: selectedZones,
9365
- onSelect: handleSelect,
9366
- optionsKey: "name",
9367
- t: t,
9368
- multiple: isMultiSelect,
9369
- ServerStyle: {
9370
- backgroundColor: "#fff"
9845
+ }, "" + t("AST_CLASSIFICATION_ASSET")))), /*#__PURE__*/React.createElement(Controller, {
9846
+ control: control,
9847
+ name: "VendorType",
9848
+ defaultValue: VendorType,
9849
+ rules: {
9850
+ required: t("CORE_COMMON_REQUIRED_ERRMSG")
9371
9851
  },
9372
- isMultiSelect: isMultiSelect,
9373
- showSelectedLabels: !isMultiSelect,
9374
- defaultLabel: isMultiSelect ? ((formData === null || formData === void 0 ? void 0 : (_formData$zoneIds = formData.zoneIds) === null || _formData$zoneIds === void 0 ? void 0 : _formData$zoneIds.length) || 0) + " Selected" : ""
9375
- })), isMultiSelect && Array.isArray(formData === null || formData === void 0 ? void 0 : formData.zoneIds) && formData.zoneIds.length > 0 && /*#__PURE__*/React.createElement("div", {
9376
- className: "selected-zones"
9377
- }, formData.zoneIds.map(zone => /*#__PURE__*/React.createElement("span", {
9378
- key: zone.code,
9379
- className: "selected-zone-chip"
9380
- }, zone.name))));
9381
- };
9382
-
9383
- const SelectEkycClusters = _ref => {
9384
- let config = _ref.config,
9385
- onSelect = _ref.onSelect,
9386
- t = _ref.t,
9387
- formData = _ref.formData;
9388
- const tenantId = Digit.ULBService.getCurrentTenantId();
9389
- const _useState = useState([]),
9390
- clusters = _useState[0],
9391
- setClusters = _useState[1];
9392
- const _useState2 = useState(Array.isArray(formData === null || formData === void 0 ? void 0 : formData.clusterIds) ? formData.clusterIds : []),
9393
- selectedClusters = _useState2[0],
9394
- setSelectedClusters = _useState2[1];
9395
- const selectedZones = React.useMemo(() => Array.isArray(formData === null || formData === void 0 ? void 0 : formData.zoneIds) ? formData.zoneIds : [], [formData === null || formData === void 0 ? void 0 : formData.zoneIds]);
9396
- const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
9397
- boundaryData = _Digit$Hooks$useCommo.data;
9398
- useEffect(() => {
9399
- var _boundaryData$egovLo, _boundaryData$egovLo$, _boundaryData$MdmsRes, _boundaryData$MdmsRes2, _boundaryData$MdmsRes3;
9400
- const tenantBoundary = (boundaryData === null || boundaryData === void 0 ? void 0 : (_boundaryData$egovLo = boundaryData["egov-location"]) === null || _boundaryData$egovLo === void 0 ? void 0 : (_boundaryData$egovLo$ = _boundaryData$egovLo.TenantBoundary) === null || _boundaryData$egovLo$ === void 0 ? void 0 : _boundaryData$egovLo$[0]) || (boundaryData === null || boundaryData === void 0 ? void 0 : (_boundaryData$MdmsRes = boundaryData.MdmsRes) === null || _boundaryData$MdmsRes === void 0 ? void 0 : (_boundaryData$MdmsRes2 = _boundaryData$MdmsRes["egov-location"]) === null || _boundaryData$MdmsRes2 === void 0 ? void 0 : (_boundaryData$MdmsRes3 = _boundaryData$MdmsRes2.TenantBoundary) === null || _boundaryData$MdmsRes3 === void 0 ? void 0 : _boundaryData$MdmsRes3[0]);
9401
- const boundaries = (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.boundary) || (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.children) || [];
9402
- let allClusters = [];
9403
- if (selectedZones.length > 0 && Array.isArray(boundaries) && boundaries.length > 0) {
9404
- selectedZones.forEach(zone => {
9405
- const zoneBoundary = boundaries.find(b => b.code === zone.code);
9406
- const children = (zoneBoundary === null || zoneBoundary === void 0 ? void 0 : zoneBoundary.children) || (zoneBoundary === null || zoneBoundary === void 0 ? void 0 : zoneBoundary.boundary) || [];
9407
- if (Array.isArray(children)) {
9408
- children.forEach(child => {
9409
- allClusters.push({
9410
- code: child.code,
9411
- name: child.name
9412
- });
9413
- });
9414
- }
9415
- });
9852
+ render: props => /*#__PURE__*/React.createElement(Dropdown, {
9853
+ selected: VendorType,
9854
+ select: setVendorType,
9855
+ option: [{
9856
+ i18nKey: "Supplier",
9857
+ code: "SUPPLIER"
9858
+ }, {
9859
+ i18nKey: "Contractor",
9860
+ code: "CONTRACTOR"
9861
+ }],
9862
+ optionKey: "i18nKey",
9863
+ placeholder: "Select",
9864
+ t: t
9865
+ })
9866
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement("div", null, t("VENOR_CATEGORY"), /*#__PURE__*/React.createElement("div", {
9867
+ className: "tooltip",
9868
+ style: {
9869
+ width: "12px",
9870
+ height: "5px",
9871
+ marginLeft: "10px",
9872
+ display: "inline-flex",
9873
+ alignItems: "center"
9416
9874
  }
9417
- if (allClusters.length === 0) {
9418
- const staticClusters = {
9419
- "ZONE-01": [{
9420
- code: "CLUSTER-01",
9421
- name: "CLUSTER-01"
9422
- }],
9423
- "ZONE-02": [{
9424
- code: "CLUSTER-02",
9425
- name: "CLUSTER-02"
9426
- }],
9427
- "ZONE-03": [{
9428
- code: "CLUSTER-03",
9429
- name: "CLUSTER-03"
9430
- }],
9431
- "ZONE-04": [{
9432
- code: "CLUSTER-04",
9433
- name: "CLUSTER-04"
9434
- }],
9435
- "ZONE-05": [{
9436
- code: "CLUSTER-05",
9437
- name: "CLUSTER-05"
9438
- }]
9439
- };
9440
- if (selectedZones.length > 0) {
9441
- selectedZones.forEach(z => {
9442
- if (staticClusters[z.code]) {
9443
- allClusters = [...allClusters, ...staticClusters[z.code]];
9444
- } else {
9445
- allClusters.push({
9446
- code: z.code + "-C1",
9447
- name: z.name + " Cluster 1"
9448
- });
9449
- }
9450
- });
9451
- } else {
9452
- allClusters = [{
9453
- code: "CLUSTER-01",
9454
- name: "CLUSTER-01"
9455
- }, {
9456
- code: "CLUSTER-02",
9457
- name: "CLUSTER-02"
9458
- }, {
9459
- code: "CLUSTER-03",
9460
- name: "CLUSTER-03"
9461
- }];
9462
- }
9875
+ }, /*#__PURE__*/React.createElement("span", {
9876
+ className: "tooltiptext",
9877
+ style: {
9878
+ whiteSpace: "pre-wrap",
9879
+ fontSize: "small",
9880
+ wordWrap: "break-word",
9881
+ width: "300px",
9882
+ marginLeft: "15px",
9883
+ marginBottom: "-10px"
9463
9884
  }
9464
- if (allClusters.length > 0) {
9465
- allClusters = Array.from(new Map(allClusters.map(item => [item.code, item])).values());
9885
+ }))), /*#__PURE__*/React.createElement(Controller, {
9886
+ control: control,
9887
+ name: "VendorCategory",
9888
+ defaultValue: VendorCategory,
9889
+ rules: {
9890
+ required: t("CORE_COMMON_REQUIRED_ERRMSG")
9891
+ },
9892
+ render: props => /*#__PURE__*/React.createElement(Dropdown, {
9893
+ selected: VendorCategory,
9894
+ select: setVendorCategory,
9895
+ option: [{
9896
+ i18nKey: "Firm",
9897
+ code: "FIRM"
9898
+ }, {
9899
+ i18nKey: "Individual",
9900
+ code: "Individual"
9901
+ }],
9902
+ optionKey: "i18nKey",
9903
+ placeholder: "Select",
9904
+ t: t
9905
+ })
9906
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement("div", null, t("STATUS"), /*#__PURE__*/React.createElement("div", {
9907
+ className: "tooltip",
9908
+ style: {
9909
+ width: "12px",
9910
+ height: "5px",
9911
+ marginLeft: "10px",
9912
+ display: "inline-flex",
9913
+ alignItems: "center"
9466
9914
  }
9467
- setClusters(allClusters);
9468
- }, [selectedZones, boundaryData]);
9469
- const handleSelect = value => {
9470
- const extractedValue = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : value;
9471
- setSelectedClusters(extractedValue);
9472
- onSelect(config.key, extractedValue);
9473
- };
9474
- const isDisabled = selectedZones.length === 0;
9475
- return /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t(config.label) + (config.isMandatory ? " *" : "")), /*#__PURE__*/React.createElement("div", {
9476
- className: "field",
9915
+ }, /*#__PURE__*/React.createElement("span", {
9916
+ className: "tooltiptext",
9477
9917
  style: {
9478
- position: "relative",
9479
- zIndex: 9
9918
+ whiteSpace: "pre-wrap",
9919
+ fontSize: "small",
9920
+ wordWrap: "break-word",
9921
+ width: "300px",
9922
+ marginLeft: "15px",
9923
+ marginBottom: "-10px"
9480
9924
  }
9481
- }, /*#__PURE__*/React.createElement(MultiSelectDropdown, {
9482
- options: clusters,
9483
- selected: selectedClusters,
9484
- onSelect: handleSelect,
9485
- optionsKey: "name",
9486
- t: t,
9487
- ServerStyle: {
9488
- backgroundColor: "#fff"
9925
+ }, "" + t("AST_CLASSIFICATION_ASSET")))), /*#__PURE__*/React.createElement(Controller, {
9926
+ control: control,
9927
+ name: "Status",
9928
+ defaultValue: Status,
9929
+ rules: {
9930
+ required: t("CORE_COMMON_REQUIRED_ERRMSG")
9489
9931
  },
9490
- disable: isDisabled
9491
- })));
9492
- };
9493
-
9494
- const SelectEkycDropdown = _ref => {
9495
- var _config$populators, _config$populators2;
9496
- let config = _ref.config,
9497
- onSelect = _ref.onSelect,
9498
- t = _ref.t,
9499
- formData = _ref.formData;
9500
- const options = (config === null || config === void 0 ? void 0 : (_config$populators = config.populators) === null || _config$populators === void 0 ? void 0 : _config$populators.options) || [];
9501
- const optionsKey = (config === null || config === void 0 ? void 0 : (_config$populators2 = config.populators) === null || _config$populators2 === void 0 ? void 0 : _config$populators2.optionsKey) || "name";
9502
- const selected = formData === null || formData === void 0 ? void 0 : formData[config.key];
9503
- const handleSelect = value => {
9504
- onSelect(config.key, value);
9505
- };
9506
- return /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t(config.label)), /*#__PURE__*/React.createElement("div", {
9507
- className: "field"
9508
- }, /*#__PURE__*/React.createElement(Dropdown, {
9509
- selected: selected,
9510
- option: options,
9511
- select: handleSelect,
9512
- optionKey: optionsKey,
9513
- t: t
9514
- })));
9932
+ render: props => /*#__PURE__*/React.createElement(Dropdown, {
9933
+ selected: Status,
9934
+ select: setStatus,
9935
+ option: [{
9936
+ i18nKey: "Active",
9937
+ code: "ACTIVE"
9938
+ }, {
9939
+ i18nKey: "Inactive",
9940
+ code: "INACTIVE"
9941
+ }],
9942
+ optionKey: "i18nKey",
9943
+ placeholder: "Select",
9944
+ t: t
9945
+ })
9946
+ })))));
9515
9947
  };
9516
9948
 
9517
9949
  const componentsToRegister = {
9518
- VendorDetails,
9519
9950
  VendorDocuments,
9520
9951
  ServiceDoc,
9521
9952
  VendorSelectAddress,
@@ -9531,7 +9962,10 @@ const componentsToRegister = {
9531
9962
  SupervisorAreaAssignment,
9532
9963
  SelectEkycZones,
9533
9964
  SelectEkycClusters,
9534
- SelectEkycDropdown
9965
+ SelectEkycDropdown,
9966
+ VendorDetails,
9967
+ EditVendor,
9968
+ AdditionalDetails
9535
9969
  };
9536
9970
  const addComponentsToRegistry = () => {
9537
9971
  Object.entries(componentsToRegister).forEach(_ref => {