@mseva/digit-ui-module-ptr 1.0.99 → 1.1.0

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
@@ -6759,20 +6759,6 @@ const OwnerForm$1 = _props => {
6759
6759
  }));
6760
6760
  };
6761
6761
 
6762
- const _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
6763
- const _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
6764
- function _catch(body, recover) {
6765
- try {
6766
- var result = body();
6767
- } catch (e) {
6768
- return recover(e);
6769
- }
6770
- if (result && result.then) {
6771
- return result.then(void 0, recover);
6772
- }
6773
- return result;
6774
- }
6775
-
6776
6762
  const UPDATE_PTRNewApplication_FORMType = "UPDATE_PTRNewApplication_FORM";
6777
6763
  const SET_PTRNewApplication_STEPType = "SET_PTRNewApplication_STEP";
6778
6764
  const RESET_PTR_NEW_APPLICATION_FORMType = "RESET_PTR_NEW_APPLICATION_FORM";
@@ -8382,20 +8368,43 @@ const CustomDatePicker = _ref => {
8382
8368
 
8383
8369
  const _excluded$1 = ["address", "name", "pincode"];
8384
8370
  const PTRCitizenPet = _ref => {
8371
+ var _mdmsPetData$petTypes, _mdmsPetData$breedTyp, _mdmsPetData$genderTy;
8385
8372
  let {
8386
8373
  onGoBack,
8387
8374
  goNext,
8388
8375
  currentStepData,
8389
8376
  t,
8390
- validateStep
8377
+ validateStep,
8378
+ isEdit
8391
8379
  } = _ref;
8380
+ console.log("currentStepData here:>> ", currentStepData);
8392
8381
  const stateId = Digit.ULBService.getStateId();
8393
8382
  let user = Digit.UserService.getUser();
8394
8383
  const dispatch = reactRedux.useDispatch();
8384
+ const apiDataCheck = reactRedux.useSelector(state => {
8385
+ var _state$ptr$PTRNewAppl;
8386
+ return (_state$ptr$PTRNewAppl = state.ptr.PTRNewApplicationFormReducer.formData) === null || _state$ptr$PTRNewAppl === void 0 ? void 0 : _state$ptr$PTRNewAppl.responseData;
8387
+ });
8395
8388
  const tenantId = window.location.href.includes("citizen") ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
8396
8389
  const {
8397
- data: mdmsPetData
8390
+ data: mdmsPetData,
8391
+ isLoading
8398
8392
  } = Digit.Hooks.ptr.usePTRPetMDMS(tenantId);
8393
+ const petTypeObj = (mdmsPetData === null || mdmsPetData === void 0 ? void 0 : (_mdmsPetData$petTypes = mdmsPetData.petTypes) === null || _mdmsPetData$petTypes === void 0 ? void 0 : _mdmsPetData$petTypes.find(pt => {
8394
+ var _apiDataCheck$, _apiDataCheck$$petDet;
8395
+ return pt.name === (apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$ = apiDataCheck[0]) === null || _apiDataCheck$ === void 0 ? void 0 : (_apiDataCheck$$petDet = _apiDataCheck$.petDetails) === null || _apiDataCheck$$petDet === void 0 ? void 0 : _apiDataCheck$$petDet.petType);
8396
+ })) || null;
8397
+ const breedTypeObj = (mdmsPetData === null || mdmsPetData === void 0 ? void 0 : (_mdmsPetData$breedTyp = mdmsPetData.breedTypes) === null || _mdmsPetData$breedTyp === void 0 ? void 0 : _mdmsPetData$breedTyp.find(bt => {
8398
+ var _apiDataCheck$2, _apiDataCheck$2$petDe;
8399
+ return bt.name === (apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$2 = apiDataCheck[0]) === null || _apiDataCheck$2 === void 0 ? void 0 : (_apiDataCheck$2$petDe = _apiDataCheck$2.petDetails) === null || _apiDataCheck$2$petDe === void 0 ? void 0 : _apiDataCheck$2$petDe.breedType);
8400
+ })) || null;
8401
+ const genderTypeObj = (mdmsPetData === null || mdmsPetData === void 0 ? void 0 : (_mdmsPetData$genderTy = mdmsPetData.genderTypes) === null || _mdmsPetData$genderTy === void 0 ? void 0 : _mdmsPetData$genderTy.find(gt => {
8402
+ var _apiDataCheck$3, _apiDataCheck$3$petDe;
8403
+ 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);
8404
+ })) || null;
8405
+ console.log("petTypeObj :>> ", petTypeObj);
8406
+ console.log("breedTypeObj :>> ", breedTypeObj);
8407
+ console.log("genderTypeObj :>> ", genderTypeObj);
8399
8408
  const today = new Date();
8400
8409
  const todayStr = today.toISOString().split("T")[0];
8401
8410
  const minVaccineDate = new Date();
@@ -8426,7 +8435,7 @@ const PTRCitizenPet = _ref => {
8426
8435
  }
8427
8436
  const onSubmit = function (data) {
8428
8437
  try {
8429
- var _currentStepData$Crea, _currentStepData$appl, _data$petType, _data$breedType, _data$petGender;
8438
+ var _currentStepData$Crea, _currentStepData$appl, _data$petType, _data$breedType, _data$petGender, _currentStepData$resp;
8430
8439
  if (validateStep) {
8431
8440
  const validationErrors = validateStep(data);
8432
8441
  console.log("validationErrors", validationErrors);
@@ -8478,28 +8487,95 @@ const PTRCitizenPet = _ref => {
8478
8487
  status: "INITIATED"
8479
8488
  }
8480
8489
  };
8481
- const _temp = _catch(function () {
8482
- return Promise.resolve(Digit.PTRService.create({
8483
- petRegistrationApplications: [formData]
8484
- }, formData.tenantId)).then(function (response) {
8485
- var _response$ResponseInf;
8486
- if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf = response.ResponseInfo) === null || _response$ResponseInf === void 0 ? void 0 : _response$ResponseInf.status) === "successful") {
8487
- dispatch(UPDATE_PTRNewApplication_FORM("CreatedResponse", response.PetRegistrationApplications[0]));
8488
- goNext(data);
8489
- }
8490
- });
8491
- }, function (err) {
8492
- console.error("API call failed:", err);
8493
- });
8490
+ const pick = (newV, oldV) => newV !== undefined && newV !== null && newV !== "" ? newV : oldV;
8491
+ const existing = (apiDataCheck === null || apiDataCheck === void 0 ? void 0 : apiDataCheck[0]) || (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$resp = currentStepData.responseData) === null || _currentStepData$resp === void 0 ? void 0 : _currentStepData$resp[0]) || {};
8492
+ const _temp = function () {
8493
+ if (existing !== null && existing !== void 0 && existing.applicationNumber) {
8494
+ var _currentStepData$docu, _currentStepData$docu2, _existing$owner, _existing$owner2, _existing$owner3, _existing$address, _existing$address2, _existing$petDetails, _data$petType$name, _data$petType2, _data$petType3, _existing$petDetails2, _data$breedType$name, _data$breedType2, _data$breedType3, _existing$petDetails3, _data$petGender$name, _data$petGender2, _data$petGender3, _existing$petDetails4, _existing$petDetails5, _existing$petDetails6, _existing$petDetails7, _existing$petDetails8, _existing$petDetails9, _existing$petDetails0;
8495
+ const existingDocuments = existing !== null && existing !== void 0 && existing.documents && Array.isArray(existing.documents) && existing.documents.length ? existing.documents : (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$docu = currentStepData.documents) === null || _currentStepData$docu === void 0 ? void 0 : (_currentStepData$docu2 = _currentStepData$docu.documents) === null || _currentStepData$docu2 === void 0 ? void 0 : _currentStepData$docu2.documents) || (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.documents) || [];
8496
+ const updateFormData = _extends({}, existing, {
8497
+ owner: _extends({}, existing.owner, filteredOwnerDetails, {
8498
+ name: (pick(filteredOwnerDetails.firstName, (((_existing$owner = existing.owner) === null || _existing$owner === void 0 ? void 0 : _existing$owner.name) || "").split(" ")[0] || "") + " " + pick(filteredOwnerDetails.lastName, (((_existing$owner2 = existing.owner) === null || _existing$owner2 === void 0 ? void 0 : _existing$owner2.name) || "").split(" ")[1] || "")).trim(),
8499
+ userName: pick(filteredOwnerDetails.mobileNumber, (_existing$owner3 = existing.owner) === null || _existing$owner3 === void 0 ? void 0 : _existing$owner3.userName)
8500
+ }),
8501
+ address: _extends({}, existing.address, {
8502
+ pincode: pick(pincode, (_existing$address = existing.address) === null || _existing$address === void 0 ? void 0 : _existing$address.pincode),
8503
+ addressId: pick(currentStepData.ownerDetails.address, (_existing$address2 = existing.address) === null || _existing$address2 === void 0 ? void 0 : _existing$address2.addressId),
8504
+ tenantId
8505
+ }),
8506
+ petDetails: _extends({}, existing.petDetails, {
8507
+ petName: pick(data.petName, (_existing$petDetails = existing.petDetails) === null || _existing$petDetails === void 0 ? void 0 : _existing$petDetails.petName),
8508
+ petType: pick((_data$petType$name = (_data$petType2 = data.petType) === null || _data$petType2 === void 0 ? void 0 : _data$petType2.name) != null ? _data$petType$name : (_data$petType3 = data.petType) === null || _data$petType3 === void 0 ? void 0 : _data$petType3.code, (_existing$petDetails2 = existing.petDetails) === null || _existing$petDetails2 === void 0 ? void 0 : _existing$petDetails2.petType),
8509
+ breedType: pick((_data$breedType$name = (_data$breedType2 = data.breedType) === null || _data$breedType2 === void 0 ? void 0 : _data$breedType2.name) != null ? _data$breedType$name : (_data$breedType3 = data.breedType) === null || _data$breedType3 === void 0 ? void 0 : _data$breedType3.code, (_existing$petDetails3 = existing.petDetails) === null || _existing$petDetails3 === void 0 ? void 0 : _existing$petDetails3.breedType),
8510
+ petGender: pick((_data$petGender$name = (_data$petGender2 = data.petGender) === null || _data$petGender2 === void 0 ? void 0 : _data$petGender2.name) != null ? _data$petGender$name : (_data$petGender3 = data.petGender) === null || _data$petGender3 === void 0 ? void 0 : _data$petGender3.code, (_existing$petDetails4 = existing.petDetails) === null || _existing$petDetails4 === void 0 ? void 0 : _existing$petDetails4.petGender),
8511
+ petColor: pick(data.petColor, (_existing$petDetails5 = existing.petDetails) === null || _existing$petDetails5 === void 0 ? void 0 : _existing$petDetails5.petColor),
8512
+ lastVaccineDate: pick(toEpochMilliseconds(data.lastVaccineDate), (_existing$petDetails6 = existing.petDetails) === null || _existing$petDetails6 === void 0 ? void 0 : _existing$petDetails6.lastVaccineDate),
8513
+ petAge: pick(data.petAge, (_existing$petDetails7 = existing.petDetails) === null || _existing$petDetails7 === void 0 ? void 0 : _existing$petDetails7.petAge),
8514
+ vaccinationNumber: pick(data.vaccinationNumber, (_existing$petDetails8 = existing.petDetails) === null || _existing$petDetails8 === void 0 ? void 0 : _existing$petDetails8.vaccinationNumber),
8515
+ doctorName: pick(data.doctorName, (_existing$petDetails9 = existing.petDetails) === null || _existing$petDetails9 === void 0 ? void 0 : _existing$petDetails9.doctorName),
8516
+ clinicName: pick(data.clinicName, (_existing$petDetails0 = existing.petDetails) === null || _existing$petDetails0 === void 0 ? void 0 : _existing$petDetails0.clinicName)
8517
+ }),
8518
+ documents: existingDocuments,
8519
+ workflow: _extends({}, existing.workflow, {
8520
+ action: "SAVEASDRAFT",
8521
+ status: "SAVEASDRAFT",
8522
+ comments: "SAVEASDRAFT"
8523
+ }),
8524
+ ownerName: (pick(filteredOwnerDetails.firstName, existing.ownerName || "") + " " + pick(filteredOwnerDetails.lastName, "")).trim() || existing.ownerName,
8525
+ mobileNumber: pick(filteredOwnerDetails.mobileNumber, existing.mobileNumber)
8526
+ });
8527
+ return Promise.resolve(Digit.PTRService.update({
8528
+ PetRegistrationApplications: [updateFormData]
8529
+ }, tenantId)).then(function (response) {
8530
+ var _response$ResponseInf;
8531
+ if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf = response.ResponseInfo) === null || _response$ResponseInf === void 0 ? void 0 : _response$ResponseInf.status) === "successful") {
8532
+ dispatch(UPDATE_PTRNewApplication_FORM("CreatedResponse", response.PetRegistrationApplications[0]));
8533
+ goNext(data);
8534
+ }
8535
+ });
8536
+ } else {
8537
+ return Promise.resolve(Digit.PTRService.create({
8538
+ petRegistrationApplications: [formData]
8539
+ }, formData.tenantId)).then(function (response) {
8540
+ var _response$ResponseInf2;
8541
+ if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf2 = response.ResponseInfo) === null || _response$ResponseInf2 === void 0 ? void 0 : _response$ResponseInf2.status) === "successful") {
8542
+ dispatch(UPDATE_PTRNewApplication_FORM("CreatedResponse", response.PetRegistrationApplications[0]));
8543
+ goNext(data);
8544
+ }
8545
+ });
8546
+ }
8547
+ }();
8494
8548
  return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
8495
8549
  } catch (e) {
8496
8550
  return Promise.reject(e);
8497
8551
  }
8498
8552
  };
8499
8553
  React.useEffect(() => {
8500
- if (currentStepData !== null && currentStepData !== void 0 && currentStepData.petDetails) {
8501
- Object.entries(currentStepData.petDetails).forEach(_ref2 => {
8554
+ var _apiDataCheck$4;
8555
+ if (apiDataCheck !== null && apiDataCheck !== void 0 && (_apiDataCheck$4 = apiDataCheck[0]) !== null && _apiDataCheck$4 !== void 0 && _apiDataCheck$4.petDetails) {
8556
+ Object.entries(apiDataCheck[0].petDetails).forEach(_ref2 => {
8502
8557
  let [key, value] = _ref2;
8558
+ if (key === "lastVaccineDate") {
8559
+ const epoch = value !== null && value !== undefined && value !== "" ? !Number.isNaN(Number(value)) ? Number(value) : value : value;
8560
+ const v = convertEpochToDateInput(epoch);
8561
+ console.log("setting lastVaccineDate from apiCheckData ->", value, "coerced ->", epoch, "converted ->", v);
8562
+ setValue(key, v);
8563
+ } else if (key === "petType") {
8564
+ setValue(key, petTypeObj);
8565
+ } else if (key === "breedType") {
8566
+ setValue(key, breedTypeObj);
8567
+ } else if (key === "petGender") {
8568
+ setValue(key, genderTypeObj);
8569
+ } else {
8570
+ setValue(key, value);
8571
+ }
8572
+ });
8573
+ }
8574
+ }, [isLoading, mdmsPetData, apiDataCheck, setValue]);
8575
+ React.useEffect(() => {
8576
+ if (currentStepData !== null && currentStepData !== void 0 && currentStepData.petDetails) {
8577
+ Object.entries(currentStepData.petDetails).forEach(_ref3 => {
8578
+ let [key, value] = _ref3;
8503
8579
  if (key === "lastVaccineDate") {
8504
8580
  setValue(key, convertEpochToDateInput(value));
8505
8581
  } else {
@@ -8510,11 +8586,12 @@ const PTRCitizenPet = _ref => {
8510
8586
  }, [currentStepData, setValue]);
8511
8587
  const selectedVaccineDate = watch("lastVaccineDate");
8512
8588
  React.useEffect(() => {
8589
+ console.log("watch lastVaccineDate ->", selectedVaccineDate, "type:", typeof selectedVaccineDate, "asJSON:", JSON.stringify(selectedVaccineDate));
8513
8590
  if (selectedVaccineDate) {
8514
8591
  trigger("petAge");
8515
8592
  }
8516
8593
  }, [selectedVaccineDate, trigger]);
8517
- const onlyAlphabets = /^[A-Za-z\s]+$/;
8594
+ const onlyAlphabets = /^[A-Za-z]+(?:[ '-][A-Za-z]+)*\s*$/;
8518
8595
  const alphaNum = /^[A-Za-z0-9]+$/;
8519
8596
  const decimalNumber = /^\d+(\.\d{1,2})?$/;
8520
8597
  const getErrorMessage = fieldName => {
@@ -8588,8 +8665,8 @@ const PTRCitizenPet = _ref => {
8588
8665
  required: t("PTR_BREED_TYPE_REQUIRED")
8589
8666
  },
8590
8667
  render: props => {
8591
- var _mdmsPetData$breedTyp;
8592
- const filteredBreeds = selectedPetType ? mdmsPetData === null || mdmsPetData === void 0 ? void 0 : (_mdmsPetData$breedTyp = mdmsPetData.breedTypes) === null || _mdmsPetData$breedTyp === void 0 ? void 0 : _mdmsPetData$breedTyp.filter(b => b.petType == selectedPetType.code) : [];
8668
+ var _mdmsPetData$breedTyp2;
8669
+ const filteredBreeds = selectedPetType ? mdmsPetData === null || mdmsPetData === void 0 ? void 0 : (_mdmsPetData$breedTyp2 = mdmsPetData.breedTypes) === null || _mdmsPetData$breedTyp2 === void 0 ? void 0 : _mdmsPetData$breedTyp2.filter(b => b.petType == selectedPetType.code) : [];
8593
8670
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
8594
8671
  className: "form-field",
8595
8672
  select: props.onChange,
@@ -8752,6 +8829,14 @@ const PTRCitizenPet = _ref => {
8752
8829
  pattern: {
8753
8830
  value: onlyAlphabets,
8754
8831
  message: t("PTR_DOCTOR_NAME_INVALID")
8832
+ },
8833
+ maxLength: {
8834
+ value: 100,
8835
+ message: "Maximum 100 characters"
8836
+ },
8837
+ minLength: {
8838
+ value: 2,
8839
+ message: "Minimum 2 characters"
8755
8840
  }
8756
8841
  },
8757
8842
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
@@ -8799,6 +8884,20 @@ const PTRCitizenPet = _ref => {
8799
8884
  })));
8800
8885
  };
8801
8886
 
8887
+ const _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
8888
+ const _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
8889
+ function _catch(body, recover) {
8890
+ try {
8891
+ var result = body();
8892
+ } catch (e) {
8893
+ return recover(e);
8894
+ }
8895
+ if (result && result.then) {
8896
+ return result.then(void 0, recover);
8897
+ }
8898
+ return result;
8899
+ }
8900
+
8802
8901
  const PTRDocumentUpload = _ref => {
8803
8902
  var _formData$documents, _data$PetService;
8804
8903
  let {
@@ -15939,14 +16038,18 @@ const PTRCitizenDetails = _ref => {
15939
16038
  goNext(data);
15940
16039
  };
15941
16040
  React.useEffect(() => {
15942
- const formattedData = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.ownerDetails;
16041
+ var _apiDataCheck, _apiDataCheck$;
16042
+ const formattedData = ((_apiDataCheck = 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);
15943
16043
  if (formattedData) {
16044
+ var _apiDataCheck2, _apiDataCheck2$, _apiDataCheck2$$addre, _currentStepData$owne, _apiDataCheck3, _apiDataCheck3$, _apiDataCheck3$$addre, _currentStepData$owne2;
15944
16045
  Object.entries(formattedData).forEach(_ref2 => {
15945
16046
  let [key, value] = _ref2;
15946
16047
  setValue(key, value);
15947
16048
  });
16049
+ setValue("address", ((_apiDataCheck2 = apiDataCheck) === null || _apiDataCheck2 === void 0 ? void 0 : (_apiDataCheck2$ = _apiDataCheck2[0]) === null || _apiDataCheck2$ === void 0 ? void 0 : (_apiDataCheck2$$addre = _apiDataCheck2$.address) === null || _apiDataCheck2$$addre === void 0 ? void 0 : _apiDataCheck2$$addre.addressId) || (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$owne = currentStepData.ownerDetails) === null || _currentStepData$owne === void 0 ? void 0 : _currentStepData$owne.address) || "");
16050
+ setValue("pincode", ((_apiDataCheck3 = apiDataCheck) === null || _apiDataCheck3 === void 0 ? void 0 : (_apiDataCheck3$ = _apiDataCheck3[0]) === null || _apiDataCheck3$ === void 0 ? void 0 : (_apiDataCheck3$$addre = _apiDataCheck3$.address) === null || _apiDataCheck3$$addre === void 0 ? void 0 : _apiDataCheck3$$addre.pincode) || (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$owne2 = currentStepData.ownerDetails) === null || _currentStepData$owne2 === void 0 ? void 0 : _currentStepData$owne2.pincode) || "");
15948
16051
  }
15949
- }, [currentStepData, setValue]);
16052
+ }, [apiDataCheck, currentStepData, setValue]);
15950
16053
  const getErrorMessage = fieldName => {
15951
16054
  if (!errors[fieldName]) return null;
15952
16055
  const error = errors[fieldName];
@@ -16732,6 +16835,11 @@ const PTRSelectProofIdentity = _ref => {
16732
16835
  const stateId = Digit.ULBService.getStateId();
16733
16836
  const [formErrors, setFormErrors] = React.useState({});
16734
16837
  const [toastError, setToastError] = React.useState(null);
16838
+ const apiDataCheck = reactRedux.useSelector(state => {
16839
+ var _state$ptr$PTRNewAppl;
16840
+ return (_state$ptr$PTRNewAppl = state.ptr.PTRNewApplicationFormReducer.formData) === null || _state$ptr$PTRNewAppl === void 0 ? void 0 : _state$ptr$PTRNewAppl.responseData;
16841
+ });
16842
+ console.log("apiDataCheck for here docs:>> ", apiDataCheck);
16735
16843
  const validateFile = (file, docCode) => {
16736
16844
  var _file$name, _file$name$toLowerCas;
16737
16845
  if (!file) return null;
@@ -16786,12 +16894,30 @@ const PTRSelectProofIdentity = _ref => {
16786
16894
  }
16787
16895
  }, [documents, mdmsDocsData]);
16788
16896
  React.useEffect(() => {
16789
- var _formData$documents2;
16790
- const incomingDocs = (formData === null || formData === void 0 ? void 0 : (_formData$documents2 = formData.documents) === null || _formData$documents2 === void 0 ? void 0 : _formData$documents2.documents) || [];
16791
- if (!lodash.isEqual(incomingDocs, documents)) {
16792
- setDocuments(incomingDocs);
16897
+ if (!apiDataCheck) {
16898
+ var _formData$documents2;
16899
+ const incomingDocs = (formData === null || formData === void 0 ? void 0 : (_formData$documents2 = formData.documents) === null || _formData$documents2 === void 0 ? void 0 : _formData$documents2.documents) || [];
16900
+ if (!lodash.isEqual(incomingDocs, documents)) {
16901
+ setDocuments(incomingDocs);
16902
+ }
16793
16903
  }
16794
- }, [formData]);
16904
+ }, [formData, apiDataCheck]);
16905
+ React.useEffect(() => {
16906
+ if (Array.isArray(apiDataCheck) && apiDataCheck.length > 0 && Array.isArray(apiDataCheck[0].documents)) {
16907
+ const docs = apiDataCheck[0].documents.map(d => {
16908
+ var _ref2, _ref3, _ref4, _d$fileStoreId, _ref5, _ref6, _d$documentType2;
16909
+ const fileId = (_ref2 = (_ref3 = (_ref4 = (_d$fileStoreId = d === null || d === void 0 ? void 0 : d.fileStoreId) != null ? _d$fileStoreId : d === null || d === void 0 ? void 0 : d.filestoreId) != null ? _ref4 : d === null || d === void 0 ? void 0 : d.filestoreId) != null ? _ref3 : d === null || d === void 0 ? void 0 : d.documentUid) != null ? _ref2 : null;
16910
+ const documentType = (_ref5 = (_ref6 = (_d$documentType2 = d === null || d === void 0 ? void 0 : d.documentType) != null ? _d$documentType2 : d === null || d === void 0 ? void 0 : d.type) != null ? _ref6 : d === null || d === void 0 ? void 0 : d.code) != null ? _ref5 : null;
16911
+ return {
16912
+ documentType,
16913
+ filestoreId: fileId,
16914
+ documentUid: fileId
16915
+ };
16916
+ });
16917
+ console.log("setting documents to", docs);
16918
+ setDocuments(docs);
16919
+ }
16920
+ }, [apiDataCheck]);
16795
16921
  const lastSentRef = React__default.useRef();
16796
16922
  React.useEffect(() => {
16797
16923
  if (!lodash.isEqual(lastSentRef.current, documents)) {
@@ -16823,6 +16949,8 @@ const PTRSelectProofIdentity = _ref => {
16823
16949
  isDisabled: Object.keys(formErrors).length > 0
16824
16950
  }, Array.isArray(mdmsDocsData) && mdmsDocsData.map((mdmsDoc, index) => {
16825
16951
  const existing = documents.find(d => d.documentType === mdmsDoc.code);
16952
+ console.log("existing for", mdmsDoc.code, existing);
16953
+ console.log("document prop", _extends({}, mdmsDoc, existing));
16826
16954
  return /*#__PURE__*/React__default.createElement(PTRSelectDocument$1, {
16827
16955
  key: index,
16828
16956
  document: _extends({}, mdmsDoc, existing),
@@ -16840,7 +16968,7 @@ const PTRSelectProofIdentity = _ref => {
16840
16968
  error: true
16841
16969
  })) : /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null));
16842
16970
  };
16843
- function PTRSelectDocument$1(_ref2) {
16971
+ function PTRSelectDocument$1(_ref7) {
16844
16972
  let {
16845
16973
  t,
16846
16974
  document: doc,
@@ -16850,10 +16978,15 @@ function PTRSelectDocument$1(_ref2) {
16850
16978
  makeDocumentsValidator,
16851
16979
  mdms,
16852
16980
  setFormErrors
16853
- } = _ref2;
16981
+ } = _ref7;
16854
16982
  const [selectedDocument, setSelectedDocument] = React.useState({});
16855
16983
  const [file, setFile] = React.useState(null);
16856
16984
  const [uploadedFile, setUploadedFile] = React.useState((doc === null || doc === void 0 ? void 0 : doc.filestoreId) || null);
16985
+ React.useEffect(() => {
16986
+ const fileId = doc === null || doc === void 0 ? void 0 : doc.filestoreId;
16987
+ setUploadedFile(fileId);
16988
+ }, [doc === null || doc === void 0 ? void 0 : doc.filestoreId]);
16989
+ console.log("uploadedFile for", doc === null || doc === void 0 ? void 0 : doc.documentType, uploadedFile, "doc prop:", doc);
16857
16990
  const [fieldError, setFieldError] = React.useState(null);
16858
16991
  const [loading, setLoading] = React.useState(false);
16859
16992
  function selectfile(e) {
@@ -17399,7 +17532,7 @@ const PTRModal = _ref => {
17399
17532
  };
17400
17533
 
17401
17534
  const PTRWFApplicationTimeline = props => {
17402
- var _props$application, _props$application$wo, _props$application2, _props$application3, _user$info, _user$info$roles, _data$actionState, _data$actionState$nex, _data$nextActions, _data$timeline, _data$timeline2, _data$timeline$, _actions$, _props$application0, _data$actionState2;
17535
+ var _props$application, _props$application$wo, _props$application2, _props$application3, _user$info, _user$info$roles, _data$actionState, _data$actionState$nex, _data$nextActions, _data$timeline, _data$timeline2, _data$timeline$, _actions$, _props$application1, _data$actionState2;
17403
17536
  const {
17404
17537
  t
17405
17538
  } = reactI18next.useTranslation();
@@ -17558,7 +17691,7 @@ const PTRWFApplicationTimeline = props => {
17558
17691
  }
17559
17692
  const submitAction = function (data) {
17560
17693
  try {
17561
- var _data$Licenses;
17694
+ var _data$Licenses, _props$application0, _props$application0$a;
17562
17695
  const payloadData = props.application;
17563
17696
  const updatedApplicant = _extends({}, payloadData, {
17564
17697
  workflow: {}
@@ -17567,7 +17700,7 @@ const PTRWFApplicationTimeline = props => {
17567
17700
  setLatestComment(filtData === null || filtData === void 0 ? void 0 : filtData.comment);
17568
17701
  updatedApplicant.workflow = {
17569
17702
  action: filtData.action,
17570
- assignes: filtData === null || filtData === void 0 ? void 0 : filtData.assignee,
17703
+ assignes: filtData.action === "SENDBACKTOCITIZEN" ? [(_props$application0 = props.application) === null || _props$application0 === void 0 ? void 0 : (_props$application0$a = _props$application0.auditDetails) === null || _props$application0$a === void 0 ? void 0 : _props$application0$a.createdBy] : filtData === null || filtData === void 0 ? void 0 : filtData.assignee,
17571
17704
  comments: filtData === null || filtData === void 0 ? void 0 : filtData.comment,
17572
17705
  documents: filtData !== null && filtData !== void 0 && filtData.wfDocuments ? filtData === null || filtData === void 0 ? void 0 : filtData.wfDocuments : null
17573
17706
  };
@@ -17644,7 +17777,7 @@ const PTRWFApplicationTimeline = props => {
17644
17777
  action: selectedAction,
17645
17778
  tenantId: tenantId,
17646
17779
  state: state,
17647
- id: (_props$application0 = props.application) === null || _props$application0 === void 0 ? void 0 : _props$application0.applicationNumber,
17780
+ id: (_props$application1 = props.application) === null || _props$application1 === void 0 ? void 0 : _props$application1.applicationNumber,
17648
17781
  applicationDetails: props.application,
17649
17782
  closeModal: closeModal,
17650
17783
  submitAction: submitAction,
@@ -17690,7 +17823,7 @@ const App = () => {
17690
17823
  width: "100%"
17691
17824
  }
17692
17825
  }, /*#__PURE__*/React__default.createElement(reactRouterDom.Switch, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.AppContainer, null, !shouldHideBackButton(hideBackButtonConfig) ? /*#__PURE__*/React__default.createElement(digitUiReactComponents.BackButton, null, "Back") : "", /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
17693
- path: path + "/petservice/new-application",
17826
+ path: path + "/petservice/new-application/:id?",
17694
17827
  component: PTRCreate
17695
17828
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
17696
17829
  path: path + "/petservice/application/:acknowledgementIds/:tenantId",
@@ -18940,7 +19073,7 @@ const PTRApplicationDetails = () => {
18940
19073
  const petImage = petData === null || petData === void 0 ? void 0 : (_petData$documents = petData.documents) === null || _petData$documents === void 0 ? void 0 : _petData$documents.find(doc => (doc === null || doc === void 0 ? void 0 : doc.documentType) === "PET.PETPHOTO");
18941
19074
  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";
18942
19075
  console.log("Final petImageUrl:", petImageUrl);
18943
- const content = "\n <html>\n <head>\n <title>Pet Registration Certificate</title>\n <style>\n @page { margin: 0.5in; }\n body { \n font-family: 'Times New Roman', serif; \n margin: 0; \n padding: 20px;\n font-size: 14px;\n line-height: 1.4;\n }\n .certificate-container {\n max-width: 800px;\n margin: 0 auto;\n border: 3px solid #000;\n padding: 30px;\n background: white;\n }\n .header {\n text-align: center;\n margin-bottom: 30px;\n border-bottom: 2px solid #000;\n padding-bottom: 20px;\n }\n .title {\n font-size: 18px;\n font-weight: bold;\n margin: 10px 0;\n text-transform: uppercase;\n }\n .subtitle {\n font-size: 16px;\n margin: 5px 0;\n color: #666;\n }\n .main-content {\n display: flex;\n gap: 30px;\n margin: 20px 0;\n }\n .details-section {\n flex: 1;\n }\n .pet-image-section {\n flex-shrink: 0;\n text-align: center;\n order: 2;\n }\n .pet-image {\n width: 150px;\n height: 150px;\n border: 2px solid #000;\n object-fit: cover;\n margin-bottom: 10px;\n display: block;\n }\n .image-label {\n font-size: 12px;\n font-weight: bold;\n text-align: center;\n }\n .details-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 15px 30px;\n margin: 20px 0;\n }\n .detail-row {\n display: flex;\n margin-bottom: 8px;\n }\n .detail-label {\n font-weight: bold;\n min-width: 150px;\n margin-right: 10px;\n }\n .detail-value {\n flex: 1;\n border-bottom: 1px dotted #000;\n padding-bottom: 2px;\n }\n .owner-section {\n margin: 30px 0;\n border-top: 1px solid #000;\n padding-top: 20px;\n }\n .footer-section {\n margin-top: 40px;\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n }\n .signature-area {\n text-align: center;\n min-width: 200px;\n }\n .signature-line {\n border-top: 1px solid #000;\n margin: 30px 0 5px 0;\n }\n .terms-section {\n margin-top: 30px;\n border-top: 2px solid #000;\n padding-top: 20px;\n font-size: 12px;\n }\n .terms-title {\n font-weight: bold;\n margin-bottom: 10px;\n }\n .terms-list {\n margin: 0;\n padding-left: 20px;\n }\n .terms-list li {\n margin-bottom: 8px;\n text-align: justify;\n }\n @media print {\n body { background: white !important; }\n }\n </style>\n </head>\n <body>\n <div class=\"certificate-container\">\n <div class=\"header\">\n <div class=\"title\">MUNICIPAL CORPORATION, SAS NAGAR</div>\n <div class=\"subtitle\">Pet Registration Certificate</div>\n </div>\n \n <div class=\"main-content\">\n <div class=\"details-section\">\n <div class=\"details-grid\">\n <div class=\"detail-row\">\n <span class=\"detail-label\">Category</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails = petData.petDetails) === null || _petData$petDetails === void 0 ? void 0 : _petData$petDetails.petType) || "Dog") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Breed</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails2 = petData.petDetails) === null || _petData$petDetails2 === void 0 ? void 0 : _petData$petDetails2.breedType) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Name of Animal</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails3 = petData.petDetails) === null || _petData$petDetails3 === void 0 ? void 0 : _petData$petDetails3.petName) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Gender</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails4 = petData.petDetails) === null || _petData$petDetails4 === void 0 ? void 0 : _petData$petDetails4.petGender) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Date Of Birth</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails5 = petData.petDetails) === null || _petData$petDetails5 === void 0 ? void 0 : _petData$petDetails5.petAge) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Colour</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails6 = petData.petDetails) === null || _petData$petDetails6 === void 0 ? void 0 : _petData$petDetails6.petColor) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Registration Number</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : petData.applicationNumber) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Token No</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : petData.id) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">License Issued date</span>\n <span class=\"detail-value\">" + currentDate + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">License Valid Upto</span>\n <span class=\"detail-value\">31-03-2025</span>\n </div>\n </div>\n </div>\n \n <div class=\"pet-image-section\">\n <img \n src=\"" + petImageUrl + "\" \n alt=\"Pet Photo\" \n class=\"pet-image\" \n onload=\"console.log('Pet image loaded successfully:', this.src);\" \n onerror=\"console.log('Pet image failed to load:', this.src); console.log('Trying fallback image...'); this.src='/adorable-golden-retriever.png';\" \n />\n <div class=\"image-label\">Pet Photo</div>\n <script>\n console.log('Image URL being used:', '" + petImageUrl + "');\n console.log('Pet image data:', " + JSON.stringify(petImage) + ");\n </script>\n </div>\n </div>\n\n <div class=\"owner-section\">\n <div class=\"detail-row\">\n <span class=\"detail-label\">Owner Name</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : petData.applicantName) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Father/Spouse Name</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : petData.fatherName) || (petData === null || petData === void 0 ? void 0 : petData.fatherOrHusbandName) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Address</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$address = petData.address) === null || _petData$address === void 0 ? void 0 : _petData$address.addressId) || "Not Specified") + ", " + ((petData === null || petData === void 0 ? void 0 : (_petData$address2 = petData.address) === null || _petData$address2 === void 0 ? void 0 : _petData$address2.pincode) || "") + "</span>\n </div>\n </div>\n\n <div class=\"footer-section\">\n <div>\n <div>Date:........................</div>\n <div>Place:.......................</div>\n </div>\n <div class=\"signature-area\">\n <div>Approved by</div>\n <div class=\"signature-line\"></div>\n <div>Licensing Authority(CSI)</div>\n <div>Municipal Corporation</div>\n <div>SAS Nagar</div>\n </div>\n </div>\n\n <div class=\"terms-section\">\n <div class=\"terms-title\">Note:- The license is being issued on the following conditions:-</div>\n <ol class=\"terms-list\">\n <li>The owner shall ensure proper space, accommodation, food and medical treatment to the dog.</li>\n <li>The owner shall keep the dog protected by getting it vaccinated against Rabies from a Govt. Veterinary Practitioner or Veterinary Practitioner duly registered with Indian Veterinary Council( IVC) or State Veterinary Council (SVC).</li>\n <li>The owner shall keep the dog chained/ leashed while taking it outside. All ferocious dogs shall be duly muzzled and a stick shall be carried by the escort accompanying the dog while taking it out.</li>\n <li>The owner shall ensure that the dog will wear a collar affixed with the metal token issued by the Registration Authority at all the times.</li>\n <li>The owner shall not indulge in breeding of dogs for commercial purposes and trading of dogs within the area of Municipal Corporation. In case it is found that dog is being kept for breeding or trading /commercial purposes by him/her, the Registration Authority shall impound dog/s besides imposing a fine as fixed by the Municipal Corporation , SAS Nagar upon him/her.</li>\n <li>The owner shall not allow the dog to defecate in public places such as residential areas, green belts, parks, streets, roads, road berms and other common places etc. In case the dog defecates at the above specified places, he/she shall arrange to get the excreta of the dog removed from the said place at his/her own level. The owner shall take his/her dog to defecate in the isolated areas which are not visited by the residents and other members of the public. The owner shall not allow the dog to defecate near the residences of other neighbours to their annoyance.</li>\n <li>The owner shall allow the Registration Authority or a Veterinary Doctor, Chief Sanitary Inspector, Sanitary Inspector or any other officer of the Municipal Corporation authorized by the Registration Authority to inspect the premises of dog and the owner shall allow that person to enter and inspect his/her premises at all reasonable times to ensure that no cruelty is being done to the animal (prevention of cruelty to Animals Act 1960).</li>\n <li>The owner shall abide by the provision of Bye Laws notified by Government of Punjab Notification No. 5/13/2020-1LG4/1877 dated 12/10/2020 and adopted by Municipal Corporation , SAS Nagar vide its resolution No. 30 dated 28/06/2021.</li>\n </ol>\n </div>\n </div>\n </body>\n </html>\n ";
19076
+ const content = "\n <html>\n <head>\n <title>Pet Registration Certificate</title>\n <style>\n @page { margin: 0.5in; }\n body { \n font-family: 'Times New Roman', serif; \n margin: 0; \n padding: 20px;\n font-size: 14px;\n line-height: 1.4;\n }\n .certificate-container {\n max-width: 800px;\n margin: 0 auto;\n border: 3px solid #000;\n padding: 30px;\n background: white;\n }\n .header {\n text-align: center;\n margin-bottom: 30px;\n border-bottom: 2px solid #000;\n padding-bottom: 20px;\n }\n .title {\n font-size: 18px;\n font-weight: bold;\n margin: 10px 0;\n text-transform: uppercase;\n }\n .subtitle {\n font-size: 16px;\n margin: 5px 0;\n color: #666;\n }\n .main-content {\n display: flex;\n gap: 30px;\n margin: 20px 0;\n }\n .details-section {\n flex: 1;\n }\n .pet-image-section {\n flex-shrink: 0;\n text-align: center;\n order: 2;\n }\n .pet-image {\n width: 150px;\n height: 150px;\n border: 2px solid #000;\n object-fit: cover;\n margin-bottom: 10px;\n display: block;\n }\n .image-label {\n font-size: 12px;\n font-weight: bold;\n text-align: center;\n }\n .details-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 15px 30px;\n margin: 20px 0;\n }\n .detail-row {\n display: flex;\n margin-bottom: 8px;\n }\n .detail-label {\n font-weight: bold;\n min-width: 150px;\n margin-right: 10px;\n }\n .detail-value {\n flex: 1;\n border-bottom: 1px dotted #000;\n padding-bottom: 2px;\n }\n .owner-section {\n margin: 30px 0;\n border-top: 1px solid #000;\n padding-top: 20px;\n }\n .footer-section {\n margin-top: 40px;\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n }\n .signature-area {\n text-align: center;\n min-width: 200px;\n }\n .signature-line {\n border-top: 1px solid #000;\n margin: 30px 0 5px 0;\n }\n .terms-section {\n margin-top: 30px;\n border-top: 2px solid #000;\n padding-top: 20px;\n font-size: 12px;\n }\n .terms-title {\n font-weight: bold;\n margin-bottom: 10px;\n }\n .terms-list {\n margin: 0;\n padding-left: 20px;\n }\n .terms-list li {\n margin-bottom: 8px;\n text-align: justify;\n }\n @media print {\n body { background: white !important; }\n }\n </style>\n </head>\n <body>\n <div class=\"certificate-container\">\n <div class=\"header\">\n <div class=\"title\">MUNICIPAL CORPORATION</div>\n <div class=\"subtitle\">Pet Registration Certificate</div>\n </div>\n \n <div class=\"main-content\">\n <div class=\"details-section\">\n <div class=\"details-grid\">\n <div class=\"detail-row\">\n <span class=\"detail-label\">Category</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails = petData.petDetails) === null || _petData$petDetails === void 0 ? void 0 : _petData$petDetails.petType) || "Dog") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Breed</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails2 = petData.petDetails) === null || _petData$petDetails2 === void 0 ? void 0 : _petData$petDetails2.breedType) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Name of Animal</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails3 = petData.petDetails) === null || _petData$petDetails3 === void 0 ? void 0 : _petData$petDetails3.petName) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Gender</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails4 = petData.petDetails) === null || _petData$petDetails4 === void 0 ? void 0 : _petData$petDetails4.petGender) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Date Of Birth</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails5 = petData.petDetails) === null || _petData$petDetails5 === void 0 ? void 0 : _petData$petDetails5.petAge) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Colour</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails6 = petData.petDetails) === null || _petData$petDetails6 === void 0 ? void 0 : _petData$petDetails6.petColor) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Registration Number</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : petData.applicationNumber) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Token No</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : petData.id) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">License Issued date</span>\n <span class=\"detail-value\">" + currentDate + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">License Valid Upto</span>\n <span class=\"detail-value\">31-03-2025</span>\n </div>\n </div>\n </div>\n \n <div class=\"pet-image-section\">\n <img \n src=\"" + petImageUrl + "\" \n alt=\"Pet Photo\" \n class=\"pet-image\" \n onload=\"console.log('Pet image loaded successfully:', this.src);\" \n onerror=\"console.log('Pet image failed to load:', this.src); console.log('Trying fallback image...'); this.src='/adorable-golden-retriever.png';\" \n />\n <div class=\"image-label\">Pet Photo</div>\n <script>\n console.log('Image URL being used:', '" + petImageUrl + "');\n console.log('Pet image data:', " + JSON.stringify(petImage) + ");\n </script>\n </div>\n </div>\n\n <div class=\"owner-section\">\n <div class=\"detail-row\">\n <span class=\"detail-label\">Owner Name</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : petData.fatherName) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Father/Spouse Name</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : petData.fatherName) || (petData === null || petData === void 0 ? void 0 : petData.fatherOrHusbandName) || "Not Specified") + "</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-label\">Address</span>\n <span class=\"detail-value\">" + ((petData === null || petData === void 0 ? void 0 : (_petData$address = petData.address) === null || _petData$address === void 0 ? void 0 : _petData$address.addressId) || "Not Specified") + ", " + ((petData === null || petData === void 0 ? void 0 : (_petData$address2 = petData.address) === null || _petData$address2 === void 0 ? void 0 : _petData$address2.pincode) || "") + "</span>\n </div>\n </div>\n\n <div class=\"footer-section\">\n <div>\n <div>Date:........................</div>\n <div>Place:.......................</div>\n </div>\n <div class=\"signature-area\">\n <div>Approved by</div>\n <div class=\"signature-line\"></div>\n <div>Licensing Authority(CSI)</div>\n <div>Municipal Corporation</div>\n \n </div>\n </div>\n\n <div class=\"terms-section\">\n <div class=\"terms-title\">Note:- The license is being issued on the following conditions:-</div>\n <ol class=\"terms-list\">\n <li>The owner shall ensure proper space, accommodation, food and medical treatment to the dog.</li>\n <li>The owner shall keep the dog protected by getting it vaccinated against Rabies from a Govt. Veterinary Practitioner or Veterinary Practitioner duly registered with Indian Veterinary Council( IVC) or State Veterinary Council (SVC).</li>\n <li>The owner shall keep the dog chained/ leashed while taking it outside. All ferocious dogs shall be duly muzzled and a stick shall be carried by the escort accompanying the dog while taking it out.</li>\n <li>The owner shall ensure that the dog will wear a collar affixed with the metal token issued by the Registration Authority at all the times.</li>\n <li>The owner shall not indulge in breeding of dogs for commercial purposes and trading of dogs within the area of Municipal Corporation. In case it is found that dog is being kept for breeding or trading /commercial purposes by him/her, the Registration Authority shall impound dog/s besides imposing a fine as fixed by the Municipal Corporation , SAS Nagar upon him/her.</li>\n <li>The owner shall not allow the dog to defecate in public places such as residential areas, green belts, parks, streets, roads, road berms and other common places etc. In case the dog defecates at the above specified places, he/she shall arrange to get the excreta of the dog removed from the said place at his/her own level. The owner shall take his/her dog to defecate in the isolated areas which are not visited by the residents and other members of the public. The owner shall not allow the dog to defecate near the residences of other neighbours to their annoyance.</li>\n <li>The owner shall allow the Registration Authority or a Veterinary Doctor, Chief Sanitary Inspector, Sanitary Inspector or any other officer of the Municipal Corporation authorized by the Registration Authority to inspect the premises of dog and the owner shall allow that person to enter and inspect his/her premises at all reasonable times to ensure that no cruelty is being done to the animal (prevention of cruelty to Animals Act 1960).</li>\n <li>The owner shall abide by the provision of Bye Laws notified by Government of Punjab Notification No. 5/13/2020-1LG4/1877 dated 12/10/2020 and adopted by Municipal Corporation , SAS Nagar vide its resolution No. 30 dated 28/06/2021.</li>\n </ol>\n </div>\n </div>\n </body>\n </html>\n ";
18944
19077
  const printWindow = window.open("", "_blank");
18945
19078
  printWindow.document.write(content);
18946
19079
  printWindow.document.close();
@@ -18979,14 +19112,14 @@ const PTRApplicationDetails = () => {
18979
19112
  throw new Error("Pet registration data is missing");
18980
19113
  }
18981
19114
  const createAcknowledgementHTML = () => {
18982
- var _petData$petDetails7, _petData$petDetails8, _petData$petDetails9;
19115
+ var _petData$petDetails7, _petData$petDetails8, _petData$petDetails9, _petData$owner, _petData$owner2, _petData$owner3;
18983
19116
  const petData = data.PetRegistrationApplications[0];
18984
19117
  const currentDate = new Date().toLocaleDateString("en-IN", {
18985
19118
  day: "2-digit",
18986
19119
  month: "long",
18987
19120
  year: "numeric"
18988
19121
  });
18989
- const content = "\n <html>\n <head>\n <title>Pet Registration Acknowledgement</title>\n <style>\n @page { margin: 0.5in; }\n body { \n font-family: 'Arial', sans-serif; \n margin: 0; \n padding: 20px;\n font-size: 14px;\n line-height: 1.6;\n }\n .acknowledgement-container {\n max-width: 800px;\n margin: 0 auto;\n border: 2px solid #333;\n padding: 30px;\n background: white;\n }\n .header {\n text-align: center;\n margin-bottom: 30px;\n border-bottom: 2px solid #333;\n padding-bottom: 20px;\n }\n .title {\n font-size: 20px;\n font-weight: bold;\n margin: 10px 0;\n color: #333;\n }\n .subtitle {\n font-size: 16px;\n margin: 5px 0;\n color: #666;\n }\n .acknowledgement-text {\n margin: 20px 0;\n text-align: justify;\n font-size: 15px;\n }\n .details-table {\n width: 100%;\n border-collapse: collapse;\n margin: 20px 0;\n }\n .details-table th,\n .details-table td {\n padding: 12px;\n text-align: left;\n border: 1px solid #ddd;\n }\n .details-table th {\n background: #f5f5f5;\n font-weight: bold;\n width: 40%;\n }\n .footer {\n margin-top: 30px;\n text-align: center;\n font-size: 12px;\n color: #666;\n }\n @media print {\n body { background: white !important; }\n }\n </style>\n </head>\n <body>\n <div class=\"acknowledgement-container\">\n <div class=\"header\">\n <div class=\"title\">Pet Registration Acknowledgement</div>\n <div class=\"subtitle\">Municipal Corporation, SAS Nagar</div>\n </div>\n \n <div class=\"acknowledgement-text\">\n This is to acknowledge that we have received your application for pet registration. \n Your application has been processed and the details are as follows:\n </div>\n \n <table class=\"details-table\">\n <tr>\n <th>Application Number</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : petData.applicationNumber) || "Not Available") + "</td>\n </tr>\n <tr>\n <th>Application Date</th>\n <td>" + currentDate + "</td>\n </tr>\n <tr>\n <th>Pet Name</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails7 = petData.petDetails) === null || _petData$petDetails7 === void 0 ? void 0 : _petData$petDetails7.petName) || "Not Specified") + "</td>\n </tr>\n <tr>\n <th>Pet Type</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails8 = petData.petDetails) === null || _petData$petDetails8 === void 0 ? void 0 : _petData$petDetails8.petType) || "Not Specified") + "</td>\n </tr>\n <tr>\n <th>Breed</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails9 = petData.petDetails) === null || _petData$petDetails9 === void 0 ? void 0 : _petData$petDetails9.breedType) || "Not Specified") + "</td>\n </tr>\n <tr>\n <th>Owner Name</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : petData.applicantName) || "Not Specified") + "</td>\n </tr>\n <tr>\n <th>Contact Number</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : petData.mobileNumber) || "Not Specified") + "</td>\n </tr>\n <tr>\n <th>Email</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : petData.emailId) || "Not Specified") + "</td>\n </tr>\n <tr>\n <th>Application Status</th>\n <td style=\"color: #28a745; font-weight: bold;\">" + ((petData === null || petData === void 0 ? void 0 : petData.status) || "SUBMITTED") + "</td>\n </tr>\n </table>\n \n <div class=\"acknowledgement-text\">\n Please keep this acknowledgement for your records. You will be notified once your \n application is processed and approved. For any queries, please contact the Municipal \n Corporation office with your application number.\n </div>\n \n <div class=\"footer\">\n <p>Generated on: " + currentDate + "</p>\n <p>Municipal Corporation, SAS Nagar</p>\n <p>This is a computer-generated document and does not require a signature.</p>\n </div>\n </div>\n </body>\n </html>\n ";
19122
+ const content = "\n <html>\n <head>\n <title>Pet Registration Acknowledgement</title>\n <style>\n @page { margin: 0.5in; }\n body { \n font-family: 'Arial', sans-serif; \n margin: 0; \n padding: 20px;\n font-size: 14px;\n line-height: 1.6;\n }\n .acknowledgement-container {\n max-width: 800px;\n margin: 0 auto;\n border: 2px solid #333;\n padding: 30px;\n background: white;\n }\n .header {\n text-align: center;\n margin-bottom: 30px;\n border-bottom: 2px solid #333;\n padding-bottom: 20px;\n }\n .title {\n font-size: 20px;\n font-weight: bold;\n margin: 10px 0;\n color: #333;\n }\n .subtitle {\n font-size: 16px;\n margin: 5px 0;\n color: #666;\n }\n .acknowledgement-text {\n margin: 20px 0;\n text-align: justify;\n font-size: 15px;\n }\n .details-table {\n width: 100%;\n border-collapse: collapse;\n margin: 20px 0;\n }\n .details-table th,\n .details-table td {\n padding: 12px;\n text-align: left;\n border: 1px solid #ddd;\n }\n .details-table th {\n background: #f5f5f5;\n font-weight: bold;\n width: 40%;\n }\n .footer {\n margin-top: 30px;\n text-align: center;\n font-size: 12px;\n color: #666;\n }\n @media print {\n body { background: white !important; }\n }\n </style>\n </head>\n <body>\n <div class=\"acknowledgement-container\">\n <div class=\"header\">\n <div class=\"title\">Pet Registration Acknowledgement</div>\n <div class=\"subtitle\">Municipal Corporation</div>\n </div>\n \n <div class=\"acknowledgement-text\">\n This is to acknowledge that we have received your application for pet registration. \n Your application has been processed and the details are as follows:\n </div>\n \n <table class=\"details-table\">\n <tr>\n <th>Application Number</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : petData.applicationNumber) || "Not Available") + "</td>\n </tr>\n <tr>\n <th>Application Date</th>\n <td>" + currentDate + "</td>\n </tr>\n <tr>\n <th>Pet Name</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails7 = petData.petDetails) === null || _petData$petDetails7 === void 0 ? void 0 : _petData$petDetails7.petName) || "Not Specified") + "</td>\n </tr>\n <tr>\n <th>Pet Type</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails8 = petData.petDetails) === null || _petData$petDetails8 === void 0 ? void 0 : _petData$petDetails8.petType) || "Not Specified") + "</td>\n </tr>\n <tr>\n <th>Breed</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : (_petData$petDetails9 = petData.petDetails) === null || _petData$petDetails9 === void 0 ? void 0 : _petData$petDetails9.breedType) || "Not Specified") + "</td>\n </tr>\n <tr>\n <th>Owner Name</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : (_petData$owner = petData.owner) === null || _petData$owner === void 0 ? void 0 : _petData$owner.name) || "Not Specified") + "</td>\n </tr>\n <tr>\n <th>Contact Number</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : (_petData$owner2 = petData.owner) === null || _petData$owner2 === void 0 ? void 0 : _petData$owner2.mobileNumber) || "Not Specified") + "</td>\n </tr>\n <tr>\n <th>Email</th>\n <td>" + ((petData === null || petData === void 0 ? void 0 : (_petData$owner3 = petData.owner) === null || _petData$owner3 === void 0 ? void 0 : _petData$owner3.emailId) || "Not Specified") + "</td>\n </tr>\n <tr>\n <th>Application Status</th>\n <td style=\"color: #28a745; font-weight: bold;\">" + ((petData === null || petData === void 0 ? void 0 : petData.status) || "SUBMITTED") + "</td>\n </tr>\n </table>\n \n <div class=\"acknowledgement-text\">\n Please keep this acknowledgement for your records. You will be notified once your \n application is processed and approved. For any queries, please contact the Municipal \n Corporation office with your application number.\n </div>\n \n <div class=\"footer\">\n <p>Generated on: " + currentDate + "</p>\n <p>Municipal Corporation</p>\n <p>This is a computer-generated document and does not require a signature.</p>\n </div>\n </div>\n </body>\n </html>\n ";
18990
19123
  const printWindow = window.open("", "_blank");
18991
19124
  printWindow.document.write(content);
18992
19125
  printWindow.document.close();
@@ -20394,7 +20527,7 @@ const EmployeeApp = _ref => {
20394
20527
  isInbox: true
20395
20528
  })
20396
20529
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
20397
- path: path + "/petservice/new-application",
20530
+ path: path + "/petservice/new-application/:id?",
20398
20531
  component: PTRCreate
20399
20532
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
20400
20533
  path: path + "/petservice/application-details/:id",
@@ -21224,7 +21357,12 @@ const ApplicationDetails = () => {
21224
21357
  }) : /*#__PURE__*/React__default.createElement(digitUiReactComponents.StatusTable, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
21225
21358
  className: "border-none",
21226
21359
  text: t("PTR_NO_DOCUMENTS_MSG")
21227
- }))), /*#__PURE__*/React__default.createElement(PTRWFApplicationTimeline, {
21360
+ }))), ((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") && /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
21361
+ label: t("COMMON_EDIT"),
21362
+ onSubmit: () => {
21363
+ history.push("/digit-ui/employee/ptr/petservice/new-application/" + id);
21364
+ }
21365
+ })), /*#__PURE__*/React__default.createElement(PTRWFApplicationTimeline, {
21228
21366
  application: application,
21229
21367
  id: application === null || application === void 0 ? void 0 : application.applicationNumber,
21230
21368
  userType: "citizen"
@@ -22084,13 +22222,34 @@ const NewPTRStepperForm = () => {
22084
22222
  const formState = reactRedux.useSelector(state => state.ptr.PTRNewApplicationFormReducer);
22085
22223
  const step = formState.step;
22086
22224
  const tenantId = Digit.ULBService.getCurrentTenantId();
22225
+ const id = window.location.pathname.split("/").pop();
22226
+ const {
22227
+ isLoading,
22228
+ data: applicationData
22229
+ } = Digit.Hooks.ptr.usePTRSearch({
22230
+ tenantId,
22231
+ filters: {
22232
+ applicationNumber: id
22233
+ },
22234
+ enabled: !!id
22235
+ });
22236
+ React.useEffect(() => {
22237
+ var _applicationData$PetR;
22238
+ console.log("applicationData for hereee:>> ", applicationData);
22239
+ if (applicationData !== null && applicationData !== void 0 && (_applicationData$PetR = applicationData.PetRegistrationApplications) !== null && _applicationData$PetR !== void 0 && _applicationData$PetR.length) {
22240
+ dispatch(UPDATE_PTRNewApplication_FORM("responseData", applicationData.PetRegistrationApplications));
22241
+ }
22242
+ }, [applicationData]);
22087
22243
  const setStep = updatedStepNumber => {
22088
22244
  dispatch(SET_PTRNewApplication_STEP(updatedStepNumber));
22089
22245
  };
22090
- React.useEffect(() => {
22091
- dispatch(RESET_PTR_NEW_APPLICATION_FORM());
22092
- }, []);
22093
22246
  const handleSubmit = () => {};
22247
+ React.useEffect(() => {
22248
+ const unlisten = history.listen(() => {
22249
+ dispatch(RESET_PTR_NEW_APPLICATION_FORM());
22250
+ });
22251
+ return () => unlisten();
22252
+ }, [history, dispatch]);
22094
22253
  return /*#__PURE__*/React__default.createElement("div", {
22095
22254
  className: "pageCard"
22096
22255
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardHeader, {
@@ -22275,8 +22434,8 @@ const NewPTRStepFormThree = _ref => {
22275
22434
 
22276
22435
  const _excluded$8 = ["owner", "petDetails", "documents", "ownerName", "mobileNumber", "workflow"];
22277
22436
  const NewPTRStepFormFour = _ref => {
22278
- var _currentStepData$Crea, _user$info, _user$info$roles, _workflowDetails$data, _workflowDetails$data2, _workflowDetails$data3, _workflowDetails$data4, _workflowDetails$data5;
22279
- const goNext = function (data) {
22437
+ var _currentStepData$docu, _currentStepData$docu2, _currentStepData$Crea, _user$info, _user$info$roles, _workflowDetails$data, _workflowDetails$data2, _workflowDetails$data3, _workflowDetails$data4, _workflowDetails$data5;
22438
+ const goNext = function (selectedAction) {
22280
22439
  try {
22281
22440
  const {
22282
22441
  missingFields,
@@ -22284,22 +22443,35 @@ const NewPTRStepFormFour = _ref => {
22284
22443
  } = validateStepData(currentStepData);
22285
22444
  if (missingFields.length > 0) {
22286
22445
  setError("Please fill the following field: " + missingFields[0]);
22287
- setShowToast(true);
22446
+ setShowToast({
22447
+ key: "error"
22448
+ });
22288
22449
  return Promise.resolve();
22289
22450
  }
22290
22451
  if (notFormattedFields.length > 0) {
22291
22452
  setError("Please format the following field: " + notFormattedFields[0]);
22292
- setShowToast(true);
22453
+ setShowToast({
22454
+ key: "error"
22455
+ });
22293
22456
  return Promise.resolve();
22294
22457
  }
22295
22458
  const _temp = _catch(function () {
22296
- return Promise.resolve(onSubmit(currentStepData, data)).then(function (res) {
22459
+ return Promise.resolve(onSubmit(currentStepData, selectedAction)).then(function (res) {
22297
22460
  if (res !== null && res !== void 0 && res.isSuccess) {
22298
22461
  var _res$response, _res$response$PetRegi, _res$response$PetRegi2, _res$response$PetRegi3;
22299
22462
  const action = res === null || res === void 0 ? void 0 : (_res$response = res.response) === null || _res$response === void 0 ? void 0 : (_res$response$PetRegi = _res$response.PetRegistrationApplications) === null || _res$response$PetRegi === void 0 ? void 0 : (_res$response$PetRegi2 = _res$response$PetRegi[0]) === null || _res$response$PetRegi2 === void 0 ? void 0 : (_res$response$PetRegi3 = _res$response$PetRegi2.workflow) === null || _res$response$PetRegi3 === void 0 ? void 0 : _res$response$PetRegi3.action;
22300
22463
  if (action == "CANCEL") {
22301
22464
  alert("Cancelled Application");
22302
22465
  onGoToPTR();
22466
+ } else if (action == "SAVEASDRAFT") {
22467
+ setShowToast({
22468
+ key: "success",
22469
+ label: "Successfully saved as draft"
22470
+ });
22471
+ setError("Successfully saved as draft");
22472
+ setTimeout(() => {
22473
+ onGoToPTR();
22474
+ }, 1000);
22303
22475
  } else {
22304
22476
  var _currentStepData$Crea2;
22305
22477
  history.replace("/digit-ui/" + (isCitizen ? "citizen" : "employee") + "/ptr/petservice/response/" + (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$Crea2 = currentStepData.CreatedResponse) === null || _currentStepData$Crea2 === void 0 ? void 0 : _currentStepData$Crea2.applicationNumber), {
@@ -22309,13 +22481,17 @@ const NewPTRStepFormFour = _ref => {
22309
22481
  } else {
22310
22482
  var _res$Errors;
22311
22483
  setError((res === null || res === void 0 ? void 0 : (_res$Errors = res.Errors) === null || _res$Errors === void 0 ? void 0 : _res$Errors.message) || "Update failed");
22312
- setShowToast(true);
22484
+ setShowToast({
22485
+ key: "error"
22486
+ });
22313
22487
  }
22314
22488
  });
22315
22489
  }, function (error) {
22316
22490
  alert("Error: " + (error === null || error === void 0 ? void 0 : error.message));
22317
22491
  setError((error === null || error === void 0 ? void 0 : error.message) || "Update failed");
22318
- setShowToast(true);
22492
+ setShowToast({
22493
+ key: "error"
22494
+ });
22319
22495
  });
22320
22496
  return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
22321
22497
  } catch (e) {
@@ -22339,8 +22515,15 @@ const NewPTRStepFormFour = _ref => {
22339
22515
  const currentStepData = reactRedux.useSelector(function (state) {
22340
22516
  return state.ptr.PTRNewApplicationFormReducer.formData || {};
22341
22517
  });
22518
+ const updatedOwnerDetails = (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.ownerDetails) || {};
22519
+ const updatedPetDetails = (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.petDetails) || {};
22520
+ const updatedDocuments = (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$docu = currentStepData.documents) === null || _currentStepData$docu === void 0 ? void 0 : (_currentStepData$docu2 = _currentStepData$docu.documents) === null || _currentStepData$docu2 === void 0 ? void 0 : _currentStepData$docu2.documents) || [];
22342
22521
  const onGoToPTR = () => {
22343
- history.push("/digit-ui/citizen/ptr-home");
22522
+ if (isCitizen) {
22523
+ history.push("/digit-ui/citizen/ptr-home");
22524
+ } else {
22525
+ history.push("/digit-ui/employee/ptr/petservice/inbox");
22526
+ }
22344
22527
  };
22345
22528
  function validateStepData(data) {
22346
22529
  const missingFields = [];
@@ -22351,9 +22534,15 @@ const NewPTRStepFormFour = _ref => {
22351
22534
  };
22352
22535
  }
22353
22536
  const isCitizen = window.location.href.includes("citizen");
22537
+ const onFormValueChange = function (setValue, data) {
22538
+ const prevStepData = currentStepData[config.key] || {};
22539
+ if (!lodash.isEqual(data, prevStepData)) {
22540
+ dispatch(UPDATE_PTRNewApplication_FORM(config.key, data));
22541
+ }
22542
+ };
22354
22543
  const onSubmit = function (data, selectedAction) {
22355
22544
  try {
22356
- var _documentWrapper$docu, _petDetailsFromData$b, _petDetailsFromData$p, _petDetailsFromData$p2;
22545
+ var _updatedPetDetails$pe, _CreatedResponse$petD, _updatedPetDetails$br, _CreatedResponse$petD2, _updatedPetDetails$pe2, _CreatedResponse$petD3;
22357
22546
  const {
22358
22547
  CreatedResponse,
22359
22548
  ownerDetails,
@@ -22364,15 +22553,29 @@ const NewPTRStepFormFour = _ref => {
22364
22553
  workflow: existingWorkflow
22365
22554
  } = CreatedResponse,
22366
22555
  otherDetails = _objectWithoutPropertiesLoose(CreatedResponse, _excluded$8);
22367
- const formData = _extends({
22368
- owner: ownerDetails,
22369
- documents: (documentWrapper === null || documentWrapper === void 0 ? void 0 : (_documentWrapper$docu = documentWrapper.documents) === null || _documentWrapper$docu === void 0 ? void 0 : _documentWrapper$docu.documents) || [],
22370
- petDetails: _extends({}, petDetailsFromData, {
22371
- breedType: (petDetailsFromData === null || petDetailsFromData === void 0 ? void 0 : (_petDetailsFromData$b = petDetailsFromData.breedType) === null || _petDetailsFromData$b === void 0 ? void 0 : _petDetailsFromData$b.name) || "",
22372
- petType: (petDetailsFromData === null || petDetailsFromData === void 0 ? void 0 : (_petDetailsFromData$p = petDetailsFromData.petType) === null || _petDetailsFromData$p === void 0 ? void 0 : _petDetailsFromData$p.name) || "",
22373
- petGender: (petDetailsFromData === null || petDetailsFromData === void 0 ? void 0 : (_petDetailsFromData$p2 = petDetailsFromData.petGender) === null || _petDetailsFromData$p2 === void 0 ? void 0 : _petDetailsFromData$p2.name) || ""
22374
- })
22375
- }, otherDetails, {
22556
+ const formData = _extends({}, CreatedResponse, {
22557
+ owner: _extends({}, CreatedResponse === null || CreatedResponse === void 0 ? void 0 : CreatedResponse.owner, updatedOwnerDetails, {
22558
+ name: updatedOwnerDetails.firstName + " " + updatedOwnerDetails.lastName
22559
+ }),
22560
+ address: _extends({}, CreatedResponse === null || CreatedResponse === void 0 ? void 0 : CreatedResponse.address, {
22561
+ tenantId: tenantId
22562
+ }),
22563
+ petDetails: _extends({}, CreatedResponse === null || CreatedResponse === void 0 ? void 0 : CreatedResponse.petDetails, updatedPetDetails, {
22564
+ petType: (updatedPetDetails === null || updatedPetDetails === void 0 ? void 0 : (_updatedPetDetails$pe = updatedPetDetails.petType) === null || _updatedPetDetails$pe === void 0 ? void 0 : _updatedPetDetails$pe.name) || (CreatedResponse === null || CreatedResponse === void 0 ? void 0 : (_CreatedResponse$petD = CreatedResponse.petDetails) === null || _CreatedResponse$petD === void 0 ? void 0 : _CreatedResponse$petD.petType) || "",
22565
+ breedType: (updatedPetDetails === null || updatedPetDetails === void 0 ? void 0 : (_updatedPetDetails$br = updatedPetDetails.breedType) === null || _updatedPetDetails$br === void 0 ? void 0 : _updatedPetDetails$br.name) || (CreatedResponse === null || CreatedResponse === void 0 ? void 0 : (_CreatedResponse$petD2 = CreatedResponse.petDetails) === null || _CreatedResponse$petD2 === void 0 ? void 0 : _CreatedResponse$petD2.breedType) || "",
22566
+ petGender: (updatedPetDetails === null || updatedPetDetails === void 0 ? void 0 : (_updatedPetDetails$pe2 = updatedPetDetails.petGender) === null || _updatedPetDetails$pe2 === void 0 ? void 0 : _updatedPetDetails$pe2.name) || (CreatedResponse === null || CreatedResponse === void 0 ? void 0 : (_CreatedResponse$petD3 = CreatedResponse.petDetails) === null || _CreatedResponse$petD3 === void 0 ? void 0 : _CreatedResponse$petD3.petGender) || ""
22567
+ }),
22568
+ documents: updatedDocuments.map(doc => {
22569
+ const originalDoc = ((CreatedResponse === null || CreatedResponse === void 0 ? void 0 : CreatedResponse.documents) || []).find(d => d.documentUid === (doc === null || doc === void 0 ? void 0 : doc.documentUid) || d.filestoreId === (doc === null || doc === void 0 ? void 0 : doc.filestoreId)) || {};
22570
+ return {
22571
+ id: (originalDoc === null || originalDoc === void 0 ? void 0 : originalDoc.id) || (doc === null || doc === void 0 ? void 0 : doc.id),
22572
+ uuid: (originalDoc === null || originalDoc === void 0 ? void 0 : originalDoc.uuid) || (doc === null || doc === void 0 ? void 0 : doc.uuid),
22573
+ documentUid: (doc === null || doc === void 0 ? void 0 : doc.documentUid) || (originalDoc === null || originalDoc === void 0 ? void 0 : originalDoc.documentUid) || (doc === null || doc === void 0 ? void 0 : doc.filestoreId) || "",
22574
+ documentType: (doc === null || doc === void 0 ? void 0 : doc.documentType) || (originalDoc === null || originalDoc === void 0 ? void 0 : originalDoc.documentType) || "",
22575
+ documentAttachment: (doc === null || doc === void 0 ? void 0 : doc.filestoreId) || (originalDoc === null || originalDoc === void 0 ? void 0 : originalDoc.documentAttachment) || "",
22576
+ filestoreId: (doc === null || doc === void 0 ? void 0 : doc.filestoreId) || (originalDoc === null || originalDoc === void 0 ? void 0 : originalDoc.filestoreId) || ""
22577
+ };
22578
+ }),
22376
22579
  workflow: _extends({}, existingWorkflow, {
22377
22580
  action: (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.action) || "",
22378
22581
  comments: "",
@@ -22439,6 +22642,7 @@ const NewPTRStepFormFour = _ref => {
22439
22642
  defaultValues: currentStepData,
22440
22643
  config: config.currStepConfig,
22441
22644
  onSubmit: goNext,
22645
+ onFormValueChange: onFormValueChange,
22442
22646
  label: t("" + config.texts.submitBarLabel),
22443
22647
  currentStep: config.currStepNumber,
22444
22648
  onBackClick: onGoBack
@@ -22463,7 +22667,7 @@ const NewPTRStepFormFour = _ref => {
22463
22667
  onSubmit: () => setDisplayMenu(!displayMenu)
22464
22668
  })), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
22465
22669
  isDleteBtn: true,
22466
- error: true,
22670
+ error: showToast.key === "error" ? true : false,
22467
22671
  label: error,
22468
22672
  onClose: closeToast
22469
22673
  }));