@djb25/digit-ui-module-ws 1.0.116 → 1.0.117

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.
@@ -28121,7 +28121,7 @@ const ConnectionDetails$1 = _props => {
28121
28121
  const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-z.-]+\.(com|org|in)$/;
28122
28122
  const errors = sessionStorage.getItem("FORMSTATE_ERRORS");
28123
28123
  let formStateErros = typeof errors === "string" ? JSON.parse(errors) : {};
28124
- if (emailPattern.test(value)) {
28124
+ if (!value || !value.trim() || emailPattern.test(value)) {
28125
28125
  var _formStateErros$Conne, _formStateErros$Conne2, _formStateErros$Conne3, _formStateErros$Conne4;
28126
28126
  if (clearErrors) clearErrors("emailId");
28127
28127
  if (formStateErros["ConnectionHolderDetails"] && (_formStateErros$Conne = formStateErros["ConnectionHolderDetails"]) !== null && _formStateErros$Conne !== void 0 && _formStateErros$Conne.type && (_formStateErros$Conne2 = formStateErros["ConnectionHolderDetails"]) !== null && _formStateErros$Conne2 !== void 0 && (_formStateErros$Conne3 = _formStateErros$Conne2.type) !== null && _formStateErros$Conne3 !== void 0 && _formStateErros$Conne3.emailId) {
@@ -31463,7 +31463,7 @@ const WSDocumentsEmployee = _ref => {
31463
31463
  } = Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesNewMasters(tenantId, wsDocsData);
31464
31464
  const hasDjbEmployeeDoc = (documents || []).some(d => {
31465
31465
  var _d$documentType2;
31466
- return ((d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType2 = d.documentType) === null || _d$documentType2 === void 0 ? void 0 : _d$documentType2.includes("DJB_EMPLOYEE_ID"))) && (d === null || d === void 0 ? void 0 : d.fileStoreId);
31466
+ return ((d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType2 = d.documentType) === null || _d$documentType2 === void 0 ? void 0 : _d$documentType2.includes("DJB_EMPLOYEE_ID"))) && ((d === null || d === void 0 ? void 0 : d.fileStoreId) || (d === null || d === void 0 ? void 0 : d.file));
31467
31467
  });
31468
31468
  const addEmployeeDocError = () => {
31469
31469
  var _formState$errors, _formState$errors$con;
@@ -31497,21 +31497,35 @@ const WSDocumentsEmployee = _ref => {
31497
31497
  addEmployeeDocError();
31498
31498
  } else {
31499
31499
  removeEmployeeDocError();
31500
+ if (formSetValue && formData !== null && formData !== void 0 && formData.djbEmployee) {
31501
+ var _formData$djbEmployee;
31502
+ const djbItem = (documents || []).find(d => {
31503
+ var _d$documentType3;
31504
+ return ((d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType3 = d.documentType) === null || _d$documentType3 === void 0 ? void 0 : _d$documentType3.includes("DJB_EMPLOYEE_ID"))) && ((d === null || d === void 0 ? void 0 : d.fileStoreId) || (d === null || d === void 0 ? void 0 : d.file));
31505
+ });
31506
+ const fsId = (djbItem === null || djbItem === void 0 ? void 0 : djbItem.fileStoreId) || (djbItem === null || djbItem === void 0 ? void 0 : djbItem.file);
31507
+ if (fsId && (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee = formData.djbEmployee) === null || _formData$djbEmployee === void 0 ? void 0 : _formData$djbEmployee.document) !== fsId) {
31508
+ formSetValue("djbEmployee", {
31509
+ ...formData.djbEmployee,
31510
+ document: fsId
31511
+ });
31512
+ }
31513
+ }
31500
31514
  }
31501
31515
  } else {
31502
- var _formData$djbEmployee;
31516
+ var _formData$djbEmployee2;
31503
31517
  removeEmployeeDocError();
31504
31518
  setDocuments(prevDocs => {
31505
31519
  const filtered = (prevDocs || []).filter(d => {
31506
- var _d$documentType3;
31507
- return (d === null || d === void 0 ? void 0 : d.documentType) !== "OWNER.DJB_EMPLOYEE_ID" && !(d !== null && d !== void 0 && (_d$documentType3 = d.documentType) !== null && _d$documentType3 !== void 0 && _d$documentType3.includes("DJB_EMPLOYEE_ID"));
31520
+ var _d$documentType4;
31521
+ return (d === null || d === void 0 ? void 0 : d.documentType) !== "OWNER.DJB_EMPLOYEE_ID" && !(d !== null && d !== void 0 && (_d$documentType4 = d.documentType) !== null && _d$documentType4 !== void 0 && _d$documentType4.includes("DJB_EMPLOYEE_ID"));
31508
31522
  });
31509
31523
  if (filtered.length !== (prevDocs || []).length) {
31510
31524
  return filtered;
31511
31525
  }
31512
31526
  return prevDocs;
31513
31527
  });
31514
- if (formSetValue && formData !== null && formData !== void 0 && (_formData$djbEmployee = formData.djbEmployee) !== null && _formData$djbEmployee !== void 0 && _formData$djbEmployee.document) {
31528
+ if (formSetValue && formData !== null && formData !== void 0 && (_formData$djbEmployee2 = formData.djbEmployee) !== null && _formData$djbEmployee2 !== void 0 && _formData$djbEmployee2.document) {
31515
31529
  formSetValue("djbEmployee", {
31516
31530
  ...formData.djbEmployee,
31517
31531
  document: ""
@@ -31746,7 +31760,7 @@ const WSDocumentsEmployee = _ref => {
31746
31760
  }));
31747
31761
  };
31748
31762
  function EmployeeIdDocumentUpload(_ref2) {
31749
- var _formData$djbEmployee2, _formData$djbEmployee3, _formData$djbEmployee4, _formData$djbEmployee5, _formData$djbEmployee0;
31763
+ var _formData$djbEmployee3, _formData$djbEmployee4, _formData$djbEmployee5, _formData$djbEmployee6, _formData$djbEmployee1;
31750
31764
  let {
31751
31765
  t,
31752
31766
  documents,
@@ -31756,26 +31770,26 @@ function EmployeeIdDocumentUpload(_ref2) {
31756
31770
  tenantId
31757
31771
  } = _ref2;
31758
31772
  const existingEmployeeDoc = documents === null || documents === void 0 ? void 0 : documents.find(d => {
31759
- var _d$documentType4;
31760
- return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType4 = d.documentType) === null || _d$documentType4 === void 0 ? void 0 : _d$documentType4.includes("DJB_EMPLOYEE_ID"));
31773
+ var _d$documentType5;
31774
+ return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType5 = d.documentType) === null || _d$documentType5 === void 0 ? void 0 : _d$documentType5.includes("DJB_EMPLOYEE_ID"));
31761
31775
  });
31762
- const initialFileId = (existingEmployeeDoc === null || existingEmployeeDoc === void 0 ? void 0 : existingEmployeeDoc.fileStoreId) || (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee2 = formData.djbEmployee) === null || _formData$djbEmployee2 === void 0 ? void 0 : (_formData$djbEmployee3 = _formData$djbEmployee2.document) === null || _formData$djbEmployee3 === void 0 ? void 0 : _formData$djbEmployee3.fileStoreId) || (typeof (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee4 = formData.djbEmployee) === null || _formData$djbEmployee4 === void 0 ? void 0 : _formData$djbEmployee4.document) === "string" ? formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee5 = formData.djbEmployee) === null || _formData$djbEmployee5 === void 0 ? void 0 : _formData$djbEmployee5.document : null);
31776
+ const initialFileId = (existingEmployeeDoc === null || existingEmployeeDoc === void 0 ? void 0 : existingEmployeeDoc.fileStoreId) || (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee3 = formData.djbEmployee) === null || _formData$djbEmployee3 === void 0 ? void 0 : (_formData$djbEmployee4 = _formData$djbEmployee3.document) === null || _formData$djbEmployee4 === void 0 ? void 0 : _formData$djbEmployee4.fileStoreId) || (typeof (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee5 = formData.djbEmployee) === null || _formData$djbEmployee5 === void 0 ? void 0 : _formData$djbEmployee5.document) === "string" ? formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee6 = formData.djbEmployee) === null || _formData$djbEmployee6 === void 0 ? void 0 : _formData$djbEmployee6.document : null);
31763
31777
  const [file, setFile] = useState(null);
31764
31778
  const [uploadedFile, setUploadedFile] = useState(initialFileId || null);
31765
31779
  const [fileName, setFileName] = useState((existingEmployeeDoc === null || existingEmployeeDoc === void 0 ? void 0 : existingEmployeeDoc.fileName) || "");
31766
31780
  const [errorUpload, setErrorUpload] = useState(null);
31767
31781
  useEffect(() => {
31768
- var _formData$djbEmployee6, _formData$djbEmployee7, _formData$djbEmployee8, _formData$djbEmployee9;
31782
+ var _formData$djbEmployee7, _formData$djbEmployee8, _formData$djbEmployee9, _formData$djbEmployee0;
31769
31783
  const doc = documents === null || documents === void 0 ? void 0 : documents.find(d => {
31770
- var _d$documentType5;
31771
- return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType5 = d.documentType) === null || _d$documentType5 === void 0 ? void 0 : _d$documentType5.includes("DJB_EMPLOYEE_ID"));
31784
+ var _d$documentType6;
31785
+ return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType6 = d.documentType) === null || _d$documentType6 === void 0 ? void 0 : _d$documentType6.includes("DJB_EMPLOYEE_ID"));
31772
31786
  });
31773
- const currentId = (doc === null || doc === void 0 ? void 0 : doc.fileStoreId) || (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee6 = formData.djbEmployee) === null || _formData$djbEmployee6 === void 0 ? void 0 : (_formData$djbEmployee7 = _formData$djbEmployee6.document) === null || _formData$djbEmployee7 === void 0 ? void 0 : _formData$djbEmployee7.fileStoreId) || (typeof (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee8 = formData.djbEmployee) === null || _formData$djbEmployee8 === void 0 ? void 0 : _formData$djbEmployee8.document) === "string" ? formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee9 = formData.djbEmployee) === null || _formData$djbEmployee9 === void 0 ? void 0 : _formData$djbEmployee9.document : null);
31787
+ const currentId = (doc === null || doc === void 0 ? void 0 : doc.fileStoreId) || (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee7 = formData.djbEmployee) === null || _formData$djbEmployee7 === void 0 ? void 0 : (_formData$djbEmployee8 = _formData$djbEmployee7.document) === null || _formData$djbEmployee8 === void 0 ? void 0 : _formData$djbEmployee8.fileStoreId) || (typeof (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee9 = formData.djbEmployee) === null || _formData$djbEmployee9 === void 0 ? void 0 : _formData$djbEmployee9.document) === "string" ? formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee0 = formData.djbEmployee) === null || _formData$djbEmployee0 === void 0 ? void 0 : _formData$djbEmployee0.document : null);
31774
31788
  if (currentId !== uploadedFile) {
31775
31789
  setUploadedFile(currentId || null);
31776
31790
  if (doc !== null && doc !== void 0 && doc.fileName) setFileName(doc.fileName);
31777
31791
  }
31778
- }, [documents, formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee0 = formData.djbEmployee) === null || _formData$djbEmployee0 === void 0 ? void 0 : _formData$djbEmployee0.document]);
31792
+ }, [documents, formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee1 = formData.djbEmployee) === null || _formData$djbEmployee1 === void 0 ? void 0 : _formData$djbEmployee1.document]);
31779
31793
  useEffect(() => {
31780
31794
  (function () {
31781
31795
  try {
@@ -31799,17 +31813,17 @@ function EmployeeIdDocumentUpload(_ref2) {
31799
31813
  setUploadedFile(fileId);
31800
31814
  setFileName(nameOfFile);
31801
31815
  setDocuments(prevDocs => {
31802
- var _formData$djbEmployee1;
31816
+ var _formData$djbEmployee10;
31803
31817
  const filtered = (prevDocs || []).filter(d => {
31804
- var _d$documentType6;
31805
- return (d === null || d === void 0 ? void 0 : d.documentType) !== "OWNER.DJB_EMPLOYEE_ID" && !(d !== null && d !== void 0 && (_d$documentType6 = d.documentType) !== null && _d$documentType6 !== void 0 && _d$documentType6.includes("DJB_EMPLOYEE_ID"));
31818
+ var _d$documentType7;
31819
+ return (d === null || d === void 0 ? void 0 : d.documentType) !== "OWNER.DJB_EMPLOYEE_ID" && !(d !== null && d !== void 0 && (_d$documentType7 = d.documentType) !== null && _d$documentType7 !== void 0 && _d$documentType7.includes("DJB_EMPLOYEE_ID"));
31806
31820
  });
31807
31821
  return [...filtered, {
31808
31822
  documentType: "OWNER.DJB_EMPLOYEE_ID",
31809
31823
  fileStoreId: fileId,
31810
31824
  fileName: nameOfFile,
31811
31825
  documentName: "WS_UPLOAD_EMPLOYEE_ID_DOC",
31812
- documentUid: (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee1 = formData.djbEmployee) === null || _formData$djbEmployee1 === void 0 ? void 0 : _formData$djbEmployee1.employeeId) || "",
31826
+ documentUid: (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee10 = formData.djbEmployee) === null || _formData$djbEmployee10 === void 0 ? void 0 : _formData$djbEmployee10.employeeId) || "",
31813
31827
  i18nKey: "WS_UPLOAD_EMPLOYEE_ID_DOC",
31814
31828
  status: "ACTIVE"
31815
31829
  }];
@@ -31859,8 +31873,8 @@ function EmployeeIdDocumentUpload(_ref2) {
31859
31873
  const fileInput = document.getElementById("employee-doc-upload");
31860
31874
  if (fileInput) fileInput.value = "";
31861
31875
  setDocuments(prevDocs => (prevDocs || []).filter(d => {
31862
- var _d$documentType7;
31863
- return (d === null || d === void 0 ? void 0 : d.documentType) !== "OWNER.DJB_EMPLOYEE_ID" && !(d !== null && d !== void 0 && (_d$documentType7 = d.documentType) !== null && _d$documentType7 !== void 0 && _d$documentType7.includes("DJB_EMPLOYEE_ID"));
31876
+ var _d$documentType8;
31877
+ return (d === null || d === void 0 ? void 0 : d.documentType) !== "OWNER.DJB_EMPLOYEE_ID" && !(d !== null && d !== void 0 && (_d$documentType8 = d.documentType) !== null && _d$documentType8 !== void 0 && _d$documentType8.includes("DJB_EMPLOYEE_ID"));
31864
31878
  }));
31865
31879
  if (formSetValue && formData !== null && formData !== void 0 && formData.djbEmployee) {
31866
31880
  formSetValue("djbEmployee", {
@@ -38779,7 +38793,7 @@ const WSDeclaration = _ref => {
38779
38793
  };
38780
38794
 
38781
38795
  const WSDjbEmployee = _ref => {
38782
- var _formData$additionalD, _localFormState$touch, _formValue$employeeId, _formValue$employeeId2, _localFormState$touch2, _formValue$designatio, _formValue$designatio2, _formData$dueVerifica;
38796
+ var _formData$additionalD, _formData$djbEmployee3, _localFormState$touch, _formValue$employeeId, _formValue$employeeId2, _localFormState$touch2, _formValue$designatio, _formValue$designatio2, _formData$dueVerifica;
38783
38797
  let {
38784
38798
  config,
38785
38799
  onSelect,
@@ -38877,20 +38891,27 @@ const WSDjbEmployee = _ref => {
38877
38891
  useEffect(() => {
38878
38892
  const isEmployeeMode = userType === "employee" || window.location.href.includes("edit-application") || window.location.href.includes("modify-connection") || window.location.href.includes("old-application");
38879
38893
  if (isEmployeeMode) {
38880
- const isDifferent = !lodash.isEqual(formData === null || formData === void 0 ? void 0 : formData.djbEmployee, formValue);
38894
+ var _formData$djbEmployee;
38895
+ const currentDoc = (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee = formData.djbEmployee) === null || _formData$djbEmployee === void 0 ? void 0 : _formData$djbEmployee.document) || (formValue === null || formValue === void 0 ? void 0 : formValue.document) || "";
38896
+ const formValueComparable = {
38897
+ ...formValue,
38898
+ document: currentDoc
38899
+ };
38900
+ const isDifferent = !lodash.isEqual(formData === null || formData === void 0 ? void 0 : formData.djbEmployee, formValueComparable);
38881
38901
  if (isDifferent) {
38882
- var _formData$djbEmployee;
38883
- const isImmediate = (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee = formData.djbEmployee) === null || _formData$djbEmployee === void 0 ? void 0 : _formData$djbEmployee.isDjbEmployee) !== (formValue === null || formValue === void 0 ? void 0 : formValue.isDjbEmployee);
38902
+ var _formData$djbEmployee2;
38903
+ const isImmediate = (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee2 = formData.djbEmployee) === null || _formData$djbEmployee2 === void 0 ? void 0 : _formData$djbEmployee2.isDjbEmployee) !== (formValue === null || formValue === void 0 ? void 0 : formValue.isDjbEmployee);
38884
38904
  const delay = isImmediate ? 0 : 100;
38885
38905
  const timer = setTimeout(() => {
38886
38906
  onSelect((config === null || config === void 0 ? void 0 : config.key) || "djbEmployee", {
38887
- ...formValue
38907
+ ...formValue,
38908
+ document: currentDoc
38888
38909
  });
38889
38910
  }, delay);
38890
38911
  return () => clearTimeout(timer);
38891
38912
  }
38892
38913
  }
38893
- }, [formValue, userType]);
38914
+ }, [formValue, userType, formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee3 = formData.djbEmployee) === null || _formData$djbEmployee3 === void 0 ? void 0 : _formData$djbEmployee3.document]);
38894
38915
  useEffect(() => {
38895
38916
  const configKey = (config === null || config === void 0 ? void 0 : config.key) || "djbEmployee";
38896
38917
  if (hasDjbErrors) {
@@ -67176,6 +67197,41 @@ const OLDApplication = () => {
67176
67197
  setPropertyId(cptId);
67177
67198
  }
67178
67199
  }, [sessionFormData === null || sessionFormData === void 0 ? void 0 : sessionFormData.cpt, propertyId]);
67200
+ useEffect(() => {
67201
+ var _formDataRef$current, _formDataRef$current$, _formDataRef$current$2, _propertyDetails$Prop, _propertyDetails$Prop2;
67202
+ const hasProp = ((_formDataRef$current = formDataRef.current) === null || _formDataRef$current === void 0 ? void 0 : (_formDataRef$current$ = _formDataRef$current.cpt) === null || _formDataRef$current$ === void 0 ? void 0 : (_formDataRef$current$2 = _formDataRef$current$.details) === null || _formDataRef$current$2 === void 0 ? void 0 : _formDataRef$current$2.propertyId) || sessionStorage.getItem("WS_OTP_VERIFIED_PROPERTY_ID") || propertyId || (propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop = propertyDetails.Properties) === null || _propertyDetails$Prop === void 0 ? void 0 : (_propertyDetails$Prop2 = _propertyDetails$Prop[0]) === null || _propertyDetails$Prop2 === void 0 ? void 0 : _propertyDetails$Prop2.propertyId);
67203
+ if (hasProp && !canSubmit) {
67204
+ var _formDataRef$current2, _formDataRef$current3, _formDataRef$current4, _formDataRef$current5, _formDataRef$current6, _formDataRef$current7, _formDataRef$current8, _djbData$document, _formDataRef$current9, _formDataRef$current0;
67205
+ const djbData = ((_formDataRef$current2 = formDataRef.current) === null || _formDataRef$current2 === void 0 ? void 0 : _formDataRef$current2.djbEmployee) || ((_formDataRef$current3 = formDataRef.current) === null || _formDataRef$current3 === void 0 ? void 0 : _formDataRef$current3.additionalDetails);
67206
+ const isDjbEmp = (djbData === null || djbData === void 0 ? void 0 : djbData.isDjbEmployee) === true || String(djbData === null || djbData === void 0 ? void 0 : djbData.isDjbEmployee) === "true";
67207
+ const docs = ((_formDataRef$current4 = formDataRef.current) === null || _formDataRef$current4 === void 0 ? void 0 : (_formDataRef$current5 = _formDataRef$current4.DocumentsRequired) === null || _formDataRef$current5 === void 0 ? void 0 : _formDataRef$current5.documents) || ((_formDataRef$current6 = formDataRef.current) === null || _formDataRef$current6 === void 0 ? void 0 : (_formDataRef$current7 = _formDataRef$current6.documents) === null || _formDataRef$current7 === void 0 ? void 0 : _formDataRef$current7.documents) || ((_formDataRef$current8 = formDataRef.current) === null || _formDataRef$current8 === void 0 ? void 0 : _formDataRef$current8.documents) || [];
67208
+ const foundDjb = Array.isArray(docs) && docs.find(d => {
67209
+ var _d$documentType;
67210
+ return ((d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType = d.documentType) === null || _d$documentType === void 0 ? void 0 : _d$documentType.includes("DJB_EMPLOYEE_ID"))) && ((d === null || d === void 0 ? void 0 : d.fileStoreId) || (d === null || d === void 0 ? void 0 : d.file) || (d === null || d === void 0 ? void 0 : d.filestoreId));
67211
+ });
67212
+ const djbDoc = (djbData === null || djbData === void 0 ? void 0 : (_djbData$document = djbData.document) === null || _djbData$document === void 0 ? void 0 : _djbData$document.fileStoreId) || typeof (djbData === null || djbData === void 0 ? void 0 : djbData.document) === "string" && (djbData === null || djbData === void 0 ? void 0 : djbData.document.trim()) || (djbData === null || djbData === void 0 ? void 0 : djbData.document) || (foundDjb ? foundDjb.fileStoreId || foundDjb.file || foundDjb.filestoreId : null);
67213
+ const isDjbEmpInv = isDjbEmp && (!(djbData !== null && djbData !== void 0 && djbData.employeeId) || !String(djbData === null || djbData === void 0 ? void 0 : djbData.employeeId).trim() || !(djbData !== null && djbData !== void 0 && djbData.designation) || !String(djbData === null || djbData === void 0 ? void 0 : djbData.designation).trim() || !djbDoc);
67214
+ const rwhData = ((_formDataRef$current9 = formDataRef.current) === null || _formDataRef$current9 === void 0 ? void 0 : _formDataRef$current9.rainWaterHarvesting) || ((_formDataRef$current0 = formDataRef.current) === null || _formDataRef$current0 === void 0 ? void 0 : _formDataRef$current0.additionalDetails);
67215
+ const isRwhReq = (rwhData === null || rwhData === void 0 ? void 0 : rwhData.hasCertificate) === true || String(rwhData === null || rwhData === void 0 ? void 0 : rwhData.hasCertificate) === "true" || (rwhData === null || rwhData === void 0 ? void 0 : rwhData.isRainwaterHarvesting) === true || String(rwhData === null || rwhData === void 0 ? void 0 : rwhData.isRainwaterHarvesting) === "true";
67216
+ const isRwhUploaded = Array.isArray(docs) && docs.some(d => isRwhDoc(d) && ((d === null || d === void 0 ? void 0 : d.fileStoreId) || (d === null || d === void 0 ? void 0 : d.file)));
67217
+ const isRwhInv = isRwhReq && !isRwhUploaded;
67218
+ const storedErrors = sessionStorage.getItem("FORMSTATE_ERRORS");
67219
+ let parsedErrors = {};
67220
+ try {
67221
+ parsedErrors = storedErrors ? JSON.parse(storedErrors) : {};
67222
+ } catch (e) {}
67223
+ const hasStoredErrors = Object.keys(parsedErrors).some(k => {
67224
+ const err = parsedErrors[k];
67225
+ if (!err) return false;
67226
+ if (Array.isArray(err === null || err === void 0 ? void 0 : err.type) && err.type.length === 0) return false;
67227
+ if (typeof err === "object" && Object.keys(err).length === 0) return false;
67228
+ return true;
67229
+ });
67230
+ if (!hasStoredErrors && !isDjbEmpInv && !isRwhInv) {
67231
+ setSubmitValve(true);
67232
+ }
67233
+ }
67234
+ }, [propertyId, propertyDetails]);
67179
67235
  const {
67180
67236
  isLoading: creatingWaterApplicationLoading,
67181
67237
  mutate: waterMutation
@@ -67193,7 +67249,7 @@ const OLDApplication = () => {
67193
67249
  mutate: sewerageUpdateMutation
67194
67250
  } = Digit.Hooks.ws.useWSApplicationActions("SEWERAGE");
67195
67251
  const onFormValueChange = (setValue, formData, formState) => {
67196
- var _formData$cpt, _formData$cpt$details, _formDataRef$current, _formDataRef$current2, _djbData$document, _formDataRef$current3, _formDataRef$current4, _formDataRef$current5, _formDataRef$current6, _formData$DocumentsRe, _formData$DocumentsRe2, _formData$DocumentsRe3, _formDataRef$current7, _formDataRef$current8, _formDataRef$current9, _formDataRef$current0, _formData$documents, _formData$documents$d, _formData$documents$d2, _djbData$document2, _formDataRef$current1, _formDataRef$current10, _formDataRef$current11, _propertyDetails$Prop, _propertyDetails$Prop2;
67252
+ var _formData$cpt, _formData$cpt$details, _formDataRef$current1, _formDataRef$current10, _djbData$document2, _formDataRef$current11, _formDataRef$current12, _formData$DocumentsRe, _formDataRef$current13, _formDataRef$current14, _formData$documents, _formDataRef$current15, _formDataRef$current16, _formDataRef$current17, _formDataRef$current18, _formDataRef$current19, _formData$DocumentsRe2, _formDataRef$current20, _formDataRef$current21, _formData$documents2, _formDataRef$current22, _formDataRef$current23, _formDataRef$current24, _formDataRef$current25, _propertyDetails$Prop3, _propertyDetails$Prop4;
67197
67253
  formDataRef.current = {
67198
67254
  ...formDataRef.current,
67199
67255
  ...formData
@@ -67209,36 +67265,49 @@ const OLDApplication = () => {
67209
67265
  if (!propertyId && cptPropId) {
67210
67266
  setPropertyId(cptPropId);
67211
67267
  }
67212
- const djbData = ((_formDataRef$current = formDataRef.current) === null || _formDataRef$current === void 0 ? void 0 : _formDataRef$current.djbEmployee) || ((_formDataRef$current2 = formDataRef.current) === null || _formDataRef$current2 === void 0 ? void 0 : _formDataRef$current2.additionalDetails);
67268
+ const findDjbDoc = docs => {
67269
+ if (!Array.isArray(docs)) return null;
67270
+ const found = docs.find(d => {
67271
+ var _d$documentType2;
67272
+ return ((d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType2 = d.documentType) === null || _d$documentType2 === void 0 ? void 0 : _d$documentType2.includes("DJB_EMPLOYEE_ID"))) && ((d === null || d === void 0 ? void 0 : d.fileStoreId) || (d === null || d === void 0 ? void 0 : d.file) || (d === null || d === void 0 ? void 0 : d.filestoreId));
67273
+ });
67274
+ return found ? found.fileStoreId || found.file || found.filestoreId : null;
67275
+ };
67276
+ const djbData = ((_formDataRef$current1 = formDataRef.current) === null || _formDataRef$current1 === void 0 ? void 0 : _formDataRef$current1.djbEmployee) || ((_formDataRef$current10 = formDataRef.current) === null || _formDataRef$current10 === void 0 ? void 0 : _formDataRef$current10.additionalDetails);
67213
67277
  const isDjbEmp = (djbData === null || djbData === void 0 ? void 0 : djbData.isDjbEmployee) === true || String(djbData === null || djbData === void 0 ? void 0 : djbData.isDjbEmployee) === "true";
67214
- const djbDoc = (djbData === null || djbData === void 0 ? void 0 : (_djbData$document = djbData.document) === null || _djbData$document === void 0 ? void 0 : _djbData$document.fileStoreId) || typeof (djbData === null || djbData === void 0 ? void 0 : djbData.document) === "string" && (djbData === null || djbData === void 0 ? void 0 : djbData.document.trim()) || (djbData === null || djbData === void 0 ? void 0 : djbData.document) || ((_formDataRef$current3 = formDataRef.current) === null || _formDataRef$current3 === void 0 ? void 0 : (_formDataRef$current4 = _formDataRef$current3.DocumentsRequired) === null || _formDataRef$current4 === void 0 ? void 0 : (_formDataRef$current5 = _formDataRef$current4.documents) === null || _formDataRef$current5 === void 0 ? void 0 : (_formDataRef$current6 = _formDataRef$current5.find(d => {
67215
- var _d$documentType;
67216
- return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType = d.documentType) === null || _d$documentType === void 0 ? void 0 : _d$documentType.includes("DJB_EMPLOYEE_ID"));
67217
- })) === null || _formDataRef$current6 === void 0 ? void 0 : _formDataRef$current6.fileStoreId) || (formData === null || formData === void 0 ? void 0 : (_formData$DocumentsRe = formData.DocumentsRequired) === null || _formData$DocumentsRe === void 0 ? void 0 : (_formData$DocumentsRe2 = _formData$DocumentsRe.documents) === null || _formData$DocumentsRe2 === void 0 ? void 0 : (_formData$DocumentsRe3 = _formData$DocumentsRe2.find(d => {
67218
- var _d$documentType2;
67219
- return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType2 = d.documentType) === null || _d$documentType2 === void 0 ? void 0 : _d$documentType2.includes("DJB_EMPLOYEE_ID"));
67220
- })) === null || _formData$DocumentsRe3 === void 0 ? void 0 : _formData$DocumentsRe3.fileStoreId) || ((_formDataRef$current7 = formDataRef.current) === null || _formDataRef$current7 === void 0 ? void 0 : (_formDataRef$current8 = _formDataRef$current7.documents) === null || _formDataRef$current8 === void 0 ? void 0 : (_formDataRef$current9 = _formDataRef$current8.documents) === null || _formDataRef$current9 === void 0 ? void 0 : (_formDataRef$current0 = _formDataRef$current9.find(d => {
67221
- var _d$documentType3;
67222
- return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType3 = d.documentType) === null || _d$documentType3 === void 0 ? void 0 : _d$documentType3.includes("DJB_EMPLOYEE_ID"));
67223
- })) === null || _formDataRef$current0 === void 0 ? void 0 : _formDataRef$current0.fileStoreId) || (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$d2 = _formData$documents$d.find(d => {
67224
- var _d$documentType4;
67225
- return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType4 = d.documentType) === null || _d$documentType4 === void 0 ? void 0 : _d$documentType4.includes("DJB_EMPLOYEE_ID"));
67226
- })) === null || _formData$documents$d2 === void 0 ? void 0 : _formData$documents$d2.fileStoreId);
67227
- const isDjbEmpInvalid = isDjbEmp && (!(djbData !== null && djbData !== void 0 && djbData.employeeId) || !String(djbData === null || djbData === void 0 ? void 0 : djbData.employeeId).trim() || !(djbData !== null && djbData !== void 0 && djbData.designation) || !String(djbData === null || djbData === void 0 ? void 0 : djbData.designation).trim() || !(djbData !== null && djbData !== void 0 && (_djbData$document2 = djbData.document) !== null && _djbData$document2 !== void 0 && _djbData$document2.fileStoreId || typeof (djbData === null || djbData === void 0 ? void 0 : djbData.document) === "string" && djbData !== null && djbData !== void 0 && djbData.document.trim() || djbData !== null && djbData !== void 0 && djbData.document));
67228
- const hasErrors = Object.keys((formState === null || formState === void 0 ? void 0 : formState.errors) || {}).length > 0 || isDjbEmpInvalid;
67229
- const hasProperty = ((_formDataRef$current1 = formDataRef.current) === null || _formDataRef$current1 === void 0 ? void 0 : (_formDataRef$current10 = _formDataRef$current1.cpt) === null || _formDataRef$current10 === void 0 ? void 0 : (_formDataRef$current11 = _formDataRef$current10.details) === null || _formDataRef$current11 === void 0 ? void 0 : _formDataRef$current11.propertyId) || sessionStorage.getItem("WS_OTP_VERIFIED_PROPERTY_ID") || propertyId || (propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop = propertyDetails.Properties) === null || _propertyDetails$Prop === void 0 ? void 0 : (_propertyDetails$Prop2 = _propertyDetails$Prop[0]) === null || _propertyDetails$Prop2 === void 0 ? void 0 : _propertyDetails$Prop2.propertyId);
67278
+ const djbDoc = (djbData === null || djbData === void 0 ? void 0 : (_djbData$document2 = djbData.document) === null || _djbData$document2 === void 0 ? void 0 : _djbData$document2.fileStoreId) || typeof (djbData === null || djbData === void 0 ? void 0 : djbData.document) === "string" && (djbData === null || djbData === void 0 ? void 0 : djbData.document.trim()) || (djbData === null || djbData === void 0 ? void 0 : djbData.document) || findDjbDoc((_formDataRef$current11 = formDataRef.current) === null || _formDataRef$current11 === void 0 ? void 0 : (_formDataRef$current12 = _formDataRef$current11.DocumentsRequired) === null || _formDataRef$current12 === void 0 ? void 0 : _formDataRef$current12.documents) || findDjbDoc(formData === null || formData === void 0 ? void 0 : (_formData$DocumentsRe = formData.DocumentsRequired) === null || _formData$DocumentsRe === void 0 ? void 0 : _formData$DocumentsRe.documents) || findDjbDoc((_formDataRef$current13 = formDataRef.current) === null || _formDataRef$current13 === void 0 ? void 0 : (_formDataRef$current14 = _formDataRef$current13.documents) === null || _formDataRef$current14 === void 0 ? void 0 : _formDataRef$current14.documents) || findDjbDoc(formData === null || formData === void 0 ? void 0 : (_formData$documents = formData.documents) === null || _formData$documents === void 0 ? void 0 : _formData$documents.documents) || findDjbDoc((_formDataRef$current15 = formDataRef.current) === null || _formDataRef$current15 === void 0 ? void 0 : _formDataRef$current15.documents) || findDjbDoc(formData === null || formData === void 0 ? void 0 : formData.documents);
67279
+ if (djbDoc) {
67280
+ if (!formDataRef.current.djbEmployee) formDataRef.current.djbEmployee = {};
67281
+ formDataRef.current.djbEmployee.document = djbDoc;
67282
+ }
67283
+ const isDjbEmpInvalid = isDjbEmp && (!(djbData !== null && djbData !== void 0 && djbData.employeeId) || !String(djbData === null || djbData === void 0 ? void 0 : djbData.employeeId).trim() || !(djbData !== null && djbData !== void 0 && djbData.designation) || !String(djbData === null || djbData === void 0 ? void 0 : djbData.designation).trim() || !djbDoc);
67284
+ const rwhData = ((_formDataRef$current16 = formDataRef.current) === null || _formDataRef$current16 === void 0 ? void 0 : _formDataRef$current16.rainWaterHarvesting) || ((_formDataRef$current17 = formDataRef.current) === null || _formDataRef$current17 === void 0 ? void 0 : _formDataRef$current17.additionalDetails);
67285
+ const isRwhRequired = (rwhData === null || rwhData === void 0 ? void 0 : rwhData.hasCertificate) === true || String(rwhData === null || rwhData === void 0 ? void 0 : rwhData.hasCertificate) === "true" || (rwhData === null || rwhData === void 0 ? void 0 : rwhData.isRainwaterHarvesting) === true || String(rwhData === null || rwhData === void 0 ? void 0 : rwhData.isRainwaterHarvesting) === "true";
67286
+ const allCurrentDocs = ((_formDataRef$current18 = formDataRef.current) === null || _formDataRef$current18 === void 0 ? void 0 : (_formDataRef$current19 = _formDataRef$current18.DocumentsRequired) === null || _formDataRef$current19 === void 0 ? void 0 : _formDataRef$current19.documents) || (formData === null || formData === void 0 ? void 0 : (_formData$DocumentsRe2 = formData.DocumentsRequired) === null || _formData$DocumentsRe2 === void 0 ? void 0 : _formData$DocumentsRe2.documents) || ((_formDataRef$current20 = formDataRef.current) === null || _formDataRef$current20 === void 0 ? void 0 : (_formDataRef$current21 = _formDataRef$current20.documents) === null || _formDataRef$current21 === void 0 ? void 0 : _formDataRef$current21.documents) || (formData === null || formData === void 0 ? void 0 : (_formData$documents2 = formData.documents) === null || _formData$documents2 === void 0 ? void 0 : _formData$documents2.documents) || ((_formDataRef$current22 = formDataRef.current) === null || _formDataRef$current22 === void 0 ? void 0 : _formDataRef$current22.documents) || (formData === null || formData === void 0 ? void 0 : formData.documents) || [];
67287
+ const isRwhDocUploaded = Array.isArray(allCurrentDocs) && allCurrentDocs.some(d => isRwhDoc(d) && ((d === null || d === void 0 ? void 0 : d.fileStoreId) || (d === null || d === void 0 ? void 0 : d.file)));
67288
+ const isRwhInvalid = isRwhRequired && !isRwhDocUploaded;
67289
+ const actualFormErrors = Object.keys((formState === null || formState === void 0 ? void 0 : formState.errors) || {}).filter(key => {
67290
+ var _formState$errors;
67291
+ const err = formState === null || formState === void 0 ? void 0 : (_formState$errors = formState.errors) === null || _formState$errors === void 0 ? void 0 : _formState$errors[key];
67292
+ if (!err) return false;
67293
+ if (Array.isArray(err === null || err === void 0 ? void 0 : err.type) && err.type.length === 0) return false;
67294
+ if (typeof err === "object" && Object.keys(err).length === 0) return false;
67295
+ return true;
67296
+ });
67297
+ const hasErrors = actualFormErrors.length > 0 || isDjbEmpInvalid || isRwhInvalid;
67298
+ const hasProperty = ((_formDataRef$current23 = formDataRef.current) === null || _formDataRef$current23 === void 0 ? void 0 : (_formDataRef$current24 = _formDataRef$current23.cpt) === null || _formDataRef$current24 === void 0 ? void 0 : (_formDataRef$current25 = _formDataRef$current24.details) === null || _formDataRef$current25 === void 0 ? void 0 : _formDataRef$current25.propertyId) || sessionStorage.getItem("WS_OTP_VERIFIED_PROPERTY_ID") || propertyId || (propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop3 = propertyDetails.Properties) === null || _propertyDetails$Prop3 === void 0 ? void 0 : (_propertyDetails$Prop4 = _propertyDetails$Prop3[0]) === null || _propertyDetails$Prop4 === void 0 ? void 0 : _propertyDetails$Prop4.propertyId);
67230
67299
  const canSubmitNow = !hasErrors && !!hasProperty;
67231
67300
  setSubmitValve(prev => prev !== canSubmitNow ? canSubmitNow : prev);
67232
67301
  };
67233
67302
  const onFormSubmit = data => {
67234
- var _combinedData$cpt, _combinedData$cpt$det, _propertyDetails$Prop3, _propertyDetails$Prop4, _combinedData$cpt2, _propertyDetails$Prop5, _djbData$document3, _combinedData$Documen, _combinedData$Documen2, _combinedData$Documen3, _combinedData$documen, _combinedData$documen2, _combinedData$documen3, _combinedData$Documen4, _combinedData$documen4, _formDataRef$current12, _formDataRef$current13, _formDataRef$current14, _formDataRef$current15, _formDataRef$current16;
67303
+ var _combinedData$cpt, _combinedData$cpt$det, _propertyDetails$Prop5, _propertyDetails$Prop6, _combinedData$cpt2, _propertyDetails$Prop7, _djbData$document3, _combinedData$Documen, _combinedData$documen, _formDataRef$current26, _formDataRef$current27, _formDataRef$current28, _formDataRef$current29, _formDataRef$current30, _combinedData$Documen2, _combinedData$documen2, _formDataRef$current31, _formDataRef$current32, _formDataRef$current33, _formDataRef$current34, _formDataRef$current35;
67235
67304
  const combinedData = {
67236
67305
  ...formDataRef.current,
67237
67306
  ...data
67238
67307
  };
67239
67308
  formDataRef.current = combinedData;
67240
67309
  Digit.SessionStorage.set("PT_CREATE_EMP_WS_NEW_FORM", combinedData);
67241
- const hasProperty = (combinedData === null || combinedData === void 0 ? void 0 : (_combinedData$cpt = combinedData.cpt) === null || _combinedData$cpt === void 0 ? void 0 : (_combinedData$cpt$det = _combinedData$cpt.details) === null || _combinedData$cpt$det === void 0 ? void 0 : _combinedData$cpt$det.propertyId) || sessionStorage.getItem("WS_OTP_VERIFIED_PROPERTY_ID") || propertyId || (propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop3 = propertyDetails.Properties) === null || _propertyDetails$Prop3 === void 0 ? void 0 : (_propertyDetails$Prop4 = _propertyDetails$Prop3[0]) === null || _propertyDetails$Prop4 === void 0 ? void 0 : _propertyDetails$Prop4.propertyId);
67310
+ const hasProperty = (combinedData === null || combinedData === void 0 ? void 0 : (_combinedData$cpt = combinedData.cpt) === null || _combinedData$cpt === void 0 ? void 0 : (_combinedData$cpt$det = _combinedData$cpt.details) === null || _combinedData$cpt$det === void 0 ? void 0 : _combinedData$cpt$det.propertyId) || sessionStorage.getItem("WS_OTP_VERIFIED_PROPERTY_ID") || propertyId || (propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop5 = propertyDetails.Properties) === null || _propertyDetails$Prop5 === void 0 ? void 0 : (_propertyDetails$Prop6 = _propertyDetails$Prop5[0]) === null || _propertyDetails$Prop6 === void 0 ? void 0 : _propertyDetails$Prop6.propertyId);
67242
67311
  if (!hasProperty) {
67243
67312
  console.warn("[WS] onSubmit EXIT: invalid property", {
67244
67313
  cpt: combinedData === null || combinedData === void 0 ? void 0 : combinedData.cpt,
@@ -67250,7 +67319,7 @@ const OLDApplication = () => {
67250
67319
  });
67251
67320
  return;
67252
67321
  }
67253
- if (!(combinedData !== null && combinedData !== void 0 && (_combinedData$cpt2 = combinedData.cpt) !== null && _combinedData$cpt2 !== void 0 && _combinedData$cpt2.id) && !(propertyDetails !== null && propertyDetails !== void 0 && (_propertyDetails$Prop5 = propertyDetails.Properties) !== null && _propertyDetails$Prop5 !== void 0 && _propertyDetails$Prop5[0])) {
67322
+ if (!(combinedData !== null && combinedData !== void 0 && (_combinedData$cpt2 = combinedData.cpt) !== null && _combinedData$cpt2 !== void 0 && _combinedData$cpt2.id) && !(propertyDetails !== null && propertyDetails !== void 0 && (_propertyDetails$Prop7 = propertyDetails.Properties) !== null && _propertyDetails$Prop7 !== void 0 && _propertyDetails$Prop7[0])) {
67254
67323
  var _combinedData$cpt3;
67255
67324
  if (!(combinedData !== null && combinedData !== void 0 && (_combinedData$cpt3 = combinedData.cpt) !== null && _combinedData$cpt3 !== void 0 && _combinedData$cpt3.details) || !propertyDetails) {
67256
67325
  console.warn("[WS] onSubmit EXIT: invalid property", {
@@ -67266,13 +67335,15 @@ const OLDApplication = () => {
67266
67335
  }
67267
67336
  const djbData = (combinedData === null || combinedData === void 0 ? void 0 : combinedData.djbEmployee) || (combinedData === null || combinedData === void 0 ? void 0 : combinedData.additionalDetails);
67268
67337
  const isDjbEmp = (djbData === null || djbData === void 0 ? void 0 : djbData.isDjbEmployee) === true || String(djbData === null || djbData === void 0 ? void 0 : djbData.isDjbEmployee) === "true";
67269
- const djbDoc = (djbData === null || djbData === void 0 ? void 0 : (_djbData$document3 = djbData.document) === null || _djbData$document3 === void 0 ? void 0 : _djbData$document3.fileStoreId) || typeof (djbData === null || djbData === void 0 ? void 0 : djbData.document) === "string" && (djbData === null || djbData === void 0 ? void 0 : djbData.document.trim()) || (djbData === null || djbData === void 0 ? void 0 : djbData.document) || (combinedData === null || combinedData === void 0 ? void 0 : (_combinedData$Documen = combinedData.DocumentsRequired) === null || _combinedData$Documen === void 0 ? void 0 : (_combinedData$Documen2 = _combinedData$Documen.documents) === null || _combinedData$Documen2 === void 0 ? void 0 : (_combinedData$Documen3 = _combinedData$Documen2.find(d => {
67270
- var _d$documentType5;
67271
- return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType5 = d.documentType) === null || _d$documentType5 === void 0 ? void 0 : _d$documentType5.includes("DJB_EMPLOYEE_ID"));
67272
- })) === null || _combinedData$Documen3 === void 0 ? void 0 : _combinedData$Documen3.fileStoreId) || (combinedData === null || combinedData === void 0 ? void 0 : (_combinedData$documen = combinedData.documents) === null || _combinedData$documen === void 0 ? void 0 : (_combinedData$documen2 = _combinedData$documen.documents) === null || _combinedData$documen2 === void 0 ? void 0 : (_combinedData$documen3 = _combinedData$documen2.find(d => {
67273
- var _d$documentType6;
67274
- return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType6 = d.documentType) === null || _d$documentType6 === void 0 ? void 0 : _d$documentType6.includes("DJB_EMPLOYEE_ID"));
67275
- })) === null || _combinedData$documen3 === void 0 ? void 0 : _combinedData$documen3.fileStoreId);
67338
+ const findDjbDocInSubmit = docs => {
67339
+ if (!Array.isArray(docs)) return null;
67340
+ const found = docs.find(d => {
67341
+ var _d$documentType3;
67342
+ return ((d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType3 = d.documentType) === null || _d$documentType3 === void 0 ? void 0 : _d$documentType3.includes("DJB_EMPLOYEE_ID"))) && ((d === null || d === void 0 ? void 0 : d.fileStoreId) || (d === null || d === void 0 ? void 0 : d.file) || (d === null || d === void 0 ? void 0 : d.filestoreId));
67343
+ });
67344
+ return found ? found.fileStoreId || found.file || found.filestoreId : null;
67345
+ };
67346
+ const djbDoc = (djbData === null || djbData === void 0 ? void 0 : (_djbData$document3 = djbData.document) === null || _djbData$document3 === void 0 ? void 0 : _djbData$document3.fileStoreId) || typeof (djbData === null || djbData === void 0 ? void 0 : djbData.document) === "string" && (djbData === null || djbData === void 0 ? void 0 : djbData.document.trim()) || (djbData === null || djbData === void 0 ? void 0 : djbData.document) || findDjbDocInSubmit(combinedData === null || combinedData === void 0 ? void 0 : (_combinedData$Documen = combinedData.DocumentsRequired) === null || _combinedData$Documen === void 0 ? void 0 : _combinedData$Documen.documents) || findDjbDocInSubmit(combinedData === null || combinedData === void 0 ? void 0 : (_combinedData$documen = combinedData.documents) === null || _combinedData$documen === void 0 ? void 0 : _combinedData$documen.documents) || findDjbDocInSubmit(combinedData === null || combinedData === void 0 ? void 0 : combinedData.documents) || findDjbDocInSubmit((_formDataRef$current26 = formDataRef.current) === null || _formDataRef$current26 === void 0 ? void 0 : (_formDataRef$current27 = _formDataRef$current26.DocumentsRequired) === null || _formDataRef$current27 === void 0 ? void 0 : _formDataRef$current27.documents) || findDjbDocInSubmit((_formDataRef$current28 = formDataRef.current) === null || _formDataRef$current28 === void 0 ? void 0 : (_formDataRef$current29 = _formDataRef$current28.documents) === null || _formDataRef$current29 === void 0 ? void 0 : _formDataRef$current29.documents) || findDjbDocInSubmit((_formDataRef$current30 = formDataRef.current) === null || _formDataRef$current30 === void 0 ? void 0 : _formDataRef$current30.documents);
67276
67347
  const isDjbEmpInvalid = isDjbEmp && (!(djbData !== null && djbData !== void 0 && djbData.employeeId) || !String(djbData === null || djbData === void 0 ? void 0 : djbData.employeeId).trim() || !(djbData !== null && djbData !== void 0 && djbData.designation) || !String(djbData === null || djbData === void 0 ? void 0 : djbData.designation).trim() || !djbDoc);
67277
67348
  if (isDjbEmpInvalid) {
67278
67349
  setShowToast({
@@ -67283,7 +67354,7 @@ const OLDApplication = () => {
67283
67354
  }
67284
67355
  const rwhSubmitData = (combinedData === null || combinedData === void 0 ? void 0 : combinedData.rainWaterHarvesting) || (combinedData === null || combinedData === void 0 ? void 0 : combinedData.additionalDetails);
67285
67356
  const isRwhSubmitRequired = (rwhSubmitData === null || rwhSubmitData === void 0 ? void 0 : rwhSubmitData.hasCertificate) === true || String(rwhSubmitData === null || rwhSubmitData === void 0 ? void 0 : rwhSubmitData.hasCertificate) === "true" || (rwhSubmitData === null || rwhSubmitData === void 0 ? void 0 : rwhSubmitData.isRainwaterHarvesting) === true || String(rwhSubmitData === null || rwhSubmitData === void 0 ? void 0 : rwhSubmitData.isRainwaterHarvesting) === "true";
67286
- const allSubmitDocs = (combinedData === null || combinedData === void 0 ? void 0 : (_combinedData$Documen4 = combinedData.DocumentsRequired) === null || _combinedData$Documen4 === void 0 ? void 0 : _combinedData$Documen4.documents) || (combinedData === null || combinedData === void 0 ? void 0 : (_combinedData$documen4 = combinedData.documents) === null || _combinedData$documen4 === void 0 ? void 0 : _combinedData$documen4.documents) || (combinedData === null || combinedData === void 0 ? void 0 : combinedData.documents) || ((_formDataRef$current12 = formDataRef.current) === null || _formDataRef$current12 === void 0 ? void 0 : (_formDataRef$current13 = _formDataRef$current12.DocumentsRequired) === null || _formDataRef$current13 === void 0 ? void 0 : _formDataRef$current13.documents) || ((_formDataRef$current14 = formDataRef.current) === null || _formDataRef$current14 === void 0 ? void 0 : (_formDataRef$current15 = _formDataRef$current14.documents) === null || _formDataRef$current15 === void 0 ? void 0 : _formDataRef$current15.documents) || ((_formDataRef$current16 = formDataRef.current) === null || _formDataRef$current16 === void 0 ? void 0 : _formDataRef$current16.documents) || [];
67357
+ const allSubmitDocs = (combinedData === null || combinedData === void 0 ? void 0 : (_combinedData$Documen2 = combinedData.DocumentsRequired) === null || _combinedData$Documen2 === void 0 ? void 0 : _combinedData$Documen2.documents) || (combinedData === null || combinedData === void 0 ? void 0 : (_combinedData$documen2 = combinedData.documents) === null || _combinedData$documen2 === void 0 ? void 0 : _combinedData$documen2.documents) || (combinedData === null || combinedData === void 0 ? void 0 : combinedData.documents) || ((_formDataRef$current31 = formDataRef.current) === null || _formDataRef$current31 === void 0 ? void 0 : (_formDataRef$current32 = _formDataRef$current31.DocumentsRequired) === null || _formDataRef$current32 === void 0 ? void 0 : _formDataRef$current32.documents) || ((_formDataRef$current33 = formDataRef.current) === null || _formDataRef$current33 === void 0 ? void 0 : (_formDataRef$current34 = _formDataRef$current33.documents) === null || _formDataRef$current34 === void 0 ? void 0 : _formDataRef$current34.documents) || ((_formDataRef$current35 = formDataRef.current) === null || _formDataRef$current35 === void 0 ? void 0 : _formDataRef$current35.documents) || [];
67287
67358
  const isRwhSubmitDocUploaded = Array.isArray(allSubmitDocs) && allSubmitDocs.some(d => isRwhDoc(d) && ((d === null || d === void 0 ? void 0 : d.fileStoreId) || (d === null || d === void 0 ? void 0 : d.file)));
67288
67359
  if (isRwhSubmitRequired && !isRwhSubmitDocUploaded) {
67289
67360
  setShowToast({
@@ -67302,7 +67373,7 @@ const OLDApplication = () => {
67302
67373
  };
67303
67374
  const processSubmission = function (data) {
67304
67375
  try {
67305
- var _data$useDetails, _data$ConnectionDetai, _data$ConnectionDetai2, _data$DocumentsRequir, _data$djbEmployee, _data$djbEmployee$doc, _data$djbEmployee2, _data$djbEmployee3, _data$djbEmployee4, _data$DocumentsRequir2, _data$DocumentsRequir3, _data$DocumentsRequir4, _data$documents, _data$documents$docum, _data$documents$docum2, _data$cpt, _Digit$UserService$ge2, _data$ConnectionHolde, _data$ConnectionHolde2, _data$ConnectionHolde3, _data$ConnectionHolde4, _data$ConnectionHolde5, _propertyDetails$Prop7, _propertyDetails$Prop8, _propertyDetails$Prop9, _propertyDetails$Prop0, _data$ConnectionHolde6, _data$ConnectionHolde7, _data$cpt2, _data$cpt2$details, _data$cpt2$details$ow, _data$cpt2$details$ow2;
67376
+ var _data$useDetails, _data$ConnectionDetai, _data$ConnectionDetai2, _data$DocumentsRequir, _data$djbEmployee, _data$djbEmployee$doc, _data$djbEmployee2, _data$djbEmployee3, _data$djbEmployee4, _data$DocumentsRequir2, _data$DocumentsRequir3, _data$DocumentsRequir4, _data$documents, _data$documents$docum, _data$documents$docum2, _data$cpt, _Digit$UserService$ge2, _data$ConnectionHolde, _data$ConnectionHolde2, _data$ConnectionHolde3, _data$ConnectionHolde4, _data$ConnectionHolde5, _propertyDetails$Prop9, _propertyDetails$Prop0, _propertyDetails$Prop1, _propertyDetails$Prop10, _data$ConnectionHolde6, _data$ConnectionHolde7, _data$cpt2, _data$cpt2$details, _data$cpt2$details$ow, _data$cpt2$details$ow2;
67306
67377
  const basePath = window.location.href.includes("/employee") ? "/digit-ui/employee/ws" : "/digit-ui/citizen/ws";
67307
67378
  if (data !== null && data !== void 0 && (_data$useDetails = data.useDetails) !== null && _data$useDetails !== void 0 && _data$useDetails.useDetails) {
67308
67379
  data.useDetails = {
@@ -67345,16 +67416,16 @@ const OLDApplication = () => {
67345
67416
  if (data !== null && data !== void 0 && (_data$DocumentsRequir = data.DocumentsRequired) !== null && _data$DocumentsRequir !== void 0 && _data$DocumentsRequir.documents) {
67346
67417
  const docs = data.DocumentsRequired.documents;
67347
67418
  const identityDoc = docs.find(d => {
67348
- var _d$documentType7;
67349
- return d === null || d === void 0 ? void 0 : (_d$documentType7 = d.documentType) === null || _d$documentType7 === void 0 ? void 0 : _d$documentType7.includes("IDENTITYPROOF");
67419
+ var _d$documentType4;
67420
+ return d === null || d === void 0 ? void 0 : (_d$documentType4 = d.documentType) === null || _d$documentType4 === void 0 ? void 0 : _d$documentType4.includes("IDENTITYPROOF");
67350
67421
  });
67351
67422
  const ownershipDoc = docs.find(d => {
67352
- var _d$documentType8, _d$documentType9;
67353
- return (d === null || d === void 0 ? void 0 : (_d$documentType8 = d.documentType) === null || _d$documentType8 === void 0 ? void 0 : _d$documentType8.includes("ADDRESSPROOF")) || (d === null || d === void 0 ? void 0 : (_d$documentType9 = d.documentType) === null || _d$documentType9 === void 0 ? void 0 : _d$documentType9.includes("OWNERSHIPPROOF"));
67423
+ var _d$documentType5, _d$documentType6;
67424
+ return (d === null || d === void 0 ? void 0 : (_d$documentType5 = d.documentType) === null || _d$documentType5 === void 0 ? void 0 : _d$documentType5.includes("ADDRESSPROOF")) || (d === null || d === void 0 ? void 0 : (_d$documentType6 = d.documentType) === null || _d$documentType6 === void 0 ? void 0 : _d$documentType6.includes("OWNERSHIPPROOF"));
67354
67425
  });
67355
67426
  const otherDoc = docs.find(d => {
67356
- var _d$documentType0;
67357
- return d === null || d === void 0 ? void 0 : (_d$documentType0 = d.documentType) === null || _d$documentType0 === void 0 ? void 0 : _d$documentType0.includes("OTHERDOCUMENTS");
67427
+ var _d$documentType7;
67428
+ return d === null || d === void 0 ? void 0 : (_d$documentType7 = d.documentType) === null || _d$documentType7 === void 0 ? void 0 : _d$documentType7.includes("OTHERDOCUMENTS");
67358
67429
  });
67359
67430
  data.documents = {
67360
67431
  documents: docs,
@@ -67364,11 +67435,11 @@ const OLDApplication = () => {
67364
67435
  };
67365
67436
  }
67366
67437
  const djbDoc = (data === null || data === void 0 ? void 0 : (_data$djbEmployee = data.djbEmployee) === null || _data$djbEmployee === void 0 ? void 0 : (_data$djbEmployee$doc = _data$djbEmployee.document) === null || _data$djbEmployee$doc === void 0 ? void 0 : _data$djbEmployee$doc.fileStoreId) || typeof (data === null || data === void 0 ? void 0 : (_data$djbEmployee2 = data.djbEmployee) === null || _data$djbEmployee2 === void 0 ? void 0 : _data$djbEmployee2.document) === "string" && (data === null || data === void 0 ? void 0 : (_data$djbEmployee3 = data.djbEmployee) === null || _data$djbEmployee3 === void 0 ? void 0 : _data$djbEmployee3.document.trim()) || (data === null || data === void 0 ? void 0 : (_data$djbEmployee4 = data.djbEmployee) === null || _data$djbEmployee4 === void 0 ? void 0 : _data$djbEmployee4.document) || (data === null || data === void 0 ? void 0 : (_data$DocumentsRequir2 = data.DocumentsRequired) === null || _data$DocumentsRequir2 === void 0 ? void 0 : (_data$DocumentsRequir3 = _data$DocumentsRequir2.documents) === null || _data$DocumentsRequir3 === void 0 ? void 0 : (_data$DocumentsRequir4 = _data$DocumentsRequir3.find(d => {
67367
- var _d$documentType1;
67368
- return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType1 = d.documentType) === null || _d$documentType1 === void 0 ? void 0 : _d$documentType1.includes("DJB_EMPLOYEE_ID"));
67438
+ var _d$documentType8;
67439
+ return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType8 = d.documentType) === null || _d$documentType8 === void 0 ? void 0 : _d$documentType8.includes("DJB_EMPLOYEE_ID"));
67369
67440
  })) === null || _data$DocumentsRequir4 === void 0 ? void 0 : _data$DocumentsRequir4.fileStoreId) || (data === null || data === void 0 ? void 0 : (_data$documents = data.documents) === null || _data$documents === void 0 ? void 0 : (_data$documents$docum = _data$documents.documents) === null || _data$documents$docum === void 0 ? void 0 : (_data$documents$docum2 = _data$documents$docum.find(d => {
67370
- var _d$documentType10;
67371
- return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType10 = d.documentType) === null || _d$documentType10 === void 0 ? void 0 : _d$documentType10.includes("DJB_EMPLOYEE_ID"));
67441
+ var _d$documentType9;
67442
+ return (d === null || d === void 0 ? void 0 : d.documentType) === "OWNER.DJB_EMPLOYEE_ID" || (d === null || d === void 0 ? void 0 : (_d$documentType9 = d.documentType) === null || _d$documentType9 === void 0 ? void 0 : _d$documentType9.includes("DJB_EMPLOYEE_ID"));
67372
67443
  })) === null || _data$documents$docum2 === void 0 ? void 0 : _data$documents$docum2.fileStoreId);
67373
67444
  if (djbDoc) {
67374
67445
  if (!data.djbEmployee) data.djbEmployee = {};
@@ -67438,9 +67509,9 @@ const OLDApplication = () => {
67438
67509
  };
67439
67510
  }
67440
67511
  if (!(data !== null && data !== void 0 && (_data$cpt = data.cpt) !== null && _data$cpt !== void 0 && _data$cpt.details)) {
67441
- var _propertyDetails$Prop6;
67512
+ var _propertyDetails$Prop8;
67442
67513
  data.cpt = {
67443
- details: propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop6 = propertyDetails.Properties) === null || _propertyDetails$Prop6 === void 0 ? void 0 : _propertyDetails$Prop6[0]
67514
+ details: propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop8 = propertyDetails.Properties) === null || _propertyDetails$Prop8 === void 0 ? void 0 : _propertyDetails$Prop8[0]
67444
67515
  };
67445
67516
  }
67446
67517
  data.channel = ((_Digit$UserService$ge2 = Digit.UserService.getType()) === null || _Digit$UserService$ge2 === void 0 ? void 0 : _Digit$UserService$ge2.toUpperCase()) === "CITIZEN" ? "CITIZEN" : "CFC_COUNTER";
@@ -67456,7 +67527,7 @@ const OLDApplication = () => {
67456
67527
  code: "NONPTPRESSURE"
67457
67528
  },
67458
67529
  categoryType: (connDetail === null || connDetail === void 0 ? void 0 : connDetail.categoryType) || {
67459
- code: (data === null || data === void 0 ? void 0 : (_data$ConnectionHolde = data.ConnectionHolderDetails) === null || _data$ConnectionHolde === void 0 ? void 0 : (_data$ConnectionHolde2 = _data$ConnectionHolde[0]) === null || _data$ConnectionHolde2 === void 0 ? void 0 : (_data$ConnectionHolde3 = _data$ConnectionHolde2.ownerType) === null || _data$ConnectionHolde3 === void 0 ? void 0 : _data$ConnectionHolde3.code) || (data === null || data === void 0 ? void 0 : (_data$ConnectionHolde4 = data.ConnectionHolderDetails) === null || _data$ConnectionHolde4 === void 0 ? void 0 : (_data$ConnectionHolde5 = _data$ConnectionHolde4[0]) === null || _data$ConnectionHolde5 === void 0 ? void 0 : _data$ConnectionHolde5.ownerType) || (propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop7 = propertyDetails.Properties) === null || _propertyDetails$Prop7 === void 0 ? void 0 : (_propertyDetails$Prop8 = _propertyDetails$Prop7[0]) === null || _propertyDetails$Prop8 === void 0 ? void 0 : (_propertyDetails$Prop9 = _propertyDetails$Prop8.owners) === null || _propertyDetails$Prop9 === void 0 ? void 0 : (_propertyDetails$Prop0 = _propertyDetails$Prop9[0]) === null || _propertyDetails$Prop0 === void 0 ? void 0 : _propertyDetails$Prop0.ownerType) || "NONE"
67530
+ code: (data === null || data === void 0 ? void 0 : (_data$ConnectionHolde = data.ConnectionHolderDetails) === null || _data$ConnectionHolde === void 0 ? void 0 : (_data$ConnectionHolde2 = _data$ConnectionHolde[0]) === null || _data$ConnectionHolde2 === void 0 ? void 0 : (_data$ConnectionHolde3 = _data$ConnectionHolde2.ownerType) === null || _data$ConnectionHolde3 === void 0 ? void 0 : _data$ConnectionHolde3.code) || (data === null || data === void 0 ? void 0 : (_data$ConnectionHolde4 = data.ConnectionHolderDetails) === null || _data$ConnectionHolde4 === void 0 ? void 0 : (_data$ConnectionHolde5 = _data$ConnectionHolde4[0]) === null || _data$ConnectionHolde5 === void 0 ? void 0 : _data$ConnectionHolde5.ownerType) || (propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop9 = propertyDetails.Properties) === null || _propertyDetails$Prop9 === void 0 ? void 0 : (_propertyDetails$Prop0 = _propertyDetails$Prop9[0]) === null || _propertyDetails$Prop0 === void 0 ? void 0 : (_propertyDetails$Prop1 = _propertyDetails$Prop0.owners) === null || _propertyDetails$Prop1 === void 0 ? void 0 : (_propertyDetails$Prop10 = _propertyDetails$Prop1[0]) === null || _propertyDetails$Prop10 === void 0 ? void 0 : _propertyDetails$Prop10.ownerType) || "NONE"
67460
67531
  },
67461
67532
  domesticType: connDetail === null || connDetail === void 0 ? void 0 : connDetail.domesticType,
67462
67533
  departmentType: connDetail === null || connDetail === void 0 ? void 0 : connDetail.departmentType,