@djb25/digit-ui-module-wt 1.0.76 → 1.0.78

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.
@@ -1,4 +1,4 @@
1
- import { TickMark, ArrowDown, ViewsIcon, TextInput, MobileNumber, CardLabelError, Dropdown, DatePicker, SubmitBar, Card, Table, Loader, Modal, Toast, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, CitizenHomeCard, CHBIcon, PropertyHouse, HomeIcon, KeyNote, CardHeader, FormStep, CardLabel, RadioButtons, UploadFile, TextArea, CheckBox, CardSubHeader, StatusTable, Row, GenericFileIcon, LinkButton, EditIcon, Banner, EmployeeModuleCard, CloseSvg, Label, LinkLabel, ActionBar, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, CustomNameDropdown, MultiSelectDropdown, CollapsibleCardPage as CollapsibleCardPage$1, LabelFieldPair, AddIcon, ToggleSwitch, Menu, CheckSvg, LayoutWrapper, Header, TelePhone, DisplayPhotos, CardSectionHeader, CheckPoint, ConnectingCheckPoints, MultiLink, RemoveableTag, FormComposer, PDFSvg, MultiUploadWrapper, Close as Close$g, BreakLine, InfoBannerIcon, ButtonSelector, LocationIcon, PTIcon, ApplicantDetails, AddressDetails } from '@djb25/digit-ui-react-components';
1
+ import { TickMark, ArrowDown, ViewsIcon, TextInput, MobileNumber, CardLabelError, Dropdown, DatePicker, SubmitBar, Card, Table, Loader, Modal, Toast, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, CitizenHomeCard, CHBIcon, PropertyHouse, HomeIcon, KeyNote, CardHeader, FormStep, CardLabel, RadioButtons, UploadFile, TextArea, CheckBox, CardSubHeader, StatusTable, Row, GenericFileIcon, LinkButton, EditIcon, CardText, Banner, EmployeeModuleCard, CloseSvg, Label, LinkLabel, ActionBar, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, CustomNameDropdown, MultiSelectDropdown, CollapsibleCardPage as CollapsibleCardPage$1, LabelFieldPair, AddIcon, ToggleSwitch, Menu, CheckSvg, LayoutWrapper, Header, TelePhone, DisplayPhotos, CardSectionHeader, CheckPoint, ConnectingCheckPoints, MultiLink, RemoveableTag, FormComposer, PDFSvg, MultiUploadWrapper, Close as Close$g, BreakLine, InfoBannerIcon, ButtonSelector, LocationIcon, PTIcon, ApplicantDetails, AddressDetails } from '@djb25/digit-ui-react-components';
2
2
  import React, { useRef, useEffect, useState, useCallback, useMemo, Fragment, useReducer } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useLocation, useRouteMatch, useHistory, Switch, Route, Redirect, Link, useParams } from 'react-router-dom';
@@ -2864,6 +2864,7 @@ const BannerPicker = props => {
2864
2864
  });
2865
2865
  };
2866
2866
  const WTAcknowledgement = _ref => {
2867
+ var _mutation$data2, _mutation$data3, _mutation$data4, _mutation$data4$data, _mutation$data4$data$, _mutation$data4$data$2, _mutation$error, _mutation$error$respo, _mutation$error$respo2, _mutation$error$respo3, _mutation$error$respo4;
2867
2868
  let data = _ref.data,
2868
2869
  onSuccess = _ref.onSuccess;
2869
2870
  const _useTranslation2 = useTranslation(),
@@ -2880,9 +2881,15 @@ const WTAcknowledgement = _ref => {
2880
2881
  data.tenantId = tenantId;
2881
2882
  let formdata = waterTankerPayload(data);
2882
2883
  mutation.mutate(formdata, {
2883
- onSuccess
2884
+ onSuccess: res => {
2885
+ if (!(res !== null && res !== void 0 && res.error)) {
2886
+ onSuccess();
2887
+ }
2888
+ }
2884
2889
  });
2885
- } catch (err) {}
2890
+ } catch (err) {
2891
+ console.error("WT payload construction error:", err);
2892
+ }
2886
2893
  }, []);
2887
2894
  Digit.Hooks.useCustomBackNavigation({
2888
2895
  redirectPath: "${APPLICATION_PATH}/citizen"
@@ -2900,21 +2907,29 @@ const WTAcknowledgement = _ref => {
2900
2907
  return Promise.reject(e);
2901
2908
  }
2902
2909
  };
2910
+ const isMutationSuccess = mutation.isSuccess && !((_mutation$data2 = mutation.data) !== null && _mutation$data2 !== void 0 && _mutation$data2.error);
2911
+ const isMutationError = mutation.isError || mutation.isSuccess && ((_mutation$data3 = mutation.data) === null || _mutation$data3 === void 0 ? void 0 : _mutation$data3.error);
2903
2912
  return mutation.isLoading || mutation.isIdle ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Card, {
2904
2913
  className: "vehicle-details-card"
2905
2914
  }, /*#__PURE__*/React.createElement(BannerPicker, {
2906
2915
  t: t,
2907
2916
  data: mutation.data,
2908
- isSuccess: mutation.isSuccess,
2917
+ isSuccess: isMutationSuccess,
2909
2918
  isLoading: mutation.isIdle || mutation.isLoading
2910
- }), /*#__PURE__*/React.createElement(StatusTable, null, mutation.isSuccess && /*#__PURE__*/React.createElement(Row, {
2919
+ }), isMutationError && /*#__PURE__*/React.createElement(CardText, {
2920
+ style: {
2921
+ color: "#d4351c",
2922
+ textAlign: "center",
2923
+ marginTop: "8px"
2924
+ }
2925
+ }, ((_mutation$data4 = mutation.data) === null || _mutation$data4 === void 0 ? void 0 : (_mutation$data4$data = _mutation$data4.data) === null || _mutation$data4$data === void 0 ? void 0 : (_mutation$data4$data$ = _mutation$data4$data.Errors) === null || _mutation$data4$data$ === void 0 ? void 0 : (_mutation$data4$data$2 = _mutation$data4$data$[0]) === null || _mutation$data4$data$2 === void 0 ? void 0 : _mutation$data4$data$2.message) || ((_mutation$error = mutation.error) === null || _mutation$error === void 0 ? void 0 : (_mutation$error$respo = _mutation$error.response) === null || _mutation$error$respo === void 0 ? void 0 : (_mutation$error$respo2 = _mutation$error$respo.data) === null || _mutation$error$respo2 === void 0 ? void 0 : (_mutation$error$respo3 = _mutation$error$respo2.Errors) === null || _mutation$error$respo3 === void 0 ? void 0 : (_mutation$error$respo4 = _mutation$error$respo3[0]) === null || _mutation$error$respo4 === void 0 ? void 0 : _mutation$error$respo4.message) || t("WT_SUBMISSION_FAILED_MESSAGE")), /*#__PURE__*/React.createElement(StatusTable, null, isMutationSuccess && /*#__PURE__*/React.createElement(Row, {
2911
2926
  rowContainerStyle: rowContainerStyle,
2912
2927
  last: true,
2913
2928
  textStyle: {
2914
2929
  whiteSpace: "pre",
2915
2930
  width: "60%"
2916
2931
  }
2917
- })), mutation.isSuccess && /*#__PURE__*/React.createElement(SubmitBar, {
2932
+ })), isMutationSuccess && /*#__PURE__*/React.createElement(SubmitBar, {
2918
2933
  label: t("WT_DOWNLOAD_ACKNOWLEDGEMENT"),
2919
2934
  onSubmit: handleDownloadPdf
2920
2935
  }), (user === null || user === void 0 ? void 0 : user.type) === "CITIZEN" ? /*#__PURE__*/React.createElement(Link, {
@@ -18404,6 +18419,9 @@ const WTEditApplicationModal = _ref => {
18404
18419
  }),
18405
18420
  formData = _useState[0],
18406
18421
  setFormData = _useState[1];
18422
+ const _useState2 = useState(null),
18423
+ showToast = _useState2[0],
18424
+ setShowToast = _useState2[1];
18407
18425
  const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVendorSearch({
18408
18426
  tenantId,
18409
18427
  filters: _extends({}, getFirstAvailable(formData === null || formData === void 0 ? void 0 : (_formData$dispatchDet = formData.dispatchDetails) === null || _formData$dispatchDet === void 0 ? void 0 : (_formData$dispatchDet2 = _formData$dispatchDet.fillingPoint) === null || _formData$dispatchDet2 === void 0 ? void 0 : _formData$dispatchDet2.id, formData === null || formData === void 0 ? void 0 : (_formData$dispatchDet3 = formData.dispatchDetails) === null || _formData$dispatchDet3 === void 0 ? void 0 : (_formData$dispatchDet4 = _formData$dispatchDet3.fillingPoint) === null || _formData$dispatchDet4 === void 0 ? void 0 : _formData$dispatchDet4.fillingPointId, formData === null || formData === void 0 ? void 0 : (_formData$dispatchDet5 = formData.dispatchDetails) === null || _formData$dispatchDet5 === void 0 ? void 0 : (_formData$dispatchDet6 = _formData$dispatchDet5.fillingPoint) === null || _formData$dispatchDet6 === void 0 ? void 0 : _formData$dispatchDet6.bookingId) ? {
@@ -18693,12 +18711,18 @@ const WTEditApplicationModal = _ref => {
18693
18711
  window.location.reload();
18694
18712
  },
18695
18713
  onError: error => {
18714
+ var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
18696
18715
  console.error("Update Error:", error);
18716
+ setShowToast({
18717
+ isError: true,
18718
+ label: (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) || t("WT_APPLICATION_UPDATE_FAILED")
18719
+ });
18720
+ setTimeout(() => setShowToast(null), 5000);
18697
18721
  }
18698
18722
  });
18699
18723
  };
18700
18724
  if (mutation.isLoading) return /*#__PURE__*/React.createElement(Loader, null);
18701
- return /*#__PURE__*/React.createElement(Modal, {
18725
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal, {
18702
18726
  headerBarMain: /*#__PURE__*/React.createElement("h1", {
18703
18727
  className: "heading-m"
18704
18728
  }, t("WT_EDIT_APPLICATION_DETAILS")),
@@ -19105,7 +19129,11 @@ const WTEditApplicationModal = _ref => {
19105
19129
  })),
19106
19130
  optionKey: "name",
19107
19131
  t: t
19108
- }))))));
19132
+ })))))), showToast && /*#__PURE__*/React.createElement(Toast, {
19133
+ error: showToast.isError,
19134
+ label: showToast.label,
19135
+ onClose: () => setShowToast(null)
19136
+ }));
19109
19137
  };
19110
19138
 
19111
19139
  const TripImages = _ref => {
@@ -22112,14 +22140,6 @@ const ActionModal$5 = _ref => {
22112
22140
  if (parsedAdhocRebateData !== null && parsedAdhocRebateData !== void 0 && (_parsedAdhocRebateDat7 = parsedAdhocRebateData.value) !== null && _parsedAdhocRebateDat7 !== void 0 && _parsedAdhocRebateDat7.adhocRebate) applicationData.additionalDetails.adhocRebate = parseInt(parsedAdhocRebateData === null || parsedAdhocRebateData === void 0 ? void 0 : (_parsedAdhocRebateDat8 = parsedAdhocRebateData.value) === null || _parsedAdhocRebateDat8 === void 0 ? void 0 : _parsedAdhocRebateDat8.adhocRebate) || "";
22113
22141
  if (parsedAdhocRebateData !== null && parsedAdhocRebateData !== void 0 && (_parsedAdhocRebateDat9 = parsedAdhocRebateData.value) !== null && _parsedAdhocRebateDat9 !== void 0 && _parsedAdhocRebateDat9.adhocRebateComment) applicationData.additionalDetails.adhocRebateComment = (parsedAdhocRebateData === null || parsedAdhocRebateData === void 0 ? void 0 : (_parsedAdhocRebateDat0 = parsedAdhocRebateData.value) === null || _parsedAdhocRebateDat0 === void 0 ? void 0 : _parsedAdhocRebateDat0.adhocRebateComment) || "";
22114
22142
  if (parsedAdhocRebateData !== null && parsedAdhocRebateData !== void 0 && (_parsedAdhocRebateDat1 = parsedAdhocRebateData.value) !== null && _parsedAdhocRebateDat1 !== void 0 && _parsedAdhocRebateDat1.adhocRebateReason) applicationData.additionalDetails.adhocRebateReason = (parsedAdhocRebateData === null || parsedAdhocRebateData === void 0 ? void 0 : (_parsedAdhocRebateDat10 = parsedAdhocRebateData.value) === null || _parsedAdhocRebateDat10 === void 0 ? void 0 : _parsedAdhocRebateDat10.adhocRebateReason) || "";
22115
- const inspectionInformationData = sessionStorage.getItem("Digit.INSPECTION_INFORMATION_DATA");
22116
- if (inspectionInformationData) {
22117
- try {
22118
- applicationData.inspectionInformation = JSON.parse(inspectionInformationData);
22119
- } catch (e) {
22120
- console.error("Error parsing inspection information data", e);
22121
- }
22122
- }
22123
22143
  ((_applicationData12 = applicationData) === null || _applicationData12 === void 0 ? void 0 : _applicationData12.serviceType) == "WATER" ? submitAction({
22124
22144
  WaterConnection: applicationData,
22125
22145
  disconnectRequest: false,
@@ -25831,29 +25851,7 @@ const ViewBreakup = _ref => {
25831
25851
  textStyle: {
25832
25852
  textAlign: "right"
25833
25853
  }
25834
- })), /*#__PURE__*/React.createElement("hr", {
25835
- style: {
25836
- color: "#cccccc",
25837
- backgroundColor: "#cccccc",
25838
- marginBottom: "10px"
25839
- }
25840
- }), /*#__PURE__*/React.createElement(Row, {
25841
- className: "border-none",
25842
- rowContainerStyle: {
25843
- margin: "0px"
25844
- },
25845
- labelStyle: {
25846
- width: "50%"
25847
- },
25848
- key: "PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",
25849
- label: "" + t("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),
25850
- text: /*#__PURE__*/React.createElement("span", null, "\u20B9", Number(breakUpData === null || breakUpData === void 0 ? void 0 : breakUpData.fee) || 0),
25851
- textStyle: {
25852
- textAlign: "right",
25853
- fontWeight: "700",
25854
- fontSize: "24px"
25855
- }
25856
- }), /*#__PURE__*/React.createElement(CardSectionHeader, {
25854
+ })), /*#__PURE__*/React.createElement(CardSectionHeader, {
25857
25855
  style: {
25858
25856
  margin: "10px 0px"
25859
25857
  }
@@ -25871,29 +25869,7 @@ const ViewBreakup = _ref => {
25871
25869
  textStyle: {
25872
25870
  textAlign: "right"
25873
25871
  }
25874
- })), /*#__PURE__*/React.createElement("hr", {
25875
- style: {
25876
- color: "#cccccc",
25877
- backgroundColor: "#cccccc",
25878
- marginBottom: "10px"
25879
- }
25880
- }), /*#__PURE__*/React.createElement(Row, {
25881
- className: "border-none",
25882
- rowContainerStyle: {
25883
- margin: "0px"
25884
- },
25885
- labelStyle: {
25886
- width: "50%"
25887
- },
25888
- key: "PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT2",
25889
- label: "" + t("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),
25890
- text: /*#__PURE__*/React.createElement("span", null, "\u20B9", Number(breakUpData === null || breakUpData === void 0 ? void 0 : breakUpData.charge) || 0),
25891
- textStyle: {
25892
- textAlign: "right",
25893
- fontWeight: "700",
25894
- fontSize: "24px"
25895
- }
25896
- }), breakUpData === null || breakUpData === void 0 ? void 0 : (_breakUpData$billSlab5 = breakUpData.billSlabData) === null || _breakUpData$billSlab5 === void 0 ? void 0 : (_breakUpData$billSlab6 = _breakUpData$billSlab5.TAX) === null || _breakUpData$billSlab6 === void 0 ? void 0 : _breakUpData$billSlab6.map(data => /*#__PURE__*/React.createElement(Row, {
25872
+ })), breakUpData === null || breakUpData === void 0 ? void 0 : (_breakUpData$billSlab5 = breakUpData.billSlabData) === null || _breakUpData$billSlab5 === void 0 ? void 0 : (_breakUpData$billSlab6 = _breakUpData$billSlab5.TAX) === null || _breakUpData$billSlab6 === void 0 ? void 0 : _breakUpData$billSlab6.map(data => /*#__PURE__*/React.createElement(Row, {
25897
25873
  className: "border-none",
25898
25874
  rowContainerStyle: {
25899
25875
  margin: "0px"
@@ -26225,7 +26201,8 @@ const DueVerification = _ref => {
26225
26201
  return newData;
26226
26202
  });
26227
26203
  }, [applicationData]);
26228
- const isPendingApproval = (applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_APPROVAL_FOR_CONNECTION";
26204
+ const isPendingApproval = (applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_APPROVAL_FOR_CONNECTION" || (applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_FOR_CONNECTION_ACTIVATION";
26205
+ const isActivation = (applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_FOR_CONNECTION_ACTIVATION";
26229
26206
  const columns = useMemo(() => {
26230
26207
  const baseColumns = [{
26231
26208
  Header: t("K No."),
@@ -26250,7 +26227,7 @@ const DueVerification = _ref => {
26250
26227
  Cell: _ref2 => {
26251
26228
  let row = _ref2.row,
26252
26229
  value = _ref2.value;
26253
- return /*#__PURE__*/React.createElement(TextInput, {
26230
+ return isActivation ? value || "-" : /*#__PURE__*/React.createElement(TextInput, {
26254
26231
  style: {
26255
26232
  marginBottom: "0px",
26256
26233
  minWidth: "150px"
@@ -26297,7 +26274,7 @@ const DueVerification = _ref => {
26297
26274
  fontWeight: "bold",
26298
26275
  marginBottom: "16px"
26299
26276
  }
26300
- }, t("Due Verification")), /*#__PURE__*/React.createElement("div", {
26277
+ }, t("Due Verification")), !isActivation && /*#__PURE__*/React.createElement("div", {
26301
26278
  style: {
26302
26279
  display: "flex",
26303
26280
  alignItems: "flex-end",
@@ -26344,25 +26321,19 @@ const DueVerification = _ref => {
26344
26321
  }
26345
26322
  }, /*#__PURE__*/React.createElement(AddIcon, null)))), tableData.length > 0 && /*#__PURE__*/React.createElement("div", {
26346
26323
  style: {
26347
- marginTop: "30px",
26324
+ marginTop: "15px",
26348
26325
  overflowX: "auto"
26349
26326
  }
26350
26327
  }, /*#__PURE__*/React.createElement(Table, {
26351
26328
  className: "customTable table-fixed-first-column table-border-style",
26352
26329
  t: t,
26330
+ totalRecords: tableData.length,
26353
26331
  disableSort: false,
26354
26332
  autoSort: true,
26355
- manualPagination: false,
26356
- isPaginationRequired: false,
26333
+ manualPagination: true,
26334
+ isPaginationRequired: true,
26357
26335
  data: tableData,
26358
- columns: columns,
26359
- getCellProps: cellInfo => {
26360
- return {
26361
- style: {
26362
- padding: "12px"
26363
- }
26364
- };
26365
- }
26336
+ columns: columns
26366
26337
  })));
26367
26338
  };
26368
26339
 
@@ -26380,30 +26351,35 @@ const InspectionInformation = _ref => {
26380
26351
  inspectorName = _useState3[0],
26381
26352
  setInspectorName = _useState3[1];
26382
26353
  useEffect(() => {
26383
- const savedData = sessionStorage.getItem("Digit.INSPECTION_INFORMATION_DATA");
26384
- if (savedData) {
26385
- try {
26386
- const parsed = JSON.parse(savedData);
26387
- setInspectionType(parsed.inspectionType || null);
26388
- setInspectionDate(parsed.inspectionDate || "");
26389
- setInspectorName(parsed.inspectorName || "");
26390
- } catch (e) {
26391
- console.error("Error parsing inspection information data", e);
26392
- }
26393
- } else if (applicationData !== null && applicationData !== void 0 && applicationData.inspectionInformation) {
26394
- setInspectionType(applicationData.inspectionInformation.inspectionType || null);
26395
- setInspectionDate(applicationData.inspectionInformation.inspectionDate || "");
26354
+ if (applicationData !== null && applicationData !== void 0 && applicationData.inspectionInformation) {
26355
+ const apiInspectionType = applicationData.inspectionInformation.inspectionType;
26356
+ let matchedType = null;
26357
+ const inspectionCode = typeof apiInspectionType === "object" && apiInspectionType !== null ? apiInspectionType.code : apiInspectionType;
26358
+ if (inspectionCode) {
26359
+ matchedType = [{
26360
+ i18nKey: "ES_COMMON_SELECT",
26361
+ code: ""
26362
+ }, {
26363
+ i18nKey: "New Connection Visit",
26364
+ code: "new_connection_visit"
26365
+ }].find(opt => opt.code === inspectionCode || opt.i18nKey === inspectionCode);
26366
+ }
26367
+ setInspectionType(matchedType || null);
26368
+ let dateValue = applicationData.inspectionInformation.inspectionDate || "";
26369
+ if (dateValue && typeof dateValue === 'number') {
26370
+ const d = new Date(dateValue);
26371
+ dateValue = d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
26372
+ } else if (dateValue && typeof dateValue === 'string' && dateValue.includes('-')) ; else if (dateValue) {
26373
+ const num = Number(dateValue);
26374
+ if (!isNaN(num)) {
26375
+ const d = new Date(num);
26376
+ dateValue = d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
26377
+ }
26378
+ }
26379
+ setInspectionDate(dateValue);
26396
26380
  setInspectorName(applicationData.inspectionInformation.inspectorName || "");
26397
- sessionStorage.setItem("Digit.INSPECTION_INFORMATION_DATA", JSON.stringify(applicationData.inspectionInformation));
26398
26381
  }
26399
26382
  }, [applicationData]);
26400
- useEffect(() => {
26401
- sessionStorage.setItem("Digit.INSPECTION_INFORMATION_DATA", JSON.stringify({
26402
- inspectionType,
26403
- inspectionDate,
26404
- inspectorName
26405
- }));
26406
- }, [inspectionType, inspectionDate, inspectorName]);
26407
26383
  const inspectionTypeOptions = [{
26408
26384
  i18nKey: "ES_COMMON_SELECT",
26409
26385
  code: ""
@@ -26411,6 +26387,23 @@ const InspectionInformation = _ref => {
26411
26387
  i18nKey: "New Connection Visit",
26412
26388
  code: "new_connection_visit"
26413
26389
  }];
26390
+ const handleInspectionTypeChange = selected => {
26391
+ setInspectionType(selected);
26392
+ if (!applicationData.inspectionInformation) applicationData.inspectionInformation = {};
26393
+ applicationData.inspectionInformation.inspectionType = selected;
26394
+ };
26395
+ const handleInspectionDateChange = date => {
26396
+ setInspectionDate(date);
26397
+ if (!applicationData.inspectionInformation) applicationData.inspectionInformation = {};
26398
+ applicationData.inspectionInformation.inspectionDate = date ? new Date(date).getTime() : null;
26399
+ };
26400
+ const handleInspectorNameChange = e => {
26401
+ const val = e.target.value;
26402
+ setInspectorName(val);
26403
+ if (!applicationData.inspectionInformation) applicationData.inspectionInformation = {};
26404
+ applicationData.inspectionInformation.inspectorName = val;
26405
+ };
26406
+ const readOnly = (applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_FOR_CONNECTION_ACTIVATION";
26414
26407
  return /*#__PURE__*/React.createElement("div", {
26415
26408
  style: {
26416
26409
  marginBottom: "20px"
@@ -26430,79 +26423,53 @@ const InspectionInformation = _ref => {
26430
26423
  }
26431
26424
  }, /*#__PURE__*/React.createElement("div", {
26432
26425
  style: {
26433
- flex: "1"
26426
+ flex: 1
26434
26427
  }
26435
26428
  }, /*#__PURE__*/React.createElement("span", {
26436
26429
  style: {
26437
26430
  fontSize: "16px",
26438
- color: "#0B0C0C",
26439
26431
  marginBottom: "8px",
26440
26432
  display: "inline-block"
26441
26433
  }
26442
- }, t("Inspection Type"), " ", /*#__PURE__*/React.createElement("span", {
26443
- style: {
26444
- color: "red"
26445
- }
26446
- }, "*")), /*#__PURE__*/React.createElement(Dropdown, {
26434
+ }, t("Inspection Type")), /*#__PURE__*/React.createElement(Dropdown, {
26447
26435
  option: inspectionTypeOptions,
26448
26436
  optionKey: "i18nKey",
26449
- id: "inspectionType",
26450
26437
  selected: inspectionType,
26451
- select: setInspectionType,
26438
+ select: handleInspectionTypeChange,
26452
26439
  t: t,
26453
- style: {
26454
- width: "100%"
26455
- }
26440
+ disable: readOnly
26456
26441
  })), /*#__PURE__*/React.createElement("div", {
26457
26442
  style: {
26458
- flex: "1"
26443
+ flex: 1
26459
26444
  }
26460
26445
  }, /*#__PURE__*/React.createElement("span", {
26461
26446
  style: {
26462
26447
  fontSize: "16px",
26463
- color: "#0B0C0C",
26464
26448
  marginBottom: "8px",
26465
26449
  display: "inline-block"
26466
26450
  }
26467
- }, t("Inspection Date"), " ", /*#__PURE__*/React.createElement("span", {
26468
- style: {
26469
- color: "red"
26470
- }
26471
- }, "*")), /*#__PURE__*/React.createElement(DatePicker, {
26451
+ }, t("Inspection Date")), /*#__PURE__*/React.createElement(DatePicker, {
26472
26452
  date: inspectionDate,
26473
- onChange: setInspectionDate,
26474
- style: {
26475
- width: "100%"
26476
- }
26453
+ onChange: handleInspectionDateChange,
26454
+ disabled: readOnly
26477
26455
  }))), /*#__PURE__*/React.createElement("div", {
26478
26456
  style: {
26479
- display: "flex",
26480
- gap: "20px",
26481
- marginBottom: "20px",
26482
- flexWrap: "wrap"
26457
+ display: "flex"
26483
26458
  }
26484
26459
  }, /*#__PURE__*/React.createElement("div", {
26485
26460
  style: {
26486
- flex: "1"
26461
+ flex: 1
26487
26462
  }
26488
26463
  }, /*#__PURE__*/React.createElement("span", {
26489
26464
  style: {
26490
26465
  fontSize: "16px",
26491
- color: "#0B0C0C",
26492
26466
  marginBottom: "8px",
26493
26467
  display: "inline-block"
26494
26468
  }
26495
- }, t("Inspector Name"), " ", /*#__PURE__*/React.createElement("span", {
26496
- style: {
26497
- color: "red"
26498
- }
26499
- }, "*")), /*#__PURE__*/React.createElement(TextInput, {
26469
+ }, t("Inspector Name")), /*#__PURE__*/React.createElement(TextInput, {
26500
26470
  value: inspectorName,
26501
- onChange: e => setInspectorName(e.target.value),
26502
- style: {
26503
- width: "50%",
26504
- marginBottom: "0"
26505
- }
26471
+ onChange: handleInspectorNameChange,
26472
+ disabled: readOnly
26506
26473
  }))));
26507
26474
  };
26508
26475
 
@@ -27018,9 +26985,11 @@ function ApplicationDetailsContent(_ref) {
27018
26985
  }), (detail === null || detail === void 0 ? void 0 : (_detail$additionalDet17 = detail.additionalDetails) === null || _detail$additionalDet17 === void 0 ? void 0 : _detail$additionalDet17.documents) && /*#__PURE__*/React.createElement(PropertyDocuments, {
27019
26986
  documents: detail === null || detail === void 0 ? void 0 : (_detail$additionalDet18 = detail.additionalDetails) === null || _detail$additionalDet18 === void 0 ? void 0 : _detail$additionalDet18.documents,
27020
26987
  applicationStatus: applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus
27021
- }), (detail === null || detail === void 0 ? void 0 : (_detail$additionalDet19 = detail.additionalDetails) === null || _detail$additionalDet19 === void 0 ? void 0 : _detail$additionalDet19.documents) && ((applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_FOR_FIELD_INSPECTION" || (applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_APPROVAL_FOR_CONNECTION") && /*#__PURE__*/React.createElement(DueVerification, {
26988
+ }), (detail === null || detail === void 0 ? void 0 : (_detail$additionalDet19 = detail.additionalDetails) === null || _detail$additionalDet19 === void 0 ? void 0 : _detail$additionalDet19.documents) && ((applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_FOR_FIELD_INSPECTION" || (applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_APPROVAL_FOR_CONNECTION" || (applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_FOR_CONNECTION_ACTIVATION" || (applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_FOR_RECONNECTION") && /*#__PURE__*/React.createElement(DueVerification, {
26989
+ applicationData: applicationData
26990
+ }), " ", (detail === null || detail === void 0 ? void 0 : (_detail$additionalDet20 = detail.additionalDetails) === null || _detail$additionalDet20 === void 0 ? void 0 : _detail$additionalDet20.documents) && ((applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_APPROVAL_FOR_CONNECTION" || (applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_FOR_CONNECTION_ACTIVATION") && /*#__PURE__*/React.createElement(InspectionInformation, {
27022
26991
  applicationData: applicationData
27023
- }), (detail === null || detail === void 0 ? void 0 : (_detail$additionalDet20 = detail.additionalDetails) === null || _detail$additionalDet20 === void 0 ? void 0 : _detail$additionalDet20.documents) && (applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationStatus) === "PENDING_APPROVAL_FOR_CONNECTION" && /*#__PURE__*/React.createElement(InspectionInformation, null), (detail === null || detail === void 0 ? void 0 : (_detail$additionalDet21 = detail.additionalDetails) === null || _detail$additionalDet21 === void 0 ? void 0 : _detail$additionalDet21.taxHeadEstimatesCalculation) && /*#__PURE__*/React.createElement(PropertyEstimates, {
26992
+ }), (detail === null || detail === void 0 ? void 0 : (_detail$additionalDet21 = detail.additionalDetails) === null || _detail$additionalDet21 === void 0 ? void 0 : _detail$additionalDet21.taxHeadEstimatesCalculation) && /*#__PURE__*/React.createElement(PropertyEstimates, {
27024
26993
  taxHeadEstimatesCalculation: detail === null || detail === void 0 ? void 0 : (_detail$additionalDet22 = detail.additionalDetails) === null || _detail$additionalDet22 === void 0 ? void 0 : _detail$additionalDet22.taxHeadEstimatesCalculation
27025
26994
  }), (detail === null || detail === void 0 ? void 0 : detail.isWaterConnectionDetails) && /*#__PURE__*/React.createElement(WSAdditonalDetails, {
27026
26995
  wsAdditionalDetails: detail,
@@ -28668,6 +28637,7 @@ const BannerPicker$1 = props => {
28668
28637
  });
28669
28638
  };
28670
28639
  const MTAcknowledgement = _ref => {
28640
+ var _mutation$data2, _mutation$data3, _mutation$data4, _mutation$data4$data, _mutation$data4$data$, _mutation$data4$data$2, _mutation$error, _mutation$error$respo, _mutation$error$respo2, _mutation$error$respo3, _mutation$error$respo4;
28671
28641
  let data = _ref.data,
28672
28642
  onSuccess = _ref.onSuccess;
28673
28643
  const _useTranslation2 = useTranslation(),
@@ -28684,9 +28654,15 @@ const MTAcknowledgement = _ref => {
28684
28654
  data.tenantId = tenantId;
28685
28655
  let formdata = mobileToiletPayload(data);
28686
28656
  mutation.mutate(formdata, {
28687
- onSuccess
28657
+ onSuccess: res => {
28658
+ if (!(res !== null && res !== void 0 && res.error)) {
28659
+ onSuccess();
28660
+ }
28661
+ }
28688
28662
  });
28689
- } catch (err) {}
28663
+ } catch (err) {
28664
+ console.error("MT payload construction error:", err);
28665
+ }
28690
28666
  }, []);
28691
28667
  Digit.Hooks.useCustomBackNavigation({
28692
28668
  redirectPath: '${APPLICATION_PATH}/citizen'
@@ -28704,19 +28680,27 @@ const MTAcknowledgement = _ref => {
28704
28680
  return Promise.reject(e);
28705
28681
  }
28706
28682
  };
28683
+ const isMutationSuccess = mutation.isSuccess && !((_mutation$data2 = mutation.data) !== null && _mutation$data2 !== void 0 && _mutation$data2.error);
28684
+ const isMutationError = mutation.isError || mutation.isSuccess && ((_mutation$data3 = mutation.data) === null || _mutation$data3 === void 0 ? void 0 : _mutation$data3.error);
28707
28685
  return mutation.isLoading || mutation.isIdle ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(BannerPicker$1, {
28708
28686
  t: t,
28709
28687
  data: mutation.data,
28710
- isSuccess: mutation.isSuccess,
28688
+ isSuccess: isMutationSuccess,
28711
28689
  isLoading: mutation.isIdle || mutation.isLoading
28712
- }), /*#__PURE__*/React.createElement(StatusTable, null, mutation.isSuccess && /*#__PURE__*/React.createElement(Row, {
28690
+ }), isMutationError && /*#__PURE__*/React.createElement(CardText, {
28691
+ style: {
28692
+ color: "#d4351c",
28693
+ textAlign: "center",
28694
+ marginTop: "8px"
28695
+ }
28696
+ }, ((_mutation$data4 = mutation.data) === null || _mutation$data4 === void 0 ? void 0 : (_mutation$data4$data = _mutation$data4.data) === null || _mutation$data4$data === void 0 ? void 0 : (_mutation$data4$data$ = _mutation$data4$data.Errors) === null || _mutation$data4$data$ === void 0 ? void 0 : (_mutation$data4$data$2 = _mutation$data4$data$[0]) === null || _mutation$data4$data$2 === void 0 ? void 0 : _mutation$data4$data$2.message) || ((_mutation$error = mutation.error) === null || _mutation$error === void 0 ? void 0 : (_mutation$error$respo = _mutation$error.response) === null || _mutation$error$respo === void 0 ? void 0 : (_mutation$error$respo2 = _mutation$error$respo.data) === null || _mutation$error$respo2 === void 0 ? void 0 : (_mutation$error$respo3 = _mutation$error$respo2.Errors) === null || _mutation$error$respo3 === void 0 ? void 0 : (_mutation$error$respo4 = _mutation$error$respo3[0]) === null || _mutation$error$respo4 === void 0 ? void 0 : _mutation$error$respo4.message) || t("MT_SUBMISSION_FAILED_MESSAGE")), /*#__PURE__*/React.createElement(StatusTable, null, isMutationSuccess && /*#__PURE__*/React.createElement(Row, {
28713
28697
  rowContainerStyle: rowContainerStyle$1,
28714
28698
  last: true,
28715
28699
  textStyle: {
28716
28700
  whiteSpace: "pre",
28717
28701
  width: "60%"
28718
28702
  }
28719
- })), mutation.isSuccess && /*#__PURE__*/React.createElement(SubmitBar, {
28703
+ })), isMutationSuccess && /*#__PURE__*/React.createElement(SubmitBar, {
28720
28704
  label: t("MT_DOWNLOAD_ACKNOWLEDGEMENT"),
28721
28705
  onSubmit: handleDownloadPdf
28722
28706
  }), (user === null || user === void 0 ? void 0 : user.type) === "CITIZEN" ? /*#__PURE__*/React.createElement(Link, {
@@ -28838,6 +28822,7 @@ const BannerPicker$2 = props => {
28838
28822
  });
28839
28823
  };
28840
28824
  const TPAcknowledgement = _ref => {
28825
+ var _mutation$data2, _mutation$data3, _mutation$data4, _mutation$data4$data, _mutation$data4$data$, _mutation$data4$data$2, _mutation$error, _mutation$error$respo, _mutation$error$respo2, _mutation$error$respo3, _mutation$error$respo4;
28841
28826
  let data = _ref.data,
28842
28827
  onSuccess = _ref.onSuccess;
28843
28828
  const _useTranslation2 = useTranslation(),
@@ -28854,9 +28839,15 @@ const TPAcknowledgement = _ref => {
28854
28839
  data.tenantId = tenantId;
28855
28840
  let formdata = treePruningPayload(data);
28856
28841
  mutation.mutate(formdata, {
28857
- onSuccess
28842
+ onSuccess: res => {
28843
+ if (!(res !== null && res !== void 0 && res.error)) {
28844
+ onSuccess();
28845
+ }
28846
+ }
28858
28847
  });
28859
- } catch (err) {}
28848
+ } catch (err) {
28849
+ console.error("TP payload construction error:", err);
28850
+ }
28860
28851
  }, []);
28861
28852
  Digit.Hooks.useCustomBackNavigation({
28862
28853
  redirectPath: '${APPLICATION_PATH}/citizen'
@@ -28874,19 +28865,27 @@ const TPAcknowledgement = _ref => {
28874
28865
  return Promise.reject(e);
28875
28866
  }
28876
28867
  };
28868
+ const isMutationSuccess = mutation.isSuccess && !((_mutation$data2 = mutation.data) !== null && _mutation$data2 !== void 0 && _mutation$data2.error);
28869
+ const isMutationError = mutation.isError || mutation.isSuccess && ((_mutation$data3 = mutation.data) === null || _mutation$data3 === void 0 ? void 0 : _mutation$data3.error);
28877
28870
  return mutation.isLoading || mutation.isIdle ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(BannerPicker$2, {
28878
28871
  t: t,
28879
28872
  data: mutation.data,
28880
- isSuccess: mutation.isSuccess,
28873
+ isSuccess: isMutationSuccess,
28881
28874
  isLoading: mutation.isIdle || mutation.isLoading
28882
- }), /*#__PURE__*/React.createElement(StatusTable, null, mutation.isSuccess && /*#__PURE__*/React.createElement(Row, {
28875
+ }), isMutationError && /*#__PURE__*/React.createElement(CardText, {
28876
+ style: {
28877
+ color: "#d4351c",
28878
+ textAlign: "center",
28879
+ marginTop: "8px"
28880
+ }
28881
+ }, ((_mutation$data4 = mutation.data) === null || _mutation$data4 === void 0 ? void 0 : (_mutation$data4$data = _mutation$data4.data) === null || _mutation$data4$data === void 0 ? void 0 : (_mutation$data4$data$ = _mutation$data4$data.Errors) === null || _mutation$data4$data$ === void 0 ? void 0 : (_mutation$data4$data$2 = _mutation$data4$data$[0]) === null || _mutation$data4$data$2 === void 0 ? void 0 : _mutation$data4$data$2.message) || ((_mutation$error = mutation.error) === null || _mutation$error === void 0 ? void 0 : (_mutation$error$respo = _mutation$error.response) === null || _mutation$error$respo === void 0 ? void 0 : (_mutation$error$respo2 = _mutation$error$respo.data) === null || _mutation$error$respo2 === void 0 ? void 0 : (_mutation$error$respo3 = _mutation$error$respo2.Errors) === null || _mutation$error$respo3 === void 0 ? void 0 : (_mutation$error$respo4 = _mutation$error$respo3[0]) === null || _mutation$error$respo4 === void 0 ? void 0 : _mutation$error$respo4.message) || t("TP_SUBMISSION_FAILED_MESSAGE")), /*#__PURE__*/React.createElement(StatusTable, null, isMutationSuccess && /*#__PURE__*/React.createElement(Row, {
28883
28882
  rowContainerStyle: rowContainerStyle$2,
28884
28883
  last: true,
28885
28884
  textStyle: {
28886
28885
  whiteSpace: "pre",
28887
28886
  width: "60%"
28888
28887
  }
28889
- })), mutation.isSuccess && /*#__PURE__*/React.createElement(SubmitBar, {
28888
+ })), isMutationSuccess && /*#__PURE__*/React.createElement(SubmitBar, {
28890
28889
  label: t("TP_DOWNLOAD_ACKNOWLEDGEMENT"),
28891
28890
  onSubmit: handleDownloadPdf
28892
28891
  }), (user === null || user === void 0 ? void 0 : user.type) === "CITIZEN" ? /*#__PURE__*/React.createElement(Link, {
@@ -30088,6 +30087,7 @@ const BannerPicker$3 = props => {
30088
30087
  });
30089
30088
  };
30090
30089
  const WTEmergencyFixedPointAcknowledgement = _ref => {
30090
+ var _mutation$data2, _mutation$data3, _mutation$data4, _mutation$data4$data, _mutation$data4$data$, _mutation$data4$data$2, _mutation$error, _mutation$error$respo, _mutation$error$respo2, _mutation$error$respo3, _mutation$error$respo4;
30091
30091
  let data = _ref.data,
30092
30092
  onSuccess = _ref.onSuccess;
30093
30093
  const _useTranslation2 = useTranslation(),
@@ -30104,9 +30104,15 @@ const WTEmergencyFixedPointAcknowledgement = _ref => {
30104
30104
  data.tenantId = tenantId;
30105
30105
  let formdata = emergencyWaterTankerPayload(data);
30106
30106
  mutation.mutate(formdata, {
30107
- onSuccess
30107
+ onSuccess: res => {
30108
+ if (!(res !== null && res !== void 0 && res.error)) {
30109
+ onSuccess();
30110
+ }
30111
+ }
30108
30112
  });
30109
- } catch (err) {}
30113
+ } catch (err) {
30114
+ console.error("Emergency WT payload construction error:", err);
30115
+ }
30110
30116
  }, []);
30111
30117
  Digit.Hooks.useCustomBackNavigation({
30112
30118
  redirectPath: "${APPLICATION_PATH}/citizen"
@@ -30124,21 +30130,29 @@ const WTEmergencyFixedPointAcknowledgement = _ref => {
30124
30130
  return Promise.reject(e);
30125
30131
  }
30126
30132
  };
30133
+ const isMutationSuccess = mutation.isSuccess && !((_mutation$data2 = mutation.data) !== null && _mutation$data2 !== void 0 && _mutation$data2.error);
30134
+ const isMutationError = mutation.isError || mutation.isSuccess && ((_mutation$data3 = mutation.data) === null || _mutation$data3 === void 0 ? void 0 : _mutation$data3.error);
30127
30135
  return mutation.isLoading || mutation.isIdle ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Card, {
30128
30136
  className: "vehicle-details-card"
30129
30137
  }, /*#__PURE__*/React.createElement(BannerPicker$3, {
30130
30138
  t: t,
30131
30139
  data: mutation.data,
30132
- isSuccess: mutation.isSuccess,
30140
+ isSuccess: isMutationSuccess,
30133
30141
  isLoading: mutation.isIdle || mutation.isLoading
30134
- }), /*#__PURE__*/React.createElement(StatusTable, null, mutation.isSuccess && /*#__PURE__*/React.createElement(Row, {
30142
+ }), isMutationError && /*#__PURE__*/React.createElement(CardText, {
30143
+ style: {
30144
+ color: "#d4351c",
30145
+ textAlign: "center",
30146
+ marginTop: "8px"
30147
+ }
30148
+ }, ((_mutation$data4 = mutation.data) === null || _mutation$data4 === void 0 ? void 0 : (_mutation$data4$data = _mutation$data4.data) === null || _mutation$data4$data === void 0 ? void 0 : (_mutation$data4$data$ = _mutation$data4$data.Errors) === null || _mutation$data4$data$ === void 0 ? void 0 : (_mutation$data4$data$2 = _mutation$data4$data$[0]) === null || _mutation$data4$data$2 === void 0 ? void 0 : _mutation$data4$data$2.message) || ((_mutation$error = mutation.error) === null || _mutation$error === void 0 ? void 0 : (_mutation$error$respo = _mutation$error.response) === null || _mutation$error$respo === void 0 ? void 0 : (_mutation$error$respo2 = _mutation$error$respo.data) === null || _mutation$error$respo2 === void 0 ? void 0 : (_mutation$error$respo3 = _mutation$error$respo2.Errors) === null || _mutation$error$respo3 === void 0 ? void 0 : (_mutation$error$respo4 = _mutation$error$respo3[0]) === null || _mutation$error$respo4 === void 0 ? void 0 : _mutation$error$respo4.message) || t("WT_SUBMISSION_FAILED_MESSAGE")), /*#__PURE__*/React.createElement(StatusTable, null, isMutationSuccess && /*#__PURE__*/React.createElement(Row, {
30135
30149
  rowContainerStyle: rowContainerStyle$3,
30136
30150
  last: true,
30137
30151
  textStyle: {
30138
30152
  whiteSpace: "pre",
30139
30153
  width: "60%"
30140
30154
  }
30141
- })), mutation.isSuccess && /*#__PURE__*/React.createElement(SubmitBar, {
30155
+ })), isMutationSuccess && /*#__PURE__*/React.createElement(SubmitBar, {
30142
30156
  label: t("WT_DOWNLOAD_ACKNOWLEDGEMENT"),
30143
30157
  onSubmit: handleDownloadPdf
30144
30158
  }), (user === null || user === void 0 ? void 0 : user.type) === "CITIZEN" ? /*#__PURE__*/React.createElement(Link, {
@@ -30180,6 +30194,7 @@ const BannerPicker$4 = props => {
30180
30194
  });
30181
30195
  };
30182
30196
  const MTEmergencyFixedPointAcknowledgement = _ref => {
30197
+ var _mutation$data2, _mutation$data3, _mutation$data4, _mutation$data4$data, _mutation$data4$data$, _mutation$data4$data$2, _mutation$error, _mutation$error$respo, _mutation$error$respo2, _mutation$error$respo3, _mutation$error$respo4;
30183
30198
  let data = _ref.data,
30184
30199
  onSuccess = _ref.onSuccess;
30185
30200
  const _useTranslation2 = useTranslation(),
@@ -30196,9 +30211,15 @@ const MTEmergencyFixedPointAcknowledgement = _ref => {
30196
30211
  data.tenantId = tenantId;
30197
30212
  let formdata = mobileToiletPayload(data);
30198
30213
  mutation.mutate(formdata, {
30199
- onSuccess
30214
+ onSuccess: res => {
30215
+ if (!(res !== null && res !== void 0 && res.error)) {
30216
+ onSuccess();
30217
+ }
30218
+ }
30200
30219
  });
30201
- } catch (err) {}
30220
+ } catch (err) {
30221
+ console.error("Emergency MT payload construction error:", err);
30222
+ }
30202
30223
  }, []);
30203
30224
  Digit.Hooks.useCustomBackNavigation({
30204
30225
  redirectPath: '${APPLICATION_PATH}/citizen'
@@ -30216,19 +30237,27 @@ const MTEmergencyFixedPointAcknowledgement = _ref => {
30216
30237
  return Promise.reject(e);
30217
30238
  }
30218
30239
  };
30240
+ const isMutationSuccess = mutation.isSuccess && !((_mutation$data2 = mutation.data) !== null && _mutation$data2 !== void 0 && _mutation$data2.error);
30241
+ const isMutationError = mutation.isError || mutation.isSuccess && ((_mutation$data3 = mutation.data) === null || _mutation$data3 === void 0 ? void 0 : _mutation$data3.error);
30219
30242
  return mutation.isLoading || mutation.isIdle ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(BannerPicker$4, {
30220
30243
  t: t,
30221
30244
  data: mutation.data,
30222
- isSuccess: mutation.isSuccess,
30245
+ isSuccess: isMutationSuccess,
30223
30246
  isLoading: mutation.isIdle || mutation.isLoading
30224
- }), /*#__PURE__*/React.createElement(StatusTable, null, mutation.isSuccess && /*#__PURE__*/React.createElement(Row, {
30247
+ }), isMutationError && /*#__PURE__*/React.createElement(CardText, {
30248
+ style: {
30249
+ color: "#d4351c",
30250
+ textAlign: "center",
30251
+ marginTop: "8px"
30252
+ }
30253
+ }, ((_mutation$data4 = mutation.data) === null || _mutation$data4 === void 0 ? void 0 : (_mutation$data4$data = _mutation$data4.data) === null || _mutation$data4$data === void 0 ? void 0 : (_mutation$data4$data$ = _mutation$data4$data.Errors) === null || _mutation$data4$data$ === void 0 ? void 0 : (_mutation$data4$data$2 = _mutation$data4$data$[0]) === null || _mutation$data4$data$2 === void 0 ? void 0 : _mutation$data4$data$2.message) || ((_mutation$error = mutation.error) === null || _mutation$error === void 0 ? void 0 : (_mutation$error$respo = _mutation$error.response) === null || _mutation$error$respo === void 0 ? void 0 : (_mutation$error$respo2 = _mutation$error$respo.data) === null || _mutation$error$respo2 === void 0 ? void 0 : (_mutation$error$respo3 = _mutation$error$respo2.Errors) === null || _mutation$error$respo3 === void 0 ? void 0 : (_mutation$error$respo4 = _mutation$error$respo3[0]) === null || _mutation$error$respo4 === void 0 ? void 0 : _mutation$error$respo4.message) || t("MT_SUBMISSION_FAILED_MESSAGE")), /*#__PURE__*/React.createElement(StatusTable, null, isMutationSuccess && /*#__PURE__*/React.createElement(Row, {
30225
30254
  rowContainerStyle: rowContainerStyle$4,
30226
30255
  last: true,
30227
30256
  textStyle: {
30228
30257
  whiteSpace: "pre",
30229
30258
  width: "60%"
30230
30259
  }
30231
- })), mutation.isSuccess && /*#__PURE__*/React.createElement(SubmitBar, {
30260
+ })), isMutationSuccess && /*#__PURE__*/React.createElement(SubmitBar, {
30232
30261
  label: t("MT_DOWNLOAD_ACKNOWLEDGEMENT"),
30233
30262
  onSubmit: handleDownloadPdf
30234
30263
  }), (user === null || user === void 0 ? void 0 : user.type) === "CITIZEN" ? /*#__PURE__*/React.createElement(Link, {
@@ -30269,6 +30298,7 @@ const BannerPicker$5 = props => {
30269
30298
  });
30270
30299
  };
30271
30300
  const EmergencyFixedPointTPAcknowledgement = _ref => {
30301
+ var _mutation$data2, _mutation$data3, _mutation$data4, _mutation$data4$data, _mutation$data4$data$, _mutation$data4$data$2, _mutation$error, _mutation$error$respo, _mutation$error$respo2, _mutation$error$respo3, _mutation$error$respo4;
30272
30302
  let data = _ref.data,
30273
30303
  onSuccess = _ref.onSuccess;
30274
30304
  const _useTranslation2 = useTranslation(),
@@ -30285,9 +30315,15 @@ const EmergencyFixedPointTPAcknowledgement = _ref => {
30285
30315
  data.tenantId = tenantId;
30286
30316
  let formdata = treePruningPayload(data);
30287
30317
  mutation.mutate(formdata, {
30288
- onSuccess
30318
+ onSuccess: res => {
30319
+ if (!(res !== null && res !== void 0 && res.error)) {
30320
+ onSuccess();
30321
+ }
30322
+ }
30289
30323
  });
30290
- } catch (err) {}
30324
+ } catch (err) {
30325
+ console.error("Emergency TP payload construction error:", err);
30326
+ }
30291
30327
  }, []);
30292
30328
  Digit.Hooks.useCustomBackNavigation({
30293
30329
  redirectPath: '${APPLICATION_PATH}/citizen'
@@ -30305,19 +30341,27 @@ const EmergencyFixedPointTPAcknowledgement = _ref => {
30305
30341
  return Promise.reject(e);
30306
30342
  }
30307
30343
  };
30344
+ const isMutationSuccess = mutation.isSuccess && !((_mutation$data2 = mutation.data) !== null && _mutation$data2 !== void 0 && _mutation$data2.error);
30345
+ const isMutationError = mutation.isError || mutation.isSuccess && ((_mutation$data3 = mutation.data) === null || _mutation$data3 === void 0 ? void 0 : _mutation$data3.error);
30308
30346
  return mutation.isLoading || mutation.isIdle ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(BannerPicker$5, {
30309
30347
  t: t,
30310
30348
  data: mutation.data,
30311
- isSuccess: mutation.isSuccess,
30349
+ isSuccess: isMutationSuccess,
30312
30350
  isLoading: mutation.isIdle || mutation.isLoading
30313
- }), /*#__PURE__*/React.createElement(StatusTable, null, mutation.isSuccess && /*#__PURE__*/React.createElement(Row, {
30351
+ }), isMutationError && /*#__PURE__*/React.createElement(CardText, {
30352
+ style: {
30353
+ color: "#d4351c",
30354
+ textAlign: "center",
30355
+ marginTop: "8px"
30356
+ }
30357
+ }, ((_mutation$data4 = mutation.data) === null || _mutation$data4 === void 0 ? void 0 : (_mutation$data4$data = _mutation$data4.data) === null || _mutation$data4$data === void 0 ? void 0 : (_mutation$data4$data$ = _mutation$data4$data.Errors) === null || _mutation$data4$data$ === void 0 ? void 0 : (_mutation$data4$data$2 = _mutation$data4$data$[0]) === null || _mutation$data4$data$2 === void 0 ? void 0 : _mutation$data4$data$2.message) || ((_mutation$error = mutation.error) === null || _mutation$error === void 0 ? void 0 : (_mutation$error$respo = _mutation$error.response) === null || _mutation$error$respo === void 0 ? void 0 : (_mutation$error$respo2 = _mutation$error$respo.data) === null || _mutation$error$respo2 === void 0 ? void 0 : (_mutation$error$respo3 = _mutation$error$respo2.Errors) === null || _mutation$error$respo3 === void 0 ? void 0 : (_mutation$error$respo4 = _mutation$error$respo3[0]) === null || _mutation$error$respo4 === void 0 ? void 0 : _mutation$error$respo4.message) || t("TP_SUBMISSION_FAILED_MESSAGE")), /*#__PURE__*/React.createElement(StatusTable, null, isMutationSuccess && /*#__PURE__*/React.createElement(Row, {
30314
30358
  rowContainerStyle: rowContainerStyle$5,
30315
30359
  last: true,
30316
30360
  textStyle: {
30317
30361
  whiteSpace: "pre",
30318
30362
  width: "60%"
30319
30363
  }
30320
- })), mutation.isSuccess && /*#__PURE__*/React.createElement(SubmitBar, {
30364
+ })), isMutationSuccess && /*#__PURE__*/React.createElement(SubmitBar, {
30321
30365
  label: t("TP_DOWNLOAD_ACKNOWLEDGEMENT"),
30322
30366
  onSubmit: handleDownloadPdf
30323
30367
  }), (user === null || user === void 0 ? void 0 : user.type) === "CITIZEN" ? /*#__PURE__*/React.createElement(Link, {