@djb25/digit-ui-module-vendor 1.0.58 → 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.
package/dist/index.js CHANGED
@@ -1037,7 +1037,6 @@ const VendorInbox = props => {
1037
1037
  key: "error",
1038
1038
  action: "Failed to fetch document."
1039
1039
  });
1040
- setTimeout(closeToast, 5000);
1041
1040
  });
1042
1041
  return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
1043
1042
  } catch (e) {
@@ -2327,6 +2326,14 @@ const SearchVendor = () => {
2327
2326
  const _useState9 = React.useState(null),
2328
2327
  showToast = _useState9[0],
2329
2328
  setShowToast = _useState9[1];
2329
+ const _Digit$Hooks$useToast = Digit.Hooks.useToast(),
2330
+ consumeToast = _Digit$Hooks$useToast.consumeToast;
2331
+ React.useEffect(() => {
2332
+ const message = consumeToast();
2333
+ if (message) {
2334
+ setShowToast(message);
2335
+ }
2336
+ }, []);
2330
2337
  const isCitizen = (userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$info = userInfo.info) === null || _userInfo$info === void 0 ? void 0 : _userInfo$info.type) === "CITIZEN";
2331
2338
  const loggedInVendorId = userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$info2 = userInfo.info) === null || _userInfo$info2 === void 0 ? void 0 : _userInfo$info2.uuid;
2332
2339
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
@@ -3640,28 +3647,19 @@ const SurveyorDetails = props => {
3640
3647
  })));
3641
3648
  };
3642
3649
 
3643
- const Heading$2 = props => {
3644
- return /*#__PURE__*/React__default.createElement("h1", {
3645
- className: "heading-m"
3646
- }, props.label);
3647
- };
3648
- const CloseBtn$1 = props => {
3649
- return /*#__PURE__*/React__default.createElement("div", {
3650
- conClick: props.onClick
3651
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CloseSvg, null));
3652
- };
3653
3650
  const formatLabel = key => {
3654
3651
  const result = key.replace(/([A-Z])/g, " $1");
3655
3652
  return result.charAt(0).toUpperCase() + result.slice(1);
3656
3653
  };
3657
- const EditVendorDetails = props => {
3654
+ const VendorDetails = () => {
3658
3655
  var _dsoData$, _dsoData$$dsoDetails, _vendorAdditionalData, _vendorAdditionalData2, _vendorAdditionalData3, _parsedAdditionalDeta, _userInfo$info$type, _dsoData$5, _dsoData$5$employeeRe, _supervisorData$super, _surveyorData$surveyo;
3659
3656
  const tenantId = Digit.ULBService.getCurrentTenantId();
3660
3657
  const _useTranslation = reactI18next.useTranslation(),
3661
3658
  t = _useTranslation.t;
3662
3659
  const history = reactRouterDom.useHistory();
3663
3660
  const queryClient = reactQuery.useQueryClient();
3664
- let _useParams = reactRouterDom.useParams(),
3661
+ const vendorId = new URLSearchParams(location.search).get("vendorId");
3662
+ const _useParams = reactRouterDom.useParams(),
3665
3663
  dsoId = _useParams.id;
3666
3664
  const _useState = React.useState(false),
3667
3665
  displayMenu = _useState[0],
@@ -3767,9 +3765,9 @@ const EditVendorDetails = props => {
3767
3765
  case "ADD_DRIVER":
3768
3766
  return setShowModal(true);
3769
3767
  case "EDIT":
3770
- return history.push("/digit-ui/" + userType + "/fsm/registry/modify-vendor/" + dsoId);
3768
+ return history.push("/digit-ui/" + userType + "/vendor/registry/modify-vendor/" + (dsoId || vendorId));
3771
3769
  case "HOME":
3772
- return history.push("/digit-ui/" + userType + "/fsm/registry?selectedTabs=VENDOR");
3770
+ return history.push("/digit-ui/" + userType + "/vendor/registry?selectedTabs=VENDOR");
3773
3771
  }
3774
3772
  }, [selectedAction]);
3775
3773
  React.useEffect(() => {
@@ -3859,11 +3857,11 @@ const EditVendorDetails = props => {
3859
3857
  };
3860
3858
  const onEdit = (details, type, id) => {
3861
3859
  if (type === "ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER") {
3862
- history.push("/digit-ui/" + userType + "/fsm/registry/modify-driver/" + id);
3860
+ history.push("/digit-ui/" + userType + "/vendor/registry/modify-driver/" + id);
3863
3861
  } else {
3864
3862
  var _details$values, _details$values$find;
3865
3863
  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;
3866
- history.push("/digit-ui/" + userType + "/fsm/registry/modify-vehicle/" + registrationNumber);
3864
+ history.push("/digit-ui/" + userType + "/vendor/registry/modify-vehicle/" + registrationNumber);
3867
3865
  }
3868
3866
  };
3869
3867
  const onDelete = (details, type, id) => {
@@ -3912,7 +3910,6 @@ const EditVendorDetails = props => {
3912
3910
  key: "error",
3913
3911
  action: error
3914
3912
  });
3915
- setTimeout(closeToast, 5000);
3916
3913
  },
3917
3914
  onSuccess: (data, variables) => {
3918
3915
  setShowToast({
@@ -3923,9 +3920,6 @@ const EditVendorDetails = props => {
3923
3920
  refetchDso();
3924
3921
  refetchVehicle();
3925
3922
  refetchDriver();
3926
- setTimeout(() => {
3927
- closeToast();
3928
- }, 5000);
3929
3923
  }
3930
3924
  });
3931
3925
  };
@@ -4060,9 +4054,9 @@ const EditVendorDetails = props => {
4060
4054
  }, safeVal));
4061
4055
  })), /*#__PURE__*/React__default.createElement("div", {
4062
4056
  className: "add-details-link hover-button",
4063
- onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/additionaldetails/info?vendorId=" + dsoId)
4057
+ onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/additionaldetails/info?vendorId=" + (dsoId || vendorId))
4064
4058
  }, t("Edit Details"))) : userType !== "CITIZEN" && !isEkyc && /*#__PURE__*/React__default.createElement("div", {
4065
- onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/additionaldetails/vendor-details?vendorId=" + dsoId),
4059
+ onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/additionaldetails/modify-details?vendorId=" + (dsoId || vendorId)),
4066
4060
  className: "add-details-link hover-button"
4067
4061
  }, t("Add Additional Details")));
4068
4062
  }
@@ -4074,7 +4068,9 @@ const EditVendorDetails = props => {
4074
4068
  caption: value.caption,
4075
4069
  className: "border-none flex-box " + (!isMobile ? "vendor-details-row" : "")
4076
4070
  });
4077
- }), detail === null || detail === void 0 ? void 0 : (_detail$child = detail.child) === null || _detail$child === void 0 ? void 0 : _detail$child.map((data, index) => {
4071
+ }), /*#__PURE__*/React__default.createElement("div", {
4072
+ className: "flex-box flex-box-col flex-gap-2"
4073
+ }, detail === null || detail === void 0 ? void 0 : (_detail$child = detail.child) === null || _detail$child === void 0 ? void 0 : _detail$child.map((data, index) => {
4078
4074
  var _data$values;
4079
4075
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
4080
4076
  className: "card-with-background",
@@ -4117,7 +4113,7 @@ const EditVendorDetails = props => {
4117
4113
  color: "green"
4118
4114
  } : {}
4119
4115
  }, value.value ? t(String(value.value)) : "N/A")))));
4120
- }), detail.type && /*#__PURE__*/React__default.createElement("div", {
4116
+ })), detail.type && /*#__PURE__*/React__default.createElement("div", {
4121
4117
  className: "add-details-link hover-button",
4122
4118
  onClick: () => onActionSelect(detail.type === "ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER" ? "ADD_DRIVER" : "ADD_VEHICLE")
4123
4119
  }, t(detail.type + "_ADD"))));
@@ -4136,7 +4132,7 @@ const EditVendorDetails = props => {
4136
4132
  t: t
4137
4133
  }), /*#__PURE__*/React__default.createElement("div", {
4138
4134
  className: "add-details-link hover-button",
4139
- onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/new-supervisor?vendorId=" + dsoId)
4135
+ onClick: () => history.push("/digit-ui/" + userType + "/vendor/registry/new-supervisor?vendorId=" + (dsoId || vendorId))
4140
4136
  }, t("ES_VENDOR_ADD_SUPERVISOR"))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSectionHeader, {
4141
4137
  style: {
4142
4138
  marginBottom: "16px",
@@ -4151,10 +4147,10 @@ const EditVendorDetails = props => {
4151
4147
  pageSizeLimit: 10,
4152
4148
  t: t
4153
4149
  })))), showModal && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
4154
- headerBarMain: /*#__PURE__*/React__default.createElement(Heading$2, {
4155
- 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")
4156
- }),
4157
- headerBarEnd: /*#__PURE__*/React__default.createElement(CloseBtn$1, {
4150
+ headerBarMain: /*#__PURE__*/React__default.createElement("h1", {
4151
+ className: "heading-m"
4152
+ }, 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")),
4153
+ headerBarEnd: /*#__PURE__*/React__default.createElement(digitUiReactComponents.CloseSvg, {
4158
4154
  onClick: closeModal
4159
4155
  }),
4160
4156
  actionCancelLabel: t("CS_COMMON_CANCEL"),
@@ -4262,15 +4258,12 @@ const stringReplaceAll = function (str, searcher, replaceWith) {
4262
4258
  return str;
4263
4259
  };
4264
4260
 
4265
- const VendorConfig = function (t, disabled, formData) {
4266
- var _formData, _formData$serviceType;
4267
- if (disabled === void 0) {
4268
- disabled = false;
4261
+ const VendorConfig = function (t, module, genderMenu, update) {
4262
+ var _module;
4263
+ if (module === void 0) {
4264
+ module = "";
4269
4265
  }
4270
- if (formData === void 0) {
4271
- formData = {};
4272
- }
4273
- 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";
4266
+ const isEkyc = ((_module = module) === null || _module === void 0 ? void 0 : _module.toLocaleUpperCase()) === "EKYC";
4274
4267
  return [{
4275
4268
  head: "ES_VRNDOR_NEW_VENDOR_DETAILS",
4276
4269
  isCollapsible: true,
@@ -4279,7 +4272,7 @@ const VendorConfig = function (t, disabled, formData) {
4279
4272
  label: "ES_FSM_REGISTRY_NEW_VENDOR_NAME",
4280
4273
  isMandatory: true,
4281
4274
  type: "text",
4282
- disable: disabled,
4275
+ disable: false,
4283
4276
  populators: {
4284
4277
  name: "vendorName",
4285
4278
  validation: {
@@ -4290,27 +4283,12 @@ const VendorConfig = function (t, disabled, formData) {
4290
4283
  defaultValue: "",
4291
4284
  className: "payment-form-text-input-correction"
4292
4285
  }
4293
- }, {
4294
- label: "ES_FSM_REGISTRY_NEW_EMAIL",
4295
- isMandatory: false,
4296
- type: "text",
4297
- key: "emailId",
4298
- populators: {
4299
- name: "emailId",
4300
- validation: {
4301
- required: false,
4302
- pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
4303
- },
4304
- error: t("FSM_REGISTRY_INVALID_EMAIL"),
4305
- defaultValue: "",
4306
- className: "payment-form-text-input-correction"
4307
- }
4308
4286
  }, {
4309
4287
  label: "ES_FSM_REGISTRY_NEW_VENDOR_PHONE",
4310
4288
  isMandatory: true,
4311
4289
  type: "mobileNumber",
4312
4290
  key: "phone",
4313
- disable: disabled,
4291
+ disable: false,
4314
4292
  populators: {
4315
4293
  name: "phone",
4316
4294
  validation: {
@@ -4325,13 +4303,28 @@ const VendorConfig = function (t, disabled, formData) {
4325
4303
  defaultValue: "",
4326
4304
  className: "payment-form-text-input-correction"
4327
4305
  }
4306
+ }, {
4307
+ label: "ES_FSM_REGISTRY_NEW_EMAIL",
4308
+ isMandatory: false,
4309
+ type: "text",
4310
+ key: "emailId",
4311
+ populators: {
4312
+ name: "emailId",
4313
+ validation: {
4314
+ required: false,
4315
+ pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
4316
+ },
4317
+ error: t("FSM_REGISTRY_INVALID_EMAIL"),
4318
+ defaultValue: "",
4319
+ className: "payment-form-text-input-correction"
4320
+ }
4328
4321
  }, {
4329
4322
  label: "ES_VENDOR_REGISTRY_SERVICE_TYPE",
4330
4323
  isMandatory: true,
4331
4324
  type: "component",
4332
4325
  key: "serviceType",
4333
4326
  component: "SelectServiceType",
4334
- disable: disabled,
4327
+ disable: update,
4335
4328
  populators: {
4336
4329
  name: "serviceType",
4337
4330
  defaultValue: {
@@ -4401,17 +4394,8 @@ const VendorConfig = function (t, disabled, formData) {
4401
4394
  component: "SelectEkycDropdown",
4402
4395
  populators: {
4403
4396
  name: "gender",
4404
- options: [{
4405
- code: "MALE",
4406
- name: "ES_COMMON_GENDER_MALE"
4407
- }, {
4408
- code: "FEMALE",
4409
- name: "ES_COMMON_GENDER_FEMALE"
4410
- }, {
4411
- code: "OTHER",
4412
- name: "ES_COMMON_GENDER_OTHER"
4413
- }],
4414
- optionsKey: "name"
4397
+ options: genderMenu,
4398
+ optionsKey: "i18nKey"
4415
4399
  }
4416
4400
  }, {
4417
4401
  label: "ES_FSM_REGISTRY_NEW_DOB",
@@ -4451,7 +4435,7 @@ const VendorConfig = function (t, disabled, formData) {
4451
4435
  };
4452
4436
 
4453
4437
  const AddVendor = () => {
4454
- var _Digit$UserService$ge, _formData$serviceType;
4438
+ var _Digit$UserService$ge, _formData$serviceType2;
4455
4439
  const tenantId = Digit.ULBService.getCurrentTenantId();
4456
4440
  const _useTranslation = reactI18next.useTranslation(),
4457
4441
  t = _useTranslation.t;
@@ -4464,12 +4448,30 @@ const AddVendor = () => {
4464
4448
  const _useState2 = React.useState(null),
4465
4449
  showToast = _useState2[0],
4466
4450
  setShowToast = _useState2[1];
4451
+ const _useState3 = React.useState([]),
4452
+ genderMenu = _useState3[0],
4453
+ setGenderMenu = _useState3[1];
4467
4454
  const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED", false),
4468
4455
  setMutationHappened = _Digit$Hooks$useSessi[1];
4469
4456
  const _Digit$Hooks$useSessi2 = Digit.Hooks.useSessionStorage("FSM_ERROR_DATA", false),
4470
4457
  clearError = _Digit$Hooks$useSessi2[2];
4471
4458
  const _Digit$Hooks$useSessi3 = Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA", false),
4472
4459
  clearSuccessData = _Digit$Hooks$useSessi3[2];
4460
+ const stateId = Digit.ULBService.getStateId();
4461
+ const _Digit$Hooks$obps$use = Digit.Hooks.obps.useMDMS(stateId, "common-masters", ["GenderType"]),
4462
+ genderTypeData = _Digit$Hooks$obps$use.data;
4463
+ React.useEffect(() => {
4464
+ var _genderTypeData$commo, _genderTypeData$commo2;
4465
+ 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) {
4466
+ var _genderTypeData$commo3, _genderTypeData$commo4;
4467
+ 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 => ({
4468
+ i18nKey: "COMMON_GENDER_" + genderDetails.code,
4469
+ code: "" + genderDetails.code,
4470
+ value: "" + genderDetails.code
4471
+ }));
4472
+ setGenderMenu(menuItems);
4473
+ }
4474
+ }, [genderTypeData]);
4473
4475
  const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVendorCreate(tenantId),
4474
4476
  mutate = _Digit$Hooks$fsm$useV.mutate;
4475
4477
  React.useEffect(() => {
@@ -4489,16 +4491,19 @@ const AddVendor = () => {
4489
4491
  amount: null
4490
4492
  }
4491
4493
  };
4492
- const _useState3 = React.useState(defaultValues),
4493
- formData = _useState3[0],
4494
- setFormData = _useState3[1];
4495
- const Config = React__default.useMemo(() => VendorConfig(t, false, formData), [t, (_formData$serviceType = formData.serviceType) === null || _formData$serviceType === void 0 ? void 0 : _formData$serviceType.code]);
4494
+ const _useState4 = React.useState(defaultValues),
4495
+ formData = _useState4[0],
4496
+ setFormData = _useState4[1];
4497
+ const Config = React__default.useMemo(() => {
4498
+ var _formData$serviceType;
4499
+ return VendorConfig(t, (_formData$serviceType = formData.serviceType) === null || _formData$serviceType === void 0 ? void 0 : _formData$serviceType.code, genderMenu);
4500
+ }, [t, formData === null || formData === void 0 ? void 0 : (_formData$serviceType2 = formData.serviceType) === null || _formData$serviceType2 === void 0 ? void 0 : _formData$serviceType2.i18nKey, genderMenu]);
4496
4501
  const onFormValueChange = (setValue, data) => {
4497
- var _data$zoneIds, _data$serviceType, _formData$serviceType2, _data$serviceType2;
4502
+ var _data$zoneIds, _data$serviceType, _formData$serviceType3, _data$serviceType2;
4498
4503
  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)) || [];
4499
4504
  const previousZoneCodes = (formData === null || formData === void 0 ? void 0 : formData.zoneIds) || [];
4500
4505
  const zoneChanged = currentZoneCodes.join(",") !== previousZoneCodes.join(",");
4501
- 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) {
4506
+ 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) {
4502
4507
  setFormData(prev => _extends({}, prev, {
4503
4508
  serviceType: data === null || data === void 0 ? void 0 : data.serviceType
4504
4509
  }));
@@ -4631,13 +4636,10 @@ const AddVendor = () => {
4631
4636
  if (isEkyc) {
4632
4637
  var _mergedData$zoneIds, _mergedData$clusterId;
4633
4638
  vendorData = _extends({}, vendorData, {
4634
- zoneIds: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$zoneIds = mergedData.zoneIds) === null || _mergedData$zoneIds === void 0 ? void 0 : _mergedData$zoneIds.map(z => {
4635
- var _z$;
4636
- return (z === null || z === void 0 ? void 0 : z.code) || (z === null || z === void 0 ? void 0 : (_z$ = z[1]) === null || _z$ === void 0 ? void 0 : _z$.code) || z;
4637
- })) || [],
4639
+ 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)) || [],
4638
4640
  clusterIds: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$clusterId = mergedData.clusterIds) === null || _mergedData$clusterId === void 0 ? void 0 : _mergedData$clusterId.map(c => {
4639
4641
  var _c$;
4640
- return (c === null || c === void 0 ? void 0 : c.code) || (c === null || c === void 0 ? void 0 : (_c$ = c[1]) === null || _c$ === void 0 ? void 0 : _c$.code) || c;
4642
+ return c === null || c === void 0 ? void 0 : (_c$ = c[1]) === null || _c$ === void 0 ? void 0 : _c$.code;
4641
4643
  })) || [],
4642
4644
  contractStartDate: mergedData.contractStartDate ? new Date(mergedData.contractStartDate).getTime() : null,
4643
4645
  contractEndDate: mergedData.contractEndDate ? new Date(mergedData.contractEndDate).getTime() : null
@@ -5369,8 +5371,8 @@ const createConfig = [{
5369
5371
  nextStep: "vendor-details",
5370
5372
  key: "Documents"
5371
5373
  }, {
5372
- route: "vendor-details",
5373
- component: "VendorDetails",
5374
+ route: "modify-details",
5375
+ component: "AdditionalDetails",
5374
5376
  withoutLabel: true,
5375
5377
  key: "vendordet",
5376
5378
  type: "component",
@@ -5454,7 +5456,6 @@ const VENDORCreate = _ref => {
5454
5456
  nextStep = key;
5455
5457
  }
5456
5458
  if (nextStep === null) {
5457
- console.log("matchhhhh pathhhh", match.path);
5458
5459
  return redirectWithHistory(match.path + "/check");
5459
5460
  }
5460
5461
  if (!isNaN(nextStep.split("/").pop())) {
@@ -5505,8 +5506,7 @@ const VENDORCreate = _ref => {
5505
5506
  clearParams();
5506
5507
  queryClient.invalidateQueries("VENDOR_CREATE");
5507
5508
  };
5508
- let commonFields = createConfig;
5509
- commonFields.forEach(obj => {
5509
+ createConfig.forEach(obj => {
5510
5510
  config = config.concat(obj.body.filter(a => !a.hideInCitizen));
5511
5511
  });
5512
5512
  config.indexRoute = "info";
@@ -5548,447 +5548,314 @@ const VENDORCreate = _ref => {
5548
5548
  }))));
5549
5549
  };
5550
5550
 
5551
- const EmployeeApp = _ref => {
5552
- let path = _ref.path;
5551
+ const EditVendor = () => {
5552
+ var _Digit$UserService$ge, _defaultValues$servic2;
5553
+ const tenantId = Digit.ULBService.getCurrentTenantId();
5553
5554
  const _useTranslation = reactI18next.useTranslation(),
5554
5555
  t = _useTranslation.t;
5555
- const location = reactRouterDom.useLocation();
5556
- sessionStorage.removeItem("revalidateddone");
5557
- const AddDriver = Digit.ComponentRegistryService.getComponent("AddDriver");
5558
- const AddVehicle = Digit.ComponentRegistryService.getComponent("AddVehicle");
5559
- const DriverDetails = Digit.ComponentRegistryService.getComponent("DriverDetails");
5560
- const VehicleDetails = Digit.ComponentRegistryService.getComponent("VehicleDetails");
5561
- const EditDriver = Digit.ComponentRegistryService.getComponent("EditDriver");
5562
- const EditVehicle = Digit.ComponentRegistryService.getComponent("EditVehicle");
5563
- const getDynamicBreadcrumbs = () => {
5564
- const pathname = location.pathname;
5565
- let crumbs = [{
5566
- icon: digitUiReactComponents.HomeIcon,
5567
- path: "/digit-ui/employee"
5556
+ const history = reactRouterDom.useHistory();
5557
+ let _useParams = reactRouterDom.useParams(),
5558
+ dsoId = _useParams.id;
5559
+ const _useState = React.useState(null),
5560
+ showToast = _useState[0],
5561
+ setShowToast = _useState[1];
5562
+ const _useState2 = React.useState(false),
5563
+ canSubmit = _useState2[0],
5564
+ setCanSubmit = _useState2[1];
5565
+ const _useState3 = React.useState({}),
5566
+ defaultValues = _useState3[0],
5567
+ setDefaultValues = _useState3[1];
5568
+ const _useState4 = React.useState({}),
5569
+ dsoDetails = _useState4[0],
5570
+ setDsoDetails = _useState4[1];
5571
+ const queryClient = reactQuery.useQueryClient();
5572
+ const userInfo = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info;
5573
+ const userType = userInfo === null || userInfo === void 0 ? void 0 : userInfo.type;
5574
+ const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED", false),
5575
+ setMutationHappened = _Digit$Hooks$useSessi[1];
5576
+ const _Digit$Hooks$useSessi2 = Digit.Hooks.useSessionStorage("FSM_ERROR_DATA", false),
5577
+ clearError = _Digit$Hooks$useSessi2[2];
5578
+ const _Digit$Hooks$useSessi3 = Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA", false),
5579
+ clearSuccessData = _Digit$Hooks$useSessi3[2];
5580
+ const _useState5 = React.useState([]),
5581
+ genderMenu = _useState5[0],
5582
+ setGenderMenu = _useState5[1];
5583
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
5584
+ ids: dsoId
5568
5585
  }, {
5569
- label: t("TITLE_VENDOR_MANAGEMENT"),
5570
- path: "/digit-ui/employee/vendor/search-vendor"
5571
- }];
5572
- if (pathname.includes("/registry/new-vendor")) {
5573
- crumbs.push({
5574
- label: t("ES_FSM_REGISTRY_TITLE_NEW_VENDOR")
5575
- });
5576
- } else if (pathname.includes("/search-vendor")) {
5577
- crumbs.push({
5578
- label: t("SEARCH_VENDOR")
5579
- });
5580
- } else if (pathname.includes("/registry/new-driver")) {
5581
- crumbs.push({
5582
- label: t("ES_FSM_REGISTRY_TITLE_NEW_DRIVER")
5583
- });
5584
- } else if (pathname.includes("/registry/vendor-details") || pathname.includes("/registry/modify-vendor/")) {
5585
- crumbs.push({
5586
- label: t("VENDOR_VENDOR_DETAILS")
5587
- });
5588
- } else if (pathname.includes("/registry/vehicle-details") || pathname.includes("/registry/modify-vehicle/")) {
5589
- crumbs.push({
5590
- label: t("VENDOR_VEHICLE_DETAILS")
5591
- });
5592
- } else if (pathname.includes("/registry/new-vehicle")) {
5593
- crumbs.push({
5594
- label: t("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE")
5595
- });
5596
- } else if (pathname.includes("/registry/driver-details") || pathname.includes("/registry/modify-driver/")) {
5597
- crumbs.push({
5598
- label: t("VENDOR_DRIVER_DETAILS")
5599
- });
5600
- } else if (pathname.includes("/registry/additionaldetails")) {
5601
- crumbs.push({
5602
- label: t("VENDOR_ADDITIONAL_DETAILS")
5603
- });
5604
- } else if (pathname.includes("/registry/new-supervisor")) {
5605
- crumbs.push({
5606
- label: t("ES_FSM_REGISTRY_TITLE_NEW_SUPERVISOR")
5607
- });
5608
- } else if (pathname.includes("/registry/supervisor-details") || pathname.includes("/registry/modify-supervisor/")) {
5609
- crumbs.push({
5610
- label: t("VENDOR_SUPERVISOR_DETAILS")
5611
- });
5612
- } else if (pathname.includes("/registry/new-surveyor")) {
5613
- crumbs.push({
5614
- label: t("ES_FSM_REGISTRY_TITLE_NEW_SURVEYOR")
5615
- });
5616
- } else if (pathname.includes("/registry/surveyor-details") || pathname.includes("/registry/modify-surveyor/")) {
5617
- crumbs.push({
5618
- label: t("VENDOR_SURVEYOR_DETAILS")
5619
- });
5620
- }
5621
- return crumbs;
5622
- };
5623
- return /*#__PURE__*/React__default.createElement(reactRouterDom.Switch, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.AppContainer, null, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
5624
- className: "ground-container employee-app-container form-container"
5625
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.ModuleHeader, {
5626
- leftContent: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.ArrowLeft, {
5627
- className: "icon"
5628
- }), "Back"),
5629
- onLeftClick: () => window.history.back(),
5630
- breadcrumbs: getDynamicBreadcrumbs()
5631
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5632
- path: path + "/search-vendor",
5633
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5634
- layoutClass: "normal"
5635
- }, /*#__PURE__*/React__default.createElement(SearchVendor, _extends({}, props, {
5636
- parentRoute: path
5637
- })))
5638
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5639
- path: path + "/registry/new-driver",
5640
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5641
- layoutClass: "action"
5642
- }, /*#__PURE__*/React__default.createElement(AddDriver, _extends({}, props, {
5643
- parentRoute: path
5644
- })))
5645
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5646
- path: path + "/registry/new-vehicle",
5647
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5648
- layoutClass: "action"
5649
- }, /*#__PURE__*/React__default.createElement(AddVehicle, _extends({}, props, {
5650
- parentRoute: path
5651
- })))
5652
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5653
- path: path + "/registry/additionaldetails",
5654
- component: props => {
5655
- const isInfoPage = props.location.pathname.includes("/info");
5656
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5657
- layoutClass: isInfoPage ? "action" : "normal"
5658
- }, /*#__PURE__*/React__default.createElement(VENDORCreate, _extends({}, props, {
5659
- parentRoute: path
5586
+ staleTime: Infinity
5587
+ }),
5588
+ dsoData = _Digit$Hooks$fsm$useD.data,
5589
+ daoDataLoading = _Digit$Hooks$fsm$useD.isLoading;
5590
+ const stateId = Digit.ULBService.getStateId();
5591
+ const _Digit$Hooks$obps$use = Digit.Hooks.obps.useMDMS(stateId, "common-masters", ["GenderType"]),
5592
+ genderTypeData = _Digit$Hooks$obps$use.data;
5593
+ const _useState6 = React.useState([]),
5594
+ zones = _useState6[0],
5595
+ setZones = _useState6[1];
5596
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
5597
+ boundaryData = _Digit$Hooks$useCommo.data,
5598
+ isLoading = _Digit$Hooks$useCommo.isLoading;
5599
+ React.useEffect(() => {
5600
+ var _boundaryData$egovLo, _boundaryData$egovLo$, _boundaryData$MdmsRes, _boundaryData$MdmsRes2, _boundaryData$MdmsRes3;
5601
+ 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]);
5602
+ const boundaries = (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.boundary) || (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.children) || [];
5603
+ if (Array.isArray(boundaries === null || boundaries === void 0 ? void 0 : boundaries.children) && (boundaries === null || boundaries === void 0 ? void 0 : boundaries.children.length) > 0) {
5604
+ const allZones = boundaries.children.flatMap(assembly => ((assembly === null || assembly === void 0 ? void 0 : assembly.children) || []).map(zone => ({
5605
+ code: zone.code,
5606
+ name: zone.name
5660
5607
  })));
5608
+ const zonesList = [...new Map(allZones.map(zone => [zone.code, zone])).values()];
5609
+ setZones(zonesList);
5661
5610
  }
5662
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5663
- path: path + "/registry/driver-details/:id",
5664
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5665
- layoutClass: "action"
5666
- }, /*#__PURE__*/React__default.createElement(DriverDetails, _extends({}, props, {
5667
- parentRoute: path
5668
- })))
5669
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5670
- path: path + "/registry/modify-driver/:id",
5671
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5672
- layoutClass: "action"
5673
- }, /*#__PURE__*/React__default.createElement(EditDriver, _extends({}, props, {
5674
- parentRoute: path
5675
- })))
5676
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5677
- path: path + "/common-search/:id",
5678
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5679
- layoutClass: "normal"
5680
- }, /*#__PURE__*/React__default.createElement(SearchApp, _extends({}, props, {
5681
- parentRoute: path
5682
- })))
5683
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5684
- path: path + "/registry/new-vendor",
5685
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5686
- layoutClass: "action"
5687
- }, /*#__PURE__*/React__default.createElement(AddVendor, _extends({}, props, {
5688
- parentRoute: path
5689
- })))
5690
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5691
- path: path + "/registry/vendor-details/:id",
5692
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5693
- layoutClass: "action"
5694
- }, /*#__PURE__*/React__default.createElement(EditVendorDetails, _extends({}, props, {
5695
- parentRoute: path
5696
- })))
5697
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5698
- path: path + "/registry/vehicle-details/:id",
5699
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5700
- layoutClass: "action"
5701
- }, /*#__PURE__*/React__default.createElement(VehicleDetails, _extends({}, props, {
5702
- parentRoute: path
5703
- })))
5704
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5705
- path: path + "/registry/modify-vehicle/:id",
5706
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5707
- layoutClass: "action"
5708
- }, /*#__PURE__*/React__default.createElement(EditVehicle, _extends({}, props, {
5709
- parentRoute: path
5710
- })))
5711
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5712
- path: path + "/registry/new-supervisor",
5713
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5714
- layoutClass: "action"
5715
- }, /*#__PURE__*/React__default.createElement(AddSupervisor, _extends({}, props, {
5716
- parentRoute: path
5717
- })))
5718
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5719
- path: path + "/registry/supervisor-details/:id",
5720
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5721
- layoutClass: "action"
5722
- }, /*#__PURE__*/React__default.createElement(SupervisorDetails, _extends({}, props, {
5723
- parentRoute: path
5724
- })))
5725
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5726
- path: path + "/registry/modify-supervisor/:id",
5727
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5728
- layoutClass: "action"
5729
- }, /*#__PURE__*/React__default.createElement(EditSupervisor, _extends({}, props, {
5730
- parentRoute: path
5731
- })))
5732
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5733
- path: path + "/registry/new-surveyor",
5734
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5735
- layoutClass: "action"
5736
- }, /*#__PURE__*/React__default.createElement(AddSurveyor, _extends({}, props, {
5737
- parentRoute: path
5738
- })))
5739
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5740
- path: path + "/registry/surveyor-details/:id",
5741
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5742
- layoutClass: "action"
5743
- }, /*#__PURE__*/React__default.createElement(SurveyorDetails, _extends({}, props, {
5744
- parentRoute: path
5745
- })))
5746
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5747
- path: path + "/registry/modify-surveyor/:id",
5748
- component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5749
- layoutClass: "action"
5750
- }, /*#__PURE__*/React__default.createElement(EditSurveyor, _extends({}, props, {
5751
- parentRoute: path
5752
- })))
5753
- })))));
5754
- };
5755
-
5756
- const VENDORCard = () => {
5757
- const _useTranslation = reactI18next.useTranslation(),
5758
- t = _useTranslation.t;
5759
- const history = reactRouterDom.useHistory();
5760
- const isCitizen = window.location.pathname.toLowerCase().includes("citizen");
5761
- let hasAccess = Digit.Utils.vendorAccess() || Digit.UserService.hasAccess(["WT_VENDOR", "MT_VENDOR"]);
5762
- if (isCitizen) {
5763
- hasAccess = Digit.UserService.hasAccess(["WT_VENDOR", "EKYC_VENDOR", "EKYC_SUPERVISOR"]);
5764
- }
5765
- if (!hasAccess) {
5766
- return null;
5767
- }
5768
- const links = [{
5769
- label: t("VENDOR_NEW_REGISTERATION"),
5770
- link: isCitizen ? "/digit-ui/citizen/vendor/registry/new-vendor" : "/digit-ui/employee/vendor/registry/new-vendor"
5771
- }, {
5772
- label: t("SEARCH_VENDOR"),
5773
- link: isCitizen ? "/digit-ui/citizen/vendor/search-vendor" : "/digit-ui/employee/vendor/search-vendor"
5774
- }];
5775
- const VENDORRole = Digit.UserService.hasAccess(["WT_VENDOR"]);
5776
- const propsForModuleCard = _extends({
5777
- Icon: /*#__PURE__*/React__default.createElement(digitUiReactComponents.PropertyHouse, null),
5778
- moduleName: t("TITLE_VENDOR_MANAGEMENT"),
5779
- kpis: [{
5780
- count: 0,
5781
- label: t("Inbox"),
5782
- link: isCitizen ? "/digit-ui/citizen/vendor/search-vendor" : "/digit-ui/employee/vendor/search-vendor"
5783
- }],
5784
- links: links.filter(link => !(link !== null && link !== void 0 && link.role) || VENDORRole)
5785
- }, isCitizen ? {
5786
- onDetailsClick: () => history.push("/digit-ui/citizen/vendor/search-vendor")
5787
- } : {});
5788
- if (isCitizen) {
5789
- return /*#__PURE__*/React__default.createElement("div", {
5790
- className: "wt-citizen-card-premium"
5791
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.EmployeeModuleCard, propsForModuleCard));
5792
- }
5793
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.EmployeeModuleCard, propsForModuleCard);
5794
- };
5795
-
5796
- const VendorDetails = _ref => {
5797
- var _formData$ownerKey, _formData$ownerKey2, _formData$ownerKey3, _formData$ownerKey4;
5798
- let t = _ref.t,
5799
- config = _ref.config,
5800
- onSelect = _ref.onSelect,
5801
- userType = _ref.userType,
5802
- formData = _ref.formData;
5803
- let index = 0;
5804
- const user = Digit.UserService.getUser().info;
5805
- 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) || "";
5806
- 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) || "";
5807
- 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);
5808
- 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) || "";
5809
- const _useState = React.useState(""),
5810
- VendorCategory = _useState[0],
5811
- setVendorCategory = _useState[1];
5812
- const _useState2 = React.useState(""),
5813
- VendorId = _useState2[0],
5814
- setVendorId = _useState2[1];
5815
- const _useState3 = React.useState(""),
5816
- userName = _useState3[0],
5817
- setUserName = _useState3[1];
5818
- const _useState4 = React.useState(""),
5819
- Bank = _useState4[0],
5820
- setBank = _useState4[1];
5821
- const _useState5 = React.useState(),
5822
- BankbranchName = _useState5[0],
5823
- setBankbranchName = _useState5[1];
5824
- const _useState6 = React.useState(""),
5825
- IFSC = _useState6[0],
5826
- setIFSC = _useState6[1];
5827
- const _useState7 = React.useState(""),
5828
- AccountNo = _useState7[0],
5829
- setAccountNo = _useState7[1];
5830
- const _useState8 = React.useState(""),
5831
- PanNo = _useState8[0],
5832
- setPanNo = _useState8[1];
5833
- const _useState9 = React.useState(""),
5834
- GstNo = _useState9[0],
5835
- setGstNo = _useState9[1];
5836
- const _useState0 = React.useState(""),
5837
- GstState = _useState0[0],
5838
- setGstState = _useState0[1];
5839
- const _useState1 = React.useState(""),
5840
- RegistrationNo = _useState1[0],
5841
- setRegistrationNo = _useState1[1];
5842
- const _useState10 = React.useState(""),
5843
- EpfNo = _useState10[0],
5844
- setEpfNo = _useState10[1];
5845
- const _useState11 = React.useState(""),
5846
- EsiNo = _useState11[0],
5847
- setEsiNo = _useState11[1];
5848
- const _useState12 = React.useState(""),
5849
- VendorType = _useState12[0],
5850
- setVendorType = _useState12[1];
5851
- const _useState13 = React.useState(""),
5852
- Status = _useState13[0],
5853
- setStatus = _useState13[1];
5854
- const _useState14 = React.useState(""),
5855
- micrNo = _useState14[0],
5856
- setmicrNo = _useState14[1];
5857
- const _useState15 = React.useState(""),
5858
- PhoneNo = _useState15[0],
5859
- setPhoneNo = _useState15[1];
5860
- const _useState16 = React.useState(""),
5861
- ContactPerson = _useState16[0],
5862
- setContactPerson = _useState16[1];
5611
+ }, [boundaryData]);
5863
5612
  React.useEffect(() => {
5864
- if (IFSC.length === 11 && !Bank && !BankbranchName && !micrNo) {
5865
- fetch("https://ifsc.razorpay.com/" + IFSC).then(response => response.json()).then(data => {
5866
- if (data && data.BANK && data.BRANCH && data.MICR) {
5867
- setBank(data.BANK);
5868
- setBankbranchName(data.BRANCH);
5869
- setmicrNo(data.MICR);
5870
- }
5871
- }).catch(() => {});
5872
- } else {
5873
- if (IFSC.length === 11 && Bank && BankbranchName) {
5874
- setBank(Bank);
5875
- setBankbranchName(BankbranchName);
5876
- setmicrNo(micrNo);
5877
- } else {
5878
- setBank("");
5879
- setBankbranchName("");
5880
- setmicrNo("");
5881
- }
5882
- }
5883
- }, [IFSC]);
5884
- function setvendorbank(e) {
5885
- setBank(e.target.value);
5886
- }
5887
- function setBankbranch(e) {
5888
- setBankbranchName(e.target.value);
5889
- }
5890
- function setvendorifsc(e) {
5891
- const input = e.target.value.replace(/[^a-zA-Z0-9]/g, "");
5892
- if (input.length <= 11) {
5893
- setIFSC(input);
5613
+ var _genderTypeData$commo, _genderTypeData$commo2;
5614
+ 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) {
5615
+ var _genderTypeData$commo3, _genderTypeData$commo4;
5616
+ 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 => ({
5617
+ i18nKey: "COMMON_GENDER_" + genderDetails.code,
5618
+ code: "" + genderDetails.code,
5619
+ value: "" + genderDetails.code
5620
+ }));
5621
+ setGenderMenu(menuItems);
5894
5622
  }
5895
- }
5896
- function setvendoraccountno(e) {
5897
- setAccountNo(e.target.value);
5898
- }
5899
- function setpanno(e) {
5900
- setPanNo(e.target.value);
5901
- }
5902
- function setgstno(e) {
5903
- setGstNo(e.target.value);
5904
- }
5905
- function setgststate(e) {
5906
- setGstState(e.target.value);
5907
- }
5908
- function setregistrationno(e) {
5909
- setRegistrationNo(e.target.value);
5910
- }
5911
- function setepfno(e) {
5912
- setEpfNo(e.target.value);
5913
- }
5914
- function setesino(e) {
5915
- setEsiNo(e.target.value);
5916
- }
5917
- function setcontactperson(e) {
5918
- setContactPerson(e.target.value);
5919
- }
5920
- const tenantId = Digit.ULBService.getCurrentTenantId();
5921
- const _useForm = reactHookForm.useForm(),
5922
- control = _useForm.control;
5923
- const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
5924
- staleTime: Infinity
5925
- }),
5926
- dsoData = _Digit$Hooks$fsm$useD.data;
5623
+ }, [genderTypeData]);
5624
+ const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVendorUpdate(tenantId),
5625
+ mutate = _Digit$Hooks$fsm$useV.mutate;
5626
+ const _Digit$Hooks$useToast = Digit.Hooks.useToast(),
5627
+ setToast = _Digit$Hooks$useToast.setToast;
5927
5628
  React.useEffect(() => {
5928
- if (dsoData) {
5929
- const vendor = dsoData.find(item => item.id);
5930
- if (vendor) {
5931
- setUserName(vendor.name);
5932
- setVendorId(vendor.id);
5933
- }
5629
+ setMutationHappened(false);
5630
+ clearSuccessData();
5631
+ clearError();
5632
+ }, []);
5633
+ React.useEffect(() => {
5634
+ if (dsoData && dsoData[0]) {
5635
+ 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;
5636
+ const dsoDetails = (_dsoData$ = dsoData[0]) === null || _dsoData$ === void 0 ? void 0 : _dsoData$.dsoDetails;
5637
+ setDsoDetails(dsoDetails);
5638
+ const serviceType = {
5639
+ i18nKey: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$additiona = dsoDetails.additionalDetails) === null || _dsoDetails$additiona === void 0 ? void 0 : _dsoDetails$additiona.serviceType.toUpperCase(),
5640
+ code: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$additiona2 = dsoDetails.additionalDetails) === null || _dsoDetails$additiona2 === void 0 ? void 0 : _dsoDetails$additiona2.serviceType
5641
+ };
5642
+ const values = {
5643
+ vendorName: dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.name,
5644
+ propertyAddress: {
5645
+ pincode: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address = dsoDetails.address) === null || _dsoDetails$address === void 0 ? void 0 : _dsoDetails$address.pincode) || "",
5646
+ city: {
5647
+ code: tenantId,
5648
+ name: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address2 = dsoDetails.address) === null || _dsoDetails$address2 === void 0 ? void 0 : _dsoDetails$address2.city,
5649
+ i18nKey: "TENANT_TENANTS_" + tenantId.toUpperCase().replace(".", "_")
5650
+ },
5651
+ locality: _extends({}, dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address3 = dsoDetails.address) === null || _dsoDetails$address3 === void 0 ? void 0 : _dsoDetails$address3.locality, {
5652
+ 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)
5653
+ }),
5654
+ houseNo: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address5 = dsoDetails.address) === null || _dsoDetails$address5 === void 0 ? void 0 : _dsoDetails$address5.doorNo) || "",
5655
+ streetName: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address6 = dsoDetails.address) === null || _dsoDetails$address6 === void 0 ? void 0 : _dsoDetails$address6.street) || "",
5656
+ landmark: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$address7 = dsoDetails.address) === null || _dsoDetails$address7 === void 0 ? void 0 : _dsoDetails$address7.landmark) || "",
5657
+ 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) || "",
5658
+ 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) || ""
5659
+ },
5660
+ cpt: {
5661
+ details: {
5662
+ address: {
5663
+ pincode: dsoDetails.address.pincode,
5664
+ city: {
5665
+ code: tenantId,
5666
+ name: dsoDetails.address.city,
5667
+ i18nKey: "TENANT_TENANTS_" + tenantId.toUpperCase().replace(".", "_")
5668
+ },
5669
+ locality: _extends({}, dsoDetails.address.locality, {
5670
+ i18nKey: dsoDetails.tenantId.toUpperCase().replace(".", "_") + "_REVENUE_" + dsoDetails.address.locality.code
5671
+ }),
5672
+ houseNo: dsoDetails.address.doorNo,
5673
+ street: dsoDetails.address.street,
5674
+ landmark: dsoDetails.address.landmark,
5675
+ geoLocation: {
5676
+ latitude: (_dsoDetails$address$g = dsoDetails.address.geoLocation) === null || _dsoDetails$address$g === void 0 ? void 0 : _dsoDetails$address$g.latitude,
5677
+ longitude: (_dsoDetails$address$g2 = dsoDetails.address.geoLocation) === null || _dsoDetails$address$g2 === void 0 ? void 0 : _dsoDetails$address$g2.longitude
5678
+ }
5679
+ },
5680
+ additionalDetails: {
5681
+ assembly: "",
5682
+ block: "",
5683
+ zone: ""
5684
+ }
5685
+ }
5686
+ },
5687
+ phone: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner = dsoDetails.owner) === null || _dsoDetails$owner === void 0 ? void 0 : _dsoDetails$owner.mobileNumber,
5688
+ ownerName: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner2 = dsoDetails.owner) === null || _dsoDetails$owner2 === void 0 ? void 0 : _dsoDetails$owner2.name,
5689
+ contractEndDate: Digit.DateUtils.ConvertTimestampToDate(dsoDetails.contractEndDate, "yyyy-MM-dd"),
5690
+ contractStartDate: Digit.DateUtils.ConvertTimestampToDate(dsoDetails.contractStartDate, "yyyy-MM-dd"),
5691
+ fatherOrHusbandName: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner3 = dsoDetails.owner) === null || _dsoDetails$owner3 === void 0 ? void 0 : _dsoDetails$owner3.fatherOrHusbandName,
5692
+ relationship: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner4 = dsoDetails.owner) === null || _dsoDetails$owner4 === void 0 ? void 0 : _dsoDetails$owner4.relationship,
5693
+ gender: genderMenu.find(ele => ele.code === dsoDetails.owner.gender),
5694
+ 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"),
5695
+ 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,
5696
+ correspondenceAddress: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner9 = dsoDetails.owner) === null || _dsoDetails$owner9 === void 0 ? void 0 : _dsoDetails$owner9.correspondenceAddress,
5697
+ additionalDetails: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$additiona3 = dsoDetails.additionalDetails) === null || _dsoDetails$additiona3 === void 0 ? void 0 : _dsoDetails$additiona3.description,
5698
+ vendorId: dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.vendor_id,
5699
+ serviceType: serviceType,
5700
+ zoneIds: dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.zoneIds
5701
+ };
5702
+ setDefaultValues(values);
5934
5703
  }
5935
5704
  }, [dsoData]);
5936
- const goNext = () => {
5937
- let owner = formData.ownerKey && formData.ownerKey[index];
5938
- let ownerStep;
5939
- if (userType === "citizen") {
5940
- ownerStep = _extends({}, owner, {
5941
- applicantName,
5942
- mobileNumber,
5943
- altMobileNumber,
5944
- emailId
5945
- });
5946
- onSelect(config.key, _extends({}, formData[config.key], ownerStep), false, index);
5705
+ React.useEffect(() => {
5706
+ var _dsoDetails$zoneIds;
5707
+ if (!zones.length || !((_dsoDetails$zoneIds = dsoDetails.zoneIds) !== null && _dsoDetails$zoneIds !== void 0 && _dsoDetails$zoneIds.length)) return;
5708
+ if (typeof dsoDetails.zoneIds[0] === "object") return;
5709
+ setDefaultValues(prev => _extends({}, prev, {
5710
+ zoneIds: zones.filter(z => {
5711
+ var _prev$zoneIds;
5712
+ return prev === null || prev === void 0 ? void 0 : (_prev$zoneIds = prev.zoneIds) === null || _prev$zoneIds === void 0 ? void 0 : _prev$zoneIds.includes(z.name);
5713
+ })
5714
+ }));
5715
+ }, [dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.zoneIds, zones]);
5716
+ const onFormValueChange = (setValue, data) => {
5717
+ var _data$propertyAddress, _data$propertyAddress2, _data$serviceType, _data$serviceType2;
5718
+ 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);
5719
+ 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);
5720
+ const isEkyc = (data === null || data === void 0 ? void 0 : (_data$serviceType2 = data.serviceType) === null || _data$serviceType2 === void 0 ? void 0 : _data$serviceType2.code) === "EKYC";
5721
+ let isEkycFieldsFilled = true;
5722
+ if (isEkyc) {
5723
+ var _data$zoneIds, _data$clusterIds;
5724
+ 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);
5725
+ }
5726
+ if (isVendorDetailsFilled && isAddressFilled && isEkycFieldsFilled) {
5727
+ setCanSubmit(true);
5947
5728
  } else {
5948
- ownerStep = _extends({}, owner, {
5949
- VendorCategory,
5950
- name: userName,
5951
- VendorId: VendorId,
5952
- Bank,
5953
- BankbranchName,
5954
- IFSC,
5955
- AccountNo,
5956
- PanNo,
5957
- GstNo,
5958
- GstState,
5959
- RegistrationNo,
5960
- EpfNo,
5961
- EsiNo,
5962
- VendorType,
5963
- Status,
5964
- micrNo,
5965
- PhoneNo,
5966
- ContactPerson
5967
- });
5968
- onSelect(config.key, ownerStep, false, index);
5729
+ setCanSubmit(false);
5969
5730
  }
5970
5731
  };
5971
- React.useEffect(() => {
5972
- if (userType === "citizen") {
5973
- goNext();
5732
+ const closeToast = () => {
5733
+ setShowToast(null);
5734
+ };
5735
+ const onSubmit = data => {
5736
+ 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;
5737
+ const mergedData = data;
5738
+ const address = mergedData === null || mergedData === void 0 ? void 0 : mergedData.propertyAddress;
5739
+ const pincode = address === null || address === void 0 ? void 0 : address.pincode;
5740
+ const street = address === null || address === void 0 ? void 0 : address.streetName;
5741
+ const doorNo = address === null || address === void 0 ? void 0 : address.houseNo;
5742
+ const landmark = address === null || address === void 0 ? void 0 : address.landmark;
5743
+ const city = address === null || address === void 0 ? void 0 : (_address$city = address.city) === null || _address$city === void 0 ? void 0 : _address$city.name;
5744
+ const state = address === null || address === void 0 ? void 0 : (_address$city2 = address.city) === null || _address$city2 === void 0 ? void 0 : _address$city2.name;
5745
+ const district = address === null || address === void 0 ? void 0 : (_address$city3 = address.city) === null || _address$city3 === void 0 ? void 0 : _address$city3.name;
5746
+ const region = address === null || address === void 0 ? void 0 : (_address$city4 = address.city) === null || _address$city4 === void 0 ? void 0 : _address$city4.name;
5747
+ const localityCode = address === null || address === void 0 ? void 0 : (_address$locality = address.locality) === null || _address$locality === void 0 ? void 0 : _address$locality.code;
5748
+ const localityName = address === null || address === void 0 ? void 0 : (_address$locality2 = address.locality) === null || _address$locality2 === void 0 ? void 0 : _address$locality2.name;
5749
+ const localityArea = address === null || address === void 0 ? void 0 : address.subLocality;
5750
+ const wardCode = address === null || address === void 0 ? void 0 : (_address$ward = address.ward) === null || _address$ward === void 0 ? void 0 : _address$ward.code;
5751
+ const wardName = address === null || address === void 0 ? void 0 : (_address$ward2 = address.ward) === null || _address$ward2 === void 0 ? void 0 : _address$ward2.name;
5752
+ const name = mergedData === null || mergedData === void 0 ? void 0 : mergedData.vendorName;
5753
+ const plotNo = mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$plotNo = mergedData.plotNo) === null || _mergedData$plotNo === void 0 ? void 0 : _mergedData$plotNo.trim();
5754
+ const buildingName = mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$buildingN = mergedData.buildingName) === null || _mergedData$buildingN === void 0 ? void 0 : _mergedData$buildingN.trim();
5755
+ const emailId = mergedData === null || mergedData === void 0 ? void 0 : mergedData.emailId;
5756
+ const phone = mergedData === null || mergedData === void 0 ? void 0 : mergedData.phone;
5757
+ const isEkyc = (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$serviceTy = mergedData.serviceType) === null || _mergedData$serviceTy === void 0 ? void 0 : _mergedData$serviceTy.i18nKey) === "EKYC";
5758
+ let vendorData = _extends({}, dsoDetails, {
5759
+ tenantId: tenantId,
5760
+ name,
5761
+ agencyType: "ULB",
5762
+ paymentPreference: "post-service",
5763
+ address: _extends({}, dsoDetails.address, {
5764
+ tenantId: tenantId,
5765
+ landmark,
5766
+ doorNo,
5767
+ plotNo,
5768
+ street,
5769
+ city,
5770
+ district,
5771
+ region,
5772
+ state,
5773
+ country: "india",
5774
+ pincode,
5775
+ buildingName,
5776
+ locality: _extends({}, dsoDetails.address.locality, {
5777
+ code: localityCode || "",
5778
+ name: localityName || "",
5779
+ label: "Locality",
5780
+ area: localityArea || ""
5781
+ }),
5782
+ ward: wardCode ? {
5783
+ code: wardCode,
5784
+ name: wardName
5785
+ } : undefined,
5786
+ geoLocation: _extends({}, dsoDetails.address.geoLocation, {
5787
+ latitude: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$address = mergedData.address) === null || _mergedData$address === void 0 ? void 0 : _mergedData$address.latitude) || 28.6139,
5788
+ longitude: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$address2 = mergedData.address) === null || _mergedData$address2 === void 0 ? void 0 : _mergedData$address2.longitude) || 77.209
5789
+ })
5790
+ }),
5791
+ owner: _extends({}, dsoDetails.owner, {
5792
+ tenantId: "dl",
5793
+ name: (mergedData === null || mergedData === void 0 ? void 0 : mergedData.ownerName) || name,
5794
+ fatherOrHusbandName: (mergedData === null || mergedData === void 0 ? void 0 : mergedData.fatherOrHusbandName) || name,
5795
+ relationship: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$relations = mergedData.relationship) === null || _mergedData$relations === void 0 ? void 0 : _mergedData$relations.code) || "OTHER",
5796
+ gender: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$gender = mergedData.gender) === null || _mergedData$gender === void 0 ? void 0 : _mergedData$gender.code) || "MALE",
5797
+ dob: mergedData !== null && mergedData !== void 0 && mergedData.dob ? new Date(mergedData.dob).getTime() : new Date("1/1/1970").getTime(),
5798
+ emailId: emailId || "",
5799
+ mobileNumber: phone
5800
+ }),
5801
+ additionalDetails: {
5802
+ serviceType: isEkyc ? "ekyc" : mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$serviceTy2 = mergedData.serviceType) === null || _mergedData$serviceTy2 === void 0 ? void 0 : _mergedData$serviceTy2.code
5803
+ },
5804
+ vehicles: [],
5805
+ drivers: [],
5806
+ source: isEkyc ? "eKYC Portal" : "WhatsApp"
5807
+ });
5808
+ if (isEkyc) {
5809
+ var _mergedData$zoneIds, _mergedData$clusterId;
5810
+ vendorData = _extends({}, vendorData, {
5811
+ 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)) || [],
5812
+ clusterIds: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$clusterId = mergedData.clusterIds) === null || _mergedData$clusterId === void 0 ? void 0 : _mergedData$clusterId.map(c => {
5813
+ var _c$;
5814
+ return c === null || c === void 0 ? void 0 : (_c$ = c[1]) === null || _c$ === void 0 ? void 0 : _c$.code;
5815
+ })) || [],
5816
+ contractStartDate: mergedData.contractStartDate ? new Date(mergedData.contractStartDate).getTime() : null,
5817
+ contractEndDate: mergedData.contractEndDate ? new Date(mergedData.contractEndDate).getTime() : null
5818
+ });
5974
5819
  }
5975
- }, [VendorCategory, VendorId, userName, Bank, BankbranchName, IFSC, AccountNo, PanNo, GstNo, GstState, RegistrationNo, EpfNo, EsiNo, VendorType, Status, micrNo, PhoneNo, ContactPerson, userType]);
5820
+ const payload = {
5821
+ vendor: vendorData
5822
+ };
5823
+ if (isEkyc) {
5824
+ payload.RequestInfo = {
5825
+ apiId: "Rainmaker",
5826
+ msgId: "ekyc-vendor-create"
5827
+ };
5828
+ }
5829
+ mutate(payload, {
5830
+ onError: error => {
5831
+ setShowToast({
5832
+ key: "error",
5833
+ action: error
5834
+ });
5835
+ },
5836
+ onSuccess: () => {
5837
+ queryClient.invalidateQueries("DSO_SEARCH");
5838
+ setToast({
5839
+ key: "success",
5840
+ action: "ES_VENDOR_UPDATE_VENDOR"
5841
+ });
5842
+ history.push("/digit-ui/" + userType + "/vendor/search-vendor");
5843
+ }
5844
+ });
5845
+ };
5846
+ const config = React__default.useMemo(() => {
5847
+ var _defaultValues$servic;
5848
+ 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);
5849
+ }, [t, defaultValues === null || defaultValues === void 0 ? void 0 : (_defaultValues$servic2 = defaultValues.serviceType) === null || _defaultValues$servic2 === void 0 ? void 0 : _defaultValues$servic2.i18nKey, genderMenu]);
5850
+ if (daoDataLoading || isLoading || Object.keys(defaultValues).length === 0) {
5851
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
5852
+ }
5976
5853
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
5977
5854
  config: [{
5978
5855
  timeLine: [{
5979
- actions: t("VENDOR_ADDITIONAL_DETAILS"),
5856
+ actions: t("ES_FSM_REGISTRY_TITLE_EDIT_VENDOR"),
5980
5857
  currentStep: 1
5981
5858
  }]
5982
- }, {
5983
- timeLine: [{
5984
- actions: t("VENDOR_DOCUMENT_DETAILS"),
5985
- currentStep: 2
5986
- }]
5987
- }, {
5988
- timeLine: [{
5989
- actions: t("VENDOR_SUMMARY"),
5990
- currentStep: 3
5991
- }]
5992
5859
  }],
5993
5860
  currentActiveIndex: 0,
5994
5861
  showFinalStep: false
@@ -5997,356 +5864,280 @@ const VendorDetails = _ref => {
5997
5864
  flex: "1",
5998
5865
  overflowY: "auto"
5999
5866
  }
6000
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormStep, {
6001
- config: config,
6002
- onSelect: goNext,
6003
- t: t,
6004
- className: "formcomposer-grid-container-form"
6005
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
6006
- className: "card-label-smaller"
6007
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CustomTooltip, {
6008
- label: "" + t("IFSC_CODE"),
6009
- isMandatory: false,
6010
- message: t("INVALID_IFSC_CODE_ERROR_MESSAGE")
6011
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
6012
- t: t,
6013
- type: "text",
6014
- isMandatory: false,
6015
- optionKey: "i18nKey",
6016
- name: "IFSC",
6017
- value: IFSC,
6018
- placeholder: "Enter IFSC Code",
6019
- onChange: setvendorifsc,
6020
- style: {
6021
- width: "100%"
6022
- },
6023
- maxLength: 11,
6024
- ValidationRequired: true,
6025
- validation: {
6026
- isRequired: true,
6027
- pattern: "^[A-Z]{4}0[A-Z0-9]{6}$",
6028
- type: "text",
6029
- title: t("INVALID_IFSC_CODE_ERROR_MESSAGE")
6030
- }
6031
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("VENDOR_BANK_NAME"), " ", /*#__PURE__*/React__default.createElement("span", {
6032
- className: "check-page-link-button"
6033
- }, "*")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
6034
- t: t,
6035
- type: "text",
6036
- isMandatory: false,
6037
- optionKey: "i18nKey",
6038
- name: "bankName",
6039
- placeholder: "Bank Name Auto Select",
6040
- style: {
6041
- width: "100%"
6042
- },
6043
- value: Bank,
6044
- onChange: setvendorbank,
6045
- disabled: true
6046
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("VENDOR_BANK_BRANCH_NAME"), " ", /*#__PURE__*/React__default.createElement("span", {
6047
- className: "check-page-link-button"
6048
- }, "*")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
6049
- t: t,
6050
- type: "text",
6051
- isMandatory: false,
6052
- optionKey: "i18nKey",
6053
- name: "BankbranchName",
6054
- value: BankbranchName,
6055
- style: {
6056
- width: "100%"
6057
- },
6058
- placeholder: "Bank Branch Name Auto Select",
6059
- onChange: setBankbranch,
6060
- disabled: false
6061
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("VENDOR_MICR_NO"), " ", /*#__PURE__*/React__default.createElement("span", {
6062
- className: "check-page-link-button"
6063
- }, "*")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
6064
- t: t,
6065
- type: "text",
6066
- isMandatory: false,
6067
- optionKey: "i18nKey",
6068
- name: "MicrNo",
6069
- value: micrNo,
6070
- style: {
6071
- width: "100%"
6072
- },
6073
- placeholder: "MICR No",
6074
- onChange: setmicrNo,
6075
- disabled: false
6076
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("ACCOUNT_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
6077
- t: t,
6078
- type: "text",
6079
- isMandatory: false,
6080
- optionKey: "i18nKey",
6081
- name: "AccountNo",
6082
- value: AccountNo,
6083
- onChange: setvendoraccountno,
6084
- style: {
6085
- width: "100%"
5867
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormComposer, {
5868
+ isDisabled: !canSubmit,
5869
+ label: t("ES_COMMON_APPLICATION_SUBMIT"),
5870
+ config: config.filter(i => !i.hideInEmployee).map(config => {
5871
+ return _extends({}, config, {
5872
+ body: config.body.filter(a => !a.hideInEmployee)
5873
+ });
5874
+ }),
5875
+ fieldStyle: {
5876
+ marginRight: 0
6086
5877
  },
6087
- ValidationRequired: true,
6088
- validation: {
6089
- isRequired: true,
6090
- pattern: "[0-9]{9,18}",
6091
- type: "text",
6092
- title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE")
6093
- }
6094
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("PHONE_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.MobileNumber, {
6095
- value: PhoneNo,
6096
- name: "PhoneNo",
6097
- onChange: setPhoneNo,
6098
- style: {
6099
- width: "100%"
6100
- }
6101
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("CONTACT_PERSON")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
6102
- t: t,
6103
- type: "text",
6104
- isMandatory: false,
6105
- optionKey: "i18nKey",
6106
- name: "ContactPerson",
6107
- value: ContactPerson,
6108
- onChange: setcontactperson,
6109
- style: {
6110
- width: "100%"
6111
- },
6112
- ValidationRequired: true,
6113
- validation: {
6114
- isRequired: true,
6115
- pattern: "^[a-zA-Z0-9/-]{1,20}$",
6116
- type: "text",
6117
- title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE")
6118
- }
6119
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("PAN_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
6120
- t: t,
6121
- type: "text",
6122
- isMandatory: false,
6123
- optionKey: "i18nKey",
6124
- name: "PanNo",
6125
- value: PanNo,
6126
- onChange: setpanno,
6127
- style: {
6128
- width: "100%"
6129
- },
6130
- ValidationRequired: true,
6131
- validation: {
6132
- isRequired: true,
6133
- pattern: "[A-Z]{5}[0-9]{4}[A-Z]{1}",
6134
- type: "text",
6135
- title: t("INVALID_PAN_NO_ERROR_MESSAGE")
6136
- }
6137
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("GST_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
6138
- t: t,
6139
- type: "text",
6140
- isMandatory: false,
6141
- optionKey: "i18nKey",
6142
- name: "GstNo",
6143
- value: GstNo,
6144
- onChange: setgstno,
6145
- style: {
6146
- width: "100%"
6147
- },
6148
- ValidationRequired: true,
6149
- validation: {
6150
- isRequired: true,
6151
- pattern: "^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[A-Z0-9]{1}[Z]{1}[A-Z0-9]{1}$",
6152
- type: "text",
6153
- title: t("INVALID_GST_NO_ERROR_MESSAGE")
6154
- }
6155
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("GST_REGISTERED_STATE/UT")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
6156
- t: t,
6157
- type: "text",
6158
- isMandatory: false,
6159
- optionKey: "i18nKey",
6160
- name: "GstState",
6161
- value: GstState,
6162
- onChange: setgststate,
6163
- style: {
6164
- width: "100%"
6165
- },
6166
- ValidationRequired: true,
6167
- validation: {
6168
- isRequired: true,
6169
- pattern: "^[a-zA-Z0-9/-]{1,20}$",
6170
- type: "text",
6171
- title: t("PT_NAME_ERROR_MESSAGE")
6172
- }
6173
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("REGISTRATION_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
6174
- t: t,
6175
- type: "text",
6176
- isMandatory: false,
6177
- optionKey: "i18nKey",
6178
- name: "RegistrationNo",
6179
- value: RegistrationNo,
6180
- onChange: setregistrationno,
6181
- style: {
6182
- width: "100%"
6183
- },
6184
- ValidationRequired: true,
6185
- validation: {
6186
- isRequired: true,
6187
- pattern: "^[a-zA-Z0-9/-]{1,20}$",
6188
- type: "text",
6189
- title: t("INVALID_REGISTRATION_NO_ERROR_MESSAGE")
6190
- }
6191
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("EPF_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
6192
- t: t,
6193
- type: "text",
6194
- isMandatory: false,
6195
- optionKey: "i18nKey",
6196
- name: "EpfNo",
6197
- value: EpfNo,
6198
- onChange: setepfno,
6199
- style: {
6200
- width: "100%"
6201
- },
6202
- ValidationRequired: true,
6203
- validation: {
6204
- isRequired: true,
6205
- pattern: "^[a-zA-Z0-9/-]{1,15}$",
6206
- type: "text",
6207
- title: t("INVALID_EPF_NO_ERROR_MESSAGE")
6208
- }
6209
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("ESI_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
6210
- t: t,
6211
- type: "text",
6212
- isMandatory: false,
6213
- optionKey: "i18nKey",
6214
- name: "EsiNo",
6215
- value: EsiNo,
6216
- onChange: setesino,
6217
- style: {
6218
- width: "100%"
6219
- },
6220
- ValidationRequired: true,
6221
- validation: {
6222
- isRequired: true,
6223
- pattern: "^[a-zA-Z0-9/-]{1,20}$",
6224
- type: "text",
6225
- title: t("INVALID_ESI_NO_ERROR_MESSAGE")
6226
- }
6227
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement("div", null, t("VENDOR_TYPE"), /*#__PURE__*/React__default.createElement("div", {
6228
- className: "tooltip",
6229
- style: {
6230
- width: "12px",
6231
- height: "5px",
6232
- marginLeft: "10px",
6233
- display: "inline-flex",
6234
- alignItems: "center"
6235
- }
6236
- }, /*#__PURE__*/React__default.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"
6245
- }
6246
- }, "" + t("AST_CLASSIFICATION_ASSET")))), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
6247
- control: control,
6248
- name: "VendorType",
6249
- defaultValue: VendorType,
6250
- rules: {
6251
- required: t("CORE_COMMON_REQUIRED_ERRMSG")
6252
- },
6253
- render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
6254
- selected: VendorType,
6255
- select: setVendorType,
6256
- option: [{
6257
- i18nKey: "Supplier",
6258
- code: "SUPPLIER"
6259
- }, {
6260
- i18nKey: "Contractor",
6261
- code: "CONTRACTOR"
6262
- }],
6263
- optionKey: "i18nKey",
6264
- placeholder: "Select",
6265
- t: t
6266
- })
6267
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement("div", null, t("VENOR_CATEGORY"), /*#__PURE__*/React__default.createElement("div", {
6268
- className: "tooltip",
6269
- style: {
6270
- width: "12px",
6271
- height: "5px",
6272
- marginLeft: "10px",
6273
- display: "inline-flex",
6274
- alignItems: "center"
6275
- }
6276
- }, /*#__PURE__*/React__default.createElement("span", {
6277
- className: "tooltiptext",
6278
- style: {
6279
- whiteSpace: "pre-wrap",
6280
- fontSize: "small",
6281
- wordWrap: "break-word",
6282
- width: "300px",
6283
- marginLeft: "15px",
6284
- marginBottom: "-10px"
6285
- }
6286
- }))), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
6287
- control: control,
6288
- name: "VendorCategory",
6289
- defaultValue: VendorCategory,
6290
- rules: {
6291
- required: t("CORE_COMMON_REQUIRED_ERRMSG")
6292
- },
6293
- render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
6294
- selected: VendorCategory,
6295
- select: setVendorCategory,
6296
- option: [{
6297
- i18nKey: "Firm",
6298
- code: "FIRM"
6299
- }, {
6300
- i18nKey: "Individual",
6301
- code: "Individual"
6302
- }],
6303
- optionKey: "i18nKey",
6304
- placeholder: "Select",
6305
- t: t
6306
- })
6307
- })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement("div", null, t("STATUS"), /*#__PURE__*/React__default.createElement("div", {
6308
- className: "tooltip",
6309
- style: {
6310
- width: "12px",
6311
- height: "5px",
6312
- marginLeft: "10px",
6313
- display: "inline-flex",
6314
- alignItems: "center"
5878
+ onSubmit: onSubmit,
5879
+ defaultValues: defaultValues,
5880
+ onFormValueChange: onFormValueChange,
5881
+ noBreakLine: true
5882
+ }), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
5883
+ error: showToast.key === "error" ? true : false,
5884
+ label: t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_SUCCESS" : showToast.action),
5885
+ onClose: closeToast
5886
+ })));
5887
+ };
5888
+
5889
+ const EmployeeApp = _ref => {
5890
+ let path = _ref.path;
5891
+ const _useTranslation = reactI18next.useTranslation(),
5892
+ t = _useTranslation.t;
5893
+ const location = reactRouterDom.useLocation();
5894
+ sessionStorage.removeItem("revalidateddone");
5895
+ const AddDriver = Digit.ComponentRegistryService.getComponent("AddDriver");
5896
+ const AddVehicle = Digit.ComponentRegistryService.getComponent("AddVehicle");
5897
+ const DriverDetails = Digit.ComponentRegistryService.getComponent("DriverDetails");
5898
+ const VehicleDetails = Digit.ComponentRegistryService.getComponent("VehicleDetails");
5899
+ const EditDriver = Digit.ComponentRegistryService.getComponent("EditDriver");
5900
+ const EditVehicle = Digit.ComponentRegistryService.getComponent("EditVehicle");
5901
+ const getDynamicBreadcrumbs = () => {
5902
+ const pathname = location.pathname;
5903
+ let crumbs = [{
5904
+ icon: digitUiReactComponents.HomeIcon,
5905
+ path: "/digit-ui/employee"
5906
+ }, {
5907
+ label: t("TITLE_VENDOR_MANAGEMENT"),
5908
+ path: "/digit-ui/employee/vendor/search-vendor"
5909
+ }];
5910
+ if (pathname.includes("/registry/new-vendor")) {
5911
+ crumbs.push({
5912
+ label: t("ES_FSM_REGISTRY_TITLE_NEW_VENDOR")
5913
+ });
5914
+ } else if (pathname.includes("/search-vendor")) {
5915
+ crumbs.push({
5916
+ label: t("SEARCH_VENDOR")
5917
+ });
5918
+ } else if (pathname.includes("/registry/new-driver")) {
5919
+ crumbs.push({
5920
+ label: t("ES_FSM_REGISTRY_TITLE_NEW_DRIVER")
5921
+ });
5922
+ } else if (pathname.includes("/registry/vendor-details") || pathname.includes("/registry/modify-vendor/")) {
5923
+ crumbs.push({
5924
+ label: t("VENDOR_VENDOR_DETAILS")
5925
+ });
5926
+ } else if (pathname.includes("/registry/vehicle-details") || pathname.includes("/registry/modify-vehicle/")) {
5927
+ crumbs.push({
5928
+ label: t("VENDOR_VEHICLE_DETAILS")
5929
+ });
5930
+ } else if (pathname.includes("/registry/new-vehicle")) {
5931
+ crumbs.push({
5932
+ label: t("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE")
5933
+ });
5934
+ } else if (pathname.includes("/registry/driver-details") || pathname.includes("/registry/modify-driver/")) {
5935
+ crumbs.push({
5936
+ label: t("VENDOR_DRIVER_DETAILS")
5937
+ });
5938
+ } else if (pathname.includes("/registry/additionaldetails")) {
5939
+ crumbs.push({
5940
+ label: t("VENDOR_ADDITIONAL_DETAILS")
5941
+ });
5942
+ } else if (pathname.includes("/registry/new-supervisor")) {
5943
+ crumbs.push({
5944
+ label: t("ES_FSM_REGISTRY_TITLE_NEW_SUPERVISOR")
5945
+ });
5946
+ } else if (pathname.includes("/registry/supervisor-details") || pathname.includes("/registry/modify-supervisor/")) {
5947
+ crumbs.push({
5948
+ label: t("VENDOR_SUPERVISOR_DETAILS")
5949
+ });
5950
+ } else if (pathname.includes("/registry/new-surveyor")) {
5951
+ crumbs.push({
5952
+ label: t("ES_FSM_REGISTRY_TITLE_NEW_SURVEYOR")
5953
+ });
5954
+ } else if (pathname.includes("/registry/surveyor-details") || pathname.includes("/registry/modify-surveyor/")) {
5955
+ crumbs.push({
5956
+ label: t("VENDOR_SURVEYOR_DETAILS")
5957
+ });
6315
5958
  }
6316
- }, /*#__PURE__*/React__default.createElement("span", {
6317
- className: "tooltiptext",
6318
- style: {
6319
- whiteSpace: "pre-wrap",
6320
- fontSize: "small",
6321
- wordWrap: "break-word",
6322
- width: "300px",
6323
- marginLeft: "15px",
6324
- marginBottom: "-10px"
5959
+ return crumbs;
5960
+ };
5961
+ return /*#__PURE__*/React__default.createElement(reactRouterDom.Switch, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.AppContainer, null, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
5962
+ className: "ground-container employee-app-container form-container"
5963
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.ModuleHeader, {
5964
+ leftContent: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.ArrowLeft, {
5965
+ className: "icon"
5966
+ }), "Back"),
5967
+ onLeftClick: () => window.history.back(),
5968
+ breadcrumbs: getDynamicBreadcrumbs()
5969
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5970
+ path: path + "/search-vendor",
5971
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5972
+ layoutClass: "normal"
5973
+ }, /*#__PURE__*/React__default.createElement(SearchVendor, _extends({}, props, {
5974
+ parentRoute: path
5975
+ })))
5976
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5977
+ path: path + "/registry/new-driver",
5978
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5979
+ layoutClass: "action"
5980
+ }, /*#__PURE__*/React__default.createElement(AddDriver, _extends({}, props, {
5981
+ parentRoute: path
5982
+ })))
5983
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5984
+ path: path + "/registry/new-vehicle",
5985
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5986
+ layoutClass: "action"
5987
+ }, /*#__PURE__*/React__default.createElement(AddVehicle, _extends({}, props, {
5988
+ parentRoute: path
5989
+ })))
5990
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
5991
+ path: path + "/registry/additionaldetails",
5992
+ component: props => {
5993
+ const isInfoPage = props.location.pathname.includes("/info");
5994
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
5995
+ layoutClass: isInfoPage ? "action" : "normal"
5996
+ }, /*#__PURE__*/React__default.createElement(VENDORCreate, _extends({}, props, {
5997
+ parentRoute: path
5998
+ })));
6325
5999
  }
6326
- }, "" + t("AST_CLASSIFICATION_ASSET")))), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
6327
- control: control,
6328
- name: "Status",
6329
- defaultValue: Status,
6330
- rules: {
6331
- required: t("CORE_COMMON_REQUIRED_ERRMSG")
6332
- },
6333
- render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
6334
- selected: Status,
6335
- select: setStatus,
6336
- option: [{
6337
- i18nKey: "Active",
6338
- code: "ACTIVE"
6339
- }, {
6340
- i18nKey: "Inactive",
6341
- code: "INACTIVE"
6342
- }],
6343
- optionKey: "i18nKey",
6344
- placeholder: "Select",
6345
- t: t
6346
- })
6000
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6001
+ path: path + "/registry/driver-details/:id",
6002
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6003
+ layoutClass: "action"
6004
+ }, /*#__PURE__*/React__default.createElement(DriverDetails, _extends({}, props, {
6005
+ parentRoute: path
6006
+ })))
6007
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6008
+ path: path + "/registry/modify-driver/:id",
6009
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6010
+ layoutClass: "action"
6011
+ }, /*#__PURE__*/React__default.createElement(EditDriver, _extends({}, props, {
6012
+ parentRoute: path
6013
+ })))
6014
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6015
+ path: path + "/common-search/:id",
6016
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6017
+ layoutClass: "normal"
6018
+ }, /*#__PURE__*/React__default.createElement(SearchApp, _extends({}, props, {
6019
+ parentRoute: path
6020
+ })))
6021
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6022
+ path: path + "/registry/new-vendor",
6023
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6024
+ layoutClass: "action"
6025
+ }, /*#__PURE__*/React__default.createElement(AddVendor, _extends({}, props, {
6026
+ parentRoute: path
6027
+ })))
6028
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6029
+ path: path + "/registry/vendor-details/:id",
6030
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6031
+ layoutClass: "action"
6032
+ }, /*#__PURE__*/React__default.createElement(VendorDetails, _extends({}, props, {
6033
+ parentRoute: path
6034
+ })))
6035
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6036
+ path: path + "/registry/modify-vendor/:id",
6037
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6038
+ layoutClass: "action"
6039
+ }, /*#__PURE__*/React__default.createElement(EditVendor, _extends({}, props, {
6040
+ parentRoute: path
6041
+ })))
6042
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6043
+ path: path + "/registry/vehicle-details/:id",
6044
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6045
+ layoutClass: "action"
6046
+ }, /*#__PURE__*/React__default.createElement(VehicleDetails, _extends({}, props, {
6047
+ parentRoute: path
6048
+ })))
6049
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6050
+ path: path + "/registry/modify-vehicle/:id",
6051
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6052
+ layoutClass: "action"
6053
+ }, /*#__PURE__*/React__default.createElement(EditVehicle, _extends({}, props, {
6054
+ parentRoute: path
6055
+ })))
6056
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6057
+ path: path + "/registry/new-supervisor",
6058
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6059
+ layoutClass: "action"
6060
+ }, /*#__PURE__*/React__default.createElement(AddSupervisor, _extends({}, props, {
6061
+ parentRoute: path
6062
+ })))
6063
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6064
+ path: path + "/registry/supervisor-details/:id",
6065
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6066
+ layoutClass: "action"
6067
+ }, /*#__PURE__*/React__default.createElement(SupervisorDetails, _extends({}, props, {
6068
+ parentRoute: path
6069
+ })))
6070
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6071
+ path: path + "/registry/modify-supervisor/:id",
6072
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6073
+ layoutClass: "action"
6074
+ }, /*#__PURE__*/React__default.createElement(EditSupervisor, _extends({}, props, {
6075
+ parentRoute: path
6076
+ })))
6077
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6078
+ path: path + "/registry/new-surveyor",
6079
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6080
+ layoutClass: "action"
6081
+ }, /*#__PURE__*/React__default.createElement(AddSurveyor, _extends({}, props, {
6082
+ parentRoute: path
6083
+ })))
6084
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6085
+ path: path + "/registry/surveyor-details/:id",
6086
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6087
+ layoutClass: "action"
6088
+ }, /*#__PURE__*/React__default.createElement(SurveyorDetails, _extends({}, props, {
6089
+ parentRoute: path
6090
+ })))
6091
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
6092
+ path: path + "/registry/modify-surveyor/:id",
6093
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
6094
+ layoutClass: "action"
6095
+ }, /*#__PURE__*/React__default.createElement(EditSurveyor, _extends({}, props, {
6096
+ parentRoute: path
6097
+ })))
6347
6098
  })))));
6348
6099
  };
6349
6100
 
6101
+ const VENDORCard = () => {
6102
+ const _useTranslation = reactI18next.useTranslation(),
6103
+ t = _useTranslation.t;
6104
+ const history = reactRouterDom.useHistory();
6105
+ const isCitizen = window.location.pathname.toLowerCase().includes("citizen");
6106
+ let hasAccess = Digit.Utils.vendorAccess() || Digit.UserService.hasAccess(["WT_VENDOR", "MT_VENDOR"]);
6107
+ if (isCitizen) {
6108
+ hasAccess = Digit.UserService.hasAccess(["WT_VENDOR", "EKYC_VENDOR", "EKYC_SUPERVISOR"]);
6109
+ }
6110
+ if (!hasAccess) {
6111
+ return null;
6112
+ }
6113
+ const links = [{
6114
+ label: t("VENDOR_NEW_REGISTERATION"),
6115
+ link: isCitizen ? "/digit-ui/citizen/vendor/registry/new-vendor" : "/digit-ui/employee/vendor/registry/new-vendor"
6116
+ }, {
6117
+ label: t("SEARCH_VENDOR"),
6118
+ link: isCitizen ? "/digit-ui/citizen/vendor/search-vendor" : "/digit-ui/employee/vendor/search-vendor"
6119
+ }];
6120
+ const VENDORRole = Digit.UserService.hasAccess(["WT_VENDOR"]);
6121
+ const propsForModuleCard = _extends({
6122
+ Icon: /*#__PURE__*/React__default.createElement(digitUiReactComponents.PropertyHouse, null),
6123
+ moduleName: t("TITLE_VENDOR_MANAGEMENT"),
6124
+ kpis: [{
6125
+ count: 0,
6126
+ label: t("Inbox"),
6127
+ link: isCitizen ? "/digit-ui/citizen/vendor/search-vendor" : "/digit-ui/employee/vendor/search-vendor"
6128
+ }],
6129
+ links: links.filter(link => !(link !== null && link !== void 0 && link.role) || VENDORRole)
6130
+ }, isCitizen ? {
6131
+ onDetailsClick: () => history.push("/digit-ui/citizen/vendor/search-vendor")
6132
+ } : {});
6133
+ if (isCitizen) {
6134
+ return /*#__PURE__*/React__default.createElement("div", {
6135
+ className: "wt-citizen-card-premium"
6136
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.EmployeeModuleCard, propsForModuleCard));
6137
+ }
6138
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.EmployeeModuleCard, propsForModuleCard);
6139
+ };
6140
+
6350
6141
  const VendorDocuments = _ref => {
6351
6142
  var _formData$documents;
6352
6143
  let t = _ref.t,
@@ -7380,7 +7171,14 @@ const CitizenVendorApp = () => {
7380
7171
  path: path + "/registry/vendor-details/:id",
7381
7172
  component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
7382
7173
  layoutClass: "action"
7383
- }, /*#__PURE__*/React__default.createElement(EditVendorDetails, _extends({}, props, {
7174
+ }, /*#__PURE__*/React__default.createElement(VendorDetails, _extends({}, props, {
7175
+ parentRoute: path
7176
+ })))
7177
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
7178
+ path: path + "/registry/modify-vendor/:id",
7179
+ component: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
7180
+ layoutClass: "action"
7181
+ }, /*#__PURE__*/React__default.createElement(EditVendor, _extends({}, props, {
7384
7182
  parentRoute: path
7385
7183
  })))
7386
7184
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
@@ -7532,8 +7330,6 @@ const CheckPage = _ref2 => {
7532
7330
  t = _useTranslation2.t;
7533
7331
  const vendordet = value.vendordet,
7534
7332
  documents = value.documents;
7535
- console.log("vendordetailssppsss", vendordet);
7536
- console.log("documents", documents);
7537
7333
  const _useState = React.useState(false),
7538
7334
  agree = _useState[0],
7539
7335
  setAgree = _useState[1];
@@ -8125,12 +7921,12 @@ const AddDriver = () => {
8125
7921
  })));
8126
7922
  };
8127
7923
 
8128
- const Heading$3 = props => {
7924
+ const Heading$2 = props => {
8129
7925
  return /*#__PURE__*/React__default.createElement("h1", {
8130
7926
  className: "heading-m"
8131
7927
  }, props.label);
8132
7928
  };
8133
- const CloseBtn$2 = props => {
7929
+ const CloseBtn$1 = props => {
8134
7930
  return /*#__PURE__*/React__default.createElement("div", {
8135
7931
  onClick: props.onClick
8136
7932
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CloseSvg, null));
@@ -8472,10 +8268,10 @@ const DriverDetails = () => {
8472
8268
  }, t(value.value) || "N/A"));
8473
8269
  }))));
8474
8270
  }))), showModal && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
8475
- headerBarMain: /*#__PURE__*/React__default.createElement(Heading$3, {
8271
+ headerBarMain: /*#__PURE__*/React__default.createElement(Heading$2, {
8476
8272
  label: t(modalHeading())
8477
8273
  }),
8478
- headerBarEnd: /*#__PURE__*/React__default.createElement(CloseBtn$2, {
8274
+ headerBarEnd: /*#__PURE__*/React__default.createElement(CloseBtn$1, {
8479
8275
  onClick: closeModal
8480
8276
  }),
8481
8277
  actionCancelLabel: t("CS_COMMON_CANCEL"),
@@ -8665,939 +8461,1495 @@ const VehicleConfig = function (t, disabled) {
8665
8461
  validation: {
8666
8462
  required: true
8667
8463
  },
8668
- component: (props, customProps) => /*#__PURE__*/React__default.createElement(DatePicker$3, _extends({
8669
- onChange: props.onChange,
8670
- date: props.value
8671
- }, customProps, {
8672
- max: (() => {
8673
- const date = new Date();
8674
- date.setFullYear(date.getFullYear() - 18);
8675
- return date.toISOString().split("T")[0];
8676
- })()
8677
- }))
8678
- }
8679
- }, {
8680
- label: "ES_FSM_REGISTRY_NEW_EMAIL",
8681
- isMandatory: false,
8682
- type: "text",
8683
- key: "emailId",
8684
- populators: {
8685
- name: "emailId",
8686
- validation: {
8687
- required: false,
8688
- pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
8464
+ component: (props, customProps) => /*#__PURE__*/React__default.createElement(DatePicker$3, _extends({
8465
+ onChange: props.onChange,
8466
+ date: props.value
8467
+ }, customProps, {
8468
+ max: (() => {
8469
+ const date = new Date();
8470
+ date.setFullYear(date.getFullYear() - 18);
8471
+ return date.toISOString().split("T")[0];
8472
+ })()
8473
+ }))
8474
+ }
8475
+ }, {
8476
+ label: "ES_FSM_REGISTRY_NEW_EMAIL",
8477
+ isMandatory: false,
8478
+ type: "text",
8479
+ key: "emailId",
8480
+ populators: {
8481
+ name: "emailId",
8482
+ validation: {
8483
+ required: false,
8484
+ pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
8485
+ },
8486
+ error: t("FSM_REGISTRY_INVALID_EMAIL"),
8487
+ defaultValue: ""
8488
+ }
8489
+ }]
8490
+ }];
8491
+ };
8492
+
8493
+ const AddVehicle = _ref => {
8494
+ var _Digit$UserService$ge, _Digit$UserService$ge2;
8495
+ const tenantId = Digit.ULBService.getCurrentTenantId();
8496
+ const stateId = Digit.ULBService.getStateId();
8497
+ const _useState = React.useState(null),
8498
+ showToast = _useState[0],
8499
+ setShowToast = _useState[1];
8500
+ const history = reactRouterDom.useHistory();
8501
+ const _useTranslation = reactI18next.useTranslation(),
8502
+ t = _useTranslation.t;
8503
+ const queryClient = reactQuery.useQueryClient();
8504
+ const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED", false),
8505
+ setMutationHappened = _Digit$Hooks$useSessi[1];
8506
+ const _Digit$Hooks$useSessi2 = Digit.Hooks.useSessionStorage("FSM_ERROR_DATA", false),
8507
+ clearError = _Digit$Hooks$useSessi2[2];
8508
+ const _Digit$Hooks$useSessi3 = Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA", false),
8509
+ clearSuccessData = _Digit$Hooks$useSessi3[2];
8510
+ const isCitizen = Digit.UserService.getType() === "WT_VENDOR" || Digit.UserService.hasAccess(["WT_VENDOR"]);
8511
+ const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVehicleCreate(stateId),
8512
+ mutate = _Digit$Hooks$fsm$useV.mutate;
8513
+ const _Digit$Hooks$fsm$useV2 = Digit.Hooks.fsm.useVendorUpdate("dl.djb"),
8514
+ mutateVendor = _Digit$Hooks$fsm$useV2.mutate;
8515
+ 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;
8516
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
8517
+ mobileNumber: mobileNumber
8518
+ }, {
8519
+ enabled: !!(isCitizen && mobileNumber)
8520
+ }),
8521
+ vendorData = _Digit$Hooks$fsm$useD.data;
8522
+ React.useEffect(() => {
8523
+ setMutationHappened(false);
8524
+ clearSuccessData();
8525
+ clearError();
8526
+ }, []);
8527
+ const Config = VehicleConfig(t);
8528
+ Config[0].body.forEach(item => {
8529
+ if (item.label === "ES_FSM_REGISTRY_VEHICLE_NUMBER") {
8530
+ item.labelChildren = /*#__PURE__*/React__default.createElement("div", {
8531
+ className: "tooltip",
8532
+ style: {
8533
+ paddingLeft: "10px",
8534
+ marginBottom: "-3px"
8535
+ }
8536
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.InfoIcon, null), /*#__PURE__*/React__default.createElement("span", {
8537
+ className: "tooltiptext",
8538
+ style: {
8539
+ width: "320px",
8540
+ left: "230%",
8541
+ fontSize: "14px"
8542
+ }
8543
+ }, item.populators.validation.title));
8544
+ }
8545
+ });
8546
+ const _useState2 = React.useState(false),
8547
+ canSubmit = _useState2[0],
8548
+ setSubmitValve = _useState2[1];
8549
+ const defaultValues = {
8550
+ serviceType: {
8551
+ code: "WT",
8552
+ name: "WT",
8553
+ i18nKey: "WT"
8554
+ },
8555
+ tripData: {
8556
+ noOfTrips: 1,
8557
+ amountPerTrip: null,
8558
+ amount: null
8559
+ }
8560
+ };
8561
+ const formatVehicleNumber = input => {
8562
+ const cleaned = input.toUpperCase().replace(/[^A-Z0-9]/g, "");
8563
+ if (cleaned.length <= 2) return cleaned;
8564
+ const state = cleaned.slice(0, 2);
8565
+ const rest = cleaned.slice(2);
8566
+ if (!rest) return state;
8567
+ const rtoMatch = rest.match(/^(\d{1,2})/);
8568
+ if (!rtoMatch) return state + "-" + rest;
8569
+ const rtoDigits = rtoMatch[1];
8570
+ const afterRto = rest.slice(rtoDigits.length);
8571
+ const lettersMatch = afterRto.match(/^([A-Z]*)/);
8572
+ const middleLetters = lettersMatch ? lettersMatch[1] : "";
8573
+ const number = afterRto.slice(middleLetters.length);
8574
+ if (!number) {
8575
+ return state + "-" + rtoDigits + middleLetters;
8576
+ }
8577
+ if (middleLetters.length >= 3) {
8578
+ const splitAt = middleLetters.length <= 3 ? 1 : 2;
8579
+ const series = middleLetters.slice(0, splitAt);
8580
+ const subSeries = middleLetters.slice(splitAt);
8581
+ return state + "-" + rtoDigits + series + "-" + subSeries + "-" + number.slice(0, 4);
8582
+ }
8583
+ return state + "-" + rtoDigits + middleLetters + "-" + number.slice(0, 4);
8584
+ };
8585
+ const onFormValueChange = (setValue, formData) => {
8586
+ var _formData$vehicle, _formData$vehicle2;
8587
+ if (formData !== null && formData !== void 0 && formData.registrationNumber) {
8588
+ let updatedRegNo = formatVehicleNumber(formData.registrationNumber);
8589
+ if (updatedRegNo.length > 15) {
8590
+ updatedRegNo = updatedRegNo.slice(0, 15);
8591
+ }
8592
+ if (updatedRegNo !== formData.registrationNumber) {
8593
+ setValue("registrationNumber", updatedRegNo);
8594
+ }
8595
+ }
8596
+ 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)) {
8597
+ setSubmitValve(true);
8598
+ } else {
8599
+ setSubmitValve(false);
8600
+ }
8601
+ };
8602
+ const closeToast = () => {
8603
+ setShowToast(null);
8604
+ };
8605
+ const onSubmit = data => {
8606
+ var _data$vehicle, _data$vehicle$type, _data$vehicle2, _data$vehicle2$modal, _data$vehicle3, _data$vehicle3$type, _data$serviceType, _data$selectGender;
8607
+ const registrationNumber = data === null || data === void 0 ? void 0 : data.registrationNumber;
8608
+ 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;
8609
+ 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;
8610
+ 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;
8611
+ const pollutionCert = new Date("" + (data === null || data === void 0 ? void 0 : data.pollutionCert)).getTime();
8612
+ const insurance = new Date("" + (data === null || data === void 0 ? void 0 : data.insurance)).getTime();
8613
+ const roadTax = new Date("" + (data === null || data === void 0 ? void 0 : data.roadTax)).getTime();
8614
+ const fitnessValidity = new Date("" + (data === null || data === void 0 ? void 0 : data.fitnessValidity)).getTime();
8615
+ const ownerName = data === null || data === void 0 ? void 0 : data.ownerName;
8616
+ const phone = data === null || data === void 0 ? void 0 : data.phone;
8617
+ const additionalDetails = data === null || data === void 0 ? void 0 : (_data$serviceType = data.serviceType) === null || _data$serviceType === void 0 ? void 0 : _data$serviceType.code;
8618
+ const gender = data === null || data === void 0 ? void 0 : (_data$selectGender = data.selectGender) === null || _data$selectGender === void 0 ? void 0 : _data$selectGender.code;
8619
+ const emailId = data === null || data === void 0 ? void 0 : data.emailId;
8620
+ const dob = new Date("" + data.dob).getTime() || new Date("1/1/1970").getTime();
8621
+ const formData = {
8622
+ vehicle: {
8623
+ tenantId: "dl.djb",
8624
+ registrationNumber: registrationNumber,
8625
+ model: vehicleModal,
8626
+ type: vehicleType,
8627
+ tankCapacity: tankCapacity,
8628
+ suctionType: "SEWER_SUCTION_MACHINE",
8629
+ pollutionCertiValidTill: pollutionCert,
8630
+ InsuranceCertValidTill: insurance,
8631
+ fitnessValidTill: fitnessValidity,
8632
+ roadTaxPaidTill: roadTax,
8633
+ gpsEnabled: true,
8634
+ source: "Municipal records",
8635
+ owner: {
8636
+ tenantId: stateId,
8637
+ name: ownerName,
8638
+ fatherOrHusbandName: ownerName,
8639
+ relationship: "OTHER",
8640
+ correspondenceAddress: "",
8641
+ mobileNumber: phone,
8642
+ gender: gender,
8643
+ dob: dob,
8644
+ emailId: emailId || "abc@egov.com"
8645
+ },
8646
+ additionalDetails: {
8647
+ serviceType: additionalDetails
8689
8648
  },
8690
- error: t("FSM_REGISTRY_INVALID_EMAIL"),
8691
- defaultValue: ""
8649
+ vehicleOwner: "ULB"
8692
8650
  }
8693
- }]
8694
- }];
8651
+ };
8652
+ mutate(formData, {
8653
+ onError: (error, variables) => {
8654
+ var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
8655
+ 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";
8656
+ setShowToast({
8657
+ key: "error",
8658
+ action: errorMessage
8659
+ });
8660
+ setTimeout(closeToast, 5000);
8661
+ },
8662
+ onSuccess: (data, variables) => {
8663
+ var _data$Errors, _data$data, _data$data$Errors, _vendorData$;
8664
+ 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;
8665
+ if (isError) {
8666
+ var _data$data2, _data$data2$Errors, _data$data2$Errors$, _data$Errors2, _data$Errors2$;
8667
+ 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";
8668
+ setShowToast({
8669
+ key: "error",
8670
+ action: errorMessage
8671
+ });
8672
+ setTimeout(closeToast, 5000);
8673
+ return;
8674
+ }
8675
+ setShowToast({
8676
+ key: "success",
8677
+ action: "ADD_VEHICLE"
8678
+ });
8679
+ queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
8680
+ if (isCitizen && vendorData !== null && vendorData !== void 0 && (_vendorData$ = vendorData[0]) !== null && _vendorData$ !== void 0 && _vendorData$.dsoDetails) {
8681
+ var _data$vehicle4;
8682
+ 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, {
8683
+ vendorVehicleStatus: "ACTIVE",
8684
+ status: "ACTIVE"
8685
+ }))) || [];
8686
+ const vendor = vendorData[0].dsoDetails;
8687
+ const updatedVendor = {
8688
+ vendor: _extends({}, vendor, {
8689
+ vehicles: vendor.vehicles ? [...vendor.vehicles, ...newVehicle] : [...newVehicle]
8690
+ })
8691
+ };
8692
+ mutateVendor(updatedVendor, {
8693
+ onError: error => {
8694
+ var _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
8695
+ 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";
8696
+ setShowToast({
8697
+ key: "error",
8698
+ action: errorMessage
8699
+ });
8700
+ setTimeout(closeToast, 5000);
8701
+ },
8702
+ onSuccess: vendorDataRes => {
8703
+ var _vendorDataRes$Errors, _vendorDataRes$data, _vendorDataRes$data$E, _Digit$UserService$ge3, _Digit$UserService$ge4, _Digit$UserService$ge5;
8704
+ 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;
8705
+ if (isError) {
8706
+ var _vendorDataRes$data2, _vendorDataRes$data2$, _vendorDataRes$data2$2, _vendorDataRes$Errors2, _vendorDataRes$Errors3;
8707
+ 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";
8708
+ setShowToast({
8709
+ key: "error",
8710
+ action: errorMessage
8711
+ });
8712
+ setTimeout(closeToast, 5000);
8713
+ return;
8714
+ }
8715
+ setShowToast({
8716
+ key: "success",
8717
+ action: "ADD_VEHICLE"
8718
+ });
8719
+ queryClient.invalidateQueries("DSO_SEARCH");
8720
+ 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";
8721
+ setTimeout(() => {
8722
+ closeToast();
8723
+ history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=VEHICLE");
8724
+ }, 3000);
8725
+ }
8726
+ });
8727
+ } else {
8728
+ var _Digit$UserService$ge6, _Digit$UserService$ge7, _Digit$UserService$ge8;
8729
+ 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";
8730
+ queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
8731
+ setTimeout(() => {
8732
+ closeToast();
8733
+ history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=VEHICLE");
8734
+ }, 3000);
8735
+ }
8736
+ }
8737
+ });
8738
+ };
8739
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
8740
+ config: [{
8741
+ route: "vendor-details",
8742
+ timeLine: [{
8743
+ actions: t("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE"),
8744
+ currentStep: 1
8745
+ }]
8746
+ }],
8747
+ currentActiveIndex: 0,
8748
+ showFinalStep: false
8749
+ }), /*#__PURE__*/React__default.createElement("div", {
8750
+ style: {
8751
+ flex: "1",
8752
+ overflowY: "auto"
8753
+ }
8754
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormComposer, {
8755
+ isDisabled: !canSubmit,
8756
+ label: t("ES_COMMON_APPLICATION_SUBMIT"),
8757
+ config: Config.filter(i => !i.hideInEmployee).map(config => {
8758
+ return _extends({}, config, {
8759
+ isCollapsible: true,
8760
+ isDefaultOpen: true,
8761
+ body: config.body.filter(a => !a.hideInEmployee)
8762
+ });
8763
+ }),
8764
+ fieldStyle: {
8765
+ marginRight: 0
8766
+ },
8767
+ onSubmit: onSubmit,
8768
+ defaultValues: defaultValues,
8769
+ onFormValueChange: onFormValueChange,
8770
+ noBreakLine: true,
8771
+ mode: "onChange",
8772
+ noCard: true
8773
+ }), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
8774
+ error: showToast.key === "error" ? true : false,
8775
+ label: t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_SUCCESS" : showToast.action),
8776
+ onClose: closeToast
8777
+ })));
8695
8778
  };
8696
8779
 
8697
- const AddVehicle = _ref => {
8698
- var _Digit$UserService$ge, _Digit$UserService$ge2;
8780
+ const Heading$3 = props => {
8781
+ return /*#__PURE__*/React__default.createElement("h1", {
8782
+ className: "heading-m"
8783
+ }, props.label);
8784
+ };
8785
+ const CloseBtn$2 = props => {
8786
+ return /*#__PURE__*/React__default.createElement("div", {
8787
+ onClick: props.onClick
8788
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CloseSvg, null));
8789
+ };
8790
+ const VehicleDetails = props => {
8791
+ var _vehicleData$6, _vehicleData$6$employ;
8699
8792
  const tenantId = Digit.ULBService.getCurrentTenantId();
8700
- const stateId = Digit.ULBService.getStateId();
8701
- const _useState = React.useState(null),
8702
- showToast = _useState[0],
8703
- setShowToast = _useState[1];
8704
- const history = reactRouterDom.useHistory();
8705
8793
  const _useTranslation = reactI18next.useTranslation(),
8706
8794
  t = _useTranslation.t;
8795
+ const history = reactRouterDom.useHistory();
8707
8796
  const queryClient = reactQuery.useQueryClient();
8708
- const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED", false),
8709
- setMutationHappened = _Digit$Hooks$useSessi[1];
8710
- const _Digit$Hooks$useSessi2 = Digit.Hooks.useSessionStorage("FSM_ERROR_DATA", false),
8711
- clearError = _Digit$Hooks$useSessi2[2];
8712
- const _Digit$Hooks$useSessi3 = Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA", false),
8713
- clearSuccessData = _Digit$Hooks$useSessi3[2];
8714
- const isCitizen = Digit.UserService.getType() === "WT_VENDOR" || Digit.UserService.hasAccess(["WT_VENDOR"]);
8715
- const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVehicleCreate(stateId),
8716
- mutate = _Digit$Hooks$fsm$useV.mutate;
8717
- const _Digit$Hooks$fsm$useV2 = Digit.Hooks.fsm.useVendorUpdate("dl.djb"),
8718
- mutateVendor = _Digit$Hooks$fsm$useV2.mutate;
8719
- 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;
8720
- const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
8721
- mobileNumber: mobileNumber
8797
+ let _useParams = reactRouterDom.useParams(),
8798
+ vehicleNumber = _useParams.id;
8799
+ const _useState = React.useState(false),
8800
+ displayMenu = _useState[0],
8801
+ setDisplayMenu = _useState[1];
8802
+ const _useState2 = React.useState(null),
8803
+ selectedAction = _useState2[0],
8804
+ setSelectedAction = _useState2[1];
8805
+ const _useState3 = React.useState(false),
8806
+ showModal = _useState3[0],
8807
+ setShowModal = _useState3[1];
8808
+ const _useState4 = React.useState(null),
8809
+ showToast = _useState4[0],
8810
+ setShowToast = _useState4[1];
8811
+ const _useState5 = React.useState([]),
8812
+ vendors = _useState5[0],
8813
+ setVendors = _useState5[1];
8814
+ const _useState6 = React.useState({}),
8815
+ selectedOption = _useState6[0],
8816
+ setSelectedOption = _useState6[1];
8817
+ const _useState7 = React.useState(null),
8818
+ vehicleId = _useState7[0],
8819
+ setVehicleId = _useState7[1];
8820
+ const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVehicleDetails(tenantId, {
8821
+ registrationNumber: vehicleNumber
8722
8822
  }, {
8723
- enabled: !!(isCitizen && mobileNumber)
8823
+ staleTime: Infinity
8724
8824
  }),
8825
+ vehicleData = _Digit$Hooks$fsm$useV.data,
8826
+ isLoading = _Digit$Hooks$fsm$useV.isLoading,
8827
+ refetch = _Digit$Hooks$fsm$useV.refetch;
8828
+ React.useEffect(() => {
8829
+ if (!isLoading && vehicleData) {
8830
+ var _vehicleData$, _vehicleData$$vehicle;
8831
+ 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);
8832
+ }
8833
+ }, [vehicleData, isLoading]);
8834
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
8835
+ sortBy: "name",
8836
+ sortOrder: "ASC",
8837
+ status: "ACTIVE"
8838
+ }, {}),
8725
8839
  vendorData = _Digit$Hooks$fsm$useD.data;
8726
8840
  React.useEffect(() => {
8727
- setMutationHappened(false);
8728
- clearSuccessData();
8729
- clearError();
8841
+ if (vendorData) {
8842
+ let vendors = vendorData.map(data => data.dsoDetails);
8843
+ setVendors(vendors);
8844
+ }
8845
+ }, [vendorData]);
8846
+ const _Digit$Hooks$fsm$useU = Digit.Hooks.fsm.useUpdateVehicle(tenantId),
8847
+ mutate = _Digit$Hooks$fsm$useU.mutate;
8848
+ const _Digit$Hooks$fsm$useV2 = Digit.Hooks.fsm.useVendorUpdate(tenantId),
8849
+ mutateVendor = _Digit$Hooks$fsm$useV2.mutate;
8850
+ function onActionSelect(action) {
8851
+ setDisplayMenu(false);
8852
+ setSelectedAction(action);
8853
+ }
8854
+ React.useEffect(() => {
8855
+ refetch();
8730
8856
  }, []);
8731
- const Config = VehicleConfig(t);
8732
- Config[0].body.forEach(item => {
8733
- if (item.label === "ES_FSM_REGISTRY_VEHICLE_NUMBER") {
8734
- item.labelChildren = /*#__PURE__*/React__default.createElement("div", {
8735
- className: "tooltip",
8736
- style: {
8737
- paddingLeft: "10px",
8738
- marginBottom: "-3px"
8739
- }
8740
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.InfoIcon, null), /*#__PURE__*/React__default.createElement("span", {
8741
- className: "tooltiptext",
8742
- style: {
8743
- width: "320px",
8744
- left: "230%",
8745
- fontSize: "14px"
8746
- }
8747
- }, item.populators.validation.title));
8748
- }
8749
- });
8750
- const _useState2 = React.useState(false),
8751
- canSubmit = _useState2[0],
8752
- setSubmitValve = _useState2[1];
8753
- const defaultValues = {
8754
- serviceType: {
8755
- code: "WT",
8756
- name: "WT",
8757
- i18nKey: "WT"
8758
- },
8759
- tripData: {
8760
- noOfTrips: 1,
8761
- amountPerTrip: null,
8762
- amount: null
8857
+ React.useEffect(() => {
8858
+ switch (selectedAction) {
8859
+ case "DELETE":
8860
+ case "ADD_VENDOR":
8861
+ case "EDIT_VENDOR":
8862
+ case "DELETE_VENDOR":
8863
+ return setShowModal(true);
8864
+ case "EDIT":
8865
+ return history.push("/digit-ui/employee/fsm/registry/modify-vehicle/" + vehicleNumber);
8866
+ case "HOME":
8867
+ return history.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE");
8763
8868
  }
8869
+ }, [selectedAction]);
8870
+ const closeToast = () => {
8871
+ setShowToast(null);
8764
8872
  };
8765
- const formatVehicleNumber = input => {
8766
- const cleaned = input.toUpperCase().replace(/[^A-Z0-9]/g, "");
8767
- if (cleaned.length <= 2) return cleaned;
8768
- const state = cleaned.slice(0, 2);
8769
- const rest = cleaned.slice(2);
8770
- if (!rest) return state;
8771
- const rtoMatch = rest.match(/^(\d{1,2})/);
8772
- if (!rtoMatch) return state + "-" + rest;
8773
- const rtoDigits = rtoMatch[1];
8774
- const afterRto = rest.slice(rtoDigits.length);
8775
- const lettersMatch = afterRto.match(/^([A-Z]*)/);
8776
- const middleLetters = lettersMatch ? lettersMatch[1] : "";
8777
- const number = afterRto.slice(middleLetters.length);
8778
- if (!number) {
8779
- return state + "-" + rtoDigits + middleLetters;
8780
- }
8781
- if (middleLetters.length >= 3) {
8782
- const splitAt = middleLetters.length <= 3 ? 1 : 2;
8783
- const series = middleLetters.slice(0, splitAt);
8784
- const subSeries = middleLetters.slice(splitAt);
8785
- return state + "-" + rtoDigits + series + "-" + subSeries + "-" + number.slice(0, 4);
8786
- }
8787
- return state + "-" + rtoDigits + middleLetters + "-" + number.slice(0, 4);
8873
+ const closeModal = () => {
8874
+ setSelectedAction(null);
8875
+ setSelectedOption({});
8876
+ setShowModal(false);
8788
8877
  };
8789
- const onFormValueChange = (setValue, formData) => {
8790
- var _formData$vehicle, _formData$vehicle2;
8791
- if (formData !== null && formData !== void 0 && formData.registrationNumber) {
8792
- let updatedRegNo = formatVehicleNumber(formData.registrationNumber);
8793
- if (updatedRegNo.length > 15) {
8794
- updatedRegNo = updatedRegNo.slice(0, 15);
8795
- }
8796
- if (updatedRegNo !== formData.registrationNumber) {
8797
- setValue("registrationNumber", updatedRegNo);
8878
+ const handleAddVendor = () => {
8879
+ var _vehicleData$2, _dsoDetails$owner;
8880
+ let dsoDetails = selectedOption;
8881
+ let vehicleDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$2 = vehicleData[0]) === null || _vehicleData$2 === void 0 ? void 0 : _vehicleData$2.vehicleData;
8882
+ vehicleDetails.vendorVehicleStatus = "ACTIVE";
8883
+ const formData = {
8884
+ vendor: _extends({}, dsoDetails, {
8885
+ owner: _extends({}, dsoDetails.owner, {
8886
+ gender: ((_dsoDetails$owner = dsoDetails.owner) === null || _dsoDetails$owner === void 0 ? void 0 : _dsoDetails$owner.gender) || "OTHERS"
8887
+ }),
8888
+ vehicles: dsoDetails.vehicles ? [...dsoDetails.vehicles, vehicleDetails] : [vehicleDetails]
8889
+ })
8890
+ };
8891
+ mutateVendor(formData, {
8892
+ onError: (error, variables) => {
8893
+ setShowToast({
8894
+ key: "error",
8895
+ action: error
8896
+ });
8897
+ setTimeout(closeToast, 5000);
8898
+ },
8899
+ onSuccess: (data, variables) => {
8900
+ setShowToast({
8901
+ key: "success",
8902
+ action: "EDIT_VENDOR"
8903
+ });
8904
+ refetch();
8905
+ queryClient.invalidateQueries("DSO_SEARCH");
8906
+ setTimeout(closeToast, 5000);
8798
8907
  }
8799
- }
8800
- 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)) {
8801
- setSubmitValve(true);
8802
- } else {
8803
- setSubmitValve(false);
8804
- }
8805
- };
8806
- const closeToast = () => {
8807
- setShowToast(null);
8908
+ });
8909
+ setShowModal(false);
8910
+ setSelectedAction(null);
8808
8911
  };
8809
- const onSubmit = data => {
8810
- var _data$vehicle, _data$vehicle$type, _data$vehicle2, _data$vehicle2$modal, _data$vehicle3, _data$vehicle3$type, _data$serviceType, _data$selectGender;
8811
- const registrationNumber = data === null || data === void 0 ? void 0 : data.registrationNumber;
8812
- 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;
8813
- 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;
8814
- 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;
8815
- const pollutionCert = new Date("" + (data === null || data === void 0 ? void 0 : data.pollutionCert)).getTime();
8816
- const insurance = new Date("" + (data === null || data === void 0 ? void 0 : data.insurance)).getTime();
8817
- const roadTax = new Date("" + (data === null || data === void 0 ? void 0 : data.roadTax)).getTime();
8818
- const fitnessValidity = new Date("" + (data === null || data === void 0 ? void 0 : data.fitnessValidity)).getTime();
8819
- const ownerName = data === null || data === void 0 ? void 0 : data.ownerName;
8820
- const phone = data === null || data === void 0 ? void 0 : data.phone;
8821
- const additionalDetails = data === null || data === void 0 ? void 0 : (_data$serviceType = data.serviceType) === null || _data$serviceType === void 0 ? void 0 : _data$serviceType.code;
8822
- const gender = data === null || data === void 0 ? void 0 : (_data$selectGender = data.selectGender) === null || _data$selectGender === void 0 ? void 0 : _data$selectGender.code;
8823
- const emailId = data === null || data === void 0 ? void 0 : data.emailId;
8824
- const dob = new Date("" + data.dob).getTime() || new Date("1/1/1970").getTime();
8912
+ const handleEditVendor = () => {
8913
+ var _vehicleData$3, _dsoDetails$owner2;
8914
+ let dsoDetails = selectedOption;
8915
+ let vehicleDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$3 = vehicleData[0]) === null || _vehicleData$3 === void 0 ? void 0 : _vehicleData$3.vehicleData;
8916
+ vehicleDetails.vendorVehicleStatus = "ACTIVE";
8825
8917
  const formData = {
8826
- vehicle: {
8827
- tenantId: "dl.djb",
8828
- registrationNumber: registrationNumber,
8829
- model: vehicleModal,
8830
- type: vehicleType,
8831
- tankCapacity: tankCapacity,
8832
- suctionType: "SEWER_SUCTION_MACHINE",
8833
- pollutionCertiValidTill: pollutionCert,
8834
- InsuranceCertValidTill: insurance,
8835
- fitnessValidTill: fitnessValidity,
8836
- roadTaxPaidTill: roadTax,
8837
- gpsEnabled: true,
8838
- source: "Municipal records",
8839
- owner: {
8840
- tenantId: stateId,
8841
- name: ownerName,
8842
- fatherOrHusbandName: ownerName,
8843
- relationship: "OTHER",
8844
- correspondenceAddress: "",
8845
- mobileNumber: phone,
8846
- gender: gender,
8847
- dob: dob,
8848
- emailId: emailId || "abc@egov.com"
8849
- },
8850
- additionalDetails: {
8851
- serviceType: additionalDetails
8852
- },
8853
- vehicleOwner: "ULB"
8918
+ vendor: _extends({}, dsoDetails, {
8919
+ owner: _extends({}, dsoDetails.owner, {
8920
+ gender: ((_dsoDetails$owner2 = dsoDetails.owner) === null || _dsoDetails$owner2 === void 0 ? void 0 : _dsoDetails$owner2.gender) || "OTHERS"
8921
+ }),
8922
+ vehicles: dsoDetails.vehicles ? [...dsoDetails.vehicles, vehicleDetails] : [vehicleDetails]
8923
+ })
8924
+ };
8925
+ mutateVendor(formData, {
8926
+ onError: (error, variables) => {
8927
+ setShowToast({
8928
+ key: "error",
8929
+ action: error
8930
+ });
8931
+ setTimeout(closeToast, 5000);
8932
+ },
8933
+ onSuccess: (data, variables) => {
8934
+ setShowToast({
8935
+ key: "success",
8936
+ action: "EDIT_VENDOR"
8937
+ });
8938
+ refetch();
8939
+ queryClient.invalidateQueries("DSO_SEARCH");
8940
+ setTimeout(closeToast, 5000);
8941
+ }
8942
+ });
8943
+ setShowModal(false);
8944
+ setSelectedAction(null);
8945
+ };
8946
+ const handleDeleteVendor = () => {
8947
+ var _vehicleData$4, _vehicleData$4$vendor, _vehicleData$4$vendor2, _dsoDetails$owner3;
8948
+ let formData = {};
8949
+ 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];
8950
+ let getVehicleVendorDetails = dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.vehicles;
8951
+ getVehicleVendorDetails = getVehicleVendorDetails.map(data => {
8952
+ if (data.id === vehicleId) {
8953
+ data.vendorVehicleStatus = "INACTIVE";
8954
+ }
8955
+ return data;
8956
+ });
8957
+ formData = {
8958
+ vendor: _extends({}, dsoDetails, {
8959
+ owner: _extends({}, dsoDetails.owner, {
8960
+ gender: ((_dsoDetails$owner3 = dsoDetails.owner) === null || _dsoDetails$owner3 === void 0 ? void 0 : _dsoDetails$owner3.gender) || "OTHERS"
8961
+ }),
8962
+ vehicles: getVehicleVendorDetails
8963
+ })
8964
+ };
8965
+ mutateVendor(formData, {
8966
+ onError: (error, variables) => {
8967
+ setShowToast({
8968
+ key: "error",
8969
+ action: error
8970
+ });
8971
+ setTimeout(closeToast, 5000);
8972
+ },
8973
+ onSuccess: (data, variables) => {
8974
+ setShowToast({
8975
+ key: "success",
8976
+ action: "DELETE_VENDOR"
8977
+ });
8978
+ queryClient.invalidateQueries("FSM_VENDOR_SEARCH");
8979
+ refetch();
8980
+ setTimeout(closeToast, 5000);
8854
8981
  }
8982
+ });
8983
+ setShowModal(false);
8984
+ };
8985
+ const handleModalAction = () => {
8986
+ switch (selectedAction) {
8987
+ case "DELETE":
8988
+ return handleDelete();
8989
+ case "DELETE_VENDOR":
8990
+ return handleDeleteVendor();
8991
+ case "ADD_VENDOR":
8992
+ return handleAddVendor();
8993
+ case "EDIT_VENDOR":
8994
+ return handleEditVendor();
8995
+ }
8996
+ };
8997
+ const handleDelete = () => {
8998
+ var _vehicleData$5;
8999
+ let vehicleDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$5 = vehicleData[0]) === null || _vehicleData$5 === void 0 ? void 0 : _vehicleData$5.vehicleData;
9000
+ const formData = {
9001
+ vehicle: _extends({}, vehicleDetails, {
9002
+ status: "INACTIVE"
9003
+ })
8855
9004
  };
8856
9005
  mutate(formData, {
8857
9006
  onError: (error, variables) => {
8858
- var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
8859
- 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";
8860
9007
  setShowToast({
8861
9008
  key: "error",
8862
- action: errorMessage
9009
+ action: error
8863
9010
  });
8864
9011
  setTimeout(closeToast, 5000);
8865
9012
  },
8866
9013
  onSuccess: (data, variables) => {
8867
- var _data$Errors, _data$data, _data$data$Errors, _vendorData$;
8868
- 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;
8869
- if (isError) {
8870
- var _data$data2, _data$data2$Errors, _data$data2$Errors$, _data$Errors2, _data$Errors2$;
8871
- 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";
8872
- setShowToast({
8873
- key: "error",
8874
- action: errorMessage
8875
- });
8876
- setTimeout(closeToast, 5000);
8877
- return;
8878
- }
8879
9014
  setShowToast({
8880
9015
  key: "success",
8881
- action: "ADD_VEHICLE"
9016
+ action: "DELETE_VEHICLE"
8882
9017
  });
8883
9018
  queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
8884
- if (isCitizen && vendorData !== null && vendorData !== void 0 && (_vendorData$ = vendorData[0]) !== null && _vendorData$ !== void 0 && _vendorData$.dsoDetails) {
8885
- var _data$vehicle4;
8886
- 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, {
8887
- vendorVehicleStatus: "ACTIVE",
8888
- status: "ACTIVE"
8889
- }))) || [];
8890
- const vendor = vendorData[0].dsoDetails;
8891
- const updatedVendor = {
8892
- vendor: _extends({}, vendor, {
8893
- vehicles: vendor.vehicles ? [...vendor.vehicles, ...newVehicle] : [...newVehicle]
8894
- })
8895
- };
8896
- mutateVendor(updatedVendor, {
8897
- onError: error => {
8898
- var _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
8899
- 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";
8900
- setShowToast({
8901
- key: "error",
8902
- action: errorMessage
8903
- });
8904
- setTimeout(closeToast, 5000);
8905
- },
8906
- onSuccess: vendorDataRes => {
8907
- var _vendorDataRes$Errors, _vendorDataRes$data, _vendorDataRes$data$E, _Digit$UserService$ge3, _Digit$UserService$ge4, _Digit$UserService$ge5;
8908
- 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;
8909
- if (isError) {
8910
- var _vendorDataRes$data2, _vendorDataRes$data2$, _vendorDataRes$data2$2, _vendorDataRes$Errors2, _vendorDataRes$Errors3;
8911
- 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";
8912
- setShowToast({
8913
- key: "error",
8914
- action: errorMessage
8915
- });
8916
- setTimeout(closeToast, 5000);
8917
- return;
8918
- }
8919
- setShowToast({
8920
- key: "success",
8921
- action: "ADD_VEHICLE"
8922
- });
8923
- queryClient.invalidateQueries("DSO_SEARCH");
8924
- 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";
8925
- setTimeout(() => {
8926
- closeToast();
8927
- history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=VEHICLE");
8928
- }, 3000);
8929
- }
8930
- });
8931
- } else {
8932
- var _Digit$UserService$ge6, _Digit$UserService$ge7, _Digit$UserService$ge8;
8933
- 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";
8934
- queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
8935
- setTimeout(() => {
8936
- closeToast();
8937
- history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=VEHICLE");
8938
- }, 3000);
8939
- }
9019
+ setTimeout(() => {
9020
+ closeToast();
9021
+ history.push("/digit-ui/employee/fsm/registry");
9022
+ }, 5000);
8940
9023
  }
8941
9024
  });
9025
+ setShowModal(false);
8942
9026
  };
8943
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
8944
- config: [{
8945
- route: "vendor-details",
8946
- timeLine: [{
8947
- actions: t("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE"),
8948
- currentStep: 1
8949
- }]
8950
- }],
8951
- currentActiveIndex: 0,
8952
- showFinalStep: false
8953
- }), /*#__PURE__*/React__default.createElement("div", {
9027
+ const renderModalContent = () => {
9028
+ if (selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR") {
9029
+ return /*#__PURE__*/React__default.createElement(ConfirmationBox, {
9030
+ t: t,
9031
+ title: "ES_FSM_REGISTRY_DELETE_TEXT"
9032
+ });
9033
+ }
9034
+ if (selectedAction === "ADD_VENDOR") {
9035
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardText, null, t("ES_FSM_REGISTRY_SELECT_VENODOR")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
9036
+ t: t,
9037
+ option: vendors,
9038
+ value: selectedOption,
9039
+ selected: selectedOption,
9040
+ select: setSelectedOption,
9041
+ optionKey: "name"
9042
+ }));
9043
+ }
9044
+ if (selectedAction === "EDIT_VENDOR") {
9045
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardText, null, t("ES_FSM_REGISTRY_SELECT_VENODOR")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
9046
+ t: t,
9047
+ option: vendors,
9048
+ value: selectedOption,
9049
+ selected: selectedOption,
9050
+ select: setSelectedOption,
9051
+ optionKey: "name"
9052
+ }));
9053
+ }
9054
+ };
9055
+ const modalHeading = () => {
9056
+ switch (selectedAction) {
9057
+ case "DELETE":
9058
+ case "DELETE_VENDOR":
9059
+ return "ES_FSM_REGISTRY_DELETE_POPUP_HEADER";
9060
+ case "ADD_VENDOR":
9061
+ return "ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER";
9062
+ case "EDIT_VENDOR":
9063
+ return "ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER";
9064
+ }
9065
+ };
9066
+ if (isLoading) {
9067
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
9068
+ }
9069
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !isLoading ? /*#__PURE__*/React__default.createElement("div", {
9070
+ className: "employee-form-content"
9071
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
9072
+ className: "vehicle-details-card",
8954
9073
  style: {
8955
- flex: "1",
8956
- overflowY: "auto"
9074
+ position: "relative"
8957
9075
  }
8958
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormComposer, {
8959
- isDisabled: !canSubmit,
8960
- label: t("ES_COMMON_APPLICATION_SUBMIT"),
8961
- config: Config.filter(i => !i.hideInEmployee).map(config => {
8962
- return _extends({}, config, {
8963
- isCollapsible: true,
8964
- isDefaultOpen: true,
8965
- body: config.body.filter(a => !a.hideInEmployee)
8966
- });
9076
+ }, 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) => {
9077
+ var _detail$values;
9078
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
9079
+ key: index
9080
+ }, index > 0 && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSectionHeader, {
9081
+ style: {
9082
+ marginBottom: "16px",
9083
+ marginTop: "32px"
9084
+ }
9085
+ }, t(detail.title)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
9086
+ className: "card-with-background",
9087
+ style: {
9088
+ margin: "10px 16px",
9089
+ padding: "20px"
9090
+ }
9091
+ }, /*#__PURE__*/React__default.createElement("div", {
9092
+ className: "additional-grid"
9093
+ }, detail === null || detail === void 0 ? void 0 : (_detail$values = detail.values) === null || _detail$values === void 0 ? void 0 : _detail$values.map((value, index) => {
9094
+ return (value === null || value === void 0 ? void 0 : value.type) === "custom" ? /*#__PURE__*/React__default.createElement(React__default.Fragment, {
9095
+ key: index
9096
+ }, /*#__PURE__*/React__default.createElement("div", {
9097
+ className: "additional-label"
9098
+ }, t(value.title)), /*#__PURE__*/React__default.createElement("div", {
9099
+ className: "additional-value",
9100
+ style: {
9101
+ display: "flex",
9102
+ alignItems: "center",
9103
+ gap: "8px"
9104
+ }
9105
+ }, value.value === "ES_FSM_REGISTRY_DETAILS_ADD_VENDOR" && /*#__PURE__*/React__default.createElement("div", {
9106
+ onClick: () => onActionSelect("ADD_VENDOR"),
9107
+ style: {
9108
+ color: "#a82227",
9109
+ display: "flex",
9110
+ alignItems: "center",
9111
+ gap: "8px",
9112
+ cursor: "pointer"
9113
+ }
9114
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.AddIcon, {
9115
+ className: "",
9116
+ fill: "#a82227"
9117
+ }), " ", t(value.value) || "N/A"), value.value !== "ES_FSM_REGISTRY_DETAILS_ADD_VENDOR" && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", null, value.value), /*#__PURE__*/React__default.createElement("div", {
9118
+ className: "add-details-link hover-button",
9119
+ onClick: () => onActionSelect("EDIT_VENDOR"),
9120
+ style: {
9121
+ cursor: "pointer"
9122
+ }
9123
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.EditIcon, {
9124
+ fill: "#a82227"
9125
+ })), /*#__PURE__*/React__default.createElement("div", {
9126
+ className: "add-details-link hover-button",
9127
+ onClick: () => onActionSelect("DELETE_VENDOR"),
9128
+ style: {
9129
+ cursor: "pointer"
9130
+ }
9131
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.DeleteIcon, {
9132
+ className: "delete",
9133
+ fill: "#a82227"
9134
+ }))))) : /*#__PURE__*/React__default.createElement(React__default.Fragment, {
9135
+ key: index
9136
+ }, /*#__PURE__*/React__default.createElement("div", {
9137
+ className: "additional-label"
9138
+ }, t(value.title)), /*#__PURE__*/React__default.createElement("div", {
9139
+ className: "additional-value",
9140
+ style: value.value === "ACTIVE" ? {
9141
+ color: "green"
9142
+ } : {}
9143
+ }, t(value.value) || "N/A"));
9144
+ }))));
9145
+ })), showModal && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
9146
+ headerBarMain: /*#__PURE__*/React__default.createElement(Heading$3, {
9147
+ label: t(modalHeading())
8967
9148
  }),
8968
- fieldStyle: {
8969
- marginRight: 0
8970
- },
8971
- onSubmit: onSubmit,
8972
- defaultValues: defaultValues,
8973
- onFormValueChange: onFormValueChange,
8974
- noBreakLine: true,
8975
- mode: "onChange",
8976
- noCard: true
8977
- }), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
9149
+ headerBarEnd: /*#__PURE__*/React__default.createElement(CloseBtn$2, {
9150
+ onClick: closeModal
9151
+ }),
9152
+ actionCancelLabel: t("CS_COMMON_CANCEL"),
9153
+ actionCancelOnSubmit: closeModal,
9154
+ actionSaveLabel: t(selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? "ES_EVENT_DELETE" : "CS_COMMON_SUBMIT"),
9155
+ actionSaveOnSubmit: handleModalAction
9156
+ }, selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? renderModalContent() : /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
9157
+ style: {
9158
+ boxShadow: "none"
9159
+ }
9160
+ }, renderModalContent())), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
8978
9161
  error: showToast.key === "error" ? true : false,
8979
9162
  label: t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_SUCCESS" : showToast.action),
8980
9163
  onClose: closeToast
8981
- })));
9164
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, {
9165
+ style: {
9166
+ zIndex: "19"
9167
+ }
9168
+ }, displayMenu ? /*#__PURE__*/React__default.createElement(digitUiReactComponents.Menu, {
9169
+ localeKeyPrefix: "ES_FSM_REGISTRY_ACTION",
9170
+ options: ["EDIT", "DELETE"],
9171
+ t: t,
9172
+ onSelect: onActionSelect
9173
+ }) : null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
9174
+ label: t("ES_COMMON_TAKE_ACTION"),
9175
+ onSubmit: () => setDisplayMenu(!displayMenu)
9176
+ }))) : /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null));
8982
9177
  };
8983
9178
 
8984
- const Heading$4 = props => {
8985
- return /*#__PURE__*/React__default.createElement("h1", {
8986
- className: "heading-m"
8987
- }, props.label);
8988
- };
8989
- const CloseBtn$3 = props => {
8990
- return /*#__PURE__*/React__default.createElement("div", {
8991
- onClick: props.onClick
8992
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CloseSvg, null));
8993
- };
8994
- const VehicleDetails = props => {
8995
- var _vehicleData$6, _vehicleData$6$employ;
9179
+ const SelectEkycZones = _ref => {
9180
+ let config = _ref.config,
9181
+ onSelect = _ref.onSelect,
9182
+ t = _ref.t,
9183
+ formData = _ref.formData,
9184
+ _ref$isMultiSelect = _ref.isMultiSelect,
9185
+ isMultiSelect = _ref$isMultiSelect === void 0 ? true : _ref$isMultiSelect;
8996
9186
  const tenantId = Digit.ULBService.getCurrentTenantId();
8997
- const _useTranslation = reactI18next.useTranslation(),
8998
- t = _useTranslation.t;
8999
- const history = reactRouterDom.useHistory();
9000
- const queryClient = reactQuery.useQueryClient();
9001
- let _useParams = reactRouterDom.useParams(),
9002
- vehicleNumber = _useParams.id;
9003
- const _useState = React.useState(false),
9004
- displayMenu = _useState[0],
9005
- setDisplayMenu = _useState[1];
9006
- const _useState2 = React.useState(null),
9007
- selectedAction = _useState2[0],
9008
- setSelectedAction = _useState2[1];
9009
- const _useState3 = React.useState(false),
9010
- showModal = _useState3[0],
9011
- setShowModal = _useState3[1];
9012
- const _useState4 = React.useState(null),
9013
- showToast = _useState4[0],
9014
- setShowToast = _useState4[1];
9015
- const _useState5 = React.useState([]),
9016
- vendors = _useState5[0],
9017
- setVendors = _useState5[1];
9018
- const _useState6 = React.useState({}),
9019
- selectedOption = _useState6[0],
9020
- setSelectedOption = _useState6[1];
9021
- const _useState7 = React.useState(null),
9022
- vehicleId = _useState7[0],
9023
- setVehicleId = _useState7[1];
9024
- const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVehicleDetails(tenantId, {
9025
- registrationNumber: vehicleNumber
9026
- }, {
9027
- staleTime: Infinity
9028
- }),
9029
- vehicleData = _Digit$Hooks$fsm$useV.data,
9030
- isLoading = _Digit$Hooks$fsm$useV.isLoading,
9031
- refetch = _Digit$Hooks$fsm$useV.refetch;
9187
+ const _useState = React.useState([]),
9188
+ zones = _useState[0],
9189
+ setZones = _useState[1];
9190
+ const _useState2 = React.useState([]),
9191
+ selectedZones = _useState2[0],
9192
+ setSelectedZones = _useState2[1];
9193
+ const initialized = React.useRef(false);
9194
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
9195
+ boundaryData = _Digit$Hooks$useCommo.data,
9196
+ isLoading = _Digit$Hooks$useCommo.isLoading;
9032
9197
  React.useEffect(() => {
9033
- if (!isLoading && vehicleData) {
9034
- var _vehicleData$, _vehicleData$$vehicle;
9035
- 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);
9198
+ var _boundaryData$egovLo, _boundaryData$egovLo$, _boundaryData$MdmsRes, _boundaryData$MdmsRes2, _boundaryData$MdmsRes3;
9199
+ 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]);
9200
+ const boundaries = (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.boundary) || (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.children) || [];
9201
+ if (Array.isArray(boundaries === null || boundaries === void 0 ? void 0 : boundaries.children)) {
9202
+ const allZones = boundaries.children.flatMap(assembly => (assembly.children || []).map(zone => ({
9203
+ code: zone.code,
9204
+ name: zone.name
9205
+ })));
9206
+ const zonesList = [...new Map(allZones.map(z => [z.code, z])).values()];
9207
+ setZones(zonesList);
9036
9208
  }
9037
- }, [vehicleData, isLoading]);
9038
- const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
9039
- sortBy: "name",
9040
- sortOrder: "ASC",
9041
- status: "ACTIVE"
9042
- }, {}),
9043
- vendorData = _Digit$Hooks$fsm$useD.data;
9209
+ }, [boundaryData]);
9044
9210
  React.useEffect(() => {
9045
- if (vendorData) {
9046
- let vendors = vendorData.map(data => data.dsoDetails);
9047
- setVendors(vendors);
9211
+ if (!zones.length || !Array.isArray(formData === null || formData === void 0 ? void 0 : formData.zoneIds)) return;
9212
+ if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object") {
9213
+ setSelectedZones(formData.zoneIds);
9214
+ return;
9048
9215
  }
9049
- }, [vendorData]);
9050
- const _Digit$Hooks$fsm$useU = Digit.Hooks.fsm.useUpdateVehicle(tenantId),
9051
- mutate = _Digit$Hooks$fsm$useU.mutate;
9052
- const _Digit$Hooks$fsm$useV2 = Digit.Hooks.fsm.useVendorUpdate(tenantId),
9053
- mutateVendor = _Digit$Hooks$fsm$useV2.mutate;
9054
- function onActionSelect(action) {
9055
- setDisplayMenu(false);
9056
- setSelectedAction(action);
9057
- }
9058
- React.useEffect(() => {
9059
- refetch();
9060
- }, []);
9061
- React.useEffect(() => {
9062
- switch (selectedAction) {
9063
- case "DELETE":
9064
- case "ADD_VENDOR":
9065
- case "EDIT_VENDOR":
9066
- case "DELETE_VENDOR":
9067
- return setShowModal(true);
9068
- case "EDIT":
9069
- return history.push("/digit-ui/employee/fsm/registry/modify-vehicle/" + vehicleNumber);
9070
- case "HOME":
9071
- return history.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE");
9216
+ const selected = zones.filter(zone => formData.zoneIds.includes(zone.name));
9217
+ setSelectedZones(selected);
9218
+ if (!initialized.current) {
9219
+ initialized.current = true;
9220
+ onSelect(config.key, selected);
9221
+ }
9222
+ }, [zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, config.key, onSelect]);
9223
+ const handleSelect = value => {
9224
+ if (isMultiSelect) {
9225
+ const selected = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : [];
9226
+ setSelectedZones(selected);
9227
+ onSelect(config.key, selected);
9228
+ } else {
9229
+ const selectedZone = Array.isArray(value) ? Array.isArray(value[0]) ? value[0][1] : value[0] : value;
9230
+ setSelectedZones(selectedZone ? [selectedZone] : []);
9231
+ onSelect(config.key, (selectedZone === null || selectedZone === void 0 ? void 0 : selectedZone.code) || "");
9072
9232
  }
9073
- }, [selectedAction]);
9074
- const closeToast = () => {
9075
- setShowToast(null);
9076
- };
9077
- const closeModal = () => {
9078
- setSelectedAction(null);
9079
- setSelectedOption({});
9080
- setShowModal(false);
9081
- };
9082
- const handleAddVendor = () => {
9083
- var _vehicleData$2, _dsoDetails$owner;
9084
- let dsoDetails = selectedOption;
9085
- let vehicleDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$2 = vehicleData[0]) === null || _vehicleData$2 === void 0 ? void 0 : _vehicleData$2.vehicleData;
9086
- vehicleDetails.vendorVehicleStatus = "ACTIVE";
9087
- const formData = {
9088
- vendor: _extends({}, dsoDetails, {
9089
- owner: _extends({}, dsoDetails.owner, {
9090
- gender: ((_dsoDetails$owner = dsoDetails.owner) === null || _dsoDetails$owner === void 0 ? void 0 : _dsoDetails$owner.gender) || "OTHERS"
9091
- }),
9092
- vehicles: dsoDetails.vehicles ? [...dsoDetails.vehicles, vehicleDetails] : [vehicleDetails]
9093
- })
9094
- };
9095
- mutateVendor(formData, {
9096
- onError: (error, variables) => {
9097
- setShowToast({
9098
- key: "error",
9099
- action: error
9100
- });
9101
- setTimeout(closeToast, 5000);
9102
- },
9103
- onSuccess: (data, variables) => {
9104
- setShowToast({
9105
- key: "success",
9106
- action: "EDIT_VENDOR"
9107
- });
9108
- refetch();
9109
- queryClient.invalidateQueries("DSO_SEARCH");
9110
- setTimeout(closeToast, 5000);
9111
- }
9112
- });
9113
- setShowModal(false);
9114
- setSelectedAction(null);
9115
9233
  };
9116
- const handleEditVendor = () => {
9117
- var _vehicleData$3, _dsoDetails$owner2;
9118
- let dsoDetails = selectedOption;
9119
- let vehicleDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$3 = vehicleData[0]) === null || _vehicleData$3 === void 0 ? void 0 : _vehicleData$3.vehicleData;
9120
- vehicleDetails.vendorVehicleStatus = "ACTIVE";
9121
- const formData = {
9122
- vendor: _extends({}, dsoDetails, {
9123
- owner: _extends({}, dsoDetails.owner, {
9124
- gender: ((_dsoDetails$owner2 = dsoDetails.owner) === null || _dsoDetails$owner2 === void 0 ? void 0 : _dsoDetails$owner2.gender) || "OTHERS"
9125
- }),
9126
- vehicles: dsoDetails.vehicles ? [...dsoDetails.vehicles, vehicleDetails] : [vehicleDetails]
9127
- })
9128
- };
9129
- mutateVendor(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: "EDIT_VENDOR"
9234
+ if (isLoading) return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
9235
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t(config.label), config.isMandatory ? " *" : ""), /*#__PURE__*/React__default.createElement("div", {
9236
+ className: "field",
9237
+ style: {
9238
+ position: "relative",
9239
+ zIndex: 10
9240
+ }
9241
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.MultiSelectDropdown, {
9242
+ options: zones,
9243
+ selected: selectedZones,
9244
+ onSelect: handleSelect,
9245
+ optionsKey: "name",
9246
+ t: t,
9247
+ multiple: isMultiSelect,
9248
+ isMultiSelect: isMultiSelect,
9249
+ showSelectedLabels: !isMultiSelect,
9250
+ ServerStyle: {
9251
+ backgroundColor: "#fff"
9252
+ },
9253
+ defaultLabel: isMultiSelect ? selectedZones.length + " Selected" : ""
9254
+ })), isMultiSelect && selectedZones.length > 0 && /*#__PURE__*/React__default.createElement("div", {
9255
+ className: "selected-zones"
9256
+ }, selectedZones.map(zone => /*#__PURE__*/React__default.createElement("span", {
9257
+ key: zone.code,
9258
+ className: "selected-zone-chip"
9259
+ }, zone.name))));
9260
+ };
9261
+
9262
+ const SelectEkycClusters = _ref => {
9263
+ let config = _ref.config,
9264
+ onSelect = _ref.onSelect,
9265
+ t = _ref.t,
9266
+ formData = _ref.formData;
9267
+ const tenantId = Digit.ULBService.getCurrentTenantId();
9268
+ const _useState = React.useState([]),
9269
+ clusters = _useState[0],
9270
+ setClusters = _useState[1];
9271
+ const _useState2 = React.useState(Array.isArray(formData === null || formData === void 0 ? void 0 : formData.clusterIds) ? formData.clusterIds : []),
9272
+ selectedClusters = _useState2[0],
9273
+ setSelectedClusters = _useState2[1];
9274
+ const selectedZones = React__default.useMemo(() => Array.isArray(formData === null || formData === void 0 ? void 0 : formData.zoneIds) ? formData.zoneIds : [], [formData === null || formData === void 0 ? void 0 : formData.zoneIds]);
9275
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
9276
+ boundaryData = _Digit$Hooks$useCommo.data;
9277
+ React.useEffect(() => {
9278
+ var _boundaryData$egovLo, _boundaryData$egovLo$, _boundaryData$MdmsRes, _boundaryData$MdmsRes2, _boundaryData$MdmsRes3;
9279
+ 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]);
9280
+ const boundaries = (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.boundary) || (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.children) || [];
9281
+ let allClusters = [];
9282
+ if (selectedZones.length > 0 && Array.isArray(boundaries) && boundaries.length > 0) {
9283
+ selectedZones.forEach(zone => {
9284
+ const zoneBoundary = boundaries.find(b => b.code === ((zone === null || zone === void 0 ? void 0 : zone.code) || zone));
9285
+ const children = (zoneBoundary === null || zoneBoundary === void 0 ? void 0 : zoneBoundary.children) || (zoneBoundary === null || zoneBoundary === void 0 ? void 0 : zoneBoundary.boundary) || [];
9286
+ if (Array.isArray(children)) {
9287
+ children.forEach(child => {
9288
+ allClusters.push({
9289
+ code: child.code,
9290
+ name: child.name
9291
+ });
9292
+ });
9293
+ }
9294
+ });
9295
+ }
9296
+ if (allClusters.length === 0) {
9297
+ const staticClusters = {
9298
+ "ZONE-01": [{
9299
+ code: "CLUSTER-01",
9300
+ name: "CLUSTER-01"
9301
+ }],
9302
+ "ZONE-02": [{
9303
+ code: "CLUSTER-02",
9304
+ name: "CLUSTER-02"
9305
+ }],
9306
+ "ZONE-03": [{
9307
+ code: "CLUSTER-03",
9308
+ name: "CLUSTER-03"
9309
+ }],
9310
+ "ZONE-04": [{
9311
+ code: "CLUSTER-04",
9312
+ name: "CLUSTER-04"
9313
+ }],
9314
+ "ZONE-05": [{
9315
+ code: "CLUSTER-05",
9316
+ name: "CLUSTER-05"
9317
+ }]
9318
+ };
9319
+ if (selectedZones.length > 0) {
9320
+ selectedZones.forEach(z => {
9321
+ const zCode = (z === null || z === void 0 ? void 0 : z.code) || z;
9322
+ const zName = (z === null || z === void 0 ? void 0 : z.name) || z;
9323
+ if (staticClusters[zCode]) {
9324
+ allClusters = [...allClusters, ...staticClusters[zCode]];
9325
+ } else {
9326
+ allClusters.push({
9327
+ code: zCode + "-C1",
9328
+ name: zName + " Cluster 1"
9329
+ });
9330
+ }
9141
9331
  });
9142
- refetch();
9143
- queryClient.invalidateQueries("DSO_SEARCH");
9144
- setTimeout(closeToast, 5000);
9332
+ } else {
9333
+ allClusters = [{
9334
+ code: "CLUSTER-01",
9335
+ name: "CLUSTER-01"
9336
+ }, {
9337
+ code: "CLUSTER-02",
9338
+ name: "CLUSTER-02"
9339
+ }, {
9340
+ code: "CLUSTER-03",
9341
+ name: "CLUSTER-03"
9342
+ }];
9145
9343
  }
9146
- });
9147
- setShowModal(false);
9148
- setSelectedAction(null);
9344
+ }
9345
+ if (allClusters.length > 0) {
9346
+ allClusters = Array.from(new Map(allClusters.map(item => [item.code, item])).values());
9347
+ }
9348
+ setClusters(allClusters);
9349
+ }, [selectedZones, boundaryData]);
9350
+ const handleSelect = value => {
9351
+ const extractedValue = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : value;
9352
+ setSelectedClusters(extractedValue);
9353
+ onSelect(config.key, extractedValue);
9149
9354
  };
9150
- const handleDeleteVendor = () => {
9151
- var _vehicleData$4, _vehicleData$4$vendor, _vehicleData$4$vendor2, _dsoDetails$owner3;
9152
- let formData = {};
9153
- 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];
9154
- let getVehicleVendorDetails = dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.vehicles;
9155
- getVehicleVendorDetails = getVehicleVendorDetails.map(data => {
9156
- if (data.id === vehicleId) {
9157
- data.vendorVehicleStatus = "INACTIVE";
9355
+ const isDisabled = selectedZones.length === 0;
9356
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t(config.label) + (config.isMandatory ? " *" : "")), /*#__PURE__*/React__default.createElement("div", {
9357
+ className: "field",
9358
+ style: {
9359
+ position: "relative",
9360
+ zIndex: 9
9361
+ }
9362
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.MultiSelectDropdown, {
9363
+ options: clusters,
9364
+ selected: selectedClusters,
9365
+ onSelect: handleSelect,
9366
+ optionsKey: "name",
9367
+ t: t,
9368
+ ServerStyle: {
9369
+ backgroundColor: "#fff"
9370
+ },
9371
+ disable: isDisabled
9372
+ })));
9373
+ };
9374
+
9375
+ const SelectEkycDropdown = _ref => {
9376
+ var _config$populators, _config$populators2;
9377
+ let config = _ref.config,
9378
+ onSelect = _ref.onSelect,
9379
+ t = _ref.t,
9380
+ formData = _ref.formData;
9381
+ const options = (config === null || config === void 0 ? void 0 : (_config$populators = config.populators) === null || _config$populators === void 0 ? void 0 : _config$populators.options) || [];
9382
+ const optionsKey = (config === null || config === void 0 ? void 0 : (_config$populators2 = config.populators) === null || _config$populators2 === void 0 ? void 0 : _config$populators2.optionsKey) || "name";
9383
+ const selected = formData === null || formData === void 0 ? void 0 : formData[config.key];
9384
+ const handleSelect = value => {
9385
+ onSelect(config.key, value);
9386
+ };
9387
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t(config.label)), /*#__PURE__*/React__default.createElement("div", {
9388
+ className: "field"
9389
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
9390
+ selected: selected,
9391
+ option: options,
9392
+ select: handleSelect,
9393
+ optionKey: optionsKey,
9394
+ t: t
9395
+ })));
9396
+ };
9397
+
9398
+ const AdditionalDetails = _ref => {
9399
+ var _formData$ownerKey, _formData$ownerKey2, _formData$ownerKey3, _formData$ownerKey4;
9400
+ let t = _ref.t,
9401
+ config = _ref.config,
9402
+ onSelect = _ref.onSelect,
9403
+ userType = _ref.userType,
9404
+ formData = _ref.formData;
9405
+ let index = 0;
9406
+ const user = Digit.UserService.getUser().info;
9407
+ 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) || "";
9408
+ 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) || "";
9409
+ 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);
9410
+ 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) || "";
9411
+ const _useState = React.useState(""),
9412
+ VendorCategory = _useState[0],
9413
+ setVendorCategory = _useState[1];
9414
+ const _useState2 = React.useState(""),
9415
+ VendorId = _useState2[0],
9416
+ setVendorId = _useState2[1];
9417
+ const _useState3 = React.useState(""),
9418
+ userName = _useState3[0],
9419
+ setUserName = _useState3[1];
9420
+ const _useState4 = React.useState(""),
9421
+ Bank = _useState4[0],
9422
+ setBank = _useState4[1];
9423
+ const _useState5 = React.useState(),
9424
+ BankbranchName = _useState5[0],
9425
+ setBankbranchName = _useState5[1];
9426
+ const _useState6 = React.useState(""),
9427
+ IFSC = _useState6[0],
9428
+ setIFSC = _useState6[1];
9429
+ const _useState7 = React.useState(""),
9430
+ AccountNo = _useState7[0],
9431
+ setAccountNo = _useState7[1];
9432
+ const _useState8 = React.useState(""),
9433
+ PanNo = _useState8[0],
9434
+ setPanNo = _useState8[1];
9435
+ const _useState9 = React.useState(""),
9436
+ GstNo = _useState9[0],
9437
+ setGstNo = _useState9[1];
9438
+ const _useState0 = React.useState(""),
9439
+ GstState = _useState0[0],
9440
+ setGstState = _useState0[1];
9441
+ const _useState1 = React.useState(""),
9442
+ RegistrationNo = _useState1[0],
9443
+ setRegistrationNo = _useState1[1];
9444
+ const _useState10 = React.useState(""),
9445
+ EpfNo = _useState10[0],
9446
+ setEpfNo = _useState10[1];
9447
+ const _useState11 = React.useState(""),
9448
+ EsiNo = _useState11[0],
9449
+ setEsiNo = _useState11[1];
9450
+ const _useState12 = React.useState(""),
9451
+ VendorType = _useState12[0],
9452
+ setVendorType = _useState12[1];
9453
+ const _useState13 = React.useState(""),
9454
+ Status = _useState13[0],
9455
+ setStatus = _useState13[1];
9456
+ const _useState14 = React.useState(""),
9457
+ micrNo = _useState14[0],
9458
+ setmicrNo = _useState14[1];
9459
+ const _useState15 = React.useState(""),
9460
+ PhoneNo = _useState15[0],
9461
+ setPhoneNo = _useState15[1];
9462
+ const _useState16 = React.useState(""),
9463
+ ContactPerson = _useState16[0],
9464
+ setContactPerson = _useState16[1];
9465
+ React.useEffect(() => {
9466
+ if (IFSC.length === 11 && !Bank && !BankbranchName && !micrNo) {
9467
+ fetch("https://ifsc.razorpay.com/" + IFSC).then(response => response.json()).then(data => {
9468
+ if (data && data.BANK && data.BRANCH && data.MICR) {
9469
+ setBank(data.BANK);
9470
+ setBankbranchName(data.BRANCH);
9471
+ setmicrNo(data.MICR);
9472
+ }
9473
+ }).catch(() => {});
9474
+ } else {
9475
+ if (IFSC.length === 11 && Bank && BankbranchName) {
9476
+ setBank(Bank);
9477
+ setBankbranchName(BankbranchName);
9478
+ setmicrNo(micrNo);
9479
+ } else {
9480
+ setBank("");
9481
+ setBankbranchName("");
9482
+ setmicrNo("");
9158
9483
  }
9159
- return data;
9160
- });
9161
- formData = {
9162
- vendor: _extends({}, dsoDetails, {
9163
- owner: _extends({}, dsoDetails.owner, {
9164
- gender: ((_dsoDetails$owner3 = dsoDetails.owner) === null || _dsoDetails$owner3 === void 0 ? void 0 : _dsoDetails$owner3.gender) || "OTHERS"
9165
- }),
9166
- vehicles: getVehicleVendorDetails
9167
- })
9168
- };
9169
- mutateVendor(formData, {
9170
- onError: (error, variables) => {
9171
- setShowToast({
9172
- key: "error",
9173
- action: error
9174
- });
9175
- setTimeout(closeToast, 5000);
9176
- },
9177
- onSuccess: (data, variables) => {
9178
- setShowToast({
9179
- key: "success",
9180
- action: "DELETE_VENDOR"
9181
- });
9182
- queryClient.invalidateQueries("FSM_VENDOR_SEARCH");
9183
- refetch();
9184
- setTimeout(closeToast, 5000);
9484
+ }
9485
+ }, [IFSC]);
9486
+ function setvendorbank(e) {
9487
+ setBank(e.target.value);
9488
+ }
9489
+ function setBankbranch(e) {
9490
+ setBankbranchName(e.target.value);
9491
+ }
9492
+ function setvendorifsc(e) {
9493
+ const input = e.target.value.replace(/[^a-zA-Z0-9]/g, "");
9494
+ if (input.length <= 11) {
9495
+ setIFSC(input);
9496
+ }
9497
+ }
9498
+ function setvendoraccountno(e) {
9499
+ setAccountNo(e.target.value);
9500
+ }
9501
+ function setpanno(e) {
9502
+ setPanNo(e.target.value);
9503
+ }
9504
+ function setgstno(e) {
9505
+ setGstNo(e.target.value);
9506
+ }
9507
+ function setgststate(e) {
9508
+ setGstState(e.target.value);
9509
+ }
9510
+ function setregistrationno(e) {
9511
+ setRegistrationNo(e.target.value);
9512
+ }
9513
+ function setepfno(e) {
9514
+ setEpfNo(e.target.value);
9515
+ }
9516
+ function setesino(e) {
9517
+ setEsiNo(e.target.value);
9518
+ }
9519
+ function setcontactperson(e) {
9520
+ setContactPerson(e.target.value);
9521
+ }
9522
+ const tenantId = Digit.ULBService.getCurrentTenantId();
9523
+ const _useForm = reactHookForm.useForm(),
9524
+ control = _useForm.control;
9525
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
9526
+ staleTime: Infinity
9527
+ }),
9528
+ dsoData = _Digit$Hooks$fsm$useD.data;
9529
+ React.useEffect(() => {
9530
+ if (dsoData) {
9531
+ const vendor = dsoData.find(item => item.id);
9532
+ if (vendor) {
9533
+ setUserName(vendor.name);
9534
+ setVendorId(vendor.id);
9185
9535
  }
9186
- });
9187
- setShowModal(false);
9188
- };
9189
- const handleModalAction = () => {
9190
- switch (selectedAction) {
9191
- case "DELETE":
9192
- return handleDelete();
9193
- case "DELETE_VENDOR":
9194
- return handleDeleteVendor();
9195
- case "ADD_VENDOR":
9196
- return handleAddVendor();
9197
- case "EDIT_VENDOR":
9198
- return handleEditVendor();
9199
9536
  }
9200
- };
9201
- const handleDelete = () => {
9202
- var _vehicleData$5;
9203
- let vehicleDetails = vehicleData === null || vehicleData === void 0 ? void 0 : (_vehicleData$5 = vehicleData[0]) === null || _vehicleData$5 === void 0 ? void 0 : _vehicleData$5.vehicleData;
9204
- const formData = {
9205
- vehicle: _extends({}, vehicleDetails, {
9206
- status: "INACTIVE"
9207
- })
9208
- };
9209
- mutate(formData, {
9210
- onError: (error, variables) => {
9211
- setShowToast({
9212
- key: "error",
9213
- action: error
9214
- });
9215
- setTimeout(closeToast, 5000);
9216
- },
9217
- onSuccess: (data, variables) => {
9218
- setShowToast({
9219
- key: "success",
9220
- action: "DELETE_VEHICLE"
9221
- });
9222
- queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
9223
- setTimeout(() => {
9224
- closeToast();
9225
- history.push("/digit-ui/employee/fsm/registry");
9226
- }, 5000);
9227
- }
9228
- });
9229
- setShowModal(false);
9230
- };
9231
- const renderModalContent = () => {
9232
- if (selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR") {
9233
- return /*#__PURE__*/React__default.createElement(ConfirmationBox, {
9234
- t: t,
9235
- title: "ES_FSM_REGISTRY_DELETE_TEXT"
9537
+ }, [dsoData]);
9538
+ const goNext = () => {
9539
+ let owner = formData.ownerKey && formData.ownerKey[index];
9540
+ let ownerStep;
9541
+ if (userType === "citizen") {
9542
+ ownerStep = _extends({}, owner, {
9543
+ applicantName,
9544
+ mobileNumber,
9545
+ altMobileNumber,
9546
+ emailId
9547
+ });
9548
+ onSelect(config.key, _extends({}, formData[config.key], ownerStep), false, index);
9549
+ } else {
9550
+ ownerStep = _extends({}, owner, {
9551
+ VendorCategory,
9552
+ name: userName,
9553
+ VendorId: VendorId,
9554
+ Bank,
9555
+ BankbranchName,
9556
+ IFSC,
9557
+ AccountNo,
9558
+ PanNo,
9559
+ GstNo,
9560
+ GstState,
9561
+ RegistrationNo,
9562
+ EpfNo,
9563
+ EsiNo,
9564
+ VendorType,
9565
+ Status,
9566
+ micrNo,
9567
+ PhoneNo,
9568
+ ContactPerson
9236
9569
  });
9570
+ onSelect(config.key, ownerStep, false, index);
9237
9571
  }
9238
- if (selectedAction === "ADD_VENDOR") {
9239
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardText, null, t("ES_FSM_REGISTRY_SELECT_VENODOR")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
9240
- t: t,
9241
- option: vendors,
9242
- value: selectedOption,
9243
- selected: selectedOption,
9244
- select: setSelectedOption,
9245
- optionKey: "name"
9246
- }));
9572
+ };
9573
+ React.useEffect(() => {
9574
+ if (userType === "citizen") {
9575
+ goNext();
9247
9576
  }
9248
- if (selectedAction === "EDIT_VENDOR") {
9249
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardText, null, t("ES_FSM_REGISTRY_SELECT_VENODOR")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
9250
- t: t,
9251
- option: vendors,
9252
- value: selectedOption,
9253
- selected: selectedOption,
9254
- select: setSelectedOption,
9255
- optionKey: "name"
9256
- }));
9577
+ }, [VendorCategory, VendorId, userName, Bank, BankbranchName, IFSC, AccountNo, PanNo, GstNo, GstState, RegistrationNo, EpfNo, EsiNo, VendorType, Status, micrNo, PhoneNo, ContactPerson, userType]);
9578
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
9579
+ config: [{
9580
+ timeLine: [{
9581
+ actions: t("VENDOR_ADDITIONAL_DETAILS"),
9582
+ currentStep: 1
9583
+ }]
9584
+ }, {
9585
+ timeLine: [{
9586
+ actions: t("VENDOR_DOCUMENT_DETAILS"),
9587
+ currentStep: 2
9588
+ }]
9589
+ }, {
9590
+ timeLine: [{
9591
+ actions: t("VENDOR_SUMMARY"),
9592
+ currentStep: 3
9593
+ }]
9594
+ }],
9595
+ currentActiveIndex: 0,
9596
+ showFinalStep: false
9597
+ }), /*#__PURE__*/React__default.createElement("div", {
9598
+ style: {
9599
+ flex: "1",
9600
+ overflowY: "auto"
9257
9601
  }
9258
- };
9259
- const modalHeading = () => {
9260
- switch (selectedAction) {
9261
- case "DELETE":
9262
- case "DELETE_VENDOR":
9263
- return "ES_FSM_REGISTRY_DELETE_POPUP_HEADER";
9264
- case "ADD_VENDOR":
9265
- return "ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER";
9266
- case "EDIT_VENDOR":
9267
- return "ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER";
9602
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormStep, {
9603
+ config: config,
9604
+ onSelect: goNext,
9605
+ t: t,
9606
+ className: "formcomposer-grid-container-form"
9607
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
9608
+ className: "card-label-smaller"
9609
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CustomTooltip, {
9610
+ label: "" + t("IFSC_CODE"),
9611
+ isMandatory: false,
9612
+ message: t("INVALID_IFSC_CODE_ERROR_MESSAGE")
9613
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9614
+ t: t,
9615
+ type: "text",
9616
+ isMandatory: false,
9617
+ optionKey: "i18nKey",
9618
+ name: "IFSC",
9619
+ value: IFSC,
9620
+ placeholder: "Enter IFSC Code",
9621
+ onChange: setvendorifsc,
9622
+ style: {
9623
+ width: "100%"
9624
+ },
9625
+ maxLength: 11,
9626
+ ValidationRequired: true,
9627
+ validation: {
9628
+ isRequired: true,
9629
+ pattern: "^[A-Z]{4}0[A-Z0-9]{6}$",
9630
+ type: "text",
9631
+ title: t("INVALID_IFSC_CODE_ERROR_MESSAGE")
9632
+ }
9633
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("VENDOR_BANK_NAME"), " ", /*#__PURE__*/React__default.createElement("span", {
9634
+ className: "check-page-link-button"
9635
+ }, "*")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9636
+ t: t,
9637
+ type: "text",
9638
+ isMandatory: false,
9639
+ optionKey: "i18nKey",
9640
+ name: "bankName",
9641
+ placeholder: "Bank Name Auto Select",
9642
+ style: {
9643
+ width: "100%"
9644
+ },
9645
+ value: Bank,
9646
+ onChange: setvendorbank,
9647
+ disabled: true
9648
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("VENDOR_BANK_BRANCH_NAME"), " ", /*#__PURE__*/React__default.createElement("span", {
9649
+ className: "check-page-link-button"
9650
+ }, "*")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9651
+ t: t,
9652
+ type: "text",
9653
+ isMandatory: false,
9654
+ optionKey: "i18nKey",
9655
+ name: "BankbranchName",
9656
+ value: BankbranchName,
9657
+ style: {
9658
+ width: "100%"
9659
+ },
9660
+ placeholder: "Bank Branch Name Auto Select",
9661
+ onChange: setBankbranch,
9662
+ disabled: false
9663
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("VENDOR_MICR_NO"), " ", /*#__PURE__*/React__default.createElement("span", {
9664
+ className: "check-page-link-button"
9665
+ }, "*")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9666
+ t: t,
9667
+ type: "text",
9668
+ isMandatory: false,
9669
+ optionKey: "i18nKey",
9670
+ name: "MicrNo",
9671
+ value: micrNo,
9672
+ style: {
9673
+ width: "100%"
9674
+ },
9675
+ placeholder: "MICR No",
9676
+ onChange: setmicrNo,
9677
+ disabled: false
9678
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("ACCOUNT_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9679
+ t: t,
9680
+ type: "text",
9681
+ isMandatory: false,
9682
+ optionKey: "i18nKey",
9683
+ name: "AccountNo",
9684
+ value: AccountNo,
9685
+ onChange: setvendoraccountno,
9686
+ style: {
9687
+ width: "100%"
9688
+ },
9689
+ ValidationRequired: true,
9690
+ validation: {
9691
+ isRequired: true,
9692
+ pattern: "[0-9]{9,18}",
9693
+ type: "text",
9694
+ title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE")
9695
+ }
9696
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("PHONE_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.MobileNumber, {
9697
+ value: PhoneNo,
9698
+ name: "PhoneNo",
9699
+ onChange: setPhoneNo,
9700
+ style: {
9701
+ width: "100%"
9702
+ }
9703
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("CONTACT_PERSON")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9704
+ t: t,
9705
+ type: "text",
9706
+ isMandatory: false,
9707
+ optionKey: "i18nKey",
9708
+ name: "ContactPerson",
9709
+ value: ContactPerson,
9710
+ onChange: setcontactperson,
9711
+ style: {
9712
+ width: "100%"
9713
+ },
9714
+ ValidationRequired: true,
9715
+ validation: {
9716
+ isRequired: true,
9717
+ pattern: "^[a-zA-Z0-9/-]{1,20}$",
9718
+ type: "text",
9719
+ title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE")
9268
9720
  }
9269
- };
9270
- if (isLoading) {
9271
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
9272
- }
9273
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !isLoading ? /*#__PURE__*/React__default.createElement("div", {
9274
- className: "employee-form-content"
9275
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
9276
- className: "vehicle-details-card",
9721
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("PAN_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9722
+ t: t,
9723
+ type: "text",
9724
+ isMandatory: false,
9725
+ optionKey: "i18nKey",
9726
+ name: "PanNo",
9727
+ value: PanNo,
9728
+ onChange: setpanno,
9277
9729
  style: {
9278
- position: "relative"
9730
+ width: "100%"
9731
+ },
9732
+ ValidationRequired: true,
9733
+ validation: {
9734
+ isRequired: true,
9735
+ pattern: "[A-Z]{5}[0-9]{4}[A-Z]{1}",
9736
+ type: "text",
9737
+ title: t("INVALID_PAN_NO_ERROR_MESSAGE")
9279
9738
  }
9280
- }, 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) => {
9281
- var _detail$values;
9282
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
9283
- key: index
9284
- }, index > 0 && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSectionHeader, {
9285
- style: {
9286
- marginBottom: "16px",
9287
- marginTop: "32px"
9288
- }
9289
- }, t(detail.title)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
9290
- className: "card-with-background",
9291
- style: {
9292
- margin: "10px 16px",
9293
- padding: "20px"
9294
- }
9295
- }, /*#__PURE__*/React__default.createElement("div", {
9296
- className: "additional-grid"
9297
- }, detail === null || detail === void 0 ? void 0 : (_detail$values = detail.values) === null || _detail$values === void 0 ? void 0 : _detail$values.map((value, index) => {
9298
- return (value === null || value === void 0 ? void 0 : value.type) === "custom" ? /*#__PURE__*/React__default.createElement(React__default.Fragment, {
9299
- key: index
9300
- }, /*#__PURE__*/React__default.createElement("div", {
9301
- className: "additional-label"
9302
- }, t(value.title)), /*#__PURE__*/React__default.createElement("div", {
9303
- className: "additional-value",
9304
- style: {
9305
- display: "flex",
9306
- alignItems: "center",
9307
- gap: "8px"
9308
- }
9309
- }, value.value === "ES_FSM_REGISTRY_DETAILS_ADD_VENDOR" && /*#__PURE__*/React__default.createElement("div", {
9310
- onClick: () => onActionSelect("ADD_VENDOR"),
9311
- style: {
9312
- color: "#a82227",
9313
- display: "flex",
9314
- alignItems: "center",
9315
- gap: "8px",
9316
- cursor: "pointer"
9317
- }
9318
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.AddIcon, {
9319
- className: "",
9320
- fill: "#a82227"
9321
- }), " ", t(value.value) || "N/A"), value.value !== "ES_FSM_REGISTRY_DETAILS_ADD_VENDOR" && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", null, value.value), /*#__PURE__*/React__default.createElement("div", {
9322
- className: "add-details-link hover-button",
9323
- onClick: () => onActionSelect("EDIT_VENDOR"),
9324
- style: {
9325
- cursor: "pointer"
9326
- }
9327
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.EditIcon, {
9328
- fill: "#a82227"
9329
- })), /*#__PURE__*/React__default.createElement("div", {
9330
- className: "add-details-link hover-button",
9331
- onClick: () => onActionSelect("DELETE_VENDOR"),
9332
- style: {
9333
- cursor: "pointer"
9334
- }
9335
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.DeleteIcon, {
9336
- className: "delete",
9337
- fill: "#a82227"
9338
- }))))) : /*#__PURE__*/React__default.createElement(React__default.Fragment, {
9339
- key: index
9340
- }, /*#__PURE__*/React__default.createElement("div", {
9341
- className: "additional-label"
9342
- }, t(value.title)), /*#__PURE__*/React__default.createElement("div", {
9343
- className: "additional-value",
9344
- style: value.value === "ACTIVE" ? {
9345
- color: "green"
9346
- } : {}
9347
- }, t(value.value) || "N/A"));
9348
- }))));
9349
- })), showModal && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
9350
- headerBarMain: /*#__PURE__*/React__default.createElement(Heading$4, {
9351
- label: t(modalHeading())
9352
- }),
9353
- headerBarEnd: /*#__PURE__*/React__default.createElement(CloseBtn$3, {
9354
- onClick: closeModal
9355
- }),
9356
- actionCancelLabel: t("CS_COMMON_CANCEL"),
9357
- actionCancelOnSubmit: closeModal,
9358
- actionSaveLabel: t(selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? "ES_EVENT_DELETE" : "CS_COMMON_SUBMIT"),
9359
- actionSaveOnSubmit: handleModalAction
9360
- }, selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? renderModalContent() : /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
9739
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("GST_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9740
+ t: t,
9741
+ type: "text",
9742
+ isMandatory: false,
9743
+ optionKey: "i18nKey",
9744
+ name: "GstNo",
9745
+ value: GstNo,
9746
+ onChange: setgstno,
9361
9747
  style: {
9362
- boxShadow: "none"
9748
+ width: "100%"
9749
+ },
9750
+ ValidationRequired: true,
9751
+ validation: {
9752
+ isRequired: true,
9753
+ pattern: "^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[A-Z0-9]{1}[Z]{1}[A-Z0-9]{1}$",
9754
+ type: "text",
9755
+ title: t("INVALID_GST_NO_ERROR_MESSAGE")
9363
9756
  }
9364
- }, renderModalContent())), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
9365
- error: showToast.key === "error" ? true : false,
9366
- label: t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_SUCCESS" : showToast.action),
9367
- onClose: closeToast
9368
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, {
9757
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("GST_REGISTERED_STATE/UT")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9758
+ t: t,
9759
+ type: "text",
9760
+ isMandatory: false,
9761
+ optionKey: "i18nKey",
9762
+ name: "GstState",
9763
+ value: GstState,
9764
+ onChange: setgststate,
9369
9765
  style: {
9370
- zIndex: "19"
9766
+ width: "100%"
9767
+ },
9768
+ ValidationRequired: true,
9769
+ validation: {
9770
+ isRequired: true,
9771
+ pattern: "^[a-zA-Z0-9/-]{1,20}$",
9772
+ type: "text",
9773
+ title: t("PT_NAME_ERROR_MESSAGE")
9371
9774
  }
9372
- }, displayMenu ? /*#__PURE__*/React__default.createElement(digitUiReactComponents.Menu, {
9373
- localeKeyPrefix: "ES_FSM_REGISTRY_ACTION",
9374
- options: ["EDIT", "DELETE"],
9775
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("REGISTRATION_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9375
9776
  t: t,
9376
- onSelect: onActionSelect
9377
- }) : null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
9378
- label: t("ES_COMMON_TAKE_ACTION"),
9379
- onSubmit: () => setDisplayMenu(!displayMenu)
9380
- }))) : /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null));
9381
- };
9382
-
9383
- const SelectEkycZones = _ref => {
9384
- var _formData$zoneIds;
9385
- let config = _ref.config,
9386
- onSelect = _ref.onSelect,
9387
- t = _ref.t,
9388
- formData = _ref.formData,
9389
- _ref$isMultiSelect = _ref.isMultiSelect,
9390
- isMultiSelect = _ref$isMultiSelect === void 0 ? true : _ref$isMultiSelect;
9391
- const tenantId = Digit.ULBService.getCurrentTenantId();
9392
- const _useState = React.useState([]),
9393
- zones = _useState[0],
9394
- setZones = _useState[1];
9395
- const _useState2 = React.useState([]),
9396
- selectedZones = _useState2[0],
9397
- setSelectedZones = _useState2[1];
9398
- const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
9399
- boundaryData = _Digit$Hooks$useCommo.data,
9400
- isLoading = _Digit$Hooks$useCommo.isLoading;
9401
- React.useEffect(() => {
9402
- if (!zones.length) return;
9403
- if (isMultiSelect) {
9404
- setSelectedZones(Array.isArray(formData === null || formData === void 0 ? void 0 : formData.zoneIds) ? zones.filter(ele => formData.zoneIds.includes(ele.code)) : []);
9405
- } else {
9406
- const selected = zones.find(ele => {
9407
- return ele.code === (formData === null || formData === void 0 ? void 0 : formData.zoneIds) || ele.name === (formData === null || formData === void 0 ? void 0 : formData.zoneIds);
9408
- });
9409
- setSelectedZones(selected ? [selected] : []);
9777
+ type: "text",
9778
+ isMandatory: false,
9779
+ optionKey: "i18nKey",
9780
+ name: "RegistrationNo",
9781
+ value: RegistrationNo,
9782
+ onChange: setregistrationno,
9783
+ style: {
9784
+ width: "100%"
9785
+ },
9786
+ ValidationRequired: true,
9787
+ validation: {
9788
+ isRequired: true,
9789
+ pattern: "^[a-zA-Z0-9/-]{1,20}$",
9790
+ type: "text",
9791
+ title: t("INVALID_REGISTRATION_NO_ERROR_MESSAGE")
9410
9792
  }
9411
- }, [zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, isMultiSelect]);
9412
- React.useEffect(() => {
9413
- var _boundaryData$egovLo, _boundaryData$egovLo$, _boundaryData$MdmsRes, _boundaryData$MdmsRes2, _boundaryData$MdmsRes3;
9414
- 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]);
9415
- const boundaries = (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.boundary) || (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.children) || [];
9416
- if (Array.isArray(boundaries === null || boundaries === void 0 ? void 0 : boundaries.children) && (boundaries === null || boundaries === void 0 ? void 0 : boundaries.children.length) > 0) {
9417
- const allZones = boundaries.children.flatMap(assembly => ((assembly === null || assembly === void 0 ? void 0 : assembly.children) || []).map(zone => ({
9418
- code: zone.code,
9419
- name: zone.name
9420
- })));
9421
- const zonesList = [...new Map(allZones.map(zone => [zone.code, zone])).values()];
9422
- setZones(zonesList);
9793
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("EPF_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9794
+ t: t,
9795
+ type: "text",
9796
+ isMandatory: false,
9797
+ optionKey: "i18nKey",
9798
+ name: "EpfNo",
9799
+ value: EpfNo,
9800
+ onChange: setepfno,
9801
+ style: {
9802
+ width: "100%"
9803
+ },
9804
+ ValidationRequired: true,
9805
+ validation: {
9806
+ isRequired: true,
9807
+ pattern: "^[a-zA-Z0-9/-]{1,15}$",
9808
+ type: "text",
9809
+ title: t("INVALID_EPF_NO_ERROR_MESSAGE")
9423
9810
  }
9424
- }, [boundaryData]);
9425
- const handleSelect = value => {
9426
- if (isMultiSelect) {
9427
- const extractedValue = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : [];
9428
- onSelect(config.key, extractedValue);
9429
- } else {
9430
- const selectedZone = Array.isArray(value) ? Array.isArray(value[0]) ? value[0][1] : value[0] : value;
9431
- setSelectedZones(selectedZone ? [selectedZone] : []);
9432
- onSelect(config.key, (selectedZone === null || selectedZone === void 0 ? void 0 : selectedZone.name) || "");
9811
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("ESI_NO")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9812
+ t: t,
9813
+ type: "text",
9814
+ isMandatory: false,
9815
+ optionKey: "i18nKey",
9816
+ name: "EsiNo",
9817
+ value: EsiNo,
9818
+ onChange: setesino,
9819
+ style: {
9820
+ width: "100%"
9821
+ },
9822
+ ValidationRequired: true,
9823
+ validation: {
9824
+ isRequired: true,
9825
+ pattern: "^[a-zA-Z0-9/-]{1,20}$",
9826
+ type: "text",
9827
+ title: t("INVALID_ESI_NO_ERROR_MESSAGE")
9828
+ }
9829
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement("div", null, t("VENDOR_TYPE"), /*#__PURE__*/React__default.createElement("div", {
9830
+ className: "tooltip",
9831
+ style: {
9832
+ width: "12px",
9833
+ height: "5px",
9834
+ marginLeft: "10px",
9835
+ display: "inline-flex",
9836
+ alignItems: "center"
9433
9837
  }
9434
- };
9435
- if (isLoading) return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
9436
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t(config.label) + (config.isMandatory ? " *" : "")), /*#__PURE__*/React__default.createElement("div", {
9437
- className: "field",
9838
+ }, /*#__PURE__*/React__default.createElement("span", {
9839
+ className: "tooltiptext",
9438
9840
  style: {
9439
- position: "relative",
9440
- zIndex: 10
9841
+ whiteSpace: "pre-wrap",
9842
+ fontSize: "small",
9843
+ wordWrap: "break-word",
9844
+ width: "300px",
9845
+ marginLeft: "15px",
9846
+ marginBottom: "-10px"
9441
9847
  }
9442
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.MultiSelectDropdown, {
9443
- options: zones,
9444
- selected: selectedZones,
9445
- onSelect: handleSelect,
9446
- optionsKey: "name",
9447
- t: t,
9448
- multiple: isMultiSelect,
9449
- ServerStyle: {
9450
- backgroundColor: "#fff"
9848
+ }, "" + t("AST_CLASSIFICATION_ASSET")))), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
9849
+ control: control,
9850
+ name: "VendorType",
9851
+ defaultValue: VendorType,
9852
+ rules: {
9853
+ required: t("CORE_COMMON_REQUIRED_ERRMSG")
9451
9854
  },
9452
- isMultiSelect: isMultiSelect,
9453
- showSelectedLabels: !isMultiSelect,
9454
- 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" : ""
9455
- })), isMultiSelect && Array.isArray(formData === null || formData === void 0 ? void 0 : formData.zoneIds) && formData.zoneIds.length > 0 && /*#__PURE__*/React__default.createElement("div", {
9456
- className: "selected-zones"
9457
- }, formData.zoneIds.map(zone => /*#__PURE__*/React__default.createElement("span", {
9458
- key: zone.code,
9459
- className: "selected-zone-chip"
9460
- }, zone.name))));
9461
- };
9462
-
9463
- const SelectEkycClusters = _ref => {
9464
- let config = _ref.config,
9465
- onSelect = _ref.onSelect,
9466
- t = _ref.t,
9467
- formData = _ref.formData;
9468
- const tenantId = Digit.ULBService.getCurrentTenantId();
9469
- const _useState = React.useState([]),
9470
- clusters = _useState[0],
9471
- setClusters = _useState[1];
9472
- const _useState2 = React.useState(Array.isArray(formData === null || formData === void 0 ? void 0 : formData.clusterIds) ? formData.clusterIds : []),
9473
- selectedClusters = _useState2[0],
9474
- setSelectedClusters = _useState2[1];
9475
- const selectedZones = React__default.useMemo(() => Array.isArray(formData === null || formData === void 0 ? void 0 : formData.zoneIds) ? formData.zoneIds : [], [formData === null || formData === void 0 ? void 0 : formData.zoneIds]);
9476
- const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
9477
- boundaryData = _Digit$Hooks$useCommo.data;
9478
- React.useEffect(() => {
9479
- var _boundaryData$egovLo, _boundaryData$egovLo$, _boundaryData$MdmsRes, _boundaryData$MdmsRes2, _boundaryData$MdmsRes3;
9480
- 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]);
9481
- const boundaries = (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.boundary) || (tenantBoundary === null || tenantBoundary === void 0 ? void 0 : tenantBoundary.children) || [];
9482
- let allClusters = [];
9483
- if (selectedZones.length > 0 && Array.isArray(boundaries) && boundaries.length > 0) {
9484
- selectedZones.forEach(zone => {
9485
- const zoneBoundary = boundaries.find(b => b.code === ((zone === null || zone === void 0 ? void 0 : zone.code) || zone));
9486
- const children = (zoneBoundary === null || zoneBoundary === void 0 ? void 0 : zoneBoundary.children) || (zoneBoundary === null || zoneBoundary === void 0 ? void 0 : zoneBoundary.boundary) || [];
9487
- if (Array.isArray(children)) {
9488
- children.forEach(child => {
9489
- allClusters.push({
9490
- code: child.code,
9491
- name: child.name
9492
- });
9493
- });
9494
- }
9495
- });
9855
+ render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
9856
+ selected: VendorType,
9857
+ select: setVendorType,
9858
+ option: [{
9859
+ i18nKey: "Supplier",
9860
+ code: "SUPPLIER"
9861
+ }, {
9862
+ i18nKey: "Contractor",
9863
+ code: "CONTRACTOR"
9864
+ }],
9865
+ optionKey: "i18nKey",
9866
+ placeholder: "Select",
9867
+ t: t
9868
+ })
9869
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement("div", null, t("VENOR_CATEGORY"), /*#__PURE__*/React__default.createElement("div", {
9870
+ className: "tooltip",
9871
+ style: {
9872
+ width: "12px",
9873
+ height: "5px",
9874
+ marginLeft: "10px",
9875
+ display: "inline-flex",
9876
+ alignItems: "center"
9496
9877
  }
9497
- if (allClusters.length === 0) {
9498
- const staticClusters = {
9499
- "ZONE-01": [{
9500
- code: "CLUSTER-01",
9501
- name: "CLUSTER-01"
9502
- }],
9503
- "ZONE-02": [{
9504
- code: "CLUSTER-02",
9505
- name: "CLUSTER-02"
9506
- }],
9507
- "ZONE-03": [{
9508
- code: "CLUSTER-03",
9509
- name: "CLUSTER-03"
9510
- }],
9511
- "ZONE-04": [{
9512
- code: "CLUSTER-04",
9513
- name: "CLUSTER-04"
9514
- }],
9515
- "ZONE-05": [{
9516
- code: "CLUSTER-05",
9517
- name: "CLUSTER-05"
9518
- }]
9519
- };
9520
- if (selectedZones.length > 0) {
9521
- selectedZones.forEach(z => {
9522
- const zCode = (z === null || z === void 0 ? void 0 : z.code) || z;
9523
- const zName = (z === null || z === void 0 ? void 0 : z.name) || z;
9524
- if (staticClusters[zCode]) {
9525
- allClusters = [...allClusters, ...staticClusters[zCode]];
9526
- } else {
9527
- allClusters.push({
9528
- code: zCode + "-C1",
9529
- name: zName + " Cluster 1"
9530
- });
9531
- }
9532
- });
9533
- } else {
9534
- allClusters = [{
9535
- code: "CLUSTER-01",
9536
- name: "CLUSTER-01"
9537
- }, {
9538
- code: "CLUSTER-02",
9539
- name: "CLUSTER-02"
9540
- }, {
9541
- code: "CLUSTER-03",
9542
- name: "CLUSTER-03"
9543
- }];
9544
- }
9878
+ }, /*#__PURE__*/React__default.createElement("span", {
9879
+ className: "tooltiptext",
9880
+ style: {
9881
+ whiteSpace: "pre-wrap",
9882
+ fontSize: "small",
9883
+ wordWrap: "break-word",
9884
+ width: "300px",
9885
+ marginLeft: "15px",
9886
+ marginBottom: "-10px"
9545
9887
  }
9546
- if (allClusters.length > 0) {
9547
- allClusters = Array.from(new Map(allClusters.map(item => [item.code, item])).values());
9888
+ }))), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
9889
+ control: control,
9890
+ name: "VendorCategory",
9891
+ defaultValue: VendorCategory,
9892
+ rules: {
9893
+ required: t("CORE_COMMON_REQUIRED_ERRMSG")
9894
+ },
9895
+ render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
9896
+ selected: VendorCategory,
9897
+ select: setVendorCategory,
9898
+ option: [{
9899
+ i18nKey: "Firm",
9900
+ code: "FIRM"
9901
+ }, {
9902
+ i18nKey: "Individual",
9903
+ code: "Individual"
9904
+ }],
9905
+ optionKey: "i18nKey",
9906
+ placeholder: "Select",
9907
+ t: t
9908
+ })
9909
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement("div", null, t("STATUS"), /*#__PURE__*/React__default.createElement("div", {
9910
+ className: "tooltip",
9911
+ style: {
9912
+ width: "12px",
9913
+ height: "5px",
9914
+ marginLeft: "10px",
9915
+ display: "inline-flex",
9916
+ alignItems: "center"
9548
9917
  }
9549
- setClusters(allClusters);
9550
- }, [selectedZones, boundaryData]);
9551
- const handleSelect = value => {
9552
- const extractedValue = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : value;
9553
- setSelectedClusters(extractedValue);
9554
- onSelect(config.key, extractedValue);
9555
- };
9556
- const isDisabled = selectedZones.length === 0;
9557
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t(config.label) + (config.isMandatory ? " *" : "")), /*#__PURE__*/React__default.createElement("div", {
9558
- className: "field",
9918
+ }, /*#__PURE__*/React__default.createElement("span", {
9919
+ className: "tooltiptext",
9559
9920
  style: {
9560
- position: "relative",
9561
- zIndex: 9
9921
+ whiteSpace: "pre-wrap",
9922
+ fontSize: "small",
9923
+ wordWrap: "break-word",
9924
+ width: "300px",
9925
+ marginLeft: "15px",
9926
+ marginBottom: "-10px"
9562
9927
  }
9563
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.MultiSelectDropdown, {
9564
- options: clusters,
9565
- selected: selectedClusters,
9566
- onSelect: handleSelect,
9567
- optionsKey: "name",
9568
- t: t,
9569
- ServerStyle: {
9570
- backgroundColor: "#fff"
9928
+ }, "" + t("AST_CLASSIFICATION_ASSET")))), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
9929
+ control: control,
9930
+ name: "Status",
9931
+ defaultValue: Status,
9932
+ rules: {
9933
+ required: t("CORE_COMMON_REQUIRED_ERRMSG")
9571
9934
  },
9572
- disable: isDisabled
9573
- })));
9574
- };
9575
-
9576
- const SelectEkycDropdown = _ref => {
9577
- var _config$populators, _config$populators2;
9578
- let config = _ref.config,
9579
- onSelect = _ref.onSelect,
9580
- t = _ref.t,
9581
- formData = _ref.formData;
9582
- const options = (config === null || config === void 0 ? void 0 : (_config$populators = config.populators) === null || _config$populators === void 0 ? void 0 : _config$populators.options) || [];
9583
- const optionsKey = (config === null || config === void 0 ? void 0 : (_config$populators2 = config.populators) === null || _config$populators2 === void 0 ? void 0 : _config$populators2.optionsKey) || "name";
9584
- const selected = formData === null || formData === void 0 ? void 0 : formData[config.key];
9585
- const handleSelect = value => {
9586
- onSelect(config.key, value);
9587
- };
9588
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t(config.label)), /*#__PURE__*/React__default.createElement("div", {
9589
- className: "field"
9590
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
9591
- selected: selected,
9592
- option: options,
9593
- select: handleSelect,
9594
- optionKey: optionsKey,
9595
- t: t
9596
- })));
9935
+ render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
9936
+ selected: Status,
9937
+ select: setStatus,
9938
+ option: [{
9939
+ i18nKey: "Active",
9940
+ code: "ACTIVE"
9941
+ }, {
9942
+ i18nKey: "Inactive",
9943
+ code: "INACTIVE"
9944
+ }],
9945
+ optionKey: "i18nKey",
9946
+ placeholder: "Select",
9947
+ t: t
9948
+ })
9949
+ })))));
9597
9950
  };
9598
9951
 
9599
9952
  const componentsToRegister = {
9600
- VendorDetails,
9601
9953
  VendorDocuments,
9602
9954
  ServiceDoc,
9603
9955
  VendorSelectAddress,
@@ -9613,7 +9965,10 @@ const componentsToRegister = {
9613
9965
  SupervisorAreaAssignment,
9614
9966
  SelectEkycZones,
9615
9967
  SelectEkycClusters,
9616
- SelectEkycDropdown
9968
+ SelectEkycDropdown,
9969
+ VendorDetails,
9970
+ EditVendor,
9971
+ AdditionalDetails
9617
9972
  };
9618
9973
  const addComponentsToRegistry = () => {
9619
9974
  Object.entries(componentsToRegister).forEach(_ref => {