@djb25/digit-ui-module-vendor 1.0.70 → 1.0.71

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.
@@ -2,7 +2,7 @@ import React, { useState, useMemo, useEffect, useCallback, useReducer, useRef }
2
2
  import { useHistory, Link, useLocation, useParams, useRouteMatch, Switch, Route, Redirect } from 'react-router-dom';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { Loader, VerticalTimeline, FormComposer, Toast, Card, ShippingTruck, Table, CheckBox, 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
- import { useQueryClient } from 'react-query';
5
+ import { useQueryClient, useQuery } from 'react-query';
6
6
  import { useForm, Controller } from 'react-hook-form';
7
7
 
8
8
  function _extends() {
@@ -94,7 +94,7 @@ const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
94
94
  isMandatory: true,
95
95
  type: "component",
96
96
  key: "gender",
97
- component: "SelectGender"
97
+ component: "SelectEkycDropdown"
98
98
  }, {
99
99
  label: t("ES_FSM_REGISTRY_NEW_DOB"),
100
100
  isMandatory: true,
@@ -3517,7 +3517,7 @@ const SupervisorConfig = function (t, agencies, reportingManagers, disabled) {
3517
3517
  isMandatory: true,
3518
3518
  type: "component",
3519
3519
  key: "gender",
3520
- component: "SelectGender"
3520
+ component: "SelectEkycDropdown"
3521
3521
  }, {
3522
3522
  label: t("ES_FSM_REGISTRY_NEW_DOB"),
3523
3523
  isMandatory: true,
@@ -4675,7 +4675,7 @@ const VendorConfig = function (t, module, genderMenu, update) {
4675
4675
  }
4676
4676
  }, {
4677
4677
  label: "ES_FSM_REGISTRY_NEW_EMAIL",
4678
- isMandatory: false,
4678
+ isMandatory: true,
4679
4679
  type: "text",
4680
4680
  key: "emailId",
4681
4681
  populators: {
@@ -5936,7 +5936,7 @@ const VENDORCreate = _ref => {
5936
5936
  };
5937
5937
 
5938
5938
  const EditVendor = () => {
5939
- var _Digit$UserService$ge, _defaultValues$servic2;
5939
+ var _Digit$UserService$ge, _dsoDetails$owner1, _defaultValues$servic2;
5940
5940
  const tenantId = Digit.ULBService.getCurrentTenantId();
5941
5941
  const _useTranslation = useTranslation(),
5942
5942
  t = _useTranslation.t;
@@ -6098,6 +6098,16 @@ const EditVendor = () => {
6098
6098
  })
6099
6099
  }));
6100
6100
  }, [dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.zoneIds, zones]);
6101
+ useEffect(() => {
6102
+ var _dsoDetails$owner0;
6103
+ if (!genderMenu.length || !(dsoDetails !== null && dsoDetails !== void 0 && (_dsoDetails$owner0 = dsoDetails.owner) !== null && _dsoDetails$owner0 !== void 0 && _dsoDetails$owner0.gender)) return;
6104
+ const matchedGender = genderMenu.find(ele => ele.code === dsoDetails.owner.gender);
6105
+ if (matchedGender) {
6106
+ setDefaultValues(prev => _extends({}, prev, {
6107
+ gender: matchedGender
6108
+ }));
6109
+ }
6110
+ }, [genderMenu, dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner1 = dsoDetails.owner) === null || _dsoDetails$owner1 === void 0 ? void 0 : _dsoDetails$owner1.gender]);
6101
6111
  const onFormValueChange = (setValue, data) => {
6102
6112
  var _data$serviceType, _data$serviceType2, _data$serviceType2$co, _data$serviceType3, _data$serviceType3$i;
6103
6113
  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);
@@ -6117,7 +6127,7 @@ const EditVendor = () => {
6117
6127
  setShowToast(null);
6118
6128
  };
6119
6129
  const onSubmit = data => {
6120
- var _address$city, _address$city2, _address$city3, _address$city4, _address$locality, _address$locality2, _address$ward, _address$ward2, _mergedData$plotNo, _mergedData$buildingN, _mergedData$serviceTy, _mergedData$serviceTy2, _mergedData$serviceTy3, _mergedData$serviceTy4, _mergedData$address, _mergedData$address2, _mergedData$relations, _mergedData$gender, _mergedData$serviceTy5;
6130
+ var _address$city, _address$city2, _address$city3, _address$city4, _address$locality, _address$locality2, _address$ward, _address$ward2, _mergedData$plotNo, _mergedData$buildingN, _mergedData$serviceTy, _mergedData$serviceTy2, _mergedData$serviceTy3, _mergedData$serviceTy4, _mergedData$address, _mergedData$address2, _mergedData$relations, _mergedData$serviceTy5;
6121
6131
  const mergedData = data;
6122
6132
  const address = mergedData === null || mergedData === void 0 ? void 0 : mergedData.propertyAddress;
6123
6133
  const pincode = address === null || address === void 0 ? void 0 : address.pincode;
@@ -6177,7 +6187,7 @@ const EditVendor = () => {
6177
6187
  name: (mergedData === null || mergedData === void 0 ? void 0 : mergedData.ownerName) || name,
6178
6188
  fatherOrHusbandName: (mergedData === null || mergedData === void 0 ? void 0 : mergedData.fatherOrHusbandName) || name,
6179
6189
  relationship: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$relations = mergedData.relationship) === null || _mergedData$relations === void 0 ? void 0 : _mergedData$relations.code) || "OTHER",
6180
- gender: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$gender = mergedData.gender) === null || _mergedData$gender === void 0 ? void 0 : _mergedData$gender.code) || "MALE",
6190
+ gender: mergedData === null || mergedData === void 0 ? void 0 : mergedData.gender,
6181
6191
  dob: mergedData !== null && mergedData !== void 0 && mergedData.dob ? new Date(mergedData.dob).getTime() : new Date("1/1/1970").getTime(),
6182
6192
  emailId: emailId || "",
6183
6193
  mobileNumber: phone
@@ -6483,17 +6493,58 @@ const EmployeeApp = _ref => {
6483
6493
  };
6484
6494
 
6485
6495
  const VENDORCard = () => {
6496
+ var _vendorCountData$tota;
6486
6497
  const _useTranslation = useTranslation(),
6487
6498
  t = _useTranslation.t;
6488
6499
  const history = useHistory();
6489
6500
  const isCitizen = window.location.pathname.toLowerCase().includes("citizen");
6501
+ const tenantId = Digit.ULBService.getStateId();
6502
+ const _useQuery = useQuery(["VENDOR_CARD_VENDOR_COUNT", tenantId], () => Digit.FSMService.vendorSearch(tenantId, {
6503
+ status: "ACTIVE",
6504
+ limit: 1,
6505
+ offset: 0
6506
+ }), {
6507
+ enabled: true,
6508
+ staleTime: 30000
6509
+ }),
6510
+ vendorCountData = _useQuery.data;
6511
+ const _useQuery2 = useQuery(["VENDOR_CARD_DRIVER_COUNT", tenantId], () => Digit.FSMService.driverSearch(tenantId, {
6512
+ status: "ACTIVE",
6513
+ limit: 1,
6514
+ offset: 0
6515
+ }), {
6516
+ enabled: true,
6517
+ staleTime: 30000
6518
+ });
6519
+ const _useQuery3 = useQuery(["VENDOR_CARD_VEHICLE_COUNT", tenantId], () => Digit.FSMService.vehiclesSearch(tenantId, {
6520
+ status: "ACTIVE",
6521
+ limit: 1,
6522
+ offset: 0
6523
+ }), {
6524
+ enabled: true,
6525
+ staleTime: 30000
6526
+ });
6527
+ const _useQuery4 = useQuery(["VENDOR_CARD_SUPERVISOR_COUNT", tenantId], () => Digit.FSMService.supervisorSearch(tenantId, {
6528
+ status: "ACTIVE,DISABLED",
6529
+ limit: 1,
6530
+ offset: 0
6531
+ }), {
6532
+ enabled: true,
6533
+ staleTime: 30000
6534
+ });
6535
+ const _useQuery5 = useQuery(["VENDOR_CARD_SURVEYOR_COUNT", tenantId], () => Digit.FSMService.surveyorSearch(tenantId, {
6536
+ status: "ACTIVE,DISABLED",
6537
+ limit: 1,
6538
+ offset: 0
6539
+ }), {
6540
+ enabled: true,
6541
+ staleTime: 30000
6542
+ });
6490
6543
  let hasAccess = Digit.Utils.vendorAccess() || Digit.UserService.hasAccess(["WT_VENDOR", "MT_VENDOR"]);
6491
6544
  if (isCitizen) {
6492
6545
  hasAccess = Digit.UserService.hasAccess(["WT_VENDOR", "EKYC_VENDOR", "EKYC_SUPERVISOR"]);
6493
6546
  }
6494
- if (!hasAccess) {
6495
- return null;
6496
- }
6547
+ if (!hasAccess) return null;
6497
6548
  const links = [{
6498
6549
  label: t("VENDOR_NEW_REGISTERATION"),
6499
6550
  link: isCitizen ? "/digit-ui/citizen/vendor/registry/new-vendor" : "/digit-ui/employee/vendor/registry/new-vendor"
@@ -6506,7 +6557,7 @@ const VENDORCard = () => {
6506
6557
  Icon: /*#__PURE__*/React.createElement(PropertyHouse, null),
6507
6558
  moduleName: t("TITLE_VENDOR_MANAGEMENT"),
6508
6559
  kpis: [{
6509
- count: 0,
6560
+ count: (_vendorCountData$tota = vendorCountData === null || vendorCountData === void 0 ? void 0 : vendorCountData.totalCount) != null ? _vendorCountData$tota : 0,
6510
6561
  label: t("Inbox"),
6511
6562
  link: isCitizen ? "/digit-ui/citizen/vendor/search-vendor" : "/digit-ui/employee/vendor/search-vendor"
6512
6563
  }],
@@ -9654,12 +9705,21 @@ const SelectEkycZones = _ref => {
9654
9705
  } else {
9655
9706
  let vendorZoneCodes = [];
9656
9707
  if (Array.isArray(matchedVendor === null || matchedVendor === void 0 ? void 0 : matchedVendor.zoneIds) && matchedVendor.zoneIds.length > 0) {
9657
- vendorZoneCodes = matchedVendor.zoneIds.map(z => z.trim().toUpperCase()).filter(Boolean);
9708
+ vendorZoneCodes = matchedVendor.zoneIds.map(z => typeof z === "object" ? (z === null || z === void 0 ? void 0 : z.code) || (z === null || z === void 0 ? void 0 : z.name) : z).filter(Boolean);
9658
9709
  } else if (matchedVendor !== null && matchedVendor !== void 0 && matchedVendor.assignedZoneId) {
9659
- vendorZoneCodes = matchedVendor.assignedZoneId.split(",").map(z => z.trim().toUpperCase()).filter(Boolean);
9710
+ vendorZoneCodes = matchedVendor.assignedZoneId.split(",").map(z => z.trim()).filter(Boolean);
9660
9711
  }
9661
9712
  if (vendorZoneCodes.length > 0) {
9662
- activeZros = activeZros.filter(zro => vendorZoneCodes.includes(zro.code.trim().toUpperCase()));
9713
+ const upperVendorCodes = vendorZoneCodes.map(z => z.toString().trim().toUpperCase());
9714
+ const matchedMdmsZros = activeZros.filter(zro => upperVendorCodes.includes(zro.code.trim().toUpperCase()));
9715
+ if (matchedMdmsZros.length > 0) {
9716
+ activeZros = matchedMdmsZros;
9717
+ } else {
9718
+ activeZros = vendorZoneCodes.map(z => ({
9719
+ code: String(z).trim(),
9720
+ name: t(String(z).trim()) || String(z).trim()
9721
+ }));
9722
+ }
9663
9723
  } else {
9664
9724
  activeZros = [];
9665
9725
  }
@@ -9671,12 +9731,21 @@ const SelectEkycZones = _ref => {
9671
9731
  } else {
9672
9732
  let supervisorZoneCodes = [];
9673
9733
  if (Array.isArray(matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.zoneIds) && matchedSupervisor.zoneIds.length > 0) {
9674
- supervisorZoneCodes = matchedSupervisor.zoneIds.map(z => z.trim().toUpperCase()).filter(Boolean);
9734
+ supervisorZoneCodes = matchedSupervisor.zoneIds.map(z => typeof z === "object" ? (z === null || z === void 0 ? void 0 : z.code) || (z === null || z === void 0 ? void 0 : z.name) : z).filter(Boolean);
9675
9735
  } else if (matchedSupervisor !== null && matchedSupervisor !== void 0 && matchedSupervisor.assignedZoneId) {
9676
- supervisorZoneCodes = matchedSupervisor.assignedZoneId.split(",").map(z => z.trim().toUpperCase()).filter(Boolean);
9736
+ supervisorZoneCodes = matchedSupervisor.assignedZoneId.split(",").map(z => z.trim()).filter(Boolean);
9677
9737
  }
9678
9738
  if (supervisorZoneCodes.length > 0) {
9679
- activeZros = activeZros.filter(zro => supervisorZoneCodes.includes(zro.code.trim().toUpperCase()));
9739
+ const upperSupCodes = supervisorZoneCodes.map(z => z.toString().trim().toUpperCase());
9740
+ const matchedMdmsZros = activeZros.filter(zro => upperSupCodes.includes(zro.code.trim().toUpperCase()));
9741
+ if (matchedMdmsZros.length > 0) {
9742
+ activeZros = matchedMdmsZros;
9743
+ } else {
9744
+ activeZros = supervisorZoneCodes.map(z => ({
9745
+ code: String(z).trim(),
9746
+ name: t(String(z).trim()) || String(z).trim()
9747
+ }));
9748
+ }
9680
9749
  } else {
9681
9750
  activeZros = [];
9682
9751
  }
@@ -10578,7 +10647,8 @@ const VENDORLinks = _ref3 => {
10578
10647
  const VENDORComponents = {
10579
10648
  VENDORCard,
10580
10649
  VENDORModule,
10581
- VENDORLinks
10650
+ VENDORLinks,
10651
+ SelectEkycZones
10582
10652
  };
10583
10653
 
10584
10654
  export { VENDORComponents, VENDORLinks, VENDORModule };