@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.
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,
@@ -3520,7 +3520,7 @@ const SupervisorConfig = function (t, agencies, reportingManagers, disabled) {
3520
3520
  isMandatory: true,
3521
3521
  type: "component",
3522
3522
  key: "gender",
3523
- component: "SelectGender"
3523
+ component: "SelectEkycDropdown"
3524
3524
  }, {
3525
3525
  label: t("ES_FSM_REGISTRY_NEW_DOB"),
3526
3526
  isMandatory: true,
@@ -4678,7 +4678,7 @@ const VendorConfig = function (t, module, genderMenu, update) {
4678
4678
  }
4679
4679
  }, {
4680
4680
  label: "ES_FSM_REGISTRY_NEW_EMAIL",
4681
- isMandatory: false,
4681
+ isMandatory: true,
4682
4682
  type: "text",
4683
4683
  key: "emailId",
4684
4684
  populators: {
@@ -5939,7 +5939,7 @@ const VENDORCreate = _ref => {
5939
5939
  };
5940
5940
 
5941
5941
  const EditVendor = () => {
5942
- var _Digit$UserService$ge, _defaultValues$servic2;
5942
+ var _Digit$UserService$ge, _dsoDetails$owner1, _defaultValues$servic2;
5943
5943
  const tenantId = Digit.ULBService.getCurrentTenantId();
5944
5944
  const _useTranslation = reactI18next.useTranslation(),
5945
5945
  t = _useTranslation.t;
@@ -6101,6 +6101,16 @@ const EditVendor = () => {
6101
6101
  })
6102
6102
  }));
6103
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]);
6104
6114
  const onFormValueChange = (setValue, data) => {
6105
6115
  var _data$serviceType, _data$serviceType2, _data$serviceType2$co, _data$serviceType3, _data$serviceType3$i;
6106
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);
@@ -6120,7 +6130,7 @@ const EditVendor = () => {
6120
6130
  setShowToast(null);
6121
6131
  };
6122
6132
  const onSubmit = data => {
6123
- 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;
6124
6134
  const mergedData = data;
6125
6135
  const address = mergedData === null || mergedData === void 0 ? void 0 : mergedData.propertyAddress;
6126
6136
  const pincode = address === null || address === void 0 ? void 0 : address.pincode;
@@ -6180,7 +6190,7 @@ const EditVendor = () => {
6180
6190
  name: (mergedData === null || mergedData === void 0 ? void 0 : mergedData.ownerName) || name,
6181
6191
  fatherOrHusbandName: (mergedData === null || mergedData === void 0 ? void 0 : mergedData.fatherOrHusbandName) || name,
6182
6192
  relationship: (mergedData === null || mergedData === void 0 ? void 0 : (_mergedData$relations = mergedData.relationship) === null || _mergedData$relations === void 0 ? void 0 : _mergedData$relations.code) || "OTHER",
6183
- 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,
6184
6194
  dob: mergedData !== null && mergedData !== void 0 && mergedData.dob ? new Date(mergedData.dob).getTime() : new Date("1/1/1970").getTime(),
6185
6195
  emailId: emailId || "",
6186
6196
  mobileNumber: phone
@@ -6486,17 +6496,58 @@ const EmployeeApp = _ref => {
6486
6496
  };
6487
6497
 
6488
6498
  const VENDORCard = () => {
6499
+ var _vendorCountData$tota;
6489
6500
  const _useTranslation = reactI18next.useTranslation(),
6490
6501
  t = _useTranslation.t;
6491
6502
  const history = reactRouterDom.useHistory();
6492
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
+ });
6493
6546
  let hasAccess = Digit.Utils.vendorAccess() || Digit.UserService.hasAccess(["WT_VENDOR", "MT_VENDOR"]);
6494
6547
  if (isCitizen) {
6495
6548
  hasAccess = Digit.UserService.hasAccess(["WT_VENDOR", "EKYC_VENDOR", "EKYC_SUPERVISOR"]);
6496
6549
  }
6497
- if (!hasAccess) {
6498
- return null;
6499
- }
6550
+ if (!hasAccess) return null;
6500
6551
  const links = [{
6501
6552
  label: t("VENDOR_NEW_REGISTERATION"),
6502
6553
  link: isCitizen ? "/digit-ui/citizen/vendor/registry/new-vendor" : "/digit-ui/employee/vendor/registry/new-vendor"
@@ -6509,7 +6560,7 @@ const VENDORCard = () => {
6509
6560
  Icon: /*#__PURE__*/React__default.createElement(digitUiReactComponents.PropertyHouse, null),
6510
6561
  moduleName: t("TITLE_VENDOR_MANAGEMENT"),
6511
6562
  kpis: [{
6512
- count: 0,
6563
+ count: (_vendorCountData$tota = vendorCountData === null || vendorCountData === void 0 ? void 0 : vendorCountData.totalCount) != null ? _vendorCountData$tota : 0,
6513
6564
  label: t("Inbox"),
6514
6565
  link: isCitizen ? "/digit-ui/citizen/vendor/search-vendor" : "/digit-ui/employee/vendor/search-vendor"
6515
6566
  }],
@@ -9657,12 +9708,21 @@ const SelectEkycZones = _ref => {
9657
9708
  } else {
9658
9709
  let vendorZoneCodes = [];
9659
9710
  if (Array.isArray(matchedVendor === null || matchedVendor === void 0 ? void 0 : matchedVendor.zoneIds) && matchedVendor.zoneIds.length > 0) {
9660
- 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);
9661
9712
  } else if (matchedVendor !== null && matchedVendor !== void 0 && matchedVendor.assignedZoneId) {
9662
- vendorZoneCodes = matchedVendor.assignedZoneId.split(",").map(z => z.trim().toUpperCase()).filter(Boolean);
9713
+ vendorZoneCodes = matchedVendor.assignedZoneId.split(",").map(z => z.trim()).filter(Boolean);
9663
9714
  }
9664
9715
  if (vendorZoneCodes.length > 0) {
9665
- 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
+ }
9666
9726
  } else {
9667
9727
  activeZros = [];
9668
9728
  }
@@ -9674,12 +9734,21 @@ const SelectEkycZones = _ref => {
9674
9734
  } else {
9675
9735
  let supervisorZoneCodes = [];
9676
9736
  if (Array.isArray(matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.zoneIds) && matchedSupervisor.zoneIds.length > 0) {
9677
- 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);
9678
9738
  } else if (matchedSupervisor !== null && matchedSupervisor !== void 0 && matchedSupervisor.assignedZoneId) {
9679
- supervisorZoneCodes = matchedSupervisor.assignedZoneId.split(",").map(z => z.trim().toUpperCase()).filter(Boolean);
9739
+ supervisorZoneCodes = matchedSupervisor.assignedZoneId.split(",").map(z => z.trim()).filter(Boolean);
9680
9740
  }
9681
9741
  if (supervisorZoneCodes.length > 0) {
9682
- 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
+ }
9683
9752
  } else {
9684
9753
  activeZros = [];
9685
9754
  }
@@ -10581,7 +10650,8 @@ const VENDORLinks = _ref3 => {
10581
10650
  const VENDORComponents = {
10582
10651
  VENDORCard,
10583
10652
  VENDORModule,
10584
- VENDORLinks
10653
+ VENDORLinks,
10654
+ SelectEkycZones
10585
10655
  };
10586
10656
 
10587
10657
  exports.VENDORComponents = VENDORComponents;