@mseva/digit-ui-module-ptr 1.1.22 → 1.1.24

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
@@ -8592,13 +8592,6 @@ const PTRCitizenPet = _ref => {
8592
8592
  });
8593
8593
  }
8594
8594
  }, [currentStepData, setValue]);
8595
- const selectedVaccineDate = watch("lastVaccineDate");
8596
- React.useEffect(() => {
8597
- console.log("watch lastVaccineDate ->", selectedVaccineDate, "type:", typeof selectedVaccineDate, "asJSON:", JSON.stringify(selectedVaccineDate));
8598
- if (selectedVaccineDate) {
8599
- trigger("petAge");
8600
- }
8601
- }, [selectedVaccineDate, trigger]);
8602
8595
  const onlyAlphabets = /^[A-Za-z]+(?:[ '-][A-Za-z]+)*\s*$/;
8603
8596
  const alphaNum = /^[A-Za-z0-9]+$/;
8604
8597
  const getErrorMessage = fieldName => {
@@ -8761,7 +8754,6 @@ const PTRCitizenPet = _ref => {
8761
8754
  onChange: e => props.onChange(e.target.value),
8762
8755
  onBlur: () => {
8763
8756
  trigger("lastVaccineDate");
8764
- trigger("petAge");
8765
8757
  },
8766
8758
  t: t
8767
8759
  })
@@ -23835,7 +23827,7 @@ function PTRSummary(_ref) {
23835
23827
  const formData = reactRedux.useSelector(state => state.ptr.PTRNewApplicationFormReducer.formData || {});
23836
23828
  const owner = (formData === null || formData === void 0 ? void 0 : formData.ownerDetails) || {};
23837
23829
  const pet = (formData === null || formData === void 0 ? void 0 : formData.petDetails) || {};
23838
- console.log('pet', pet);
23830
+ console.log("pet", pet);
23839
23831
  const docs = (formData === null || formData === void 0 ? void 0 : (_formData$documents = formData.documents) === null || _formData$documents === void 0 ? void 0 : (_formData$documents$d = _formData$documents.documents) === null || _formData$documents$d === void 0 ? void 0 : _formData$documents$d.documents) || [];
23840
23832
  const tenantId = window.location.href.includes("citizen") ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
23841
23833
  const sectionStyle = {
@@ -23899,6 +23891,27 @@ function PTRSummary(_ref) {
23899
23891
  minWidth: "120px"
23900
23892
  }
23901
23893
  }, value || "NA"));
23894
+ const formatPetAge = (ageValue, t) => {
23895
+ if (ageValue === null || ageValue === undefined || ageValue === "") return t("CS_NA");
23896
+ const ageStr = String(ageValue).trim();
23897
+ if (!/^\d+(\.\d+)?$/.test(ageStr)) return t("CS_NA");
23898
+ const [yearsPart, decPart] = ageStr.split(".");
23899
+ let years = Number(yearsPart) || 0;
23900
+ let months = 0;
23901
+ if (decPart) {
23902
+ if (decPart.length === 1) {
23903
+ months = parseInt(decPart, 10);
23904
+ } else {
23905
+ months = parseInt(decPart.slice(0, 2), 10);
23906
+ }
23907
+ if (isNaN(months)) months = 0;
23908
+ }
23909
+ if (months > 11) months = 11;
23910
+ if (years === 0 && months === 0) return t("CS_NA");
23911
+ if (years === 0) return months + " month" + (months > 1 ? "s" : "");
23912
+ if (months === 0) return years + " year" + (years > 1 ? "s" : "");
23913
+ return years + " year" + (years > 1 ? "s" : "") + " and " + months + " month" + (months > 1 ? "s" : "");
23914
+ };
23902
23915
  return /*#__PURE__*/React__default.createElement("div", {
23903
23916
  className: "application-summary"
23904
23917
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
@@ -23920,7 +23933,7 @@ function PTRSummary(_ref) {
23920
23933
  style: headerRow
23921
23934
  }, /*#__PURE__*/React__default.createElement("h3", {
23922
23935
  style: headingStyle
23923
- }, t("ES_TITILE_PET_DETAILS"))), renderRow(t("PTR_PET_NAME"), pet === null || pet === void 0 ? void 0 : pet.petName), renderRow(t("PTR_PET_TYPE"), (pet === null || pet === void 0 ? void 0 : (_pet$petType = pet.petType) === null || _pet$petType === void 0 ? void 0 : _pet$petType.name) || (pet === null || pet === void 0 ? void 0 : (_pet$petType2 = pet.petType) === null || _pet$petType2 === void 0 ? void 0 : _pet$petType2.code)), renderRow(t("PTR_BREED_TYPE"), (pet === null || pet === void 0 ? void 0 : (_pet$breedType = pet.breedType) === null || _pet$breedType === void 0 ? void 0 : _pet$breedType.name) || (pet === null || pet === void 0 ? void 0 : (_pet$breedType2 = pet.breedType) === null || _pet$breedType2 === void 0 ? void 0 : _pet$breedType2.code)), renderRow(t("PTR_PET_GENDER"), (pet === null || pet === void 0 ? void 0 : (_pet$petGender = pet.petGender) === null || _pet$petGender === void 0 ? void 0 : _pet$petGender.name) || (pet === null || pet === void 0 ? void 0 : (_pet$petGender2 = pet.petGender) === null || _pet$petGender2 === void 0 ? void 0 : _pet$petGender2.code)), renderRow(t("PTR_PET_AGE"), pet === null || pet === void 0 ? void 0 : pet.petAge), renderRow(t("PTR_COLOR"), pet === null || pet === void 0 ? void 0 : pet.petColor), renderRow(t("PTR_VACCINATION_NUMBER"), pet === null || pet === void 0 ? void 0 : pet.vaccinationNumber), renderRow(t("PTR_VACCINATION_DATE"), pet === null || pet === void 0 ? void 0 : pet.lastVaccineDate), renderRow(t("PTR_CLINIC_NAME"), pet === null || pet === void 0 ? void 0 : pet.clinicName), renderRow(t("PTR_DOCTOR_NAME"), pet === null || pet === void 0 ? void 0 : pet.doctorName))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
23936
+ }, t("ES_TITILE_PET_DETAILS"))), renderRow(t("PTR_PET_NAME"), pet === null || pet === void 0 ? void 0 : pet.petName), renderRow(t("PTR_PET_TYPE"), (pet === null || pet === void 0 ? void 0 : (_pet$petType = pet.petType) === null || _pet$petType === void 0 ? void 0 : _pet$petType.name) || (pet === null || pet === void 0 ? void 0 : (_pet$petType2 = pet.petType) === null || _pet$petType2 === void 0 ? void 0 : _pet$petType2.code)), renderRow(t("PTR_BREED_TYPE"), (pet === null || pet === void 0 ? void 0 : (_pet$breedType = pet.breedType) === null || _pet$breedType === void 0 ? void 0 : _pet$breedType.name) || (pet === null || pet === void 0 ? void 0 : (_pet$breedType2 = pet.breedType) === null || _pet$breedType2 === void 0 ? void 0 : _pet$breedType2.code)), renderRow(t("PTR_PET_GENDER"), (pet === null || pet === void 0 ? void 0 : (_pet$petGender = pet.petGender) === null || _pet$petGender === void 0 ? void 0 : _pet$petGender.name) || (pet === null || pet === void 0 ? void 0 : (_pet$petGender2 = pet.petGender) === null || _pet$petGender2 === void 0 ? void 0 : _pet$petGender2.code)), renderRow(t("PTR_PET_AGE"), formatPetAge(pet === null || pet === void 0 ? void 0 : pet.petAge, t)), renderRow(t("PTR_COLOR"), pet === null || pet === void 0 ? void 0 : pet.petColor), renderRow(t("PTR_VACCINATION_NUMBER"), pet === null || pet === void 0 ? void 0 : pet.vaccinationNumber), renderRow(t("PTR_VACCINATION_DATE"), pet === null || pet === void 0 ? void 0 : pet.lastVaccineDate), renderRow(t("PTR_CLINIC_NAME"), pet === null || pet === void 0 ? void 0 : pet.clinicName), renderRow(t("PTR_DOCTOR_NAME"), pet === null || pet === void 0 ? void 0 : pet.doctorName))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
23924
23937
  className: "summary-section"
23925
23938
  }, /*#__PURE__*/React__default.createElement("div", {
23926
23939
  style: sectionStyle