@djb25/digit-ui-module-vendor 1.0.64 → 1.0.66

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.
package/dist/index.js CHANGED
@@ -126,6 +126,22 @@ const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
126
126
  },
127
127
  className: "payment-form-text-input-correction"
128
128
  }
129
+ }, {
130
+ label: t("ES_VENDOR_ZONE"),
131
+ isMandatory: true,
132
+ type: "component",
133
+ key: "zoneIds",
134
+ populators: {
135
+ name: "zoneIds",
136
+ validation: {
137
+ required: true
138
+ },
139
+ className: "mb-16"
140
+ },
141
+ props: {
142
+ isMultiSelect: false
143
+ },
144
+ component: "SelectEkycZones"
129
145
  }, {
130
146
  label: t("ES_VENDOR_SURVEYOR_DESCRIPTION"),
131
147
  isMandatory: false,
@@ -139,7 +155,7 @@ const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
139
155
  };
140
156
 
141
157
  const AddSurveyor = _ref => {
142
- var _Digit$UserService$ge;
158
+ var _Digit$UserService$ge, _userInfo$roles;
143
159
  const _useTranslation = reactI18next.useTranslation(),
144
160
  t = _useTranslation.t;
145
161
  const history = reactRouterDom.useHistory();
@@ -156,14 +172,63 @@ const AddSurveyor = _ref => {
156
172
  setCanSubmit = _useState2[1];
157
173
  const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorCreate(tenantId),
158
174
  mutateAsync = _Digit$Hooks$fsm$useS.mutateAsync;
159
- const Config = SurveyorConfig(t);
160
- const defaultValues = {
161
- role: {
162
- code: "SURVEYOR",
163
- name: "Surveyor"
164
- },
165
- mobileNumber: ""
166
- };
175
+ const isSupervisor = userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$roles = userInfo.roles) === null || _userInfo$roles === void 0 ? void 0 : _userInfo$roles.some(role => role.code === "EKYC_SUPERVISOR");
176
+ const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
177
+ status: "ACTIVE"
178
+ }, {
179
+ enabled: isSupervisor,
180
+ staleTime: Infinity
181
+ }),
182
+ supervisorSearchResponse = _Digit$Hooks$fsm$useS2.data,
183
+ isSupervisorSearchLoading = _Digit$Hooks$fsm$useS2.isLoading;
184
+ const matchedSupervisor = React.useMemo(() => {
185
+ if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors)) return null;
186
+ return supervisorSearchResponse.supervisors.find(s => {
187
+ var _s$id, _userInfo$uuid, _s$owner, _s$owner$uuid, _userInfo$uuid2, _s$owner2;
188
+ return ((_s$id = s.id) === null || _s$id === void 0 ? void 0 : _s$id.toLowerCase()) === (userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$uuid = userInfo.uuid) === null || _userInfo$uuid === void 0 ? void 0 : _userInfo$uuid.toLowerCase()) || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : (_s$owner$uuid = _s$owner.uuid) === null || _s$owner$uuid === void 0 ? void 0 : _s$owner$uuid.toLowerCase()) === (userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$uuid2 = userInfo.uuid) === null || _userInfo$uuid2 === void 0 ? void 0 : _userInfo$uuid2.toLowerCase()) || ((_s$owner2 = s.owner) === null || _s$owner2 === void 0 ? void 0 : _s$owner2.mobileNumber) === (userInfo === null || userInfo === void 0 ? void 0 : userInfo.mobileNumber) || s.mobileNo === (userInfo === null || userInfo === void 0 ? void 0 : userInfo.mobileNumber);
189
+ });
190
+ }, [supervisorSearchResponse, userInfo]);
191
+ const _useState3 = React.useState(null),
192
+ defaultValues = _useState3[0],
193
+ setDefaultValues = _useState3[1];
194
+ React.useEffect(() => {
195
+ if (!isSupervisor) {
196
+ setDefaultValues({
197
+ role: {
198
+ code: "SURVEYOR",
199
+ name: "Surveyor"
200
+ },
201
+ mobileNumber: ""
202
+ });
203
+ } else if (supervisorSearchResponse && !isSupervisorSearchLoading) {
204
+ setDefaultValues({
205
+ role: {
206
+ code: "SURVEYOR",
207
+ name: "Surveyor"
208
+ },
209
+ mobileNumber: "",
210
+ zoneIds: (matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.assignedZoneId) || ""
211
+ });
212
+ }
213
+ }, [isSupervisor, supervisorSearchResponse, isSupervisorSearchLoading, matchedSupervisor]);
214
+ const Config = React.useMemo(() => {
215
+ const baseConfig = SurveyorConfig(t);
216
+ if (isSupervisor) {
217
+ return baseConfig.map(section => _extends({}, section, {
218
+ body: section.body.map(field => {
219
+ if (field.key === "zoneIds") {
220
+ return _extends({}, field, {
221
+ props: _extends({}, field.props, {
222
+ disable: true
223
+ })
224
+ });
225
+ }
226
+ return field;
227
+ })
228
+ }));
229
+ }
230
+ return baseConfig;
231
+ }, [t, isSupervisor]);
167
232
  const isValidAge = dateStr => {
168
233
  if (!dateStr) return false;
169
234
  const today = new Date();
@@ -188,8 +253,8 @@ const AddSurveyor = _ref => {
188
253
  };
189
254
  const onSubmit = function (data) {
190
255
  try {
191
- var _userInfo$roles, _Digit$UserService$ge2, _data$gender;
192
- const isSupervisor = userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$roles = userInfo.roles) === null || _userInfo$roles === void 0 ? void 0 : _userInfo$roles.some(role => role.code === "EKYC_SUPERVISOR");
256
+ var _data$zoneIds, _Digit$UserService$ge2, _data$gender;
257
+ const assignedZone = Array.isArray(data === null || data === void 0 ? void 0 : data.zoneIds) ? (data === null || data === void 0 ? void 0 : (_data$zoneIds = data.zoneIds) === null || _data$zoneIds === void 0 ? void 0 : _data$zoneIds.map(ele => ele.code).join(",")) || "" : (data === null || data === void 0 ? void 0 : data.zoneIds) || "";
193
258
  const formData = {
194
259
  RequestInfo: _extends({
195
260
  apiId: "Rainmaker",
@@ -211,6 +276,9 @@ const AddSurveyor = _ref => {
211
276
  }),
212
277
  surveyor: {
213
278
  tenantId: tenantId,
279
+ vendorId: isSupervisor ? matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.vendorId : undefined,
280
+ supervisorId: isSupervisor ? matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.id : undefined,
281
+ assignedZoneId: assignedZone,
214
282
  description: (data === null || data === void 0 ? void 0 : data.description) || "",
215
283
  correspondenceAddress: data === null || data === void 0 ? void 0 : data.correspondenceAddress,
216
284
  additionalDetails: {
@@ -253,6 +321,9 @@ const AddSurveyor = _ref => {
253
321
  return Promise.reject(e);
254
322
  }
255
323
  };
324
+ if (isSupervisor && (isSupervisorSearchLoading || !defaultValues)) {
325
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
326
+ }
256
327
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
257
328
  config: [{
258
329
  route: "surveyor-details",
@@ -1020,7 +1091,7 @@ const VendorInbox = props => {
1020
1091
  const userInfo = Digit.SessionStorage.get("User");
1021
1092
  const userRoles = userInfo.info.roles;
1022
1093
  const userType = (_userInfo$info$type = userInfo.info.type) === null || _userInfo$info$type === void 0 ? void 0 : _userInfo$info$type.toLowerCase();
1023
- const EKYC_ROLES = ["EKYC_VENDOR", "EKYC_SUPERVISOR", "EKYC_SURVEYOR"];
1094
+ const EKYC_ROLES = ["EKYC_SUPERVISOR", "EKYC_SURVEYOR"];
1024
1095
  const isEkycRole = userRoles === null || userRoles === void 0 ? void 0 : userRoles.some(role => EKYC_ROLES.includes((role === null || role === void 0 ? void 0 : role.code) || role));
1025
1096
  const openWorkOrderModal = vendorDetails => {
1026
1097
  setSelectedVendorForWorkOrder(vendorDetails);
@@ -1345,9 +1416,11 @@ const VendorInbox = props => {
1345
1416
  });
1346
1417
  },
1347
1418
  onSuccess: (data, variables) => {
1419
+ console.log("newStatus:", newStatus, "isDisable:", newStatus === "DISABLED");
1348
1420
  setShowToast({
1349
1421
  key: "success",
1350
- action: "SUPERVISOR"
1422
+ action: "SUPERVISOR",
1423
+ isDisable: newStatus === "DISABLED"
1351
1424
  });
1352
1425
  queryClient.invalidateQueries("FSM_SUPERVISOR_SEARCH");
1353
1426
  queryClient.invalidateQueries("SUPERVISOR_SEARCH");
@@ -1381,9 +1454,11 @@ const VendorInbox = props => {
1381
1454
  });
1382
1455
  },
1383
1456
  onSuccess: (data, variables) => {
1457
+ console.log("newStatus:", newStatus, "isDisable:", newStatus === "DISABLED");
1384
1458
  setShowToast({
1385
1459
  key: "success",
1386
- action: "SURVEYOR"
1460
+ action: "SURVEYOR",
1461
+ isDisable: newStatus === "DISABLED"
1387
1462
  });
1388
1463
  queryClient.invalidateQueries("FSM_SURVEYOR_SEARCH");
1389
1464
  queryClient.invalidateQueries("SURVEYOR_SEARCH");
@@ -1791,7 +1866,7 @@ const VendorInbox = props => {
1791
1866
  }
1792
1867
  const hasDetails = ((_row$original8 = row.original) === null || _row$original8 === void 0 ? void 0 : _row$original8.vendorAdditionalDetails) !== null;
1793
1868
  return /*#__PURE__*/React__default.createElement(reactRouterDom.Link, {
1794
- to: hasDetails ? "/digit-ui/" + userType + "/vendor/registry/additionaldetails/info?vendorId=" + vendorId : "/digit-ui/" + userType + "/vendor/registry/additionaldetails/vendor-details?vendorId=" + vendorId
1869
+ to: !hasDetails ? "/digit-ui/" + userType + "/vendor/registry/additionaldetails/info?vendorId=" + vendorId : "/digit-ui/" + userType + "/vendor/registry/vendor-details/" + vendorId
1795
1870
  }, /*#__PURE__*/React__default.createElement("button", {
1796
1871
  className: "submit-bar",
1797
1872
  style: {
@@ -4675,13 +4750,26 @@ const VendorConfig = function (t, module, genderMenu, update) {
4675
4750
  populators: {
4676
4751
  name: "dob",
4677
4752
  validation: {
4678
- required: true
4753
+ required: true,
4754
+ validate: value => {
4755
+ if (!value) return true;
4756
+ const dob = new Date(value);
4757
+ const today = new Date();
4758
+ let age = today.getFullYear() - dob.getFullYear();
4759
+ const m = today.getMonth() - dob.getMonth();
4760
+ if (m < 0 || m === 0 && today.getDate() < dob.getDate()) {
4761
+ age--;
4762
+ }
4763
+ return age >= 18 || t("ES_VENDOR_DOB_MIN_AGE_ERROR") || "Vendor must be 18 years or older";
4764
+ }
4679
4765
  },
4680
4766
  component: (props, customProps) => /*#__PURE__*/React__default.createElement(digitUiReactComponents.DatePicker, _extends({
4681
4767
  onChange: props.onChange,
4682
4768
  date: props.value
4683
4769
  }, customProps, {
4684
- max: convertEpochToDate(new Date().setFullYear(new Date().getFullYear()))
4770
+ isDOB: true,
4771
+ minAge: 18,
4772
+ max: convertEpochToDate(new Date().setFullYear(new Date().getFullYear() - 18))
4685
4773
  }))
4686
4774
  }
4687
4775
  }] : [])]
@@ -4706,7 +4794,8 @@ const VendorConfig = function (t, module, genderMenu, update) {
4706
4794
 
4707
4795
  const AddVendor = () => {
4708
4796
  var _Digit$UserService$ge, _formData$serviceType2;
4709
- const tenantId = Digit.ULBService.getCurrentTenantId();
4797
+ const rawTenantId = Digit.ULBService.getCurrentTenantId();
4798
+ const tenantId = rawTenantId !== null && rawTenantId !== void 0 && rawTenantId.includes(".") ? rawTenantId : rawTenantId + ".djb";
4710
4799
  const _useTranslation = reactI18next.useTranslation(),
4711
4800
  t = _useTranslation.t;
4712
4801
  const history = reactRouterDom.useHistory();
@@ -4928,7 +5017,7 @@ const AddVendor = () => {
4928
5017
  onError: error => {
4929
5018
  setShowToast({
4930
5019
  key: "error",
4931
- action: error
5020
+ action: (error === null || error === void 0 ? void 0 : error.message) || error
4932
5021
  });
4933
5022
  },
4934
5023
  onSuccess: () => {
@@ -5638,7 +5727,7 @@ const createConfig = [{
5638
5727
  body: [{
5639
5728
  route: "info",
5640
5729
  component: "ServiceDoc",
5641
- nextStep: "vendor-details",
5730
+ nextStep: "modify-details",
5642
5731
  key: "Documents"
5643
5732
  }, {
5644
5733
  route: "modify-details",
@@ -5688,12 +5777,19 @@ const VENDORCreate = _ref => {
5688
5777
  React__default.useEffect(() => {
5689
5778
  const searchParams = new URLSearchParams(search || window.location.search);
5690
5779
  const vendorId = searchParams.get("vendorId");
5691
- if (vendorId && params.vendor_id !== vendorId) {
5692
- setParams(_extends({}, params, {
5693
- vendor_id: vendorId
5694
- }));
5780
+ if (vendorId) {
5781
+ if (params.vendor_id !== vendorId) {
5782
+ setParams(_extends({}, params, {
5783
+ vendor_id: vendorId
5784
+ }));
5785
+ }
5786
+ } else {
5787
+ if (params && Object.keys(params).length > 0 && window.location.href.includes("/info") && sessionStorage.getItem("docReqScreenByBack") !== "true") {
5788
+ clearParams();
5789
+ queryClient.invalidateQueries("VENDOR_CREATE");
5790
+ }
5695
5791
  }
5696
- }, [search, window.location.search, params, setParams]);
5792
+ }, [search, pathname, params, setParams, clearParams, queryClient]);
5697
5793
  const goNext = (skipStep, index, isAddMultiple, key) => {
5698
5794
  let currentPath = pathname.split("/").pop(),
5699
5795
  lastchar = currentPath.charAt(currentPath.length - 1),
@@ -5735,10 +5831,6 @@ const VENDORCreate = _ref => {
5735
5831
  }
5736
5832
  redirectWithHistory(nextPage);
5737
5833
  };
5738
- if (params && Object.keys(params).length > 0 && window.location.href.includes("/info") && sessionStorage.getItem("docReqScreenByBack") !== "true") {
5739
- clearParams();
5740
- queryClient.invalidateQueries("VENDOR_CREATE");
5741
- }
5742
5834
  const vendorcreate = function () {
5743
5835
  try {
5744
5836
  history.push(match.path + "/acknowledgement");
@@ -5829,7 +5921,7 @@ const EditVendor = () => {
5829
5921
  const _useState = React.useState(null),
5830
5922
  showToast = _useState[0],
5831
5923
  setShowToast = _useState[1];
5832
- const _useState2 = React.useState(false),
5924
+ const _useState2 = React.useState(true),
5833
5925
  canSubmit = _useState2[0],
5834
5926
  setCanSubmit = _useState2[1];
5835
5927
  const _useState3 = React.useState({}),
@@ -5863,22 +5955,20 @@ const EditVendor = () => {
5863
5955
  const _useState6 = React.useState([]),
5864
5956
  zones = _useState6[0],
5865
5957
  setZones = _useState6[1];
5866
- const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
5867
- boundaryData = _Digit$Hooks$useCommo.data,
5958
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "common-masters", ["ZroOfficeList"]),
5959
+ zroData = _Digit$Hooks$useCommo.data,
5868
5960
  isLoading = _Digit$Hooks$useCommo.isLoading;
5869
5961
  React.useEffect(() => {
5870
- var _boundaryData$egovLo, _boundaryData$egovLo$, _boundaryData$MdmsRes, _boundaryData$MdmsRes2, _boundaryData$MdmsRes3;
5871
- 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]);
5872
- const boundaries = (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.boundary) || (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.children) || [];
5873
- if (Array.isArray(boundaries === null || boundaries === void 0 ? void 0 : boundaries.children) && (boundaries === null || boundaries === void 0 ? void 0 : boundaries.children.length) > 0) {
5874
- const allZones = boundaries.children.flatMap(assembly => ((assembly === null || assembly === void 0 ? void 0 : assembly.children) || []).map(zone => ({
5875
- code: zone.code,
5876
- name: zone.name
5877
- })));
5878
- const zonesList = [...new Map(allZones.map(zone => [zone.code, zone])).values()];
5879
- setZones(zonesList);
5962
+ var _zroData$commonMaste, _zroData$MdmsRes, _zroData$MdmsRes$comm;
5963
+ const zroOfficeList = (zroData === null || zroData === void 0 ? void 0 : (_zroData$commonMaste = zroData["common-masters"]) === null || _zroData$commonMaste === void 0 ? void 0 : _zroData$commonMaste.ZroOfficeList) || (zroData === null || zroData === void 0 ? void 0 : (_zroData$MdmsRes = zroData.MdmsRes) === null || _zroData$MdmsRes === void 0 ? void 0 : (_zroData$MdmsRes$comm = _zroData$MdmsRes["common-masters"]) === null || _zroData$MdmsRes$comm === void 0 ? void 0 : _zroData$MdmsRes$comm.ZroOfficeList) || [];
5964
+ if (Array.isArray(zroOfficeList)) {
5965
+ const activeZros = zroOfficeList.filter(zro => zro && zro.active).map(zro => ({
5966
+ code: zro.code,
5967
+ name: zro.code
5968
+ }));
5969
+ setZones(activeZros);
5880
5970
  }
5881
- }, [boundaryData]);
5971
+ }, [zroData]);
5882
5972
  React.useEffect(() => {
5883
5973
  var _genderTypeData$commo, _genderTypeData$commo2;
5884
5974
  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) {
@@ -5978,22 +6068,21 @@ const EditVendor = () => {
5978
6068
  if (typeof dsoDetails.zoneIds[0] === "object") return;
5979
6069
  setDefaultValues(prev => _extends({}, prev, {
5980
6070
  zoneIds: zones.filter(z => {
5981
- var _prev$zoneIds;
5982
- return prev === null || prev === void 0 ? void 0 : (_prev$zoneIds = prev.zoneIds) === null || _prev$zoneIds === void 0 ? void 0 : _prev$zoneIds.includes(z.name);
6071
+ const prevZones = (prev === null || prev === void 0 ? void 0 : prev.zoneIds) || [];
6072
+ return prevZones.some(prevZ => typeof prevZ === "object" ? (prevZ === null || prevZ === void 0 ? void 0 : prevZ.code) === z.code : prevZ === z.code || prevZ === z.name);
5983
6073
  })
5984
6074
  }));
5985
6075
  }, [dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.zoneIds, zones]);
5986
6076
  const onFormValueChange = (setValue, data) => {
5987
- var _data$propertyAddress, _data$propertyAddress2, _data$serviceType, _data$serviceType2;
5988
- 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);
6077
+ var _data$serviceType, _data$serviceType2, _data$serviceType2$co, _data$serviceType3, _data$serviceType3$i;
5989
6078
  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);
5990
- const isEkyc = (data === null || data === void 0 ? void 0 : (_data$serviceType2 = data.serviceType) === null || _data$serviceType2 === void 0 ? void 0 : _data$serviceType2.code) === "EKYC";
6079
+ const isEkyc = (data === null || data === void 0 ? void 0 : (_data$serviceType2 = data.serviceType) === null || _data$serviceType2 === void 0 ? void 0 : (_data$serviceType2$co = _data$serviceType2.code) === null || _data$serviceType2$co === void 0 ? void 0 : _data$serviceType2$co.toUpperCase()) === "EKYC" || (data === null || data === void 0 ? void 0 : (_data$serviceType3 = data.serviceType) === null || _data$serviceType3 === void 0 ? void 0 : (_data$serviceType3$i = _data$serviceType3.i18nKey) === null || _data$serviceType3$i === void 0 ? void 0 : _data$serviceType3$i.toUpperCase()) === "EKYC";
5991
6080
  let isEkycFieldsFilled = true;
5992
6081
  if (isEkyc) {
5993
- var _data$zoneIds, _data$clusterIds;
5994
- 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);
6082
+ var _data$zoneIds;
6083
+ 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.gender) && (data === null || data === void 0 ? void 0 : data.dob);
5995
6084
  }
5996
- if (isVendorDetailsFilled && isAddressFilled && isEkycFieldsFilled) {
6085
+ if (isVendorDetailsFilled && isEkycFieldsFilled) {
5997
6086
  setCanSubmit(true);
5998
6087
  } else {
5999
6088
  setCanSubmit(false);
@@ -6003,7 +6092,7 @@ const EditVendor = () => {
6003
6092
  setShowToast(null);
6004
6093
  };
6005
6094
  const onSubmit = data => {
6006
- 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;
6095
+ var _address$city, _address$city2, _address$city3, _address$city4, _address$locality, _address$locality2, _address$ward, _address$ward2, _mergedData$plotNo, _mergedData$buildingN, _mergedData$serviceTy, _mergedData$serviceTy2, _mergedData$serviceTy3, _mergedData$serviceTy4, _mergedData$address, _mergedData$address2, _mergedData$relations, _mergedData$gender, _mergedData$serviceTy5;
6007
6096
  const mergedData = data;
6008
6097
  const address = mergedData === null || mergedData === void 0 ? void 0 : mergedData.propertyAddress;
6009
6098
  const pincode = address === null || address === void 0 ? void 0 : address.pincode;
@@ -6024,7 +6113,7 @@ const EditVendor = () => {
6024
6113
  const buildingName = mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$buildingN = mergedData.buildingName) === null || _mergedData$buildingN === void 0 ? void 0 : _mergedData$buildingN.trim();
6025
6114
  const emailId = mergedData === null || mergedData === void 0 ? void 0 : mergedData.emailId;
6026
6115
  const phone = mergedData === null || mergedData === void 0 ? void 0 : mergedData.phone;
6027
- const isEkyc = (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$serviceTy = mergedData.serviceType) === null || _mergedData$serviceTy === void 0 ? void 0 : _mergedData$serviceTy.i18nKey) === "EKYC";
6116
+ const isEkyc = (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$serviceTy = mergedData.serviceType) === null || _mergedData$serviceTy === void 0 ? void 0 : (_mergedData$serviceTy2 = _mergedData$serviceTy.code) === null || _mergedData$serviceTy2 === void 0 ? void 0 : _mergedData$serviceTy2.toUpperCase()) === "EKYC" || (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$serviceTy3 = mergedData.serviceType) === null || _mergedData$serviceTy3 === void 0 ? void 0 : (_mergedData$serviceTy4 = _mergedData$serviceTy3.i18nKey) === null || _mergedData$serviceTy4 === void 0 ? void 0 : _mergedData$serviceTy4.toUpperCase()) === "EKYC";
6028
6117
  let vendorData = _extends({}, dsoDetails, {
6029
6118
  tenantId: tenantId,
6030
6119
  name,
@@ -6069,7 +6158,7 @@ const EditVendor = () => {
6069
6158
  mobileNumber: phone
6070
6159
  }),
6071
6160
  additionalDetails: {
6072
- serviceType: isEkyc ? "ekyc" : mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$serviceTy2 = mergedData.serviceType) === null || _mergedData$serviceTy2 === void 0 ? void 0 : _mergedData$serviceTy2.code
6161
+ serviceType: isEkyc ? "ekyc" : mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$serviceTy5 = mergedData.serviceType) === null || _mergedData$serviceTy5 === void 0 ? void 0 : _mergedData$serviceTy5.code
6073
6162
  },
6074
6163
  vehicles: [],
6075
6164
  drivers: [],
@@ -6100,7 +6189,7 @@ const EditVendor = () => {
6100
6189
  onError: error => {
6101
6190
  setShowToast({
6102
6191
  key: "error",
6103
- action: error
6192
+ action: (error === null || error === void 0 ? void 0 : error.message) || error
6104
6193
  });
6105
6194
  },
6106
6195
  onSuccess: () => {
@@ -6562,6 +6651,9 @@ const ServiceDoc = _ref => {
6562
6651
  _Digit$Hooks$asset$us2 = _Digit$Hooks$asset$us.data,
6563
6652
  Documentsob = _Digit$Hooks$asset$us2 === void 0 ? {} : _Digit$Hooks$asset$us2;
6564
6653
  let docs = Documentsob === null || Documentsob === void 0 ? void 0 : (_Documentsob$ASSET = Documentsob.ASSET) === null || _Documentsob$ASSET === void 0 ? void 0 : _Documentsob$ASSET.Documents;
6654
+ const onSubmit = () => {
6655
+ onSelect(config.key, {});
6656
+ };
6565
6657
  return /*#__PURE__*/React__default.createElement("div", {
6566
6658
  className: "employee-form-content"
6567
6659
  }, isLoading && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null), Array.isArray(docs) && docs.map((_ref2, index) => {
@@ -6583,7 +6675,7 @@ const ServiceDoc = _ref => {
6583
6675
  }, dropdownIndex + 1, ". ", t(stringReplaceAll(dropdownData === null || dropdownData === void 0 ? void 0 : dropdownData.code, ".", "_")))));
6584
6676
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
6585
6677
  label: t("COMMON_NEXT"),
6586
- onSubmit: onSelect
6678
+ onSubmit: onSubmit
6587
6679
  })));
6588
6680
  };
6589
6681
 
@@ -7666,91 +7758,91 @@ const CheckPage = _ref2 => {
7666
7758
  label: t("VENDOR_ID"),
7667
7759
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : vendordet.VendorId)),
7668
7760
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7669
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7761
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7670
7762
  })
7671
7763
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7672
7764
  label: t("VENDOR_BANK_IFSC_CODE"),
7673
7765
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : vendordet.IFSC)),
7674
7766
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7675
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7767
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7676
7768
  })
7677
7769
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7678
7770
  label: t("VENDOR_BANK_NAME"),
7679
7771
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : vendordet.Bank)),
7680
7772
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7681
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7773
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7682
7774
  })
7683
7775
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7684
7776
  label: t("VENDOR_BANK_BRANCH"),
7685
7777
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : vendordet.BankbranchName)),
7686
7778
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7687
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7779
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7688
7780
  })
7689
7781
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7690
7782
  label: t("VENDOR_MICR_NO"),
7691
7783
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : vendordet.micrNo)),
7692
7784
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7693
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7785
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7694
7786
  })
7695
7787
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7696
7788
  label: t("BANK_ACCONT_NO"),
7697
7789
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : vendordet.AccountNo)),
7698
7790
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7699
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7791
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7700
7792
  })
7701
7793
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7702
7794
  label: t("PAN_NO"),
7703
7795
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : vendordet.PanNo)),
7704
7796
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7705
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7797
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7706
7798
  })
7707
7799
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7708
7800
  label: t("GST_NO"),
7709
7801
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : vendordet.GstNo)),
7710
7802
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7711
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7803
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7712
7804
  })
7713
7805
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7714
7806
  label: t("GST_REGISTERED_STATE/UT"),
7715
7807
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : vendordet.GstState)),
7716
7808
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7717
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7809
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7718
7810
  })
7719
7811
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7720
7812
  label: t("REGISTRATION_NO"),
7721
7813
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : vendordet.RegistrationNo)),
7722
7814
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7723
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7815
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7724
7816
  })
7725
7817
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7726
7818
  label: t("EPF_NO"),
7727
7819
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : vendordet.EpfNo)),
7728
7820
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7729
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7821
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7730
7822
  })
7731
7823
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7732
7824
  label: t("ESI_NO"),
7733
7825
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : vendordet.EsiNo)),
7734
7826
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7735
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7827
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7736
7828
  })
7737
7829
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7738
7830
  label: t("VENDOR_TYPE"),
7739
7831
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : (_vendordet$VendorType = vendordet.VendorType) === null || _vendordet$VendorType === void 0 ? void 0 : _vendordet$VendorType.code)),
7740
7832
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7741
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7833
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7742
7834
  })
7743
7835
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7744
7836
  label: t("VENDOR_CATEGORY"),
7745
7837
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : (_vendordet$VendorCate = vendordet.VendorCategory) === null || _vendordet$VendorCate === void 0 ? void 0 : _vendordet$VendorCate.code)),
7746
7838
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7747
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7839
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7748
7840
  })
7749
7841
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7750
7842
  label: t("VENDOR_STATUS"),
7751
7843
  text: "" + t(checkForNA(vendordet === null || vendordet === void 0 ? void 0 : (_vendordet$Status = vendordet.Status) === null || _vendordet$Status === void 0 ? void 0 : _vendordet$Status.code)),
7752
7844
  actionButton: /*#__PURE__*/React__default.createElement(ActionButton, {
7753
- jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/vendor-details"
7845
+ jumpTo: "/digit-ui/" + (window.location.pathname.includes("/citizen") ? "citizen" : "employee") + "/vendor/registry/additionaldetails/modify-details"
7754
7846
  })
7755
7847
  }))), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSubHeader, null, t("VENDOR_DOCUMENTS_DETAILS")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.StatusTable, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.StatusTable, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
7756
7848
  label: t("VENDOR_DOCUMENTS"),
@@ -9463,14 +9555,17 @@ const VehicleDetails = props => {
9463
9555
  };
9464
9556
 
9465
9557
  const SelectEkycZones = _ref => {
9466
- var _Digit$SessionStorage, _loggedInUser$roles;
9558
+ var _Digit$SessionStorage, _loggedInUser$roles, _config$props;
9467
9559
  let config = _ref.config,
9468
9560
  onSelect = _ref.onSelect,
9469
9561
  t = _ref.t,
9470
9562
  formData = _ref.formData,
9471
9563
  _ref$isMultiSelect = _ref.isMultiSelect,
9472
- isMultiSelect = _ref$isMultiSelect === void 0 ? true : _ref$isMultiSelect;
9473
- const tenantId = Digit.ULBService.getCurrentTenantId();
9564
+ isMultiSelect = _ref$isMultiSelect === void 0 ? true : _ref$isMultiSelect,
9565
+ _ref$disable = _ref.disable,
9566
+ disable = _ref$disable === void 0 ? false : _ref$disable;
9567
+ const rawTenantId = Digit.ULBService.getCurrentTenantId();
9568
+ const tenantId = rawTenantId !== null && rawTenantId !== void 0 && rawTenantId.includes(".") ? rawTenantId : rawTenantId + ".djb";
9474
9569
  const _useState = React.useState([]),
9475
9570
  zones = _useState[0],
9476
9571
  setZones = _useState[1];
@@ -9478,16 +9573,25 @@ const SelectEkycZones = _ref => {
9478
9573
  selectedZones = _useState2[0],
9479
9574
  setSelectedZones = _useState2[1];
9480
9575
  const initialized = React.useRef(false);
9576
+ const isVendorPage = window.location.pathname.includes("/new-vendor") || window.location.pathname.includes("/modify-vendor") || window.location.href.includes("/new-vendor") || window.location.href.includes("/modify-vendor");
9481
9577
  const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
9482
9578
  const roles = (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$roles = loggedInUser.roles) === null || _loggedInUser$roles === void 0 ? void 0 : _loggedInUser$roles.map(r => r.code)) || [];
9483
9579
  const isEkycVendor = roles.includes("EKYC_VENDOR");
9580
+ const isEkycSupervisor = roles.includes("EKYC_SUPERVISOR");
9484
9581
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
9485
9582
  status: "ACTIVE"
9486
9583
  }, {
9487
- enabled: isEkycVendor
9584
+ enabled: isEkycVendor && !isVendorPage
9488
9585
  }),
9489
9586
  vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
9490
9587
  isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
9588
+ const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
9589
+ status: "ACTIVE"
9590
+ }, {
9591
+ enabled: isEkycSupervisor
9592
+ }),
9593
+ supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
9594
+ isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
9491
9595
  const matchedVendor = React__default.useMemo(() => {
9492
9596
  var _vendorSearchResponse, _vendorSearchResponse2;
9493
9597
  if (!vendorSearchResponse) return null;
@@ -9501,35 +9605,36 @@ const SelectEkycZones = _ref => {
9501
9605
  return userUuid && ownerUuid === userUuid || userMobile && ownerMobile === userMobile;
9502
9606
  })) === null || _vendorSearchResponse === void 0 ? void 0 : _vendorSearchResponse.dsoDetails) || ((_vendorSearchResponse2 = vendorSearchResponse[0]) === null || _vendorSearchResponse2 === void 0 ? void 0 : _vendorSearchResponse2.dsoDetails) || vendorSearchResponse[0];
9503
9607
  }, [vendorSearchResponse, loggedInUser]);
9504
- const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
9505
- boundaryData = _Digit$Hooks$useCommo.data,
9608
+ const matchedSupervisor = React__default.useMemo(() => {
9609
+ if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors)) return null;
9610
+ return supervisorSearchResponse.supervisors.find(s => {
9611
+ var _s$id, _loggedInUser$uuid, _s$owner, _s$owner$uuid, _loggedInUser$uuid2, _s$owner2;
9612
+ return ((_s$id = s.id) === null || _s$id === void 0 ? void 0 : _s$id.toLowerCase()) === (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$uuid = loggedInUser.uuid) === null || _loggedInUser$uuid === void 0 ? void 0 : _loggedInUser$uuid.toLowerCase()) || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : (_s$owner$uuid = _s$owner.uuid) === null || _s$owner$uuid === void 0 ? void 0 : _s$owner$uuid.toLowerCase()) === (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$uuid2 = loggedInUser.uuid) === null || _loggedInUser$uuid2 === void 0 ? void 0 : _loggedInUser$uuid2.toLowerCase()) || ((_s$owner2 = s.owner) === null || _s$owner2 === void 0 ? void 0 : _s$owner2.mobileNumber) === (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber) || s.mobileNo === (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber);
9613
+ });
9614
+ }, [supervisorSearchResponse, loggedInUser]);
9615
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS("dl", "common-masters", ["ZroOfficeList"]),
9616
+ zroData = _Digit$Hooks$useCommo.data,
9506
9617
  isLoading = _Digit$Hooks$useCommo.isLoading;
9507
9618
  React.useEffect(() => {
9508
- var _boundaryData$egovLo, _boundaryData$egovLo$, _boundaryData$MdmsRes, _boundaryData$MdmsRes2, _boundaryData$MdmsRes3;
9509
- 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]);
9510
- const boundaries = (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.boundary) || (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.children) || [];
9511
- if (Array.isArray(boundaries === null || boundaries === void 0 ? void 0 : boundaries.children)) {
9512
- const allZones = boundaries.children.flatMap(assembly => (assembly.children || []).map(zone => ({
9513
- code: zone.code,
9514
- name: zone.name
9515
- })));
9516
- let zonesList = [...new Map(allZones.map(z => [z.code, z])).values()];
9517
- if (isEkycVendor && matchedVendor !== null && matchedVendor !== void 0 && matchedVendor.zoneIds) {
9518
- const assignedZoneCodes = matchedVendor.zoneIds.map(z => String(z).toUpperCase());
9519
- zonesList = zonesList.filter(z => assignedZoneCodes.includes(String(z.code).toUpperCase()) || assignedZoneCodes.includes(String(z.name).toUpperCase()));
9520
- }
9521
- setZones(zonesList);
9619
+ var _zroData$commonMaste, _zroData$MdmsRes, _zroData$MdmsRes$comm;
9620
+ const zroOfficeList = (zroData === null || zroData === void 0 ? void 0 : (_zroData$commonMaste = zroData["common-masters"]) === null || _zroData$commonMaste === void 0 ? void 0 : _zroData$commonMaste.ZroOfficeList) || (zroData === null || zroData === void 0 ? void 0 : (_zroData$MdmsRes = zroData.MdmsRes) === null || _zroData$MdmsRes === void 0 ? void 0 : (_zroData$MdmsRes$comm = _zroData$MdmsRes["common-masters"]) === null || _zroData$MdmsRes$comm === void 0 ? void 0 : _zroData$MdmsRes$comm.ZroOfficeList) || [];
9621
+ if (Array.isArray(zroOfficeList)) {
9622
+ const activeZros = zroOfficeList.filter(zro => zro && zro.active).map(zro => ({
9623
+ code: zro.code,
9624
+ name: zro.code
9625
+ }));
9626
+ setZones(activeZros);
9522
9627
  }
9523
- }, [boundaryData, isEkycVendor, matchedVendor]);
9628
+ }, [zroData]);
9524
9629
  React.useEffect(() => {
9525
9630
  if (!zones.length || !(formData !== null && formData !== void 0 && formData.zoneIds)) return;
9526
9631
  if (isMultiSelect) {
9527
9632
  if (!Array.isArray(formData.zoneIds)) return;
9528
- if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object") {
9529
- setSelectedZones(formData.zoneIds);
9633
+ if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object" && formData.zoneIds[0] !== null) {
9634
+ setSelectedZones(formData.zoneIds.filter(Boolean));
9530
9635
  return;
9531
9636
  }
9532
- const selected = zones.filter(zone => formData.zoneIds.includes(zone.name) || formData.zoneIds.includes(zone.code));
9637
+ const selected = zones.filter(zone => zone && (formData.zoneIds.includes(zone.name) || formData.zoneIds.includes(zone.code)));
9533
9638
  setSelectedZones(selected);
9534
9639
  if (!initialized.current) {
9535
9640
  initialized.current = true;
@@ -9541,10 +9646,10 @@ const SelectEkycZones = _ref => {
9541
9646
  var _selectedVal$, _selectedVal$2;
9542
9647
  selectedVal = ((_selectedVal$ = selectedVal[0]) === null || _selectedVal$ === void 0 ? void 0 : _selectedVal$.name) || ((_selectedVal$2 = selectedVal[0]) === null || _selectedVal$2 === void 0 ? void 0 : _selectedVal$2.code) || selectedVal[0] || "";
9543
9648
  }
9544
- if (typeof selectedVal === "object") {
9649
+ if (selectedVal && typeof selectedVal === "object") {
9545
9650
  selectedVal = selectedVal.name || selectedVal.code || "";
9546
9651
  }
9547
- const selected = zones.find(zone => zone.name === selectedVal || zone.code === selectedVal);
9652
+ const selected = zones.find(zone => zone && (zone.name === selectedVal || zone.code === selectedVal));
9548
9653
  setSelectedZones(selected ? [selected] : []);
9549
9654
  if (!initialized.current && selected) {
9550
9655
  initialized.current = true;
@@ -9552,6 +9657,13 @@ const SelectEkycZones = _ref => {
9552
9657
  }
9553
9658
  }
9554
9659
  }, [zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, config.key, onSelect, isMultiSelect]);
9660
+ React.useEffect(() => {
9661
+ if (isEkycSupervisor && zones.length > 0 && !(formData !== null && formData !== void 0 && formData.zoneIds) && !initialized.current) {
9662
+ initialized.current = true;
9663
+ setSelectedZones([zones[0]]);
9664
+ onSelect(config.key, zones[0].name || "");
9665
+ }
9666
+ }, [isEkycSupervisor, zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, config.key, onSelect]);
9555
9667
  const handleSelect = value => {
9556
9668
  if (isMultiSelect) {
9557
9669
  const selected = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : [];
@@ -9563,7 +9675,7 @@ const SelectEkycZones = _ref => {
9563
9675
  onSelect(config.key, (selectedZone === null || selectedZone === void 0 ? void 0 : selectedZone.name) || "");
9564
9676
  }
9565
9677
  };
9566
- if (isLoading || isEkycVendor && isVendorSearchLoading) return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
9678
+ if (isLoading || isEkycVendor && !isVendorPage && isVendorSearchLoading || isEkycSupervisor && isSupervisorSearchLoading) return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
9567
9679
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t(config.label), config.isMandatory ? /*#__PURE__*/React__default.createElement("span", {
9568
9680
  className: "check-page-link-button"
9569
9681
  }, " * ") : ""), /*#__PURE__*/React__default.createElement("div", {
@@ -9584,13 +9696,14 @@ const SelectEkycZones = _ref => {
9584
9696
  ServerStyle: {
9585
9697
  backgroundColor: "#fff"
9586
9698
  },
9587
- defaultLabel: isMultiSelect ? selectedZones.length + " Selected" : ""
9699
+ defaultLabel: isMultiSelect ? selectedZones.length + " Selected" : "",
9700
+ disable: disable || isEkycSupervisor || ((_config$props = config.props) === null || _config$props === void 0 ? void 0 : _config$props.disable) || config.disable
9588
9701
  })), isMultiSelect && selectedZones.length > 0 && /*#__PURE__*/React__default.createElement("div", {
9589
9702
  className: "selected-zones"
9590
- }, selectedZones.map(zone => /*#__PURE__*/React__default.createElement("span", {
9703
+ }, selectedZones.filter(zone => zone && zone.code).map(zone => /*#__PURE__*/React__default.createElement("span", {
9591
9704
  key: zone.code,
9592
9705
  className: "selected-zone-chip"
9593
- }, zone.name))));
9706
+ }, t(zone.code)))));
9594
9707
  };
9595
9708
 
9596
9709
  const SelectEkycClusters = _ref => {
@@ -9730,70 +9843,82 @@ const SelectEkycDropdown = _ref => {
9730
9843
  };
9731
9844
 
9732
9845
  const AdditionalDetails = _ref => {
9733
- var _formData$ownerKey, _formData$ownerKey2, _formData$ownerKey3, _formData$ownerKey4;
9846
+ var _formData$ownerKey, _formData$ownerKey2, _formData$ownerKey3, _formData$ownerKey4, _formData$config$key, _formData$config$key2, _formData$config$key3, _formData$config$key4, _formData$config$key5, _formData$config$key6, _formData$config$key7, _formData$config$key8, _formData$config$key9, _formData$config$key0, _formData$config$key1, _formData$config$key10, _formData$config$key11, _formData$config$key12, _formData$config$key13, _formData$config$key14, _formData$config$key15, _formData$config$key16;
9734
9847
  let t = _ref.t,
9735
9848
  config = _ref.config,
9736
9849
  onSelect = _ref.onSelect,
9737
9850
  userType = _ref.userType,
9738
9851
  formData = _ref.formData;
9739
9852
  let index = 0;
9853
+ const rawTenantId = Digit.ULBService.getCurrentTenantId();
9854
+ const tenantId = rawTenantId !== null && rawTenantId !== void 0 && rawTenantId.includes(".") ? rawTenantId : rawTenantId + ".djb";
9855
+ const vendorId = (formData === null || formData === void 0 ? void 0 : formData.vendor_id) || new URLSearchParams(window.location.search).get("vendorId");
9856
+ const _Digit$Hooks$vendor$u = Digit.Hooks.vendor.useEmpvendorCommonSearch({
9857
+ tenantId,
9858
+ filters: {
9859
+ vendorId: vendorId
9860
+ }
9861
+ }, {
9862
+ enabled: !!vendorId
9863
+ }),
9864
+ vendorAdditionalData = _Digit$Hooks$vendor$u.data;
9740
9865
  const user = Digit.UserService.getUser().info;
9741
9866
  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) || "";
9742
9867
  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) || "";
9743
9868
  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);
9744
9869
  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) || "";
9745
- const _useState = React.useState(""),
9870
+ const _useState = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key = formData[config.key]) === null || _formData$config$key === void 0 ? void 0 : _formData$config$key.VendorCategory) || ""),
9746
9871
  VendorCategory = _useState[0],
9747
9872
  setVendorCategory = _useState[1];
9748
- const _useState2 = React.useState(""),
9873
+ const _useState2 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key2 = formData[config.key]) === null || _formData$config$key2 === void 0 ? void 0 : _formData$config$key2.VendorId) || ""),
9749
9874
  VendorId = _useState2[0],
9750
9875
  setVendorId = _useState2[1];
9751
- const _useState3 = React.useState(""),
9876
+ const _useState3 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key3 = formData[config.key]) === null || _formData$config$key3 === void 0 ? void 0 : _formData$config$key3.name) || ""),
9752
9877
  userName = _useState3[0],
9753
9878
  setUserName = _useState3[1];
9754
- const _useState4 = React.useState(""),
9879
+ const _useState4 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key4 = formData[config.key]) === null || _formData$config$key4 === void 0 ? void 0 : _formData$config$key4.Bank) || ""),
9755
9880
  Bank = _useState4[0],
9756
9881
  setBank = _useState4[1];
9757
- const _useState5 = React.useState(),
9882
+ const _useState5 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key5 = formData[config.key]) === null || _formData$config$key5 === void 0 ? void 0 : _formData$config$key5.BankbranchName) || undefined),
9758
9883
  BankbranchName = _useState5[0],
9759
9884
  setBankbranchName = _useState5[1];
9760
- const _useState6 = React.useState(""),
9885
+ const _useState6 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key6 = formData[config.key]) === null || _formData$config$key6 === void 0 ? void 0 : _formData$config$key6.IFSC) || ""),
9761
9886
  IFSC = _useState6[0],
9762
9887
  setIFSC = _useState6[1];
9763
- const _useState7 = React.useState(""),
9888
+ const _useState7 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key7 = formData[config.key]) === null || _formData$config$key7 === void 0 ? void 0 : _formData$config$key7.AccountNo) || ""),
9764
9889
  AccountNo = _useState7[0],
9765
9890
  setAccountNo = _useState7[1];
9766
- const _useState8 = React.useState(""),
9891
+ const _useState8 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key8 = formData[config.key]) === null || _formData$config$key8 === void 0 ? void 0 : _formData$config$key8.PanNo) || ""),
9767
9892
  PanNo = _useState8[0],
9768
9893
  setPanNo = _useState8[1];
9769
- const _useState9 = React.useState(""),
9894
+ const _useState9 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key9 = formData[config.key]) === null || _formData$config$key9 === void 0 ? void 0 : _formData$config$key9.GstNo) || ""),
9770
9895
  GstNo = _useState9[0],
9771
9896
  setGstNo = _useState9[1];
9772
- const _useState0 = React.useState(""),
9897
+ const _useState0 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key0 = formData[config.key]) === null || _formData$config$key0 === void 0 ? void 0 : _formData$config$key0.GstState) || ""),
9773
9898
  GstState = _useState0[0],
9774
9899
  setGstState = _useState0[1];
9775
- const _useState1 = React.useState(""),
9900
+ const _useState1 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key1 = formData[config.key]) === null || _formData$config$key1 === void 0 ? void 0 : _formData$config$key1.RegistrationNo) || ""),
9776
9901
  RegistrationNo = _useState1[0],
9777
9902
  setRegistrationNo = _useState1[1];
9778
- const _useState10 = React.useState(""),
9903
+ const _useState10 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key10 = formData[config.key]) === null || _formData$config$key10 === void 0 ? void 0 : _formData$config$key10.EpfNo) || ""),
9779
9904
  EpfNo = _useState10[0],
9780
9905
  setEpfNo = _useState10[1];
9781
- const _useState11 = React.useState(""),
9906
+ const _useState11 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key11 = formData[config.key]) === null || _formData$config$key11 === void 0 ? void 0 : _formData$config$key11.EsiNo) || ""),
9782
9907
  EsiNo = _useState11[0],
9783
9908
  setEsiNo = _useState11[1];
9784
- const _useState12 = React.useState(""),
9909
+ const _useState12 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key12 = formData[config.key]) === null || _formData$config$key12 === void 0 ? void 0 : _formData$config$key12.VendorType) || ""),
9785
9910
  VendorType = _useState12[0],
9786
9911
  setVendorType = _useState12[1];
9787
- const _useState13 = React.useState(""),
9912
+ const _useState13 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key13 = formData[config.key]) === null || _formData$config$key13 === void 0 ? void 0 : _formData$config$key13.Status) || ""),
9788
9913
  Status = _useState13[0],
9789
9914
  setStatus = _useState13[1];
9790
- const _useState14 = React.useState(""),
9915
+ const _useState14 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key14 = formData[config.key]) === null || _formData$config$key14 === void 0 ? void 0 : _formData$config$key14.micrNo) || ""),
9791
9916
  micrNo = _useState14[0],
9792
9917
  setmicrNo = _useState14[1];
9793
- const _useState15 = React.useState(""),
9918
+ const _useState15 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key15 = formData[config.key]) === null || _formData$config$key15 === void 0 ? void 0 : _formData$config$key15.PhoneNo) || ""),
9794
9919
  PhoneNo = _useState15[0],
9795
9920
  setPhoneNo = _useState15[1];
9796
- const _useState16 = React.useState(""),
9921
+ const _useState16 = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key16 = formData[config.key]) === null || _formData$config$key16 === void 0 ? void 0 : _formData$config$key16.ContactPerson) || ""),
9797
9922
  ContactPerson = _useState16[0],
9798
9923
  setContactPerson = _useState16[1];
9799
9924
  React.useEffect(() => {
@@ -9853,22 +9978,59 @@ const AdditionalDetails = _ref => {
9853
9978
  function setcontactperson(e) {
9854
9979
  setContactPerson(e.target.value);
9855
9980
  }
9856
- const tenantId = Digit.ULBService.getCurrentTenantId();
9857
9981
  const _useForm = reactHookForm.useForm(),
9858
9982
  control = _useForm.control;
9859
9983
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
9984
+ ids: vendorId
9985
+ }, {
9986
+ enabled: !!vendorId,
9860
9987
  staleTime: Infinity
9861
9988
  }),
9862
9989
  dsoData = _Digit$Hooks$fsm$useD.data;
9863
9990
  React.useEffect(() => {
9864
- if (dsoData) {
9865
- const vendor = dsoData.find(item => item.id);
9866
- if (vendor) {
9867
- setUserName(vendor.name);
9868
- setVendorId(vendor.id);
9869
- }
9991
+ if (dsoData && dsoData.length > 0) {
9992
+ const vendor = dsoData[0];
9993
+ setUserName(vendor.name);
9994
+ setVendorId(vendor.id);
9870
9995
  }
9871
9996
  }, [dsoData]);
9997
+ React.useEffect(() => {
9998
+ var _vendorAdditionalData, _vendorAdditionalData2;
9999
+ if (vendorAdditionalData !== null && vendorAdditionalData !== void 0 && (_vendorAdditionalData = vendorAdditionalData.VendorDetails) !== null && _vendorAdditionalData !== void 0 && (_vendorAdditionalData2 = _vendorAdditionalData[0]) !== null && _vendorAdditionalData2 !== void 0 && _vendorAdditionalData2.vendorAdditionalDetails) {
10000
+ const details = vendorAdditionalData.VendorDetails[0].vendorAdditionalDetails;
10001
+ if (details.ifscCode) setIFSC(details.ifscCode);
10002
+ if (details.bank) setBank(details.bank);
10003
+ if (details.bankBranchName) setBankbranchName(details.bankBranchName);
10004
+ if (details.micrNo) setmicrNo(details.micrNo);
10005
+ if (details.bankAccountNumber) setAccountNo(details.bankAccountNumber);
10006
+ if (details.vendorPhone) setPhoneNo(details.vendorPhone);
10007
+ if (details.contactPerson) setContactPerson(details.contactPerson);
10008
+ if (details.panNo) setPanNo(details.panNo);
10009
+ if (details.gstTinNo) setGstNo(details.gstTinNo);
10010
+ if (details.gstRegisteredState) setGstState(details.gstRegisteredState);
10011
+ if (details.registrationNo) setRegistrationNo(details.registrationNo);
10012
+ if (details.epfNo) setEpfNo(details.epfNo);
10013
+ if (details.esiNo) setEsiNo(details.esiNo);
10014
+ if (details.serviceType) {
10015
+ setVendorType({
10016
+ code: details.serviceType,
10017
+ i18nKey: details.serviceType === "SUPPLIER" ? "Supplier" : details.serviceType === "CONTRACTOR" ? "Contractor" : details.serviceType
10018
+ });
10019
+ }
10020
+ if (details.vendorCategory) {
10021
+ setVendorCategory({
10022
+ code: details.vendorCategory,
10023
+ i18nKey: details.vendorCategory === "FIRM" ? "Firm" : details.vendorCategory === "Individual" ? "Individual" : details.vendorCategory
10024
+ });
10025
+ }
10026
+ if (details.status) {
10027
+ setStatus({
10028
+ code: details.status,
10029
+ i18nKey: details.status === "ACTIVE" ? "Active" : details.status === "INACTIVE" ? "Inactive" : details.status
10030
+ });
10031
+ }
10032
+ }
10033
+ }, [vendorAdditionalData]);
9872
10034
  const goNext = () => {
9873
10035
  let owner = formData.ownerKey && formData.ownerKey[index];
9874
10036
  let ownerStep;