@mseva/digit-ui-module-ndc 1.0.32 → 1.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1424,9 +1424,14 @@ const ApplicationOverview = () => {
1424
1424
  workflow: {}
1425
1425
  });
1426
1426
  const filtData = data === null || data === void 0 ? void 0 : (_data$Licenses = data.Licenses) === null || _data$Licenses === void 0 ? void 0 : _data$Licenses[0];
1427
+ let checkAssigne;
1428
+ if (filtData.action == "SENDBACKTOCITIZEN") {
1429
+ var _payloadData$owners, _payloadData$owners$;
1430
+ checkAssigne = [payloadData === null || payloadData === void 0 ? void 0 : (_payloadData$owners = payloadData.owners) === null || _payloadData$owners === void 0 ? void 0 : (_payloadData$owners$ = _payloadData$owners[0]) === null || _payloadData$owners$ === void 0 ? void 0 : _payloadData$owners$.uuid];
1431
+ }
1427
1432
  updatedApplicant.workflow = {
1428
1433
  action: filtData.action,
1429
- assignes: filtData === null || filtData === void 0 ? void 0 : filtData.assignee,
1434
+ assignes: (filtData === null || filtData === void 0 ? void 0 : filtData.assignee) || checkAssigne,
1430
1435
  comment: filtData === null || filtData === void 0 ? void 0 : filtData.comment,
1431
1436
  documents: filtData === null || filtData === void 0 ? void 0 : filtData.wfDocuments
1432
1437
  };
@@ -9234,6 +9239,7 @@ const CitizenApplicationOverview = () => {
9234
9239
  className: "ndc_label"
9235
9240
  }, t("NDC_APPLICATION_NDC_DETAILS_OVERVIEW")), displayData === null || displayData === void 0 ? void 0 : (_displayData$NdcDetai2 = displayData.NdcDetails) === null || _displayData$NdcDetai2 === void 0 ? void 0 : _displayData$NdcDetai2.map((detail, index) => {
9236
9241
  var _detail$dueAmount, _propertyDetailsFetch, _propertyDetailsFetch2, _propertyDetailsFetch3, _propertyDetailsFetch4, _propertyDetailsFetch5, _propertyDetailsFetch6, _propertyDetailsFetch7, _propertyDetailsFetch8, _propertyDetailsFetch9, _propertyDetailsFetch0, _propertyDetailsFetch1, _propertyDetailsFetch10, _propertyDetailsFetch11, _propertyDetailsFetch12, _propertyDetailsFetch13, _propertyDetailsFetch14, _propertyDetailsFetch15, _propertyDetailsFetch16, _propertyDetailsFetch17, _propertyDetailsFetch18;
9242
+ const isRed = detail.dueAmount > 0;
9237
9243
  return /*#__PURE__*/React__default.createElement("div", {
9238
9244
  key: index,
9239
9245
  style: {
@@ -9248,10 +9254,17 @@ const CitizenApplicationOverview = () => {
9248
9254
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
9249
9255
  label: t("NDC_CONSUMER_CODE"),
9250
9256
  text: detail.consumerCode || "N/A"
9251
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
9257
+ }), /*#__PURE__*/React__default.createElement("div", {
9258
+ style: {
9259
+ background: isRed ? "red" : "none",
9260
+ color: isRed ? "white" : "black",
9261
+ paddingTop: isRed ? "8px" : "0",
9262
+ paddingLeft: isRed ? "10px" : "0"
9263
+ }
9264
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
9252
9265
  label: t("NDC_DUE_AMOUNT"),
9253
9266
  text: ((_detail$dueAmount = detail.dueAmount) === null || _detail$dueAmount === void 0 ? void 0 : _detail$dueAmount.toString()) || "0"
9254
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
9267
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
9255
9268
  label: t("NDC_PROPERTY_TYPE"),
9256
9269
  text: t(detail.propertyType) || detail.propertyType
9257
9270
  }), (detail === null || detail === void 0 ? void 0 : detail.businessService) == "NDC_PROPERTY_TAX" && (propertyDetailsFetch === null || propertyDetailsFetch === void 0 ? void 0 : propertyDetailsFetch.Properties) && /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
@@ -9414,7 +9427,7 @@ const SearchFormFieldsComponents = _ref => {
9414
9427
  name: "uuid",
9415
9428
  inputRef: registerRef({})
9416
9429
  })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.SearchField, null, /*#__PURE__*/React__default.createElement("label", null, t("CORE_COMMON_PHONE_NUMBER")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
9417
- name: "phoneNumber",
9430
+ name: "mobileNumber",
9418
9431
  inputRef: registerRef({})
9419
9432
  })), /*#__PURE__*/React__default.createElement("div", {
9420
9433
  className: "search-action-wrapper",
@@ -9719,7 +9732,7 @@ const Inbox = _ref => {
9719
9732
  const onSearchFormReset = setSearchFormValue => {
9720
9733
  setSearchFormValue("sourceRefId", null);
9721
9734
  setSearchFormValue("uuid", null);
9722
- setSearchFormValue("phoneNumber", null);
9735
+ setSearchFormValue("mobileNumber", null);
9723
9736
  dispatch({
9724
9737
  action: "mutateSearchForm",
9725
9738
  data: searchFormDefaultValues
@@ -11832,6 +11845,7 @@ const NewNDCStepForm = () => {
11832
11845
  uuid: id
11833
11846
  }, tenantId);
11834
11847
  React.useEffect(() => {
11848
+ console.log("applicationDetails", applicationDetails);
11835
11849
  if (applicationDetails !== null && applicationDetails !== void 0 && applicationDetails.Applications.length) {
11836
11850
  dispatch(updateNDCForm("responseData", applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.Applications));
11837
11851
  }
@@ -11881,8 +11895,10 @@ const NewNDCStepFormOne = _ref => {
11881
11895
  const [showToast, setShowToast] = React.useState(false);
11882
11896
  const [error, setError] = React.useState("");
11883
11897
  const user = Digit.UserService.getUser();
11898
+ const id = window.location.pathname.split("/").pop();
11884
11899
  const currentStepData = reactRedux.useSelector(state => state.ndc.NDCForm.formData && state.ndc.NDCForm.formData[config.key] ? state.ndc.NDCForm.formData[config.key] : {});
11885
11900
  const checkFormData = reactRedux.useSelector(state => state.ndc.NDCForm.formData || {});
11901
+ const checkFormDatass = reactRedux.useSelector(state => state.ndc.NDCForm || {});
11886
11902
  const tenantId = window.localStorage.getItem("CITIZEN.CITY");
11887
11903
  function goNext(data) {
11888
11904
  var _checkFormData$apiDat, _checkFormData$apiDat2, _checkFormData$apiDat3, _checkFormData$respon, _checkFormData$respon2;
@@ -11895,8 +11911,12 @@ const NewNDCStepFormOne = _ref => {
11895
11911
  }, 3000);
11896
11912
  return;
11897
11913
  }
11898
- if (checkFormData !== null && checkFormData !== void 0 && (_checkFormData$apiDat = checkFormData.apiData) !== null && _checkFormData$apiDat !== void 0 && (_checkFormData$apiDat2 = _checkFormData$apiDat.Applications) !== null && _checkFormData$apiDat2 !== void 0 && (_checkFormData$apiDat3 = _checkFormData$apiDat2[0]) !== null && _checkFormData$apiDat3 !== void 0 && _checkFormData$apiDat3.uuid || checkFormData !== null && checkFormData !== void 0 && (_checkFormData$respon = checkFormData.responseData) !== null && _checkFormData$respon !== void 0 && (_checkFormData$respon2 = _checkFormData$respon[0]) !== null && _checkFormData$respon2 !== void 0 && _checkFormData$respon2.uuid) {
11899
- onGoNext();
11914
+ console.log("checkFormData", checkFormData);
11915
+ const isRealId = id && id.startsWith("NDC-");
11916
+ console.log("isRealId", isRealId);
11917
+ if (checkFormData !== null && checkFormData !== void 0 && (_checkFormData$apiDat = checkFormData.apiData) !== null && _checkFormData$apiDat !== void 0 && (_checkFormData$apiDat2 = _checkFormData$apiDat.Applications) !== null && _checkFormData$apiDat2 !== void 0 && (_checkFormData$apiDat3 = _checkFormData$apiDat2[0]) !== null && _checkFormData$apiDat3 !== void 0 && _checkFormData$apiDat3.uuid || checkFormData !== null && checkFormData !== void 0 && (_checkFormData$respon = checkFormData.responseData) !== null && _checkFormData$respon !== void 0 && (_checkFormData$respon2 = _checkFormData$respon[0]) !== null && _checkFormData$respon2 !== void 0 && _checkFormData$respon2.uuid || isRealId) {
11918
+ updateApplication(data);
11919
+ console.log("here bab");
11900
11920
  } else createApplication(data);
11901
11921
  }
11902
11922
  const createApplication = function (data) {
@@ -11995,18 +12015,119 @@ const NewNDCStepFormOne = _ref => {
11995
12015
  return Promise.reject(e);
11996
12016
  }
11997
12017
  };
12018
+ const updateApplication = function (data) {
12019
+ try {
12020
+ var _Digit$UserService$ge2, _data$cpt6, _data$cpt6$details, _user$info5, _user$info6, _data$PropertyDetails1, _user$info7, _user$info8, _data$PropertyDetails10, _data$PropertyDetails12, _data$PropertyDetails14, _data$PropertyDetails15, _data$NDCReason2, _data$cpt1, _data$cpt1$details;
12021
+ const applicant = ((_Digit$UserService$ge2 = Digit.UserService.getUser()) === null || _Digit$UserService$ge2 === void 0 ? void 0 : _Digit$UserService$ge2.info) || {};
12022
+ const auditDetails = data === null || data === void 0 ? void 0 : (_data$cpt6 = data.cpt) === null || _data$cpt6 === void 0 ? void 0 : (_data$cpt6$details = _data$cpt6.details) === null || _data$cpt6$details === void 0 ? void 0 : _data$cpt6$details.auditDetails;
12023
+ const applicantId = applicant === null || applicant === void 0 ? void 0 : applicant.uuid;
12024
+ console.log("data===?????", data);
12025
+ console.log("checkFormData???====", checkFormData);
12026
+ const owners = [{
12027
+ name: user === null || user === void 0 ? void 0 : (_user$info5 = user.info) === null || _user$info5 === void 0 ? void 0 : _user$info5.name,
12028
+ mobileNumber: user === null || user === void 0 ? void 0 : (_user$info6 = user.info) === null || _user$info6 === void 0 ? void 0 : _user$info6.mobileNumber,
12029
+ gender: data === null || data === void 0 ? void 0 : (_data$PropertyDetails1 = data.PropertyDetails) === null || _data$PropertyDetails1 === void 0 ? void 0 : _data$PropertyDetails1.gender,
12030
+ emailId: user === null || user === void 0 ? void 0 : (_user$info7 = user.info) === null || _user$info7 === void 0 ? void 0 : _user$info7.emailId,
12031
+ type: user === null || user === void 0 ? void 0 : (_user$info8 = user.info) === null || _user$info8 === void 0 ? void 0 : _user$info8.type
12032
+ }];
12033
+ const ndcDetails = [];
12034
+ ((data === null || data === void 0 ? void 0 : (_data$PropertyDetails10 = data.PropertyDetails) === null || _data$PropertyDetails10 === void 0 ? void 0 : _data$PropertyDetails10.waterConnection) || []).forEach(wc => {
12035
+ var _wc$billData4, _data$PropertyDetails11, _data$cpt7, _data$cpt7$details, _wc$billData5, _wc$billData6;
12036
+ ndcDetails.push({
12037
+ uuid: wc === null || wc === void 0 ? void 0 : (_wc$billData4 = wc.billData) === null || _wc$billData4 === void 0 ? void 0 : _wc$billData4.id,
12038
+ applicantId: applicantId,
12039
+ businessService: "WS",
12040
+ consumerCode: wc === null || wc === void 0 ? void 0 : wc.connectionNo,
12041
+ additionalDetails: {
12042
+ propertyAddress: data === null || data === void 0 ? void 0 : (_data$PropertyDetails11 = data.PropertyDetails) === null || _data$PropertyDetails11 === void 0 ? void 0 : _data$PropertyDetails11.address,
12043
+ propertyType: data === null || data === void 0 ? void 0 : (_data$cpt7 = data.cpt) === null || _data$cpt7 === void 0 ? void 0 : (_data$cpt7$details = _data$cpt7.details) === null || _data$cpt7$details === void 0 ? void 0 : _data$cpt7$details.usageCategory
12044
+ },
12045
+ dueAmount: (wc === null || wc === void 0 ? void 0 : (_wc$billData5 = wc.billData) === null || _wc$billData5 === void 0 ? void 0 : _wc$billData5.totalAmount) || 0,
12046
+ status: wc === null || wc === void 0 ? void 0 : (_wc$billData6 = wc.billData) === null || _wc$billData6 === void 0 ? void 0 : _wc$billData6.status
12047
+ });
12048
+ });
12049
+ ((data === null || data === void 0 ? void 0 : (_data$PropertyDetails12 = data.PropertyDetails) === null || _data$PropertyDetails12 === void 0 ? void 0 : _data$PropertyDetails12.sewerageConnection) || []).forEach(sc => {
12050
+ var _sc$billData4, _data$PropertyDetails13, _data$cpt8, _data$cpt8$details, _sc$billData5, _sc$billData6;
12051
+ ndcDetails.push({
12052
+ uuid: sc === null || sc === void 0 ? void 0 : (_sc$billData4 = sc.billData) === null || _sc$billData4 === void 0 ? void 0 : _sc$billData4.id,
12053
+ applicantId: applicantId,
12054
+ businessService: "SW",
12055
+ consumerCode: sc === null || sc === void 0 ? void 0 : sc.connectionNo,
12056
+ additionalDetails: {
12057
+ propertyAddress: data === null || data === void 0 ? void 0 : (_data$PropertyDetails13 = data.PropertyDetails) === null || _data$PropertyDetails13 === void 0 ? void 0 : _data$PropertyDetails13.address,
12058
+ propertyType: data === null || data === void 0 ? void 0 : (_data$cpt8 = data.cpt) === null || _data$cpt8 === void 0 ? void 0 : (_data$cpt8$details = _data$cpt8.details) === null || _data$cpt8$details === void 0 ? void 0 : _data$cpt8$details.usageCategory
12059
+ },
12060
+ dueAmount: (sc === null || sc === void 0 ? void 0 : (_sc$billData5 = sc.billData) === null || _sc$billData5 === void 0 ? void 0 : _sc$billData5.totalAmount) || 0,
12061
+ status: sc === null || sc === void 0 ? void 0 : (_sc$billData6 = sc.billData) === null || _sc$billData6 === void 0 ? void 0 : _sc$billData6.status
12062
+ });
12063
+ });
12064
+ if (data !== null && data !== void 0 && (_data$PropertyDetails14 = data.PropertyDetails) !== null && _data$PropertyDetails14 !== void 0 && (_data$PropertyDetails15 = _data$PropertyDetails14.propertyBillData) !== null && _data$PropertyDetails15 !== void 0 && _data$PropertyDetails15.billData) {
12065
+ var _data$PropertyDetails16, _data$PropertyDetails17, _data$cpt9, _data$PropertyDetails18, _data$cpt0, _data$cpt0$details;
12066
+ const billData = data === null || data === void 0 ? void 0 : (_data$PropertyDetails16 = data.PropertyDetails) === null || _data$PropertyDetails16 === void 0 ? void 0 : (_data$PropertyDetails17 = _data$PropertyDetails16.propertyBillData) === null || _data$PropertyDetails17 === void 0 ? void 0 : _data$PropertyDetails17.billData;
12067
+ ndcDetails.push({
12068
+ uuid: billData === null || billData === void 0 ? void 0 : billData.id,
12069
+ applicantId: applicantId,
12070
+ businessService: "PT",
12071
+ consumerCode: data === null || data === void 0 ? void 0 : (_data$cpt9 = data.cpt) === null || _data$cpt9 === void 0 ? void 0 : _data$cpt9.id,
12072
+ additionalDetails: {
12073
+ propertyAddress: data === null || data === void 0 ? void 0 : (_data$PropertyDetails18 = data.PropertyDetails) === null || _data$PropertyDetails18 === void 0 ? void 0 : _data$PropertyDetails18.address,
12074
+ propertyType: data === null || data === void 0 ? void 0 : (_data$cpt0 = data.cpt) === null || _data$cpt0 === void 0 ? void 0 : (_data$cpt0$details = _data$cpt0.details) === null || _data$cpt0$details === void 0 ? void 0 : _data$cpt0$details.usageCategory
12075
+ },
12076
+ dueAmount: (billData === null || billData === void 0 ? void 0 : billData.totalAmount) || 0,
12077
+ status: billData === null || billData === void 0 ? void 0 : billData.status
12078
+ });
12079
+ }
12080
+ const payload = {
12081
+ Applications: [{
12082
+ tenantId,
12083
+ owners,
12084
+ NdcDetails: ndcDetails,
12085
+ Documents: [],
12086
+ active: true,
12087
+ reason: data === null || data === void 0 ? void 0 : (_data$NDCReason2 = data.NDCReason) === null || _data$NDCReason2 === void 0 ? void 0 : _data$NDCReason2.code,
12088
+ auditDetails: data === null || data === void 0 ? void 0 : (_data$cpt1 = data.cpt) === null || _data$cpt1 === void 0 ? void 0 : (_data$cpt1$details = _data$cpt1.details) === null || _data$cpt1$details === void 0 ? void 0 : _data$cpt1$details.auditDetails,
12089
+ uuid: id,
12090
+ workflow: {
12091
+ action: "DRAFT"
12092
+ }
12093
+ }]
12094
+ };
12095
+ console.log("payload", payload);
12096
+ return Promise.resolve(Digit.NDCService.NDCUpdate({
12097
+ tenantId,
12098
+ details: payload
12099
+ })).then(function (response) {
12100
+ var _response$ResponseInf2;
12101
+ if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf2 = response.ResponseInfo) === null || _response$ResponseInf2 === void 0 ? void 0 : _response$ResponseInf2.status) === "successful") {
12102
+ dispatch(updateNDCForm("apiData", response));
12103
+ onGoNext();
12104
+ return {
12105
+ isSuccess: true,
12106
+ response
12107
+ };
12108
+ } else {
12109
+ return {
12110
+ isSuccess: false,
12111
+ response
12112
+ };
12113
+ }
12114
+ });
12115
+ } catch (e) {
12116
+ return Promise.reject(e);
12117
+ }
12118
+ };
11998
12119
  function validateStepData(data) {
11999
- var _data$cpt6, _data$cpt7, _data$cpt7$dues, _propertyDetails$wate, _propertyDetails$sewe;
12120
+ var _data$cpt10, _data$cpt11, _data$cpt11$dues, _propertyDetails$wate, _propertyDetails$sewe;
12000
12121
  const missingFields = [];
12001
12122
  const invalidFields = [];
12002
12123
  const cpt = (data === null || data === void 0 ? void 0 : data.cpt) || {};
12003
12124
  const cptDetails = (cpt === null || cpt === void 0 ? void 0 : cpt.details) || {};
12004
12125
  const propertyDetails = (data === null || data === void 0 ? void 0 : data.PropertyDetails) || {};
12005
12126
  const NDCReason = (data === null || data === void 0 ? void 0 : data.NDCReason) || {};
12006
- if (!(data !== null && data !== void 0 && (_data$cpt6 = data.cpt) !== null && _data$cpt6 !== void 0 && _data$cpt6.dues)) {
12127
+ if (!(data !== null && data !== void 0 && (_data$cpt10 = data.cpt) !== null && _data$cpt10 !== void 0 && _data$cpt10.dues)) {
12007
12128
  missingFields.push(t("NDC_MESSAGE_PLEASE_CHECK_STATUS_OF_PROPERTY_TAX") + " " + (cpt === null || cpt === void 0 ? void 0 : cpt.id));
12008
12129
  }
12009
- if ((data === null || data === void 0 ? void 0 : (_data$cpt7 = data.cpt) === null || _data$cpt7 === void 0 ? void 0 : (_data$cpt7$dues = _data$cpt7.dues) === null || _data$cpt7$dues === void 0 ? void 0 : _data$cpt7$dues.totalAmount) > 0) {
12130
+ if ((data === null || data === void 0 ? void 0 : (_data$cpt11 = data.cpt) === null || _data$cpt11 === void 0 ? void 0 : (_data$cpt11$dues = _data$cpt11.dues) === null || _data$cpt11$dues === void 0 ? void 0 : _data$cpt11$dues.totalAmount) > 0) {
12010
12131
  missingFields.push(t("NDC_MESSAGE_PLEASE_PAY_DUES_OF_PROPERTY_TAX") + " " + (cpt === null || cpt === void 0 ? void 0 : cpt.id));
12011
12132
  }
12012
12133
  if ((propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$wate = propertyDetails.waterConnection) === null || _propertyDetails$wate === void 0 ? void 0 : _propertyDetails$wate.length) > 0) {
@@ -12428,8 +12549,8 @@ const PropertyDetailsForm$1 = _ref => {
12428
12549
  var _apiDataCheck$2;
12429
12550
  let waterConnection;
12430
12551
  if (apiDataCheck !== null && apiDataCheck !== void 0 && (_apiDataCheck$2 = apiDataCheck[0]) !== null && _apiDataCheck$2 !== void 0 && _apiDataCheck$2.NdcDetails) {
12431
- var _apiDataCheck$3;
12432
- const resData = apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$3 = apiDataCheck[0]) === null || _apiDataCheck$3 === void 0 ? void 0 : _apiDataCheck$3.NdcDetails.filter(item => {
12552
+ var _apiDataCheck$3, _apiDataCheck$3$NdcDe;
12553
+ const resData = apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$3 = apiDataCheck[0]) === null || _apiDataCheck$3 === void 0 ? void 0 : (_apiDataCheck$3$NdcDe = _apiDataCheck$3.NdcDetails) === null || _apiDataCheck$3$NdcDe === void 0 ? void 0 : _apiDataCheck$3$NdcDe.filter(item => {
12433
12554
  return item.businessService == "WS";
12434
12555
  });
12435
12556
  waterConnection = (resData === null || resData === void 0 ? void 0 : resData.map(item => ({
@@ -12455,9 +12576,10 @@ const PropertyDetailsForm$1 = _ref => {
12455
12576
  React.useEffect(() => {
12456
12577
  var _apiDataCheck$4;
12457
12578
  let sewerageConnection;
12579
+ console.log("apiDataCheck", apiDataCheck);
12458
12580
  if (apiDataCheck !== null && apiDataCheck !== void 0 && (_apiDataCheck$4 = apiDataCheck[0]) !== null && _apiDataCheck$4 !== void 0 && _apiDataCheck$4.NdcDetails) {
12459
- var _apiDataCheck$5;
12460
- const resData = apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$5 = apiDataCheck[0]) === null || _apiDataCheck$5 === void 0 ? void 0 : _apiDataCheck$5.NdcDetails.filter(item => {
12581
+ var _apiDataCheck$5, _apiDataCheck$5$NdcDe;
12582
+ const resData = apiDataCheck === null || apiDataCheck === void 0 ? void 0 : (_apiDataCheck$5 = apiDataCheck[0]) === null || _apiDataCheck$5 === void 0 ? void 0 : (_apiDataCheck$5$NdcDe = _apiDataCheck$5.NdcDetails) === null || _apiDataCheck$5$NdcDe === void 0 ? void 0 : _apiDataCheck$5$NdcDe.filter(item => {
12461
12583
  return item.businessService == "SW";
12462
12584
  });
12463
12585
  sewerageConnection = (resData === null || resData === void 0 ? void 0 : resData.map(item => ({
@@ -13299,11 +13421,13 @@ const SelectNDCDocuments = _ref => {
13299
13421
  const [error, setError] = React.useState(null);
13300
13422
  React.useEffect(() => {
13301
13423
  var _checkFormData$respon, _checkFormData$respon2, _checkFormData$respon3;
13302
- if (checkFormData !== null && checkFormData !== void 0 && (_checkFormData$respon = checkFormData.responseData) !== null && _checkFormData$respon !== void 0 && (_checkFormData$respon2 = _checkFormData$respon[0]) !== null && _checkFormData$respon2 !== void 0 && (_checkFormData$respon3 = _checkFormData$respon2.Documents) !== null && _checkFormData$respon3 !== void 0 && _checkFormData$respon3.length) {
13303
- const apiDocs = checkFormData.responseData[0].Documents.map(doc => ({
13304
- documentType: doc.documentType,
13305
- fileStoreId: doc.documentAttachment,
13306
- documentUid: doc.documentAttachment
13424
+ console.log("coming here again");
13425
+ if (checkFormData !== null && checkFormData !== void 0 && (_checkFormData$respon = checkFormData.responseData) !== null && _checkFormData$respon !== void 0 && (_checkFormData$respon2 = _checkFormData$respon[0]) !== null && _checkFormData$respon2 !== void 0 && (_checkFormData$respon3 = _checkFormData$respon2.Documents) !== null && _checkFormData$respon3 !== void 0 && _checkFormData$respon3.length && documents.length === 0) {
13426
+ var _checkFormData$respon4, _checkFormData$respon5, _checkFormData$respon6;
13427
+ const apiDocs = checkFormData === null || checkFormData === void 0 ? void 0 : (_checkFormData$respon4 = checkFormData.responseData) === null || _checkFormData$respon4 === void 0 ? void 0 : (_checkFormData$respon5 = _checkFormData$respon4[0]) === null || _checkFormData$respon5 === void 0 ? void 0 : (_checkFormData$respon6 = _checkFormData$respon5.Documents) === null || _checkFormData$respon6 === void 0 ? void 0 : _checkFormData$respon6.map(doc => ({
13428
+ documentType: doc === null || doc === void 0 ? void 0 : doc.documentType,
13429
+ fileStoreId: doc === null || doc === void 0 ? void 0 : doc.documentAttachment,
13430
+ documentUid: doc === null || doc === void 0 ? void 0 : doc.documentAttachment
13307
13431
  }));
13308
13432
  setDocuments(apiDocs);
13309
13433
  }
@@ -13373,7 +13497,7 @@ function SelectDocument(_ref2) {
13373
13497
  setFile(e.target.files[0]);
13374
13498
  }
13375
13499
  React.useEffect(() => {
13376
- if (filteredDocument !== null && filteredDocument !== void 0 && filteredDocument.fileStoreId) {
13500
+ if (filteredDocument !== null && filteredDocument !== void 0 && filteredDocument.fileStoreId && !file) {
13377
13501
  setUploadedFile(filteredDocument.fileStoreId);
13378
13502
  }
13379
13503
  }, [filteredDocument]);
@@ -13468,10 +13592,26 @@ const NewNDCStepFormTwo = _ref => {
13468
13592
  const stateId = Digit.ULBService.getStateId();
13469
13593
  const [showToast, setShowToast] = React.useState(false);
13470
13594
  const [error, setError] = React.useState("");
13595
+ const tenantId = window.localStorage.getItem("CITIZEN.CITY");
13471
13596
  const {
13472
13597
  isLoading,
13473
13598
  data
13474
13599
  } = Digit.Hooks.pt.usePropertyMDMS(stateId, "NDC", ["Documents"]);
13600
+ const checkFormData = reactRedux.useSelector(state => state.ndc.NDCForm.formData || {});
13601
+ const id = window.location.pathname.split("/").pop();
13602
+ const user = Digit.UserService.getUser();
13603
+ const {
13604
+ isLoading: propertyLoading,
13605
+ data: applicationDetails,
13606
+ refetch
13607
+ } = Digit.Hooks.ndc.useSearchEmployeeApplication({
13608
+ uuid: id
13609
+ }, tenantId);
13610
+ React.useEffect(() => {
13611
+ if (applicationDetails !== null && applicationDetails !== void 0 && applicationDetails.Applications.length) {
13612
+ dispatch(updateNDCForm("responseData", applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.Applications));
13613
+ }
13614
+ }, [applicationDetails]);
13475
13615
  function goNext(finaldata) {
13476
13616
  console.log("Data in step " + config.currStepNumber + " is: \n", finaldata);
13477
13617
  const missingFields = validation(finaldata);
@@ -13483,8 +13623,69 @@ const NewNDCStepFormTwo = _ref => {
13483
13623
  }, 3000);
13484
13624
  return;
13485
13625
  }
13486
- onGoNext();
13626
+ const isRealId = id && id.startsWith("NDC-");
13627
+ if (isRealId) {
13628
+ updateApplication(finaldata);
13629
+ console.log("here bab");
13630
+ }
13487
13631
  }
13632
+ const updateApplication = function (data) {
13633
+ try {
13634
+ var _Digit$UserService$ge, _data$cpt, _data$cpt$details, _user$info, _user$info2, _checkFormData$NDCDet, _checkFormData$NDCDet2, _user$info3, _user$info4, _checkFormData$respon, _ref2, _data$documents;
13635
+ const applicant = ((_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info) || {};
13636
+ const auditDetails = data === null || data === void 0 ? void 0 : (_data$cpt = data.cpt) === null || _data$cpt === void 0 ? void 0 : (_data$cpt$details = _data$cpt.details) === null || _data$cpt$details === void 0 ? void 0 : _data$cpt$details.auditDetails;
13637
+ const applicantId = applicant === null || applicant === void 0 ? void 0 : applicant.uuid;
13638
+ console.log("final data===?????", data);
13639
+ console.log("checkFormData???====", checkFormData);
13640
+ const owners = [{
13641
+ name: user === null || user === void 0 ? void 0 : (_user$info = user.info) === null || _user$info === void 0 ? void 0 : _user$info.name,
13642
+ mobileNumber: user === null || user === void 0 ? void 0 : (_user$info2 = user.info) === null || _user$info2 === void 0 ? void 0 : _user$info2.mobileNumber,
13643
+ gender: checkFormData === null || checkFormData === void 0 ? void 0 : (_checkFormData$NDCDet = checkFormData.NDCDetails) === null || _checkFormData$NDCDet === void 0 ? void 0 : (_checkFormData$NDCDet2 = _checkFormData$NDCDet.PropertyDetails) === null || _checkFormData$NDCDet2 === void 0 ? void 0 : _checkFormData$NDCDet2.gender,
13644
+ emailId: user === null || user === void 0 ? void 0 : (_user$info3 = user.info) === null || _user$info3 === void 0 ? void 0 : _user$info3.emailId,
13645
+ type: user === null || user === void 0 ? void 0 : (_user$info4 = user.info) === null || _user$info4 === void 0 ? void 0 : _user$info4.type
13646
+ }];
13647
+ const baseApplication = (checkFormData === null || checkFormData === void 0 ? void 0 : (_checkFormData$respon = checkFormData.responseData) === null || _checkFormData$respon === void 0 ? void 0 : _checkFormData$respon[0]) || {};
13648
+ const updatedApplication = _extends({}, baseApplication, {
13649
+ workflow: _extends({}, baseApplication === null || baseApplication === void 0 ? void 0 : baseApplication.workflow),
13650
+ owners: owners,
13651
+ NdcDetails: baseApplication === null || baseApplication === void 0 ? void 0 : baseApplication.NdcDetails,
13652
+ Documents: []
13653
+ });
13654
+ (_ref2 = (data === null || data === void 0 ? void 0 : (_data$documents = data.documents) === null || _data$documents === void 0 ? void 0 : _data$documents.documents) || []) === null || _ref2 === void 0 ? void 0 : _ref2.forEach(doc => {
13655
+ var _updatedApplication$D;
13656
+ (_updatedApplication$D = updatedApplication.Documents) === null || _updatedApplication$D === void 0 ? void 0 : _updatedApplication$D.push({
13657
+ uuid: doc === null || doc === void 0 ? void 0 : doc.documentUid,
13658
+ documentType: doc === null || doc === void 0 ? void 0 : doc.documentType,
13659
+ documentAttachment: doc === null || doc === void 0 ? void 0 : doc.fileStoreId
13660
+ });
13661
+ });
13662
+ const payload = {
13663
+ Applications: [updatedApplication]
13664
+ };
13665
+ console.log("payload", payload);
13666
+ return Promise.resolve(Digit.NDCService.NDCUpdate({
13667
+ tenantId,
13668
+ details: payload
13669
+ })).then(function (response) {
13670
+ var _response$ResponseInf;
13671
+ if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf = response.ResponseInfo) === null || _response$ResponseInf === void 0 ? void 0 : _response$ResponseInf.status) === "successful") {
13672
+ dispatch(updateNDCForm("apiData", response));
13673
+ onGoNext();
13674
+ return {
13675
+ isSuccess: true,
13676
+ response
13677
+ };
13678
+ } else {
13679
+ return {
13680
+ isSuccess: false,
13681
+ response
13682
+ };
13683
+ }
13684
+ });
13685
+ } catch (e) {
13686
+ return Promise.reject(e);
13687
+ }
13688
+ };
13488
13689
  const closeToast = () => {
13489
13690
  setShowToast(false);
13490
13691
  setError("");