@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.
package/dist/index.js CHANGED
@@ -28124,7 +28124,7 @@ const ConnectionDetails$1 = _props => {
28124
28124
  const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-z.-]+\.(com|org|in)$/;
28125
28125
  const errors = sessionStorage.getItem("FORMSTATE_ERRORS");
28126
28126
  let formStateErros = typeof errors === "string" ? JSON.parse(errors) : {};
28127
- if (emailPattern.test(value)) {
28127
+ if (!value || !value.trim() || emailPattern.test(value)) {
28128
28128
  var _formStateErros$Conne, _formStateErros$Conne2, _formStateErros$Conne3, _formStateErros$Conne4;
28129
28129
  if (clearErrors) clearErrors("emailId");
28130
28130
  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) {
@@ -31466,7 +31466,7 @@ const WSDocumentsEmployee = _ref => {
31466
31466
  } = Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesNewMasters(tenantId, wsDocsData);
31467
31467
  const hasDjbEmployeeDoc = (documents || []).some(d => {
31468
31468
  var _d$documentType2;
31469
- 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);
31469
+ 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));
31470
31470
  });
31471
31471
  const addEmployeeDocError = () => {
31472
31472
  var _formState$errors, _formState$errors$con;
@@ -31500,21 +31500,35 @@ const WSDocumentsEmployee = _ref => {
31500
31500
  addEmployeeDocError();
31501
31501
  } else {
31502
31502
  removeEmployeeDocError();
31503
+ if (formSetValue && formData !== null && formData !== void 0 && formData.djbEmployee) {
31504
+ var _formData$djbEmployee;
31505
+ const djbItem = (documents || []).find(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 ? 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));
31508
+ });
31509
+ const fsId = (djbItem === null || djbItem === void 0 ? void 0 : djbItem.fileStoreId) || (djbItem === null || djbItem === void 0 ? void 0 : djbItem.file);
31510
+ if (fsId && (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee = formData.djbEmployee) === null || _formData$djbEmployee === void 0 ? void 0 : _formData$djbEmployee.document) !== fsId) {
31511
+ formSetValue("djbEmployee", {
31512
+ ...formData.djbEmployee,
31513
+ document: fsId
31514
+ });
31515
+ }
31516
+ }
31503
31517
  }
31504
31518
  } else {
31505
- var _formData$djbEmployee;
31519
+ var _formData$djbEmployee2;
31506
31520
  removeEmployeeDocError();
31507
31521
  setDocuments(prevDocs => {
31508
31522
  const filtered = (prevDocs || []).filter(d => {
31509
- var _d$documentType3;
31510
- 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"));
31523
+ var _d$documentType4;
31524
+ 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"));
31511
31525
  });
31512
31526
  if (filtered.length !== (prevDocs || []).length) {
31513
31527
  return filtered;
31514
31528
  }
31515
31529
  return prevDocs;
31516
31530
  });
31517
- if (formSetValue && formData !== null && formData !== void 0 && (_formData$djbEmployee = formData.djbEmployee) !== null && _formData$djbEmployee !== void 0 && _formData$djbEmployee.document) {
31531
+ if (formSetValue && formData !== null && formData !== void 0 && (_formData$djbEmployee2 = formData.djbEmployee) !== null && _formData$djbEmployee2 !== void 0 && _formData$djbEmployee2.document) {
31518
31532
  formSetValue("djbEmployee", {
31519
31533
  ...formData.djbEmployee,
31520
31534
  document: ""
@@ -31749,7 +31763,7 @@ const WSDocumentsEmployee = _ref => {
31749
31763
  }));
31750
31764
  };
31751
31765
  function EmployeeIdDocumentUpload(_ref2) {
31752
- var _formData$djbEmployee2, _formData$djbEmployee3, _formData$djbEmployee4, _formData$djbEmployee5, _formData$djbEmployee0;
31766
+ var _formData$djbEmployee3, _formData$djbEmployee4, _formData$djbEmployee5, _formData$djbEmployee6, _formData$djbEmployee1;
31753
31767
  let {
31754
31768
  t,
31755
31769
  documents,
@@ -31759,26 +31773,26 @@ function EmployeeIdDocumentUpload(_ref2) {
31759
31773
  tenantId
31760
31774
  } = _ref2;
31761
31775
  const existingEmployeeDoc = documents === null || documents === void 0 ? void 0 : documents.find(d => {
31762
- var _d$documentType4;
31763
- 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"));
31776
+ var _d$documentType5;
31777
+ 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"));
31764
31778
  });
31765
- 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);
31779
+ 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);
31766
31780
  const [file, setFile] = React.useState(null);
31767
31781
  const [uploadedFile, setUploadedFile] = React.useState(initialFileId || null);
31768
31782
  const [fileName, setFileName] = React.useState((existingEmployeeDoc === null || existingEmployeeDoc === void 0 ? void 0 : existingEmployeeDoc.fileName) || "");
31769
31783
  const [errorUpload, setErrorUpload] = React.useState(null);
31770
31784
  React.useEffect(() => {
31771
- var _formData$djbEmployee6, _formData$djbEmployee7, _formData$djbEmployee8, _formData$djbEmployee9;
31785
+ var _formData$djbEmployee7, _formData$djbEmployee8, _formData$djbEmployee9, _formData$djbEmployee0;
31772
31786
  const doc = documents === null || documents === void 0 ? void 0 : documents.find(d => {
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"));
31787
+ var _d$documentType6;
31788
+ 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"));
31775
31789
  });
31776
- 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);
31790
+ 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);
31777
31791
  if (currentId !== uploadedFile) {
31778
31792
  setUploadedFile(currentId || null);
31779
31793
  if (doc !== null && doc !== void 0 && doc.fileName) setFileName(doc.fileName);
31780
31794
  }
31781
- }, [documents, formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee0 = formData.djbEmployee) === null || _formData$djbEmployee0 === void 0 ? void 0 : _formData$djbEmployee0.document]);
31795
+ }, [documents, formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee1 = formData.djbEmployee) === null || _formData$djbEmployee1 === void 0 ? void 0 : _formData$djbEmployee1.document]);
31782
31796
  React.useEffect(() => {
31783
31797
  (function () {
31784
31798
  try {
@@ -31802,17 +31816,17 @@ function EmployeeIdDocumentUpload(_ref2) {
31802
31816
  setUploadedFile(fileId);
31803
31817
  setFileName(nameOfFile);
31804
31818
  setDocuments(prevDocs => {
31805
- var _formData$djbEmployee1;
31819
+ var _formData$djbEmployee10;
31806
31820
  const filtered = (prevDocs || []).filter(d => {
31807
- var _d$documentType6;
31808
- 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"));
31821
+ var _d$documentType7;
31822
+ 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"));
31809
31823
  });
31810
31824
  return [...filtered, {
31811
31825
  documentType: "OWNER.DJB_EMPLOYEE_ID",
31812
31826
  fileStoreId: fileId,
31813
31827
  fileName: nameOfFile,
31814
31828
  documentName: "WS_UPLOAD_EMPLOYEE_ID_DOC",
31815
- documentUid: (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee1 = formData.djbEmployee) === null || _formData$djbEmployee1 === void 0 ? void 0 : _formData$djbEmployee1.employeeId) || "",
31829
+ documentUid: (formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee10 = formData.djbEmployee) === null || _formData$djbEmployee10 === void 0 ? void 0 : _formData$djbEmployee10.employeeId) || "",
31816
31830
  i18nKey: "WS_UPLOAD_EMPLOYEE_ID_DOC",
31817
31831
  status: "ACTIVE"
31818
31832
  }];
@@ -31862,8 +31876,8 @@ function EmployeeIdDocumentUpload(_ref2) {
31862
31876
  const fileInput = document.getElementById("employee-doc-upload");
31863
31877
  if (fileInput) fileInput.value = "";
31864
31878
  setDocuments(prevDocs => (prevDocs || []).filter(d => {
31865
- var _d$documentType7;
31866
- 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"));
31879
+ var _d$documentType8;
31880
+ 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"));
31867
31881
  }));
31868
31882
  if (formSetValue && formData !== null && formData !== void 0 && formData.djbEmployee) {
31869
31883
  formSetValue("djbEmployee", {
@@ -38782,7 +38796,7 @@ const WSDeclaration = _ref => {
38782
38796
  };
38783
38797
 
38784
38798
  const WSDjbEmployee = _ref => {
38785
- var _formData$additionalD, _localFormState$touch, _formValue$employeeId, _formValue$employeeId2, _localFormState$touch2, _formValue$designatio, _formValue$designatio2, _formData$dueVerifica;
38799
+ var _formData$additionalD, _formData$djbEmployee3, _localFormState$touch, _formValue$employeeId, _formValue$employeeId2, _localFormState$touch2, _formValue$designatio, _formValue$designatio2, _formData$dueVerifica;
38786
38800
  let {
38787
38801
  config,
38788
38802
  onSelect,
@@ -38880,20 +38894,27 @@ const WSDjbEmployee = _ref => {
38880
38894
  React.useEffect(() => {
38881
38895
  const isEmployeeMode = userType === "employee" || window.location.href.includes("edit-application") || window.location.href.includes("modify-connection") || window.location.href.includes("old-application");
38882
38896
  if (isEmployeeMode) {
38883
- const isDifferent = !lodash.isEqual(formData === null || formData === void 0 ? void 0 : formData.djbEmployee, formValue);
38897
+ var _formData$djbEmployee;
38898
+ 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) || "";
38899
+ const formValueComparable = {
38900
+ ...formValue,
38901
+ document: currentDoc
38902
+ };
38903
+ const isDifferent = !lodash.isEqual(formData === null || formData === void 0 ? void 0 : formData.djbEmployee, formValueComparable);
38884
38904
  if (isDifferent) {
38885
- var _formData$djbEmployee;
38886
- 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);
38905
+ var _formData$djbEmployee2;
38906
+ 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);
38887
38907
  const delay = isImmediate ? 0 : 100;
38888
38908
  const timer = setTimeout(() => {
38889
38909
  onSelect((config === null || config === void 0 ? void 0 : config.key) || "djbEmployee", {
38890
- ...formValue
38910
+ ...formValue,
38911
+ document: currentDoc
38891
38912
  });
38892
38913
  }, delay);
38893
38914
  return () => clearTimeout(timer);
38894
38915
  }
38895
38916
  }
38896
- }, [formValue, userType]);
38917
+ }, [formValue, userType, formData === null || formData === void 0 ? void 0 : (_formData$djbEmployee3 = formData.djbEmployee) === null || _formData$djbEmployee3 === void 0 ? void 0 : _formData$djbEmployee3.document]);
38897
38918
  React.useEffect(() => {
38898
38919
  const configKey = (config === null || config === void 0 ? void 0 : config.key) || "djbEmployee";
38899
38920
  if (hasDjbErrors) {
@@ -67179,6 +67200,41 @@ const OLDApplication = () => {
67179
67200
  setPropertyId(cptId);
67180
67201
  }
67181
67202
  }, [sessionFormData === null || sessionFormData === void 0 ? void 0 : sessionFormData.cpt, propertyId]);
67203
+ React.useEffect(() => {
67204
+ var _formDataRef$current, _formDataRef$current$, _formDataRef$current$2, _propertyDetails$Prop, _propertyDetails$Prop2;
67205
+ 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);
67206
+ if (hasProp && !canSubmit) {
67207
+ var _formDataRef$current2, _formDataRef$current3, _formDataRef$current4, _formDataRef$current5, _formDataRef$current6, _formDataRef$current7, _formDataRef$current8, _djbData$document, _formDataRef$current9, _formDataRef$current0;
67208
+ 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);
67209
+ const isDjbEmp = (djbData === null || djbData === void 0 ? void 0 : djbData.isDjbEmployee) === true || String(djbData === null || djbData === void 0 ? void 0 : djbData.isDjbEmployee) === "true";
67210
+ 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) || [];
67211
+ const foundDjb = Array.isArray(docs) && docs.find(d => {
67212
+ var _d$documentType;
67213
+ 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));
67214
+ });
67215
+ 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);
67216
+ 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);
67217
+ 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);
67218
+ 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";
67219
+ 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)));
67220
+ const isRwhInv = isRwhReq && !isRwhUploaded;
67221
+ const storedErrors = sessionStorage.getItem("FORMSTATE_ERRORS");
67222
+ let parsedErrors = {};
67223
+ try {
67224
+ parsedErrors = storedErrors ? JSON.parse(storedErrors) : {};
67225
+ } catch (e) {}
67226
+ const hasStoredErrors = Object.keys(parsedErrors).some(k => {
67227
+ const err = parsedErrors[k];
67228
+ if (!err) return false;
67229
+ if (Array.isArray(err === null || err === void 0 ? void 0 : err.type) && err.type.length === 0) return false;
67230
+ if (typeof err === "object" && Object.keys(err).length === 0) return false;
67231
+ return true;
67232
+ });
67233
+ if (!hasStoredErrors && !isDjbEmpInv && !isRwhInv) {
67234
+ setSubmitValve(true);
67235
+ }
67236
+ }
67237
+ }, [propertyId, propertyDetails]);
67182
67238
  const {
67183
67239
  isLoading: creatingWaterApplicationLoading,
67184
67240
  mutate: waterMutation
@@ -67196,7 +67252,7 @@ const OLDApplication = () => {
67196
67252
  mutate: sewerageUpdateMutation
67197
67253
  } = Digit.Hooks.ws.useWSApplicationActions("SEWERAGE");
67198
67254
  const onFormValueChange = (setValue, formData, formState) => {
67199
- 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;
67255
+ 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;
67200
67256
  formDataRef.current = {
67201
67257
  ...formDataRef.current,
67202
67258
  ...formData
@@ -67212,36 +67268,49 @@ const OLDApplication = () => {
67212
67268
  if (!propertyId && cptPropId) {
67213
67269
  setPropertyId(cptPropId);
67214
67270
  }
67215
- 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);
67271
+ const findDjbDoc = docs => {
67272
+ if (!Array.isArray(docs)) return null;
67273
+ const found = docs.find(d => {
67274
+ var _d$documentType2;
67275
+ 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));
67276
+ });
67277
+ return found ? found.fileStoreId || found.file || found.filestoreId : null;
67278
+ };
67279
+ 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);
67216
67280
  const isDjbEmp = (djbData === null || djbData === void 0 ? void 0 : djbData.isDjbEmployee) === true || String(djbData === null || djbData === void 0 ? void 0 : djbData.isDjbEmployee) === "true";
67217
- 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 => {
67218
- var _d$documentType;
67219
- 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"));
67220
- })) === 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 => {
67221
- var _d$documentType2;
67222
- 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"));
67223
- })) === 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 => {
67224
- var _d$documentType3;
67225
- 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"));
67226
- })) === 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 => {
67227
- var _d$documentType4;
67228
- 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"));
67229
- })) === null || _formData$documents$d2 === void 0 ? void 0 : _formData$documents$d2.fileStoreId);
67230
- 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));
67231
- const hasErrors = Object.keys((formState === null || formState === void 0 ? void 0 : formState.errors) || {}).length > 0 || isDjbEmpInvalid;
67232
- 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);
67281
+ 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);
67282
+ if (djbDoc) {
67283
+ if (!formDataRef.current.djbEmployee) formDataRef.current.djbEmployee = {};
67284
+ formDataRef.current.djbEmployee.document = djbDoc;
67285
+ }
67286
+ 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);
67287
+ 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);
67288
+ 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";
67289
+ 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) || [];
67290
+ 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)));
67291
+ const isRwhInvalid = isRwhRequired && !isRwhDocUploaded;
67292
+ const actualFormErrors = Object.keys((formState === null || formState === void 0 ? void 0 : formState.errors) || {}).filter(key => {
67293
+ var _formState$errors;
67294
+ const err = formState === null || formState === void 0 ? void 0 : (_formState$errors = formState.errors) === null || _formState$errors === void 0 ? void 0 : _formState$errors[key];
67295
+ if (!err) return false;
67296
+ if (Array.isArray(err === null || err === void 0 ? void 0 : err.type) && err.type.length === 0) return false;
67297
+ if (typeof err === "object" && Object.keys(err).length === 0) return false;
67298
+ return true;
67299
+ });
67300
+ const hasErrors = actualFormErrors.length > 0 || isDjbEmpInvalid || isRwhInvalid;
67301
+ 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);
67233
67302
  const canSubmitNow = !hasErrors && !!hasProperty;
67234
67303
  setSubmitValve(prev => prev !== canSubmitNow ? canSubmitNow : prev);
67235
67304
  };
67236
67305
  const onFormSubmit = data => {
67237
- 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;
67306
+ 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;
67238
67307
  const combinedData = {
67239
67308
  ...formDataRef.current,
67240
67309
  ...data
67241
67310
  };
67242
67311
  formDataRef.current = combinedData;
67243
67312
  Digit.SessionStorage.set("PT_CREATE_EMP_WS_NEW_FORM", combinedData);
67244
- 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);
67313
+ 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);
67245
67314
  if (!hasProperty) {
67246
67315
  console.warn("[WS] onSubmit EXIT: invalid property", {
67247
67316
  cpt: combinedData === null || combinedData === void 0 ? void 0 : combinedData.cpt,
@@ -67253,7 +67322,7 @@ const OLDApplication = () => {
67253
67322
  });
67254
67323
  return;
67255
67324
  }
67256
- 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])) {
67325
+ 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])) {
67257
67326
  var _combinedData$cpt3;
67258
67327
  if (!(combinedData !== null && combinedData !== void 0 && (_combinedData$cpt3 = combinedData.cpt) !== null && _combinedData$cpt3 !== void 0 && _combinedData$cpt3.details) || !propertyDetails) {
67259
67328
  console.warn("[WS] onSubmit EXIT: invalid property", {
@@ -67269,13 +67338,15 @@ const OLDApplication = () => {
67269
67338
  }
67270
67339
  const djbData = (combinedData === null || combinedData === void 0 ? void 0 : combinedData.djbEmployee) || (combinedData === null || combinedData === void 0 ? void 0 : combinedData.additionalDetails);
67271
67340
  const isDjbEmp = (djbData === null || djbData === void 0 ? void 0 : djbData.isDjbEmployee) === true || String(djbData === null || djbData === void 0 ? void 0 : djbData.isDjbEmployee) === "true";
67272
- 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 => {
67273
- var _d$documentType5;
67274
- 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"));
67275
- })) === 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 => {
67276
- var _d$documentType6;
67277
- 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"));
67278
- })) === null || _combinedData$documen3 === void 0 ? void 0 : _combinedData$documen3.fileStoreId);
67341
+ const findDjbDocInSubmit = docs => {
67342
+ if (!Array.isArray(docs)) return null;
67343
+ const found = docs.find(d => {
67344
+ var _d$documentType3;
67345
+ 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));
67346
+ });
67347
+ return found ? found.fileStoreId || found.file || found.filestoreId : null;
67348
+ };
67349
+ 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);
67279
67350
  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);
67280
67351
  if (isDjbEmpInvalid) {
67281
67352
  setShowToast({
@@ -67286,7 +67357,7 @@ const OLDApplication = () => {
67286
67357
  }
67287
67358
  const rwhSubmitData = (combinedData === null || combinedData === void 0 ? void 0 : combinedData.rainWaterHarvesting) || (combinedData === null || combinedData === void 0 ? void 0 : combinedData.additionalDetails);
67288
67359
  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";
67289
- 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) || [];
67360
+ 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) || [];
67290
67361
  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)));
67291
67362
  if (isRwhSubmitRequired && !isRwhSubmitDocUploaded) {
67292
67363
  setShowToast({
@@ -67305,7 +67376,7 @@ const OLDApplication = () => {
67305
67376
  };
67306
67377
  const processSubmission = function (data) {
67307
67378
  try {
67308
- 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;
67379
+ 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;
67309
67380
  const basePath = window.location.href.includes("/employee") ? "/digit-ui/employee/ws" : "/digit-ui/citizen/ws";
67310
67381
  if (data !== null && data !== void 0 && (_data$useDetails = data.useDetails) !== null && _data$useDetails !== void 0 && _data$useDetails.useDetails) {
67311
67382
  data.useDetails = {
@@ -67348,16 +67419,16 @@ const OLDApplication = () => {
67348
67419
  if (data !== null && data !== void 0 && (_data$DocumentsRequir = data.DocumentsRequired) !== null && _data$DocumentsRequir !== void 0 && _data$DocumentsRequir.documents) {
67349
67420
  const docs = data.DocumentsRequired.documents;
67350
67421
  const identityDoc = docs.find(d => {
67351
- var _d$documentType7;
67352
- return d === null || d === void 0 ? void 0 : (_d$documentType7 = d.documentType) === null || _d$documentType7 === void 0 ? void 0 : _d$documentType7.includes("IDENTITYPROOF");
67422
+ var _d$documentType4;
67423
+ return d === null || d === void 0 ? void 0 : (_d$documentType4 = d.documentType) === null || _d$documentType4 === void 0 ? void 0 : _d$documentType4.includes("IDENTITYPROOF");
67353
67424
  });
67354
67425
  const ownershipDoc = docs.find(d => {
67355
- var _d$documentType8, _d$documentType9;
67356
- 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"));
67426
+ var _d$documentType5, _d$documentType6;
67427
+ 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"));
67357
67428
  });
67358
67429
  const otherDoc = docs.find(d => {
67359
- var _d$documentType0;
67360
- return d === null || d === void 0 ? void 0 : (_d$documentType0 = d.documentType) === null || _d$documentType0 === void 0 ? void 0 : _d$documentType0.includes("OTHERDOCUMENTS");
67430
+ var _d$documentType7;
67431
+ return d === null || d === void 0 ? void 0 : (_d$documentType7 = d.documentType) === null || _d$documentType7 === void 0 ? void 0 : _d$documentType7.includes("OTHERDOCUMENTS");
67361
67432
  });
67362
67433
  data.documents = {
67363
67434
  documents: docs,
@@ -67367,11 +67438,11 @@ const OLDApplication = () => {
67367
67438
  };
67368
67439
  }
67369
67440
  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 => {
67370
- var _d$documentType1;
67371
- 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"));
67441
+ var _d$documentType8;
67442
+ 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"));
67372
67443
  })) === 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 => {
67373
- var _d$documentType10;
67374
- 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"));
67444
+ var _d$documentType9;
67445
+ 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"));
67375
67446
  })) === null || _data$documents$docum2 === void 0 ? void 0 : _data$documents$docum2.fileStoreId);
67376
67447
  if (djbDoc) {
67377
67448
  if (!data.djbEmployee) data.djbEmployee = {};
@@ -67441,9 +67512,9 @@ const OLDApplication = () => {
67441
67512
  };
67442
67513
  }
67443
67514
  if (!(data !== null && data !== void 0 && (_data$cpt = data.cpt) !== null && _data$cpt !== void 0 && _data$cpt.details)) {
67444
- var _propertyDetails$Prop6;
67515
+ var _propertyDetails$Prop8;
67445
67516
  data.cpt = {
67446
- details: propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop6 = propertyDetails.Properties) === null || _propertyDetails$Prop6 === void 0 ? void 0 : _propertyDetails$Prop6[0]
67517
+ details: propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop8 = propertyDetails.Properties) === null || _propertyDetails$Prop8 === void 0 ? void 0 : _propertyDetails$Prop8[0]
67447
67518
  };
67448
67519
  }
67449
67520
  data.channel = ((_Digit$UserService$ge2 = Digit.UserService.getType()) === null || _Digit$UserService$ge2 === void 0 ? void 0 : _Digit$UserService$ge2.toUpperCase()) === "CITIZEN" ? "CITIZEN" : "CFC_COUNTER";
@@ -67459,7 +67530,7 @@ const OLDApplication = () => {
67459
67530
  code: "NONPTPRESSURE"
67460
67531
  },
67461
67532
  categoryType: (connDetail === null || connDetail === void 0 ? void 0 : connDetail.categoryType) || {
67462
- 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"
67533
+ 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"
67463
67534
  },
67464
67535
  domesticType: connDetail === null || connDetail === void 0 ? void 0 : connDetail.domesticType,
67465
67536
  departmentType: connDetail === null || connDetail === void 0 ? void 0 : connDetail.departmentType,