@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.
@@ -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,112 @@ 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, _data$PropertyDetails10, _data$PropertyDetails12, _data$PropertyDetails14, _data$PropertyDetails15, _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
+ const ndcDetails = [];
11909
+ ((data === null || data === void 0 ? void 0 : (_data$PropertyDetails10 = data.PropertyDetails) === null || _data$PropertyDetails10 === void 0 ? void 0 : _data$PropertyDetails10.waterConnection) || []).forEach(wc => {
11910
+ var _wc$billData4, _data$PropertyDetails11, _data$cpt7, _data$cpt7$details, _wc$billData5, _wc$billData6;
11911
+ ndcDetails.push({
11912
+ uuid: wc === null || wc === void 0 ? void 0 : (_wc$billData4 = wc.billData) === null || _wc$billData4 === void 0 ? void 0 : _wc$billData4.id,
11913
+ applicantId: applicantId,
11914
+ businessService: "WS",
11915
+ consumerCode: wc === null || wc === void 0 ? void 0 : wc.connectionNo,
11916
+ additionalDetails: {
11917
+ propertyAddress: data === null || data === void 0 ? void 0 : (_data$PropertyDetails11 = data.PropertyDetails) === null || _data$PropertyDetails11 === void 0 ? void 0 : _data$PropertyDetails11.address,
11918
+ 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
11919
+ },
11920
+ dueAmount: (wc === null || wc === void 0 ? void 0 : (_wc$billData5 = wc.billData) === null || _wc$billData5 === void 0 ? void 0 : _wc$billData5.totalAmount) || 0,
11921
+ status: wc === null || wc === void 0 ? void 0 : (_wc$billData6 = wc.billData) === null || _wc$billData6 === void 0 ? void 0 : _wc$billData6.status
11922
+ });
11923
+ });
11924
+ ((data === null || data === void 0 ? void 0 : (_data$PropertyDetails12 = data.PropertyDetails) === null || _data$PropertyDetails12 === void 0 ? void 0 : _data$PropertyDetails12.sewerageConnection) || []).forEach(sc => {
11925
+ var _sc$billData4, _data$PropertyDetails13, _data$cpt8, _data$cpt8$details, _sc$billData5, _sc$billData6;
11926
+ ndcDetails.push({
11927
+ uuid: sc === null || sc === void 0 ? void 0 : (_sc$billData4 = sc.billData) === null || _sc$billData4 === void 0 ? void 0 : _sc$billData4.id,
11928
+ applicantId: applicantId,
11929
+ businessService: "SW",
11930
+ consumerCode: sc === null || sc === void 0 ? void 0 : sc.connectionNo,
11931
+ additionalDetails: {
11932
+ propertyAddress: data === null || data === void 0 ? void 0 : (_data$PropertyDetails13 = data.PropertyDetails) === null || _data$PropertyDetails13 === void 0 ? void 0 : _data$PropertyDetails13.address,
11933
+ 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
11934
+ },
11935
+ dueAmount: (sc === null || sc === void 0 ? void 0 : (_sc$billData5 = sc.billData) === null || _sc$billData5 === void 0 ? void 0 : _sc$billData5.totalAmount) || 0,
11936
+ status: sc === null || sc === void 0 ? void 0 : (_sc$billData6 = sc.billData) === null || _sc$billData6 === void 0 ? void 0 : _sc$billData6.status
11937
+ });
11938
+ });
11939
+ 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) {
11940
+ var _data$PropertyDetails16, _data$PropertyDetails17, _data$cpt9, _data$PropertyDetails18, _data$cpt0, _data$cpt0$details;
11941
+ 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;
11942
+ ndcDetails.push({
11943
+ uuid: billData === null || billData === void 0 ? void 0 : billData.id,
11944
+ applicantId: applicantId,
11945
+ businessService: "PT",
11946
+ consumerCode: data === null || data === void 0 ? void 0 : (_data$cpt9 = data.cpt) === null || _data$cpt9 === void 0 ? void 0 : _data$cpt9.id,
11947
+ additionalDetails: {
11948
+ propertyAddress: data === null || data === void 0 ? void 0 : (_data$PropertyDetails18 = data.PropertyDetails) === null || _data$PropertyDetails18 === void 0 ? void 0 : _data$PropertyDetails18.address,
11949
+ 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
11950
+ },
11951
+ dueAmount: (billData === null || billData === void 0 ? void 0 : billData.totalAmount) || 0,
11952
+ status: billData === null || billData === void 0 ? void 0 : billData.status
11953
+ });
11954
+ }
11955
+ const payload = {
11956
+ Applications: [{
11957
+ tenantId,
11958
+ owners,
11959
+ NdcDetails: ndcDetails,
11960
+ Documents: [],
11961
+ active: true,
11962
+ reason: data === null || data === void 0 ? void 0 : (_data$NDCReason2 = data.NDCReason) === null || _data$NDCReason2 === void 0 ? void 0 : _data$NDCReason2.code,
11963
+ 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,
11964
+ uuid: id,
11965
+ workflow: {
11966
+ action: "DRAFT"
11967
+ }
11968
+ }]
11969
+ };
11970
+ console.log("payload", payload);
11971
+ const response = await Digit.NDCService.NDCUpdate({
11972
+ tenantId,
11973
+ details: payload
11974
+ });
11975
+ if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf2 = response.ResponseInfo) === null || _response$ResponseInf2 === void 0 ? void 0 : _response$ResponseInf2.status) === "successful") {
11976
+ dispatch(updateNDCForm("apiData", response));
11977
+ onGoNext();
11978
+ return {
11979
+ isSuccess: true,
11980
+ response
11981
+ };
11982
+ } else {
11983
+ return {
11984
+ isSuccess: false,
11985
+ response
11986
+ };
11987
+ }
11988
+ };
11875
11989
  function validateStepData(data) {
11876
- var _data$cpt6, _data$cpt7, _data$cpt7$dues, _propertyDetails$wate, _propertyDetails$sewe;
11990
+ var _data$cpt10, _data$cpt11, _data$cpt11$dues, _propertyDetails$wate, _propertyDetails$sewe;
11877
11991
  const missingFields = [];
11878
11992
  const invalidFields = [];
11879
11993
  const cpt = (data === null || data === void 0 ? void 0 : data.cpt) || {};
11880
11994
  const cptDetails = (cpt === null || cpt === void 0 ? void 0 : cpt.details) || {};
11881
11995
  const propertyDetails = (data === null || data === void 0 ? void 0 : data.PropertyDetails) || {};
11882
11996
  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)) {
11997
+ if (!(data !== null && data !== void 0 && (_data$cpt10 = data.cpt) !== null && _data$cpt10 !== void 0 && _data$cpt10.dues)) {
11884
11998
  missingFields.push(`${t("NDC_MESSAGE_PLEASE_CHECK_STATUS_OF_PROPERTY_TAX")} ${cpt === null || cpt === void 0 ? void 0 : cpt.id}`);
11885
11999
  }
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) {
12000
+ 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
12001
  missingFields.push(`${t("NDC_MESSAGE_PLEASE_PAY_DUES_OF_PROPERTY_TAX")} ${cpt === null || cpt === void 0 ? void 0 : cpt.id}`);
11888
12002
  }
11889
12003
  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 +12266,8 @@ const PropertyDetailsForm$1 = ({
12152
12266
  var _apiDataCheck$2;
12153
12267
  let waterConnection;
12154
12268
  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 => {
12269
+ var _apiDataCheck$3, _apiDataCheck$3$NdcDe;
12270
+ 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
12271
  return item.businessService == "WS";
12158
12272
  });
12159
12273
  waterConnection = (resData === null || resData === void 0 ? void 0 : resData.map(item => ({
@@ -12180,9 +12294,10 @@ const PropertyDetailsForm$1 = ({
12180
12294
  useEffect(() => {
12181
12295
  var _apiDataCheck$4;
12182
12296
  let sewerageConnection;
12297
+ console.log("apiDataCheck", apiDataCheck);
12183
12298
  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 => {
12299
+ var _apiDataCheck$5, _apiDataCheck$5$NdcDe;
12300
+ 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
12301
  return item.businessService == "SW";
12187
12302
  });
12188
12303
  sewerageConnection = (resData === null || resData === void 0 ? void 0 : resData.map(item => ({
@@ -13208,11 +13323,13 @@ const SelectNDCDocuments = ({
13208
13323
  const [error, setError] = useState(null);
13209
13324
  useEffect(() => {
13210
13325
  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
13326
+ console.log("coming here again");
13327
+ 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) {
13328
+ var _checkFormData$respon4, _checkFormData$respon5, _checkFormData$respon6;
13329
+ 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 => ({
13330
+ documentType: doc === null || doc === void 0 ? void 0 : doc.documentType,
13331
+ fileStoreId: doc === null || doc === void 0 ? void 0 : doc.documentAttachment,
13332
+ documentUid: doc === null || doc === void 0 ? void 0 : doc.documentAttachment
13216
13333
  }));
13217
13334
  setDocuments(apiDocs);
13218
13335
  }
@@ -13281,7 +13398,7 @@ function SelectDocument({
13281
13398
  setFile(e.target.files[0]);
13282
13399
  }
13283
13400
  useEffect(() => {
13284
- if (filteredDocument !== null && filteredDocument !== void 0 && filteredDocument.fileStoreId) {
13401
+ if (filteredDocument !== null && filteredDocument !== void 0 && filteredDocument.fileStoreId && !file) {
13285
13402
  setUploadedFile(filteredDocument.fileStoreId);
13286
13403
  }
13287
13404
  }, [filteredDocument]);
@@ -13363,10 +13480,26 @@ const NewNDCStepFormTwo = ({
13363
13480
  const stateId = Digit.ULBService.getStateId();
13364
13481
  const [showToast, setShowToast] = useState(false);
13365
13482
  const [error, setError] = useState("");
13483
+ const tenantId = window.localStorage.getItem("CITIZEN.CITY");
13366
13484
  const {
13367
13485
  isLoading,
13368
13486
  data
13369
13487
  } = Digit.Hooks.pt.usePropertyMDMS(stateId, "NDC", ["Documents"]);
13488
+ const checkFormData = useSelector(state => state.ndc.NDCForm.formData || {});
13489
+ const id = window.location.pathname.split("/").pop();
13490
+ const user = Digit.UserService.getUser();
13491
+ const {
13492
+ isLoading: propertyLoading,
13493
+ data: applicationDetails,
13494
+ refetch
13495
+ } = Digit.Hooks.ndc.useSearchEmployeeApplication({
13496
+ uuid: id
13497
+ }, tenantId);
13498
+ useEffect(() => {
13499
+ if (applicationDetails !== null && applicationDetails !== void 0 && applicationDetails.Applications.length) {
13500
+ dispatch(updateNDCForm("responseData", applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.Applications));
13501
+ }
13502
+ }, [applicationDetails]);
13370
13503
  function goNext(finaldata) {
13371
13504
  console.log(`Data in step ${config.currStepNumber} is: \n`, finaldata);
13372
13505
  const missingFields = validation(finaldata);
@@ -13378,8 +13511,64 @@ const NewNDCStepFormTwo = ({
13378
13511
  }, 3000);
13379
13512
  return;
13380
13513
  }
13381
- onGoNext();
13514
+ const isRealId = id && id.startsWith("NDC-");
13515
+ if (isRealId) {
13516
+ updateApplication(finaldata);
13517
+ console.log("here bab");
13518
+ }
13382
13519
  }
13520
+ const updateApplication = async data => {
13521
+ var _Digit$UserService$ge, _user$info, _user$info2, _checkFormData$NDCDet, _checkFormData$NDCDet2, _user$info3, _user$info4, _checkFormData$respon, _ref, _data$documents, _response$ResponseInf;
13522
+ const applicant = ((_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info) || {};
13523
+ console.log("final data===?????", data);
13524
+ console.log("checkFormData???====", checkFormData);
13525
+ const owners = [{
13526
+ name: user === null || user === void 0 ? void 0 : (_user$info = user.info) === null || _user$info === void 0 ? void 0 : _user$info.name,
13527
+ mobileNumber: user === null || user === void 0 ? void 0 : (_user$info2 = user.info) === null || _user$info2 === void 0 ? void 0 : _user$info2.mobileNumber,
13528
+ 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,
13529
+ emailId: user === null || user === void 0 ? void 0 : (_user$info3 = user.info) === null || _user$info3 === void 0 ? void 0 : _user$info3.emailId,
13530
+ type: user === null || user === void 0 ? void 0 : (_user$info4 = user.info) === null || _user$info4 === void 0 ? void 0 : _user$info4.type
13531
+ }];
13532
+ const baseApplication = (checkFormData === null || checkFormData === void 0 ? void 0 : (_checkFormData$respon = checkFormData.responseData) === null || _checkFormData$respon === void 0 ? void 0 : _checkFormData$respon[0]) || {};
13533
+ const updatedApplication = {
13534
+ ...baseApplication,
13535
+ workflow: {
13536
+ ...(baseApplication === null || baseApplication === void 0 ? void 0 : baseApplication.workflow)
13537
+ },
13538
+ owners: owners,
13539
+ NdcDetails: baseApplication === null || baseApplication === void 0 ? void 0 : baseApplication.NdcDetails,
13540
+ Documents: []
13541
+ };
13542
+ (_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 => {
13543
+ var _updatedApplication$D;
13544
+ (_updatedApplication$D = updatedApplication.Documents) === null || _updatedApplication$D === void 0 ? void 0 : _updatedApplication$D.push({
13545
+ uuid: doc === null || doc === void 0 ? void 0 : doc.documentUid,
13546
+ documentType: doc === null || doc === void 0 ? void 0 : doc.documentType,
13547
+ documentAttachment: doc === null || doc === void 0 ? void 0 : doc.fileStoreId
13548
+ });
13549
+ });
13550
+ const payload = {
13551
+ Applications: [updatedApplication]
13552
+ };
13553
+ console.log("payload", payload);
13554
+ const response = await Digit.NDCService.NDCUpdate({
13555
+ tenantId,
13556
+ details: payload
13557
+ });
13558
+ if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf = response.ResponseInfo) === null || _response$ResponseInf === void 0 ? void 0 : _response$ResponseInf.status) === "successful") {
13559
+ dispatch(updateNDCForm("apiData", response));
13560
+ onGoNext();
13561
+ return {
13562
+ isSuccess: true,
13563
+ response
13564
+ };
13565
+ } else {
13566
+ return {
13567
+ isSuccess: false,
13568
+ response
13569
+ };
13570
+ }
13571
+ };
13383
13572
  const closeToast = () => {
13384
13573
  setShowToast(false);
13385
13574
  setError("");