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