@djb25/digit-ui-module-vendor 1.0.66 → 1.0.67

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
@@ -9612,20 +9612,31 @@ const SelectEkycZones = _ref => {
9612
9612
  return ((_s$id = s.id) === null || _s$id === void 0 ? void 0 : _s$id.toLowerCase()) === (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$uuid = loggedInUser.uuid) === null || _loggedInUser$uuid === void 0 ? void 0 : _loggedInUser$uuid.toLowerCase()) || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : (_s$owner$uuid = _s$owner.uuid) === null || _s$owner$uuid === void 0 ? void 0 : _s$owner$uuid.toLowerCase()) === (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$uuid2 = loggedInUser.uuid) === null || _loggedInUser$uuid2 === void 0 ? void 0 : _loggedInUser$uuid2.toLowerCase()) || ((_s$owner2 = s.owner) === null || _s$owner2 === void 0 ? void 0 : _s$owner2.mobileNumber) === (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber) || s.mobileNo === (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber);
9613
9613
  });
9614
9614
  }, [supervisorSearchResponse, loggedInUser]);
9615
- const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS("dl", "common-masters", ["ZroOfficeList"]),
9616
- zroData = _Digit$Hooks$useCommo.data,
9615
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS("dl", "egov-location", ["TenantBoundary"]),
9616
+ boundaryData = _Digit$Hooks$useCommo.data,
9617
9617
  isLoading = _Digit$Hooks$useCommo.isLoading;
9618
9618
  React.useEffect(() => {
9619
- var _zroData$commonMaste, _zroData$MdmsRes, _zroData$MdmsRes$comm;
9620
- const zroOfficeList = (zroData === null || zroData === void 0 ? void 0 : (_zroData$commonMaste = zroData["common-masters"]) === null || _zroData$commonMaste === void 0 ? void 0 : _zroData$commonMaste.ZroOfficeList) || (zroData === null || zroData === void 0 ? void 0 : (_zroData$MdmsRes = zroData.MdmsRes) === null || _zroData$MdmsRes === void 0 ? void 0 : (_zroData$MdmsRes$comm = _zroData$MdmsRes["common-masters"]) === null || _zroData$MdmsRes$comm === void 0 ? void 0 : _zroData$MdmsRes$comm.ZroOfficeList) || [];
9621
- if (Array.isArray(zroOfficeList)) {
9622
- const activeZros = zroOfficeList.filter(zro => zro && zro.active).map(zro => ({
9623
- code: zro.code,
9624
- name: zro.code
9625
- }));
9626
- setZones(activeZros);
9627
- }
9628
- }, [zroData]);
9619
+ var _boundaryData$egovLo, _boundaryData$MdmsRes, _boundaryData$MdmsRes2;
9620
+ const tenantBoundaryList = (boundaryData === null || boundaryData === void 0 ? void 0 : (_boundaryData$egovLo = boundaryData["egov-location"]) === null || _boundaryData$egovLo === void 0 ? void 0 : _boundaryData$egovLo.TenantBoundary) || (boundaryData === null || boundaryData === void 0 ? void 0 : (_boundaryData$MdmsRes = boundaryData.MdmsRes) === null || _boundaryData$MdmsRes === void 0 ? void 0 : (_boundaryData$MdmsRes2 = _boundaryData$MdmsRes["egov-location"]) === null || _boundaryData$MdmsRes2 === void 0 ? void 0 : _boundaryData$MdmsRes2.TenantBoundary) || [];
9621
+ const zoneMap = {};
9622
+ tenantBoundaryList.forEach(tb => {
9623
+ const walkBoundary = node => {
9624
+ if (!node) return;
9625
+ if (node.label === "Zone" && node.code && node.code !== "UNKNOWN") {
9626
+ if (!zoneMap[node.code]) {
9627
+ zoneMap[node.code] = {
9628
+ code: node.code,
9629
+ name: node.name || node.code
9630
+ };
9631
+ }
9632
+ }
9633
+ (node.children || []).forEach(walkBoundary);
9634
+ };
9635
+ walkBoundary(tb.boundary);
9636
+ });
9637
+ const uniqueZones = Object.values(zoneMap).sort((a, b) => a.name.localeCompare(b.name));
9638
+ setZones(uniqueZones);
9639
+ }, [boundaryData]);
9629
9640
  React.useEffect(() => {
9630
9641
  if (!zones.length || !(formData !== null && formData !== void 0 && formData.zoneIds)) return;
9631
9642
  if (isMultiSelect) {
@@ -9634,7 +9645,10 @@ const SelectEkycZones = _ref => {
9634
9645
  setSelectedZones(formData.zoneIds.filter(Boolean));
9635
9646
  return;
9636
9647
  }
9637
- const selected = zones.filter(zone => zone && (formData.zoneIds.includes(zone.name) || formData.zoneIds.includes(zone.code)));
9648
+ const selected = zones.filter(zone => zone && formData.zoneIds.some(id => {
9649
+ var _zone$code, _zone$name;
9650
+ return id && (id.toString().toUpperCase() === ((_zone$code = zone.code) === null || _zone$code === void 0 ? void 0 : _zone$code.toUpperCase()) || id.toString().toUpperCase() === ((_zone$name = zone.name) === null || _zone$name === void 0 ? void 0 : _zone$name.toUpperCase()));
9651
+ }));
9638
9652
  setSelectedZones(selected);
9639
9653
  if (!initialized.current) {
9640
9654
  initialized.current = true;
@@ -9649,7 +9663,10 @@ const SelectEkycZones = _ref => {
9649
9663
  if (selectedVal && typeof selectedVal === "object") {
9650
9664
  selectedVal = selectedVal.name || selectedVal.code || "";
9651
9665
  }
9652
- const selected = zones.find(zone => zone && (zone.name === selectedVal || zone.code === selectedVal));
9666
+ const selected = zones.find(zone => {
9667
+ var _zone$name2, _selectedVal, _zone$code2, _selectedVal2;
9668
+ return zone && (((_zone$name2 = zone.name) === null || _zone$name2 === void 0 ? void 0 : _zone$name2.toUpperCase()) === ((_selectedVal = selectedVal) === null || _selectedVal === void 0 ? void 0 : _selectedVal.toString().toUpperCase()) || ((_zone$code2 = zone.code) === null || _zone$code2 === void 0 ? void 0 : _zone$code2.toUpperCase()) === ((_selectedVal2 = selectedVal) === null || _selectedVal2 === void 0 ? void 0 : _selectedVal2.toString().toUpperCase()));
9669
+ });
9653
9670
  setSelectedZones(selected ? [selected] : []);
9654
9671
  if (!initialized.current && selected) {
9655
9672
  initialized.current = true;
@@ -9668,7 +9685,7 @@ const SelectEkycZones = _ref => {
9668
9685
  if (isMultiSelect) {
9669
9686
  const selected = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : [];
9670
9687
  setSelectedZones(selected);
9671
- onSelect(config.key, selected);
9688
+ onSelect(config.key, selected.map(z => z.name));
9672
9689
  } else {
9673
9690
  const selectedZone = Array.isArray(value) ? Array.isArray(value[0]) ? value[0][1] : value[0] : value;
9674
9691
  setSelectedZones(selectedZone ? [selectedZone] : []);
@@ -9700,10 +9717,10 @@ const SelectEkycZones = _ref => {
9700
9717
  disable: disable || isEkycSupervisor || ((_config$props = config.props) === null || _config$props === void 0 ? void 0 : _config$props.disable) || config.disable
9701
9718
  })), isMultiSelect && selectedZones.length > 0 && /*#__PURE__*/React__default.createElement("div", {
9702
9719
  className: "selected-zones"
9703
- }, selectedZones.filter(zone => zone && zone.code).map(zone => /*#__PURE__*/React__default.createElement("span", {
9720
+ }, selectedZones.filter(zone => zone && zone.name).map(zone => /*#__PURE__*/React__default.createElement("span", {
9704
9721
  key: zone.code,
9705
9722
  className: "selected-zone-chip"
9706
- }, t(zone.code)))));
9723
+ }, zone.name))));
9707
9724
  };
9708
9725
 
9709
9726
  const SelectEkycClusters = _ref => {