@djb25/digit-ui-module-ws 1.0.66 → 1.0.68

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
@@ -10917,6 +10917,11 @@ const BILLSBreadCrumbs = _ref => {
10917
10917
  path: "/digit-ui/employee/ws/required-documents",
10918
10918
  label: t("ES_COMMON_WS_DOCUMENTS_REQUIRED"),
10919
10919
  show: location.pathname.includes("/required-documents") ? true : false
10920
+ }, {
10921
+ path: "" + (location === null || location === void 0 ? void 0 : location.pathname) + location.search,
10922
+ label: t("WS_MUTATION_CONNECTION_LABEL"),
10923
+ show: location.pathname.includes("/mutation-application") ? true : false,
10924
+ isBack: true
10920
10925
  }, {
10921
10926
  path: requestParam ? "/digit-ui/employee/ws/bill-amendment?" + requestParam : "/digit-ui/employee/ws/bill-amendment",
10922
10927
  label: t("WS_BILL_AMEND_APP"),
@@ -11251,6 +11256,9 @@ const App$1 = _ref2 => {
11251
11256
  let actions = [];
11252
11257
  const getAction = flow => {
11253
11258
  switch (flow) {
11259
+ case "MUTATION":
11260
+ actions = ['WS_MUTATION_DETAILS', 'WS_MUTATION_NEW_CONSUMER', 'WS_MUTATION_DOCUMENTS', 'WS_MUTATION_PREVIEW'];
11261
+ break;
11254
11262
  default:
11255
11263
  actions = ['WS_COMMON_PROPERTY_DETAILS', 'WS_COMMON_CONNECTION_DETAIL', 'WS_COMMON_DOCUMENT_DETAILS', 'WS_COMMON_SUMMARY'];
11256
11264
  }
@@ -17433,13 +17441,13 @@ const UploadFileDigiLocker = props => {
17433
17441
  React.useEffect(() => handleEmpty(), [inpRef === null || inpRef === void 0 ? void 0 : (_inpRef$current = inpRef.current) === null || _inpRef$current === void 0 ? void 0 : _inpRef$current.files]);
17434
17442
  React.useEffect(() => handleChange(), [props.message]);
17435
17443
  const dataURItoBlob = dataURI => {
17436
- var binary = atob(dataURI.split(',')[1]);
17444
+ var binary = atob(dataURI.split(",")[1]);
17437
17445
  var array = [];
17438
17446
  for (var i = 0; i < binary.length; i++) {
17439
17447
  array.push(binary.charCodeAt(i));
17440
17448
  }
17441
17449
  return new Blob([new Uint8Array(array)], {
17442
- type: 'application/pdf'
17450
+ type: "application/pdf"
17443
17451
  });
17444
17452
  };
17445
17453
  const fetchDigiLockerDocuments = function (e) {
@@ -17473,20 +17481,69 @@ const UploadFileDigiLocker = props => {
17473
17481
  const code = props.documentType.toUpperCase();
17474
17482
  if (code.includes("AADHAAR") || code.includes("AADHAR")) doctype = "ADHAR";else if (code.includes("DRIVING") || code.includes("DRVLC")) doctype = "DRVLC";else if (code.includes("PAN")) doctype = "PANCR";else if (code.includes("VOTER")) doctype = "VOTER";
17475
17483
  }
17476
- let uri = res1.IssuedDoc.filter(item => item.doctype === doctype);
17477
- const _temp = function () {
17484
+ const DOCTYPE_ALIASES = {
17485
+ ADHAR: ["ADHAR", "AADHAAR", "AADHAR"],
17486
+ DRVLC: ["DRVLC", "DRIVING"],
17487
+ PANCR: ["PANCR", "PANCH", "PAN"],
17488
+ VOTER: ["VOTER", "VOTERID"]
17489
+ };
17490
+ const aliases = DOCTYPE_ALIASES[doctype] || [doctype];
17491
+ let uri = res1.IssuedDoc.filter(item => aliases.some(alias => item.doctype === alias));
17492
+ const _temp5 = function () {
17478
17493
  if ((uri === null || uri === void 0 ? void 0 : uri.length) > 0) {
17494
+ const uriStr = uri[0].uri || "";
17495
+ const parts = uriStr.split("-");
17496
+ const documentNumber = parts.length > 1 ? parts[parts.length - 1] : "";
17497
+ if (documentNumber && props !== null && props !== void 0 && props.onDocumentNumber) {
17498
+ props.onDocumentNumber(documentNumber);
17499
+ }
17479
17500
  let TokenReqNew = {
17480
17501
  authToken: digiLockerToken,
17481
- id: uri[0].uri
17502
+ id: uriStr
17482
17503
  };
17483
17504
  const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
17484
17505
  return Promise.resolve(Digit.DigiLockerService.uri({
17485
17506
  TokenReq: TokenReqNew
17486
17507
  }, tenantId)).then(function (res2) {
17487
- let c = new Blob([res2]);
17488
- let filename = doctype + "_" + (uri[0].name || "document") + ".pdf";
17489
- convertToFile(e, c, filename);
17508
+ function _temp4() {
17509
+ let filename = doctype + "_" + (uri[0].name || "document") + ".pdf";
17510
+ if (blobData) convertToFile(e, blobData, filename);else setShowToast({
17511
+ error: true,
17512
+ label: "Failed to read document from DigiLocker."
17513
+ });
17514
+ }
17515
+ let blobData;
17516
+ const _temp3 = function () {
17517
+ if (typeof res2 === "string" && res2.includes("base64")) {
17518
+ blobData = dataURItoBlob(res2);
17519
+ } else {
17520
+ const _temp2 = function () {
17521
+ if (res2 instanceof Blob) {
17522
+ blobData = res2;
17523
+ } else {
17524
+ const _temp = function () {
17525
+ if (res2 && typeof res2 === "object" && res2.fileStoreId) {
17526
+ return Promise.resolve(Digit.UploadServices.FileFetchbyid(res2.fileStoreId, Digit.ULBService.getStateId())).then(function (fileRes) {
17527
+ if (fileRes !== null && fileRes !== void 0 && fileRes.data) {
17528
+ var _fileRes$headers;
17529
+ blobData = fileRes.data instanceof Blob ? fileRes.data : new Blob([fileRes.data], {
17530
+ type: ((_fileRes$headers = fileRes.headers) === null || _fileRes$headers === void 0 ? void 0 : _fileRes$headers["content-type"]) || "application/pdf"
17531
+ });
17532
+ }
17533
+ });
17534
+ } else {
17535
+ blobData = new Blob([JSON.stringify(res2)], {
17536
+ type: "application/pdf"
17537
+ });
17538
+ }
17539
+ }();
17540
+ if (_temp && _temp.then) return _temp.then(function () {});
17541
+ }
17542
+ }();
17543
+ if (_temp2 && _temp2.then) return _temp2.then(function () {});
17544
+ }
17545
+ }();
17546
+ return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
17490
17547
  });
17491
17548
  } else {
17492
17549
  setShowToast({
@@ -17495,7 +17552,7 @@ const UploadFileDigiLocker = props => {
17495
17552
  });
17496
17553
  }
17497
17554
  }();
17498
- if (_temp && _temp.then) return _temp.then(function () {});
17555
+ if (_temp5 && _temp5.then) return _temp5.then(function () {});
17499
17556
  });
17500
17557
  }, function (error) {
17501
17558
  console.error("DigiLocker Fetch Error:", error);
@@ -17821,25 +17878,28 @@ function SelectDocument(_ref2) {
17821
17878
  documentUid = _useState7[0],
17822
17879
  setDocumentUid = _useState7[1];
17823
17880
  const _useState8 = React.useState(false),
17824
- showCamera = _useState8[0],
17825
- setShowCamera = _useState8[1];
17881
+ isDocumentUidLocked = _useState8[0],
17882
+ setIsDocumentUidLocked = _useState8[1];
17826
17883
  const _useState9 = React.useState(false),
17827
- isUploading = _useState9[0],
17828
- setIsUploading = _useState9[1];
17884
+ showCamera = _useState9[0],
17885
+ setShowCamera = _useState9[1];
17829
17886
  const _useState0 = React.useState(false),
17830
- setIsCameraFile = _useState0[1];
17887
+ isUploading = _useState0[0],
17888
+ setIsUploading = _useState0[1];
17831
17889
  const _useState1 = React.useState(false),
17832
- showDocModal = _useState1[0],
17833
- setShowDocModal = _useState1[1];
17834
- const _useState10 = React.useState(""),
17835
- docFileUrl = _useState10[0],
17836
- setDocFileUrl = _useState10[1];
17890
+ setIsCameraFile = _useState1[1];
17891
+ const _useState10 = React.useState(false),
17892
+ showDocModal = _useState10[0],
17893
+ setShowDocModal = _useState10[1];
17837
17894
  const _useState11 = React.useState(""),
17838
- docFileType = _useState11[0],
17839
- setDocFileType = _useState11[1];
17840
- const _useState12 = React.useState(false),
17841
- digiLockerUpload = _useState12[0],
17842
- setDigilockerUpload = _useState12[1];
17895
+ docFileUrl = _useState11[0],
17896
+ setDocFileUrl = _useState11[1];
17897
+ const _useState12 = React.useState(""),
17898
+ docFileType = _useState12[0],
17899
+ setDocFileType = _useState12[1];
17900
+ const _useState13 = React.useState(false),
17901
+ digiLockerUpload = _useState13[0],
17902
+ setDigilockerUpload = _useState13[1];
17843
17903
  React.useEffect(() => {
17844
17904
  const eligible = isDigiLockerEligible((selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code) || "");
17845
17905
  setDigilockerUpload(eligible);
@@ -17857,17 +17917,16 @@ function SelectDocument(_ref2) {
17857
17917
  const _temp = _catch(function () {
17858
17918
  return Promise.resolve(Digit.UploadServices.FileFetchbyid(uploadedFile, Digit.ULBService.getStateId())).then(function (res) {
17859
17919
  if (res !== null && res !== void 0 && res.data) {
17920
+ var _res$headers, _res$headers2;
17921
+ const contentType = ((_res$headers = res.headers) === null || _res$headers === void 0 ? void 0 : _res$headers["content-type"]) || ((_res$headers2 = res.headers) === null || _res$headers2 === void 0 ? void 0 : _res$headers2["Content-Type"]) || "";
17922
+ const isPdf = contentType.toLowerCase().includes("pdf") || res.data instanceof Blob && res.data.type && res.data.type.toLowerCase().includes("pdf");
17923
+ const mimeType = isPdf ? "application/pdf" : contentType || "image/jpeg";
17860
17924
  const blob = res.data instanceof Blob ? res.data : new Blob([res.data], {
17861
- type: res.headers["content-type"] || res.headers["Content-Type"] || "image/jpeg"
17925
+ type: mimeType
17862
17926
  });
17863
17927
  const fileURL = URL.createObjectURL(blob);
17864
17928
  setDocFileUrl(fileURL);
17865
- const contentType = res.headers["content-type"] || res.headers["Content-Type"] || "";
17866
- if (contentType.toLowerCase().includes("pdf")) {
17867
- setDocFileType("pdf");
17868
- } else {
17869
- setDocFileType("image");
17870
- }
17929
+ setDocFileType(isPdf ? "pdf" : "image");
17871
17930
  setShowDocModal(true);
17872
17931
  }
17873
17932
  });
@@ -17906,8 +17965,8 @@ function SelectDocument(_ref2) {
17906
17965
  }
17907
17966
  const dropdownData = doc.dropdownData;
17908
17967
  var dropDownData = dropdownData;
17909
- const _useState13 = React.useState(false),
17910
- isHidden = _useState13[0];
17968
+ const _useState14 = React.useState(false),
17969
+ isHidden = _useState14[0];
17911
17970
  const addError = () => {
17912
17971
  var _formState$errors, _formState$errors$con;
17913
17972
  let type = formState === null || formState === void 0 ? void 0 : (_formState$errors = formState.errors) === null || _formState$errors === void 0 ? void 0 : (_formState$errors$con = _formState$errors[config.key]) === null || _formState$errors$con === void 0 ? void 0 : _formState$errors$con.type;
@@ -18047,8 +18106,16 @@ function SelectDocument(_ref2) {
18047
18106
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
18048
18107
  type: "text",
18049
18108
  value: documentUid,
18050
- onChange: e => setDocumentUid(e.target.value),
18051
- placeholder: t("WS_IDENTITY_NO_PLACEHOLDER")
18109
+ onChange: e => {
18110
+ if (!isDocumentUidLocked) setDocumentUid(e.target.value);
18111
+ },
18112
+ placeholder: t("WS_IDENTITY_NO_PLACEHOLDER"),
18113
+ disabled: isDocumentUidLocked,
18114
+ style: isDocumentUidLocked ? {
18115
+ backgroundColor: "#f0f0f0",
18116
+ cursor: "not-allowed",
18117
+ color: "#555"
18118
+ } : {}
18052
18119
  }))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, doc !== null && doc !== void 0 && doc.required ? t((doc === null || doc === void 0 ? void 0 : (_doc$i18nKey2 = doc.i18nKey) === null || _doc$i18nKey2 === void 0 ? void 0 : _doc$i18nKey2.replaceAll(".", "_")) + "_UPLOAD_DOCUMENT") + "*" : "" + t((doc === null || doc === void 0 ? void 0 : (_doc$i18nKey3 = doc.i18nKey) === null || _doc$i18nKey3 === void 0 ? void 0 : _doc$i18nKey3.replaceAll(".", "_")) + "_UPLOAD_DOCUMENT")), /*#__PURE__*/React__default.createElement("div", {
18053
18120
  className: "field",
18054
18121
  style: {
@@ -18067,6 +18134,7 @@ function SelectDocument(_ref2) {
18067
18134
  setUploadedFile(null);
18068
18135
  setFile(null);
18069
18136
  setIsCameraFile(false);
18137
+ setIsDocumentUidLocked(false);
18070
18138
  },
18071
18139
  id: id,
18072
18140
  message: uploadedFile ? "1 " + t("CS_ACTION_FILEUPLOADED") : t("CS_ACTION_NO_FILEUPLOADED"),
@@ -18083,8 +18151,13 @@ function SelectDocument(_ref2) {
18083
18151
  setUploadedFile(null);
18084
18152
  setFile(null);
18085
18153
  setIsCameraFile(false);
18154
+ setIsDocumentUidLocked(false);
18086
18155
  },
18087
- documentType: selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code
18156
+ documentType: selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code,
18157
+ onDocumentNumber: num => {
18158
+ setDocumentUid(num);
18159
+ setIsDocumentUidLocked(true);
18160
+ }
18088
18161
  }) : /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
18089
18162
  onUpload: selectfile,
18090
18163
  onDelete: () => {
@@ -18221,12 +18294,12 @@ const CameraCaptureModal = _ref4 => {
18221
18294
  t = _ref4.t;
18222
18295
  const videoRef = React.useRef(null);
18223
18296
  const canvasRef = React.useRef(null);
18224
- const _useState14 = React.useState(null),
18225
- stream = _useState14[0],
18226
- setStream = _useState14[1];
18227
18297
  const _useState15 = React.useState(null),
18228
- error = _useState15[0],
18229
- setError = _useState15[1];
18298
+ stream = _useState15[0],
18299
+ setStream = _useState15[1];
18300
+ const _useState16 = React.useState(null),
18301
+ error = _useState16[0],
18302
+ setError = _useState16[1];
18230
18303
  React.useEffect(() => {
18231
18304
  const startCamera = function () {
18232
18305
  try {
@@ -47998,11 +48071,11 @@ const ApplicationDetails$1 = () => {
47998
48071
  };
47999
48072
 
48000
48073
  const GetConnectionDetails = () => {
48001
- var _applicationDetails$a, _applicationDetails$a2, _applicationDetails$a3, _applicationDetails$a4, _applicationDetails$a5, _applicationDetails$a6, _applicationDetails$a7, _applicationDetails$a8, _applicationDetails$a9, _applicationDetails$a0, _applicationDetails$a1, _applicationDetails$a10, _applicationDetails$a11, _applicationDetails$a12, _mdmsCommonmastersDat, _applicationDetails$a14, _applicationDetails$a18, _applicationDetails$f5, _applicationDetails$p3, _applicationDetails$p4, _applicationDetails$a19, _applicationDetails$a20, _applicationDetails$a21, _applicationDetails$f6, _applicationDetails$f7;
48074
+ var _applicationDetails$a, _applicationDetails$a2, _applicationDetails$a3, _applicationDetails$a4, _applicationDetails$a5, _applicationDetails$a6, _applicationDetails$a7, _applicationDetails$a8, _applicationDetails$a9, _applicationDetails$a0, _applicationDetails$a1, _applicationDetails$a10, _applicationDetails$a11, _applicationDetails$a12, _mdmsCommonmastersDat, _applicationDetails$a14, _applicationDetails$a18, _applicationDetails$f7, _applicationDetails$p3, _applicationDetails$p4, _applicationDetails$a19, _applicationDetails$a20, _applicationDetails$a21, _applicationDetails$f8, _applicationDetails$f9;
48002
48075
  const getBillSearch = function () {
48003
48076
  try {
48004
- const _temp = function (_applicationDetails$f8) {
48005
- if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f8 = applicationDetails.fetchBillsData) === null || _applicationDetails$f8 === void 0 ? void 0 : _applicationDetails$f8.length) > 0) {
48077
+ const _temp = function (_applicationDetails$f0) {
48078
+ if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f0 = applicationDetails.fetchBillsData) === null || _applicationDetails$f0 === void 0 ? void 0 : _applicationDetails$f0.length) > 0) {
48006
48079
  var _applicationDetails$a22;
48007
48080
  const service = serviceType === "WATER" ? "WS" : "SW";
48008
48081
  let wsSearchFilters = {
@@ -48132,7 +48205,7 @@ const GetConnectionDetails = () => {
48132
48205
  const checkApplicationStatus = (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a14 = applicationDetails.applicationData) === null || _applicationDetails$a14 === void 0 ? void 0 : _applicationDetails$a14.status) === "Active" ? true : false;
48133
48206
  const checkWorkflow = applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.isApplicationApproved;
48134
48207
  const getModifyConnectionButton = () => {
48135
- var _applicationDetails$f, _applicationDetails$a15, _applicationDetails$p;
48208
+ var _applicationDetails$f, _applicationDetails$f2, _applicationDetails$a15, _applicationDetails$p;
48136
48209
  if (!checkApplicationStatus) {
48137
48210
  setshowActionToast({
48138
48211
  key: "error",
@@ -48140,7 +48213,7 @@ const GetConnectionDetails = () => {
48140
48213
  });
48141
48214
  return;
48142
48215
  }
48143
- if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f = applicationDetails.fetchBillsData[0]) === null || _applicationDetails$f === void 0 ? void 0 : _applicationDetails$f.totalAmount) > 0) {
48216
+ if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f = applicationDetails.fetchBillsData) === null || _applicationDetails$f === void 0 ? void 0 : (_applicationDetails$f2 = _applicationDetails$f[0]) === null || _applicationDetails$f2 === void 0 ? void 0 : _applicationDetails$f2.totalAmount) > 0) {
48144
48217
  setshowActionToast({
48145
48218
  key: "error",
48146
48219
  label: "WS_DUE_AMOUNT_SHOULD_BE_ZERO"
@@ -48153,7 +48226,7 @@ const GetConnectionDetails = () => {
48153
48226
  }));
48154
48227
  };
48155
48228
  const getMutationButton = () => {
48156
- var _applicationDetails$f2, _applicationDetails$a16, _applicationDetails$p2;
48229
+ var _applicationDetails$f3, _applicationDetails$f4, _applicationDetails$a16, _applicationDetails$p2;
48157
48230
  if (!checkApplicationStatus) {
48158
48231
  setshowActionToast({
48159
48232
  key: "error",
@@ -48161,7 +48234,7 @@ const GetConnectionDetails = () => {
48161
48234
  });
48162
48235
  return;
48163
48236
  }
48164
- if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f2 = applicationDetails.fetchBillsData[0]) === null || _applicationDetails$f2 === void 0 ? void 0 : _applicationDetails$f2.totalAmount) > 0) {
48237
+ if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f3 = applicationDetails.fetchBillsData) === null || _applicationDetails$f3 === void 0 ? void 0 : (_applicationDetails$f4 = _applicationDetails$f3[0]) === null || _applicationDetails$f4 === void 0 ? void 0 : _applicationDetails$f4.totalAmount) > 0) {
48165
48238
  setshowActionToast({
48166
48239
  key: "error",
48167
48240
  label: "WS_DUE_AMOUNT_SHOULD_BE_ZERO"
@@ -48215,9 +48288,9 @@ const GetConnectionDetails = () => {
48215
48288
  label: "WORKFLOW_IN_PROGRESS"
48216
48289
  });
48217
48290
  } else {
48218
- var _billData$, _applicationDetails$f3;
48291
+ var _billData$, _applicationDetails$f5;
48219
48292
  console.log("due", due, applicationDetails);
48220
- if (((_billData$ = billData[0]) === null || _billData$ === void 0 ? void 0 : _billData$.status) === "ACTIVE" || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f3 = applicationDetails.fetchBillsData) === null || _applicationDetails$f3 === void 0 ? void 0 : _applicationDetails$f3.length) <= 0 || due == "0" || due < 0) {
48293
+ if (((_billData$ = billData[0]) === null || _billData$ === void 0 ? void 0 : _billData$.status) === "ACTIVE" || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f5 = applicationDetails.fetchBillsData) === null || _applicationDetails$f5 === void 0 ? void 0 : _applicationDetails$f5.length) <= 0 || due == "0" || due < 0) {
48221
48294
  Digit.SessionStorage.set("WS_DISCONNECTION", applicationDetails);
48222
48295
  history.push("" + pathname);
48223
48296
  } else {
@@ -48233,8 +48306,8 @@ const GetConnectionDetails = () => {
48233
48306
  label: "WORKFLOW_IN_PROGRESS"
48234
48307
  });
48235
48308
  } else {
48236
- var _billData$2, _applicationDetails$f4;
48237
- if (((_billData$2 = billData[0]) === null || _billData$2 === void 0 ? void 0 : _billData$2.status) === "ACTIVE" || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f4 = applicationDetails.fetchBillsData) === null || _applicationDetails$f4 === void 0 ? void 0 : _applicationDetails$f4.length) <= 0 || due === "0") {
48309
+ var _billData$2, _applicationDetails$f6;
48310
+ if (((_billData$2 = billData[0]) === null || _billData$2 === void 0 ? void 0 : _billData$2.status) === "ACTIVE" || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f6 = applicationDetails.fetchBillsData) === null || _applicationDetails$f6 === void 0 ? void 0 : _applicationDetails$f6.length) <= 0 || due === "0") {
48238
48311
  Digit.SessionStorage.set("WS_DISCONNECTION", applicationDetails);
48239
48312
  history.push("" + pathname);
48240
48313
  } else {
@@ -48269,7 +48342,7 @@ const GetConnectionDetails = () => {
48269
48342
  label: t("WS_CONNECTION_DETAILS"),
48270
48343
  onClick: () => downloadConnectionDetails()
48271
48344
  };
48272
- if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f5 = applicationDetails.fetchBillsData) === null || _applicationDetails$f5 === void 0 ? void 0 : _applicationDetails$f5.length) > 0) dowloadOptions = [appFeeDownloadReceipt, connectionDetailsReceipt];else dowloadOptions = [connectionDetailsReceipt];
48345
+ if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f7 = applicationDetails.fetchBillsData) === null || _applicationDetails$f7 === void 0 ? void 0 : _applicationDetails$f7.length) > 0) dowloadOptions = [appFeeDownloadReceipt, connectionDetailsReceipt];else dowloadOptions = [connectionDetailsReceipt];
48273
48346
  const Close = () => /*#__PURE__*/React__default.createElement("svg", {
48274
48347
  xmlns: "http://www.w3.org/2000/svg",
48275
48348
  viewBox: "0 0 24 24",
@@ -48392,7 +48465,7 @@ const GetConnectionDetails = () => {
48392
48465
  className: "modal-header-ws"
48393
48466
  }, t("WS_CLEAR_DUES_DISCONNECTION_SUB_HEADER_LABEL"), " "), /*#__PURE__*/React__default.createElement("div", {
48394
48467
  className: "modal-body-ws"
48395
- }, /*#__PURE__*/React__default.createElement("span", null, t("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"), ": \u20B9", due ? due : applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f6 = applicationDetails.fetchBillsData) === null || _applicationDetails$f6 === void 0 ? void 0 : (_applicationDetails$f7 = _applicationDetails$f6[0]) === null || _applicationDetails$f7 === void 0 ? void 0 : _applicationDetails$f7.totalAmount))) : null, showActionToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
48468
+ }, /*#__PURE__*/React__default.createElement("span", null, t("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"), ": \u20B9", due ? due : applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f8 = applicationDetails.fetchBillsData) === null || _applicationDetails$f8 === void 0 ? void 0 : (_applicationDetails$f9 = _applicationDetails$f8[0]) === null || _applicationDetails$f9 === void 0 ? void 0 : _applicationDetails$f9.totalAmount))) : null, showActionToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
48396
48469
  error: showActionToast.key,
48397
48470
  label: t("" + showActionToast.label),
48398
48471
  onClose: closeBillToast
@@ -49546,7 +49619,15 @@ const ConsumptionDetails = _ref => {
49546
49619
  meterReadings = _ref2.meterReadings;
49547
49620
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
49548
49621
  className: "employee-form-section-wrapper"
49549
- }, /*#__PURE__*/React__default.createElement("div", {
49622
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
49623
+ config: [{
49624
+ timeLine: [{
49625
+ actions: "WS_VIEW_CONSUMPTION",
49626
+ currentStep: 1
49627
+ }]
49628
+ }],
49629
+ showFinalStep: false
49630
+ }), /*#__PURE__*/React__default.createElement("div", {
49550
49631
  style: {
49551
49632
  flex: 1,
49552
49633
  display: "flex",
@@ -50170,49 +50251,230 @@ const EditModifyApplication = () => {
50170
50251
  }));
50171
50252
  };
50172
50253
 
50173
- const WSMutationApplicantDetails = _ref => {
50174
- var _formData$config$key, _errors$proposedNewCo, _errors$newOwnerMobil, _errors$newOwnerEmail, _errors$relationshipW, _errors$reasonForName;
50254
+ const Step1_ExistingConnection = _ref => {
50255
+ var _appData$connectionHo, _propertyData$Propert, _propertyData$Propert2, _appData$property, _propertyAddress$loca;
50256
+ let applicationDetails = _ref.applicationDetails,
50257
+ propertyId = _ref.propertyId;
50258
+ const getMaskedName = name => {
50259
+ if (!name) return "NA";
50260
+ return name.split("").map((char, index) => index % 2 === 1 && char !== " " ? "*" : char).join("");
50261
+ };
50262
+ const getMaskedPhone = phone => {
50263
+ if (!phone || phone.length < 10) return "NA";
50264
+ return "******" + phone.slice(-4);
50265
+ };
50266
+ const appData = (applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.applicationData) || {};
50267
+ const connectionNo = (appData === null || appData === void 0 ? void 0 : appData.connectionNo) || "NA";
50268
+ const meterId = (appData === null || appData === void 0 ? void 0 : appData.meterId) || "NA";
50269
+ const connectionStatus = (appData === null || appData === void 0 ? void 0 : appData.status) || "NA";
50270
+ const holderDetails = (appData === null || appData === void 0 ? void 0 : (_appData$connectionHo = appData.connectionHolders) === null || _appData$connectionHo === void 0 ? void 0 : _appData$connectionHo[0]) || {};
50271
+ const registeredName = getMaskedName(holderDetails === null || holderDetails === void 0 ? void 0 : holderDetails.name);
50272
+ const registeredPhone = getMaskedPhone(holderDetails === null || holderDetails === void 0 ? void 0 : holderDetails.mobileNumber);
50273
+ const tenantId = Digit.ULBService.getCurrentTenantId();
50274
+ const _Digit$Hooks$pt$usePr = Digit.Hooks.pt.usePropertySearch({
50275
+ filters: {
50276
+ propertyIds: propertyId
50277
+ },
50278
+ tenantId
50279
+ }, {
50280
+ enabled: !!propertyId
50281
+ }),
50282
+ propertyData = _Digit$Hooks$pt$usePr.data;
50283
+ const propertyAddress = (propertyData === null || propertyData === void 0 ? void 0 : (_propertyData$Propert = propertyData.Properties) === null || _propertyData$Propert === void 0 ? void 0 : (_propertyData$Propert2 = _propertyData$Propert[0]) === null || _propertyData$Propert2 === void 0 ? void 0 : _propertyData$Propert2.address) || (appData === null || appData === void 0 ? void 0 : (_appData$property = appData.property) === null || _appData$property === void 0 ? void 0 : _appData$property.address) || {};
50284
+ const formattedAddress = [(propertyAddress === null || propertyAddress === void 0 ? void 0 : propertyAddress.houseNo) || (propertyAddress === null || propertyAddress === void 0 ? void 0 : propertyAddress.doorNo), propertyAddress === null || propertyAddress === void 0 ? void 0 : propertyAddress.buildingName, propertyAddress === null || propertyAddress === void 0 ? void 0 : propertyAddress.street, propertyAddress === null || propertyAddress === void 0 ? void 0 : (_propertyAddress$loca = propertyAddress.locality) === null || _propertyAddress$loca === void 0 ? void 0 : _propertyAddress$loca.name, propertyAddress === null || propertyAddress === void 0 ? void 0 : propertyAddress.city, propertyAddress === null || propertyAddress === void 0 ? void 0 : propertyAddress.pincode].filter(Boolean).join(", ") || "NA";
50285
+ const missingFields = [];
50286
+ if (connectionNo === "NA") missingFields.push("Connection Number");
50287
+ if (registeredName === "NA") missingFields.push("Owner Name");
50288
+ if (formattedAddress === "NA") missingFields.push("Property Address");
50289
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
50290
+ style: {
50291
+ marginBottom: "20px"
50292
+ }
50293
+ }, /*#__PURE__*/React__default.createElement("div", {
50294
+ style: {
50295
+ padding: "16px",
50296
+ backgroundColor: "#fff3cd",
50297
+ color: "#856404",
50298
+ borderRadius: "8px",
50299
+ border: "1px solid #ffeeba",
50300
+ marginBottom: "20px",
50301
+ display: "flex",
50302
+ alignItems: "center"
50303
+ }
50304
+ }, /*#__PURE__*/React__default.createElement("span", {
50305
+ style: {
50306
+ marginRight: "8px",
50307
+ fontSize: "20px"
50308
+ }
50309
+ }, "\u2139\uFE0F"), /*#__PURE__*/React__default.createElement("span", {
50310
+ style: {
50311
+ fontWeight: "500"
50312
+ }
50313
+ }, "Name Change / Mutation is limited to changing the name of the consumer/account holder on the existing water connection. It does not constitute or imply transfer of property ownership.")), missingFields.length > 0 && /*#__PURE__*/React__default.createElement("div", {
50314
+ style: {
50315
+ padding: "12px 16px",
50316
+ backgroundColor: "#fdecea",
50317
+ color: "#611a15",
50318
+ borderRadius: "8px",
50319
+ border: "1px solid #f5c6cb",
50320
+ marginBottom: "16px",
50321
+ display: "flex",
50322
+ alignItems: "center"
50323
+ }
50324
+ }, /*#__PURE__*/React__default.createElement("span", {
50325
+ style: {
50326
+ marginRight: "8px",
50327
+ fontSize: "18px"
50328
+ }
50329
+ }, "\u26A0\uFE0F"), /*#__PURE__*/React__default.createElement("span", {
50330
+ style: {
50331
+ fontWeight: "500",
50332
+ fontSize: "14px"
50333
+ }
50334
+ }, "Please verify the connection data before proceeding.")), /*#__PURE__*/React__default.createElement("div", {
50335
+ style: {
50336
+ display: "flex",
50337
+ alignItems: "center",
50338
+ marginBottom: "16px"
50339
+ }
50340
+ }, /*#__PURE__*/React__default.createElement("span", {
50341
+ style: {
50342
+ fontSize: "24px",
50343
+ marginRight: "8px"
50344
+ }
50345
+ }, "\uD83C\uDFE2"), /*#__PURE__*/React__default.createElement("h2", {
50346
+ style: {
50347
+ fontSize: "20px",
50348
+ fontWeight: "700",
50349
+ margin: 0
50350
+ }
50351
+ }, "1. Existing Connection & Current Consumer Details.")), /*#__PURE__*/React__default.createElement("div", {
50352
+ style: {
50353
+ padding: "16px",
50354
+ backgroundColor: "#f9f9f9",
50355
+ borderRadius: "8px",
50356
+ borderLeft: "4px solid #00497e"
50357
+ }
50358
+ }, /*#__PURE__*/React__default.createElement("div", {
50359
+ style: {
50360
+ display: "grid",
50361
+ gridTemplateColumns: "1fr 1fr 1fr",
50362
+ gap: "16px"
50363
+ }
50364
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
50365
+ style: {
50366
+ color: "#555",
50367
+ fontSize: "14px",
50368
+ marginBottom: "4px"
50369
+ }
50370
+ }, "Connection Number"), /*#__PURE__*/React__default.createElement("div", {
50371
+ style: {
50372
+ fontWeight: "bold"
50373
+ }
50374
+ }, connectionNo)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
50375
+ style: {
50376
+ color: "#555",
50377
+ fontSize: "14px",
50378
+ marginBottom: "4px"
50379
+ }
50380
+ }, "Current Owner Name"), /*#__PURE__*/React__default.createElement("div", {
50381
+ style: {
50382
+ fontWeight: "bold"
50383
+ }
50384
+ }, registeredName)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
50385
+ style: {
50386
+ color: "#555",
50387
+ fontSize: "14px",
50388
+ marginBottom: "4px"
50389
+ }
50390
+ }, "Property Address"), /*#__PURE__*/React__default.createElement("div", {
50391
+ style: {
50392
+ fontWeight: "bold"
50393
+ }
50394
+ }, formattedAddress)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
50395
+ style: {
50396
+ color: "#555",
50397
+ fontSize: "14px",
50398
+ marginBottom: "4px"
50399
+ }
50400
+ }, "Connection Status"), /*#__PURE__*/React__default.createElement("div", {
50401
+ style: {
50402
+ fontWeight: "bold",
50403
+ color: (connectionStatus === null || connectionStatus === void 0 ? void 0 : connectionStatus.toLowerCase()) === "active" ? "#28a745" : "#dc3545"
50404
+ }
50405
+ }, connectionStatus)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
50406
+ style: {
50407
+ color: "#555",
50408
+ fontSize: "14px",
50409
+ marginBottom: "4px"
50410
+ }
50411
+ }, "Meter Number"), /*#__PURE__*/React__default.createElement("div", {
50412
+ style: {
50413
+ fontWeight: "bold"
50414
+ }
50415
+ }, meterId)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
50416
+ style: {
50417
+ color: "#555",
50418
+ fontSize: "14px",
50419
+ marginBottom: "4px"
50420
+ }
50421
+ }, "Mobile Number"), /*#__PURE__*/React__default.createElement("div", {
50422
+ style: {
50423
+ fontWeight: "bold"
50424
+ }
50425
+ }, registeredPhone)))));
50426
+ };
50427
+
50428
+ const Step2_NewConsumerDetails = _ref => {
50429
+ var _errors$proposedNewCo, _errors$gender, _errors$newOwnerMobil, _errors$newOwnerEmail, _errors$reasonForName, _errors$relationshipW;
50175
50430
  let t = _ref.t,
50176
- config = _ref.config,
50177
- onSelect = _ref.onSelect,
50178
- formData = _ref.formData,
50179
- clearErrors = _ref.clearErrors;
50431
+ onNext = _ref.onNext,
50432
+ onBack = _ref.onBack,
50433
+ defaultValues = _ref.defaultValues;
50180
50434
  const _useForm = reactHookForm.useForm({
50181
- defaultValues: (formData === null || formData === void 0 ? void 0 : formData[config.key]) || {}
50435
+ defaultValues: defaultValues || {},
50436
+ mode: "onBlur"
50182
50437
  }),
50183
50438
  control = _useForm.control,
50184
- watch = _useForm.watch,
50185
- localFormState = _useForm.formState;
50186
- const formValue = watch();
50187
- const errors = localFormState.errors;
50439
+ handleSubmit = _useForm.handleSubmit,
50440
+ errors = _useForm.formState.errors,
50441
+ trigger = _useForm.trigger,
50442
+ setError = _useForm.setError,
50443
+ clearErrors = _useForm.clearErrors;
50444
+ const _useState = React.useState(null),
50445
+ showToast = _useState[0],
50446
+ setShowToast = _useState[1];
50447
+ const _useState2 = React.useState({}),
50448
+ touched = _useState2[0],
50449
+ setTouched = _useState2[1];
50450
+ const selectedReason = reactHookForm.useWatch({
50451
+ control,
50452
+ name: "reasonForNameChange"
50453
+ });
50454
+ const isOtherReason = (selectedReason === null || selectedReason === void 0 ? void 0 : selectedReason.code) === "OTHER" || selectedReason === "OTHER";
50455
+ const genderOptions = [{
50456
+ code: "MALE",
50457
+ i18nKey: "Male"
50458
+ }, {
50459
+ code: "FEMALE",
50460
+ i18nKey: "Female"
50461
+ }, {
50462
+ code: "TRANSGENDER",
50463
+ i18nKey: "Transgender"
50464
+ }];
50188
50465
  const reasonOptions = [{
50189
50466
  code: "SALE_PURCHASE",
50190
- i18nKey: "Sale / Purchase of Property"
50467
+ i18nKey: "Purchase of Property"
50191
50468
  }, {
50192
50469
  code: "DEVOLUTION_INHERITANCE",
50193
50470
  i18nKey: "Devolution/Inheritance"
50194
50471
  }, {
50195
50472
  code: "OTHER",
50196
- i18nKey: "Other Reason(Gift, Lease, etc)"
50473
+ i18nKey: "Other Reason(Gift Deed, Lease Agreement, etc)"
50197
50474
  }];
50198
50475
  const relationshipOptions = [{
50199
- code: "MOTHER",
50200
- i18nKey: "Mother"
50201
- }, {
50202
- code: "FATHER",
50203
- i18nKey: "Father"
50204
- }, {
50205
- code: "SIBLING",
50206
- i18nKey: "Sibling"
50207
- }, {
50208
- code: "SPOUSE",
50209
- i18nKey: "Spouse"
50210
- }, {
50211
- code: "SON",
50212
- i18nKey: "Son"
50213
- }, {
50214
- code: "DAUGHTER",
50215
- i18nKey: "Daughter"
50476
+ code: "BLOOD_RELATION",
50477
+ i18nKey: "Blood Relation (Son / Daughter / Spouse)"
50216
50478
  }, {
50217
50479
  code: "LEGAL_HEIR",
50218
50480
  i18nKey: "Legal heir"
@@ -50220,432 +50482,1357 @@ const WSMutationApplicantDetails = _ref => {
50220
50482
  code: "OTHER",
50221
50483
  i18nKey: "Other"
50222
50484
  }];
50223
- const _useState = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key = formData[config.key]) === null || _formData$config$key === void 0 ? void 0 : _formData$config$key.saleDeedDocumentId) || null),
50224
- uploadedFile = _useState[0],
50225
- setUploadedFile = _useState[1];
50226
- const _useState2 = React.useState(null),
50227
- file = _useState2[0],
50228
- setFile = _useState2[1];
50229
- const _useState3 = React.useState(false),
50230
- isUploading = _useState3[0],
50231
- setIsUploading = _useState3[1];
50232
- React.useEffect(() => {
50233
- const currentState = _extends({}, formValue, {
50234
- saleDeedDocumentId: uploadedFile
50235
- });
50236
- if (!lodash.isEqual(formData === null || formData === void 0 ? void 0 : formData[config.key], currentState)) {
50237
- onSelect(config.key, currentState);
50238
- }
50239
- }, [formValue, uploadedFile]);
50240
- React.useEffect(() => {
50241
- (function () {
50242
- try {
50243
- const _temp2 = function () {
50244
- if (file) {
50245
- const _temp = _finallyRethrows(function () {
50246
- return _catch(function () {
50247
- setIsUploading(true);
50248
- return Promise.resolve(window.Digit.UploadServices.Filestorage("WS", file, window.Digit.ULBService.getStateId())).then(function (response) {
50249
- var _response$data, _response$data$files;
50250
- if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
50251
- setUploadedFile(response.data.files[0].fileStoreId);
50252
- clearErrors && clearErrors(config.key);
50253
- }
50254
- });
50255
- }, function (err) {
50256
- console.error("File upload error", err);
50257
- });
50258
- }, function (_wasThrown, _result) {
50259
- setIsUploading(false);
50260
- if (_wasThrown) throw _result;
50261
- return _result;
50262
- });
50263
- if (_temp && _temp.then) return _temp.then(function () {});
50264
- }
50265
- }();
50266
- return _temp2 && _temp2.then ? _temp2.then(function () {}) : void 0;
50267
- } catch (e) {
50268
- Promise.reject(e);
50269
- }
50270
- })();
50271
- }, [file]);
50272
50485
  const errorStyle = {
50273
50486
  width: "100%",
50274
50487
  marginLeft: "0px",
50275
50488
  fontSize: "12px",
50276
- marginTop: "4px"
50489
+ marginTop: "4px",
50490
+ color: "#d32f2f"
50277
50491
  };
50278
- return /*#__PURE__*/React__default.createElement("div", {
50279
- className: "formcomposer-section-grid",
50492
+ const getFieldBorderStyle = fieldName => {
50493
+ if (errors !== null && errors !== void 0 && errors[fieldName]) return {
50494
+ border: "1px solid #d32f2f"
50495
+ };
50496
+ if (touched[fieldName] && !(errors !== null && errors !== void 0 && errors[fieldName])) return {
50497
+ border: "1px solid #28a745"
50498
+ };
50499
+ return {};
50500
+ };
50501
+ const onSubmit = data => {
50502
+ if (data.proposedNewConsumerName && data.proposedNewConsumerName.trim().length < 3) {
50503
+ setError("proposedNewConsumerName", {
50504
+ type: "manual",
50505
+ message: "Name must be at least 3 characters"
50506
+ });
50507
+ return;
50508
+ }
50509
+ if (data.proposedNewConsumerName && !/^[a-zA-Z\s.'-]+$/.test(data.proposedNewConsumerName.trim())) {
50510
+ setError("proposedNewConsumerName", {
50511
+ type: "manual",
50512
+ message: "Name should only contain alphabets, spaces, dots, hyphens"
50513
+ });
50514
+ return;
50515
+ }
50516
+ onNext(data);
50517
+ };
50518
+ const onError = () => {
50519
+ const errorCount = Object.keys(errors).length;
50520
+ setShowToast({
50521
+ key: "error",
50522
+ message: "Please fix " + errorCount + " validation error" + (errorCount > 1 ? "s" : "") + " before proceeding."
50523
+ });
50524
+ };
50525
+ const mandatoryIndicator = /*#__PURE__*/React__default.createElement("span", {
50280
50526
  style: {
50281
- gridTemplateColumns: "1fr 1fr",
50282
- gap: "20px",
50283
- display: "grid"
50527
+ color: "#d32f2f",
50528
+ marginLeft: "2px"
50529
+ }
50530
+ }, "*");
50531
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
50532
+ style: {
50533
+ marginBottom: "20px"
50284
50534
  }
50285
50535
  }, /*#__PURE__*/React__default.createElement("div", {
50286
50536
  style: {
50287
50537
  display: "flex",
50288
- flexDirection: "column",
50289
- gap: "20px"
50538
+ alignItems: "center",
50539
+ marginBottom: "16px"
50540
+ }
50541
+ }, /*#__PURE__*/React__default.createElement("span", {
50542
+ style: {
50543
+ fontSize: "24px",
50544
+ marginRight: "8px"
50545
+ }
50546
+ }, "\uD83D\uDC64"), /*#__PURE__*/React__default.createElement("h2", {
50547
+ style: {
50548
+ fontSize: "20px",
50549
+ fontWeight: "700",
50550
+ margin: 0
50290
50551
  }
50291
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50552
+ }, "2. New Consumer Details.")), Object.keys(errors).length > 0 && /*#__PURE__*/React__default.createElement("div", {
50292
50553
  style: {
50554
+ padding: "12px 16px",
50555
+ backgroundColor: "#fdecea",
50556
+ color: "#611a15",
50557
+ borderRadius: "8px",
50558
+ border: "1px solid #f5c6cb",
50559
+ marginBottom: "16px",
50293
50560
  display: "flex",
50294
- flexDirection: "column",
50295
- alignItems: "flex-start",
50296
- gap: "4px"
50561
+ alignItems: "center"
50297
50562
  }
50298
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50563
+ }, /*#__PURE__*/React__default.createElement("span", {
50299
50564
  style: {
50300
- margin: 0,
50565
+ marginRight: "8px",
50566
+ fontSize: "18px"
50567
+ }
50568
+ }, "\u26A0\uFE0F"), /*#__PURE__*/React__default.createElement("span", {
50569
+ style: {
50570
+ fontWeight: "500",
50571
+ fontSize: "14px"
50572
+ }
50573
+ }, "Please fill in all required fields marked with ", /*#__PURE__*/React__default.createElement("span", {
50574
+ style: {
50575
+ color: "#d32f2f",
50301
50576
  fontWeight: "bold"
50302
50577
  }
50303
- }, "PROPOSED NEW CONSUMER NAME*"), /*#__PURE__*/React__default.createElement("div", {
50304
- className: "field",
50578
+ }, "*"), " before proceeding.")), /*#__PURE__*/React__default.createElement("form", {
50579
+ onSubmit: handleSubmit(onSubmit, onError)
50580
+ }, /*#__PURE__*/React__default.createElement("div", {
50305
50581
  style: {
50306
- width: "100%"
50582
+ display: "grid",
50583
+ gridTemplateColumns: "1fr 1fr 1fr",
50584
+ gap: "24px",
50585
+ padding: "16px 0"
50307
50586
  }
50308
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50587
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50588
+ style: {
50589
+ fontWeight: "bold"
50590
+ }
50591
+ }, "New Consumer Full Name ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50309
50592
  control: control,
50310
50593
  name: "proposedNewConsumerName",
50311
50594
  rules: {
50312
- required: "Required field"
50595
+ required: "Consumer name is required",
50596
+ minLength: {
50597
+ value: 3,
50598
+ message: "Name must be at least 3 characters"
50599
+ },
50600
+ pattern: {
50601
+ value: /^[a-zA-Z\s.'-]+$/,
50602
+ message: "Only alphabets, spaces, dots and hyphens allowed"
50603
+ }
50313
50604
  },
50314
50605
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
50315
50606
  value: props.value,
50316
50607
  onChange: e => {
50317
50608
  props.onChange(e.target.value);
50609
+ clearErrors("proposedNewConsumerName");
50318
50610
  },
50319
- placeholder: "Enter full legal name of new owner",
50320
- onBlur: props.onBlur
50611
+ onBlur: () => {
50612
+ props.onBlur();
50613
+ setTouched(p => _extends({}, p, {
50614
+ proposedNewConsumerName: true
50615
+ }));
50616
+ trigger("proposedNewConsumerName");
50617
+ },
50618
+ placeholder: "Enter full name (e.g. Rajesh Kumar)",
50619
+ style: getFieldBorderStyle("proposedNewConsumerName")
50321
50620
  })
50322
- }))), (errors === null || errors === void 0 ? void 0 : errors.proposedNewConsumerName) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50621
+ }), (errors === null || errors === void 0 ? void 0 : errors.proposedNewConsumerName) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50323
50622
  style: errorStyle
50324
- }, errors === null || errors === void 0 ? void 0 : (_errors$proposedNewCo = errors.proposedNewConsumerName) === null || _errors$proposedNewCo === void 0 ? void 0 : _errors$proposedNewCo.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50623
+ }, errors === null || errors === void 0 ? void 0 : (_errors$proposedNewCo = errors.proposedNewConsumerName) === null || _errors$proposedNewCo === void 0 ? void 0 : _errors$proposedNewCo.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50325
50624
  style: {
50326
- display: "flex",
50327
- flexDirection: "column",
50328
- alignItems: "flex-start",
50329
- gap: "4px"
50330
- }
50331
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50332
- style: {
50333
- margin: 0,
50334
50625
  fontWeight: "bold"
50335
50626
  }
50336
- }, "NEW OWNER MOBILE NUMBER*"), /*#__PURE__*/React__default.createElement("div", {
50337
- className: "field",
50627
+ }, "Gender ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50628
+ control: control,
50629
+ name: "gender",
50630
+ rules: {
50631
+ required: "Please select gender"
50632
+ },
50633
+ render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
50634
+ selected: props.value,
50635
+ option: genderOptions,
50636
+ select: val => {
50637
+ props.onChange(val);
50638
+ setTouched(p => _extends({}, p, {
50639
+ gender: true
50640
+ }));
50641
+ },
50642
+ optionKey: "i18nKey",
50643
+ t: t,
50644
+ placeholder: "Select Gender"
50645
+ })
50646
+ }), (errors === null || errors === void 0 ? void 0 : errors.gender) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50647
+ style: errorStyle
50648
+ }, errors === null || errors === void 0 ? void 0 : (_errors$gender = errors.gender) === null || _errors$gender === void 0 ? void 0 : _errors$gender.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50338
50649
  style: {
50339
- width: "100%"
50650
+ fontWeight: "bold"
50340
50651
  }
50341
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50652
+ }, "Mobile Number ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50342
50653
  control: control,
50343
50654
  name: "newOwnerMobileNumber",
50344
50655
  rules: {
50345
- required: "Required field",
50656
+ required: "Mobile number is required",
50346
50657
  pattern: {
50347
50658
  value: /^[6-9]\d{9}$/,
50348
- message: "Invalid mobile number"
50659
+ message: "Enter a valid 10-digit mobile number starting with 6-9"
50349
50660
  }
50350
50661
  },
50351
50662
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.MobileNumber, {
50352
50663
  value: props.value || "",
50353
50664
  onChange: val => {
50354
50665
  props.onChange(val);
50666
+ clearErrors("newOwnerMobileNumber");
50355
50667
  },
50356
- placeholder: "Enter mobile number",
50357
- onBlur: props.onBlur
50668
+ onBlur: () => {
50669
+ setTouched(p => _extends({}, p, {
50670
+ newOwnerMobileNumber: true
50671
+ }));
50672
+ trigger("newOwnerMobileNumber");
50673
+ },
50674
+ placeholder: "Enter 10-digit mobile number",
50675
+ maxLength: 10
50358
50676
  })
50359
- }))), (errors === null || errors === void 0 ? void 0 : errors.newOwnerMobileNumber) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50677
+ }), (errors === null || errors === void 0 ? void 0 : errors.newOwnerMobileNumber) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50360
50678
  style: errorStyle
50361
- }, errors === null || errors === void 0 ? void 0 : (_errors$newOwnerMobil = errors.newOwnerMobileNumber) === null || _errors$newOwnerMobil === void 0 ? void 0 : _errors$newOwnerMobil.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50362
- style: {
50363
- display: "flex",
50364
- flexDirection: "column",
50365
- alignItems: "flex-start",
50366
- gap: "4px"
50367
- }
50368
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50679
+ }, errors === null || errors === void 0 ? void 0 : (_errors$newOwnerMobil = errors.newOwnerMobileNumber) === null || _errors$newOwnerMobil === void 0 ? void 0 : _errors$newOwnerMobil.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50369
50680
  style: {
50370
- margin: 0,
50371
50681
  fontWeight: "bold"
50372
50682
  }
50373
- }, "NEW OWNER EMAIL ADDRESS"), /*#__PURE__*/React__default.createElement("div", {
50374
- className: "field",
50683
+ }, "Email ID ", /*#__PURE__*/React__default.createElement("span", {
50375
50684
  style: {
50376
- width: "100%"
50685
+ color: "#999",
50686
+ fontSize: "12px"
50377
50687
  }
50378
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50688
+ }, "(Optional)")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50379
50689
  control: control,
50380
50690
  name: "newOwnerEmailAddress",
50381
50691
  rules: {
50382
50692
  pattern: {
50383
50693
  value: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
50384
- message: "Invalid email address"
50694
+ message: "Please enter a valid email address"
50385
50695
  }
50386
50696
  },
50387
50697
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
50388
50698
  value: props.value,
50389
50699
  onChange: e => {
50390
50700
  props.onChange(e.target.value);
50701
+ clearErrors("newOwnerEmailAddress");
50391
50702
  },
50392
- placeholder: "Enter email address",
50393
- onBlur: props.onBlur
50703
+ onBlur: () => {
50704
+ props.onBlur();
50705
+ setTouched(p => _extends({}, p, {
50706
+ newOwnerEmailAddress: true
50707
+ }));
50708
+ trigger("newOwnerEmailAddress");
50709
+ },
50710
+ placeholder: "example@email.com",
50711
+ style: getFieldBorderStyle("newOwnerEmailAddress")
50394
50712
  })
50395
- }))), (errors === null || errors === void 0 ? void 0 : errors.newOwnerEmailAddress) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50713
+ }), (errors === null || errors === void 0 ? void 0 : errors.newOwnerEmailAddress) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50396
50714
  style: errorStyle
50397
- }, errors === null || errors === void 0 ? void 0 : (_errors$newOwnerEmail = errors.newOwnerEmailAddress) === null || _errors$newOwnerEmail === void 0 ? void 0 : _errors$newOwnerEmail.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50398
- style: {
50399
- display: "flex",
50400
- flexDirection: "column",
50401
- alignItems: "flex-start",
50402
- gap: "4px"
50403
- }
50404
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50715
+ }, errors === null || errors === void 0 ? void 0 : (_errors$newOwnerEmail = errors.newOwnerEmailAddress) === null || _errors$newOwnerEmail === void 0 ? void 0 : _errors$newOwnerEmail.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50405
50716
  style: {
50406
- margin: 0,
50407
50717
  fontWeight: "bold"
50408
50718
  }
50409
- }, "RELATIONSHIP WITH EXISTING CONSUMER*"), /*#__PURE__*/React__default.createElement("div", {
50410
- className: "field",
50411
- style: {
50412
- width: "100%"
50413
- }
50414
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50719
+ }, "Reason for Name Change / Mutation ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50415
50720
  control: control,
50416
- name: "relationshipWithExistingConsumer",
50721
+ name: "reasonForNameChange",
50417
50722
  rules: {
50418
- required: "Required field"
50723
+ required: "Please select a reason for mutation"
50419
50724
  },
50420
50725
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
50421
50726
  selected: props.value,
50422
- option: relationshipOptions,
50423
- select: e => {
50424
- props.onChange(e);
50727
+ option: reasonOptions,
50728
+ select: val => {
50729
+ props.onChange(val);
50730
+ setTouched(p => _extends({}, p, {
50731
+ reasonForNameChange: true
50732
+ }));
50425
50733
  },
50426
50734
  optionKey: "i18nKey",
50427
50735
  t: t,
50428
- placeholder: "Select relationship"
50736
+ placeholder: "Select reason"
50429
50737
  })
50430
- }))), (errors === null || errors === void 0 ? void 0 : errors.relationshipWithExistingConsumer) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50738
+ }), (errors === null || errors === void 0 ? void 0 : errors.reasonForNameChange) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50431
50739
  style: errorStyle
50432
- }, errors === null || errors === void 0 ? void 0 : (_errors$relationshipW = errors.relationshipWithExistingConsumer) === null || _errors$relationshipW === void 0 ? void 0 : _errors$relationshipW.message))), /*#__PURE__*/React__default.createElement("div", {
50433
- style: {
50434
- display: "flex",
50435
- flexDirection: "column",
50436
- gap: "20px"
50437
- }
50438
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50740
+ }, errors === null || errors === void 0 ? void 0 : (_errors$reasonForName = errors.reasonForNameChange) === null || _errors$reasonForName === void 0 ? void 0 : _errors$reasonForName.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50439
50741
  style: {
50440
- display: "flex",
50441
- flexDirection: "column",
50442
- alignItems: "flex-start",
50443
- gap: "4px"
50444
- }
50445
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50446
- style: {
50447
- margin: 0,
50448
- fontWeight: "bold"
50449
- }
50450
- }, "REASON FOR NAME CHANGE*"), /*#__PURE__*/React__default.createElement("div", {
50451
- className: "field",
50452
- style: {
50453
- width: "100%"
50742
+ fontWeight: "bold",
50743
+ color: isOtherReason ? "inherit" : "#999"
50454
50744
  }
50455
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50745
+ }, "Relationship with Existing Consumer ", isOtherReason && mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50456
50746
  control: control,
50457
- name: "reasonForNameChange",
50747
+ name: "relationshipWithExistingConsumer",
50458
50748
  rules: {
50459
- required: "Required field"
50749
+ required: isOtherReason ? "Relationship is required when 'Other Reason' is selected" : false
50460
50750
  },
50461
50751
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
50462
50752
  selected: props.value,
50463
- option: reasonOptions,
50464
- select: e => {
50465
- props.onChange(e);
50753
+ option: relationshipOptions,
50754
+ select: val => {
50755
+ props.onChange(val);
50756
+ setTouched(p => _extends({}, p, {
50757
+ relationshipWithExistingConsumer: true
50758
+ }));
50466
50759
  },
50467
50760
  optionKey: "i18nKey",
50468
50761
  t: t,
50469
- placeholder: "Select reason"
50762
+ placeholder: "Select relationship",
50763
+ disable: !isOtherReason
50470
50764
  })
50471
- }))), (errors === null || errors === void 0 ? void 0 : errors.reasonForNameChange) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50472
- style: errorStyle
50473
- }, errors === null || errors === void 0 ? void 0 : (_errors$reasonForName = errors.reasonForNameChange) === null || _errors$reasonForName === void 0 ? void 0 : _errors$reasonForName.message)), /*#__PURE__*/React__default.createElement("div", {
50765
+ }), !isOtherReason && /*#__PURE__*/React__default.createElement("span", {
50474
50766
  style: {
50475
- marginTop: "10px",
50476
- padding: "20px",
50477
- border: "1px dashed #ccc",
50478
- borderRadius: "8px",
50479
- backgroundColor: "#fafafa"
50767
+ fontSize: "11px",
50768
+ color: "#999",
50769
+ marginTop: "4px",
50770
+ display: "block"
50480
50771
  }
50481
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50772
+ }, "Enabled only when \"Other Reason\" is selected above"), (errors === null || errors === void 0 ? void 0 : errors.relationshipWithExistingConsumer) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50773
+ style: errorStyle
50774
+ }, errors === null || errors === void 0 ? void 0 : (_errors$relationshipW = errors.relationshipWithExistingConsumer) === null || _errors$relationshipW === void 0 ? void 0 : _errors$relationshipW.message))), /*#__PURE__*/React__default.createElement("div", {
50482
50775
  style: {
50483
50776
  display: "flex",
50484
- flexDirection: "column",
50485
- alignItems: "flex-start",
50486
- gap: "4px"
50777
+ justifyContent: "space-between",
50778
+ alignItems: "center",
50779
+ marginTop: "24px"
50487
50780
  }
50488
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50781
+ }, /*#__PURE__*/React__default.createElement("button", {
50782
+ type: "button",
50783
+ onClick: onBack,
50489
50784
  style: {
50490
- margin: 0,
50785
+ padding: "8px 24px",
50786
+ backgroundColor: "#e0e0e0",
50787
+ border: "none",
50788
+ borderRadius: "4px",
50789
+ cursor: "pointer",
50491
50790
  fontWeight: "bold"
50492
50791
  }
50493
- }, "UPLOAD REGISTERED SALE DEED*"), /*#__PURE__*/React__default.createElement("p", {
50792
+ }, "\u2190 Back"), /*#__PURE__*/React__default.createElement("div", {
50494
50793
  style: {
50495
- color: "#666",
50496
- fontSize: "12px",
50497
- marginBottom: "15px",
50498
- marginTop: "5px"
50794
+ display: "flex",
50795
+ alignItems: "center",
50796
+ gap: "12px"
50499
50797
  }
50500
- }, "Submit a clear scan of the stamp duty Registered Sale Deed."), /*#__PURE__*/React__default.createElement("div", {
50501
- className: "field",
50798
+ }, /*#__PURE__*/React__default.createElement("span", {
50502
50799
  style: {
50503
- width: "100%"
50800
+ fontSize: "12px",
50801
+ color: "#999"
50504
50802
  }
50505
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
50506
- id: "sale-deed-upload",
50507
- onUpload: e => {
50508
- setFile(e.target.files[0]);
50509
- },
50510
- onDelete: () => {
50511
- setUploadedFile(null);
50512
- setFile(null);
50513
- },
50514
- message: uploadedFile ? "1 File Uploaded" : "Click to upload document",
50515
- accept: "image/*, .pdf, .png, .jpeg, .jpg",
50516
- uploadedFiles: uploadedFile && !file ? [["Document", {
50517
- fileStoreId: uploadedFile
50518
- }]] : undefined,
50519
- removeTargetedFile: () => {
50520
- setUploadedFile(null);
50521
- setFile(null);
50803
+ }, "Fields marked with ", /*#__PURE__*/React__default.createElement("span", {
50804
+ style: {
50805
+ color: "#d32f2f"
50522
50806
  }
50523
- }))), isUploading && /*#__PURE__*/React__default.createElement("span", {
50807
+ }, "*"), " are mandatory"), /*#__PURE__*/React__default.createElement("button", {
50808
+ type: "submit",
50524
50809
  style: {
50525
- color: "#00497e",
50526
- fontWeight: "bold",
50527
- fontSize: "12px"
50810
+ padding: "10px 24px",
50811
+ backgroundColor: "#00497e",
50812
+ color: "white",
50813
+ border: "none",
50814
+ borderRadius: "4px",
50815
+ cursor: "pointer",
50816
+ fontWeight: "bold"
50528
50817
  }
50529
- }, "Uploading..."))));
50818
+ }, "Save & Proceed to Documents \u2192")))), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
50819
+ error: showToast.key === "error",
50820
+ warning: showToast.key === "warning",
50821
+ label: t(showToast.message),
50822
+ onClose: () => setShowToast(null),
50823
+ isDleteBtn: true
50824
+ }));
50530
50825
  };
50531
50826
 
50532
- const MutationApplication = () => {
50533
- var _state, _details, _details2, _details2$application, _applicationDetails$a, _applicationDetails$a2, _applicationDetails$a3, _applicationDetails$a4, _applicationDetails$a5, _applicationDetails$a6, _applicationDetails$a7;
50534
- const _useTranslation = reactI18next.useTranslation(),
50535
- t = _useTranslation.t;
50536
- let _useLocation = reactRouterDom.useLocation(),
50537
- state = _useLocation.state;
50538
- state = state ? typeof state === "string" ? JSON.parse(state) : state : {};
50539
- const history = reactRouterDom.useHistory();
50540
- let filters = getQueryStringParams(location.search);
50541
- const _useState = React.useState(false),
50542
- canSubmit = _useState[0],
50543
- setSubmitValve = _useState[1];
50544
- const _useState2 = React.useState(null),
50545
- showToast = _useState2[0],
50546
- setShowToast = _useState2[1];
50547
- const _useState3 = React.useState({}),
50548
- appData = _useState3[0],
50549
- setAppData = _useState3[1];
50550
- const _useState4 = React.useState({
50551
- head: "",
50552
- body: []
50827
+ const Step3_UploadDocuments = _ref => {
50828
+ var _defaultValues$reason;
50829
+ let t = _ref.t,
50830
+ onNext = _ref.onNext,
50831
+ onBack = _ref.onBack,
50832
+ defaultValues = _ref.defaultValues;
50833
+ const _useState = React.useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.identityProofType) || null),
50834
+ identityProofType = _useState[0],
50835
+ setIdentityProofType = _useState[1];
50836
+ const _useState2 = React.useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.documentNumber) || ""),
50837
+ documentNumber = _useState2[0],
50838
+ setDocumentNumber = _useState2[1];
50839
+ const _useState3 = React.useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.identityProofDocumentId) || null),
50840
+ identityProofFile = _useState3[0],
50841
+ setIdentityProofFile = _useState3[1];
50842
+ const _useState4 = React.useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.saleDeedDocumentId) || null),
50843
+ mutationDocFile = _useState4[0],
50844
+ setMutationDocFile = _useState4[1];
50845
+ const _useState5 = React.useState({
50846
+ identity: null,
50847
+ mutation: null
50553
50848
  }),
50554
- config = _useState4[0],
50555
- setConfig = _useState4[1];
50556
- const _useState5 = React.useState(true),
50557
- enabledLoader = _useState5[0],
50558
- setEnabledLoader = _useState5[1];
50849
+ rawFiles = _useState5[0],
50850
+ setRawFiles = _useState5[1];
50559
50851
  const _useState6 = React.useState(false),
50560
- isAppDetailsPage = _useState6[0];
50561
- const _useState7 = React.useState(false),
50562
- isEnableLoader = _useState7[0],
50563
- setIsEnableLoader = _useState7[1];
50564
- let tenantId = Digit.ULBService.getCurrentTenantId();
50565
- const applicationNumber = filters === null || filters === void 0 ? void 0 : filters.applicationNumber;
50566
- const serviceType = filters === null || filters === void 0 ? void 0 : filters.service;
50567
- const stateId = Digit.ULBService.getStateId();
50568
- let _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(stateId, {}),
50569
- newConfig = _Digit$Hooks$ws$useWS.data,
50570
- isConfigLoading = _Digit$Hooks$ws$useWS.isLoading;
50571
- let details = cloneDeep_1((_state = state) === null || _state === void 0 ? void 0 : _state.data);
50572
- let _Digit$Hooks$ws$useWS2 = Digit.Hooks.ws.useWSDetailsPage(t, tenantId, ((_details = details) === null || _details === void 0 ? void 0 : _details.applicationNo) || applicationNumber, (serviceType === null || serviceType === void 0 ? void 0 : serviceType.toUpperCase()) || ((_details2 = details) === null || _details2 === void 0 ? void 0 : (_details2$application = _details2.applicationData) === null || _details2$application === void 0 ? void 0 : _details2$application.serviceType)),
50573
- applicationDetails = _Digit$Hooks$ws$useWS2.data;
50574
- details = applicationDetails;
50575
- const _useState8 = React.useState(new URLSearchParams(reactRouterDom.useLocation().search).get("propertyId")),
50576
- propertyId = _useState8[0],
50577
- setPropertyId = _useState8[1];
50578
- const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM", {}),
50579
- sessionFormData = _Digit$Hooks$useSessi[0],
50580
- setSessionFormData = _Digit$Hooks$useSessi[1],
50581
- clearSessionFormData = _Digit$Hooks$useSessi[2];
50582
- const _Digit$Hooks$pt$usePr = Digit.Hooks.pt.usePropertySearch({
50583
- filters: {
50584
- propertyIds: propertyId
50585
- },
50586
- tenantId: tenantId
50587
- }, {
50588
- filters: {
50589
- propertyIds: propertyId
50590
- },
50591
- tenantId: tenantId,
50592
- enabled: propertyId && propertyId != "" ? true : false
50593
- }),
50594
- propertyDetails = _Digit$Hooks$pt$usePr.data;
50595
- React.useEffect(() => {
50596
- if (!isConfigLoading && newConfig && Array.isArray(newConfig)) {
50597
- const config = cloneDeep_1(newConfig.find(conf => conf.hideInCitizen && conf.isModify));
50598
- if (config) {
50599
- var _config$body;
50600
- config.head = "WS_WATER_AND_SEWERAGE_MUTATION_CONNECTION_LABEL";
50601
- let bodyDetails = [];
50602
- config === null || config === void 0 ? void 0 : (_config$body = config.body) === null || _config$body === void 0 ? void 0 : _config$body.forEach(data => {
50603
- if (data !== null && data !== void 0 && data.isModifyConnection) bodyDetails.push(data);
50604
- });
50605
- bodyDetails.forEach(bdyData => {
50606
- if ((bdyData === null || bdyData === void 0 ? void 0 : bdyData.head) === "WS_COMMON_PROPERTY_DETAILS") {
50607
- bdyData.head = "";
50608
- bdyData.className = "mutation-disabled-section";
50609
- } else if ((bdyData === null || bdyData === void 0 ? void 0 : bdyData.head) === "WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER") {
50610
- bdyData.head = "Specify ownership updates and transfer reason:";
50611
- bdyData.body = [{
50612
- type: "component",
50613
- key: "MutationApplicantDetails",
50614
- component: WSMutationApplicantDetails,
50615
- withoutLabel: true
50616
- }];
50617
- } else {
50618
- bdyData.head = "";
50619
- bdyData.className = "mutation-hidden-section";
50620
- }
50621
- });
50622
- config.body = bodyDetails;
50623
- setConfig(config);
50624
- }
50625
- }
50626
- }, [newConfig]);
50627
- React.useEffect(() => {
50628
- var _sessionFormData$cpt, _sessionFormData$cpt$, _sessionFormData$cpt2, _sessionFormData$cpt3;
50629
- !propertyId && (sessionFormData === null || sessionFormData === void 0 ? void 0 : (_sessionFormData$cpt = sessionFormData.cpt) === null || _sessionFormData$cpt === void 0 ? void 0 : (_sessionFormData$cpt$ = _sessionFormData$cpt.details) === null || _sessionFormData$cpt$ === void 0 ? void 0 : _sessionFormData$cpt$.propertyId) && setPropertyId(sessionFormData === null || sessionFormData === void 0 ? void 0 : (_sessionFormData$cpt2 = sessionFormData.cpt) === null || _sessionFormData$cpt2 === void 0 ? void 0 : (_sessionFormData$cpt3 = _sessionFormData$cpt2.details) === null || _sessionFormData$cpt3 === void 0 ? void 0 : _sessionFormData$cpt3.propertyId);
50630
- }, [sessionFormData === null || sessionFormData === void 0 ? void 0 : sessionFormData.cpt]);
50631
- React.useEffect(function () {
50852
+ isUploading = _useState6[0],
50853
+ setIsUploading = _useState6[1];
50854
+ const _useState7 = React.useState(null),
50855
+ showToast = _useState7[0],
50856
+ setShowToast = _useState7[1];
50857
+ const _useState8 = React.useState({}),
50858
+ fieldErrors = _useState8[0],
50859
+ setFieldErrors = _useState8[1];
50860
+ const _useState9 = React.useState(false),
50861
+ hasAttemptedSubmit = _useState9[0],
50862
+ setHasAttemptedSubmit = _useState9[1];
50863
+ const identityOptions = [{
50864
+ code: "AADHAAR",
50865
+ i18nKey: "Aadhaar Card"
50866
+ }, {
50867
+ code: "VOTER_ID",
50868
+ i18nKey: "Voter ID"
50869
+ }, {
50870
+ code: "PAN",
50871
+ i18nKey: "PAN Card"
50872
+ }, {
50873
+ code: "OTHER",
50874
+ i18nKey: "Any other document configured by DJB"
50875
+ }];
50876
+ const getReasonDocLabel = reasonCode => {
50877
+ switch (reasonCode) {
50878
+ case "SALE_PURCHASE":
50879
+ return "Upload Purchase of Property";
50880
+ case "DEVOLUTION_INHERITANCE":
50881
+ return "Upload Devolution/ Inheritance";
50882
+ case "OTHER":
50883
+ return "Upload Other (Gift Deed, Will registration, etc.)";
50884
+ default:
50885
+ return "Upload Supporting Document";
50886
+ }
50887
+ };
50888
+ const reasonCode = (defaultValues === null || defaultValues === void 0 ? void 0 : (_defaultValues$reason = defaultValues.reasonForNameChange) === null || _defaultValues$reason === void 0 ? void 0 : _defaultValues$reason.code) || (defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.reasonForNameChange);
50889
+ const reasonDocLabel = getReasonDocLabel(reasonCode);
50890
+ const validateDocumentNumber = (value, docType) => {
50891
+ if (!value || !value.trim()) return "Document number is required";
50892
+ const trimmed = value.trim();
50893
+ if ((docType === null || docType === void 0 ? void 0 : docType.code) === "AADHAAR") {
50894
+ if (!/^\d{12}$/.test(trimmed)) return "Aadhaar number must be exactly 12 digits";
50895
+ } else if ((docType === null || docType === void 0 ? void 0 : docType.code) === "PAN") {
50896
+ if (!/^[A-Z]{5}[0-9]{4}[A-Z]{1}$/.test(trimmed.toUpperCase())) return "PAN must be in format ABCDE1234F";
50897
+ } else if ((docType === null || docType === void 0 ? void 0 : docType.code) === "VOTER_ID") {
50898
+ if (!/^[A-Z]{3}\d{7}$/.test(trimmed.toUpperCase())) return "Voter ID must be in format ABC1234567";
50899
+ } else {
50900
+ if (trimmed.length < 3) return "Document number must be at least 3 characters";
50901
+ }
50902
+ return null;
50903
+ };
50904
+ const validateFileSize = file => {
50905
+ const maxSizeMB = 5;
50906
+ if (file.size > maxSizeMB * 1024 * 1024) {
50907
+ return "File size exceeds " + maxSizeMB + "MB limit. Please choose a smaller file.";
50908
+ }
50909
+ return null;
50910
+ };
50911
+ const validateFileType = file => {
50912
+ const allowedTypes = ["image/jpeg", "image/jpg", "image/png", "application/pdf"];
50913
+ if (!allowedTypes.includes(file.type)) {
50914
+ return "Only PDF, PNG, JPEG files are allowed.";
50915
+ }
50916
+ return null;
50917
+ };
50918
+ const handleFileUpload = function (file, type) {
50632
50919
  try {
50633
- const IsDetailsExists = sessionStorage.getItem("IsDetailsExists") ? JSON.parse(sessionStorage.getItem("IsDetailsExists")) : false;
50634
- const _temp = function (_details3, _details3$application) {
50635
- if ((_details3 = details) !== null && _details3 !== void 0 && (_details3$application = _details3.applicationData) !== null && _details3$application !== void 0 && _details3$application.id) {
50636
- var _details4, _details4$application;
50637
- return Promise.resolve(convertApplicationData(details, (serviceType === null || serviceType === void 0 ? void 0 : serviceType.toUpperCase()) || ((_details4 = details) === null || _details4 === void 0 ? void 0 : (_details4$application = _details4.applicationData) === null || _details4$application === void 0 ? void 0 : _details4$application.serviceType), true, undefined, t)).then(function (convertAppData) {
50638
- setSessionFormData(prev => _extends({}, prev, convertAppData));
50639
- setAppData(prev => _extends({}, prev, convertAppData));
50640
- sessionStorage.setItem("IsDetailsExists", JSON.stringify(true));
50920
+ const sizeError = validateFileSize(file);
50921
+ if (sizeError) {
50922
+ setShowToast({
50923
+ key: "error",
50924
+ message: sizeError
50925
+ });
50926
+ return Promise.resolve();
50927
+ }
50928
+ const typeError = validateFileType(file);
50929
+ if (typeError) {
50930
+ setShowToast({
50931
+ key: "error",
50932
+ message: typeError
50933
+ });
50934
+ return Promise.resolve();
50935
+ }
50936
+ const _temp = _finallyRethrows(function () {
50937
+ return _catch(function () {
50938
+ setIsUploading(true);
50939
+ return Promise.resolve(window.Digit.UploadServices.Filestorage("WS", file, window.Digit.ULBService.getStateId())).then(function (response) {
50940
+ var _response$data, _response$data$files;
50941
+ if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
50942
+ const fileStoreId = response.data.files[0].fileStoreId;
50943
+ if (type === "identity") {
50944
+ setIdentityProofFile(fileStoreId);
50945
+ setFieldErrors(prev => _extends({}, prev, {
50946
+ identityFile: null
50947
+ }));
50948
+ }
50949
+ if (type === "mutation") {
50950
+ setMutationDocFile(fileStoreId);
50951
+ setFieldErrors(prev => _extends({}, prev, {
50952
+ mutationFile: null
50953
+ }));
50954
+ }
50955
+ setShowToast({
50956
+ key: "success",
50957
+ message: "Document uploaded successfully!"
50958
+ });
50959
+ }
50641
50960
  });
50642
- }
50643
- }();
50961
+ }, function (err) {
50962
+ console.error("File upload error", err);
50963
+ setShowToast({
50964
+ key: "error",
50965
+ message: "File upload failed. Please try again."
50966
+ });
50967
+ });
50968
+ }, function (_wasThrown, _result) {
50969
+ setIsUploading(false);
50970
+ if (_wasThrown) throw _result;
50971
+ return _result;
50972
+ });
50644
50973
  return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
50645
50974
  } catch (e) {
50646
50975
  return Promise.reject(e);
50647
50976
  }
50648
- }, [details, applicationDetails]);
50977
+ };
50978
+ React.useEffect(() => {
50979
+ if (rawFiles.identity) handleFileUpload(rawFiles.identity, "identity");
50980
+ }, [rawFiles.identity]);
50981
+ React.useEffect(() => {
50982
+ if (rawFiles.mutation) handleFileUpload(rawFiles.mutation, "mutation");
50983
+ }, [rawFiles.mutation]);
50984
+ React.useEffect(() => {
50985
+ if (hasAttemptedSubmit) {
50986
+ const newErrors = {};
50987
+ if (!identityProofType) newErrors.identityType = "Please select a document type";
50988
+ if (!identityProofFile) newErrors.identityFile = "Please upload your identity proof document";
50989
+ if (!mutationDocFile) newErrors.mutationFile = "Please upload the reason-based supporting document";
50990
+ const docError = validateDocumentNumber(documentNumber, identityProofType);
50991
+ if (docError) newErrors.documentNumber = docError;
50992
+ setFieldErrors(newErrors);
50993
+ }
50994
+ }, [identityProofType, documentNumber, identityProofFile, mutationDocFile, hasAttemptedSubmit]);
50995
+ const onProceed = () => {
50996
+ setHasAttemptedSubmit(true);
50997
+ const newErrors = {};
50998
+ if (!identityProofType) newErrors.identityType = "Please select a document type";
50999
+ const docError = validateDocumentNumber(documentNumber, identityProofType);
51000
+ if (docError) newErrors.documentNumber = docError;
51001
+ if (!identityProofFile) newErrors.identityFile = "Please upload your identity proof document";
51002
+ if (!mutationDocFile) newErrors.mutationFile = "Please upload the reason-based supporting document";
51003
+ setFieldErrors(newErrors);
51004
+ if (Object.keys(newErrors).length > 0) {
51005
+ const errorCount = Object.keys(newErrors).length;
51006
+ setShowToast({
51007
+ key: "warning",
51008
+ message: "Please fix " + errorCount + " issue" + (errorCount > 1 ? "s" : "") + " before proceeding."
51009
+ });
51010
+ return;
51011
+ }
51012
+ onNext({
51013
+ identityProofType,
51014
+ documentNumber: documentNumber.trim(),
51015
+ identityProofDocumentId: identityProofFile,
51016
+ saleDeedDocumentId: mutationDocFile
51017
+ });
51018
+ };
51019
+ const uploadBoxStyle = (hasError, hasFile) => ({
51020
+ border: hasError ? "2px dashed #d32f2f" : hasFile ? "2px dashed #28a745" : "1px dashed #ccc",
51021
+ padding: "20px",
51022
+ borderRadius: "8px",
51023
+ backgroundColor: hasError ? "#fef2f2" : hasFile ? "#f0fff4" : "#f4f9fc",
51024
+ textAlign: "center",
51025
+ marginTop: "8px",
51026
+ transition: "all 0.2s ease"
51027
+ });
51028
+ const errorTextStyle = {
51029
+ fontSize: "12px",
51030
+ color: "#d32f2f",
51031
+ marginTop: "4px"
51032
+ };
51033
+ const successTextStyle = {
51034
+ fontSize: "12px",
51035
+ color: "#28a745",
51036
+ marginTop: "4px",
51037
+ fontWeight: "500"
51038
+ };
51039
+ const mandatoryIndicator = /*#__PURE__*/React__default.createElement("span", {
51040
+ style: {
51041
+ color: "#d32f2f",
51042
+ marginLeft: "2px"
51043
+ }
51044
+ }, "*");
51045
+ const errorCount = Object.keys(fieldErrors).length;
51046
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
51047
+ style: {
51048
+ marginBottom: "20px"
51049
+ }
51050
+ }, /*#__PURE__*/React__default.createElement("div", {
51051
+ style: {
51052
+ display: "flex",
51053
+ alignItems: "center",
51054
+ marginBottom: "8px"
51055
+ }
51056
+ }, /*#__PURE__*/React__default.createElement("span", {
51057
+ style: {
51058
+ fontSize: "24px",
51059
+ marginRight: "8px"
51060
+ }
51061
+ }, "\uD83D\uDCC4"), /*#__PURE__*/React__default.createElement("h2", {
51062
+ style: {
51063
+ fontSize: "20px",
51064
+ fontWeight: "700",
51065
+ margin: 0
51066
+ }
51067
+ }, "3. Upload Verification Documents")), /*#__PURE__*/React__default.createElement("p", {
51068
+ style: {
51069
+ color: "#666",
51070
+ marginBottom: "20px"
51071
+ }
51072
+ }, "Please upload legible scanned copies or photos (PDF, PNG, JPEG - Max 5MB)."), hasAttemptedSubmit && errorCount > 0 && /*#__PURE__*/React__default.createElement("div", {
51073
+ style: {
51074
+ padding: "12px 16px",
51075
+ backgroundColor: "#fdecea",
51076
+ color: "#611a15",
51077
+ borderRadius: "8px",
51078
+ border: "1px solid #f5c6cb",
51079
+ marginBottom: "16px",
51080
+ display: "flex",
51081
+ alignItems: "center"
51082
+ }
51083
+ }, /*#__PURE__*/React__default.createElement("span", {
51084
+ style: {
51085
+ marginRight: "8px",
51086
+ fontSize: "18px"
51087
+ }
51088
+ }, "\u26A0\uFE0F"), /*#__PURE__*/React__default.createElement("span", {
51089
+ style: {
51090
+ fontWeight: "500",
51091
+ fontSize: "14px"
51092
+ }
51093
+ }, errorCount, " required item", errorCount > 1 ? "s" : "", " still need", errorCount === 1 ? "s" : "", " your attention before proceeding.")), /*#__PURE__*/React__default.createElement("div", {
51094
+ style: {
51095
+ display: "grid",
51096
+ gridTemplateColumns: "1fr 1fr",
51097
+ gap: "24px"
51098
+ }
51099
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
51100
+ style: {
51101
+ fontWeight: "bold"
51102
+ }
51103
+ }, "1. Address / Identity Proof ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
51104
+ selected: identityProofType,
51105
+ option: identityOptions,
51106
+ select: val => {
51107
+ setIdentityProofType(val);
51108
+ setFieldErrors(prev => _extends({}, prev, {
51109
+ identityType: null
51110
+ }));
51111
+ },
51112
+ optionKey: "i18nKey",
51113
+ t: t,
51114
+ placeholder: "Select Document Type",
51115
+ style: {
51116
+ marginBottom: "12px"
51117
+ }
51118
+ }), fieldErrors.identityType && /*#__PURE__*/React__default.createElement("div", {
51119
+ style: errorTextStyle
51120
+ }, fieldErrors.identityType), /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
51121
+ style: {
51122
+ fontWeight: "bold",
51123
+ marginTop: "8px"
51124
+ }
51125
+ }, "Document Number ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
51126
+ value: documentNumber,
51127
+ onChange: e => {
51128
+ setDocumentNumber(e.target.value);
51129
+ setFieldErrors(prev => _extends({}, prev, {
51130
+ documentNumber: null
51131
+ }));
51132
+ },
51133
+ onBlur: () => {
51134
+ if (hasAttemptedSubmit) {
51135
+ const err = validateDocumentNumber(documentNumber, identityProofType);
51136
+ if (err) setFieldErrors(prev => _extends({}, prev, {
51137
+ documentNumber: err
51138
+ }));
51139
+ }
51140
+ },
51141
+ placeholder: (identityProofType === null || identityProofType === void 0 ? void 0 : identityProofType.code) === "AADHAAR" ? "Enter 12-digit Aadhaar number" : (identityProofType === null || identityProofType === void 0 ? void 0 : identityProofType.code) === "PAN" ? "Enter PAN (e.g. ABCDE1234F)" : "Enter Document Number",
51142
+ style: _extends({
51143
+ marginBottom: "4px"
51144
+ }, fieldErrors.documentNumber ? {
51145
+ border: "1px solid #d32f2f"
51146
+ } : {})
51147
+ }), fieldErrors.documentNumber && /*#__PURE__*/React__default.createElement("div", {
51148
+ style: errorTextStyle
51149
+ }, fieldErrors.documentNumber), (identityProofType === null || identityProofType === void 0 ? void 0 : identityProofType.code) === "AADHAAR" && !fieldErrors.documentNumber && /*#__PURE__*/React__default.createElement("span", {
51150
+ style: {
51151
+ fontSize: "11px",
51152
+ color: "#999"
51153
+ }
51154
+ }, "Format: 12-digit numeric (e.g. 123456789012)"), (identityProofType === null || identityProofType === void 0 ? void 0 : identityProofType.code) === "PAN" && !fieldErrors.documentNumber && /*#__PURE__*/React__default.createElement("span", {
51155
+ style: {
51156
+ fontSize: "11px",
51157
+ color: "#999"
51158
+ }
51159
+ }, "Format: ABCDE1234F"), /*#__PURE__*/React__default.createElement("div", {
51160
+ style: uploadBoxStyle(!!fieldErrors.identityFile, !!identityProofFile)
51161
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
51162
+ id: "identity-upload",
51163
+ onUpload: e => setRawFiles(prev => _extends({}, prev, {
51164
+ identity: e.target.files[0]
51165
+ })),
51166
+ onDelete: () => {
51167
+ setIdentityProofFile(null);
51168
+ setRawFiles(prev => _extends({}, prev, {
51169
+ identity: null
51170
+ }));
51171
+ },
51172
+ message: identityProofFile ? "Uploaded" : "Click to Choose File",
51173
+ accept: "image/*, .pdf, .png, .jpeg, .jpg",
51174
+ uploadedFiles: identityProofFile && !rawFiles.identity ? [["Document", {
51175
+ fileStoreId: identityProofFile
51176
+ }]] : undefined,
51177
+ removeTargetedFile: () => {
51178
+ setIdentityProofFile(null);
51179
+ setRawFiles(prev => _extends({}, prev, {
51180
+ identity: null
51181
+ }));
51182
+ }
51183
+ })), fieldErrors.identityFile && /*#__PURE__*/React__default.createElement("div", {
51184
+ style: errorTextStyle
51185
+ }, fieldErrors.identityFile), identityProofFile && /*#__PURE__*/React__default.createElement("div", {
51186
+ style: successTextStyle
51187
+ }, "\u2713 Document uploaded successfully")), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
51188
+ style: {
51189
+ fontWeight: "bold"
51190
+ }
51191
+ }, "2. Reason-Based Supporting Document ", mandatoryIndicator), /*#__PURE__*/React__default.createElement("div", {
51192
+ style: {
51193
+ padding: "10px",
51194
+ backgroundColor: "#e9ecef",
51195
+ borderRadius: "4px",
51196
+ marginBottom: "12px",
51197
+ color: "#495057",
51198
+ fontSize: "14px",
51199
+ minHeight: "42px",
51200
+ display: "flex",
51201
+ alignItems: "center"
51202
+ }
51203
+ }, reasonDocLabel), /*#__PURE__*/React__default.createElement("div", {
51204
+ style: uploadBoxStyle(!!fieldErrors.mutationFile, !!mutationDocFile)
51205
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
51206
+ id: "mutation-upload",
51207
+ onUpload: e => setRawFiles(prev => _extends({}, prev, {
51208
+ mutation: e.target.files[0]
51209
+ })),
51210
+ onDelete: () => {
51211
+ setMutationDocFile(null);
51212
+ setRawFiles(prev => _extends({}, prev, {
51213
+ mutation: null
51214
+ }));
51215
+ },
51216
+ message: mutationDocFile ? "Uploaded" : "Click to Upload",
51217
+ accept: "image/*, .pdf, .png, .jpeg, .jpg",
51218
+ uploadedFiles: mutationDocFile && !rawFiles.mutation ? [["Document", {
51219
+ fileStoreId: mutationDocFile
51220
+ }]] : undefined,
51221
+ removeTargetedFile: () => {
51222
+ setMutationDocFile(null);
51223
+ setRawFiles(prev => _extends({}, prev, {
51224
+ mutation: null
51225
+ }));
51226
+ }
51227
+ })), fieldErrors.mutationFile && /*#__PURE__*/React__default.createElement("div", {
51228
+ style: errorTextStyle
51229
+ }, fieldErrors.mutationFile), mutationDocFile && /*#__PURE__*/React__default.createElement("div", {
51230
+ style: successTextStyle
51231
+ }, "\u2713 Document uploaded successfully"))), /*#__PURE__*/React__default.createElement("div", {
51232
+ style: {
51233
+ display: "flex",
51234
+ justifyContent: "space-between",
51235
+ alignItems: "center",
51236
+ marginTop: "32px"
51237
+ }
51238
+ }, /*#__PURE__*/React__default.createElement("button", {
51239
+ type: "button",
51240
+ onClick: onBack,
51241
+ style: {
51242
+ padding: "8px 24px",
51243
+ backgroundColor: "#e0e0e0",
51244
+ border: "none",
51245
+ borderRadius: "4px",
51246
+ cursor: "pointer",
51247
+ fontWeight: "bold"
51248
+ }
51249
+ }, "\u2190 Back"), /*#__PURE__*/React__default.createElement("div", {
51250
+ style: {
51251
+ display: "flex",
51252
+ alignItems: "center",
51253
+ gap: "12px"
51254
+ }
51255
+ }, /*#__PURE__*/React__default.createElement("span", {
51256
+ style: {
51257
+ fontSize: "12px",
51258
+ color: "#999"
51259
+ }
51260
+ }, "All documents are mandatory"), /*#__PURE__*/React__default.createElement("button", {
51261
+ type: "button",
51262
+ onClick: onProceed,
51263
+ disabled: isUploading,
51264
+ style: {
51265
+ padding: "10px 24px",
51266
+ backgroundColor: isUploading ? "#ccc" : "#00497e",
51267
+ color: "white",
51268
+ border: "none",
51269
+ borderRadius: "4px",
51270
+ cursor: isUploading ? "not-allowed" : "pointer",
51271
+ fontWeight: "bold"
51272
+ }
51273
+ }, isUploading ? "Uploading..." : "Proceed to Application Preview →"))), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
51274
+ error: showToast.key === "error",
51275
+ warning: showToast.key === "warning",
51276
+ success: showToast.key === "success",
51277
+ label: t(showToast.message),
51278
+ onClose: () => setShowToast(null),
51279
+ isDleteBtn: true
51280
+ }));
51281
+ };
51282
+
51283
+ const Step4_Preview = _ref => {
51284
+ var _appData$connectionHo, _appData$property, _address$locality;
51285
+ let formData = _ref.formData,
51286
+ applicationDetails = _ref.applicationDetails,
51287
+ onBack = _ref.onBack,
51288
+ onSubmit = _ref.onSubmit,
51289
+ isLoading = _ref.isLoading;
51290
+ const _useState = React.useState(false),
51291
+ agreed = _useState[0],
51292
+ setAgreed = _useState[1];
51293
+ const _useState2 = React.useState(0),
51294
+ fee = _useState2[0],
51295
+ setFee = _useState2[1];
51296
+ const _useState3 = React.useState("Calculating..."),
51297
+ slab = _useState3[0],
51298
+ setSlab = _useState3[1];
51299
+ const getMaskedName = name => {
51300
+ if (!name) return "NA";
51301
+ return name.split("").map((char, index) => index % 2 === 1 && char !== " " ? "*" : char).join("");
51302
+ };
51303
+ const getMaskedPhone = phone => {
51304
+ if (!phone || phone.length < 10) return "NA";
51305
+ return "******" + phone.slice(-4);
51306
+ };
51307
+ const appData = (applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.applicationData) || {};
51308
+ const connectionNo = (appData === null || appData === void 0 ? void 0 : appData.connectionNo) || "NA";
51309
+ const meterId = (appData === null || appData === void 0 ? void 0 : appData.meterId) || "NA";
51310
+ const propertyId = (appData === null || appData === void 0 ? void 0 : appData.propertyId) || "NA";
51311
+ const oldHolder = (appData === null || appData === void 0 ? void 0 : (_appData$connectionHo = appData.connectionHolders) === null || _appData$connectionHo === void 0 ? void 0 : _appData$connectionHo[0]) || {};
51312
+ const oldName = getMaskedName(oldHolder === null || oldHolder === void 0 ? void 0 : oldHolder.name);
51313
+ const oldPhone = getMaskedPhone(oldHolder === null || oldHolder === void 0 ? void 0 : oldHolder.mobileNumber);
51314
+ const address = (appData === null || appData === void 0 ? void 0 : (_appData$property = appData.property) === null || _appData$property === void 0 ? void 0 : _appData$property.address) || {};
51315
+ const oldAddress = [address === null || address === void 0 ? void 0 : address.doorNo, address === null || address === void 0 ? void 0 : address.buildingName, address === null || address === void 0 ? void 0 : address.street, address === null || address === void 0 ? void 0 : (_address$locality = address.locality) === null || _address$locality === void 0 ? void 0 : _address$locality.name, address === null || address === void 0 ? void 0 : address.city].filter(Boolean).join(", ") || "NA";
51316
+ const proposedNewConsumerName = formData.proposedNewConsumerName,
51317
+ newOwnerMobileNumber = formData.newOwnerMobileNumber,
51318
+ relationshipWithExistingConsumer = formData.relationshipWithExistingConsumer,
51319
+ reasonForNameChange = formData.reasonForNameChange,
51320
+ identityProofType = formData.identityProofType,
51321
+ documentNumber = formData.documentNumber,
51322
+ identityProofDocumentId = formData.identityProofDocumentId,
51323
+ saleDeedDocumentId = formData.saleDeedDocumentId;
51324
+ const getRelationshipName = code => {
51325
+ if (code !== null && code !== void 0 && code.code) return code.i18nKey;
51326
+ const map = {
51327
+ "BLOOD_RELATION": "Blood Relation",
51328
+ "LEGAL_HEIR": "Legal Heir",
51329
+ "OTHER": "Other"
51330
+ };
51331
+ return map[code] || code;
51332
+ };
51333
+ const getReasonName = code => {
51334
+ if (code !== null && code !== void 0 && code.code) return code.i18nKey;
51335
+ const map = {
51336
+ "SALE_PURCHASE": "Sale / Purchase of Property",
51337
+ "DEVOLUTION_INHERITANCE": "Inheritance / Succession",
51338
+ "OTHER": "Other"
51339
+ };
51340
+ return map[code] || code;
51341
+ };
51342
+ const tenantId = Digit.ULBService.getCurrentTenantId();
51343
+ const viewDocument = function (fileStoreId) {
51344
+ try {
51345
+ if (!fileStoreId) return Promise.resolve();
51346
+ const _temp = _catch(function () {
51347
+ const stateId = Digit.ULBService.getStateId();
51348
+ return Promise.resolve(window.Digit.UploadServices.Filefetch([fileStoreId], stateId)).then(function (res) {
51349
+ var _res$data;
51350
+ if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data[fileStoreId]) {
51351
+ const fileUrl = res.data[fileStoreId].split(",")[0];
51352
+ window.open(fileUrl, "_blank");
51353
+ }
51354
+ });
51355
+ }, function (err) {
51356
+ console.error("Failed to fetch document", err);
51357
+ });
51358
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
51359
+ } catch (e) {
51360
+ return Promise.reject(e);
51361
+ }
51362
+ };
51363
+ React.useEffect(() => {
51364
+ const relationCode = (relationshipWithExistingConsumer === null || relationshipWithExistingConsumer === void 0 ? void 0 : relationshipWithExistingConsumer.code) || relationshipWithExistingConsumer;
51365
+ if (relationCode && relationCode !== "OTHER") {
51366
+ setFee(100);
51367
+ setSlab("Blood relation slab");
51368
+ } else {
51369
+ setFee(1350);
51370
+ setSlab("Other Slab");
51371
+ }
51372
+ }, [relationshipWithExistingConsumer]);
51373
+ const sectionStyle = {
51374
+ border: "1px solid #e0e0e0",
51375
+ borderRadius: "8px",
51376
+ padding: "16px",
51377
+ marginBottom: "16px"
51378
+ };
51379
+ const labelStyle = {
51380
+ color: "#666",
51381
+ fontSize: "14px",
51382
+ marginBottom: "4px"
51383
+ };
51384
+ const valueStyle = {
51385
+ fontWeight: "bold",
51386
+ fontSize: "16px"
51387
+ };
51388
+ const uploadDocStatusStyle = {
51389
+ fontSize: "14px",
51390
+ fontWeight: "bold"
51391
+ };
51392
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
51393
+ style: {
51394
+ marginBottom: "20px"
51395
+ }
51396
+ }, /*#__PURE__*/React__default.createElement("div", {
51397
+ style: {
51398
+ display: "flex",
51399
+ alignItems: "center",
51400
+ marginBottom: "16px"
51401
+ }
51402
+ }, /*#__PURE__*/React__default.createElement("span", {
51403
+ style: {
51404
+ fontSize: "24px",
51405
+ marginRight: "8px"
51406
+ }
51407
+ }, "\uD83D\uDCCB"), /*#__PURE__*/React__default.createElement("h2", {
51408
+ style: {
51409
+ fontSize: "20px",
51410
+ fontWeight: "700",
51411
+ margin: 0
51412
+ }
51413
+ }, "4. Application Preview & Final Declaration")), /*#__PURE__*/React__default.createElement("div", {
51414
+ style: _extends({}, sectionStyle, {
51415
+ borderLeft: "4px solid #00497e"
51416
+ })
51417
+ }, /*#__PURE__*/React__default.createElement("h3", {
51418
+ style: {
51419
+ fontSize: "16px",
51420
+ fontWeight: "bold",
51421
+ color: "#00497e",
51422
+ marginBottom: "12px"
51423
+ }
51424
+ }, "Property & Connection Summary"), /*#__PURE__*/React__default.createElement("div", {
51425
+ style: {
51426
+ display: "flex",
51427
+ justifyContent: "space-between"
51428
+ }
51429
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51430
+ style: labelStyle
51431
+ }, "Connection No"), /*#__PURE__*/React__default.createElement("div", {
51432
+ style: valueStyle
51433
+ }, connectionNo)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51434
+ style: labelStyle
51435
+ }, "Meter Number"), /*#__PURE__*/React__default.createElement("div", {
51436
+ style: valueStyle
51437
+ }, meterId)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51438
+ style: labelStyle
51439
+ }, "Property ID"), /*#__PURE__*/React__default.createElement("div", {
51440
+ style: valueStyle
51441
+ }, propertyId)))), /*#__PURE__*/React__default.createElement("div", {
51442
+ style: _extends({}, sectionStyle, {
51443
+ borderLeft: "4px solid #f29c1f"
51444
+ })
51445
+ }, /*#__PURE__*/React__default.createElement("h3", {
51446
+ style: {
51447
+ fontSize: "16px",
51448
+ fontWeight: "bold",
51449
+ color: "#f29c1f",
51450
+ marginBottom: "12px"
51451
+ }
51452
+ }, "\uD83D\uDD12 Existing / Previous Owner Details (Masked Information)"), /*#__PURE__*/React__default.createElement("div", {
51453
+ style: {
51454
+ display: "flex",
51455
+ justifyContent: "space-between",
51456
+ marginBottom: "12px"
51457
+ }
51458
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51459
+ style: labelStyle
51460
+ }, "Registered Name:"), /*#__PURE__*/React__default.createElement("div", {
51461
+ style: valueStyle
51462
+ }, oldName)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51463
+ style: labelStyle
51464
+ }, "Meter Number:"), /*#__PURE__*/React__default.createElement("div", {
51465
+ style: valueStyle
51466
+ }, meterId)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51467
+ style: labelStyle
51468
+ }, "Registered Phone:"), /*#__PURE__*/React__default.createElement("div", {
51469
+ style: valueStyle
51470
+ }, oldPhone))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51471
+ style: labelStyle
51472
+ }, "Registered Address:"), /*#__PURE__*/React__default.createElement("div", {
51473
+ style: valueStyle
51474
+ }, oldAddress))), /*#__PURE__*/React__default.createElement("div", {
51475
+ style: _extends({}, sectionStyle, {
51476
+ borderLeft: "4px solid #00497e"
51477
+ })
51478
+ }, /*#__PURE__*/React__default.createElement("h3", {
51479
+ style: {
51480
+ fontSize: "16px",
51481
+ fontWeight: "bold",
51482
+ color: "#00497e",
51483
+ marginBottom: "12px"
51484
+ }
51485
+ }, "\uD83D\uDC64 Transferee (New Owner) Summary"), /*#__PURE__*/React__default.createElement("div", {
51486
+ style: {
51487
+ display: "flex",
51488
+ justifyContent: "space-between"
51489
+ }
51490
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51491
+ style: labelStyle
51492
+ }, "New Owner Name"), /*#__PURE__*/React__default.createElement("div", {
51493
+ style: valueStyle
51494
+ }, proposedNewConsumerName)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51495
+ style: labelStyle
51496
+ }, "Mobile Number"), /*#__PURE__*/React__default.createElement("div", {
51497
+ style: valueStyle
51498
+ }, newOwnerMobileNumber)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51499
+ style: labelStyle
51500
+ }, "Relation Type"), /*#__PURE__*/React__default.createElement("div", {
51501
+ style: valueStyle
51502
+ }, getRelationshipName(relationshipWithExistingConsumer))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51503
+ style: labelStyle
51504
+ }, "Transfer Reason"), /*#__PURE__*/React__default.createElement("div", {
51505
+ style: valueStyle
51506
+ }, getReasonName(reasonForNameChange))))), /*#__PURE__*/React__default.createElement("div", {
51507
+ style: _extends({}, sectionStyle, {
51508
+ borderLeft: "4px solid #17a2b8"
51509
+ })
51510
+ }, /*#__PURE__*/React__default.createElement("h3", {
51511
+ style: {
51512
+ fontSize: "16px",
51513
+ fontWeight: "bold",
51514
+ color: "#17a2b8",
51515
+ marginBottom: "12px"
51516
+ }
51517
+ }, "Uploaded Documents"), /*#__PURE__*/React__default.createElement("div", {
51518
+ style: {
51519
+ display: "grid",
51520
+ gridTemplateColumns: "1fr 1fr 1fr",
51521
+ gap: "16px"
51522
+ }
51523
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51524
+ style: labelStyle
51525
+ }, "Address / Identity Proof"), /*#__PURE__*/React__default.createElement("div", {
51526
+ style: {
51527
+ display: "flex",
51528
+ alignItems: "center",
51529
+ gap: "8px"
51530
+ }
51531
+ }, /*#__PURE__*/React__default.createElement("span", {
51532
+ style: uploadDocStatusStyle
51533
+ }, "\u2713 ", (identityProofType === null || identityProofType === void 0 ? void 0 : identityProofType.i18nKey) || "Document"), identityProofDocumentId && /*#__PURE__*/React__default.createElement("button", {
51534
+ type: "button",
51535
+ onClick: () => viewDocument(identityProofDocumentId),
51536
+ style: {
51537
+ color: "#00497e",
51538
+ background: "none",
51539
+ border: "none",
51540
+ textDecoration: "underline",
51541
+ cursor: "pointer",
51542
+ fontSize: "14px",
51543
+ fontWeight: "bold"
51544
+ }
51545
+ }, "View"))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51546
+ style: labelStyle
51547
+ }, "Document Number"), /*#__PURE__*/React__default.createElement("div", {
51548
+ style: valueStyle
51549
+ }, documentNumber || "NA")), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51550
+ style: labelStyle
51551
+ }, "Reason-Based Proof"), /*#__PURE__*/React__default.createElement("div", {
51552
+ style: {
51553
+ display: "flex",
51554
+ alignItems: "center",
51555
+ gap: "8px"
51556
+ }
51557
+ }, /*#__PURE__*/React__default.createElement("span", {
51558
+ style: uploadDocStatusStyle
51559
+ }, "\u2713 Uploaded"), saleDeedDocumentId && /*#__PURE__*/React__default.createElement("button", {
51560
+ type: "button",
51561
+ onClick: () => viewDocument(saleDeedDocumentId),
51562
+ style: {
51563
+ color: "#00497e",
51564
+ background: "none",
51565
+ border: "none",
51566
+ textDecoration: "underline",
51567
+ cursor: "pointer",
51568
+ fontSize: "14px",
51569
+ fontWeight: "bold"
51570
+ }
51571
+ }, "View"))))), /*#__PURE__*/React__default.createElement("div", {
51572
+ style: _extends({}, sectionStyle, {
51573
+ backgroundColor: "#f2fff5",
51574
+ border: "1px solid #c3e6cb",
51575
+ borderLeft: "4px solid #28a745"
51576
+ })
51577
+ }, /*#__PURE__*/React__default.createElement("h3", {
51578
+ style: {
51579
+ fontSize: "16px",
51580
+ fontWeight: "bold",
51581
+ color: "#28a745",
51582
+ marginBottom: "12px"
51583
+ }
51584
+ }, "\uD83D\uDCB5 Mutation Fee Details (Money to Pay in Mutation)"), /*#__PURE__*/React__default.createElement("div", {
51585
+ style: {
51586
+ display: "flex",
51587
+ justifyContent: "space-between"
51588
+ }
51589
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51590
+ style: labelStyle
51591
+ }, "Mutation Money to Pay:"), /*#__PURE__*/React__default.createElement("div", {
51592
+ style: _extends({}, valueStyle, {
51593
+ color: "#28a745",
51594
+ fontSize: "20px"
51595
+ })
51596
+ }, "\u20B9 ", fee, ".00")), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51597
+ style: labelStyle
51598
+ }, "Fee Status:"), /*#__PURE__*/React__default.createElement("span", {
51599
+ style: {
51600
+ padding: "4px 8px",
51601
+ backgroundColor: "#d1ecf1",
51602
+ color: "#0c5460",
51603
+ borderRadius: "16px",
51604
+ fontSize: "12px",
51605
+ fontWeight: "bold"
51606
+ }
51607
+ }, "PAYABLE POST VERIFICATION")), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51608
+ style: labelStyle
51609
+ }, "Applicable Slab:"), /*#__PURE__*/React__default.createElement("div", {
51610
+ style: valueStyle
51611
+ }, slab)))), /*#__PURE__*/React__default.createElement("div", {
51612
+ style: {
51613
+ padding: "16px",
51614
+ backgroundColor: "#fffbeb",
51615
+ border: "1px solid #ffeeba",
51616
+ borderRadius: "8px",
51617
+ marginBottom: "24px"
51618
+ }
51619
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CheckBox, {
51620
+ label: "I want to go ahead with submitting this application. I confirm that the details and information provided by me are true and correct to the best of my knowledge.",
51621
+ onChange: e => setAgreed(e.target.checked),
51622
+ checked: agreed
51623
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement("button", {
51624
+ type: "button",
51625
+ onClick: onBack,
51626
+ style: {
51627
+ padding: "8px 24px",
51628
+ backgroundColor: "#e0e0e0",
51629
+ border: "none",
51630
+ borderRadius: "4px",
51631
+ cursor: "pointer",
51632
+ fontWeight: "bold",
51633
+ marginRight: "16px"
51634
+ }
51635
+ }, "\u2190 Edit Information"), /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
51636
+ label: isLoading ? "Submitting..." : "Submit Mutation Application",
51637
+ onSubmit: onSubmit,
51638
+ disabled: !agreed || isLoading
51639
+ })));
51640
+ };
51641
+
51642
+ const Step5_Submission = _ref => {
51643
+ let applicationNumber = _ref.applicationNumber,
51644
+ serviceType = _ref.serviceType,
51645
+ t = _ref.t;
51646
+ const history = reactRouterDom.useHistory();
51647
+ const _useState = React.useState(null),
51648
+ showToast = _useState[0],
51649
+ setShowToast = _useState[1];
51650
+ const _useState2 = React.useState(false);
51651
+ const _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSApplicationActions(serviceType);
51652
+ const goHome = () => {
51653
+ history.push("/digit-ui/employee");
51654
+ };
51655
+ const bannerStyle = {
51656
+ backgroundColor: "#fff",
51657
+ border: "1px solid #d4edda",
51658
+ borderTop: "4px solid #28a745",
51659
+ borderRadius: "8px",
51660
+ padding: "20px",
51661
+ display: "flex",
51662
+ justifyContent: "space-between",
51663
+ alignItems: "center",
51664
+ marginBottom: "20px"
51665
+ };
51666
+ const statusPanelStyle = {
51667
+ backgroundColor: "#fff",
51668
+ border: "1px solid #e0e0e0",
51669
+ borderRadius: "8px",
51670
+ padding: "20px"
51671
+ };
51672
+ return /*#__PURE__*/React__default.createElement("div", {
51673
+ style: {
51674
+ padding: "20px 0"
51675
+ }
51676
+ }, /*#__PURE__*/React__default.createElement("div", {
51677
+ style: bannerStyle
51678
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h2", {
51679
+ style: {
51680
+ color: "#28a745",
51681
+ fontSize: "20px",
51682
+ fontWeight: "bold",
51683
+ margin: 0,
51684
+ display: "flex",
51685
+ alignItems: "center"
51686
+ }
51687
+ }, /*#__PURE__*/React__default.createElement("span", {
51688
+ style: {
51689
+ marginRight: "8px"
51690
+ }
51691
+ }, "\u2705"), " Application Submitted Successfully!"), /*#__PURE__*/React__default.createElement("div", {
51692
+ style: {
51693
+ color: "#666",
51694
+ marginTop: "4px"
51695
+ }
51696
+ }, "Application Reference No: ", /*#__PURE__*/React__default.createElement("strong", {
51697
+ style: {
51698
+ color: "#00497e"
51699
+ }
51700
+ }, applicationNumber))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("span", {
51701
+ style: {
51702
+ padding: "6px 12px",
51703
+ backgroundColor: "#fff3cd",
51704
+ color: "#856404",
51705
+ borderRadius: "16px",
51706
+ fontSize: "12px",
51707
+ fontWeight: "bold"
51708
+ }
51709
+ }, "PENDING_APPROVAL_FOR_MUTATION"))), /*#__PURE__*/React__default.createElement("div", {
51710
+ style: statusPanelStyle
51711
+ }, /*#__PURE__*/React__default.createElement("h3", {
51712
+ style: {
51713
+ color: "#00497e",
51714
+ fontSize: "16px",
51715
+ fontWeight: "bold",
51716
+ margin: "0 0 16px 0",
51717
+ display: "flex",
51718
+ alignItems: "center"
51719
+ }
51720
+ }, /*#__PURE__*/React__default.createElement("span", {
51721
+ style: {
51722
+ marginRight: "8px"
51723
+ }
51724
+ }, "\uD83D\uDCCC"), " Current Workflow Status"), /*#__PURE__*/React__default.createElement("hr", {
51725
+ style: {
51726
+ border: "0",
51727
+ borderTop: "1px solid #e0e0e0",
51728
+ margin: "0 0 16px 0"
51729
+ }
51730
+ }), /*#__PURE__*/React__default.createElement("p", {
51731
+ style: {
51732
+ color: "#333",
51733
+ fontSize: "14px",
51734
+ margin: 0
51735
+ }
51736
+ }, "Application has been routed to ", /*#__PURE__*/React__default.createElement("strong", null, "Water Supply Department Verification Officer"), ".")), /*#__PURE__*/React__default.createElement("div", {
51737
+ style: {
51738
+ marginTop: "24px",
51739
+ textAlign: "center"
51740
+ }
51741
+ }, /*#__PURE__*/React__default.createElement("button", {
51742
+ onClick: goHome,
51743
+ style: {
51744
+ padding: "10px 24px",
51745
+ backgroundColor: "#00497e",
51746
+ color: "white",
51747
+ border: "none",
51748
+ borderRadius: "4px",
51749
+ cursor: "pointer",
51750
+ fontWeight: "bold"
51751
+ }
51752
+ }, "Go to Home")), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
51753
+ error: showToast.key === "error",
51754
+ warning: showToast.key === "warning",
51755
+ label: t(showToast.message),
51756
+ onClose: () => setShowToast(null)
51757
+ }));
51758
+ };
51759
+
51760
+ const MutationApplication = () => {
51761
+ var _state, _details$applicationD, _applicationDetails$a, _applicationDetails$a3, _applicationDetails$a4;
51762
+ const _useTranslation = reactI18next.useTranslation(),
51763
+ t = _useTranslation.t;
51764
+ let _useLocation = reactRouterDom.useLocation(),
51765
+ state = _useLocation.state;
51766
+ state = state ? typeof state === "string" ? JSON.parse(state) : state : {};
51767
+ const history = reactRouterDom.useHistory();
51768
+ let filters = getQueryStringParams(location.search);
51769
+ const _useState = React.useState(1),
51770
+ currentStep = _useState[0],
51771
+ setCurrentStep = _useState[1];
51772
+ const _useState2 = React.useState({}),
51773
+ formData = _useState2[0],
51774
+ setFormData = _useState2[1];
51775
+ const _useState3 = React.useState(null),
51776
+ showToast = _useState3[0],
51777
+ setShowToast = _useState3[1];
51778
+ const _useState4 = React.useState(null),
51779
+ generatedAppNo = _useState4[0],
51780
+ setGeneratedAppNo = _useState4[1];
51781
+ const _useState5 = React.useState(false),
51782
+ isSubmitting = _useState5[0],
51783
+ setIsSubmitting = _useState5[1];
51784
+ const _useState6 = React.useState(new Set()),
51785
+ setCompletedSteps = _useState6[1];
51786
+ let tenantId = Digit.ULBService.getCurrentTenantId();
51787
+ const applicationNumber = filters === null || filters === void 0 ? void 0 : filters.applicationNumber;
51788
+ const serviceType = filters === null || filters === void 0 ? void 0 : filters.service;
51789
+ let details = cloneDeep_1((_state = state) === null || _state === void 0 ? void 0 : _state.data);
51790
+ let _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSDetailsPage(t, tenantId, (details === null || details === void 0 ? void 0 : details.applicationNo) || applicationNumber, (serviceType === null || serviceType === void 0 ? void 0 : serviceType.toUpperCase()) || (details === null || details === void 0 ? void 0 : (_details$applicationD = details.applicationData) === null || _details$applicationD === void 0 ? void 0 : _details$applicationD.serviceType)),
51791
+ isDetailsLoading = _Digit$Hooks$ws$useWS.isLoading,
51792
+ applicationDetails = _Digit$Hooks$ws$useWS.data;
51793
+ const _useState7 = React.useState(new URLSearchParams(reactRouterDom.useLocation().search).get("propertyId") || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a = applicationDetails.applicationData) === null || _applicationDetails$a === void 0 ? void 0 : _applicationDetails$a.propertyId)),
51794
+ propertyId = _useState7[0];
51795
+ const _Digit$Hooks$pt$usePr = Digit.Hooks.pt.usePropertySearch({
51796
+ filters: {
51797
+ propertyIds: propertyId
51798
+ },
51799
+ tenantId: tenantId
51800
+ }, {
51801
+ filters: {
51802
+ propertyIds: propertyId
51803
+ },
51804
+ tenantId: tenantId,
51805
+ enabled: !!propertyId
51806
+ }),
51807
+ propertyDetails = _Digit$Hooks$pt$usePr.data,
51808
+ isPropertyLoading = _Digit$Hooks$pt$usePr.isLoading;
51809
+ const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM", {}),
51810
+ sessionFormData = _Digit$Hooks$useSessi[0],
51811
+ setSessionFormData = _Digit$Hooks$useSessi[1],
51812
+ clearSessionFormData = _Digit$Hooks$useSessi[2];
51813
+ React.useEffect(() => {
51814
+ var _applicationDetails$a2;
51815
+ const fetchAppData = function () {
51816
+ try {
51817
+ const dataToConvert = applicationDetails || details;
51818
+ const _temp = function (_dataToConvert$applic) {
51819
+ if (dataToConvert !== null && dataToConvert !== void 0 && (_dataToConvert$applic = dataToConvert.applicationData) !== null && _dataToConvert$applic !== void 0 && _dataToConvert$applic.id) {
51820
+ var _dataToConvert$applic2;
51821
+ return Promise.resolve(convertApplicationData(dataToConvert, (serviceType === null || serviceType === void 0 ? void 0 : serviceType.toUpperCase()) || (dataToConvert === null || dataToConvert === void 0 ? void 0 : (_dataToConvert$applic2 = dataToConvert.applicationData) === null || _dataToConvert$applic2 === void 0 ? void 0 : _dataToConvert$applic2.serviceType), true, undefined, t)).then(function (convertAppData) {
51822
+ setSessionFormData(prev => _extends({}, prev, convertAppData));
51823
+ sessionStorage.setItem("IsDetailsExists", JSON.stringify(true));
51824
+ });
51825
+ }
51826
+ }();
51827
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
51828
+ } catch (e) {
51829
+ return Promise.reject(e);
51830
+ }
51831
+ };
51832
+ if (applicationDetails !== null && applicationDetails !== void 0 && (_applicationDetails$a2 = applicationDetails.applicationData) !== null && _applicationDetails$a2 !== void 0 && _applicationDetails$a2.id && !(sessionFormData !== null && sessionFormData !== void 0 && sessionFormData.applicationData)) {
51833
+ fetchAppData();
51834
+ }
51835
+ }, [applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a3 = applicationDetails.applicationData) === null || _applicationDetails$a3 === void 0 ? void 0 : _applicationDetails$a3.id]);
50649
51836
  React.useEffect(() => {
50650
51837
  var _propertyDetails$Prop;
50651
51838
  if (propertyDetails !== null && propertyDetails !== void 0 && (_propertyDetails$Prop = propertyDetails.Properties) !== null && _propertyDetails$Prop !== void 0 && _propertyDetails$Prop[0]) {
@@ -50659,220 +51846,311 @@ const MutationApplication = () => {
50659
51846
  });
50660
51847
  }
50661
51848
  }, [propertyDetails]);
50662
- React.useEffect(() => {
50663
- var _sessionFormData$Conn, _sessionFormData$Conn2;
50664
- if (sessionFormData !== null && sessionFormData !== void 0 && (_sessionFormData$Conn = sessionFormData.ConnectionDetails) !== null && _sessionFormData$Conn !== void 0 && (_sessionFormData$Conn2 = _sessionFormData$Conn[0]) !== null && _sessionFormData$Conn2 !== void 0 && _sessionFormData$Conn2.applicationNo) {
50665
- setEnabledLoader(false);
50666
- }
50667
- }, [propertyDetails, sessionFormData, sessionFormData === null || sessionFormData === void 0 ? void 0 : sessionFormData.cpt]);
50668
- React.useEffect(() => {
50669
- const timer = setTimeout(() => {
50670
- var _sessionFormData$Conn3, _sessionFormData$Conn4, _sessionFormData$Conn5, _sessionFormData$Conn6, _sessionFormData$Conn7;
50671
- if (isAppDetailsPage) window.location.href = window.location.origin + "/digit-ui/employee/ws/application-details?applicationNumber=" + (sessionFormData === null || sessionFormData === void 0 ? void 0 : (_sessionFormData$Conn3 = sessionFormData.ConnectionDetails) === null || _sessionFormData$Conn3 === void 0 ? void 0 : (_sessionFormData$Conn4 = _sessionFormData$Conn3[0]) === null || _sessionFormData$Conn4 === void 0 ? void 0 : _sessionFormData$Conn4.applicationNo) + "&service=" + (sessionFormData === null || sessionFormData === void 0 ? void 0 : (_sessionFormData$Conn5 = sessionFormData.ConnectionDetails) === null || _sessionFormData$Conn5 === void 0 ? void 0 : (_sessionFormData$Conn6 = _sessionFormData$Conn5[0]) === null || _sessionFormData$Conn6 === void 0 ? void 0 : (_sessionFormData$Conn7 = _sessionFormData$Conn6.serviceName) === null || _sessionFormData$Conn7 === void 0 ? void 0 : _sessionFormData$Conn7.toUpperCase());
50672
- }, 3000);
50673
- return () => clearTimeout(timer);
50674
- }, [isAppDetailsPage]);
50675
51849
  const _Digit$Hooks$ws$useWa = Digit.Hooks.ws.useWaterCreateAPI("WATER"),
50676
51850
  waterMutation = _Digit$Hooks$ws$useWa.mutate;
50677
- const _Digit$Hooks$ws$useWS3 = Digit.Hooks.ws.useWSApplicationActions("WATER");
50678
51851
  const _Digit$Hooks$ws$useWa2 = Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),
50679
51852
  sewerageMutation = _Digit$Hooks$ws$useWa2.mutate;
50680
- const _Digit$Hooks$ws$useWS4 = Digit.Hooks.ws.useWSApplicationActions("SEWERAGE");
50681
- const onFormValueChange = (setValue, formData, formState) => {
50682
- var _formData$cpt, _formData$cpt$details;
50683
- const updatedData = _extends({}, sessionFormData, formData);
50684
- if (!lodash.isEqual(sessionFormData, updatedData)) {
50685
- setSessionFormData(updatedData);
50686
- }
50687
- if (Object.keys(formState.errors).length > 0 && Object.keys(formState.errors).length == 1 && formState.errors["owners"] && Object.values(formState.errors["owners"].type).filter(ob => ob.type === "required").length == 0 && !(formData !== null && formData !== void 0 && (_formData$cpt = formData.cpt) !== null && _formData$cpt !== void 0 && (_formData$cpt$details = _formData$cpt.details) !== null && _formData$cpt$details !== void 0 && _formData$cpt$details.propertyId)) setSubmitValve(true);else setSubmitValve(!Object.keys(formState.errors).length);
51853
+ const _Digit$Hooks$ws$useWS2 = Digit.Hooks.ws.useWSApplicationActions("WATER"),
51854
+ waterUpdateMutation = _Digit$Hooks$ws$useWS2.mutate;
51855
+ const _Digit$Hooks$ws$useWS3 = Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),
51856
+ sewerageUpdateMutation = _Digit$Hooks$ws$useWS3.mutate;
51857
+ const handleNextStep2 = data => {
51858
+ setFormData(prev => _extends({}, prev, data));
51859
+ setCompletedSteps(prev => new Set([...prev, 2]));
51860
+ setCurrentStep(3);
50688
51861
  };
50689
- const onSubmit = function (data) {
51862
+ const handleNextStep3 = data => {
51863
+ setFormData(prev => _extends({}, prev, data));
51864
+ setCompletedSteps(prev => new Set([...prev, 3]));
51865
+ setCurrentStep(4);
51866
+ };
51867
+ const submitApplication = function () {
50690
51868
  try {
50691
- var _finalData$cpt, _propertyDetails$Prop3;
50692
- let finalData = _extends({}, sessionFormData, data);
50693
- if (!(finalData !== null && finalData !== void 0 && (_finalData$cpt = finalData.cpt) !== null && _finalData$cpt !== void 0 && _finalData$cpt.id) && !(propertyDetails !== null && propertyDetails !== void 0 && (_propertyDetails$Prop3 = propertyDetails.Properties) !== null && _propertyDetails$Prop3 !== void 0 && _propertyDetails$Prop3[0])) {
50694
- var _finalData$cpt2;
50695
- if (!(finalData !== null && finalData !== void 0 && (_finalData$cpt2 = finalData.cpt) !== null && _finalData$cpt2 !== void 0 && _finalData$cpt2.details) || !propertyDetails) {
50696
- setShowToast({
50697
- key: "error",
50698
- message: "ERR_INVALID_PROPERTY_ID"
50699
- });
50700
- return Promise.resolve();
51869
+ setIsSubmitting(true);
51870
+ const _temp2 = _catch(function () {
51871
+ var _finalData$cpt;
51872
+ let finalData = _extends({}, sessionFormData);
51873
+ if (!(finalData !== null && finalData !== void 0 && (_finalData$cpt = finalData.cpt) !== null && _finalData$cpt !== void 0 && _finalData$cpt.details)) {
51874
+ var _propertyDetails$Prop3;
51875
+ finalData.cpt = {
51876
+ details: propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop3 = propertyDetails.Properties) === null || _propertyDetails$Prop3 === void 0 ? void 0 : _propertyDetails$Prop3[0]
51877
+ };
50701
51878
  }
50702
- }
50703
- const _temp7 = function () {
50704
- if (!canSubmit) {
50705
- setShowToast({
50706
- warning: true,
50707
- message: "PLEASE_FILL_MANDATORY_DETAILS"
50708
- });
50709
- setTimeout(() => {
50710
- setShowToast(false);
50711
- }, 3000);
50712
- } else {
50713
- var _finalData$cpt3;
50714
- if (!(finalData !== null && finalData !== void 0 && (_finalData$cpt3 = finalData.cpt) !== null && _finalData$cpt3 !== void 0 && _finalData$cpt3.details)) {
50715
- var _propertyDetails$Prop4;
50716
- finalData.cpt = {
50717
- details: propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop4 = propertyDetails.Properties) === null || _propertyDetails$Prop4 === void 0 ? void 0 : _propertyDetails$Prop4[0]
50718
- };
51879
+ finalData.MutationApplicantDetails = {
51880
+ proposedNewConsumerName: formData.proposedNewConsumerName,
51881
+ newOwnerMobileNumber: formData.newOwnerMobileNumber,
51882
+ newOwnerEmailAddress: formData.newOwnerEmailAddress,
51883
+ reasonForNameChange: formData.reasonForNameChange,
51884
+ relationshipWithExistingConsumer: formData.relationshipWithExistingConsumer,
51885
+ saleDeedDocumentId: formData.saleDeedDocumentId,
51886
+ identityProofType: formData.identityProofType,
51887
+ identityProofDocumentId: formData.identityProofDocumentId,
51888
+ documentNumber: formData.documentNumber
51889
+ };
51890
+ if (finalData !== null && finalData !== void 0 && finalData.MutationApplicantDetails) {
51891
+ var _finalData$Connection;
51892
+ const mutDetails = finalData.MutationApplicantDetails;
51893
+ const existingHolder = (finalData === null || finalData === void 0 ? void 0 : (_finalData$Connection = finalData.ConnectionHolderDetails) === null || _finalData$Connection === void 0 ? void 0 : _finalData$Connection[0]) || {};
51894
+ finalData.ConnectionHolderDetails = [_extends({}, existingHolder, {
51895
+ name: mutDetails.proposedNewConsumerName || existingHolder.name,
51896
+ mobileNumber: mutDetails.newOwnerMobileNumber || existingHolder.mobileNumber,
51897
+ emailId: mutDetails.newOwnerEmailAddress || existingHolder.emailId,
51898
+ sameAsOwnerDetails: false
51899
+ })];
51900
+ }
51901
+ const sessionDetails = sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS") ? JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")) : {};
51902
+ return Promise.resolve(convertModifyApplicationDetails(finalData, sessionDetails, "INITIATE")).then(function (convertAppData) {
51903
+ if (!convertAppData.dateEffectiveFrom) {
51904
+ convertAppData.dateEffectiveFrom = Date.now();
50719
51905
  }
50720
51906
  if (finalData !== null && finalData !== void 0 && finalData.MutationApplicantDetails) {
50721
- var _finalData$Connection;
51907
+ var _mutDetails$reasonFor;
50722
51908
  const mutDetails = finalData.MutationApplicantDetails;
50723
- const existingHolder = (finalData === null || finalData === void 0 ? void 0 : (_finalData$Connection = finalData.ConnectionHolderDetails) === null || _finalData$Connection === void 0 ? void 0 : _finalData$Connection[0]) || {};
50724
- finalData.ConnectionHolderDetails = [_extends({}, existingHolder, {
50725
- name: mutDetails.proposedNewConsumerName || existingHolder.name,
50726
- mobileNumber: mutDetails.newOwnerMobileNumber || existingHolder.mobileNumber,
50727
- emailId: mutDetails.newOwnerEmailAddress || existingHolder.emailId,
50728
- sameAsOwnerDetails: false
50729
- })];
50730
- }
50731
- const details = sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS") ? JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")) : {};
50732
- return Promise.resolve(convertModifyApplicationDetails(finalData, details, "APPLY_MUTATION")).then(function (convertAppData) {
50733
- function _temp6() {
50734
- const _temp4 = function () {
50735
- if (serviceType !== "WATER") {
50736
- const _temp3 = function () {
50737
- if (sewerageMutation) {
50738
- setIsEnableLoader(true);
50739
- return Promise.resolve(sewerageMutation(reqDetails, {
50740
- onError: (error, variables) => {
50741
- var _error$response, _error$response$data, _error$response$data$, _error$response$data$2, _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
50742
- setIsEnableLoader(false);
50743
- setShowToast({
50744
- key: "error",
50745
- message: error !== null && error !== void 0 && (_error$response = error.response) !== null && _error$response !== void 0 && (_error$response$data = _error$response.data) !== null && _error$response$data !== void 0 && (_error$response$data$ = _error$response$data.Errors) !== null && _error$response$data$ !== void 0 && (_error$response$data$2 = _error$response$data$[0]) !== null && _error$response$data$2 !== void 0 && _error$response$data$2.message ? error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : (_error$response2$data2 = _error$response2$data.Errors) === null || _error$response2$data2 === void 0 ? void 0 : (_error$response2$data3 = _error$response2$data2[0]) === null || _error$response2$data3 === void 0 ? void 0 : _error$response2$data3.message : error
50746
- });
50747
- setTimeout(closeToastOfError, 5000);
50748
- },
50749
- onSuccess: function (data, variables) {
50750
- try {
50751
- var _data$SewerageConnect, _data$SewerageConnect2;
50752
- clearSessionFormData();
50753
- history.push("/digit-ui/employee/ws/ws-response?applicationNumber1=" + (data === null || data === void 0 ? void 0 : (_data$SewerageConnect = data.SewerageConnections) === null || _data$SewerageConnect === void 0 ? void 0 : (_data$SewerageConnect2 = _data$SewerageConnect[0]) === null || _data$SewerageConnect2 === void 0 ? void 0 : _data$SewerageConnect2.applicationNo));
50754
- return Promise.resolve();
50755
- } catch (e) {
50756
- return Promise.reject(e);
50757
- }
50758
- }
50759
- })).then(function () {});
50760
- }
50761
- }();
50762
- if (_temp3 && _temp3.then) return _temp3.then(function () {});
50763
- }
50764
- }();
50765
- if (_temp4 && _temp4.then) return _temp4.then(function () {});
51909
+ if (!convertAppData.additionalDetails) convertAppData.additionalDetails = {};
51910
+ if (mutDetails.reasonForNameChange) convertAppData.additionalDetails.reasonForNameChange = ((_mutDetails$reasonFor = mutDetails.reasonForNameChange) === null || _mutDetails$reasonFor === void 0 ? void 0 : _mutDetails$reasonFor.code) || mutDetails.reasonForNameChange;
51911
+ if (mutDetails.relationshipWithExistingConsumer) {
51912
+ var _mutDetails$relations;
51913
+ const relationCode = ((_mutDetails$relations = mutDetails.relationshipWithExistingConsumer) === null || _mutDetails$relations === void 0 ? void 0 : _mutDetails$relations.code) || mutDetails.relationshipWithExistingConsumer;
51914
+ convertAppData.additionalDetails.relationshipWithExistingConsumer = relationCode;
51915
+ convertAppData.additionalDetails.isBloodRelation = relationCode !== "OTHER";
50766
51916
  }
50767
- if (finalData !== null && finalData !== void 0 && finalData.MutationApplicantDetails) {
50768
- var _mutDetails$reasonFor;
50769
- const mutDetails = finalData.MutationApplicantDetails;
50770
- if (!convertAppData.additionalDetails) convertAppData.additionalDetails = {};
50771
- if (mutDetails.reasonForNameChange) convertAppData.additionalDetails.reasonForNameChange = ((_mutDetails$reasonFor = mutDetails.reasonForNameChange) === null || _mutDetails$reasonFor === void 0 ? void 0 : _mutDetails$reasonFor.code) || mutDetails.reasonForNameChange;
50772
- if (mutDetails.relationshipWithExistingConsumer) {
50773
- var _mutDetails$relations;
50774
- const relationCode = ((_mutDetails$relations = mutDetails.relationshipWithExistingConsumer) === null || _mutDetails$relations === void 0 ? void 0 : _mutDetails$relations.code) || mutDetails.relationshipWithExistingConsumer;
50775
- convertAppData.additionalDetails.relationshipWithExistingConsumer = relationCode;
50776
- convertAppData.additionalDetails.isBloodRelation = relationCode !== "OTHER";
50777
- }
50778
- if (mutDetails.saleDeedDocumentId) {
50779
- convertAppData.additionalDetails.saleDeedDocumentId = mutDetails.saleDeedDocumentId;
50780
- if (!convertAppData.documents) convertAppData.documents = [];
50781
- convertAppData.documents.push({
50782
- documentType: "REGISTERED_SALE_DEED",
50783
- fileStoreId: mutDetails.saleDeedDocumentId,
50784
- documentUid: mutDetails.saleDeedDocumentId
51917
+ if (mutDetails.saleDeedDocumentId) {
51918
+ convertAppData.additionalDetails.saleDeedDocumentId = mutDetails.saleDeedDocumentId;
51919
+ if (!convertAppData.documents) convertAppData.documents = [];
51920
+ convertAppData.documents.push({
51921
+ documentType: "REGISTERED_SALE_DEED",
51922
+ fileStoreId: mutDetails.saleDeedDocumentId,
51923
+ documentUid: mutDetails.saleDeedDocumentId,
51924
+ status: "ACTIVE"
51925
+ });
51926
+ }
51927
+ if (mutDetails.identityProofDocumentId) {
51928
+ var _mutDetails$identityP;
51929
+ if (!convertAppData.documents) convertAppData.documents = [];
51930
+ convertAppData.documents.push({
51931
+ documentType: ((_mutDetails$identityP = mutDetails.identityProofType) === null || _mutDetails$identityP === void 0 ? void 0 : _mutDetails$identityP.code) || "IDENTITY_PROOF",
51932
+ fileStoreId: mutDetails.identityProofDocumentId,
51933
+ documentUid: mutDetails.documentNumber || mutDetails.identityProofDocumentId,
51934
+ documentNumber: mutDetails.documentNumber,
51935
+ status: "ACTIVE"
51936
+ });
51937
+ }
51938
+ }
51939
+ convertAppData.applicationType = serviceType == "WATER" ? "MUTATION_WATER_CONNECTION" : "MUTATION_SEWERAGE_CONNECTION";
51940
+ const reqDetails = serviceType == "WATER" ? {
51941
+ WaterConnection: convertAppData,
51942
+ reconnectRequest: false,
51943
+ disconnectRequest: false
51944
+ } : {
51945
+ SewerageConnection: convertAppData,
51946
+ reconnectRequest: false,
51947
+ disconnectRequest: false
51948
+ };
51949
+ const mutation = serviceType == "WATER" ? waterMutation : sewerageMutation;
51950
+ return Promise.resolve(mutation(reqDetails, {
51951
+ onError: error => {
51952
+ var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
51953
+ setIsSubmitting(false);
51954
+ setShowToast({
51955
+ key: "error",
51956
+ message: (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.Errors) === null || _error$response$data$ === void 0 ? void 0 : (_error$response$data$2 = _error$response$data$[0]) === null || _error$response$data$2 === void 0 ? void 0 : _error$response$data$2.message) || "Failed to submit application"
51957
+ });
51958
+ },
51959
+ onSuccess: data => {
51960
+ var _data$response, _data$response$data;
51961
+ if (data instanceof Error || data !== null && data !== void 0 && data.isAxiosError || data !== null && data !== void 0 && (_data$response = data.response) !== null && _data$response !== void 0 && (_data$response$data = _data$response.data) !== null && _data$response$data !== void 0 && _data$response$data.Errors) {
51962
+ var _data$response2, _data$response2$data, _apiErrors$;
51963
+ setIsSubmitting(false);
51964
+ const apiErrors = data === null || data === void 0 ? void 0 : (_data$response2 = data.response) === null || _data$response2 === void 0 ? void 0 : (_data$response2$data = _data$response2.data) === null || _data$response2$data === void 0 ? void 0 : _data$response2$data.Errors;
51965
+ const errorMessage = (apiErrors === null || apiErrors === void 0 ? void 0 : (_apiErrors$ = apiErrors[0]) === null || _apiErrors$ === void 0 ? void 0 : _apiErrors$.message) || (data === null || data === void 0 ? void 0 : data.message) || "Failed to submit application";
51966
+ setShowToast({
51967
+ key: "error",
51968
+ message: errorMessage
50785
51969
  });
51970
+ return;
50786
51971
  }
50787
- }
50788
- convertAppData.applicationType = serviceType == "WATER" ? "MUTATION_WATER_CONNECTION" : "MUTATION_SEWERAGE_CONNECTION";
50789
- const reqDetails = serviceType == "WATER" ? {
50790
- WaterConnection: convertAppData,
50791
- reconnectRequest: false,
50792
- disconnectRequest: false
50793
- } : {
50794
- SewerageConnection: convertAppData,
50795
- reconnectRequest: false,
50796
- disconnectRequest: false
50797
- };
50798
- const _temp5 = function () {
50799
- if (serviceType == "WATER") {
50800
- const _temp2 = function () {
50801
- if (waterMutation) {
50802
- setIsEnableLoader(true);
50803
- return Promise.resolve(waterMutation(reqDetails, {
50804
- onError: (error, variables) => {
50805
- var _error$response3, _error$response3$data, _error$response3$data2, _error$response4, _error$response4$data, _error$response4$data2;
50806
- setIsEnableLoader(false);
50807
- setShowToast({
50808
- key: "error",
50809
- message: error !== null && error !== void 0 && (_error$response3 = error.response) !== null && _error$response3 !== void 0 && (_error$response3$data = _error$response3.data) !== null && _error$response3$data !== void 0 && (_error$response3$data2 = _error$response3$data.Errors) !== null && _error$response3$data2 !== void 0 && _error$response3$data2[0].message ? error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : (_error$response4$data = _error$response4.data) === null || _error$response4$data === void 0 ? void 0 : (_error$response4$data2 = _error$response4$data.Errors) === null || _error$response4$data2 === void 0 ? void 0 : _error$response4$data2[0].message : error
50810
- });
50811
- setTimeout(closeToastOfError, 5000);
50812
- },
50813
- onSuccess: function (data, variables) {
50814
- try {
50815
- var _data$WaterConnection, _data$WaterConnection2;
50816
- clearSessionFormData();
50817
- history.push("/digit-ui/employee/ws/ws-response?applicationNumber=" + (data === null || data === void 0 ? void 0 : (_data$WaterConnection = data.WaterConnection) === null || _data$WaterConnection === void 0 ? void 0 : (_data$WaterConnection2 = _data$WaterConnection[0]) === null || _data$WaterConnection2 === void 0 ? void 0 : _data$WaterConnection2.applicationNo));
50818
- return Promise.resolve();
50819
- } catch (e) {
50820
- return Promise.reject(e);
50821
- }
50822
- }
50823
- })).then(function () {});
51972
+ if (data !== null && data !== void 0 && data.Errors && data.Errors.length > 0) {
51973
+ setIsSubmitting(false);
51974
+ setShowToast({
51975
+ key: "error",
51976
+ message: data.Errors[0].message || "Failed to submit application"
51977
+ });
51978
+ } else {
51979
+ var _data$WaterConnection, _data$SewerageConnect, _Digit, _Digit$Customizations, _Digit$Customizations2;
51980
+ const updateMutation = serviceType == "WATER" ? waterUpdateMutation : sewerageUpdateMutation;
51981
+ const createdConnection = serviceType == "WATER" ? data === null || data === void 0 ? void 0 : (_data$WaterConnection = data.WaterConnection) === null || _data$WaterConnection === void 0 ? void 0 : _data$WaterConnection[0] : data === null || data === void 0 ? void 0 : (_data$SewerageConnect = data.SewerageConnections) === null || _data$SewerageConnect === void 0 ? void 0 : _data$SewerageConnect[0];
51982
+ let updatePayload = _extends({}, createdConnection, {
51983
+ dateEffectiveFrom: (createdConnection === null || createdConnection === void 0 ? void 0 : createdConnection.dateEffectiveFrom) || Date.now(),
51984
+ processInstance: _extends({}, createdConnection === null || createdConnection === void 0 ? void 0 : createdConnection.processInstance, {
51985
+ action: "APPLY_MUTATION"
51986
+ })
51987
+ });
51988
+ if ((_Digit = Digit) !== null && _Digit !== void 0 && (_Digit$Customizations = _Digit.Customizations) !== null && _Digit$Customizations !== void 0 && (_Digit$Customizations2 = _Digit$Customizations.WS) !== null && _Digit$Customizations2 !== void 0 && _Digit$Customizations2.customiseUpdatePayloadOfWS) {
51989
+ updatePayload = Digit.Customizations.WS.customiseUpdatePayloadOfWS(createdConnection, updatePayload, serviceType);
51990
+ }
51991
+ let reqDetailsUpdate = serviceType == "WATER" ? {
51992
+ WaterConnection: updatePayload,
51993
+ reconnectRequest: false,
51994
+ disconnectRequest: false
51995
+ } : {
51996
+ SewerageConnection: updatePayload,
51997
+ reconnectRequest: false,
51998
+ disconnectRequest: false
51999
+ };
52000
+ updateMutation(reqDetailsUpdate, {
52001
+ onError: error => {
52002
+ var _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
52003
+ setIsSubmitting(false);
52004
+ setShowToast({
52005
+ key: "error",
52006
+ message: (error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : (_error$response2$data2 = _error$response2$data.Errors) === null || _error$response2$data2 === void 0 ? void 0 : (_error$response2$data3 = _error$response2$data2[0]) === null || _error$response2$data3 === void 0 ? void 0 : _error$response2$data3.message) || "Failed to update workflow"
52007
+ });
52008
+ },
52009
+ onSuccess: updateData => {
52010
+ var _updateData$response, _updateData$response$, _updateData$WaterConn, _updateData$WaterConn2, _updateData$SewerageC, _updateData$SewerageC2;
52011
+ setIsSubmitting(false);
52012
+ if (updateData instanceof Error || updateData !== null && updateData !== void 0 && updateData.isAxiosError || updateData !== null && updateData !== void 0 && (_updateData$response = updateData.response) !== null && _updateData$response !== void 0 && (_updateData$response$ = _updateData$response.data) !== null && _updateData$response$ !== void 0 && _updateData$response$.Errors) {
52013
+ var _updateData$response2, _updateData$response3, _apiErrors$2;
52014
+ const apiErrors = updateData === null || updateData === void 0 ? void 0 : (_updateData$response2 = updateData.response) === null || _updateData$response2 === void 0 ? void 0 : (_updateData$response3 = _updateData$response2.data) === null || _updateData$response3 === void 0 ? void 0 : _updateData$response3.Errors;
52015
+ const errorMessage = (apiErrors === null || apiErrors === void 0 ? void 0 : (_apiErrors$2 = apiErrors[0]) === null || _apiErrors$2 === void 0 ? void 0 : _apiErrors$2.message) || (updateData === null || updateData === void 0 ? void 0 : updateData.message) || "Failed to update workflow";
52016
+ setShowToast({
52017
+ key: "error",
52018
+ message: errorMessage
52019
+ });
52020
+ return;
52021
+ }
52022
+ if (updateData !== null && updateData !== void 0 && updateData.Errors && updateData.Errors.length > 0) {
52023
+ setShowToast({
52024
+ key: "error",
52025
+ message: updateData.Errors[0].message || "Failed to update workflow"
52026
+ });
52027
+ return;
52028
+ }
52029
+ clearSessionFormData();
52030
+ const newAppNo = serviceType == "WATER" ? updateData === null || updateData === void 0 ? void 0 : (_updateData$WaterConn = updateData.WaterConnection) === null || _updateData$WaterConn === void 0 ? void 0 : (_updateData$WaterConn2 = _updateData$WaterConn[0]) === null || _updateData$WaterConn2 === void 0 ? void 0 : _updateData$WaterConn2.applicationNo : updateData === null || updateData === void 0 ? void 0 : (_updateData$SewerageC = updateData.SewerageConnections) === null || _updateData$SewerageC === void 0 ? void 0 : (_updateData$SewerageC2 = _updateData$SewerageC[0]) === null || _updateData$SewerageC2 === void 0 ? void 0 : _updateData$SewerageC2.applicationNo;
52031
+ setGeneratedAppNo(newAppNo);
52032
+ setCurrentStep(5);
50824
52033
  }
50825
- }();
50826
- if (_temp2 && _temp2.then) return _temp2.then(function () {});
52034
+ });
50827
52035
  }
50828
- }();
50829
- return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
50830
- });
50831
- }
50832
- }();
50833
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
52036
+ }
52037
+ })).then(function () {});
52038
+ });
52039
+ }, function (e) {
52040
+ console.error(e);
52041
+ setIsSubmitting(false);
52042
+ setShowToast({
52043
+ key: "error",
52044
+ message: "Failed to submit application"
52045
+ });
52046
+ });
52047
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
50834
52048
  } catch (e) {
50835
52049
  return Promise.reject(e);
50836
52050
  }
50837
52051
  };
50838
- const closeToastOfError = () => {
50839
- setShowToast(null);
50840
- };
50841
- const closeToast = () => {
50842
- setShowToast(null);
52052
+ const handleTimelineSelect = (route, index) => {
52053
+ const targetStep = index + 1;
52054
+ if (targetStep < currentStep) {
52055
+ setCurrentStep(targetStep);
52056
+ return;
52057
+ }
52058
+ if (targetStep === currentStep) return;
52059
+ if (targetStep > currentStep) {
52060
+ setShowToast({
52061
+ key: "warning",
52062
+ message: "Please complete Step " + currentStep + " before proceeding to Step " + targetStep + "."
52063
+ });
52064
+ }
50843
52065
  };
50844
- if (enabledLoader || isEnableLoader || isConfigLoading) {
52066
+ const timelineConfig = [{
52067
+ sectionId: "application",
52068
+ route: "application-selection",
52069
+ actions: "Existing Connection"
52070
+ }, {
52071
+ sectionId: "applicant",
52072
+ route: "applicant-details",
52073
+ actions: "New Consumer Details"
52074
+ }, {
52075
+ sectionId: "documents",
52076
+ route: "documents",
52077
+ actions: "Documents"
52078
+ }, {
52079
+ sectionId: "Review",
52080
+ route: "review",
52081
+ actions: "Preview"
52082
+ }].map((step, index) => _extends({}, step, {
52083
+ timeLine: [{
52084
+ actions: step.actions,
52085
+ currentStep: index + 1
52086
+ }]
52087
+ }));
52088
+ if (isDetailsLoading || propertyId && isPropertyLoading) {
50845
52089
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
50846
52090
  }
50847
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("style", null, "\n .mutation-disabled-section { pointer-events: none; opacity: 0.8; margin-top: -24px !important; }\n .mutation-hidden-section { display: none !important; margin: 0 !important; padding: 0 !important; height: 0 !important; overflow: hidden !important; border: 0 !important; }\n .mutation-hidden-section + hr { display: none !important; margin: 0 !important; }\n .mutation-hidden-section + .break-line { display: none !important; margin: 0 !important; }\n "), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Header, null, t(config.head)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSubHeader, null, t("WS_MUTATION_DETAILS")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.StatusTable, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50848
- label: t("WS_MYCONNECTIONS_APPLICATION_NO"),
50849
- text: (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a = applicationDetails.applicationData) === null || _applicationDetails$a === void 0 ? void 0 : _applicationDetails$a.applicationNo) || "NA"
50850
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50851
- label: t("WS_CONNECTION_CATEGORY"),
50852
- text: (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a2 = applicationDetails.applicationData) === null || _applicationDetails$a2 === void 0 ? void 0 : _applicationDetails$a2.connectionCategory) || "NA"
50853
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50854
- label: t("WS_PROPERTY_ID_LABEL"),
50855
- text: (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a3 = applicationDetails.applicationData) === null || _applicationDetails$a3 === void 0 ? void 0 : _applicationDetails$a3.propertyId) || propertyId || "NA"
50856
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50857
- label: t("WS_APPLICATION_ID"),
50858
- text: (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a4 = applicationDetails.applicationData) === null || _applicationDetails$a4 === void 0 ? void 0 : _applicationDetails$a4.id) || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a5 = applicationDetails.applicationData) === null || _applicationDetails$a5 === void 0 ? void 0 : _applicationDetails$a5.connectionNo) || "NA"
50859
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50860
- label: t("WS_CONNECTION_DATE"),
50861
- text: applicationDetails !== null && applicationDetails !== void 0 && (_applicationDetails$a6 = applicationDetails.applicationData) !== null && _applicationDetails$a6 !== void 0 && _applicationDetails$a6.connectionExecutionDate ? Digit.DateUtils.ConvertEpochToDate(applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a7 = applicationDetails.applicationData) === null || _applicationDetails$a7 === void 0 ? void 0 : _applicationDetails$a7.connectionExecutionDate) : "NA"
50862
- }))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormComposer, {
50863
- config: config.body,
50864
- userType: "employee",
50865
- onFormValueChange: onFormValueChange,
50866
- label: t("CS_COMMON_SUBMIT"),
50867
- onSubmit: onSubmit,
50868
- defaultValues: sessionFormData,
50869
- appData: appData
52091
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
52092
+ className: "employee-form-section-wrapper"
52093
+ }, currentStep !== 5 && /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
52094
+ config: timelineConfig,
52095
+ currentActiveIndex: currentStep - 1,
52096
+ showFinalStep: false,
52097
+ onSelect: handleTimelineSelect
52098
+ }), /*#__PURE__*/React__default.createElement("div", {
52099
+ style: {
52100
+ flex: "1",
52101
+ minWidth: 0
52102
+ }
52103
+ }, currentStep === 1 && /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(Step1_ExistingConnection, {
52104
+ t: t,
52105
+ applicationDetails: applicationDetails,
52106
+ propertyId: propertyId
52107
+ }), /*#__PURE__*/React__default.createElement("div", {
52108
+ style: {
52109
+ display: "flex",
52110
+ justifyContent: "flex-end"
52111
+ }
52112
+ }, /*#__PURE__*/React__default.createElement("button", {
52113
+ onClick: () => {
52114
+ setCompletedSteps(prev => new Set([...prev, 1]));
52115
+ setCurrentStep(2);
52116
+ },
52117
+ style: {
52118
+ padding: "10px 24px",
52119
+ backgroundColor: "#00497e",
52120
+ color: "white",
52121
+ border: "none",
52122
+ borderRadius: "4px",
52123
+ cursor: "pointer",
52124
+ fontWeight: "bold"
52125
+ }
52126
+ }, "Proceed to New Consumer Details \u2192"))), currentStep === 2 && /*#__PURE__*/React__default.createElement(Step2_NewConsumerDetails, {
52127
+ t: t,
52128
+ defaultValues: formData,
52129
+ onNext: handleNextStep2,
52130
+ onBack: () => setCurrentStep(1)
52131
+ }), currentStep === 3 && /*#__PURE__*/React__default.createElement(Step3_UploadDocuments, {
52132
+ t: t,
52133
+ defaultValues: formData,
52134
+ onNext: handleNextStep3,
52135
+ onBack: () => setCurrentStep(2)
52136
+ }), currentStep === 4 && /*#__PURE__*/React__default.createElement(Step4_Preview, {
52137
+ t: t,
52138
+ formData: formData,
52139
+ applicationDetails: applicationDetails,
52140
+ onBack: () => setCurrentStep(3),
52141
+ onSubmit: submitApplication,
52142
+ isLoading: isSubmitting
52143
+ }), currentStep === 5 && /*#__PURE__*/React__default.createElement(Step5_Submission, {
52144
+ t: t,
52145
+ applicationNumber: generatedAppNo,
52146
+ serviceType: serviceType || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a4 = applicationDetails.applicationData) === null || _applicationDetails$a4 === void 0 ? void 0 : _applicationDetails$a4.serviceType)
50870
52147
  }), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
50871
- isDleteBtn: true,
50872
- error: (showToast === null || showToast === void 0 ? void 0 : showToast.key) === "error" ? true : false,
52148
+ error: (showToast === null || showToast === void 0 ? void 0 : showToast.key) === "error",
52149
+ warning: (showToast === null || showToast === void 0 ? void 0 : showToast.key) === "warning",
50873
52150
  label: t(showToast === null || showToast === void 0 ? void 0 : showToast.message),
50874
- onClose: closeToast
50875
- }));
52151
+ onClose: () => setShowToast(null),
52152
+ isDleteBtn: true
52153
+ }))));
50876
52154
  };
50877
52155
 
50878
52156
  const getPath$5 = (path, params) => {