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

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,124 @@ 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, _checkFormData$respon3, _checkFormData$respon4, _checkFormData$respon5, _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
+ let ndcDetails = [];
12034
+ if ((checkFormData === null || checkFormData === void 0 ? void 0 : (_checkFormData$respon3 = checkFormData.responseData) === null || _checkFormData$respon3 === void 0 ? void 0 : (_checkFormData$respon4 = _checkFormData$respon3[0]) === null || _checkFormData$respon4 === void 0 ? void 0 : (_checkFormData$respon5 = _checkFormData$respon4.NdcDetails) === null || _checkFormData$respon5 === void 0 ? void 0 : _checkFormData$respon5.length) > 0) {
12035
+ ndcDetails = checkFormData.responseData[0].NdcDetails;
12036
+ } else {
12037
+ var _ref2, _data$PropertyDetails10, _ref3, _data$PropertyDetails12, _data$PropertyDetails14, _data$PropertyDetails15;
12038
+ (_ref2 = (data === null || data === void 0 ? void 0 : (_data$PropertyDetails10 = data.PropertyDetails) === null || _data$PropertyDetails10 === void 0 ? void 0 : _data$PropertyDetails10.waterConnection) || []) === null || _ref2 === void 0 ? void 0 : _ref2.forEach(wc => {
12039
+ var _wc$billData4, _data$PropertyDetails11, _data$cpt7, _data$cpt7$details, _wc$billData5, _wc$billData6;
12040
+ ndcDetails.push({
12041
+ uuid: wc === null || wc === void 0 ? void 0 : (_wc$billData4 = wc.billData) === null || _wc$billData4 === void 0 ? void 0 : _wc$billData4.id,
12042
+ applicantId: applicantId,
12043
+ businessService: "WS",
12044
+ consumerCode: wc === null || wc === void 0 ? void 0 : wc.connectionNo,
12045
+ additionalDetails: {
12046
+ propertyAddress: data === null || data === void 0 ? void 0 : (_data$PropertyDetails11 = data.PropertyDetails) === null || _data$PropertyDetails11 === void 0 ? void 0 : _data$PropertyDetails11.address,
12047
+ 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
12048
+ },
12049
+ dueAmount: (wc === null || wc === void 0 ? void 0 : (_wc$billData5 = wc.billData) === null || _wc$billData5 === void 0 ? void 0 : _wc$billData5.totalAmount) || 0,
12050
+ status: wc === null || wc === void 0 ? void 0 : (_wc$billData6 = wc.billData) === null || _wc$billData6 === void 0 ? void 0 : _wc$billData6.status
12051
+ });
12052
+ });
12053
+ (_ref3 = (data === null || data === void 0 ? void 0 : (_data$PropertyDetails12 = data.PropertyDetails) === null || _data$PropertyDetails12 === void 0 ? void 0 : _data$PropertyDetails12.sewerageConnection) || []) === null || _ref3 === void 0 ? void 0 : _ref3.forEach(sc => {
12054
+ var _sc$billData4, _data$PropertyDetails13, _data$cpt8, _data$cpt8$details, _sc$billData5, _sc$billData6;
12055
+ ndcDetails.push({
12056
+ uuid: sc === null || sc === void 0 ? void 0 : (_sc$billData4 = sc.billData) === null || _sc$billData4 === void 0 ? void 0 : _sc$billData4.id,
12057
+ applicantId: applicantId,
12058
+ businessService: "SW",
12059
+ consumerCode: sc === null || sc === void 0 ? void 0 : sc.connectionNo,
12060
+ additionalDetails: {
12061
+ propertyAddress: data === null || data === void 0 ? void 0 : (_data$PropertyDetails13 = data.PropertyDetails) === null || _data$PropertyDetails13 === void 0 ? void 0 : _data$PropertyDetails13.address,
12062
+ 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
12063
+ },
12064
+ dueAmount: (sc === null || sc === void 0 ? void 0 : (_sc$billData5 = sc.billData) === null || _sc$billData5 === void 0 ? void 0 : _sc$billData5.totalAmount) || 0,
12065
+ status: sc === null || sc === void 0 ? void 0 : (_sc$billData6 = sc.billData) === null || _sc$billData6 === void 0 ? void 0 : _sc$billData6.status
12066
+ });
12067
+ });
12068
+ 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) {
12069
+ var _data$PropertyDetails16, _data$PropertyDetails17, _data$cpt9, _data$PropertyDetails18, _data$cpt0, _data$cpt0$details;
12070
+ 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;
12071
+ ndcDetails.push({
12072
+ uuid: billData === null || billData === void 0 ? void 0 : billData.id,
12073
+ applicantId: applicantId,
12074
+ businessService: "PT",
12075
+ consumerCode: data === null || data === void 0 ? void 0 : (_data$cpt9 = data.cpt) === null || _data$cpt9 === void 0 ? void 0 : _data$cpt9.id,
12076
+ additionalDetails: {
12077
+ propertyAddress: data === null || data === void 0 ? void 0 : (_data$PropertyDetails18 = data.PropertyDetails) === null || _data$PropertyDetails18 === void 0 ? void 0 : _data$PropertyDetails18.address,
12078
+ 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
12079
+ },
12080
+ dueAmount: (billData === null || billData === void 0 ? void 0 : billData.totalAmount) || 0,
12081
+ status: billData === null || billData === void 0 ? void 0 : billData.status
12082
+ });
12083
+ }
12084
+ }
12085
+ const payload = {
12086
+ Applications: [{
12087
+ tenantId,
12088
+ owners,
12089
+ NdcDetails: ndcDetails,
12090
+ Documents: [],
12091
+ active: true,
12092
+ reason: data === null || data === void 0 ? void 0 : (_data$NDCReason2 = data.NDCReason) === null || _data$NDCReason2 === void 0 ? void 0 : _data$NDCReason2.code,
12093
+ 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,
12094
+ uuid: id,
12095
+ workflow: {
12096
+ action: "DRAFT"
12097
+ }
12098
+ }]
12099
+ };
12100
+ console.log("payload", payload);
12101
+ return Promise.resolve(Digit.NDCService.NDCUpdate({
12102
+ tenantId,
12103
+ details: payload
12104
+ })).then(function (response) {
12105
+ var _response$ResponseInf2;
12106
+ if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf2 = response.ResponseInfo) === null || _response$ResponseInf2 === void 0 ? void 0 : _response$ResponseInf2.status) === "successful") {
12107
+ dispatch(updateNDCForm("apiData", response));
12108
+ onGoNext();
12109
+ return {
12110
+ isSuccess: true,
12111
+ response
12112
+ };
12113
+ } else {
12114
+ return {
12115
+ isSuccess: false,
12116
+ response
12117
+ };
12118
+ }
12119
+ });
12120
+ } catch (e) {
12121
+ return Promise.reject(e);
12122
+ }
12123
+ };
11998
12124
  function validateStepData(data) {
11999
- var _data$cpt6, _data$cpt7, _data$cpt7$dues, _propertyDetails$wate, _propertyDetails$sewe;
12125
+ var _data$cpt10, _data$cpt11, _data$cpt11$dues, _propertyDetails$wate, _propertyDetails$sewe;
12000
12126
  const missingFields = [];
12001
12127
  const invalidFields = [];
12002
12128
  const cpt = (data === null || data === void 0 ? void 0 : data.cpt) || {};
12003
12129
  const cptDetails = (cpt === null || cpt === void 0 ? void 0 : cpt.details) || {};
12004
12130
  const propertyDetails = (data === null || data === void 0 ? void 0 : data.PropertyDetails) || {};
12005
12131
  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)) {
12132
+ if (!(data !== null && data !== void 0 && (_data$cpt10 = data.cpt) !== null && _data$cpt10 !== void 0 && _data$cpt10.dues)) {
12007
12133
  missingFields.push(t("NDC_MESSAGE_PLEASE_CHECK_STATUS_OF_PROPERTY_TAX") + " " + (cpt === null || cpt === void 0 ? void 0 : cpt.id));
12008
12134
  }
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) {
12135
+ 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
12136
  missingFields.push(t("NDC_MESSAGE_PLEASE_PAY_DUES_OF_PROPERTY_TAX") + " " + (cpt === null || cpt === void 0 ? void 0 : cpt.id));
12011
12137
  }
12012
12138
  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 +12554,8 @@ const PropertyDetailsForm$1 = _ref => {
12428
12554
  var _apiDataCheck$2;
12429
12555
  let waterConnection;
12430
12556
  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 => {
12557
+ var _apiDataCheck$3, _apiDataCheck$3$NdcDe;
12558
+ 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
12559
  return item.businessService == "WS";
12434
12560
  });
12435
12561
  waterConnection = (resData === null || resData === void 0 ? void 0 : resData.map(item => ({
@@ -12455,9 +12581,10 @@ const PropertyDetailsForm$1 = _ref => {
12455
12581
  React.useEffect(() => {
12456
12582
  var _apiDataCheck$4;
12457
12583
  let sewerageConnection;
12584
+ console.log("apiDataCheck", apiDataCheck);
12458
12585
  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 => {
12586
+ var _apiDataCheck$5, _apiDataCheck$5$NdcDe;
12587
+ 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
12588
  return item.businessService == "SW";
12462
12589
  });
12463
12590
  sewerageConnection = (resData === null || resData === void 0 ? void 0 : resData.map(item => ({
@@ -13299,11 +13426,13 @@ const SelectNDCDocuments = _ref => {
13299
13426
  const [error, setError] = React.useState(null);
13300
13427
  React.useEffect(() => {
13301
13428
  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
13429
+ console.log("coming here again");
13430
+ 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) {
13431
+ var _checkFormData$respon4, _checkFormData$respon5, _checkFormData$respon6;
13432
+ 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 => ({
13433
+ documentType: doc === null || doc === void 0 ? void 0 : doc.documentType,
13434
+ fileStoreId: doc === null || doc === void 0 ? void 0 : doc.documentAttachment,
13435
+ documentUid: doc === null || doc === void 0 ? void 0 : doc.documentAttachment
13307
13436
  }));
13308
13437
  setDocuments(apiDocs);
13309
13438
  }
@@ -13373,7 +13502,7 @@ function SelectDocument(_ref2) {
13373
13502
  setFile(e.target.files[0]);
13374
13503
  }
13375
13504
  React.useEffect(() => {
13376
- if (filteredDocument !== null && filteredDocument !== void 0 && filteredDocument.fileStoreId) {
13505
+ if (filteredDocument !== null && filteredDocument !== void 0 && filteredDocument.fileStoreId && !file) {
13377
13506
  setUploadedFile(filteredDocument.fileStoreId);
13378
13507
  }
13379
13508
  }, [filteredDocument]);
@@ -13468,10 +13597,26 @@ const NewNDCStepFormTwo = _ref => {
13468
13597
  const stateId = Digit.ULBService.getStateId();
13469
13598
  const [showToast, setShowToast] = React.useState(false);
13470
13599
  const [error, setError] = React.useState("");
13600
+ const tenantId = window.localStorage.getItem("CITIZEN.CITY");
13471
13601
  const {
13472
13602
  isLoading,
13473
13603
  data
13474
13604
  } = Digit.Hooks.pt.usePropertyMDMS(stateId, "NDC", ["Documents"]);
13605
+ const checkFormData = reactRedux.useSelector(state => state.ndc.NDCForm.formData || {});
13606
+ const id = window.location.pathname.split("/").pop();
13607
+ const user = Digit.UserService.getUser();
13608
+ const {
13609
+ isLoading: propertyLoading,
13610
+ data: applicationDetails,
13611
+ refetch
13612
+ } = Digit.Hooks.ndc.useSearchEmployeeApplication({
13613
+ uuid: id
13614
+ }, tenantId);
13615
+ React.useEffect(() => {
13616
+ if (applicationDetails !== null && applicationDetails !== void 0 && applicationDetails.Applications.length) {
13617
+ dispatch(updateNDCForm("responseData", applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.Applications));
13618
+ }
13619
+ }, [applicationDetails]);
13475
13620
  function goNext(finaldata) {
13476
13621
  console.log("Data in step " + config.currStepNumber + " is: \n", finaldata);
13477
13622
  const missingFields = validation(finaldata);
@@ -13483,8 +13628,69 @@ const NewNDCStepFormTwo = _ref => {
13483
13628
  }, 3000);
13484
13629
  return;
13485
13630
  }
13486
- onGoNext();
13631
+ const isRealId = id && id.startsWith("NDC-");
13632
+ if (isRealId) {
13633
+ updateApplication(finaldata);
13634
+ console.log("here bab");
13635
+ }
13487
13636
  }
13637
+ const updateApplication = function (data) {
13638
+ try {
13639
+ 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;
13640
+ const applicant = ((_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info) || {};
13641
+ 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;
13642
+ const applicantId = applicant === null || applicant === void 0 ? void 0 : applicant.uuid;
13643
+ console.log("final data===?????", data);
13644
+ console.log("checkFormData???====", checkFormData);
13645
+ const owners = [{
13646
+ name: user === null || user === void 0 ? void 0 : (_user$info = user.info) === null || _user$info === void 0 ? void 0 : _user$info.name,
13647
+ mobileNumber: user === null || user === void 0 ? void 0 : (_user$info2 = user.info) === null || _user$info2 === void 0 ? void 0 : _user$info2.mobileNumber,
13648
+ 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,
13649
+ emailId: user === null || user === void 0 ? void 0 : (_user$info3 = user.info) === null || _user$info3 === void 0 ? void 0 : _user$info3.emailId,
13650
+ type: user === null || user === void 0 ? void 0 : (_user$info4 = user.info) === null || _user$info4 === void 0 ? void 0 : _user$info4.type
13651
+ }];
13652
+ const baseApplication = (checkFormData === null || checkFormData === void 0 ? void 0 : (_checkFormData$respon = checkFormData.responseData) === null || _checkFormData$respon === void 0 ? void 0 : _checkFormData$respon[0]) || {};
13653
+ const updatedApplication = _extends({}, baseApplication, {
13654
+ workflow: _extends({}, baseApplication === null || baseApplication === void 0 ? void 0 : baseApplication.workflow),
13655
+ owners: owners,
13656
+ NdcDetails: baseApplication === null || baseApplication === void 0 ? void 0 : baseApplication.NdcDetails,
13657
+ Documents: []
13658
+ });
13659
+ (_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 => {
13660
+ var _updatedApplication$D;
13661
+ (_updatedApplication$D = updatedApplication.Documents) === null || _updatedApplication$D === void 0 ? void 0 : _updatedApplication$D.push({
13662
+ uuid: doc === null || doc === void 0 ? void 0 : doc.documentUid,
13663
+ documentType: doc === null || doc === void 0 ? void 0 : doc.documentType,
13664
+ documentAttachment: doc === null || doc === void 0 ? void 0 : doc.fileStoreId
13665
+ });
13666
+ });
13667
+ const payload = {
13668
+ Applications: [updatedApplication]
13669
+ };
13670
+ console.log("payload", payload);
13671
+ return Promise.resolve(Digit.NDCService.NDCUpdate({
13672
+ tenantId,
13673
+ details: payload
13674
+ })).then(function (response) {
13675
+ var _response$ResponseInf;
13676
+ if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf = response.ResponseInfo) === null || _response$ResponseInf === void 0 ? void 0 : _response$ResponseInf.status) === "successful") {
13677
+ dispatch(updateNDCForm("apiData", response));
13678
+ onGoNext();
13679
+ return {
13680
+ isSuccess: true,
13681
+ response
13682
+ };
13683
+ } else {
13684
+ return {
13685
+ isSuccess: false,
13686
+ response
13687
+ };
13688
+ }
13689
+ });
13690
+ } catch (e) {
13691
+ return Promise.reject(e);
13692
+ }
13693
+ };
13488
13694
  const closeToast = () => {
13489
13695
  setShowToast(false);
13490
13696
  setError("");