@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.
@@ -1309,9 +1309,14 @@ const ApplicationOverview = () => {
1309
1309
  workflow: {}
1310
1310
  };
1311
1311
  const filtData = data === null || data === void 0 ? void 0 : (_data$Licenses = data.Licenses) === null || _data$Licenses === void 0 ? void 0 : _data$Licenses[0];
1312
+ let checkAssigne;
1313
+ if (filtData.action == "SENDBACKTOCITIZEN") {
1314
+ var _payloadData$owners, _payloadData$owners$;
1315
+ 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];
1316
+ }
1312
1317
  updatedApplicant.workflow = {
1313
1318
  action: filtData.action,
1314
- assignes: filtData === null || filtData === void 0 ? void 0 : filtData.assignee,
1319
+ assignes: (filtData === null || filtData === void 0 ? void 0 : filtData.assignee) || checkAssigne,
1315
1320
  comment: filtData === null || filtData === void 0 ? void 0 : filtData.comment,
1316
1321
  documents: filtData === null || filtData === void 0 ? void 0 : filtData.wfDocuments
1317
1322
  };
@@ -9121,6 +9126,7 @@ const CitizenApplicationOverview = () => {
9121
9126
  className: "ndc_label"
9122
9127
  }, 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) => {
9123
9128
  var _detail$dueAmount, _propertyDetailsFetch, _propertyDetailsFetch2, _propertyDetailsFetch3, _propertyDetailsFetch4, _propertyDetailsFetch5, _propertyDetailsFetch6, _propertyDetailsFetch7, _propertyDetailsFetch8, _propertyDetailsFetch9, _propertyDetailsFetch0, _propertyDetailsFetch1, _propertyDetailsFetch10, _propertyDetailsFetch11, _propertyDetailsFetch12, _propertyDetailsFetch13, _propertyDetailsFetch14, _propertyDetailsFetch15, _propertyDetailsFetch16, _propertyDetailsFetch17, _propertyDetailsFetch18;
9129
+ const isRed = detail.dueAmount > 0;
9124
9130
  return /*#__PURE__*/React.createElement("div", {
9125
9131
  key: index,
9126
9132
  style: {
@@ -9135,10 +9141,17 @@ const CitizenApplicationOverview = () => {
9135
9141
  }), /*#__PURE__*/React.createElement(Row, {
9136
9142
  label: t("NDC_CONSUMER_CODE"),
9137
9143
  text: detail.consumerCode || "N/A"
9138
- }), /*#__PURE__*/React.createElement(Row, {
9144
+ }), /*#__PURE__*/React.createElement("div", {
9145
+ style: {
9146
+ background: isRed ? "red" : "none",
9147
+ color: isRed ? "white" : "black",
9148
+ paddingTop: isRed ? "8px" : "0",
9149
+ paddingLeft: isRed ? "10px" : "0"
9150
+ }
9151
+ }, /*#__PURE__*/React.createElement(Row, {
9139
9152
  label: t("NDC_DUE_AMOUNT"),
9140
9153
  text: ((_detail$dueAmount = detail.dueAmount) === null || _detail$dueAmount === void 0 ? void 0 : _detail$dueAmount.toString()) || "0"
9141
- }), /*#__PURE__*/React.createElement(Row, {
9154
+ })), /*#__PURE__*/React.createElement(Row, {
9142
9155
  label: t("NDC_PROPERTY_TYPE"),
9143
9156
  text: t(detail.propertyType) || detail.propertyType
9144
9157
  }), (detail === null || detail === void 0 ? void 0 : detail.businessService) == "NDC_PROPERTY_TAX" && (propertyDetailsFetch === null || propertyDetailsFetch === void 0 ? void 0 : propertyDetailsFetch.Properties) && /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(Row, {
@@ -9312,7 +9325,7 @@ const SearchFormFieldsComponents = ({
9312
9325
  name: "uuid",
9313
9326
  inputRef: registerRef({})
9314
9327
  })), /*#__PURE__*/React.createElement(SearchField, null, /*#__PURE__*/React.createElement("label", null, t("CORE_COMMON_PHONE_NUMBER")), /*#__PURE__*/React.createElement(TextInput, {
9315
- name: "phoneNumber",
9328
+ name: "mobileNumber",
9316
9329
  inputRef: registerRef({})
9317
9330
  })), /*#__PURE__*/React.createElement("div", {
9318
9331
  className: "search-action-wrapper",
@@ -9617,7 +9630,7 @@ const Inbox = ({
9617
9630
  const onSearchFormReset = setSearchFormValue => {
9618
9631
  setSearchFormValue("sourceRefId", null);
9619
9632
  setSearchFormValue("uuid", null);
9620
- setSearchFormValue("phoneNumber", null);
9633
+ setSearchFormValue("mobileNumber", null);
9621
9634
  dispatch({
9622
9635
  action: "mutateSearchForm",
9623
9636
  data: searchFormDefaultValues
@@ -11717,6 +11730,7 @@ const NewNDCStepForm = () => {
11717
11730
  uuid: id
11718
11731
  }, tenantId);
11719
11732
  useEffect(() => {
11733
+ console.log("applicationDetails", applicationDetails);
11720
11734
  if (applicationDetails !== null && applicationDetails !== void 0 && applicationDetails.Applications.length) {
11721
11735
  dispatch(updateNDCForm("responseData", applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.Applications));
11722
11736
  }
@@ -11765,8 +11779,10 @@ const NewNDCStepFormOne = ({
11765
11779
  const [showToast, setShowToast] = useState(false);
11766
11780
  const [error, setError] = useState("");
11767
11781
  const user = Digit.UserService.getUser();
11782
+ const id = window.location.pathname.split("/").pop();
11768
11783
  const currentStepData = useSelector(state => state.ndc.NDCForm.formData && state.ndc.NDCForm.formData[config.key] ? state.ndc.NDCForm.formData[config.key] : {});
11769
11784
  const checkFormData = useSelector(state => state.ndc.NDCForm.formData || {});
11785
+ const checkFormDatass = useSelector(state => state.ndc.NDCForm || {});
11770
11786
  const tenantId = window.localStorage.getItem("CITIZEN.CITY");
11771
11787
  function goNext(data) {
11772
11788
  var _checkFormData$apiDat, _checkFormData$apiDat2, _checkFormData$apiDat3, _checkFormData$respon, _checkFormData$respon2;
@@ -11779,8 +11795,12 @@ const NewNDCStepFormOne = ({
11779
11795
  }, 3000);
11780
11796
  return;
11781
11797
  }
11782
- 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) {
11783
- onGoNext();
11798
+ console.log("checkFormData", checkFormData);
11799
+ const isRealId = id && id.startsWith("NDC-");
11800
+ console.log("isRealId", isRealId);
11801
+ 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) {
11802
+ updateApplication(data);
11803
+ console.log("here bab");
11784
11804
  } else createApplication(data);
11785
11805
  }
11786
11806
  const createApplication = async data => {
@@ -11872,18 +11892,117 @@ const NewNDCStepFormOne = ({
11872
11892
  };
11873
11893
  }
11874
11894
  };
11895
+ const updateApplication = async data => {
11896
+ var _Digit$UserService$ge2, _user$info5, _user$info6, _data$PropertyDetails1, _user$info7, _user$info8, _checkFormData$respon3, _checkFormData$respon4, _checkFormData$respon5, _data$NDCReason2, _data$cpt1, _data$cpt1$details, _response$ResponseInf2;
11897
+ const applicant = ((_Digit$UserService$ge2 = Digit.UserService.getUser()) === null || _Digit$UserService$ge2 === void 0 ? void 0 : _Digit$UserService$ge2.info) || {};
11898
+ const applicantId = applicant === null || applicant === void 0 ? void 0 : applicant.uuid;
11899
+ console.log("data===?????", data);
11900
+ console.log("checkFormData???====", checkFormData);
11901
+ const owners = [{
11902
+ name: user === null || user === void 0 ? void 0 : (_user$info5 = user.info) === null || _user$info5 === void 0 ? void 0 : _user$info5.name,
11903
+ mobileNumber: user === null || user === void 0 ? void 0 : (_user$info6 = user.info) === null || _user$info6 === void 0 ? void 0 : _user$info6.mobileNumber,
11904
+ gender: data === null || data === void 0 ? void 0 : (_data$PropertyDetails1 = data.PropertyDetails) === null || _data$PropertyDetails1 === void 0 ? void 0 : _data$PropertyDetails1.gender,
11905
+ emailId: user === null || user === void 0 ? void 0 : (_user$info7 = user.info) === null || _user$info7 === void 0 ? void 0 : _user$info7.emailId,
11906
+ type: user === null || user === void 0 ? void 0 : (_user$info8 = user.info) === null || _user$info8 === void 0 ? void 0 : _user$info8.type
11907
+ }];
11908
+ let ndcDetails = [];
11909
+ 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) {
11910
+ ndcDetails = checkFormData.responseData[0].NdcDetails;
11911
+ } else {
11912
+ var _ref, _data$PropertyDetails10, _ref2, _data$PropertyDetails12, _data$PropertyDetails14, _data$PropertyDetails15;
11913
+ (_ref = (data === null || data === void 0 ? void 0 : (_data$PropertyDetails10 = data.PropertyDetails) === null || _data$PropertyDetails10 === void 0 ? void 0 : _data$PropertyDetails10.waterConnection) || []) === null || _ref === void 0 ? void 0 : _ref.forEach(wc => {
11914
+ var _wc$billData4, _data$PropertyDetails11, _data$cpt7, _data$cpt7$details, _wc$billData5, _wc$billData6;
11915
+ ndcDetails.push({
11916
+ uuid: wc === null || wc === void 0 ? void 0 : (_wc$billData4 = wc.billData) === null || _wc$billData4 === void 0 ? void 0 : _wc$billData4.id,
11917
+ applicantId: applicantId,
11918
+ businessService: "WS",
11919
+ consumerCode: wc === null || wc === void 0 ? void 0 : wc.connectionNo,
11920
+ additionalDetails: {
11921
+ propertyAddress: data === null || data === void 0 ? void 0 : (_data$PropertyDetails11 = data.PropertyDetails) === null || _data$PropertyDetails11 === void 0 ? void 0 : _data$PropertyDetails11.address,
11922
+ 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
11923
+ },
11924
+ dueAmount: (wc === null || wc === void 0 ? void 0 : (_wc$billData5 = wc.billData) === null || _wc$billData5 === void 0 ? void 0 : _wc$billData5.totalAmount) || 0,
11925
+ status: wc === null || wc === void 0 ? void 0 : (_wc$billData6 = wc.billData) === null || _wc$billData6 === void 0 ? void 0 : _wc$billData6.status
11926
+ });
11927
+ });
11928
+ (_ref2 = (data === null || data === void 0 ? void 0 : (_data$PropertyDetails12 = data.PropertyDetails) === null || _data$PropertyDetails12 === void 0 ? void 0 : _data$PropertyDetails12.sewerageConnection) || []) === null || _ref2 === void 0 ? void 0 : _ref2.forEach(sc => {
11929
+ var _sc$billData4, _data$PropertyDetails13, _data$cpt8, _data$cpt8$details, _sc$billData5, _sc$billData6;
11930
+ ndcDetails.push({
11931
+ uuid: sc === null || sc === void 0 ? void 0 : (_sc$billData4 = sc.billData) === null || _sc$billData4 === void 0 ? void 0 : _sc$billData4.id,
11932
+ applicantId: applicantId,
11933
+ businessService: "SW",
11934
+ consumerCode: sc === null || sc === void 0 ? void 0 : sc.connectionNo,
11935
+ additionalDetails: {
11936
+ propertyAddress: data === null || data === void 0 ? void 0 : (_data$PropertyDetails13 = data.PropertyDetails) === null || _data$PropertyDetails13 === void 0 ? void 0 : _data$PropertyDetails13.address,
11937
+ 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
11938
+ },
11939
+ dueAmount: (sc === null || sc === void 0 ? void 0 : (_sc$billData5 = sc.billData) === null || _sc$billData5 === void 0 ? void 0 : _sc$billData5.totalAmount) || 0,
11940
+ status: sc === null || sc === void 0 ? void 0 : (_sc$billData6 = sc.billData) === null || _sc$billData6 === void 0 ? void 0 : _sc$billData6.status
11941
+ });
11942
+ });
11943
+ 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) {
11944
+ var _data$PropertyDetails16, _data$PropertyDetails17, _data$cpt9, _data$PropertyDetails18, _data$cpt0, _data$cpt0$details;
11945
+ 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;
11946
+ ndcDetails.push({
11947
+ uuid: billData === null || billData === void 0 ? void 0 : billData.id,
11948
+ applicantId: applicantId,
11949
+ businessService: "PT",
11950
+ consumerCode: data === null || data === void 0 ? void 0 : (_data$cpt9 = data.cpt) === null || _data$cpt9 === void 0 ? void 0 : _data$cpt9.id,
11951
+ additionalDetails: {
11952
+ propertyAddress: data === null || data === void 0 ? void 0 : (_data$PropertyDetails18 = data.PropertyDetails) === null || _data$PropertyDetails18 === void 0 ? void 0 : _data$PropertyDetails18.address,
11953
+ 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
11954
+ },
11955
+ dueAmount: (billData === null || billData === void 0 ? void 0 : billData.totalAmount) || 0,
11956
+ status: billData === null || billData === void 0 ? void 0 : billData.status
11957
+ });
11958
+ }
11959
+ }
11960
+ const payload = {
11961
+ Applications: [{
11962
+ tenantId,
11963
+ owners,
11964
+ NdcDetails: ndcDetails,
11965
+ Documents: [],
11966
+ active: true,
11967
+ reason: data === null || data === void 0 ? void 0 : (_data$NDCReason2 = data.NDCReason) === null || _data$NDCReason2 === void 0 ? void 0 : _data$NDCReason2.code,
11968
+ 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,
11969
+ uuid: id,
11970
+ workflow: {
11971
+ action: "DRAFT"
11972
+ }
11973
+ }]
11974
+ };
11975
+ console.log("payload", payload);
11976
+ const response = await Digit.NDCService.NDCUpdate({
11977
+ tenantId,
11978
+ details: payload
11979
+ });
11980
+ if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf2 = response.ResponseInfo) === null || _response$ResponseInf2 === void 0 ? void 0 : _response$ResponseInf2.status) === "successful") {
11981
+ dispatch(updateNDCForm("apiData", response));
11982
+ onGoNext();
11983
+ return {
11984
+ isSuccess: true,
11985
+ response
11986
+ };
11987
+ } else {
11988
+ return {
11989
+ isSuccess: false,
11990
+ response
11991
+ };
11992
+ }
11993
+ };
11875
11994
  function validateStepData(data) {
11876
- var _data$cpt6, _data$cpt7, _data$cpt7$dues, _propertyDetails$wate, _propertyDetails$sewe;
11995
+ var _data$cpt10, _data$cpt11, _data$cpt11$dues, _propertyDetails$wate, _propertyDetails$sewe;
11877
11996
  const missingFields = [];
11878
11997
  const invalidFields = [];
11879
11998
  const cpt = (data === null || data === void 0 ? void 0 : data.cpt) || {};
11880
11999
  const cptDetails = (cpt === null || cpt === void 0 ? void 0 : cpt.details) || {};
11881
12000
  const propertyDetails = (data === null || data === void 0 ? void 0 : data.PropertyDetails) || {};
11882
12001
  const NDCReason = (data === null || data === void 0 ? void 0 : data.NDCReason) || {};
11883
- if (!(data !== null && data !== void 0 && (_data$cpt6 = data.cpt) !== null && _data$cpt6 !== void 0 && _data$cpt6.dues)) {
12002
+ if (!(data !== null && data !== void 0 && (_data$cpt10 = data.cpt) !== null && _data$cpt10 !== void 0 && _data$cpt10.dues)) {
11884
12003
  missingFields.push(`${t("NDC_MESSAGE_PLEASE_CHECK_STATUS_OF_PROPERTY_TAX")} ${cpt === null || cpt === void 0 ? void 0 : cpt.id}`);
11885
12004
  }
11886
- 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) {
12005
+ 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) {
11887
12006
  missingFields.push(`${t("NDC_MESSAGE_PLEASE_PAY_DUES_OF_PROPERTY_TAX")} ${cpt === null || cpt === void 0 ? void 0 : cpt.id}`);
11888
12007
  }
11889
12008
  if ((propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$wate = propertyDetails.waterConnection) === null || _propertyDetails$wate === void 0 ? void 0 : _propertyDetails$wate.length) > 0) {
@@ -12152,8 +12271,8 @@ const PropertyDetailsForm$1 = ({
12152
12271
  var _apiDataCheck$2;
12153
12272
  let waterConnection;
12154
12273
  if (apiDataCheck !== null && apiDataCheck !== void 0 && (_apiDataCheck$2 = apiDataCheck[0]) !== null && _apiDataCheck$2 !== void 0 && _apiDataCheck$2.NdcDetails) {
12155
- var _apiDataCheck$3;
12156
- 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 => {
12274
+ var _apiDataCheck$3, _apiDataCheck$3$NdcDe;
12275
+ 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 => {
12157
12276
  return item.businessService == "WS";
12158
12277
  });
12159
12278
  waterConnection = (resData === null || resData === void 0 ? void 0 : resData.map(item => ({
@@ -12180,9 +12299,10 @@ const PropertyDetailsForm$1 = ({
12180
12299
  useEffect(() => {
12181
12300
  var _apiDataCheck$4;
12182
12301
  let sewerageConnection;
12302
+ console.log("apiDataCheck", apiDataCheck);
12183
12303
  if (apiDataCheck !== null && apiDataCheck !== void 0 && (_apiDataCheck$4 = apiDataCheck[0]) !== null && _apiDataCheck$4 !== void 0 && _apiDataCheck$4.NdcDetails) {
12184
- var _apiDataCheck$5;
12185
- 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 => {
12304
+ var _apiDataCheck$5, _apiDataCheck$5$NdcDe;
12305
+ 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 => {
12186
12306
  return item.businessService == "SW";
12187
12307
  });
12188
12308
  sewerageConnection = (resData === null || resData === void 0 ? void 0 : resData.map(item => ({
@@ -13208,11 +13328,13 @@ const SelectNDCDocuments = ({
13208
13328
  const [error, setError] = useState(null);
13209
13329
  useEffect(() => {
13210
13330
  var _checkFormData$respon, _checkFormData$respon2, _checkFormData$respon3;
13211
- 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) {
13212
- const apiDocs = checkFormData.responseData[0].Documents.map(doc => ({
13213
- documentType: doc.documentType,
13214
- fileStoreId: doc.documentAttachment,
13215
- documentUid: doc.documentAttachment
13331
+ console.log("coming here again");
13332
+ 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) {
13333
+ var _checkFormData$respon4, _checkFormData$respon5, _checkFormData$respon6;
13334
+ 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 => ({
13335
+ documentType: doc === null || doc === void 0 ? void 0 : doc.documentType,
13336
+ fileStoreId: doc === null || doc === void 0 ? void 0 : doc.documentAttachment,
13337
+ documentUid: doc === null || doc === void 0 ? void 0 : doc.documentAttachment
13216
13338
  }));
13217
13339
  setDocuments(apiDocs);
13218
13340
  }
@@ -13281,7 +13403,7 @@ function SelectDocument({
13281
13403
  setFile(e.target.files[0]);
13282
13404
  }
13283
13405
  useEffect(() => {
13284
- if (filteredDocument !== null && filteredDocument !== void 0 && filteredDocument.fileStoreId) {
13406
+ if (filteredDocument !== null && filteredDocument !== void 0 && filteredDocument.fileStoreId && !file) {
13285
13407
  setUploadedFile(filteredDocument.fileStoreId);
13286
13408
  }
13287
13409
  }, [filteredDocument]);
@@ -13363,10 +13485,26 @@ const NewNDCStepFormTwo = ({
13363
13485
  const stateId = Digit.ULBService.getStateId();
13364
13486
  const [showToast, setShowToast] = useState(false);
13365
13487
  const [error, setError] = useState("");
13488
+ const tenantId = window.localStorage.getItem("CITIZEN.CITY");
13366
13489
  const {
13367
13490
  isLoading,
13368
13491
  data
13369
13492
  } = Digit.Hooks.pt.usePropertyMDMS(stateId, "NDC", ["Documents"]);
13493
+ const checkFormData = useSelector(state => state.ndc.NDCForm.formData || {});
13494
+ const id = window.location.pathname.split("/").pop();
13495
+ const user = Digit.UserService.getUser();
13496
+ const {
13497
+ isLoading: propertyLoading,
13498
+ data: applicationDetails,
13499
+ refetch
13500
+ } = Digit.Hooks.ndc.useSearchEmployeeApplication({
13501
+ uuid: id
13502
+ }, tenantId);
13503
+ useEffect(() => {
13504
+ if (applicationDetails !== null && applicationDetails !== void 0 && applicationDetails.Applications.length) {
13505
+ dispatch(updateNDCForm("responseData", applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.Applications));
13506
+ }
13507
+ }, [applicationDetails]);
13370
13508
  function goNext(finaldata) {
13371
13509
  console.log(`Data in step ${config.currStepNumber} is: \n`, finaldata);
13372
13510
  const missingFields = validation(finaldata);
@@ -13378,8 +13516,64 @@ const NewNDCStepFormTwo = ({
13378
13516
  }, 3000);
13379
13517
  return;
13380
13518
  }
13381
- onGoNext();
13519
+ const isRealId = id && id.startsWith("NDC-");
13520
+ if (isRealId) {
13521
+ updateApplication(finaldata);
13522
+ console.log("here bab");
13523
+ }
13382
13524
  }
13525
+ const updateApplication = async data => {
13526
+ var _Digit$UserService$ge, _user$info, _user$info2, _checkFormData$NDCDet, _checkFormData$NDCDet2, _user$info3, _user$info4, _checkFormData$respon, _ref, _data$documents, _response$ResponseInf;
13527
+ const applicant = ((_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info) || {};
13528
+ console.log("final data===?????", data);
13529
+ console.log("checkFormData???====", checkFormData);
13530
+ const owners = [{
13531
+ name: user === null || user === void 0 ? void 0 : (_user$info = user.info) === null || _user$info === void 0 ? void 0 : _user$info.name,
13532
+ mobileNumber: user === null || user === void 0 ? void 0 : (_user$info2 = user.info) === null || _user$info2 === void 0 ? void 0 : _user$info2.mobileNumber,
13533
+ 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,
13534
+ emailId: user === null || user === void 0 ? void 0 : (_user$info3 = user.info) === null || _user$info3 === void 0 ? void 0 : _user$info3.emailId,
13535
+ type: user === null || user === void 0 ? void 0 : (_user$info4 = user.info) === null || _user$info4 === void 0 ? void 0 : _user$info4.type
13536
+ }];
13537
+ const baseApplication = (checkFormData === null || checkFormData === void 0 ? void 0 : (_checkFormData$respon = checkFormData.responseData) === null || _checkFormData$respon === void 0 ? void 0 : _checkFormData$respon[0]) || {};
13538
+ const updatedApplication = {
13539
+ ...baseApplication,
13540
+ workflow: {
13541
+ ...(baseApplication === null || baseApplication === void 0 ? void 0 : baseApplication.workflow)
13542
+ },
13543
+ owners: owners,
13544
+ NdcDetails: baseApplication === null || baseApplication === void 0 ? void 0 : baseApplication.NdcDetails,
13545
+ Documents: []
13546
+ };
13547
+ (_ref = (data === null || data === void 0 ? void 0 : (_data$documents = data.documents) === null || _data$documents === void 0 ? void 0 : _data$documents.documents) || []) === null || _ref === void 0 ? void 0 : _ref.forEach(doc => {
13548
+ var _updatedApplication$D;
13549
+ (_updatedApplication$D = updatedApplication.Documents) === null || _updatedApplication$D === void 0 ? void 0 : _updatedApplication$D.push({
13550
+ uuid: doc === null || doc === void 0 ? void 0 : doc.documentUid,
13551
+ documentType: doc === null || doc === void 0 ? void 0 : doc.documentType,
13552
+ documentAttachment: doc === null || doc === void 0 ? void 0 : doc.fileStoreId
13553
+ });
13554
+ });
13555
+ const payload = {
13556
+ Applications: [updatedApplication]
13557
+ };
13558
+ console.log("payload", payload);
13559
+ const response = await Digit.NDCService.NDCUpdate({
13560
+ tenantId,
13561
+ details: payload
13562
+ });
13563
+ if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf = response.ResponseInfo) === null || _response$ResponseInf === void 0 ? void 0 : _response$ResponseInf.status) === "successful") {
13564
+ dispatch(updateNDCForm("apiData", response));
13565
+ onGoNext();
13566
+ return {
13567
+ isSuccess: true,
13568
+ response
13569
+ };
13570
+ } else {
13571
+ return {
13572
+ isSuccess: false,
13573
+ response
13574
+ };
13575
+ }
13576
+ };
13383
13577
  const closeToast = () => {
13384
13578
  setShowToast(false);
13385
13579
  setError("");