@mseva/digit-ui-module-ptr 1.3.4-UAT.13 → 1.3.4-UAT.14

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.
@@ -7684,18 +7684,9 @@ const PTRCitizenPet = ({
7684
7684
  return gt.name === (apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$3 = apiDataCheck[0]) === null || _apiDataCheck$3 === void 0 ? void 0 : (_apiDataCheck$3$petDe = _apiDataCheck$3.petDetails) === null || _apiDataCheck$3$petDe === void 0 ? void 0 : _apiDataCheck$3$petDe.petGender);
7685
7685
  })) || null;
7686
7686
  const pathParts = window.location.pathname.split("/");
7687
- const startIndex = pathParts.findIndex(part => part === "new-application");
7688
- let id = null;
7689
- if (startIndex !== -1) {
7690
- const nextPart = pathParts[startIndex + 1];
7691
- if (nextPart !== null && nextPart !== void 0 && nextPart.startsWith("PB-PTR-")) {
7692
- id = nextPart;
7693
- } else if (nextPart === "PL") {
7694
- id = pathParts.slice(startIndex + 1, startIndex + 5).join("/");
7695
- }
7696
- }
7697
- id = id ? decodeURIComponent(id) : null;
7698
- const checkForRenew = window.location.pathname.includes("renew-application");
7687
+ const id = pathParts[pathParts.length - 1];
7688
+ const checkNumber = pathParts[pathParts.length - 2];
7689
+ const checkForRenew = id == "renew-application";
7699
7690
  const today = new Date();
7700
7691
  const todayStr = today.toISOString().split("T")[0];
7701
7692
  const minVaccineDate = new Date();
@@ -7721,7 +7712,7 @@ const PTRCitizenPet = ({
7721
7712
  return new Date(dateStr).getTime();
7722
7713
  }
7723
7714
  const onSubmit = async data => {
7724
- var _currentStepData$Crea, _currentStepData$appl, _data$petType, _data$breedType, _data$petGender, _currentStepData$owne, _currentStepData$resp;
7715
+ var _currentStepData$Crea, _currentStepData$appl, _data$petType, _data$breedType, _data$petGender, _currentStepData$resp;
7725
7716
  if (validateStep) {
7726
7717
  const validationErrors = validateStep(data);
7727
7718
  if (Object.keys(validationErrors).length > 0) return;
@@ -7759,9 +7750,9 @@ const PTRCitizenPet = ({
7759
7750
  },
7760
7751
  address: {
7761
7752
  pincode,
7762
- addressLine1: currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$owne = currentStepData.ownerDetails) === null || _currentStepData$owne === void 0 ? void 0 : _currentStepData$owne.address
7753
+ addressId: currentStepData.ownerDetails.address
7763
7754
  },
7764
- previousApplicationNumber: id ? id : null,
7755
+ previousApplicationNumber: checkNumber ? checkNumber : null,
7765
7756
  applicationType: checkForRenew ? "RENEWAPPLICATION" : "NEWAPPLICATION",
7766
7757
  ownerName: name,
7767
7758
  fatherName: filteredOwnerDetails === null || filteredOwnerDetails === void 0 ? void 0 : filteredOwnerDetails.fatherOrHusbandName,
@@ -7788,7 +7779,7 @@ const PTRCitizenPet = ({
7788
7779
  address: {
7789
7780
  ...existing.address,
7790
7781
  pincode: pick(pincode, (_existing$address = existing.address) === null || _existing$address === void 0 ? void 0 : _existing$address.pincode),
7791
- addressLine1: pick(currentStepData.ownerDetails.address, (_existing$address2 = existing.address) === null || _existing$address2 === void 0 ? void 0 : _existing$address2.addressLine1),
7782
+ addressId: pick(currentStepData.ownerDetails.address, (_existing$address2 = existing.address) === null || _existing$address2 === void 0 ? void 0 : _existing$address2.addressId),
7792
7783
  tenantId
7793
7784
  },
7794
7785
  petDetails: {
@@ -7919,7 +7910,7 @@ const PTRCitizenPet = ({
7919
7910
  totalYears: years + months / 12
7920
7911
  };
7921
7912
  };
7922
- const AGE_REGEX = /^(?:(?:[1-9]|[1-3][0-9])(?:\.(?:0|[1-9]|1[01]))?|40(?:\.0?)?|0?\.(?:[1-9]|1[01]))$/;
7913
+ const AGE_REGEX = /^(?:(?:[1-9]|[1-3][0-9])(?:\.(?:[1-9]|1[01]))?|40(?:\.0?)?|0?\.(?:[1-9]|1[01]))$/;
7923
7914
  const petAgeVal = watch("petAge");
7924
7915
  useEffect(() => {
7925
7916
  if (!petAgeVal) return;
@@ -15378,12 +15369,12 @@ const PTRCitizenDetails = ({
15378
15369
  var _apiDataCheck$;
15379
15370
  const formattedData = (apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$ = apiDataCheck[0]) === null || _apiDataCheck$ === void 0 ? void 0 : _apiDataCheck$.owner) || (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.ownerDetails);
15380
15371
  if (formattedData) {
15381
- var _apiDataCheck$2, _apiDataCheck$2$addre, _apiDataCheck$3, _apiDataCheck$3$addre, _apiDataCheck$4, _apiDataCheck$4$addre, _currentStepData$owne, _apiDataCheck$5, _apiDataCheck$5$addre, _currentStepData$owne2;
15372
+ var _apiDataCheck$2, _apiDataCheck$2$addre, _currentStepData$owne, _apiDataCheck$3, _apiDataCheck$3$addre, _currentStepData$owne2;
15382
15373
  Object.entries(formattedData).forEach(([key, value]) => {
15383
15374
  setValue(key, value);
15384
15375
  });
15385
- setValue("address", (apiDataCheck !== null && apiDataCheck !== void 0 && (_apiDataCheck$2 = apiDataCheck[0]) !== null && _apiDataCheck$2 !== void 0 && (_apiDataCheck$2$addre = _apiDataCheck$2.address) !== null && _apiDataCheck$2$addre !== void 0 && _apiDataCheck$2$addre.addressLine1 ? apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$3 = apiDataCheck[0]) === null || _apiDataCheck$3 === void 0 ? void 0 : (_apiDataCheck$3$addre = _apiDataCheck$3.address) === null || _apiDataCheck$3$addre === void 0 ? void 0 : _apiDataCheck$3$addre.addressLine1 : apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$4 = apiDataCheck[0]) === null || _apiDataCheck$4 === void 0 ? void 0 : (_apiDataCheck$4$addre = _apiDataCheck$4.address) === null || _apiDataCheck$4$addre === void 0 ? void 0 : _apiDataCheck$4$addre.addressId) || (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$owne = currentStepData.ownerDetails) === null || _currentStepData$owne === void 0 ? void 0 : _currentStepData$owne.address) || "");
15386
- setValue("pincode", (apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$5 = apiDataCheck[0]) === null || _apiDataCheck$5 === void 0 ? void 0 : (_apiDataCheck$5$addre = _apiDataCheck$5.address) === null || _apiDataCheck$5$addre === void 0 ? void 0 : _apiDataCheck$5$addre.pincode) || (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$owne2 = currentStepData.ownerDetails) === null || _currentStepData$owne2 === void 0 ? void 0 : _currentStepData$owne2.pincode) || "");
15376
+ setValue("address", (apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$2 = apiDataCheck[0]) === null || _apiDataCheck$2 === void 0 ? void 0 : (_apiDataCheck$2$addre = _apiDataCheck$2.address) === null || _apiDataCheck$2$addre === void 0 ? void 0 : _apiDataCheck$2$addre.addressId) || (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$owne = currentStepData.ownerDetails) === null || _currentStepData$owne === void 0 ? void 0 : _currentStepData$owne.address) || "");
15377
+ setValue("pincode", (apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$3 = apiDataCheck[0]) === null || _apiDataCheck$3 === void 0 ? void 0 : (_apiDataCheck$3$addre = _apiDataCheck$3.address) === null || _apiDataCheck$3$addre === void 0 ? void 0 : _apiDataCheck$3$addre.pincode) || (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$owne2 = currentStepData.ownerDetails) === null || _currentStepData$owne2 === void 0 ? void 0 : _currentStepData$owne2.pincode) || "");
15387
15378
  }
15388
15379
  }, [apiDataCheck, currentStepData, setValue]);
15389
15380
  const getErrorMessage = fieldName => {
@@ -17138,7 +17129,7 @@ function NewApplicationTimeline({
17138
17129
  }
17139
17130
 
17140
17131
  const PTRWFApplicationTimeline = props => {
17141
- var _props$application2, _props$application3, _props$application4, _workflowDetails$data, _workflowDetails$data2, _workflowDetails$data3, _user$info, _user$info$roles, _workflowDetails$data6, _workflowDetails$data7, _workflowDetails$data8, _workflowDetails$data9, _workflowDetails$data0, _data$PetService, _data$PetService$Appl, _checkRenewTime$, _props$application0, _props$application1, _props$application10, _props$application11, _props$application12, _actions$, _props$application13, _props$application14, _props$application16, _props$application18, _workflowDetails$data1, _workflowDetails$data10, _workflowDetails$data11;
17132
+ var _props$application2, _props$application3, _props$application4, _workflowDetails$data, _workflowDetails$data2, _workflowDetails$data3, _user$info, _user$info$roles, _workflowDetails$data6, _workflowDetails$data7, _workflowDetails$data8, _workflowDetails$data9, _workflowDetails$data0, _props$application0, _props$application1, _actions$, _props$application10, _props$application11, _props$application13, _workflowDetails$data1, _workflowDetails$data10, _workflowDetails$data11;
17142
17133
  const {
17143
17134
  t
17144
17135
  } = useTranslation();
@@ -17328,23 +17319,10 @@ const PTRWFApplicationTimeline = props => {
17328
17319
  fetchWorkflowService();
17329
17320
  }
17330
17321
  }, [tenantId]);
17331
- const {
17332
- data
17333
- } = Digit.Hooks.useCustomMDMS(tenantId, "PetService", [{
17334
- name: "ApplicationType"
17335
- }]);
17336
- const checkRenewTime = data === null || data === void 0 ? void 0 : (_data$PetService = data.PetService) === null || _data$PetService === void 0 ? void 0 : (_data$PetService$Appl = _data$PetService.ApplicationType) === null || _data$PetService$Appl === void 0 ? void 0 : _data$PetService$Appl.filter(item => item.code == "RENEWAPPLICATION");
17337
- const checkTimeRenew = (checkRenewTime === null || checkRenewTime === void 0 ? void 0 : (_checkRenewTime$ = checkRenewTime[0]) === null || _checkRenewTime$ === void 0 ? void 0 : _checkRenewTime$.renewalPeriod) * 1000;
17338
- const validToObj = (_props$application0 = props.application) === null || _props$application0 === void 0 ? void 0 : _props$application0.validityDate;
17339
- const validToMillis = validToObj ? validToObj * 1000 : null;
17340
- const currentDateObj = Date.now();
17341
- const duration = validToObj && currentDateObj ? validToMillis - currentDateObj : null;
17342
- const checkDuration = duration !== null && duration <= checkTimeRenew;
17343
- const checkRenewal = ((_props$application1 = props.application) === null || _props$application1 === void 0 ? void 0 : _props$application1.status) == "APPROVED" || ((_props$application10 = props.application) === null || _props$application10 === void 0 ? void 0 : _props$application10.status) == "EXPIRED";
17344
17322
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(NewApplicationTimeline, {
17345
17323
  workflowDetails: workflowDetails,
17346
17324
  t: t
17347
- }), (((_props$application11 = props.application) === null || _props$application11 === void 0 ? void 0 : _props$application11.status) != "CITIZENACTIONREQUIRED" || ((_props$application12 = props.application) === null || _props$application12 === void 0 ? void 0 : _props$application12.status) != "INITIATED") && actions && actions.length > 0 && ((_actions$ = actions[0]) === null || _actions$ === void 0 ? void 0 : _actions$.action) != "PAY" && !isCitizen && /*#__PURE__*/React.createElement(ActionBar, null, displayMenu ? /*#__PURE__*/React.createElement(Menu, {
17325
+ }), (((_props$application0 = props.application) === null || _props$application0 === void 0 ? void 0 : _props$application0.status) != "CITIZENACTIONREQUIRED" || ((_props$application1 = props.application) === null || _props$application1 === void 0 ? void 0 : _props$application1.status) != "INITIATED") && actions && ((_actions$ = actions[0]) === null || _actions$ === void 0 ? void 0 : _actions$.action) != "PAY" && !isCitizen && /*#__PURE__*/React.createElement(ActionBar, null, displayMenu ? /*#__PURE__*/React.createElement(Menu, {
17348
17326
  localeKeyPrefix: `WF_EMPLOYEE_${"PTR"}`,
17349
17327
  options: actions,
17350
17328
  optionKey: "action",
@@ -17354,24 +17332,18 @@ const PTRWFApplicationTimeline = props => {
17354
17332
  ref: menuRef,
17355
17333
  label: t("WF_TAKE_ACTION"),
17356
17334
  onSubmit: () => setDisplayMenu(!displayMenu)
17357
- })), (((_props$application13 = props.application) === null || _props$application13 === void 0 ? void 0 : _props$application13.status) == "CITIZENACTIONREQUIRED" || ((_props$application14 = props.application) === null || _props$application14 === void 0 ? void 0 : _props$application14.status) == "INITIATED") && !isCitizen && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
17335
+ })), (((_props$application10 = props.application) === null || _props$application10 === void 0 ? void 0 : _props$application10.status) == "CITIZENACTIONREQUIRED" || ((_props$application11 = props.application) === null || _props$application11 === void 0 ? void 0 : _props$application11.status) == "INITIATED") && !isCitizen && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
17358
17336
  label: t("COMMON_EDIT"),
17359
17337
  onSubmit: () => {
17360
- var _props$application15;
17361
- history.push(`/digit-ui/employee/ptr/petservice/new-application/${(_props$application15 = props.application) === null || _props$application15 === void 0 ? void 0 : _props$application15.applicationNumber}`);
17362
- }
17363
- })), checkRenewal && checkDuration && ((_props$application16 = props.application) === null || _props$application16 === void 0 ? void 0 : _props$application16.status) == "APPROVED" && !isCitizen && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
17364
- label: t("PT_RENEW_HEADER"),
17365
- onSubmit: () => {
17366
- var _props$application17;
17367
- history.push(`/digit-ui/employee/ptr/petservice/new-application/${props === null || props === void 0 ? void 0 : (_props$application17 = props.application) === null || _props$application17 === void 0 ? void 0 : _props$application17.applicationNumber}/renew-application`);
17338
+ var _props$application12;
17339
+ history.push(`/digit-ui/employee/ptr/petservice/new-application/${(_props$application12 = props.application) === null || _props$application12 === void 0 ? void 0 : _props$application12.applicationNumber}`);
17368
17340
  }
17369
17341
  })), showModal ? /*#__PURE__*/React.createElement(PTRModal, {
17370
17342
  t: t,
17371
17343
  action: selectedAction,
17372
17344
  tenantId: tenantId,
17373
17345
  state: state,
17374
- id: (_props$application18 = props.application) === null || _props$application18 === void 0 ? void 0 : _props$application18.applicationNumber,
17346
+ id: (_props$application13 = props.application) === null || _props$application13 === void 0 ? void 0 : _props$application13.applicationNumber,
17375
17347
  applicationDetails: props.application,
17376
17348
  closeModal: closeModal,
17377
17349
  submitAction: submitAction,
@@ -20768,13 +20740,20 @@ const PTRApplicationDetails = () => {
20768
20740
  payments,
20769
20741
  ...params
20770
20742
  }) {
20771
- var _response;
20743
+ var _application$document, _application$petDetai, _response;
20744
+ const petImage = application === null || application === void 0 ? void 0 : (_application$document = application.documents) === null || _application$document === void 0 ? void 0 : _application$document.find(doc => (doc === null || doc === void 0 ? void 0 : doc.documentType) === "PET.PETPHOTO");
20745
+ const petImageUrl = petImage !== null && petImage !== void 0 && petImage.filestoreId ? `${window.location.origin}/filestore/v1/files/id?tenantId=pb&fileStoreId=${petImage.filestoreId}` : `${window.location.origin}/adorable-golden-retriever.png`;
20746
+ const petAge = formatPetAge(application === null || application === void 0 ? void 0 : (_application$petDetai = application.petDetails) === null || _application$petDetai === void 0 ? void 0 : _application$petDetai.petAge, t);
20772
20747
  let response = {
20773
20748
  filestoreIds: [payments === null || payments === void 0 ? void 0 : payments.fileStoreId]
20774
20749
  };
20775
20750
  response = await Digit.PaymentService.generatePdf(tenantId, {
20776
20751
  Payments: [{
20777
- ...payments
20752
+ ...payments,
20753
+ application,
20754
+ approver,
20755
+ petAge,
20756
+ petImageUrl
20778
20757
  }]
20779
20758
  }, "petservice-receipt");
20780
20759
  const fileStore = await Digit.PaymentService.printReciept(tenantId, {
@@ -20892,7 +20871,7 @@ const PTRApplicationDetails = () => {
20892
20871
  }, t("WS_COMMON_TABLE_COL_ADDRESS")), /*#__PURE__*/React.createElement(StatusTable, null, /*#__PURE__*/React.createElement(Row, {
20893
20872
  className: "border-none",
20894
20873
  label: t("PTR_ADDRESS"),
20895
- text: (pet_details === null || pet_details === void 0 ? void 0 : (_pet_details$address = pet_details.address) === null || _pet_details$address === void 0 ? void 0 : _pet_details$address.addressLine1) || t("CS_NA")
20874
+ text: (pet_details === null || pet_details === void 0 ? void 0 : (_pet_details$address = pet_details.address) === null || _pet_details$address === void 0 ? void 0 : _pet_details$address.addressId) || t("CS_NA")
20896
20875
  }), /*#__PURE__*/React.createElement(Row, {
20897
20876
  className: "border-none",
20898
20877
  label: t("PTR_PINCODE"),
@@ -23515,7 +23494,7 @@ const ApplicationDetails = () => {
23515
23494
  }, t("WS_COMMON_TABLE_COL_ADDRESS")), /*#__PURE__*/React.createElement(StatusTable, null, /*#__PURE__*/React.createElement(Row, {
23516
23495
  className: "border-none",
23517
23496
  label: t("PTR_ADDRESS"),
23518
- text: (pet_details === null || pet_details === void 0 ? void 0 : (_pet_details$address = pet_details.address) === null || _pet_details$address === void 0 ? void 0 : _pet_details$address.addressLine1) || t("CS_NA")
23497
+ text: (pet_details === null || pet_details === void 0 ? void 0 : (_pet_details$address = pet_details.address) === null || _pet_details$address === void 0 ? void 0 : _pet_details$address.addressId) || t("CS_NA")
23519
23498
  }), /*#__PURE__*/React.createElement(Row, {
23520
23499
  className: "border-none",
23521
23500
  label: t("PTR_PINCODE"),
@@ -24476,19 +24455,9 @@ const NewPTRStepperForm = () => {
24476
24455
  const step = formState.step;
24477
24456
  const tenantId = Digit.ULBService.getCurrentTenantId();
24478
24457
  const pathParts = window.location.pathname.split("/");
24479
- const startIndex = pathParts.findIndex(part => part === "new-application");
24480
- let id = null;
24481
- if (startIndex !== -1) {
24482
- const nextPart = pathParts[startIndex + 1];
24483
- if (nextPart !== null && nextPart !== void 0 && nextPart.startsWith("PB-PTR-")) {
24484
- id = nextPart;
24485
- } else if (nextPart === "PL") {
24486
- id = pathParts.slice(startIndex + 1, startIndex + 5).join("/");
24487
- }
24488
- }
24489
- id = id ? decodeURIComponent(id) : null;
24490
- console.log("id:", id);
24491
- const shouldEnableSearch = Boolean(id);
24458
+ const id = pathParts.find(part => part.startsWith("PB-PTR-"));
24459
+ console.log("id", id);
24460
+ const shouldEnableSearch = Boolean(id && id.startsWith("PB-PTR-"));
24492
24461
  console.log("shouldEnableSearch", shouldEnableSearch);
24493
24462
  const {
24494
24463
  isLoading,
@@ -24503,7 +24472,6 @@ const NewPTRStepperForm = () => {
24503
24472
  useEffect(() => {
24504
24473
  var _applicationData$PetR;
24505
24474
  console.log("applicationData for hereee:>> ", applicationData);
24506
- console.log("id", id);
24507
24475
  if (id && applicationData !== null && applicationData !== void 0 && (_applicationData$PetR = applicationData.PetRegistrationApplications) !== null && _applicationData$PetR !== void 0 && _applicationData$PetR.length) {
24508
24476
  dispatch(UPDATE_PTRNewApplication_FORM("responseData", applicationData.PetRegistrationApplications));
24509
24477
  }