@djb25/digit-ui-module-fsm 1.0.21 → 1.0.23

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,4 +1,4 @@
1
- import { AddNewIcon, ShippingTruck, EmployeeModuleCard, TickMark, FormStep as FormStep$1, RadioOrSelect, LabelFieldPair, CardLabel as CardLabel$1, Dropdown, TextInput as TextInput$1, RadioButtons, Loader, LocationSearchCard, TextArea as TextArea$1, CardLabelError as CardLabelError$1, CitizenInfoLabel, CardText as CardText$1, WrapUnMaskComponent, PitDimension, ImageUploadHandler, KeyNote, BackButton, PrivateRoute, LayoutWrapper, TelePhone, CardSectionHeader, CheckPoint, ConnectingCheckPoints, LinkButton as LinkButton$1, ActionLinks, Rating, SubmitBar as SubmitBar$1, Header, Card as Card$1, CardHeader as CardHeader$1, CardSubHeader, StatusTable, Row, Banner, RatingCard, ULBHomeCard, ViewReportIcon, InboxIcon, Table, CheckBox, CloseSvg, Localities, RemoveableTag, ActionBar, ApplyFilterBar, Label, LinkLabel, DatePicker as DatePicker$2, DetailsCard, SearchAction, FilterAction, PopUp, BreadCrumb, ModuleHeader, ArrowLeft, HomeIcon, Modal, FormComposer, UploadPitPhoto, ImageViewer, BreakLine, Toast, Menu, MultiUploadWrapper, AddIcon, ToggleSwitch, InfoIcon, EditIcon, DeleteIcon, VerticalTimeline, CustomTooltip, MobileNumber, CitizenHomeCard, CitizenTruck } from '@djb25/digit-ui-react-components';
1
+ import { AddNewIcon, ShippingTruck, EmployeeModuleCard, TickMark, FormStep as FormStep$1, RadioOrSelect, LabelFieldPair, CardLabel as CardLabel$1, Dropdown, TextInput as TextInput$1, RadioButtons, Loader, LocationSearchCard, TextArea as TextArea$1, CardLabelError as CardLabelError$1, CitizenInfoLabel, CardText as CardText$1, WrapUnMaskComponent, PitDimension, ImageUploadHandler, KeyNote, BackButton, PrivateRoute, LayoutWrapper, TelePhone, CardSectionHeader, CheckPoint, ConnectingCheckPoints, LinkButton as LinkButton$1, ActionLinks, Rating, SubmitBar as SubmitBar$1, Header, Card, CardHeader as CardHeader$1, CardSubHeader, StatusTable, Row, Banner, RatingCard, ULBHomeCard, ViewReportIcon, InboxIcon, Table, CheckBox, CloseSvg, Localities, RemoveableTag, ActionBar, ApplyFilterBar, Label, LinkLabel, DatePicker as DatePicker$2, DetailsCard, SearchAction, FilterAction, PopUp, BreadCrumb, ModuleHeader, ArrowLeft, HomeIcon, Modal, FormComposer, UploadPitPhoto, ImageViewer, BreakLine, Toast, Menu, MultiUploadWrapper, AddIcon, ToggleSwitch, InfoIcon, EditIcon, DeleteIcon, VerticalTimeline, CitizenHomeCard, CitizenTruck } from '@djb25/digit-ui-react-components';
2
2
  import React, { useState, useEffect, Fragment as Fragment$1, forwardRef, useCallback, useMemo, useRef } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useLocation, useParams, Switch, Redirect, Link, useHistory, useRouteMatch, Route } from 'react-router-dom';
@@ -561,6 +561,28 @@ const SelectGender = _ref => {
561
561
  if (isLoading) {
562
562
  return /*#__PURE__*/React.createElement(Loader, null);
563
563
  }
564
+ const isRegistry = window.location.pathname.includes("/registry/");
565
+ if (isRegistry) {
566
+ const selectedValue = (GenderData === null || GenderData === void 0 ? void 0 : GenderData.find(option => {
567
+ var _formData$config$key;
568
+ return option.code === ((formData === null || formData === void 0 ? void 0 : (_formData$config$key = formData[config.key]) === null || _formData$config$key === void 0 ? void 0 : _formData$config$key.code) || (formData === null || formData === void 0 ? void 0 : formData[config.key]) || (genderType === null || genderType === void 0 ? void 0 : genderType.code) || genderType);
569
+ })) || null;
570
+ return /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, t(config.label), config.isMandatory ? /*#__PURE__*/React.createElement("span", {
571
+ className: "check-page-link-button"
572
+ }, " * ") : ""), /*#__PURE__*/React.createElement(Dropdown, {
573
+ className: "payment-form-text-input-correction",
574
+ isMandatory: config.isMandatory,
575
+ selected: selectedValue,
576
+ option: GenderData === null || GenderData === void 0 ? void 0 : GenderData.sort((a, b) => a.code.localeCompare(b.code)),
577
+ select: value => {
578
+ setGenderType(value);
579
+ onSelect(config.key, value);
580
+ },
581
+ optionKey: "i18nKey",
582
+ disable: config.disable,
583
+ t: t
584
+ }));
585
+ }
564
586
  if (userType === "employee") {
565
587
  return /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, t(config.label)), /*#__PURE__*/React.createElement(Dropdown, {
566
588
  className: "payment-form-text-input-correction",
@@ -2205,13 +2227,15 @@ const InputCard = _ref => {
2205
2227
  isMultipleAllow = _ref$isMultipleAllow === void 0 ? false : _ref$isMultipleAllow,
2206
2228
  _ref$cardStyle = _ref.cardStyle,
2207
2229
  cardStyle = _ref$cardStyle === void 0 ? {} : _ref$cardStyle,
2208
- className = _ref.className;
2230
+ className = _ref.className,
2231
+ _ref$noGrid = _ref.noGrid,
2232
+ noGrid = _ref$noGrid === void 0 ? false : _ref$noGrid;
2209
2233
  const isMobile = window.Digit.Utils.browser.isMobile();
2210
2234
  return /*#__PURE__*/React.createElement("div", {
2211
2235
  className: className || "",
2212
2236
  style: cardStyle
2213
2237
  }, texts.headerCaption && /*#__PURE__*/React.createElement(CardCaption, null, t(texts.headerCaption)), (texts === null || texts === void 0 ? void 0 : texts.header) && /*#__PURE__*/React.createElement(CardHeader, null, t(texts.header)), (texts === null || texts === void 0 ? void 0 : texts.cardText) && /*#__PURE__*/React.createElement(CardText, null, t(texts.cardText)), /*#__PURE__*/React.createElement("div", {
2214
- className: "formcomposer-section-grid"
2238
+ className: noGrid ? "" : "formcomposer-section-grid"
2215
2239
  }, children), texts.submitBarLabel ? /*#__PURE__*/React.createElement("div", {
2216
2240
  className: "formcomposer-section-button"
2217
2241
  }, /*#__PURE__*/React.createElement(SubmitBar, {
@@ -2325,24 +2349,6 @@ const CollapsibleCardPage = _ref => {
2325
2349
  }, children(activeTab)) : children)));
2326
2350
  };
2327
2351
 
2328
- const _excluded = ["onClick", "style", "children", "className", "ReactRef"];
2329
- const Card = _ref => {
2330
- let onClick = _ref.onClick,
2331
- style = _ref.style,
2332
- children = _ref.children,
2333
- className = _ref.className,
2334
- ReactRef = _ref.ReactRef,
2335
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
2336
- return /*#__PURE__*/React.createElement("div", _extends({
2337
- key: props.key,
2338
- className: "employeeCard " + (className ? className : ""),
2339
- onClick: onClick,
2340
- style: style
2341
- }, props, {
2342
- ref: ReactRef
2343
- }), children);
2344
- };
2345
-
2346
2352
  const FormStep = _ref => {
2347
2353
  var _config$inputs, _config$texts;
2348
2354
  let t = _ref.t,
@@ -2372,8 +2378,7 @@ const FormStep = _ref => {
2372
2378
  isCollapsible = _ref$isCollapsible === void 0 ? true : _ref$isCollapsible,
2373
2379
  _ref$defaultOpen = _ref.defaultOpen,
2374
2380
  defaultOpen = _ref$defaultOpen === void 0 ? true : _ref$defaultOpen,
2375
- formClassName = _ref.formClassName,
2376
- cardClassName = _ref.cardClassName;
2381
+ formClassName = _ref.formClassName;
2377
2382
  const _useForm = useForm({
2378
2383
  defaultValues: _defaultValues
2379
2384
  }),
@@ -2456,8 +2461,6 @@ const FormStep = _ref => {
2456
2461
  flex: "1"
2457
2462
  },
2458
2463
  onSubmit: handleSubmit(goNext)
2459
- }, /*#__PURE__*/React.createElement(Card, {
2460
- className: "form-composer-card " + (cardClassName ? cardClassName : "")
2461
2464
  }, _isCollapsible ? /*#__PURE__*/React.createElement(CollapsibleCardPage, {
2462
2465
  title: t(config === null || config === void 0 ? void 0 : (_config$texts = config.texts) === null || _config$texts === void 0 ? void 0 : _config$texts.header),
2463
2466
  defaultOpen: _defaultOpen
@@ -2473,7 +2476,8 @@ const FormStep = _ref => {
2473
2476
  onSkip: onSkip,
2474
2477
  onAdd: onAdd,
2475
2478
  t: t,
2476
- className: className || ""
2479
+ className: className || "",
2480
+ noGrid: config.noGrid || false
2477
2481
  }), !childrenAtTheBottom && children, inputs, forcedError && !showErrorBelowChildren && /*#__PURE__*/React.createElement(CardLabelError, null, t(forcedError)), childrenAtTheBottom && children, forcedError && showErrorBelowChildren && /*#__PURE__*/React.createElement(CardLabelError, null, t(forcedError)))) : /*#__PURE__*/React.createElement(InputCard, _extends({
2478
2482
  isDisable: isDisable,
2479
2483
  isMultipleAllow: isMultipleAllow
@@ -2484,7 +2488,7 @@ const FormStep = _ref => {
2484
2488
  onAdd: onAdd,
2485
2489
  t: t,
2486
2490
  className: className || ""
2487
- }), !childrenAtTheBottom && children, inputs, forcedError && !showErrorBelowChildren && /*#__PURE__*/React.createElement(CardLabelError, null, t(forcedError)), childrenAtTheBottom && children, forcedError && showErrorBelowChildren && /*#__PURE__*/React.createElement(CardLabelError, null, t(forcedError)))));
2491
+ }), !childrenAtTheBottom && children, inputs, forcedError && !showErrorBelowChildren && /*#__PURE__*/React.createElement(CardLabelError, null, t(forcedError)), childrenAtTheBottom && children, forcedError && showErrorBelowChildren && /*#__PURE__*/React.createElement(CardLabelError, null, t(forcedError))));
2488
2492
  };
2489
2493
  FormStep.propTypes = {
2490
2494
  config: propTypes.shape({}),
@@ -9737,7 +9741,6 @@ const CitizenApp = _ref => {
9737
9741
  const DsoDashboard = Digit.ComponentRegistryService.getComponent("FSMDsoDashboard");
9738
9742
  const Inbox = Digit.ComponentRegistryService.getComponent("FSMEmpInbox");
9739
9743
  const EditVendor = Digit.ComponentRegistryService.getComponent("EditVendor");
9740
- console.log(path + "/registry/modify-vendor/:id");
9741
9744
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
9742
9745
  className: "fsm-citizen-wrapper"
9743
9746
  }, location.pathname.includes("/response") || location.pathname.split("/").includes("check") ? null : location.pathname.includes("/street") ? /*#__PURE__*/React.createElement(BackButton, {
@@ -10031,7 +10034,7 @@ const ApplicationDetails = () => {
10031
10034
  color: "#A52A2A"
10032
10035
  },
10033
10036
  onClick: handleViewTimeline
10034
- }))), /*#__PURE__*/React.createElement(Card$1, {
10037
+ }))), /*#__PURE__*/React.createElement(Card, {
10035
10038
  style: {
10036
10039
  position: "relative"
10037
10040
  }
@@ -10059,7 +10062,7 @@ const MyApplication = _ref => {
10059
10062
  let application = _ref.application;
10060
10063
  const _useTranslation = useTranslation(),
10061
10064
  t = _useTranslation.t;
10062
- return /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement(KeyNote, {
10065
+ return /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(KeyNote, {
10063
10066
  keyValue: t("CS_FSM_APPLICATION_APPLICATION_NO"),
10064
10067
  note: application.applicationNo
10065
10068
  }), /*#__PURE__*/React.createElement(KeyNote, {
@@ -10103,7 +10106,7 @@ const MyApplications = () => {
10103
10106
  key: index
10104
10107
  }, /*#__PURE__*/React.createElement(MyApplication, {
10105
10108
  application: application
10106
- }))), applicationsList.length === 0 && /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement("p", {
10109
+ }))), applicationsList.length === 0 && /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("p", {
10107
10110
  style: {
10108
10111
  textAlign: "center"
10109
10112
  }
@@ -10165,7 +10168,7 @@ const CheckPage = _ref2 => {
10165
10168
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Timeline, {
10166
10169
  currentStep: 4,
10167
10170
  flow: "APPLY"
10168
- }), /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement(CardHeader$1, null, t("CS_CHECK_CHECK_YOUR_ANSWERS")), /*#__PURE__*/React.createElement(CardText$1, null, t("CS_CHECK_CHECK_YOUR_ANSWERS_TEXT")), /*#__PURE__*/React.createElement(CardSubHeader, null, t("CS_CHECK_PROPERTY_DETAILS")), /*#__PURE__*/React.createElement(StatusTable, null, selectTripNo && (selectTripNo === null || selectTripNo === void 0 ? void 0 : selectTripNo.tripNo) && /*#__PURE__*/React.createElement(Row, {
10171
+ }), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(CardHeader$1, null, t("CS_CHECK_CHECK_YOUR_ANSWERS")), /*#__PURE__*/React.createElement(CardText$1, null, t("CS_CHECK_CHECK_YOUR_ANSWERS_TEXT")), /*#__PURE__*/React.createElement(CardSubHeader, null, t("CS_CHECK_PROPERTY_DETAILS")), /*#__PURE__*/React.createElement(StatusTable, null, selectTripNo && (selectTripNo === null || selectTripNo === void 0 ? void 0 : selectTripNo.tripNo) && /*#__PURE__*/React.createElement(Row, {
10169
10172
  label: t("ES_FSM_ACTION_NUMBER_OF_TRIPS"),
10170
10173
  text: t(selectTripNo === null || selectTripNo === void 0 ? void 0 : (_selectTripNo$tripNo = selectTripNo.tripNo) === null || _selectTripNo$tripNo === void 0 ? void 0 : _selectTripNo$tripNo.i18nKey),
10171
10174
  actionButton: /*#__PURE__*/React.createElement(ActionButton, {
@@ -10586,7 +10589,7 @@ const Response = _ref => {
10586
10589
  Digit.Utils.pdf.generate(data);
10587
10590
  };
10588
10591
  const isSuccess = !successData ? mutation === null || mutation === void 0 ? void 0 : mutation.isSuccess : true;
10589
- return mutation.isLoading || mutation.isIdle && !mutationHappened ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement(BannerPicker, {
10592
+ return mutation.isLoading || mutation.isIdle && !mutationHappened ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(BannerPicker, {
10590
10593
  t: t,
10591
10594
  data: Data,
10592
10595
  isSuccess: isSuccess,
@@ -11040,7 +11043,7 @@ const RateView = props => {
11040
11043
  if (isLoading || isWorkflowLoading) {
11041
11044
  return /*#__PURE__*/React.createElement(Loader, null);
11042
11045
  }
11043
- return /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement(CardHeader$1, null, t("CS_RATE_HELP_US")), /*#__PURE__*/React.createElement(KeyNote, {
11046
+ return /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(CardHeader$1, null, t("CS_RATE_HELP_US")), /*#__PURE__*/React.createElement(KeyNote, {
11044
11047
  keyValue: t("CS_FSM_YOU_RATED")
11045
11048
  }, /*#__PURE__*/React.createElement(Rating, {
11046
11049
  currentRating: data === null || data === void 0 ? void 0 : (_data$timeline$ = data.timeline[0]) === null || _data$timeline$ === void 0 ? void 0 : _data$timeline$.rating
@@ -11329,7 +11332,7 @@ const FSMLink = _ref => {
11329
11332
  }, /*#__PURE__*/React.createElement(ShippingTruck, null)), " ", /*#__PURE__*/React.createElement("span", {
11330
11333
  className: "text"
11331
11334
  }, t("ES_TITLE_FAECAL_SLUDGE_MGMT")));
11332
- return /*#__PURE__*/React.createElement(Card$1, {
11335
+ return /*#__PURE__*/React.createElement(Card, {
11333
11336
  className: "employeeCard inboxLinksFSM"
11334
11337
  }, /*#__PURE__*/React.createElement("div", {
11335
11338
  className: "complaint-links-container"
@@ -11481,14 +11484,14 @@ const AssignedTo = _ref => {
11481
11484
  }));
11482
11485
  };
11483
11486
 
11484
- const _excluded$1 = ["searchParams", "paginationParms", "onFilterChange", "onSearch", "removeParam"];
11487
+ const _excluded = ["searchParams", "paginationParms", "onFilterChange", "onSearch", "removeParam"];
11485
11488
  const Filter = _ref => {
11486
11489
  var _mergedRoleDetails$st, _mergedRoleDetails$st2, _props$applications, _props$applications2;
11487
11490
  let searchParams = _ref.searchParams,
11488
11491
  paginationParms = _ref.paginationParms,
11489
11492
  onFilterChange = _ref.onFilterChange,
11490
11493
  onSearch = _ref.onSearch,
11491
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
11494
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
11492
11495
  const _useTranslation = useTranslation(),
11493
11496
  t = _useTranslation.t;
11494
11497
  const location = useLocation();
@@ -11978,7 +11981,7 @@ const DesktopInbox = props => {
11978
11981
  if (props.isLoading) {
11979
11982
  result = /*#__PURE__*/React.createElement(Loader, null);
11980
11983
  } else if (props.isSearch && !props.shouldSearch || (props === null || props === void 0 ? void 0 : (_props$data = props.data) === null || _props$data === void 0 ? void 0 : (_props$data$table = _props$data.table) === null || _props$data$table === void 0 ? void 0 : _props$data$table.length) === 0) {
11981
- result = /*#__PURE__*/React.createElement(Card$1, {
11984
+ result = /*#__PURE__*/React.createElement(Card, {
11982
11985
  style: {
11983
11986
  marginTop: 20
11984
11987
  }
@@ -12168,7 +12171,7 @@ const ApplicationCard = _ref => {
12168
12171
  }
12169
12172
  let result;
12170
12173
  if (!data || (data === null || data === void 0 ? void 0 : data.length) === 0) {
12171
- result = /*#__PURE__*/React.createElement(Card$1, {
12174
+ result = /*#__PURE__*/React.createElement(Card, {
12172
12175
  style: {
12173
12176
  marginTop: 20
12174
12177
  }
@@ -14388,7 +14391,7 @@ const ApplicationDetails$1 = props => {
14388
14391
  color: "#A52A2A"
14389
14392
  },
14390
14393
  onClick: handleViewTimeline
14391
- })), /*#__PURE__*/React.createElement(Card$1, {
14394
+ })), /*#__PURE__*/React.createElement(Card, {
14392
14395
  className: "fsm",
14393
14396
  style: {
14394
14397
  position: "relative"
@@ -15934,7 +15937,7 @@ const FstpOperatorDetails = () => {
15934
15937
  styles: {
15935
15938
  marginLeft: "16px"
15936
15939
  }
15937
- }, t("ES_INBOX_VEHICLE_LOG")), /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement(StatusTable, null, vehicleData === null || vehicleData === void 0 ? void 0 : vehicleData.map((row, index) => /*#__PURE__*/React.createElement(Row, {
15940
+ }, t("ES_INBOX_VEHICLE_LOG")), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(StatusTable, null, vehicleData === null || vehicleData === void 0 ? void 0 : vehicleData.map((row, index) => /*#__PURE__*/React.createElement(Row, {
15938
15941
  rowContainerStyle: isMobile && history.location.pathname.includes("new-vehicle-entry") ? {
15939
15942
  display: "block"
15940
15943
  } : {
@@ -17232,7 +17235,7 @@ const Response$1 = props => {
17232
17235
  ACTIONS = [...ACTIONS, "ASSIGN_TO_DSO"];
17233
17236
  }
17234
17237
  const isSuccess = !successData ? mutation === null || mutation === void 0 ? void 0 : mutation.isSuccess : true;
17235
- return /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement(BannerPicker$1, {
17238
+ return /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(BannerPicker$1, {
17236
17239
  t: t,
17237
17240
  data: Data,
17238
17241
  action: state.action,
@@ -17961,7 +17964,7 @@ const RegisryInbox = props => {
17961
17964
  emptyCardText = "ES_FSM_REGISTRY_EMPTY_CARD_DRIVER";
17962
17965
  emptyButtonText = "ES_FSM_REGISTRY_EMPTY_BUTTON_DRIVER";
17963
17966
  }
17964
- result = /*#__PURE__*/React.createElement(Card$1, {
17967
+ result = /*#__PURE__*/React.createElement(Card, {
17965
17968
  style: {
17966
17969
  display: "flex",
17967
17970
  justifyContent: "center",
@@ -18603,7 +18606,7 @@ const VehicleDetails = props => {
18603
18606
  }
18604
18607
  return !isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
18605
18608
  className: "employee-form-content"
18606
- }, /*#__PURE__*/React.createElement(Card$1, {
18609
+ }, /*#__PURE__*/React.createElement(Card, {
18607
18610
  style: {
18608
18611
  position: "relative",
18609
18612
  backgroundColor: "#fff"
@@ -18617,7 +18620,7 @@ const VehicleDetails = props => {
18617
18620
  marginBottom: "16px",
18618
18621
  marginTop: "32px"
18619
18622
  }
18620
- }, t(detail.title)), /*#__PURE__*/React.createElement(Card$1, {
18623
+ }, t(detail.title)), /*#__PURE__*/React.createElement(Card, {
18621
18624
  className: "card-with-background",
18622
18625
  style: {
18623
18626
  margin: "10px 16px",
@@ -18682,7 +18685,7 @@ const VehicleDetails = props => {
18682
18685
  actionSaveLabel: t(selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? "ES_EVENT_DELETE" : "CS_COMMON_SUBMIT"),
18683
18686
  actionSaveOnSubmit: handleModalAction,
18684
18687
  formId: "modal-action"
18685
- }, selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? renderModalContent() : /*#__PURE__*/React.createElement(Card$1, {
18688
+ }, selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? renderModalContent() : /*#__PURE__*/React.createElement(Card, {
18686
18689
  style: {
18687
18690
  boxShadow: "none"
18688
18691
  }
@@ -19551,7 +19554,7 @@ const DriverDetails = props => {
19551
19554
  }
19552
19555
  return !isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
19553
19556
  className: "employee-form-content"
19554
- }, /*#__PURE__*/React.createElement(Card$1, {
19557
+ }, /*#__PURE__*/React.createElement(Card, {
19555
19558
  style: {
19556
19559
  position: "relative",
19557
19560
  backgroundColor: "#fff"
@@ -19565,7 +19568,7 @@ const DriverDetails = props => {
19565
19568
  marginBottom: "16px",
19566
19569
  marginTop: "32px"
19567
19570
  }
19568
- }, t(detail.title)), /*#__PURE__*/React.createElement(Card$1, {
19571
+ }, t(detail.title)), /*#__PURE__*/React.createElement(Card, {
19569
19572
  className: "card-with-background",
19570
19573
  style: {
19571
19574
  margin: "10px 16px",
@@ -19630,7 +19633,7 @@ const DriverDetails = props => {
19630
19633
  actionSaveLabel: t(selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? "ES_EVENT_DELETE" : "CS_COMMON_SUBMIT"),
19631
19634
  actionSaveOnSubmit: handleModalAction,
19632
19635
  formId: "modal-action"
19633
- }, selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? renderModalContent() : /*#__PURE__*/React.createElement(Card$1, {
19636
+ }, selectedAction === "DELETE" || selectedAction === "DELETE_VENDOR" ? renderModalContent() : /*#__PURE__*/React.createElement(Card, {
19634
19637
  style: {
19635
19638
  boxShadow: "none"
19636
19639
  }
@@ -20757,15 +20760,12 @@ const convertEpochToDate$1 = (dateEpoch, businessService) => {
20757
20760
  }
20758
20761
  };
20759
20762
 
20760
- const VendorConfig = function (t, disabled, formData) {
20761
- var _formData, _formData$serviceType;
20762
- if (disabled === void 0) {
20763
- disabled = false;
20764
- }
20765
- if (formData === void 0) {
20766
- formData = {};
20763
+ const VendorConfig = function (t, module, genderMenu, update) {
20764
+ var _module;
20765
+ if (module === void 0) {
20766
+ module = "";
20767
20767
  }
20768
- 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";
20768
+ const isEkyc = ((_module = module) === null || _module === void 0 ? void 0 : _module.toLocaleUpperCase()) === "EKYC";
20769
20769
  return [{
20770
20770
  head: "ES_VRNDOR_NEW_VENDOR_DETAILS",
20771
20771
  isCollapsible: true,
@@ -20774,7 +20774,7 @@ const VendorConfig = function (t, disabled, formData) {
20774
20774
  label: "ES_FSM_REGISTRY_NEW_VENDOR_NAME",
20775
20775
  isMandatory: true,
20776
20776
  type: "text",
20777
- disable: disabled,
20777
+ disable: false,
20778
20778
  populators: {
20779
20779
  name: "vendorName",
20780
20780
  validation: {
@@ -20785,27 +20785,12 @@ const VendorConfig = function (t, disabled, formData) {
20785
20785
  defaultValue: "",
20786
20786
  className: "payment-form-text-input-correction"
20787
20787
  }
20788
- }, {
20789
- label: "ES_FSM_REGISTRY_NEW_EMAIL",
20790
- isMandatory: false,
20791
- type: "text",
20792
- key: "emailId",
20793
- populators: {
20794
- name: "emailId",
20795
- validation: {
20796
- required: false,
20797
- pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
20798
- },
20799
- error: t("FSM_REGISTRY_INVALID_EMAIL"),
20800
- defaultValue: "",
20801
- className: "payment-form-text-input-correction"
20802
- }
20803
20788
  }, {
20804
20789
  label: "ES_FSM_REGISTRY_NEW_VENDOR_PHONE",
20805
20790
  isMandatory: true,
20806
20791
  type: "mobileNumber",
20807
20792
  key: "phone",
20808
- disable: disabled,
20793
+ disable: false,
20809
20794
  populators: {
20810
20795
  name: "phone",
20811
20796
  validation: {
@@ -20820,13 +20805,28 @@ const VendorConfig = function (t, disabled, formData) {
20820
20805
  defaultValue: "",
20821
20806
  className: "payment-form-text-input-correction"
20822
20807
  }
20808
+ }, {
20809
+ label: "ES_FSM_REGISTRY_NEW_EMAIL",
20810
+ isMandatory: false,
20811
+ type: "text",
20812
+ key: "emailId",
20813
+ populators: {
20814
+ name: "emailId",
20815
+ validation: {
20816
+ required: false,
20817
+ pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
20818
+ },
20819
+ error: t("FSM_REGISTRY_INVALID_EMAIL"),
20820
+ defaultValue: "",
20821
+ className: "payment-form-text-input-correction"
20822
+ }
20823
20823
  }, {
20824
20824
  label: "ES_VENDOR_REGISTRY_SERVICE_TYPE",
20825
20825
  isMandatory: true,
20826
20826
  type: "component",
20827
20827
  key: "serviceType",
20828
20828
  component: "SelectServiceType",
20829
- disable: disabled,
20829
+ disable: update,
20830
20830
  populators: {
20831
20831
  name: "serviceType",
20832
20832
  defaultValue: {
@@ -20896,17 +20896,8 @@ const VendorConfig = function (t, disabled, formData) {
20896
20896
  component: "SelectEkycDropdown",
20897
20897
  populators: {
20898
20898
  name: "gender",
20899
- options: [{
20900
- code: "MALE",
20901
- name: "ES_COMMON_GENDER_MALE"
20902
- }, {
20903
- code: "FEMALE",
20904
- name: "ES_COMMON_GENDER_FEMALE"
20905
- }, {
20906
- code: "OTHER",
20907
- name: "ES_COMMON_GENDER_OTHER"
20908
- }],
20909
- optionsKey: "name"
20899
+ options: genderMenu,
20900
+ optionsKey: "i18nKey"
20910
20901
  }
20911
20902
  }, {
20912
20903
  label: "ES_FSM_REGISTRY_NEW_DOB",
@@ -20932,791 +20923,57 @@ const VendorConfig = function (t, disabled, formData) {
20932
20923
  body: [{
20933
20924
  type: "component",
20934
20925
  key: "propertyAddress",
20935
- component: "CPTPropertyLocationDetails",
20926
+ component: "PropertyLocationDetails",
20936
20927
  withoutLabel: true,
20937
20928
  props: {
20938
20929
  hidePropertySearch: true,
20939
20930
  hideZRO: true
20931
+ },
20932
+ texts: {
20933
+ header: "PT_LOCATION_DETAILS"
20940
20934
  }
20941
20935
  }]
20942
20936
  }];
20943
20937
  };
20944
20938
 
20945
- const EditVendor = () => {
20946
- const tenantId = Digit.ULBService.getCurrentTenantId();
20947
- let _useParams = useParams(),
20948
- dsoId = _useParams.id;
20949
- const _useState = useState(null),
20950
- showToast = _useState[0],
20951
- setShowToast = _useState[1];
20952
- const _useState2 = useState(false),
20953
- canSubmit = _useState2[0],
20954
- setSubmitValve = _useState2[1];
20955
- const _useState3 = useState({}),
20956
- defaultValues = _useState3[0],
20957
- setDefaultValues = _useState3[1];
20958
- const _useState4 = useState({}),
20959
- dsoDetails = _useState4[0],
20960
- setDsoDetails = _useState4[1];
20961
- const queryClient = useQueryClient();
20962
- const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED", false),
20963
- setMutationHappened = _Digit$Hooks$useSessi[1];
20964
- const _Digit$Hooks$useSessi2 = Digit.Hooks.useSessionStorage("FSM_ERROR_DATA", false),
20965
- clearError = _Digit$Hooks$useSessi2[2];
20966
- const _Digit$Hooks$useSessi3 = Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA", false),
20967
- clearSuccessData = _Digit$Hooks$useSessi3[2];
20968
- const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
20969
- ids: dsoId
20970
- }, {
20971
- staleTime: Infinity
20972
- }),
20973
- dsoData = _Digit$Hooks$fsm$useD.data,
20974
- daoDataLoading = _Digit$Hooks$fsm$useD.isLoading;
20975
- const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVendorUpdate(tenantId),
20976
- mutate = _Digit$Hooks$fsm$useV.mutate;
20977
- useEffect(() => {
20978
- setMutationHappened(false);
20979
- clearSuccessData();
20980
- clearError();
20981
- }, []);
20982
- useEffect(() => {
20983
- if (dsoData && dsoData[0]) {
20984
- var _dsoDetails$dsoDetail, _dsoDetails$dsoDetail2, _dsoDetails$dsoDetail3, _dsoDetails$dsoDetail4, _dsoDetails$dsoDetail5, _dsoDetails$dsoDetail6, _dsoDetails$dsoDetail7, _dsoDetails$dsoDetail8, _dsoDetails$dsoDetail9, _dsoDetails$dsoDetail0, _dsoDetails$dsoDetail1, _dsoDetails$dsoDetail10, _dsoDetails$dsoDetail11, _dsoDetails$dsoDetail12, _dsoDetails$dsoDetail13, _dsoDetails$dsoDetail14, _dsoDetails$dsoDetail15, _dsoDetails$dsoDetail16, _dsoDetails$dsoDetail17, _dsoDetails$dsoDetail18, _dsoDetails$dsoDetail19, _dsoDetails$dsoDetail20, _dsoDetails$dsoDetail21, _dsoDetails$dsoDetail22, _dsoDetails$dsoDetail23, _dsoDetails$dsoDetail24, _dsoDetails$dsoDetail25, _dsoDetails$dsoDetail26, _dsoDetails$dsoDetail27, _dsoDetails$dsoDetail28, _dsoDetails$dsoDetail29, _dsoDetails$dsoDetail30, _dsoDetails$dsoDetail31, _dsoDetails$dsoDetail32, _dsoDetails$dsoDetail33, _dsoDetails$dsoDetail34, _dsoDetails$dsoDetail35, _dsoDetails$dsoDetail36;
20985
- let dsoDetails = dsoData[0];
20986
- setDsoDetails(dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.dsoDetails);
20987
- let values = {
20988
- vendorName: dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.name,
20989
- street: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail === void 0 ? void 0 : (_dsoDetails$dsoDetail2 = _dsoDetails$dsoDetail.address) === null || _dsoDetails$dsoDetail2 === void 0 ? void 0 : _dsoDetails$dsoDetail2.street,
20990
- doorNo: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail3 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail3 === void 0 ? void 0 : (_dsoDetails$dsoDetail4 = _dsoDetails$dsoDetail3.address) === null || _dsoDetails$dsoDetail4 === void 0 ? void 0 : _dsoDetails$dsoDetail4.doorNo,
20991
- plotNo: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail5 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail5 === void 0 ? void 0 : (_dsoDetails$dsoDetail6 = _dsoDetails$dsoDetail5.address) === null || _dsoDetails$dsoDetail6 === void 0 ? void 0 : _dsoDetails$dsoDetail6.plotNo,
20992
- landmark: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail7 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail7 === void 0 ? void 0 : (_dsoDetails$dsoDetail8 = _dsoDetails$dsoDetail7.address) === null || _dsoDetails$dsoDetail8 === void 0 ? void 0 : _dsoDetails$dsoDetail8.landmark,
20993
- pincode: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail9 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail9 === void 0 ? void 0 : (_dsoDetails$dsoDetail0 = _dsoDetails$dsoDetail9.address) === null || _dsoDetails$dsoDetail0 === void 0 ? void 0 : _dsoDetails$dsoDetail0.pincode,
20994
- buildingName: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail1 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail1 === void 0 ? void 0 : (_dsoDetails$dsoDetail10 = _dsoDetails$dsoDetail1.address) === null || _dsoDetails$dsoDetail10 === void 0 ? void 0 : _dsoDetails$dsoDetail10.buildingName,
20995
- address: {
20996
- pincode: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail11 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail11 === void 0 ? void 0 : (_dsoDetails$dsoDetail12 = _dsoDetails$dsoDetail11.address) === null || _dsoDetails$dsoDetail12 === void 0 ? void 0 : _dsoDetails$dsoDetail12.pincode,
20997
- locality: _extends({}, dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail13 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail13 === void 0 ? void 0 : (_dsoDetails$dsoDetail14 = _dsoDetails$dsoDetail13.address) === null || _dsoDetails$dsoDetail14 === void 0 ? void 0 : _dsoDetails$dsoDetail14.locality, {
20998
- i18nkey: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail15 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail15 === void 0 ? void 0 : _dsoDetails$dsoDetail15.tenantId.toUpperCase().split(".").join("_")) + "_REVENUE_" + (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail16 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail16 === void 0 ? void 0 : _dsoDetails$dsoDetail16.address.locality.code)
20999
- })
21000
- },
21001
- phone: dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.mobileNumber,
21002
- ownerName: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail17 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail17 === void 0 ? void 0 : (_dsoDetails$dsoDetail18 = _dsoDetails$dsoDetail17.owner) === null || _dsoDetails$dsoDetail18 === void 0 ? void 0 : _dsoDetails$dsoDetail18.name,
21003
- fatherOrHusbandName: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail19 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail19 === void 0 ? void 0 : (_dsoDetails$dsoDetail20 = _dsoDetails$dsoDetail19.owner) === null || _dsoDetails$dsoDetail20 === void 0 ? void 0 : _dsoDetails$dsoDetail20.fatherOrHusbandName,
21004
- relationship: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail21 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail21 === void 0 ? void 0 : (_dsoDetails$dsoDetail22 = _dsoDetails$dsoDetail21.owner) === null || _dsoDetails$dsoDetail22 === void 0 ? void 0 : _dsoDetails$dsoDetail22.relationship,
21005
- selectGender: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail23 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail23 === void 0 ? void 0 : (_dsoDetails$dsoDetail24 = _dsoDetails$dsoDetail23.owner) === null || _dsoDetails$dsoDetail24 === void 0 ? void 0 : _dsoDetails$dsoDetail24.gender,
21006
- dob: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail25 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail25 === void 0 ? void 0 : (_dsoDetails$dsoDetail26 = _dsoDetails$dsoDetail25.owner) === null || _dsoDetails$dsoDetail26 === void 0 ? void 0 : _dsoDetails$dsoDetail26.dob) && Digit.DateUtils.ConvertTimestampToDate(dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail27 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail27 === void 0 ? void 0 : (_dsoDetails$dsoDetail28 = _dsoDetails$dsoDetail27.owner) === null || _dsoDetails$dsoDetail28 === void 0 ? void 0 : _dsoDetails$dsoDetail28.dob, "yyyy-MM-dd"),
21007
- emailId: (dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail29 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail29 === void 0 ? void 0 : (_dsoDetails$dsoDetail30 = _dsoDetails$dsoDetail29.owner) === null || _dsoDetails$dsoDetail30 === void 0 ? void 0 : _dsoDetails$dsoDetail30.emailId) === "abc@egov.com" ? "" : dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail31 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail31 === void 0 ? void 0 : (_dsoDetails$dsoDetail32 = _dsoDetails$dsoDetail31.owner) === null || _dsoDetails$dsoDetail32 === void 0 ? void 0 : _dsoDetails$dsoDetail32.emailId,
21008
- correspondenceAddress: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail33 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail33 === void 0 ? void 0 : (_dsoDetails$dsoDetail34 = _dsoDetails$dsoDetail33.owner) === null || _dsoDetails$dsoDetail34 === void 0 ? void 0 : _dsoDetails$dsoDetail34.correspondenceAddress,
21009
- additionalDetails: dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$dsoDetail35 = dsoDetails.dsoDetails) === null || _dsoDetails$dsoDetail35 === void 0 ? void 0 : (_dsoDetails$dsoDetail36 = _dsoDetails$dsoDetail35.additionalDetails) === null || _dsoDetails$dsoDetail36 === void 0 ? void 0 : _dsoDetails$dsoDetail36.description
21010
- };
21011
- setDefaultValues(values);
21012
- }
21013
- }, [dsoData]);
21014
- const _useTranslation = useTranslation(),
21015
- t = _useTranslation.t;
21016
- const history = useHistory();
21017
- const Config = VendorConfig(t, true);
21018
- const onFormValueChange = (setValue, formData) => {
21019
- var _formData$address;
21020
- if (formData !== null && formData !== void 0 && formData.phone && formData !== null && formData !== void 0 && (_formData$address = formData.address) !== null && _formData$address !== void 0 && _formData$address.locality) {
21021
- setSubmitValve(true);
21022
- } else {
21023
- setSubmitValve(false);
21024
- }
21025
- };
21026
- const closeToast = () => {
21027
- setShowToast(null);
21028
- };
21029
- const onSubmit = data => {
21030
- var _data$street, _data$doorNo, _data$plotNo, _data$landmark, _data$address, _data$address$city, _data$address2, _data$address2$city, _data$address3, _data$address3$city, _data$address4, _data$address4$city, _data$buildingName, _data$address5, _data$address5$locali, _data$address6, _data$address6$locali, _data$address7, _data$address7$locali, _data$selectGender, _data$address8, _data$address9, _dsoDetails$owner, _dsoDetails$owner2;
21031
- const name = data === null || data === void 0 ? void 0 : data.vendorName;
21032
- const phone = data === null || data === void 0 ? void 0 : data.phone;
21033
- const pincode = data === null || data === void 0 ? void 0 : data.pincode;
21034
- const street = data === null || data === void 0 ? void 0 : (_data$street = data.street) === null || _data$street === void 0 ? void 0 : _data$street.trim();
21035
- const doorNo = data === null || data === void 0 ? void 0 : (_data$doorNo = data.doorNo) === null || _data$doorNo === void 0 ? void 0 : _data$doorNo.trim();
21036
- const plotNo = data === null || data === void 0 ? void 0 : (_data$plotNo = data.plotNo) === null || _data$plotNo === void 0 ? void 0 : _data$plotNo.trim();
21037
- const landmark = data === null || data === void 0 ? void 0 : (_data$landmark = data.landmark) === null || _data$landmark === void 0 ? void 0 : _data$landmark.trim();
21038
- const city = data === null || data === void 0 ? void 0 : (_data$address = data.address) === null || _data$address === void 0 ? void 0 : (_data$address$city = _data$address.city) === null || _data$address$city === void 0 ? void 0 : _data$address$city.name;
21039
- const state = data === null || data === void 0 ? void 0 : (_data$address2 = data.address) === null || _data$address2 === void 0 ? void 0 : (_data$address2$city = _data$address2.city) === null || _data$address2$city === void 0 ? void 0 : _data$address2$city.state;
21040
- const district = data === null || data === void 0 ? void 0 : (_data$address3 = data.address) === null || _data$address3 === void 0 ? void 0 : (_data$address3$city = _data$address3.city) === null || _data$address3$city === void 0 ? void 0 : _data$address3$city.name;
21041
- const region = data === null || data === void 0 ? void 0 : (_data$address4 = data.address) === null || _data$address4 === void 0 ? void 0 : (_data$address4$city = _data$address4.city) === null || _data$address4$city === void 0 ? void 0 : _data$address4$city.name;
21042
- const buildingName = data === null || data === void 0 ? void 0 : (_data$buildingName = data.buildingName) === null || _data$buildingName === void 0 ? void 0 : _data$buildingName.trim();
21043
- const localityCode = data === null || data === void 0 ? void 0 : (_data$address5 = data.address) === null || _data$address5 === void 0 ? void 0 : (_data$address5$locali = _data$address5.locality) === null || _data$address5$locali === void 0 ? void 0 : _data$address5$locali.code;
21044
- const localityName = data === null || data === void 0 ? void 0 : (_data$address6 = data.address) === null || _data$address6 === void 0 ? void 0 : (_data$address6$locali = _data$address6.locality) === null || _data$address6$locali === void 0 ? void 0 : _data$address6$locali.name;
21045
- const localityArea = data === null || data === void 0 ? void 0 : (_data$address7 = data.address) === null || _data$address7 === void 0 ? void 0 : (_data$address7$locali = _data$address7.locality) === null || _data$address7$locali === void 0 ? void 0 : _data$address7$locali.area;
21046
- const additionalDetails = data === null || data === void 0 ? void 0 : data.additionalDetails;
21047
- const gender = data === null || data === void 0 ? void 0 : (_data$selectGender = data.selectGender) === null || _data$selectGender === void 0 ? void 0 : _data$selectGender.code;
21048
- const emailId = data === null || data === void 0 ? void 0 : data.emailId;
21049
- const dob = new Date("" + data.dob).getTime() || new Date("1/1/1970").getTime();
21050
- const formData = {
21051
- vendor: _extends({}, dsoDetails, {
21052
- name,
21053
- address: _extends({}, dsoDetails.address, {
21054
- landmark,
21055
- doorNo,
21056
- plotNo,
21057
- street,
21058
- city,
21059
- district,
21060
- region,
21061
- state,
21062
- country: "in",
21063
- pincode,
21064
- buildingName,
21065
- locality: _extends({}, dsoDetails.address.locality, {
21066
- code: localityCode || "",
21067
- name: localityName || "",
21068
- label: "Locality",
21069
- area: localityArea || ""
21070
- }),
21071
- geoLocation: _extends({}, dsoDetails.address.geoLocation, {
21072
- latitude: (data === null || data === void 0 ? void 0 : (_data$address8 = data.address) === null || _data$address8 === void 0 ? void 0 : _data$address8.latitude) || 0,
21073
- longitude: (data === null || data === void 0 ? void 0 : (_data$address9 = data.address) === null || _data$address9 === void 0 ? void 0 : _data$address9.longitude) || 0
21074
- })
21075
- }),
21076
- owner: _extends({}, dsoDetails.owner, {
21077
- gender: gender || ((_dsoDetails$owner = dsoDetails.owner) === null || _dsoDetails$owner === void 0 ? void 0 : _dsoDetails$owner.gender) || "OTHER",
21078
- dob: dob,
21079
- emailId: emailId || "abc@egov.com",
21080
- mobileNumber: phone,
21081
- relationship: ((_dsoDetails$owner2 = dsoDetails.owner) === null || _dsoDetails$owner2 === void 0 ? void 0 : _dsoDetails$owner2.relationship) || "OTHER"
21082
- }),
21083
- additionalDetails: _extends({}, dsoDetails.additionalDetails, {
21084
- description: additionalDetails
21085
- })
21086
- })
21087
- };
21088
- mutate(formData, {
21089
- onError: (error, variables) => {
21090
- setShowToast({
21091
- key: "error",
21092
- action: error
21093
- });
21094
- setTimeout(closeToast, 5000);
21095
- },
21096
- onSuccess: (data, variables) => {
21097
- setShowToast({
21098
- key: "success",
21099
- action: "UPDATE_VENDOR"
21100
- });
21101
- setTimeout(closeToast, 5000);
21102
- queryClient.invalidateQueries("DSO_SEARCH");
21103
- setTimeout(() => {
21104
- closeToast();
21105
- history.push("/digit-ui/employee/fsm/registry/vendor-details/" + dsoId);
21106
- }, 5000);
21107
- }
21108
- });
21109
- };
21110
- if (daoDataLoading || Object.keys(defaultValues).length === 0) {
21111
- return /*#__PURE__*/React.createElement(Loader, null);
21112
- }
21113
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VerticalTimeline, {
21114
- config: [{
21115
- timeLine: [{
21116
- actions: t("ES_FSM_REGISTRY_TITLE_EDIT_VENDOR"),
21117
- currentStep: 1
21118
- }]
21119
- }],
21120
- currentActiveIndex: 0,
21121
- showFinalStep: false
21122
- }), /*#__PURE__*/React.createElement("div", {
21123
- style: {
21124
- flex: "1",
21125
- overflowY: "auto"
21126
- }
21127
- }, /*#__PURE__*/React.createElement(FormComposer, {
21128
- isDisabled: !canSubmit,
21129
- label: t("ES_COMMON_APPLICATION_SUBMIT"),
21130
- config: Config.filter(i => !i.hideInEmployee).map(config => {
21131
- return _extends({}, config, {
21132
- body: config.body.filter(a => !a.hideInEmployee)
21133
- });
21134
- }),
21135
- fieldStyle: {
21136
- marginRight: 0
21137
- },
21138
- onSubmit: onSubmit,
21139
- defaultValues: defaultValues,
21140
- onFormValueChange: onFormValueChange,
21141
- noBreakLine: true
21142
- }), showToast && /*#__PURE__*/React.createElement(Toast, {
21143
- error: showToast.key === "error" ? true : false,
21144
- label: t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_SUCCESS" : showToast.action),
21145
- onClose: closeToast
21146
- })));
21147
- };
21148
-
21149
- const VendorDetails = _ref => {
21150
- var _formData$ownerKey, _formData$ownerKey2, _formData$ownerKey3, _formData$ownerKey4;
21151
- let t = _ref.t,
21152
- config = _ref.config,
21153
- onSelect = _ref.onSelect,
21154
- userType = _ref.userType,
21155
- formData = _ref.formData;
21156
- let index = 0;
21157
- const user = Digit.UserService.getUser().info;
21158
- 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) || "";
21159
- 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) || "";
21160
- 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);
21161
- 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) || "";
21162
- const _useState = useState(""),
21163
- VendorCategory = _useState[0],
21164
- setVendorCategory = _useState[1];
21165
- const _useState2 = useState(""),
21166
- VendorId = _useState2[0],
21167
- setVendorId = _useState2[1];
21168
- const _useState3 = useState(""),
21169
- userName = _useState3[0],
21170
- setUserName = _useState3[1];
21171
- const _useState4 = useState(""),
21172
- Bank = _useState4[0],
21173
- setBank = _useState4[1];
21174
- const _useState5 = useState(),
21175
- BankbranchName = _useState5[0],
21176
- setBankbranchName = _useState5[1];
21177
- const _useState6 = useState(""),
21178
- IFSC = _useState6[0],
21179
- setIFSC = _useState6[1];
21180
- const _useState7 = useState(""),
21181
- AccountNo = _useState7[0],
21182
- setAccountNo = _useState7[1];
21183
- const _useState8 = useState(""),
21184
- PanNo = _useState8[0],
21185
- setPanNo = _useState8[1];
21186
- const _useState9 = useState(""),
21187
- GstNo = _useState9[0],
21188
- setGstNo = _useState9[1];
21189
- const _useState0 = useState(""),
21190
- GstState = _useState0[0],
21191
- setGstState = _useState0[1];
21192
- const _useState1 = useState(""),
21193
- RegistrationNo = _useState1[0],
21194
- setRegistrationNo = _useState1[1];
21195
- const _useState10 = useState(""),
21196
- EpfNo = _useState10[0],
21197
- setEpfNo = _useState10[1];
21198
- const _useState11 = useState(""),
21199
- EsiNo = _useState11[0],
21200
- setEsiNo = _useState11[1];
21201
- const _useState12 = useState(""),
21202
- VendorType = _useState12[0],
21203
- setVendorType = _useState12[1];
21204
- const _useState13 = useState(""),
21205
- Status = _useState13[0],
21206
- setStatus = _useState13[1];
21207
- const _useState14 = useState(""),
21208
- micrNo = _useState14[0],
21209
- setmicrNo = _useState14[1];
21210
- const _useState15 = useState(""),
21211
- PhoneNo = _useState15[0],
21212
- setPhoneNo = _useState15[1];
21213
- const _useState16 = useState(""),
21214
- ContactPerson = _useState16[0],
21215
- setContactPerson = _useState16[1];
21216
- useEffect(() => {
21217
- if (IFSC.length === 11 && !Bank && !BankbranchName && !micrNo) {
21218
- fetch("https://ifsc.razorpay.com/" + IFSC).then(response => response.json()).then(data => {
21219
- if (data && data.BANK && data.BRANCH && data.MICR) {
21220
- setBank(data.BANK);
21221
- setBankbranchName(data.BRANCH);
21222
- setmicrNo(data.MICR);
21223
- }
21224
- }).catch(() => {});
21225
- } else {
21226
- if (IFSC.length === 11 && Bank && BankbranchName) {
21227
- setBank(Bank);
21228
- setBankbranchName(BankbranchName);
21229
- setmicrNo(micrNo);
21230
- } else {
21231
- setBank("");
21232
- setBankbranchName("");
21233
- setmicrNo("");
21234
- }
21235
- }
21236
- }, [IFSC]);
21237
- function setvendorbank(e) {
21238
- setBank(e.target.value);
21239
- }
21240
- function setBankbranch(e) {
21241
- setBankbranchName(e.target.value);
21242
- }
21243
- function setvendorifsc(e) {
21244
- const input = e.target.value.replace(/[^a-zA-Z0-9]/g, "");
21245
- if (input.length <= 11) {
21246
- setIFSC(input);
21247
- }
21248
- }
21249
- function setvendoraccountno(e) {
21250
- setAccountNo(e.target.value);
21251
- }
21252
- function setpanno(e) {
21253
- setPanNo(e.target.value);
21254
- }
21255
- function setgstno(e) {
21256
- setGstNo(e.target.value);
21257
- }
21258
- function setgststate(e) {
21259
- setGstState(e.target.value);
21260
- }
21261
- function setregistrationno(e) {
21262
- setRegistrationNo(e.target.value);
21263
- }
21264
- function setepfno(e) {
21265
- setEpfNo(e.target.value);
21266
- }
21267
- function setesino(e) {
21268
- setEsiNo(e.target.value);
21269
- }
21270
- function setcontactperson(e) {
21271
- setContactPerson(e.target.value);
21272
- }
21273
- const tenantId = Digit.ULBService.getCurrentTenantId();
21274
- const _useForm = useForm(),
21275
- control = _useForm.control;
21276
- const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
21277
- staleTime: Infinity
21278
- }),
21279
- dsoData = _Digit$Hooks$fsm$useD.data;
21280
- useEffect(() => {
21281
- if (dsoData) {
21282
- const vendor = dsoData.find(item => item.id);
21283
- if (vendor) {
21284
- setUserName(vendor.name);
21285
- setVendorId(vendor.id);
21286
- }
21287
- }
21288
- }, [dsoData]);
21289
- const goNext = () => {
21290
- let owner = formData.ownerKey && formData.ownerKey[index];
21291
- let ownerStep;
21292
- if (userType === "citizen") {
21293
- ownerStep = _extends({}, owner, {
21294
- applicantName,
21295
- mobileNumber,
21296
- altMobileNumber,
21297
- emailId
21298
- });
21299
- onSelect(config.key, _extends({}, formData[config.key], ownerStep), false, index);
21300
- } else {
21301
- ownerStep = _extends({}, owner, {
21302
- VendorCategory,
21303
- name: userName,
21304
- VendorId: VendorId,
21305
- Bank,
21306
- BankbranchName,
21307
- IFSC,
21308
- AccountNo,
21309
- PanNo,
21310
- GstNo,
21311
- GstState,
21312
- RegistrationNo,
21313
- EpfNo,
21314
- EsiNo,
21315
- VendorType,
21316
- Status,
21317
- micrNo,
21318
- PhoneNo,
21319
- ContactPerson
21320
- });
21321
- onSelect(config.key, ownerStep, false, index);
21322
- }
21323
- };
21324
- useEffect(() => {
21325
- if (userType === "citizen") {
21326
- goNext();
21327
- }
21328
- }, [VendorCategory, VendorId, userName, Bank, BankbranchName, IFSC, AccountNo, PanNo, GstNo, GstState, RegistrationNo, EpfNo, EsiNo, VendorType, Status, micrNo, PhoneNo, ContactPerson, userType]);
21329
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VerticalTimeline, {
21330
- config: [{
21331
- timeLine: [{
21332
- actions: t("VENDOR_ADDITIONAL_DETAILS"),
21333
- currentStep: 1
21334
- }]
21335
- }, {
21336
- timeLine: [{
21337
- actions: t("VENDOR_DOCUMENT_DETAILS"),
21338
- currentStep: 2
21339
- }]
21340
- }, {
21341
- timeLine: [{
21342
- actions: t("VENDOR_SUMMARY"),
21343
- currentStep: 3
21344
- }]
21345
- }],
21346
- currentActiveIndex: 0,
21347
- showFinalStep: false
21348
- }), /*#__PURE__*/React.createElement("div", {
21349
- style: {
21350
- flex: "1",
21351
- overflowY: "auto"
21352
- }
21353
- }, /*#__PURE__*/React.createElement(FormStep$1, {
21354
- config: config,
21355
- onSelect: goNext,
21356
- t: t,
21357
- className: "formcomposer-grid-container-form"
21358
- }, /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, {
21359
- className: "card-label-smaller"
21360
- }, /*#__PURE__*/React.createElement(CustomTooltip, {
21361
- label: "" + t("IFSC_CODE"),
21362
- isMandatory: false,
21363
- message: t("INVALID_IFSC_CODE_ERROR_MESSAGE")
21364
- })), /*#__PURE__*/React.createElement(TextInput$1, {
21365
- t: t,
21366
- type: "text",
21367
- isMandatory: false,
21368
- optionKey: "i18nKey",
21369
- name: "IFSC",
21370
- value: IFSC,
21371
- placeholder: "Enter IFSC Code",
21372
- onChange: setvendorifsc,
21373
- style: {
21374
- width: "100%"
21375
- },
21376
- maxLength: 11,
21377
- ValidationRequired: true,
21378
- validation: {
21379
- isRequired: true,
21380
- pattern: "^[A-Z]{4}0[A-Z0-9]{6}$",
21381
- type: "text",
21382
- title: t("INVALID_IFSC_CODE_ERROR_MESSAGE")
21383
- }
21384
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, "" + t("VENDOR_BANK_NAME"), " ", /*#__PURE__*/React.createElement("span", {
21385
- className: "check-page-link-button"
21386
- }, "*")), /*#__PURE__*/React.createElement(TextInput$1, {
21387
- t: t,
21388
- type: "text",
21389
- isMandatory: false,
21390
- optionKey: "i18nKey",
21391
- name: "bankName",
21392
- placeholder: "Bank Name Auto Select",
21393
- style: {
21394
- width: "100%"
21395
- },
21396
- value: Bank,
21397
- onChange: setvendorbank,
21398
- disabled: true
21399
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, "" + t("VENDOR_BANK_BRANCH_NAME"), " ", /*#__PURE__*/React.createElement("span", {
21400
- className: "check-page-link-button"
21401
- }, "*")), /*#__PURE__*/React.createElement(TextInput$1, {
21402
- t: t,
21403
- type: "text",
21404
- isMandatory: false,
21405
- optionKey: "i18nKey",
21406
- name: "BankbranchName",
21407
- value: BankbranchName,
21408
- style: {
21409
- width: "100%"
21410
- },
21411
- placeholder: "Bank Branch Name Auto Select",
21412
- onChange: setBankbranch,
21413
- disabled: false
21414
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, "" + t("VENDOR_MICR_NO"), " ", /*#__PURE__*/React.createElement("span", {
21415
- className: "check-page-link-button"
21416
- }, "*")), /*#__PURE__*/React.createElement(TextInput$1, {
21417
- t: t,
21418
- type: "text",
21419
- isMandatory: false,
21420
- optionKey: "i18nKey",
21421
- name: "MicrNo",
21422
- value: micrNo,
21423
- style: {
21424
- width: "100%"
21425
- },
21426
- placeholder: "MICR No",
21427
- onChange: setmicrNo,
21428
- disabled: false
21429
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, "" + t("ACCOUNT_NO")), /*#__PURE__*/React.createElement(TextInput$1, {
21430
- t: t,
21431
- type: "text",
21432
- isMandatory: false,
21433
- optionKey: "i18nKey",
21434
- name: "AccountNo",
21435
- value: AccountNo,
21436
- onChange: setvendoraccountno,
21437
- style: {
21438
- width: "100%"
21439
- },
21440
- ValidationRequired: true,
21441
- validation: {
21442
- isRequired: true,
21443
- pattern: "[0-9]{9,18}",
21444
- type: "text",
21445
- title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE")
21446
- }
21447
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, "" + t("PHONE_NO")), /*#__PURE__*/React.createElement(MobileNumber, {
21448
- value: PhoneNo,
21449
- name: "PhoneNo",
21450
- onChange: setPhoneNo,
21451
- style: {
21452
- width: "100%"
21453
- }
21454
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, "" + t("CONTACT_PERSON")), /*#__PURE__*/React.createElement(TextInput$1, {
21455
- t: t,
21456
- type: "text",
21457
- isMandatory: false,
21458
- optionKey: "i18nKey",
21459
- name: "ContactPerson",
21460
- value: ContactPerson,
21461
- onChange: setcontactperson,
21462
- style: {
21463
- width: "100%"
21464
- },
21465
- ValidationRequired: true,
21466
- validation: {
21467
- isRequired: true,
21468
- pattern: "^[a-zA-Z0-9/-]{1,20}$",
21469
- type: "text",
21470
- title: t("INVALID_ACCOUNT_NO_ERROR_MESSAGE")
21471
- }
21472
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, "" + t("PAN_NO")), /*#__PURE__*/React.createElement(TextInput$1, {
21473
- t: t,
21474
- type: "text",
21475
- isMandatory: false,
21476
- optionKey: "i18nKey",
21477
- name: "PanNo",
21478
- value: PanNo,
21479
- onChange: setpanno,
21480
- style: {
21481
- width: "100%"
21482
- },
21483
- ValidationRequired: true,
21484
- validation: {
21485
- isRequired: true,
21486
- pattern: "[A-Z]{5}[0-9]{4}[A-Z]{1}",
21487
- type: "text",
21488
- title: t("INVALID_PAN_NO_ERROR_MESSAGE")
21489
- }
21490
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, "" + t("GST_NO")), /*#__PURE__*/React.createElement(TextInput$1, {
21491
- t: t,
21492
- type: "text",
21493
- isMandatory: false,
21494
- optionKey: "i18nKey",
21495
- name: "GstNo",
21496
- value: GstNo,
21497
- onChange: setgstno,
21498
- style: {
21499
- width: "100%"
21500
- },
21501
- ValidationRequired: true,
21502
- validation: {
21503
- isRequired: true,
21504
- pattern: "^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[A-Z0-9]{1}[Z]{1}[A-Z0-9]{1}$",
21505
- type: "text",
21506
- title: t("INVALID_GST_NO_ERROR_MESSAGE")
21507
- }
21508
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, "" + t("GST_REGISTERED_STATE/UT")), /*#__PURE__*/React.createElement(TextInput$1, {
21509
- t: t,
21510
- type: "text",
21511
- isMandatory: false,
21512
- optionKey: "i18nKey",
21513
- name: "GstState",
21514
- value: GstState,
21515
- onChange: setgststate,
21516
- style: {
21517
- width: "100%"
21518
- },
21519
- ValidationRequired: true,
21520
- validation: {
21521
- isRequired: true,
21522
- pattern: "^[a-zA-Z0-9/-]{1,20}$",
21523
- type: "text",
21524
- title: t("PT_NAME_ERROR_MESSAGE")
21525
- }
21526
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, "" + t("REGISTRATION_NO")), /*#__PURE__*/React.createElement(TextInput$1, {
21527
- t: t,
21528
- type: "text",
21529
- isMandatory: false,
21530
- optionKey: "i18nKey",
21531
- name: "RegistrationNo",
21532
- value: RegistrationNo,
21533
- onChange: setregistrationno,
21534
- style: {
21535
- width: "100%"
21536
- },
21537
- ValidationRequired: true,
21538
- validation: {
21539
- isRequired: true,
21540
- pattern: "^[a-zA-Z0-9/-]{1,20}$",
21541
- type: "text",
21542
- title: t("INVALID_REGISTRATION_NO_ERROR_MESSAGE")
21543
- }
21544
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, "" + t("EPF_NO")), /*#__PURE__*/React.createElement(TextInput$1, {
21545
- t: t,
21546
- type: "text",
21547
- isMandatory: false,
21548
- optionKey: "i18nKey",
21549
- name: "EpfNo",
21550
- value: EpfNo,
21551
- onChange: setepfno,
21552
- style: {
21553
- width: "100%"
21554
- },
21555
- ValidationRequired: true,
21556
- validation: {
21557
- isRequired: true,
21558
- pattern: "^[a-zA-Z0-9/-]{1,15}$",
21559
- type: "text",
21560
- title: t("INVALID_EPF_NO_ERROR_MESSAGE")
21561
- }
21562
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel$1, null, "" + t("ESI_NO")), /*#__PURE__*/React.createElement(TextInput$1, {
21563
- t: t,
21564
- type: "text",
21565
- isMandatory: false,
21566
- optionKey: "i18nKey",
21567
- name: "EsiNo",
21568
- value: EsiNo,
21569
- onChange: setesino,
21570
- style: {
21571
- width: "100%"
21572
- },
21573
- ValidationRequired: true,
21574
- validation: {
21575
- isRequired: true,
21576
- pattern: "^[a-zA-Z0-9/-]{1,20}$",
21577
- type: "text",
21578
- title: t("INVALID_ESI_NO_ERROR_MESSAGE")
21579
- }
21580
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement("div", null, t("VENDOR_TYPE"), /*#__PURE__*/React.createElement("div", {
21581
- className: "tooltip",
21582
- style: {
21583
- width: "12px",
21584
- height: "5px",
21585
- marginLeft: "10px",
21586
- display: "inline-flex",
21587
- alignItems: "center"
21588
- }
21589
- }, /*#__PURE__*/React.createElement("span", {
21590
- className: "tooltiptext",
21591
- style: {
21592
- whiteSpace: "pre-wrap",
21593
- fontSize: "small",
21594
- wordWrap: "break-word",
21595
- width: "300px",
21596
- marginLeft: "15px",
21597
- marginBottom: "-10px"
21598
- }
21599
- }, "" + t("AST_CLASSIFICATION_ASSET")))), /*#__PURE__*/React.createElement(Controller, {
21600
- control: control,
21601
- name: "VendorType",
21602
- defaultValue: VendorType,
21603
- rules: {
21604
- required: t("CORE_COMMON_REQUIRED_ERRMSG")
21605
- },
21606
- render: props => /*#__PURE__*/React.createElement(Dropdown, {
21607
- selected: VendorType,
21608
- select: setVendorType,
21609
- option: [{
21610
- i18nKey: "Supplier",
21611
- code: "SUPPLIER"
21612
- }, {
21613
- i18nKey: "Contractor",
21614
- code: "CONTRACTOR"
21615
- }],
21616
- optionKey: "i18nKey",
21617
- placeholder: "Select",
21618
- t: t
21619
- })
21620
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement("div", null, t("VENOR_CATEGORY"), /*#__PURE__*/React.createElement("div", {
21621
- className: "tooltip",
21622
- style: {
21623
- width: "12px",
21624
- height: "5px",
21625
- marginLeft: "10px",
21626
- display: "inline-flex",
21627
- alignItems: "center"
21628
- }
21629
- }, /*#__PURE__*/React.createElement("span", {
21630
- className: "tooltiptext",
21631
- style: {
21632
- whiteSpace: "pre-wrap",
21633
- fontSize: "small",
21634
- wordWrap: "break-word",
21635
- width: "300px",
21636
- marginLeft: "15px",
21637
- marginBottom: "-10px"
21638
- }
21639
- }))), /*#__PURE__*/React.createElement(Controller, {
21640
- control: control,
21641
- name: "VendorCategory",
21642
- defaultValue: VendorCategory,
21643
- rules: {
21644
- required: t("CORE_COMMON_REQUIRED_ERRMSG")
21645
- },
21646
- render: props => /*#__PURE__*/React.createElement(Dropdown, {
21647
- selected: VendorCategory,
21648
- select: setVendorCategory,
21649
- option: [{
21650
- i18nKey: "Firm",
21651
- code: "FIRM"
21652
- }, {
21653
- i18nKey: "Individual",
21654
- code: "Individual"
21655
- }],
21656
- optionKey: "i18nKey",
21657
- placeholder: "Select",
21658
- t: t
21659
- })
21660
- })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement("div", null, t("STATUS"), /*#__PURE__*/React.createElement("div", {
21661
- className: "tooltip",
21662
- style: {
21663
- width: "12px",
21664
- height: "5px",
21665
- marginLeft: "10px",
21666
- display: "inline-flex",
21667
- alignItems: "center"
21668
- }
21669
- }, /*#__PURE__*/React.createElement("span", {
21670
- className: "tooltiptext",
21671
- style: {
21672
- whiteSpace: "pre-wrap",
21673
- fontSize: "small",
21674
- wordWrap: "break-word",
21675
- width: "300px",
21676
- marginLeft: "15px",
21677
- marginBottom: "-10px"
21678
- }
21679
- }, "" + t("AST_CLASSIFICATION_ASSET")))), /*#__PURE__*/React.createElement(Controller, {
21680
- control: control,
21681
- name: "Status",
21682
- defaultValue: Status,
21683
- rules: {
21684
- required: t("CORE_COMMON_REQUIRED_ERRMSG")
21685
- },
21686
- render: props => /*#__PURE__*/React.createElement(Dropdown, {
21687
- selected: Status,
21688
- select: setStatus,
21689
- option: [{
21690
- i18nKey: "Active",
21691
- code: "ACTIVE"
21692
- }, {
21693
- i18nKey: "Inactive",
21694
- code: "INACTIVE"
21695
- }],
21696
- optionKey: "i18nKey",
21697
- placeholder: "Select",
21698
- t: t
21699
- })
21700
- })))));
21701
- };
21702
-
21703
- const AddVendor = _ref => {
20939
+ const AddVendor = () => {
20940
+ var _Digit$UserService$ge, _formData$serviceType2;
21704
20941
  const tenantId = Digit.ULBService.getCurrentTenantId();
21705
20942
  const _useTranslation = useTranslation(),
21706
20943
  t = _useTranslation.t;
21707
20944
  const history = useHistory();
20945
+ const userInfo = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info;
20946
+ const userType = userInfo === null || userInfo === void 0 ? void 0 : userInfo.type;
21708
20947
  const _useState = useState(1),
21709
20948
  currentStep = _useState[0],
21710
20949
  setCurrentStep = _useState[1];
21711
20950
  const _useState2 = useState(null),
21712
20951
  showToast = _useState2[0],
21713
20952
  setShowToast = _useState2[1];
20953
+ const _useState3 = useState([]),
20954
+ genderMenu = _useState3[0],
20955
+ setGenderMenu = _useState3[1];
21714
20956
  const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED", false),
21715
20957
  setMutationHappened = _Digit$Hooks$useSessi[1];
21716
20958
  const _Digit$Hooks$useSessi2 = Digit.Hooks.useSessionStorage("FSM_ERROR_DATA", false),
21717
20959
  clearError = _Digit$Hooks$useSessi2[2];
21718
20960
  const _Digit$Hooks$useSessi3 = Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA", false),
21719
20961
  clearSuccessData = _Digit$Hooks$useSessi3[2];
20962
+ const stateId = Digit.ULBService.getStateId();
20963
+ const _Digit$Hooks$obps$use = Digit.Hooks.obps.useMDMS(stateId, "common-masters", ["GenderType"]),
20964
+ genderTypeData = _Digit$Hooks$obps$use.data;
20965
+ useEffect(() => {
20966
+ var _genderTypeData$commo, _genderTypeData$commo2;
20967
+ 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) {
20968
+ var _genderTypeData$commo3, _genderTypeData$commo4;
20969
+ 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 => ({
20970
+ i18nKey: "COMMON_GENDER_" + genderDetails.code,
20971
+ code: "" + genderDetails.code,
20972
+ value: "" + genderDetails.code
20973
+ }));
20974
+ setGenderMenu(menuItems);
20975
+ }
20976
+ }, [genderTypeData]);
21720
20977
  const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVendorCreate(tenantId),
21721
20978
  mutate = _Digit$Hooks$fsm$useV.mutate;
21722
20979
  useEffect(() => {
@@ -21736,19 +20993,19 @@ const AddVendor = _ref => {
21736
20993
  amount: null
21737
20994
  }
21738
20995
  };
21739
- const _useState3 = useState(defaultValues),
21740
- formData = _useState3[0],
21741
- setFormData = _useState3[1];
21742
- const Config = VendorConfig(t, false, formData);
20996
+ const _useState4 = useState(defaultValues),
20997
+ formData = _useState4[0],
20998
+ setFormData = _useState4[1];
20999
+ const Config = React.useMemo(() => {
21000
+ var _formData$serviceType;
21001
+ return VendorConfig(t, (_formData$serviceType = formData.serviceType) === null || _formData$serviceType === void 0 ? void 0 : _formData$serviceType.code, genderMenu);
21002
+ }, [t, formData === null || formData === void 0 ? void 0 : (_formData$serviceType2 = formData.serviceType) === null || _formData$serviceType2 === void 0 ? void 0 : _formData$serviceType2.i18nKey, genderMenu]);
21743
21003
  const onFormValueChange = (setValue, data) => {
21744
- var _data$zoneIds, _data$serviceType, _formData$serviceType, _data$serviceType2;
21745
- const currentZoneCodes = (data === null || data === void 0 ? void 0 : (_data$zoneIds = data.zoneIds) === null || _data$zoneIds === void 0 ? void 0 : _data$zoneIds.map(item => {
21746
- var _item$;
21747
- return item === null || item === void 0 ? void 0 : (_item$ = item[1]) === null || _item$ === void 0 ? void 0 : _item$.code;
21748
- })) || [];
21004
+ var _data$zoneIds, _data$serviceType, _formData$serviceType3, _data$serviceType2;
21005
+ 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)) || [];
21749
21006
  const previousZoneCodes = (formData === null || formData === void 0 ? void 0 : formData.zoneIds) || [];
21750
21007
  const zoneChanged = currentZoneCodes.join(",") !== previousZoneCodes.join(",");
21751
- 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$serviceType = formData.serviceType) === null || _formData$serviceType === void 0 ? void 0 : _formData$serviceType.code) || zoneChanged) {
21008
+ 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) {
21752
21009
  setFormData(prev => _extends({}, prev, {
21753
21010
  serviceType: data === null || data === void 0 ? void 0 : data.serviceType
21754
21011
  }));
@@ -21758,6 +21015,19 @@ const AddVendor = _ref => {
21758
21015
  zoneIds: currentZoneCodes
21759
21016
  }));
21760
21017
  }
21018
+ const startDate = data === null || data === void 0 ? void 0 : data.contractStartDate;
21019
+ const endDate = data === null || data === void 0 ? void 0 : data.contractEndDate;
21020
+ if (startDate && endDate) {
21021
+ const isInvalid = new Date(endDate) < new Date(startDate);
21022
+ if (isInvalid && (showToast === null || showToast === void 0 ? void 0 : showToast.action) !== "INVALID_CONTRACT_DATE") {
21023
+ setShowToast({
21024
+ key: "error",
21025
+ action: "INVALID_CONTRACT_DATE"
21026
+ });
21027
+ } else if (!isInvalid && showToast) {
21028
+ setShowToast(null);
21029
+ }
21030
+ }
21761
21031
  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$serviceType2 = data.serviceType) === null || _data$serviceType2 === void 0 ? void 0 : _data$serviceType2.code);
21762
21032
  if (isVendorDetailsFilled) {
21763
21033
  if (currentStep === 1) {
@@ -21868,10 +21138,7 @@ const AddVendor = _ref => {
21868
21138
  if (isEkyc) {
21869
21139
  var _mergedData$zoneIds, _mergedData$clusterId;
21870
21140
  vendorData = _extends({}, vendorData, {
21871
- zoneIds: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$zoneIds = mergedData.zoneIds) === null || _mergedData$zoneIds === void 0 ? void 0 : _mergedData$zoneIds.map(z => {
21872
- var _z$;
21873
- return z === null || z === void 0 ? void 0 : (_z$ = z[1]) === null || _z$ === void 0 ? void 0 : _z$.code;
21874
- })) || [],
21141
+ 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)) || [],
21875
21142
  clusterIds: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$clusterId = mergedData.clusterIds) === null || _mergedData$clusterId === void 0 ? void 0 : _mergedData$clusterId.map(c => {
21876
21143
  var _c$;
21877
21144
  return c === null || c === void 0 ? void 0 : (_c$ = c[1]) === null || _c$ === void 0 ? void 0 : _c$.code;
@@ -21895,17 +21162,18 @@ const AddVendor = _ref => {
21895
21162
  key: "error",
21896
21163
  action: error
21897
21164
  });
21898
- setTimeout(closeToast, 5000);
21899
21165
  },
21900
- onSuccess: (data, variables) => {
21901
- setShowToast({
21902
- key: "success",
21903
- action: "ADD_VENDOR"
21166
+ onSuccess: () => {
21167
+ history.push({
21168
+ pathname: "/digit-ui/" + userType + "/vendor/search-vendor",
21169
+ state: {
21170
+ showSuccessToast: true,
21171
+ message: {
21172
+ key: "success",
21173
+ action: "ES_VENDOR_ADD_VENDOR"
21174
+ }
21175
+ }
21904
21176
  });
21905
- setTimeout(() => {
21906
- closeToast();
21907
- history.push("/digit-ui/employee/vendor/search-vendor");
21908
- }, 2000);
21909
21177
  }
21910
21178
  });
21911
21179
  };
@@ -21932,7 +21200,7 @@ const AddVendor = _ref => {
21932
21200
  }
21933
21201
  }, /*#__PURE__*/React.createElement(FormComposer, {
21934
21202
  config: Config,
21935
- userType: "employee",
21203
+ userType: userType,
21936
21204
  onFormValueChange: onFormValueChange,
21937
21205
  label: t("ES_COMMON_APPLICATION_SUBMIT"),
21938
21206
  onSubmit: onSubmit,
@@ -21941,7 +21209,7 @@ const AddVendor = _ref => {
21941
21209
  noBreakLine: true
21942
21210
  }), showToast && /*#__PURE__*/React.createElement(Toast, {
21943
21211
  error: showToast.key === "error",
21944
- label: t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_SUCCESS" : showToast.action),
21212
+ label: showToast.action === "INVALID_CONTRACT_DATE" ? t("ES_VENDOR_CONTRACT_END_DATE") + " cannot be earlier than " + t("ES_VENDOR_CONTRACT_START_DATE") : t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_SUCCESS" : showToast.action),
21945
21213
  onClose: closeToast
21946
21214
  })));
21947
21215
  };
@@ -22102,9 +21370,7 @@ const componentsToRegister = {
22102
21370
  FSMSelectRating: SelectRating,
22103
21371
  FSMDsoDashboard: DsoDashboard,
22104
21372
  FSMRegistry,
22105
- VendorDetails,
22106
21373
  AddVendor,
22107
- EditVendor,
22108
21374
  VehicleDetails,
22109
21375
  AddVehicle,
22110
21376
  EditVehicle,