@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.
@@ -8556,13 +8556,6 @@ const PTRCitizenPet = ({
8556
8556
  });
8557
8557
  }
8558
8558
  }, [currentStepData, setValue]);
8559
- const selectedVaccineDate = watch("lastVaccineDate");
8560
- useEffect(() => {
8561
- console.log("watch lastVaccineDate ->", selectedVaccineDate, "type:", typeof selectedVaccineDate, "asJSON:", JSON.stringify(selectedVaccineDate));
8562
- if (selectedVaccineDate) {
8563
- trigger("petAge");
8564
- }
8565
- }, [selectedVaccineDate, trigger]);
8566
8559
  const onlyAlphabets = /^[A-Za-z]+(?:[ '-][A-Za-z]+)*\s*$/;
8567
8560
  const alphaNum = /^[A-Za-z0-9]+$/;
8568
8561
  const getErrorMessage = fieldName => {
@@ -8725,7 +8718,6 @@ const PTRCitizenPet = ({
8725
8718
  onChange: e => props.onChange(e.target.value),
8726
8719
  onBlur: () => {
8727
8720
  trigger("lastVaccineDate");
8728
- trigger("petAge");
8729
8721
  },
8730
8722
  t: t
8731
8723
  })
@@ -24053,7 +24045,7 @@ function PTRSummary({
24053
24045
  const formData = useSelector(state => state.ptr.PTRNewApplicationFormReducer.formData || {});
24054
24046
  const owner = (formData === null || formData === void 0 ? void 0 : formData.ownerDetails) || {};
24055
24047
  const pet = (formData === null || formData === void 0 ? void 0 : formData.petDetails) || {};
24056
- console.log('pet', pet);
24048
+ console.log("pet", pet);
24057
24049
  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) || [];
24058
24050
  const tenantId = window.location.href.includes("citizen") ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
24059
24051
  const sectionStyle = {
@@ -24117,6 +24109,27 @@ function PTRSummary({
24117
24109
  minWidth: "120px"
24118
24110
  }
24119
24111
  }, value || "NA"));
24112
+ const formatPetAge = (ageValue, t) => {
24113
+ if (ageValue === null || ageValue === undefined || ageValue === "") return t("CS_NA");
24114
+ const ageStr = String(ageValue).trim();
24115
+ if (!/^\d+(\.\d+)?$/.test(ageStr)) return t("CS_NA");
24116
+ const [yearsPart, decPart] = ageStr.split(".");
24117
+ let years = Number(yearsPart) || 0;
24118
+ let months = 0;
24119
+ if (decPart) {
24120
+ if (decPart.length === 1) {
24121
+ months = parseInt(decPart, 10);
24122
+ } else {
24123
+ months = parseInt(decPart.slice(0, 2), 10);
24124
+ }
24125
+ if (isNaN(months)) months = 0;
24126
+ }
24127
+ if (months > 11) months = 11;
24128
+ if (years === 0 && months === 0) return t("CS_NA");
24129
+ if (years === 0) return `${months} month${months > 1 ? "s" : ""}`;
24130
+ if (months === 0) return `${years} year${years > 1 ? "s" : ""}`;
24131
+ return `${years} year${years > 1 ? "s" : ""} and ${months} month${months > 1 ? "s" : ""}`;
24132
+ };
24120
24133
  return /*#__PURE__*/React.createElement("div", {
24121
24134
  className: "application-summary"
24122
24135
  }, /*#__PURE__*/React.createElement(Card, {
@@ -24138,7 +24151,7 @@ function PTRSummary({
24138
24151
  style: headerRow
24139
24152
  }, /*#__PURE__*/React.createElement("h3", {
24140
24153
  style: headingStyle
24141
- }, 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.createElement(Card, {
24154
+ }, 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.createElement(Card, {
24142
24155
  className: "summary-section"
24143
24156
  }, /*#__PURE__*/React.createElement("div", {
24144
24157
  style: sectionStyle