@mseva/digit-ui-module-ptr 1.1.75 → 1.1.77

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.
@@ -18543,7 +18543,7 @@ const TimelineCaption = React.memo(({
18543
18543
  className: "timeline-label"
18544
18544
  }, t(label), ":"), /*#__PURE__*/React.createElement("span", {
18545
18545
  className: "timeline-value"
18546
- }, (checkpoint === null || checkpoint === void 0 ? void 0 : checkpoint[key]) || "N/A")))), /*#__PURE__*/React.createElement("div", {
18546
+ }, t(checkpoint === null || checkpoint === void 0 ? void 0 : checkpoint[key]) || "N/A")))), /*#__PURE__*/React.createElement("div", {
18547
18547
  className: "timeline-note"
18548
18548
  }, /*#__PURE__*/React.createElement("span", {
18549
18549
  className: "timeline-label"
@@ -21504,8 +21504,7 @@ const PTRApplicationDetails = () => {
21504
21504
  } = useTranslation();
21505
21505
  const history = useHistory();
21506
21506
  const {
21507
- acknowledgementIds,
21508
- tenantId
21507
+ acknowledgementIds
21509
21508
  } = useParams();
21510
21509
  const [acknowldgementData, setAcknowldgementData] = useState([]);
21511
21510
  const [showOptions, setShowOptions] = useState(false);
@@ -21513,6 +21512,14 @@ const PTRApplicationDetails = () => {
21513
21512
  const [popup, setpopup] = useState(false);
21514
21513
  const [showToast, setShowToast] = useState(null);
21515
21514
  const [approver, setApprover] = useState(null);
21515
+ const tenantId = window.location.href.includes("employee") ? Digit.ULBService.getCurrentPermanentCity() : localStorage.getItem("CITIZEN.CITY");
21516
+ const pathname = window.location.pathname;
21517
+ const afterApplication = pathname.split("/application/")[1];
21518
+ const parts = afterApplication.split("/");
21519
+ const tenantIdPop = parts.pop();
21520
+ let applicationNumber = parts.join("/");
21521
+ applicationNumber = decodeURIComponent(applicationNumber);
21522
+ console.log("applicationNumber", applicationNumber);
21516
21523
  const {
21517
21524
  data: storeData
21518
21525
  } = Digit.Hooks.useStore.getInitData();
@@ -21529,7 +21536,7 @@ const PTRApplicationDetails = () => {
21529
21536
  } = Digit.Hooks.ptr.usePTRSearch({
21530
21537
  tenantId,
21531
21538
  filters: {
21532
- applicationNumber: acknowledgementIds
21539
+ applicationNumber
21533
21540
  }
21534
21541
  });
21535
21542
  const [billData, setBillData] = useState(null);
@@ -21544,7 +21551,7 @@ const PTRApplicationDetails = () => {
21544
21551
  isLoading: approverDataLoading
21545
21552
  } = Digit.Hooks.useWorkflowDetails({
21546
21553
  tenantId,
21547
- id: petId,
21554
+ id: applicationNumber,
21548
21555
  moduleCode: "ptr"
21549
21556
  });
21550
21557
  useEffect(() => {
@@ -21559,14 +21566,14 @@ const PTRApplicationDetails = () => {
21559
21566
  setLoading(true);
21560
21567
  const result = await Digit.PaymentService.fetchBill(tenantId, {
21561
21568
  businessService: "pet-services",
21562
- consumerCode: acknowledgementIds
21569
+ consumerCode: applicationNumber
21563
21570
  });
21564
21571
  setBillData(result);
21565
21572
  setLoading(false);
21566
21573
  };
21567
21574
  useEffect(() => {
21568
21575
  fetchBillData();
21569
- }, [tenantId, acknowledgementIds]);
21576
+ }, [tenantId, applicationNumber]);
21570
21577
  const {
21571
21578
  isLoading: auditDataLoading,
21572
21579
  isError: isAuditError,
@@ -21574,7 +21581,7 @@ const PTRApplicationDetails = () => {
21574
21581
  } = Digit.Hooks.ptr.usePTRSearch({
21575
21582
  tenantId,
21576
21583
  filters: {
21577
- applicationNumber: petId,
21584
+ applicationNumber: applicationNumber,
21578
21585
  audit: true
21579
21586
  }
21580
21587
  }, {
@@ -21586,10 +21593,10 @@ const PTRApplicationDetails = () => {
21586
21593
  } = Digit.Hooks.useRecieptSearch({
21587
21594
  tenantId: tenantId,
21588
21595
  businessService: "pet-services",
21589
- consumerCodes: acknowledgementIds,
21596
+ consumerCodes: applicationNumber,
21590
21597
  isEmployee: false
21591
21598
  }, {
21592
- enabled: acknowledgementIds ? true : false
21599
+ enabled: applicationNumber ? true : false
21593
21600
  });
21594
21601
  if (!pet_details.workflow) {
21595
21602
  const workflow = {
@@ -22242,21 +22249,32 @@ const PTRApplicationDetails = () => {
22242
22249
  });
22243
22250
  }
22244
22251
  const formatPetAge = (ageValue, t) => {
22245
- if (ageValue === null || ageValue === undefined || ageValue === "") return t("CS_NA");
22246
- const ageStr = String(ageValue).trim();
22247
- if (!/^\d+(\.\d+)?$/.test(ageStr)) return t("CS_NA");
22248
- const [yearsPart, decPart] = ageStr.split(".");
22249
- let years = Number(yearsPart) || 0;
22252
+ if (!ageValue) return t("CS_NA");
22253
+ let ageStr = String(ageValue).trim();
22254
+ if (/^\d+(\.\d+)?$/.test(ageStr)) {
22255
+ const [yearsPart, decPart] = ageStr.split(".");
22256
+ let _years = Number(yearsPart) || 0;
22257
+ let _months = 0;
22258
+ if (decPart) {
22259
+ _months = parseInt(decPart.slice(0, 2), 10);
22260
+ if (isNaN(_months)) _months = 0;
22261
+ if (_months > 11) _months = 11;
22262
+ }
22263
+ if (_years === 0 && _months === 0) return t("CS_NA");
22264
+ if (_years === 0) return `${_months} month${_months > 1 ? "s" : ""}`;
22265
+ if (_months === 0) return `${_years} year${_years > 1 ? "s" : ""}`;
22266
+ return `${_years} year${_years > 1 ? "s" : ""} and ${_months} month${_months > 1 ? "s" : ""}`;
22267
+ }
22268
+ const regex = /(\d+)\s*(year|years|yr|yrs|month|months|mo|mos)/gi;
22269
+ const matches = ageStr.matchAll(regex);
22270
+ let years = 0;
22250
22271
  let months = 0;
22251
- if (decPart) {
22252
- if (decPart.length === 1) {
22253
- months = parseInt(decPart, 10);
22254
- } else {
22255
- months = parseInt(decPart.slice(0, 2), 10);
22256
- }
22257
- if (isNaN(months)) months = 0;
22272
+ for (const match of matches) {
22273
+ const num = parseInt(match[1], 10);
22274
+ const unit = match[2].toLowerCase();
22275
+ if (unit.includes("year") || unit.includes("yr")) years = num;
22276
+ if (unit.includes("month") || unit.includes("mo")) months = num;
22258
22277
  }
22259
- if (months > 11) months = 11;
22260
22278
  if (years === 0 && months === 0) return t("CS_NA");
22261
22279
  if (years === 0) return `${months} month${months > 1 ? "s" : ""}`;
22262
22280
  if (months === 0) return `${years} year${years > 1 ? "s" : ""}`;
@@ -22392,7 +22410,7 @@ const PTRApplicationDetails = () => {
22392
22410
  }))), ((pet_details === null || pet_details === void 0 ? void 0 : pet_details.status) == "CITIZENACTIONREQUIRED" || (pet_details === null || pet_details === void 0 ? void 0 : pet_details.status) == "INITIATED") && isCitizen && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
22393
22411
  label: t("COMMON_EDIT"),
22394
22412
  onSubmit: () => {
22395
- history.push(`/digit-ui/citizen/ptr/petservice/new-application/${acknowledgementIds}`);
22413
+ history.push(`/digit-ui/citizen/ptr/petservice/new-application/${applicationNumber}`);
22396
22414
  }
22397
22415
  })), /*#__PURE__*/React.createElement(PTRWFApplicationTimeline, {
22398
22416
  application: application,