@djb25/digit-ui-module-ws 1.0.67 → 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) {
@@ -17457,9 +17465,10 @@ const UploadFileDigiLocker = props => {
17457
17465
  let TokenReq = {
17458
17466
  authToken: digiLockerToken
17459
17467
  };
17468
+ const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
17460
17469
  return Promise.resolve(Digit.DigiLockerService.issueDoc({
17461
17470
  TokenReq
17462
- })).then(function (res1) {
17471
+ }, tenantId)).then(function (res1) {
17463
17472
  if (!res1 || !res1.IssuedDoc) {
17464
17473
  setShowToast({
17465
17474
  error: true,
@@ -17492,9 +17501,10 @@ const UploadFileDigiLocker = props => {
17492
17501
  authToken: digiLockerToken,
17493
17502
  id: uriStr
17494
17503
  };
17504
+ const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
17495
17505
  return Promise.resolve(Digit.DigiLockerService.uri({
17496
17506
  TokenReq: TokenReqNew
17497
- })).then(function (res2) {
17507
+ }, tenantId)).then(function (res2) {
17498
17508
  function _temp4() {
17499
17509
  let filename = doctype + "_" + (uri[0].name || "document") + ".pdf";
17500
17510
  if (blobData) convertToFile(e, blobData, filename);else setShowToast({
@@ -48061,11 +48071,11 @@ const ApplicationDetails$1 = () => {
48061
48071
  };
48062
48072
 
48063
48073
  const GetConnectionDetails = () => {
48064
- 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;
48065
48075
  const getBillSearch = function () {
48066
48076
  try {
48067
- const _temp = function (_applicationDetails$f8) {
48068
- 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) {
48069
48079
  var _applicationDetails$a22;
48070
48080
  const service = serviceType === "WATER" ? "WS" : "SW";
48071
48081
  let wsSearchFilters = {
@@ -48195,7 +48205,7 @@ const GetConnectionDetails = () => {
48195
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;
48196
48206
  const checkWorkflow = applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.isApplicationApproved;
48197
48207
  const getModifyConnectionButton = () => {
48198
- var _applicationDetails$f, _applicationDetails$a15, _applicationDetails$p;
48208
+ var _applicationDetails$f, _applicationDetails$f2, _applicationDetails$a15, _applicationDetails$p;
48199
48209
  if (!checkApplicationStatus) {
48200
48210
  setshowActionToast({
48201
48211
  key: "error",
@@ -48203,7 +48213,7 @@ const GetConnectionDetails = () => {
48203
48213
  });
48204
48214
  return;
48205
48215
  }
48206
- 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) {
48207
48217
  setshowActionToast({
48208
48218
  key: "error",
48209
48219
  label: "WS_DUE_AMOUNT_SHOULD_BE_ZERO"
@@ -48216,7 +48226,7 @@ const GetConnectionDetails = () => {
48216
48226
  }));
48217
48227
  };
48218
48228
  const getMutationButton = () => {
48219
- var _applicationDetails$f2, _applicationDetails$a16, _applicationDetails$p2;
48229
+ var _applicationDetails$f3, _applicationDetails$f4, _applicationDetails$a16, _applicationDetails$p2;
48220
48230
  if (!checkApplicationStatus) {
48221
48231
  setshowActionToast({
48222
48232
  key: "error",
@@ -48224,7 +48234,7 @@ const GetConnectionDetails = () => {
48224
48234
  });
48225
48235
  return;
48226
48236
  }
48227
- 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) {
48228
48238
  setshowActionToast({
48229
48239
  key: "error",
48230
48240
  label: "WS_DUE_AMOUNT_SHOULD_BE_ZERO"
@@ -48278,9 +48288,9 @@ const GetConnectionDetails = () => {
48278
48288
  label: "WORKFLOW_IN_PROGRESS"
48279
48289
  });
48280
48290
  } else {
48281
- var _billData$, _applicationDetails$f3;
48291
+ var _billData$, _applicationDetails$f5;
48282
48292
  console.log("due", due, applicationDetails);
48283
- 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) {
48284
48294
  Digit.SessionStorage.set("WS_DISCONNECTION", applicationDetails);
48285
48295
  history.push("" + pathname);
48286
48296
  } else {
@@ -48296,8 +48306,8 @@ const GetConnectionDetails = () => {
48296
48306
  label: "WORKFLOW_IN_PROGRESS"
48297
48307
  });
48298
48308
  } else {
48299
- var _billData$2, _applicationDetails$f4;
48300
- 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") {
48301
48311
  Digit.SessionStorage.set("WS_DISCONNECTION", applicationDetails);
48302
48312
  history.push("" + pathname);
48303
48313
  } else {
@@ -48332,7 +48342,7 @@ const GetConnectionDetails = () => {
48332
48342
  label: t("WS_CONNECTION_DETAILS"),
48333
48343
  onClick: () => downloadConnectionDetails()
48334
48344
  };
48335
- 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];
48336
48346
  const Close = () => /*#__PURE__*/React__default.createElement("svg", {
48337
48347
  xmlns: "http://www.w3.org/2000/svg",
48338
48348
  viewBox: "0 0 24 24",
@@ -48455,7 +48465,7 @@ const GetConnectionDetails = () => {
48455
48465
  className: "modal-header-ws"
48456
48466
  }, t("WS_CLEAR_DUES_DISCONNECTION_SUB_HEADER_LABEL"), " "), /*#__PURE__*/React__default.createElement("div", {
48457
48467
  className: "modal-body-ws"
48458
- }, /*#__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, {
48459
48469
  error: showActionToast.key,
48460
48470
  label: t("" + showActionToast.label),
48461
48471
  onClose: closeBillToast
@@ -50241,49 +50251,230 @@ const EditModifyApplication = () => {
50241
50251
  }));
50242
50252
  };
50243
50253
 
50244
- const WSMutationApplicantDetails = _ref => {
50245
- 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;
50246
50430
  let t = _ref.t,
50247
- config = _ref.config,
50248
- onSelect = _ref.onSelect,
50249
- formData = _ref.formData,
50250
- clearErrors = _ref.clearErrors;
50431
+ onNext = _ref.onNext,
50432
+ onBack = _ref.onBack,
50433
+ defaultValues = _ref.defaultValues;
50251
50434
  const _useForm = reactHookForm.useForm({
50252
- defaultValues: (formData === null || formData === void 0 ? void 0 : formData[config.key]) || {}
50435
+ defaultValues: defaultValues || {},
50436
+ mode: "onBlur"
50253
50437
  }),
50254
50438
  control = _useForm.control,
50255
- watch = _useForm.watch,
50256
- localFormState = _useForm.formState;
50257
- const formValue = watch();
50258
- 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
+ }];
50259
50465
  const reasonOptions = [{
50260
50466
  code: "SALE_PURCHASE",
50261
- i18nKey: "Sale / Purchase of Property"
50467
+ i18nKey: "Purchase of Property"
50262
50468
  }, {
50263
50469
  code: "DEVOLUTION_INHERITANCE",
50264
50470
  i18nKey: "Devolution/Inheritance"
50265
50471
  }, {
50266
50472
  code: "OTHER",
50267
- i18nKey: "Other Reason(Gift, Lease, etc)"
50473
+ i18nKey: "Other Reason(Gift Deed, Lease Agreement, etc)"
50268
50474
  }];
50269
50475
  const relationshipOptions = [{
50270
- code: "MOTHER",
50271
- i18nKey: "Mother"
50272
- }, {
50273
- code: "FATHER",
50274
- i18nKey: "Father"
50275
- }, {
50276
- code: "SIBLING",
50277
- i18nKey: "Sibling"
50278
- }, {
50279
- code: "SPOUSE",
50280
- i18nKey: "Spouse"
50281
- }, {
50282
- code: "SON",
50283
- i18nKey: "Son"
50284
- }, {
50285
- code: "DAUGHTER",
50286
- i18nKey: "Daughter"
50476
+ code: "BLOOD_RELATION",
50477
+ i18nKey: "Blood Relation (Son / Daughter / Spouse)"
50287
50478
  }, {
50288
50479
  code: "LEGAL_HEIR",
50289
50480
  i18nKey: "Legal heir"
@@ -50291,432 +50482,1357 @@ const WSMutationApplicantDetails = _ref => {
50291
50482
  code: "OTHER",
50292
50483
  i18nKey: "Other"
50293
50484
  }];
50294
- 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),
50295
- uploadedFile = _useState[0],
50296
- setUploadedFile = _useState[1];
50297
- const _useState2 = React.useState(null),
50298
- file = _useState2[0],
50299
- setFile = _useState2[1];
50300
- const _useState3 = React.useState(false),
50301
- isUploading = _useState3[0],
50302
- setIsUploading = _useState3[1];
50303
- React.useEffect(() => {
50304
- const currentState = _extends({}, formValue, {
50305
- saleDeedDocumentId: uploadedFile
50306
- });
50307
- if (!lodash.isEqual(formData === null || formData === void 0 ? void 0 : formData[config.key], currentState)) {
50308
- onSelect(config.key, currentState);
50309
- }
50310
- }, [formValue, uploadedFile]);
50311
- React.useEffect(() => {
50312
- (function () {
50313
- try {
50314
- const _temp2 = function () {
50315
- if (file) {
50316
- const _temp = _finallyRethrows(function () {
50317
- return _catch(function () {
50318
- setIsUploading(true);
50319
- return Promise.resolve(window.Digit.UploadServices.Filestorage("WS", file, window.Digit.ULBService.getStateId())).then(function (response) {
50320
- var _response$data, _response$data$files;
50321
- 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) {
50322
- setUploadedFile(response.data.files[0].fileStoreId);
50323
- clearErrors && clearErrors(config.key);
50324
- }
50325
- });
50326
- }, function (err) {
50327
- console.error("File upload error", err);
50328
- });
50329
- }, function (_wasThrown, _result) {
50330
- setIsUploading(false);
50331
- if (_wasThrown) throw _result;
50332
- return _result;
50333
- });
50334
- if (_temp && _temp.then) return _temp.then(function () {});
50335
- }
50336
- }();
50337
- return _temp2 && _temp2.then ? _temp2.then(function () {}) : void 0;
50338
- } catch (e) {
50339
- Promise.reject(e);
50340
- }
50341
- })();
50342
- }, [file]);
50343
50485
  const errorStyle = {
50344
50486
  width: "100%",
50345
50487
  marginLeft: "0px",
50346
50488
  fontSize: "12px",
50347
- marginTop: "4px"
50489
+ marginTop: "4px",
50490
+ color: "#d32f2f"
50348
50491
  };
50349
- return /*#__PURE__*/React__default.createElement("div", {
50350
- 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", {
50351
50526
  style: {
50352
- gridTemplateColumns: "1fr 1fr",
50353
- gap: "20px",
50354
- display: "grid"
50527
+ color: "#d32f2f",
50528
+ marginLeft: "2px"
50529
+ }
50530
+ }, "*");
50531
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
50532
+ style: {
50533
+ marginBottom: "20px"
50355
50534
  }
50356
50535
  }, /*#__PURE__*/React__default.createElement("div", {
50357
50536
  style: {
50358
50537
  display: "flex",
50359
- flexDirection: "column",
50360
- 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
50361
50551
  }
50362
- }, /*#__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", {
50363
50553
  style: {
50554
+ padding: "12px 16px",
50555
+ backgroundColor: "#fdecea",
50556
+ color: "#611a15",
50557
+ borderRadius: "8px",
50558
+ border: "1px solid #f5c6cb",
50559
+ marginBottom: "16px",
50364
50560
  display: "flex",
50365
- flexDirection: "column",
50366
- alignItems: "flex-start",
50367
- gap: "4px"
50561
+ alignItems: "center"
50368
50562
  }
50369
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50563
+ }, /*#__PURE__*/React__default.createElement("span", {
50370
50564
  style: {
50371
- 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",
50372
50576
  fontWeight: "bold"
50373
50577
  }
50374
- }, "PROPOSED NEW CONSUMER NAME*"), /*#__PURE__*/React__default.createElement("div", {
50375
- className: "field",
50578
+ }, "*"), " before proceeding.")), /*#__PURE__*/React__default.createElement("form", {
50579
+ onSubmit: handleSubmit(onSubmit, onError)
50580
+ }, /*#__PURE__*/React__default.createElement("div", {
50376
50581
  style: {
50377
- width: "100%"
50582
+ display: "grid",
50583
+ gridTemplateColumns: "1fr 1fr 1fr",
50584
+ gap: "24px",
50585
+ padding: "16px 0"
50378
50586
  }
50379
- }, /*#__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, {
50380
50592
  control: control,
50381
50593
  name: "proposedNewConsumerName",
50382
50594
  rules: {
50383
- 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
+ }
50384
50604
  },
50385
50605
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
50386
50606
  value: props.value,
50387
50607
  onChange: e => {
50388
50608
  props.onChange(e.target.value);
50609
+ clearErrors("proposedNewConsumerName");
50389
50610
  },
50390
- placeholder: "Enter full legal name of new owner",
50391
- 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")
50392
50620
  })
50393
- }))), (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, {
50394
50622
  style: errorStyle
50395
- }, 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, {
50396
- style: {
50397
- display: "flex",
50398
- flexDirection: "column",
50399
- alignItems: "flex-start",
50400
- gap: "4px"
50401
- }
50402
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
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, {
50403
50624
  style: {
50404
- margin: 0,
50405
50625
  fontWeight: "bold"
50406
50626
  }
50407
- }, "NEW OWNER MOBILE NUMBER*"), /*#__PURE__*/React__default.createElement("div", {
50408
- 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, {
50409
50649
  style: {
50410
- width: "100%"
50650
+ fontWeight: "bold"
50411
50651
  }
50412
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50652
+ }, "Mobile Number ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50413
50653
  control: control,
50414
50654
  name: "newOwnerMobileNumber",
50415
50655
  rules: {
50416
- required: "Required field",
50656
+ required: "Mobile number is required",
50417
50657
  pattern: {
50418
50658
  value: /^[6-9]\d{9}$/,
50419
- message: "Invalid mobile number"
50659
+ message: "Enter a valid 10-digit mobile number starting with 6-9"
50420
50660
  }
50421
50661
  },
50422
50662
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.MobileNumber, {
50423
50663
  value: props.value || "",
50424
50664
  onChange: val => {
50425
50665
  props.onChange(val);
50666
+ clearErrors("newOwnerMobileNumber");
50426
50667
  },
50427
- placeholder: "Enter mobile number",
50428
- 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
50429
50676
  })
50430
- }))), (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, {
50431
50678
  style: errorStyle
50432
- }, 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, {
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, {
50433
50680
  style: {
50434
- display: "flex",
50435
- flexDirection: "column",
50436
- alignItems: "flex-start",
50437
- gap: "4px"
50438
- }
50439
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50440
- style: {
50441
- margin: 0,
50442
50681
  fontWeight: "bold"
50443
50682
  }
50444
- }, "NEW OWNER EMAIL ADDRESS"), /*#__PURE__*/React__default.createElement("div", {
50445
- className: "field",
50683
+ }, "Email ID ", /*#__PURE__*/React__default.createElement("span", {
50446
50684
  style: {
50447
- width: "100%"
50685
+ color: "#999",
50686
+ fontSize: "12px"
50448
50687
  }
50449
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50688
+ }, "(Optional)")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50450
50689
  control: control,
50451
50690
  name: "newOwnerEmailAddress",
50452
50691
  rules: {
50453
50692
  pattern: {
50454
50693
  value: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
50455
- message: "Invalid email address"
50694
+ message: "Please enter a valid email address"
50456
50695
  }
50457
50696
  },
50458
50697
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
50459
50698
  value: props.value,
50460
50699
  onChange: e => {
50461
50700
  props.onChange(e.target.value);
50701
+ clearErrors("newOwnerEmailAddress");
50462
50702
  },
50463
- placeholder: "Enter email address",
50464
- 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")
50465
50712
  })
50466
- }))), (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, {
50467
50714
  style: errorStyle
50468
- }, 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, {
50469
- style: {
50470
- display: "flex",
50471
- flexDirection: "column",
50472
- alignItems: "flex-start",
50473
- gap: "4px"
50474
- }
50475
- }, /*#__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, {
50476
50716
  style: {
50477
- margin: 0,
50478
50717
  fontWeight: "bold"
50479
50718
  }
50480
- }, "RELATIONSHIP WITH EXISTING CONSUMER*"), /*#__PURE__*/React__default.createElement("div", {
50481
- className: "field",
50482
- style: {
50483
- width: "100%"
50484
- }
50485
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50719
+ }, "Reason for Name Change / Mutation ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50486
50720
  control: control,
50487
- name: "relationshipWithExistingConsumer",
50721
+ name: "reasonForNameChange",
50488
50722
  rules: {
50489
- required: "Required field"
50723
+ required: "Please select a reason for mutation"
50490
50724
  },
50491
50725
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
50492
50726
  selected: props.value,
50493
- option: relationshipOptions,
50494
- select: e => {
50495
- props.onChange(e);
50727
+ option: reasonOptions,
50728
+ select: val => {
50729
+ props.onChange(val);
50730
+ setTouched(p => _extends({}, p, {
50731
+ reasonForNameChange: true
50732
+ }));
50496
50733
  },
50497
50734
  optionKey: "i18nKey",
50498
50735
  t: t,
50499
- placeholder: "Select relationship"
50736
+ placeholder: "Select reason"
50500
50737
  })
50501
- }))), (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, {
50502
50739
  style: errorStyle
50503
- }, 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", {
50504
- style: {
50505
- display: "flex",
50506
- flexDirection: "column",
50507
- gap: "20px"
50508
- }
50509
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50510
- style: {
50511
- display: "flex",
50512
- flexDirection: "column",
50513
- alignItems: "flex-start",
50514
- gap: "4px"
50515
- }
50516
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50517
- style: {
50518
- margin: 0,
50519
- fontWeight: "bold"
50520
- }
50521
- }, "REASON FOR NAME CHANGE*"), /*#__PURE__*/React__default.createElement("div", {
50522
- className: "field",
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, {
50523
50741
  style: {
50524
- width: "100%"
50742
+ fontWeight: "bold",
50743
+ color: isOtherReason ? "inherit" : "#999"
50525
50744
  }
50526
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50745
+ }, "Relationship with Existing Consumer ", isOtherReason && mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50527
50746
  control: control,
50528
- name: "reasonForNameChange",
50747
+ name: "relationshipWithExistingConsumer",
50529
50748
  rules: {
50530
- required: "Required field"
50749
+ required: isOtherReason ? "Relationship is required when 'Other Reason' is selected" : false
50531
50750
  },
50532
50751
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
50533
50752
  selected: props.value,
50534
- option: reasonOptions,
50535
- select: e => {
50536
- props.onChange(e);
50753
+ option: relationshipOptions,
50754
+ select: val => {
50755
+ props.onChange(val);
50756
+ setTouched(p => _extends({}, p, {
50757
+ relationshipWithExistingConsumer: true
50758
+ }));
50537
50759
  },
50538
50760
  optionKey: "i18nKey",
50539
50761
  t: t,
50540
- placeholder: "Select reason"
50762
+ placeholder: "Select relationship",
50763
+ disable: !isOtherReason
50541
50764
  })
50542
- }))), (errors === null || errors === void 0 ? void 0 : errors.reasonForNameChange) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50543
- style: errorStyle
50544
- }, 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", {
50545
50766
  style: {
50546
- marginTop: "10px",
50547
- padding: "20px",
50548
- border: "1px dashed #ccc",
50549
- borderRadius: "8px",
50550
- backgroundColor: "#fafafa"
50767
+ fontSize: "11px",
50768
+ color: "#999",
50769
+ marginTop: "4px",
50770
+ display: "block"
50551
50771
  }
50552
- }, /*#__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", {
50553
50775
  style: {
50554
50776
  display: "flex",
50555
- flexDirection: "column",
50556
- alignItems: "flex-start",
50557
- gap: "4px"
50777
+ justifyContent: "space-between",
50778
+ alignItems: "center",
50779
+ marginTop: "24px"
50558
50780
  }
50559
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50781
+ }, /*#__PURE__*/React__default.createElement("button", {
50782
+ type: "button",
50783
+ onClick: onBack,
50560
50784
  style: {
50561
- margin: 0,
50785
+ padding: "8px 24px",
50786
+ backgroundColor: "#e0e0e0",
50787
+ border: "none",
50788
+ borderRadius: "4px",
50789
+ cursor: "pointer",
50562
50790
  fontWeight: "bold"
50563
50791
  }
50564
- }, "UPLOAD REGISTERED SALE DEED*"), /*#__PURE__*/React__default.createElement("p", {
50792
+ }, "\u2190 Back"), /*#__PURE__*/React__default.createElement("div", {
50565
50793
  style: {
50566
- color: "#666",
50567
- fontSize: "12px",
50568
- marginBottom: "15px",
50569
- marginTop: "5px"
50794
+ display: "flex",
50795
+ alignItems: "center",
50796
+ gap: "12px"
50570
50797
  }
50571
- }, "Submit a clear scan of the stamp duty Registered Sale Deed."), /*#__PURE__*/React__default.createElement("div", {
50572
- className: "field",
50798
+ }, /*#__PURE__*/React__default.createElement("span", {
50573
50799
  style: {
50574
- width: "100%"
50800
+ fontSize: "12px",
50801
+ color: "#999"
50575
50802
  }
50576
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
50577
- id: "sale-deed-upload",
50578
- onUpload: e => {
50579
- setFile(e.target.files[0]);
50580
- },
50581
- onDelete: () => {
50582
- setUploadedFile(null);
50583
- setFile(null);
50584
- },
50585
- message: uploadedFile ? "1 File Uploaded" : "Click to upload document",
50586
- accept: "image/*, .pdf, .png, .jpeg, .jpg",
50587
- uploadedFiles: uploadedFile && !file ? [["Document", {
50588
- fileStoreId: uploadedFile
50589
- }]] : undefined,
50590
- removeTargetedFile: () => {
50591
- setUploadedFile(null);
50592
- setFile(null);
50803
+ }, "Fields marked with ", /*#__PURE__*/React__default.createElement("span", {
50804
+ style: {
50805
+ color: "#d32f2f"
50593
50806
  }
50594
- }))), isUploading && /*#__PURE__*/React__default.createElement("span", {
50807
+ }, "*"), " are mandatory"), /*#__PURE__*/React__default.createElement("button", {
50808
+ type: "submit",
50595
50809
  style: {
50596
- color: "#00497e",
50597
- fontWeight: "bold",
50598
- fontSize: "12px"
50810
+ padding: "10px 24px",
50811
+ backgroundColor: "#00497e",
50812
+ color: "white",
50813
+ border: "none",
50814
+ borderRadius: "4px",
50815
+ cursor: "pointer",
50816
+ fontWeight: "bold"
50599
50817
  }
50600
- }, "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
+ }));
50601
50825
  };
50602
50826
 
50603
- const MutationApplication = () => {
50604
- var _state, _details, _details2, _details2$application, _applicationDetails$a, _applicationDetails$a2, _applicationDetails$a3, _applicationDetails$a4, _applicationDetails$a5, _applicationDetails$a6, _applicationDetails$a7;
50605
- const _useTranslation = reactI18next.useTranslation(),
50606
- t = _useTranslation.t;
50607
- let _useLocation = reactRouterDom.useLocation(),
50608
- state = _useLocation.state;
50609
- state = state ? typeof state === "string" ? JSON.parse(state) : state : {};
50610
- const history = reactRouterDom.useHistory();
50611
- let filters = getQueryStringParams(location.search);
50612
- const _useState = React.useState(false),
50613
- canSubmit = _useState[0],
50614
- setSubmitValve = _useState[1];
50615
- const _useState2 = React.useState(null),
50616
- showToast = _useState2[0],
50617
- setShowToast = _useState2[1];
50618
- const _useState3 = React.useState({}),
50619
- appData = _useState3[0],
50620
- setAppData = _useState3[1];
50621
- const _useState4 = React.useState({
50622
- head: "",
50623
- 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
50624
50848
  }),
50625
- config = _useState4[0],
50626
- setConfig = _useState4[1];
50627
- const _useState5 = React.useState(true),
50628
- enabledLoader = _useState5[0],
50629
- setEnabledLoader = _useState5[1];
50849
+ rawFiles = _useState5[0],
50850
+ setRawFiles = _useState5[1];
50630
50851
  const _useState6 = React.useState(false),
50631
- isAppDetailsPage = _useState6[0];
50632
- const _useState7 = React.useState(false),
50633
- isEnableLoader = _useState7[0],
50634
- setIsEnableLoader = _useState7[1];
50635
- let tenantId = Digit.ULBService.getCurrentTenantId();
50636
- const applicationNumber = filters === null || filters === void 0 ? void 0 : filters.applicationNumber;
50637
- const serviceType = filters === null || filters === void 0 ? void 0 : filters.service;
50638
- const stateId = Digit.ULBService.getStateId();
50639
- let _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(stateId, {}),
50640
- newConfig = _Digit$Hooks$ws$useWS.data,
50641
- isConfigLoading = _Digit$Hooks$ws$useWS.isLoading;
50642
- let details = cloneDeep_1((_state = state) === null || _state === void 0 ? void 0 : _state.data);
50643
- 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)),
50644
- applicationDetails = _Digit$Hooks$ws$useWS2.data;
50645
- details = applicationDetails;
50646
- const _useState8 = React.useState(new URLSearchParams(reactRouterDom.useLocation().search).get("propertyId")),
50647
- propertyId = _useState8[0],
50648
- setPropertyId = _useState8[1];
50649
- const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM", {}),
50650
- sessionFormData = _Digit$Hooks$useSessi[0],
50651
- setSessionFormData = _Digit$Hooks$useSessi[1],
50652
- clearSessionFormData = _Digit$Hooks$useSessi[2];
50653
- const _Digit$Hooks$pt$usePr = Digit.Hooks.pt.usePropertySearch({
50654
- filters: {
50655
- propertyIds: propertyId
50656
- },
50657
- tenantId: tenantId
50658
- }, {
50659
- filters: {
50660
- propertyIds: propertyId
50661
- },
50662
- tenantId: tenantId,
50663
- enabled: propertyId && propertyId != "" ? true : false
50664
- }),
50665
- propertyDetails = _Digit$Hooks$pt$usePr.data;
50666
- React.useEffect(() => {
50667
- if (!isConfigLoading && newConfig && Array.isArray(newConfig)) {
50668
- const config = cloneDeep_1(newConfig.find(conf => conf.hideInCitizen && conf.isModify));
50669
- if (config) {
50670
- var _config$body;
50671
- config.head = "WS_WATER_AND_SEWERAGE_MUTATION_CONNECTION_LABEL";
50672
- let bodyDetails = [];
50673
- config === null || config === void 0 ? void 0 : (_config$body = config.body) === null || _config$body === void 0 ? void 0 : _config$body.forEach(data => {
50674
- if (data !== null && data !== void 0 && data.isModifyConnection) bodyDetails.push(data);
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) {
50919
+ try {
50920
+ const sizeError = validateFileSize(file);
50921
+ if (sizeError) {
50922
+ setShowToast({
50923
+ key: "error",
50924
+ message: sizeError
50675
50925
  });
50676
- bodyDetails.forEach(bdyData => {
50677
- if ((bdyData === null || bdyData === void 0 ? void 0 : bdyData.head) === "WS_COMMON_PROPERTY_DETAILS") {
50678
- bdyData.head = "";
50679
- bdyData.className = "mutation-disabled-section";
50680
- } else if ((bdyData === null || bdyData === void 0 ? void 0 : bdyData.head) === "WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER") {
50681
- bdyData.head = "Specify ownership updates and transfer reason:";
50682
- bdyData.body = [{
50683
- type: "component",
50684
- key: "MutationApplicantDetails",
50685
- component: WSMutationApplicantDetails,
50686
- withoutLabel: true
50687
- }];
50688
- } else {
50689
- bdyData.head = "";
50690
- bdyData.className = "mutation-hidden-section";
50691
- }
50926
+ return Promise.resolve();
50927
+ }
50928
+ const typeError = validateFileType(file);
50929
+ if (typeError) {
50930
+ setShowToast({
50931
+ key: "error",
50932
+ message: typeError
50692
50933
  });
50693
- config.body = bodyDetails;
50694
- setConfig(config);
50934
+ return Promise.resolve();
50695
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
+ }
50960
+ });
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
+ });
50973
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
50974
+ } catch (e) {
50975
+ return Promise.reject(e);
50696
50976
  }
50697
- }, [newConfig]);
50977
+ };
50698
50978
  React.useEffect(() => {
50699
- var _sessionFormData$cpt, _sessionFormData$cpt$, _sessionFormData$cpt2, _sessionFormData$cpt3;
50700
- !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);
50701
- }, [sessionFormData === null || sessionFormData === void 0 ? void 0 : sessionFormData.cpt]);
50702
- React.useEffect(function () {
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) {
50703
51344
  try {
50704
- const IsDetailsExists = sessionStorage.getItem("IsDetailsExists") ? JSON.parse(sessionStorage.getItem("IsDetailsExists")) : false;
50705
- const _temp = function (_details3, _details3$application) {
50706
- if ((_details3 = details) !== null && _details3 !== void 0 && (_details3$application = _details3.applicationData) !== null && _details3$application !== void 0 && _details3$application.id) {
50707
- var _details4, _details4$application;
50708
- 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) {
50709
- setSessionFormData(prev => _extends({}, prev, convertAppData));
50710
- setAppData(prev => _extends({}, prev, convertAppData));
50711
- sessionStorage.setItem("IsDetailsExists", JSON.stringify(true));
50712
- });
50713
- }
50714
- }();
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
+ });
50715
51358
  return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
50716
51359
  } catch (e) {
50717
51360
  return Promise.reject(e);
50718
51361
  }
50719
- }, [details, applicationDetails]);
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]);
50720
51836
  React.useEffect(() => {
50721
51837
  var _propertyDetails$Prop;
50722
51838
  if (propertyDetails !== null && propertyDetails !== void 0 && (_propertyDetails$Prop = propertyDetails.Properties) !== null && _propertyDetails$Prop !== void 0 && _propertyDetails$Prop[0]) {
@@ -50730,220 +51846,311 @@ const MutationApplication = () => {
50730
51846
  });
50731
51847
  }
50732
51848
  }, [propertyDetails]);
50733
- React.useEffect(() => {
50734
- var _sessionFormData$Conn, _sessionFormData$Conn2;
50735
- 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) {
50736
- setEnabledLoader(false);
50737
- }
50738
- }, [propertyDetails, sessionFormData, sessionFormData === null || sessionFormData === void 0 ? void 0 : sessionFormData.cpt]);
50739
- React.useEffect(() => {
50740
- const timer = setTimeout(() => {
50741
- var _sessionFormData$Conn3, _sessionFormData$Conn4, _sessionFormData$Conn5, _sessionFormData$Conn6, _sessionFormData$Conn7;
50742
- 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());
50743
- }, 3000);
50744
- return () => clearTimeout(timer);
50745
- }, [isAppDetailsPage]);
50746
51849
  const _Digit$Hooks$ws$useWa = Digit.Hooks.ws.useWaterCreateAPI("WATER"),
50747
51850
  waterMutation = _Digit$Hooks$ws$useWa.mutate;
50748
- const _Digit$Hooks$ws$useWS3 = Digit.Hooks.ws.useWSApplicationActions("WATER");
50749
51851
  const _Digit$Hooks$ws$useWa2 = Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),
50750
51852
  sewerageMutation = _Digit$Hooks$ws$useWa2.mutate;
50751
- const _Digit$Hooks$ws$useWS4 = Digit.Hooks.ws.useWSApplicationActions("SEWERAGE");
50752
- const onFormValueChange = (setValue, formData, formState) => {
50753
- var _formData$cpt, _formData$cpt$details;
50754
- const updatedData = _extends({}, sessionFormData, formData);
50755
- if (!lodash.isEqual(sessionFormData, updatedData)) {
50756
- setSessionFormData(updatedData);
50757
- }
50758
- 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);
50759
51861
  };
50760
- 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 () {
50761
51868
  try {
50762
- var _finalData$cpt, _propertyDetails$Prop3;
50763
- let finalData = _extends({}, sessionFormData, data);
50764
- 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])) {
50765
- var _finalData$cpt2;
50766
- if (!(finalData !== null && finalData !== void 0 && (_finalData$cpt2 = finalData.cpt) !== null && _finalData$cpt2 !== void 0 && _finalData$cpt2.details) || !propertyDetails) {
50767
- setShowToast({
50768
- key: "error",
50769
- message: "ERR_INVALID_PROPERTY_ID"
50770
- });
50771
- 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
+ };
50772
51878
  }
50773
- }
50774
- const _temp7 = function () {
50775
- if (!canSubmit) {
50776
- setShowToast({
50777
- warning: true,
50778
- message: "PLEASE_FILL_MANDATORY_DETAILS"
50779
- });
50780
- setTimeout(() => {
50781
- setShowToast(false);
50782
- }, 3000);
50783
- } else {
50784
- var _finalData$cpt3;
50785
- if (!(finalData !== null && finalData !== void 0 && (_finalData$cpt3 = finalData.cpt) !== null && _finalData$cpt3 !== void 0 && _finalData$cpt3.details)) {
50786
- var _propertyDetails$Prop4;
50787
- finalData.cpt = {
50788
- details: propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop4 = propertyDetails.Properties) === null || _propertyDetails$Prop4 === void 0 ? void 0 : _propertyDetails$Prop4[0]
50789
- };
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();
50790
51905
  }
50791
51906
  if (finalData !== null && finalData !== void 0 && finalData.MutationApplicantDetails) {
50792
- var _finalData$Connection;
51907
+ var _mutDetails$reasonFor;
50793
51908
  const mutDetails = finalData.MutationApplicantDetails;
50794
- const existingHolder = (finalData === null || finalData === void 0 ? void 0 : (_finalData$Connection = finalData.ConnectionHolderDetails) === null || _finalData$Connection === void 0 ? void 0 : _finalData$Connection[0]) || {};
50795
- finalData.ConnectionHolderDetails = [_extends({}, existingHolder, {
50796
- name: mutDetails.proposedNewConsumerName || existingHolder.name,
50797
- mobileNumber: mutDetails.newOwnerMobileNumber || existingHolder.mobileNumber,
50798
- emailId: mutDetails.newOwnerEmailAddress || existingHolder.emailId,
50799
- sameAsOwnerDetails: false
50800
- })];
50801
- }
50802
- const details = sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS") ? JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")) : {};
50803
- return Promise.resolve(convertModifyApplicationDetails(finalData, details, "APPLY_MUTATION")).then(function (convertAppData) {
50804
- function _temp6() {
50805
- const _temp4 = function () {
50806
- if (serviceType !== "WATER") {
50807
- const _temp3 = function () {
50808
- if (sewerageMutation) {
50809
- setIsEnableLoader(true);
50810
- return Promise.resolve(sewerageMutation(reqDetails, {
50811
- onError: (error, variables) => {
50812
- var _error$response, _error$response$data, _error$response$data$, _error$response$data$2, _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
50813
- setIsEnableLoader(false);
50814
- setShowToast({
50815
- key: "error",
50816
- 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
50817
- });
50818
- setTimeout(closeToastOfError, 5000);
50819
- },
50820
- onSuccess: function (data, variables) {
50821
- try {
50822
- var _data$SewerageConnect, _data$SewerageConnect2;
50823
- clearSessionFormData();
50824
- 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));
50825
- return Promise.resolve();
50826
- } catch (e) {
50827
- return Promise.reject(e);
50828
- }
50829
- }
50830
- })).then(function () {});
50831
- }
50832
- }();
50833
- if (_temp3 && _temp3.then) return _temp3.then(function () {});
50834
- }
50835
- }();
50836
- 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";
50837
51916
  }
50838
- if (finalData !== null && finalData !== void 0 && finalData.MutationApplicantDetails) {
50839
- var _mutDetails$reasonFor;
50840
- const mutDetails = finalData.MutationApplicantDetails;
50841
- if (!convertAppData.additionalDetails) convertAppData.additionalDetails = {};
50842
- if (mutDetails.reasonForNameChange) convertAppData.additionalDetails.reasonForNameChange = ((_mutDetails$reasonFor = mutDetails.reasonForNameChange) === null || _mutDetails$reasonFor === void 0 ? void 0 : _mutDetails$reasonFor.code) || mutDetails.reasonForNameChange;
50843
- if (mutDetails.relationshipWithExistingConsumer) {
50844
- var _mutDetails$relations;
50845
- const relationCode = ((_mutDetails$relations = mutDetails.relationshipWithExistingConsumer) === null || _mutDetails$relations === void 0 ? void 0 : _mutDetails$relations.code) || mutDetails.relationshipWithExistingConsumer;
50846
- convertAppData.additionalDetails.relationshipWithExistingConsumer = relationCode;
50847
- convertAppData.additionalDetails.isBloodRelation = relationCode !== "OTHER";
50848
- }
50849
- if (mutDetails.saleDeedDocumentId) {
50850
- convertAppData.additionalDetails.saleDeedDocumentId = mutDetails.saleDeedDocumentId;
50851
- if (!convertAppData.documents) convertAppData.documents = [];
50852
- convertAppData.documents.push({
50853
- documentType: "REGISTERED_SALE_DEED",
50854
- fileStoreId: mutDetails.saleDeedDocumentId,
50855
- 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
50856
51969
  });
51970
+ return;
50857
51971
  }
50858
- }
50859
- convertAppData.applicationType = serviceType == "WATER" ? "MUTATION_WATER_CONNECTION" : "MUTATION_SEWERAGE_CONNECTION";
50860
- const reqDetails = serviceType == "WATER" ? {
50861
- WaterConnection: convertAppData,
50862
- reconnectRequest: false,
50863
- disconnectRequest: false
50864
- } : {
50865
- SewerageConnection: convertAppData,
50866
- reconnectRequest: false,
50867
- disconnectRequest: false
50868
- };
50869
- const _temp5 = function () {
50870
- if (serviceType == "WATER") {
50871
- const _temp2 = function () {
50872
- if (waterMutation) {
50873
- setIsEnableLoader(true);
50874
- return Promise.resolve(waterMutation(reqDetails, {
50875
- onError: (error, variables) => {
50876
- var _error$response3, _error$response3$data, _error$response3$data2, _error$response4, _error$response4$data, _error$response4$data2;
50877
- setIsEnableLoader(false);
50878
- setShowToast({
50879
- key: "error",
50880
- 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
50881
- });
50882
- setTimeout(closeToastOfError, 5000);
50883
- },
50884
- onSuccess: function (data, variables) {
50885
- try {
50886
- var _data$WaterConnection, _data$WaterConnection2;
50887
- clearSessionFormData();
50888
- 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));
50889
- return Promise.resolve();
50890
- } catch (e) {
50891
- return Promise.reject(e);
50892
- }
50893
- }
50894
- })).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);
50895
52033
  }
50896
- }();
50897
- if (_temp2 && _temp2.then) return _temp2.then(function () {});
52034
+ });
50898
52035
  }
50899
- }();
50900
- return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
50901
- });
50902
- }
50903
- }();
50904
- 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);
50905
52048
  } catch (e) {
50906
52049
  return Promise.reject(e);
50907
52050
  }
50908
52051
  };
50909
- const closeToastOfError = () => {
50910
- setShowToast(null);
50911
- };
50912
- const closeToast = () => {
50913
- 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
+ }
50914
52065
  };
50915
- 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) {
50916
52089
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
50917
52090
  }
50918
- 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, {
50919
- label: t("WS_MYCONNECTIONS_APPLICATION_NO"),
50920
- text: (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a = applicationDetails.applicationData) === null || _applicationDetails$a === void 0 ? void 0 : _applicationDetails$a.applicationNo) || "NA"
50921
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50922
- label: t("WS_CONNECTION_CATEGORY"),
50923
- text: (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a2 = applicationDetails.applicationData) === null || _applicationDetails$a2 === void 0 ? void 0 : _applicationDetails$a2.connectionCategory) || "NA"
50924
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50925
- label: t("WS_PROPERTY_ID_LABEL"),
50926
- text: (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a3 = applicationDetails.applicationData) === null || _applicationDetails$a3 === void 0 ? void 0 : _applicationDetails$a3.propertyId) || propertyId || "NA"
50927
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50928
- label: t("WS_APPLICATION_ID"),
50929
- 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"
50930
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50931
- label: t("WS_CONNECTION_DATE"),
50932
- 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"
50933
- }))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormComposer, {
50934
- config: config.body,
50935
- userType: "employee",
50936
- onFormValueChange: onFormValueChange,
50937
- label: t("CS_COMMON_SUBMIT"),
50938
- onSubmit: onSubmit,
50939
- defaultValues: sessionFormData,
50940
- 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)
50941
52147
  }), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
50942
- isDleteBtn: true,
50943
- 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",
50944
52150
  label: t(showToast === null || showToast === void 0 ? void 0 : showToast.message),
50945
- onClose: closeToast
50946
- }));
52151
+ onClose: () => setShowToast(null),
52152
+ isDleteBtn: true
52153
+ }))));
50947
52154
  };
50948
52155
 
50949
52156
  const getPath$5 = (path, params) => {