@djb25/digit-ui-module-vendor 1.0.69 → 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,
@@ -2385,17 +2385,47 @@ const VendorInbox = props => {
2385
2385
  const getCSVExportData = React.useCallback(function () {
2386
2386
  try {
2387
2387
  let _exit = false;
2388
- function _temp8(_result) {
2388
+ function _temp10(_result) {
2389
2389
  let _exit2 = false;
2390
2390
  if (_exit) return _result;
2391
- const _temp6 = function () {
2391
+ function _temp0(_result2) {
2392
+ let _exit3 = false;
2393
+ if (_exit2) return _result2;
2394
+ const _temp8 = function () {
2395
+ if (props.selectedTab === "VENDOR") {
2396
+ return _catch(function () {
2397
+ var _props$searchParams, _props$searchParams2;
2398
+ return Promise.resolve(Digit.FSMService.vendorSearch(tenantId, {
2399
+ status: "ACTIVE,DISABLED",
2400
+ name: (_props$searchParams = props.searchParams) === null || _props$searchParams === void 0 ? void 0 : _props$searchParams.name,
2401
+ mobileNumber: ((_props$searchParams2 = props.searchParams) === null || _props$searchParams2 === void 0 ? void 0 : _props$searchParams2.mobileNumber) || undefined,
2402
+ limit: 100000,
2403
+ offset: 0
2404
+ })).then(function (response) {
2405
+ const _temp6 = (response === null || response === void 0 ? void 0 : response.vendors) || (response === null || response === void 0 ? void 0 : response.vendor) || [];
2406
+ _exit3 = true;
2407
+ return _temp6;
2408
+ });
2409
+ }, function (e) {
2410
+ console.error(e);
2411
+ const _temp7 = [];
2412
+ _exit3 = true;
2413
+ return _temp7;
2414
+ });
2415
+ }
2416
+ }();
2417
+ return _temp8 && _temp8.then ? _temp8.then(function (_result3) {
2418
+ return _exit3 ? _result3 : tableData;
2419
+ }) : _exit3 ? _temp8 : tableData;
2420
+ }
2421
+ const _temp9 = function () {
2392
2422
  if (props.selectedTab === "SURVEYOR") {
2393
2423
  return _catch(function () {
2394
- var _props$searchParams, _props$searchParams2;
2424
+ var _props$searchParams3, _props$searchParams4;
2395
2425
  return Promise.resolve(Digit.FSMService.surveyorSearch(tenantId, {
2396
2426
  status: "ACTIVE,DISABLED",
2397
- name: (_props$searchParams = props.searchParams) === null || _props$searchParams === void 0 ? void 0 : _props$searchParams.name,
2398
- mobileNumber: ((_props$searchParams2 = props.searchParams) === null || _props$searchParams2 === void 0 ? void 0 : _props$searchParams2.mobileNumber) || undefined,
2427
+ name: (_props$searchParams3 = props.searchParams) === null || _props$searchParams3 === void 0 ? void 0 : _props$searchParams3.name,
2428
+ mobileNumber: ((_props$searchParams4 = props.searchParams) === null || _props$searchParams4 === void 0 ? void 0 : _props$searchParams4.mobileNumber) || undefined,
2399
2429
  limit: 100000,
2400
2430
  offset: 0
2401
2431
  })).then(function (response) {
@@ -2411,18 +2441,16 @@ const VendorInbox = props => {
2411
2441
  });
2412
2442
  }
2413
2443
  }();
2414
- return _temp6 && _temp6.then ? _temp6.then(function (_result2) {
2415
- return _exit2 ? _result2 : tableData;
2416
- }) : _exit2 ? _temp6 : tableData;
2444
+ return _temp9 && _temp9.then ? _temp9.then(_temp0) : _temp0(_temp9);
2417
2445
  }
2418
- const _temp7 = function () {
2446
+ const _temp1 = function () {
2419
2447
  if (props.selectedTab === "SUPERVISOR") {
2420
2448
  return _catch(function () {
2421
- var _props$searchParams3, _props$searchParams4;
2449
+ var _props$searchParams5, _props$searchParams6;
2422
2450
  return Promise.resolve(Digit.FSMService.supervisorSearch(tenantId, {
2423
2451
  status: "ACTIVE,DISABLED",
2424
- name: (_props$searchParams3 = props.searchParams) === null || _props$searchParams3 === void 0 ? void 0 : _props$searchParams3.name,
2425
- mobileNumber: ((_props$searchParams4 = props.searchParams) === null || _props$searchParams4 === void 0 ? void 0 : _props$searchParams4.mobileNumber) || undefined,
2452
+ name: (_props$searchParams5 = props.searchParams) === null || _props$searchParams5 === void 0 ? void 0 : _props$searchParams5.name,
2453
+ mobileNumber: ((_props$searchParams6 = props.searchParams) === null || _props$searchParams6 === void 0 ? void 0 : _props$searchParams6.mobileNumber) || undefined,
2426
2454
  limit: 100000,
2427
2455
  offset: 0
2428
2456
  })).then(function (response) {
@@ -2438,7 +2466,7 @@ const VendorInbox = props => {
2438
2466
  });
2439
2467
  }
2440
2468
  }();
2441
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
2469
+ return Promise.resolve(_temp1 && _temp1.then ? _temp1.then(_temp10) : _temp10(_temp1));
2442
2470
  } catch (e) {
2443
2471
  return Promise.reject(e);
2444
2472
  }
@@ -3489,7 +3517,7 @@ const SupervisorConfig = function (t, agencies, reportingManagers, disabled) {
3489
3517
  isMandatory: true,
3490
3518
  type: "component",
3491
3519
  key: "gender",
3492
- component: "SelectGender"
3520
+ component: "SelectEkycDropdown"
3493
3521
  }, {
3494
3522
  label: t("ES_FSM_REGISTRY_NEW_DOB"),
3495
3523
  isMandatory: true,
@@ -4647,7 +4675,7 @@ const VendorConfig = function (t, module, genderMenu, update) {
4647
4675
  }
4648
4676
  }, {
4649
4677
  label: "ES_FSM_REGISTRY_NEW_EMAIL",
4650
- isMandatory: false,
4678
+ isMandatory: true,
4651
4679
  type: "text",
4652
4680
  key: "emailId",
4653
4681
  populators: {
@@ -5908,7 +5936,7 @@ const VENDORCreate = _ref => {
5908
5936
  };
5909
5937
 
5910
5938
  const EditVendor = () => {
5911
- var _Digit$UserService$ge, _defaultValues$servic2;
5939
+ var _Digit$UserService$ge, _dsoDetails$owner1, _defaultValues$servic2;
5912
5940
  const tenantId = Digit.ULBService.getCurrentTenantId();
5913
5941
  const _useTranslation = useTranslation(),
5914
5942
  t = _useTranslation.t;
@@ -6070,6 +6098,16 @@ const EditVendor = () => {
6070
6098
  })
6071
6099
  }));
6072
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]);
6073
6111
  const onFormValueChange = (setValue, data) => {
6074
6112
  var _data$serviceType, _data$serviceType2, _data$serviceType2$co, _data$serviceType3, _data$serviceType3$i;
6075
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);
@@ -6089,7 +6127,7 @@ const EditVendor = () => {
6089
6127
  setShowToast(null);
6090
6128
  };
6091
6129
  const onSubmit = data => {
6092
- 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;
6093
6131
  const mergedData = data;
6094
6132
  const address = mergedData === null || mergedData === void 0 ? void 0 : mergedData.propertyAddress;
6095
6133
  const pincode = address === null || address === void 0 ? void 0 : address.pincode;
@@ -6149,7 +6187,7 @@ const EditVendor = () => {
6149
6187
  name: (mergedData === null || mergedData === void 0 ? void 0 : mergedData.ownerName) || name,
6150
6188
  fatherOrHusbandName: (mergedData === null || mergedData === void 0 ? void 0 : mergedData.fatherOrHusbandName) || name,
6151
6189
  relationship: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$relations = mergedData.relationship) === null || _mergedData$relations === void 0 ? void 0 : _mergedData$relations.code) || "OTHER",
6152
- 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,
6153
6191
  dob: mergedData !== null && mergedData !== void 0 && mergedData.dob ? new Date(mergedData.dob).getTime() : new Date("1/1/1970").getTime(),
6154
6192
  emailId: emailId || "",
6155
6193
  mobileNumber: phone
@@ -6455,17 +6493,58 @@ const EmployeeApp = _ref => {
6455
6493
  };
6456
6494
 
6457
6495
  const VENDORCard = () => {
6496
+ var _vendorCountData$tota;
6458
6497
  const _useTranslation = useTranslation(),
6459
6498
  t = _useTranslation.t;
6460
6499
  const history = useHistory();
6461
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
+ });
6462
6543
  let hasAccess = Digit.Utils.vendorAccess() || Digit.UserService.hasAccess(["WT_VENDOR", "MT_VENDOR"]);
6463
6544
  if (isCitizen) {
6464
6545
  hasAccess = Digit.UserService.hasAccess(["WT_VENDOR", "EKYC_VENDOR", "EKYC_SUPERVISOR"]);
6465
6546
  }
6466
- if (!hasAccess) {
6467
- return null;
6468
- }
6547
+ if (!hasAccess) return null;
6469
6548
  const links = [{
6470
6549
  label: t("VENDOR_NEW_REGISTERATION"),
6471
6550
  link: isCitizen ? "/digit-ui/citizen/vendor/registry/new-vendor" : "/digit-ui/employee/vendor/registry/new-vendor"
@@ -6478,7 +6557,7 @@ const VENDORCard = () => {
6478
6557
  Icon: /*#__PURE__*/React.createElement(PropertyHouse, null),
6479
6558
  moduleName: t("TITLE_VENDOR_MANAGEMENT"),
6480
6559
  kpis: [{
6481
- count: 0,
6560
+ count: (_vendorCountData$tota = vendorCountData === null || vendorCountData === void 0 ? void 0 : vendorCountData.totalCount) != null ? _vendorCountData$tota : 0,
6482
6561
  label: t("Inbox"),
6483
6562
  link: isCitizen ? "/digit-ui/citizen/vendor/search-vendor" : "/digit-ui/employee/vendor/search-vendor"
6484
6563
  }],
@@ -9626,12 +9705,21 @@ const SelectEkycZones = _ref => {
9626
9705
  } else {
9627
9706
  let vendorZoneCodes = [];
9628
9707
  if (Array.isArray(matchedVendor === null || matchedVendor === void 0 ? void 0 : matchedVendor.zoneIds) && matchedVendor.zoneIds.length > 0) {
9629
- 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);
9630
9709
  } else if (matchedVendor !== null && matchedVendor !== void 0 && matchedVendor.assignedZoneId) {
9631
- vendorZoneCodes = matchedVendor.assignedZoneId.split(",").map(z => z.trim().toUpperCase()).filter(Boolean);
9710
+ vendorZoneCodes = matchedVendor.assignedZoneId.split(",").map(z => z.trim()).filter(Boolean);
9632
9711
  }
9633
9712
  if (vendorZoneCodes.length > 0) {
9634
- 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
+ }
9635
9723
  } else {
9636
9724
  activeZros = [];
9637
9725
  }
@@ -9643,12 +9731,21 @@ const SelectEkycZones = _ref => {
9643
9731
  } else {
9644
9732
  let supervisorZoneCodes = [];
9645
9733
  if (Array.isArray(matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.zoneIds) && matchedSupervisor.zoneIds.length > 0) {
9646
- 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);
9647
9735
  } else if (matchedSupervisor !== null && matchedSupervisor !== void 0 && matchedSupervisor.assignedZoneId) {
9648
- supervisorZoneCodes = matchedSupervisor.assignedZoneId.split(",").map(z => z.trim().toUpperCase()).filter(Boolean);
9736
+ supervisorZoneCodes = matchedSupervisor.assignedZoneId.split(",").map(z => z.trim()).filter(Boolean);
9649
9737
  }
9650
9738
  if (supervisorZoneCodes.length > 0) {
9651
- 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
+ }
9652
9749
  } else {
9653
9750
  activeZros = [];
9654
9751
  }
@@ -10550,7 +10647,8 @@ const VENDORLinks = _ref3 => {
10550
10647
  const VENDORComponents = {
10551
10648
  VENDORCard,
10552
10649
  VENDORModule,
10553
- VENDORLinks
10650
+ VENDORLinks,
10651
+ SelectEkycZones
10554
10652
  };
10555
10653
 
10556
10654
  export { VENDORComponents, VENDORLinks, VENDORModule };