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