@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.
package/dist/index.js CHANGED
@@ -97,7 +97,7 @@ const SurveyorConfig = function (t, agencies, reportingManagers, disabled) {
97
97
  isMandatory: true,
98
98
  type: "component",
99
99
  key: "gender",
100
- component: "SelectGender"
100
+ component: "SelectEkycDropdown"
101
101
  }, {
102
102
  label: t("ES_FSM_REGISTRY_NEW_DOB"),
103
103
  isMandatory: true,
@@ -2388,17 +2388,47 @@ const VendorInbox = props => {
2388
2388
  const getCSVExportData = React__default.useCallback(function () {
2389
2389
  try {
2390
2390
  let _exit = false;
2391
- function _temp8(_result) {
2391
+ function _temp10(_result) {
2392
2392
  let _exit2 = false;
2393
2393
  if (_exit) return _result;
2394
- const _temp6 = function () {
2394
+ function _temp0(_result2) {
2395
+ let _exit3 = false;
2396
+ if (_exit2) return _result2;
2397
+ const _temp8 = function () {
2398
+ if (props.selectedTab === "VENDOR") {
2399
+ return _catch(function () {
2400
+ var _props$searchParams, _props$searchParams2;
2401
+ return Promise.resolve(Digit.FSMService.vendorSearch(tenantId, {
2402
+ status: "ACTIVE,DISABLED",
2403
+ name: (_props$searchParams = props.searchParams) === null || _props$searchParams === void 0 ? void 0 : _props$searchParams.name,
2404
+ mobileNumber: ((_props$searchParams2 = props.searchParams) === null || _props$searchParams2 === void 0 ? void 0 : _props$searchParams2.mobileNumber) || undefined,
2405
+ limit: 100000,
2406
+ offset: 0
2407
+ })).then(function (response) {
2408
+ const _temp6 = (response === null || response === void 0 ? void 0 : response.vendors) || (response === null || response === void 0 ? void 0 : response.vendor) || [];
2409
+ _exit3 = true;
2410
+ return _temp6;
2411
+ });
2412
+ }, function (e) {
2413
+ console.error(e);
2414
+ const _temp7 = [];
2415
+ _exit3 = true;
2416
+ return _temp7;
2417
+ });
2418
+ }
2419
+ }();
2420
+ return _temp8 && _temp8.then ? _temp8.then(function (_result3) {
2421
+ return _exit3 ? _result3 : tableData;
2422
+ }) : _exit3 ? _temp8 : tableData;
2423
+ }
2424
+ const _temp9 = function () {
2395
2425
  if (props.selectedTab === "SURVEYOR") {
2396
2426
  return _catch(function () {
2397
- var _props$searchParams, _props$searchParams2;
2427
+ var _props$searchParams3, _props$searchParams4;
2398
2428
  return Promise.resolve(Digit.FSMService.surveyorSearch(tenantId, {
2399
2429
  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,
2430
+ name: (_props$searchParams3 = props.searchParams) === null || _props$searchParams3 === void 0 ? void 0 : _props$searchParams3.name,
2431
+ mobileNumber: ((_props$searchParams4 = props.searchParams) === null || _props$searchParams4 === void 0 ? void 0 : _props$searchParams4.mobileNumber) || undefined,
2402
2432
  limit: 100000,
2403
2433
  offset: 0
2404
2434
  })).then(function (response) {
@@ -2414,18 +2444,16 @@ const VendorInbox = props => {
2414
2444
  });
2415
2445
  }
2416
2446
  }();
2417
- return _temp6 && _temp6.then ? _temp6.then(function (_result2) {
2418
- return _exit2 ? _result2 : tableData;
2419
- }) : _exit2 ? _temp6 : tableData;
2447
+ return _temp9 && _temp9.then ? _temp9.then(_temp0) : _temp0(_temp9);
2420
2448
  }
2421
- const _temp7 = function () {
2449
+ const _temp1 = function () {
2422
2450
  if (props.selectedTab === "SUPERVISOR") {
2423
2451
  return _catch(function () {
2424
- var _props$searchParams3, _props$searchParams4;
2452
+ var _props$searchParams5, _props$searchParams6;
2425
2453
  return Promise.resolve(Digit.FSMService.supervisorSearch(tenantId, {
2426
2454
  status: "ACTIVE,DISABLED",
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,
2455
+ name: (_props$searchParams5 = props.searchParams) === null || _props$searchParams5 === void 0 ? void 0 : _props$searchParams5.name,
2456
+ mobileNumber: ((_props$searchParams6 = props.searchParams) === null || _props$searchParams6 === void 0 ? void 0 : _props$searchParams6.mobileNumber) || undefined,
2429
2457
  limit: 100000,
2430
2458
  offset: 0
2431
2459
  })).then(function (response) {
@@ -2441,7 +2469,7 @@ const VendorInbox = props => {
2441
2469
  });
2442
2470
  }
2443
2471
  }();
2444
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
2472
+ return Promise.resolve(_temp1 && _temp1.then ? _temp1.then(_temp10) : _temp10(_temp1));
2445
2473
  } catch (e) {
2446
2474
  return Promise.reject(e);
2447
2475
  }
@@ -3492,7 +3520,7 @@ const SupervisorConfig = function (t, agencies, reportingManagers, disabled) {
3492
3520
  isMandatory: true,
3493
3521
  type: "component",
3494
3522
  key: "gender",
3495
- component: "SelectGender"
3523
+ component: "SelectEkycDropdown"
3496
3524
  }, {
3497
3525
  label: t("ES_FSM_REGISTRY_NEW_DOB"),
3498
3526
  isMandatory: true,
@@ -4650,7 +4678,7 @@ const VendorConfig = function (t, module, genderMenu, update) {
4650
4678
  }
4651
4679
  }, {
4652
4680
  label: "ES_FSM_REGISTRY_NEW_EMAIL",
4653
- isMandatory: false,
4681
+ isMandatory: true,
4654
4682
  type: "text",
4655
4683
  key: "emailId",
4656
4684
  populators: {
@@ -5911,7 +5939,7 @@ const VENDORCreate = _ref => {
5911
5939
  };
5912
5940
 
5913
5941
  const EditVendor = () => {
5914
- var _Digit$UserService$ge, _defaultValues$servic2;
5942
+ var _Digit$UserService$ge, _dsoDetails$owner1, _defaultValues$servic2;
5915
5943
  const tenantId = Digit.ULBService.getCurrentTenantId();
5916
5944
  const _useTranslation = reactI18next.useTranslation(),
5917
5945
  t = _useTranslation.t;
@@ -6073,6 +6101,16 @@ const EditVendor = () => {
6073
6101
  })
6074
6102
  }));
6075
6103
  }, [dsoDetails === null || dsoDetails === void 0 ? void 0 : dsoDetails.zoneIds, zones]);
6104
+ React.useEffect(() => {
6105
+ var _dsoDetails$owner0;
6106
+ if (!genderMenu.length || !(dsoDetails !== null && dsoDetails !== void 0 && (_dsoDetails$owner0 = dsoDetails.owner) !== null && _dsoDetails$owner0 !== void 0 && _dsoDetails$owner0.gender)) return;
6107
+ const matchedGender = genderMenu.find(ele => ele.code === dsoDetails.owner.gender);
6108
+ if (matchedGender) {
6109
+ setDefaultValues(prev => _extends({}, prev, {
6110
+ gender: matchedGender
6111
+ }));
6112
+ }
6113
+ }, [genderMenu, dsoDetails === null || dsoDetails === void 0 ? void 0 : (_dsoDetails$owner1 = dsoDetails.owner) === null || _dsoDetails$owner1 === void 0 ? void 0 : _dsoDetails$owner1.gender]);
6076
6114
  const onFormValueChange = (setValue, data) => {
6077
6115
  var _data$serviceType, _data$serviceType2, _data$serviceType2$co, _data$serviceType3, _data$serviceType3$i;
6078
6116
  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);
@@ -6092,7 +6130,7 @@ const EditVendor = () => {
6092
6130
  setShowToast(null);
6093
6131
  };
6094
6132
  const onSubmit = data => {
6095
- 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;
6133
+ 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;
6096
6134
  const mergedData = data;
6097
6135
  const address = mergedData === null || mergedData === void 0 ? void 0 : mergedData.propertyAddress;
6098
6136
  const pincode = address === null || address === void 0 ? void 0 : address.pincode;
@@ -6152,7 +6190,7 @@ const EditVendor = () => {
6152
6190
  name: (mergedData === null || mergedData === void 0 ? void 0 : mergedData.ownerName) || name,
6153
6191
  fatherOrHusbandName: (mergedData === null || mergedData === void 0 ? void 0 : mergedData.fatherOrHusbandName) || name,
6154
6192
  relationship: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$relations = mergedData.relationship) === null || _mergedData$relations === void 0 ? void 0 : _mergedData$relations.code) || "OTHER",
6155
- gender: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$gender = mergedData.gender) === null || _mergedData$gender === void 0 ? void 0 : _mergedData$gender.code) || "MALE",
6193
+ gender: mergedData === null || mergedData === void 0 ? void 0 : mergedData.gender,
6156
6194
  dob: mergedData !== null && mergedData !== void 0 && mergedData.dob ? new Date(mergedData.dob).getTime() : new Date("1/1/1970").getTime(),
6157
6195
  emailId: emailId || "",
6158
6196
  mobileNumber: phone
@@ -6458,17 +6496,58 @@ const EmployeeApp = _ref => {
6458
6496
  };
6459
6497
 
6460
6498
  const VENDORCard = () => {
6499
+ var _vendorCountData$tota;
6461
6500
  const _useTranslation = reactI18next.useTranslation(),
6462
6501
  t = _useTranslation.t;
6463
6502
  const history = reactRouterDom.useHistory();
6464
6503
  const isCitizen = window.location.pathname.toLowerCase().includes("citizen");
6504
+ const tenantId = Digit.ULBService.getStateId();
6505
+ const _useQuery = reactQuery.useQuery(["VENDOR_CARD_VENDOR_COUNT", tenantId], () => Digit.FSMService.vendorSearch(tenantId, {
6506
+ status: "ACTIVE",
6507
+ limit: 1,
6508
+ offset: 0
6509
+ }), {
6510
+ enabled: true,
6511
+ staleTime: 30000
6512
+ }),
6513
+ vendorCountData = _useQuery.data;
6514
+ const _useQuery2 = reactQuery.useQuery(["VENDOR_CARD_DRIVER_COUNT", tenantId], () => Digit.FSMService.driverSearch(tenantId, {
6515
+ status: "ACTIVE",
6516
+ limit: 1,
6517
+ offset: 0
6518
+ }), {
6519
+ enabled: true,
6520
+ staleTime: 30000
6521
+ });
6522
+ const _useQuery3 = reactQuery.useQuery(["VENDOR_CARD_VEHICLE_COUNT", tenantId], () => Digit.FSMService.vehiclesSearch(tenantId, {
6523
+ status: "ACTIVE",
6524
+ limit: 1,
6525
+ offset: 0
6526
+ }), {
6527
+ enabled: true,
6528
+ staleTime: 30000
6529
+ });
6530
+ const _useQuery4 = reactQuery.useQuery(["VENDOR_CARD_SUPERVISOR_COUNT", tenantId], () => Digit.FSMService.supervisorSearch(tenantId, {
6531
+ status: "ACTIVE,DISABLED",
6532
+ limit: 1,
6533
+ offset: 0
6534
+ }), {
6535
+ enabled: true,
6536
+ staleTime: 30000
6537
+ });
6538
+ const _useQuery5 = reactQuery.useQuery(["VENDOR_CARD_SURVEYOR_COUNT", tenantId], () => Digit.FSMService.surveyorSearch(tenantId, {
6539
+ status: "ACTIVE,DISABLED",
6540
+ limit: 1,
6541
+ offset: 0
6542
+ }), {
6543
+ enabled: true,
6544
+ staleTime: 30000
6545
+ });
6465
6546
  let hasAccess = Digit.Utils.vendorAccess() || Digit.UserService.hasAccess(["WT_VENDOR", "MT_VENDOR"]);
6466
6547
  if (isCitizen) {
6467
6548
  hasAccess = Digit.UserService.hasAccess(["WT_VENDOR", "EKYC_VENDOR", "EKYC_SUPERVISOR"]);
6468
6549
  }
6469
- if (!hasAccess) {
6470
- return null;
6471
- }
6550
+ if (!hasAccess) return null;
6472
6551
  const links = [{
6473
6552
  label: t("VENDOR_NEW_REGISTERATION"),
6474
6553
  link: isCitizen ? "/digit-ui/citizen/vendor/registry/new-vendor" : "/digit-ui/employee/vendor/registry/new-vendor"
@@ -6481,7 +6560,7 @@ const VENDORCard = () => {
6481
6560
  Icon: /*#__PURE__*/React__default.createElement(digitUiReactComponents.PropertyHouse, null),
6482
6561
  moduleName: t("TITLE_VENDOR_MANAGEMENT"),
6483
6562
  kpis: [{
6484
- count: 0,
6563
+ count: (_vendorCountData$tota = vendorCountData === null || vendorCountData === void 0 ? void 0 : vendorCountData.totalCount) != null ? _vendorCountData$tota : 0,
6485
6564
  label: t("Inbox"),
6486
6565
  link: isCitizen ? "/digit-ui/citizen/vendor/search-vendor" : "/digit-ui/employee/vendor/search-vendor"
6487
6566
  }],
@@ -9629,12 +9708,21 @@ const SelectEkycZones = _ref => {
9629
9708
  } else {
9630
9709
  let vendorZoneCodes = [];
9631
9710
  if (Array.isArray(matchedVendor === null || matchedVendor === void 0 ? void 0 : matchedVendor.zoneIds) && matchedVendor.zoneIds.length > 0) {
9632
- vendorZoneCodes = matchedVendor.zoneIds.map(z => z.trim().toUpperCase()).filter(Boolean);
9711
+ 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);
9633
9712
  } else if (matchedVendor !== null && matchedVendor !== void 0 && matchedVendor.assignedZoneId) {
9634
- vendorZoneCodes = matchedVendor.assignedZoneId.split(",").map(z => z.trim().toUpperCase()).filter(Boolean);
9713
+ vendorZoneCodes = matchedVendor.assignedZoneId.split(",").map(z => z.trim()).filter(Boolean);
9635
9714
  }
9636
9715
  if (vendorZoneCodes.length > 0) {
9637
- activeZros = activeZros.filter(zro => vendorZoneCodes.includes(zro.code.trim().toUpperCase()));
9716
+ const upperVendorCodes = vendorZoneCodes.map(z => z.toString().trim().toUpperCase());
9717
+ const matchedMdmsZros = activeZros.filter(zro => upperVendorCodes.includes(zro.code.trim().toUpperCase()));
9718
+ if (matchedMdmsZros.length > 0) {
9719
+ activeZros = matchedMdmsZros;
9720
+ } else {
9721
+ activeZros = vendorZoneCodes.map(z => ({
9722
+ code: String(z).trim(),
9723
+ name: t(String(z).trim()) || String(z).trim()
9724
+ }));
9725
+ }
9638
9726
  } else {
9639
9727
  activeZros = [];
9640
9728
  }
@@ -9646,12 +9734,21 @@ const SelectEkycZones = _ref => {
9646
9734
  } else {
9647
9735
  let supervisorZoneCodes = [];
9648
9736
  if (Array.isArray(matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.zoneIds) && matchedSupervisor.zoneIds.length > 0) {
9649
- supervisorZoneCodes = matchedSupervisor.zoneIds.map(z => z.trim().toUpperCase()).filter(Boolean);
9737
+ 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);
9650
9738
  } else if (matchedSupervisor !== null && matchedSupervisor !== void 0 && matchedSupervisor.assignedZoneId) {
9651
- supervisorZoneCodes = matchedSupervisor.assignedZoneId.split(",").map(z => z.trim().toUpperCase()).filter(Boolean);
9739
+ supervisorZoneCodes = matchedSupervisor.assignedZoneId.split(",").map(z => z.trim()).filter(Boolean);
9652
9740
  }
9653
9741
  if (supervisorZoneCodes.length > 0) {
9654
- activeZros = activeZros.filter(zro => supervisorZoneCodes.includes(zro.code.trim().toUpperCase()));
9742
+ const upperSupCodes = supervisorZoneCodes.map(z => z.toString().trim().toUpperCase());
9743
+ const matchedMdmsZros = activeZros.filter(zro => upperSupCodes.includes(zro.code.trim().toUpperCase()));
9744
+ if (matchedMdmsZros.length > 0) {
9745
+ activeZros = matchedMdmsZros;
9746
+ } else {
9747
+ activeZros = supervisorZoneCodes.map(z => ({
9748
+ code: String(z).trim(),
9749
+ name: t(String(z).trim()) || String(z).trim()
9750
+ }));
9751
+ }
9655
9752
  } else {
9656
9753
  activeZros = [];
9657
9754
  }
@@ -10553,7 +10650,8 @@ const VENDORLinks = _ref3 => {
10553
10650
  const VENDORComponents = {
10554
10651
  VENDORCard,
10555
10652
  VENDORModule,
10556
- VENDORLinks
10653
+ VENDORLinks,
10654
+ SelectEkycZones
10557
10655
  };
10558
10656
 
10559
10657
  exports.VENDORComponents = VENDORComponents;