@mseva/digit-ui-module-garbagecollection 1.0.22 → 1.0.24

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
@@ -2823,6 +2823,8 @@ const CHBCitizenSecond = _ref => {
2823
2823
  const isCitizen = window.location.href.includes("citizen");
2824
2824
  const [getPropertyId, setPropertyId] = React.useState(null);
2825
2825
  const [loader, setLoader] = React.useState(false);
2826
+ const [showToast, setShowToast] = React.useState(false);
2827
+ const [error, setError] = React.useState("");
2826
2828
  const {
2827
2829
  data: GCData = [],
2828
2830
  isLoading: GCLoading
@@ -2868,50 +2870,105 @@ const CHBCitizenSecond = _ref => {
2868
2870
  });
2869
2871
  const onSubmit = function (data) {
2870
2872
  try {
2871
- var _data$frequency, _data$typeOfWaste, _data$propertyType, _data$connectionCateg, _data$connectionCateg2;
2872
- setLoader(true);
2873
- console.log("data", data);
2874
- console.log("currentStepData", currentStepData);
2875
- const ownerData = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.ownerDetails;
2876
- const payload = {
2877
- GarbageConnection: {
2878
- tenantId: tenantId,
2879
- propertyId: data === null || data === void 0 ? void 0 : data.propertyId,
2880
- frequency: data === null || data === void 0 ? void 0 : (_data$frequency = data.frequency) === null || _data$frequency === void 0 ? void 0 : _data$frequency.name,
2881
- typeOfWaste: data === null || data === void 0 ? void 0 : (_data$typeOfWaste = data.typeOfWaste) === null || _data$typeOfWaste === void 0 ? void 0 : _data$typeOfWaste.name,
2882
- propertyType: data === null || data === void 0 ? void 0 : (_data$propertyType = data.propertyType) === null || _data$propertyType === void 0 ? void 0 : _data$propertyType.name,
2883
- plotSize: data === null || data === void 0 ? void 0 : data.plotSize,
2884
- location: data === null || data === void 0 ? void 0 : data.location,
2885
- applicationType: "NEW_GARBAGE_CONNECTION",
2886
- connectionCategory: data === null || data === void 0 ? void 0 : (_data$connectionCateg = data.connectionCategory) === null || _data$connectionCateg === void 0 ? void 0 : _data$connectionCateg.name,
2887
- connectionHolders: [{
2888
- name: ownerData === null || ownerData === void 0 ? void 0 : ownerData.name,
2889
- mobileNumber: ownerData === null || ownerData === void 0 ? void 0 : ownerData.mobileNumber,
2890
- address: ownerData === null || ownerData === void 0 ? void 0 : ownerData.address,
2891
- emailId: ownerData === null || ownerData === void 0 ? void 0 : ownerData.emailId,
2892
- type: "CITIZEN"
2893
- }],
2894
- processInstance: {
2895
- businessService: "NewGC",
2896
- action: "INITIATE",
2897
- moduleName: "gc-services"
2898
- },
2899
- additionalDetails: {
2900
- connectionCategory: data === null || data === void 0 ? void 0 : (_data$connectionCateg2 = data.connectionCategory) === null || _data$connectionCateg2 === void 0 ? void 0 : _data$connectionCateg2.name
2901
- }
2873
+ const _temp3 = function (_currentStepData$venu, _currentStepData$apiR) {
2874
+ if (currentStepData !== null && currentStepData !== void 0 && (_currentStepData$venu = currentStepData.venueDetails) !== null && _currentStepData$venu !== void 0 && _currentStepData$venu.applicationNo || currentStepData !== null && currentStepData !== void 0 && (_currentStepData$apiR = currentStepData.apiResponseData) !== null && _currentStepData$apiR !== void 0 && _currentStepData$apiR.applicationNo) {
2875
+ var _data$frequency, _data$typeOfWaste, _data$propertyType, _data$connectionCateg, _currentStepData$venu2, _data$connectionCateg2;
2876
+ const ownerData = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.ownerDetails;
2877
+ const updatedDatacheck = (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.venueDetails) || (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.apiResponseData);
2878
+ const payload = {
2879
+ GarbageConnection: _extends({}, updatedDatacheck, {
2880
+ tenantId: tenantId,
2881
+ propertyId: data === null || data === void 0 ? void 0 : data.propertyId,
2882
+ frequency: data === null || data === void 0 ? void 0 : (_data$frequency = data.frequency) === null || _data$frequency === void 0 ? void 0 : _data$frequency.name,
2883
+ typeOfWaste: data === null || data === void 0 ? void 0 : (_data$typeOfWaste = data.typeOfWaste) === null || _data$typeOfWaste === void 0 ? void 0 : _data$typeOfWaste.name,
2884
+ propertyType: data === null || data === void 0 ? void 0 : (_data$propertyType = data.propertyType) === null || _data$propertyType === void 0 ? void 0 : _data$propertyType.name,
2885
+ plotSize: data === null || data === void 0 ? void 0 : data.plotSize,
2886
+ location: data === null || data === void 0 ? void 0 : data.location,
2887
+ connectionCategory: data === null || data === void 0 ? void 0 : (_data$connectionCateg = data.connectionCategory) === null || _data$connectionCateg === void 0 ? void 0 : _data$connectionCateg.name,
2888
+ connectionHolders: [{
2889
+ name: ownerData === null || ownerData === void 0 ? void 0 : ownerData.name,
2890
+ mobileNumber: ownerData === null || ownerData === void 0 ? void 0 : ownerData.mobileNumber,
2891
+ permanentAddress: ownerData === null || ownerData === void 0 ? void 0 : ownerData.address,
2892
+ emailId: ownerData === null || ownerData === void 0 ? void 0 : ownerData.emailId,
2893
+ type: "CITIZEN"
2894
+ }],
2895
+ processInstance: _extends({}, currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$venu2 = currentStepData.venueDetails) === null || _currentStepData$venu2 === void 0 ? void 0 : _currentStepData$venu2.processInstance, {
2896
+ action: "DRAFT"
2897
+ }),
2898
+ additionalDetails: {
2899
+ connectionCategory: data === null || data === void 0 ? void 0 : (_data$connectionCateg2 = data.connectionCategory) === null || _data$connectionCateg2 === void 0 ? void 0 : _data$connectionCateg2.name
2900
+ }
2901
+ })
2902
+ };
2903
+ console.log("payload check", payload);
2904
+ setLoader(true);
2905
+ const _temp = _catch(function () {
2906
+ return Promise.resolve(Digit.GCService.update(payload)).then(function (response) {
2907
+ var _response$GarbageConn;
2908
+ setLoader(false);
2909
+ console.log("response", response);
2910
+ goNext(response === null || response === void 0 ? void 0 : (_response$GarbageConn = response.GarbageConnection) === null || _response$GarbageConn === void 0 ? void 0 : _response$GarbageConn[0]);
2911
+ });
2912
+ }, function (error) {
2913
+ var _error$response$data, _error$response$data$, _error$response$data$2;
2914
+ setLoader(false);
2915
+ console.log("Response Data:", error.response.data);
2916
+ setShowToast(true);
2917
+ setError((_error$response$data = error.response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.Errors) === null || _error$response$data$ === void 0 ? void 0 : (_error$response$data$2 = _error$response$data$[0]) === null || _error$response$data$2 === void 0 ? void 0 : _error$response$data$2.message);
2918
+ });
2919
+ if (_temp && _temp.then) return _temp.then(function () {});
2920
+ } else {
2921
+ var _data$frequency2, _data$typeOfWaste2, _data$propertyType2, _data$connectionCateg3, _data$connectionCateg4;
2922
+ setLoader(true);
2923
+ console.log("data", data);
2924
+ console.log("currentStepData", currentStepData);
2925
+ const ownerData = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.ownerDetails;
2926
+ const payload = {
2927
+ GarbageConnection: {
2928
+ tenantId: tenantId,
2929
+ propertyId: data === null || data === void 0 ? void 0 : data.propertyId,
2930
+ frequency: data === null || data === void 0 ? void 0 : (_data$frequency2 = data.frequency) === null || _data$frequency2 === void 0 ? void 0 : _data$frequency2.name,
2931
+ typeOfWaste: data === null || data === void 0 ? void 0 : (_data$typeOfWaste2 = data.typeOfWaste) === null || _data$typeOfWaste2 === void 0 ? void 0 : _data$typeOfWaste2.name,
2932
+ propertyType: data === null || data === void 0 ? void 0 : (_data$propertyType2 = data.propertyType) === null || _data$propertyType2 === void 0 ? void 0 : _data$propertyType2.name,
2933
+ plotSize: data === null || data === void 0 ? void 0 : data.plotSize,
2934
+ location: data === null || data === void 0 ? void 0 : data.location,
2935
+ applicationType: "NEW_GARBAGE_CONNECTION",
2936
+ connectionCategory: data === null || data === void 0 ? void 0 : (_data$connectionCateg3 = data.connectionCategory) === null || _data$connectionCateg3 === void 0 ? void 0 : _data$connectionCateg3.name,
2937
+ connectionHolders: [{
2938
+ name: ownerData === null || ownerData === void 0 ? void 0 : ownerData.name,
2939
+ mobileNumber: ownerData === null || ownerData === void 0 ? void 0 : ownerData.mobileNumber,
2940
+ permanentAddress: ownerData === null || ownerData === void 0 ? void 0 : ownerData.address,
2941
+ emailId: ownerData === null || ownerData === void 0 ? void 0 : ownerData.emailId,
2942
+ type: "CITIZEN"
2943
+ }],
2944
+ processInstance: {
2945
+ businessService: "NewGC",
2946
+ action: "INITIATE",
2947
+ moduleName: "gc-services"
2948
+ },
2949
+ additionalDetails: {
2950
+ connectionCategory: data === null || data === void 0 ? void 0 : (_data$connectionCateg4 = data.connectionCategory) === null || _data$connectionCateg4 === void 0 ? void 0 : _data$connectionCateg4.name
2951
+ }
2952
+ }
2953
+ };
2954
+ const _temp2 = _catch(function () {
2955
+ return Promise.resolve(Digit.GCService.create(payload)).then(function (response) {
2956
+ var _response$GarbageConn2;
2957
+ setLoader(false);
2958
+ console.log("response", response);
2959
+ goNext(response === null || response === void 0 ? void 0 : (_response$GarbageConn2 = response.GarbageConnection) === null || _response$GarbageConn2 === void 0 ? void 0 : _response$GarbageConn2[0]);
2960
+ });
2961
+ }, function (error) {
2962
+ var _error$response$data2, _error$response$data3, _error$response$data4;
2963
+ setLoader(false);
2964
+ console.log("Response Data:", error.response.data);
2965
+ setShowToast(true);
2966
+ setError((_error$response$data2 = error.response.data) === null || _error$response$data2 === void 0 ? void 0 : (_error$response$data3 = _error$response$data2.Errors) === null || _error$response$data3 === void 0 ? void 0 : (_error$response$data4 = _error$response$data3[0]) === null || _error$response$data4 === void 0 ? void 0 : _error$response$data4.message);
2967
+ });
2968
+ if (_temp2 && _temp2.then) return _temp2.then(function () {});
2902
2969
  }
2903
- };
2904
- const _temp = _catch(function () {
2905
- return Promise.resolve(Digit.GCService.create(payload)).then(function (response) {
2906
- var _response$GarbageConn;
2907
- setLoader(false);
2908
- console.log("response", response);
2909
- goNext(response === null || response === void 0 ? void 0 : (_response$GarbageConn = response.GarbageConnection) === null || _response$GarbageConn === void 0 ? void 0 : _response$GarbageConn[0]);
2910
- });
2911
- }, function () {
2912
- setLoader(false);
2913
- });
2914
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
2970
+ }();
2971
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
2915
2972
  } catch (e) {
2916
2973
  return Promise.reject(e);
2917
2974
  }
@@ -2934,26 +2991,33 @@ const CHBCitizenSecond = _ref => {
2934
2991
  });
2935
2992
  React.useEffect(() => {
2936
2993
  console.log("propertyDetailsFetch==", propertyDetailsFetch === null || propertyDetailsFetch === void 0 ? void 0 : propertyDetailsFetch.Properties);
2937
- if (propertyDetailsFetch !== null && propertyDetailsFetch !== void 0 && propertyDetailsFetch.Properties || currentStepData !== null && currentStepData !== void 0 && currentStepData.venueDetails) {
2938
- var _propertyDetailsFetch, _propertyDetailsFetch2, _propertyDetailsFetch3, _propertyDetailsFetch4, _propertyDetailsFetch5, _propertyDetailsFetch6, _GCData$swServicesC, _FreqType$gcServices, _WasteType$gcService, _propertyDetailsFetch7, _propertyDetailsFetch8, _backStepData$propert, _backStepData$frequen, _backStepData$typeOfW;
2939
- const backStepData = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.venueDetails;
2994
+ console.log("currentStepData==", currentStepData);
2995
+ if (propertyDetailsFetch !== null && propertyDetailsFetch !== void 0 && propertyDetailsFetch.Properties || currentStepData !== null && currentStepData !== void 0 && currentStepData.venueDetails || currentStepData !== null && currentStepData !== void 0 && currentStepData.apiResponseData) {
2996
+ var _propertyDetailsFetch, _propertyDetailsFetch2, _propertyDetailsFetch3, _propertyDetailsFetch4, _propertyDetailsFetch5, _propertyDetailsFetch6, _GCData$swServicesC, _FreqType$gcServices, _WasteType$gcService, _connectionCategory$g, _propertyDetailsFetch7, _propertyDetailsFetch8;
2997
+ const backStepData = (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.venueDetails) || (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.apiResponseData);
2940
2998
  const location = (propertyDetailsFetch === null || propertyDetailsFetch === void 0 ? void 0 : (_propertyDetailsFetch = propertyDetailsFetch.Properties) === null || _propertyDetailsFetch === void 0 ? void 0 : (_propertyDetailsFetch2 = _propertyDetailsFetch[0]) === null || _propertyDetailsFetch2 === void 0 ? void 0 : (_propertyDetailsFetch3 = _propertyDetailsFetch2.owners) === null || _propertyDetailsFetch3 === void 0 ? void 0 : (_propertyDetailsFetch4 = _propertyDetailsFetch3[0]) === null || _propertyDetailsFetch4 === void 0 ? void 0 : _propertyDetailsFetch4.permanentAddress) || (backStepData === null || backStepData === void 0 ? void 0 : backStepData.location);
2941
2999
  const plotSize = (propertyDetailsFetch === null || propertyDetailsFetch === void 0 ? void 0 : (_propertyDetailsFetch5 = propertyDetailsFetch.Properties) === null || _propertyDetailsFetch5 === void 0 ? void 0 : (_propertyDetailsFetch6 = _propertyDetailsFetch5[0]) === null || _propertyDetailsFetch6 === void 0 ? void 0 : _propertyDetailsFetch6.landArea) || (backStepData === null || backStepData === void 0 ? void 0 : backStepData.plotSize);
2942
3000
  if (backStepData !== null && backStepData !== void 0 && backStepData.propertyId) setValue("propertyId", backStepData === null || backStepData === void 0 ? void 0 : backStepData.propertyId);
2943
3001
  setValue("location", location);
2944
3002
  setValue("plotSize", plotSize);
2945
3003
  const pTypeOptions = (GCData === null || GCData === void 0 ? void 0 : (_GCData$swServicesC = GCData["sw-services-calculation"]) === null || _GCData$swServicesC === void 0 ? void 0 : _GCData$swServicesC.PropertyUsageType) || [];
3004
+ console.log("pTypeOptions", pTypeOptions);
2946
3005
  const freqTypeOptions = (FreqType === null || FreqType === void 0 ? void 0 : (_FreqType$gcServices = FreqType["gc-services-masters"]) === null || _FreqType$gcServices === void 0 ? void 0 : _FreqType$gcServices.GarbageCollectionFrequency) || [];
2947
3006
  const wasteTypeOptions = (WasteType === null || WasteType === void 0 ? void 0 : (_WasteType$gcService = WasteType["gc-services-masters"]) === null || _WasteType$gcService === void 0 ? void 0 : _WasteType$gcService.TypeOfWaste) || [];
2948
- const usage = (propertyDetailsFetch === null || propertyDetailsFetch === void 0 ? void 0 : (_propertyDetailsFetch7 = propertyDetailsFetch.Properties) === null || _propertyDetailsFetch7 === void 0 ? void 0 : (_propertyDetailsFetch8 = _propertyDetailsFetch7[0]) === null || _propertyDetailsFetch8 === void 0 ? void 0 : _propertyDetailsFetch8.usageCategory) || (backStepData === null || backStepData === void 0 ? void 0 : (_backStepData$propert = backStepData.propertyType) === null || _backStepData$propert === void 0 ? void 0 : _backStepData$propert.code);
2949
- const frequency = backStepData === null || backStepData === void 0 ? void 0 : (_backStepData$frequen = backStepData.frequency) === null || _backStepData$frequen === void 0 ? void 0 : _backStepData$frequen.code;
2950
- const typeOfWaste = backStepData === null || backStepData === void 0 ? void 0 : (_backStepData$typeOfW = backStepData.typeOfWaste) === null || _backStepData$typeOfW === void 0 ? void 0 : _backStepData$typeOfW.code;
2951
- const pType = pTypeOptions === null || pTypeOptions === void 0 ? void 0 : pTypeOptions.find(item => item.code == usage);
2952
- const freType = freqTypeOptions === null || freqTypeOptions === void 0 ? void 0 : freqTypeOptions.find(item => item.code == frequency);
2953
- const wasteType = wasteTypeOptions === null || wasteTypeOptions === void 0 ? void 0 : wasteTypeOptions.find(item => item.code == typeOfWaste);
3007
+ const connectionCatoptions = (connectionCategory === null || connectionCategory === void 0 ? void 0 : (_connectionCategory$g = connectionCategory["gc-services-masters"]) === null || _connectionCategory$g === void 0 ? void 0 : _connectionCategory$g.connectionCategory) || [];
3008
+ console.log("connectionCatoptions", connectionCatoptions);
3009
+ const usage = (propertyDetailsFetch === null || propertyDetailsFetch === void 0 ? void 0 : (_propertyDetailsFetch7 = propertyDetailsFetch.Properties) === null || _propertyDetailsFetch7 === void 0 ? void 0 : (_propertyDetailsFetch8 = _propertyDetailsFetch7[0]) === null || _propertyDetailsFetch8 === void 0 ? void 0 : _propertyDetailsFetch8.usageCategory) || (backStepData === null || backStepData === void 0 ? void 0 : backStepData.propertyType);
3010
+ const frequency = backStepData === null || backStepData === void 0 ? void 0 : backStepData.frequency;
3011
+ const typeOfWaste = backStepData === null || backStepData === void 0 ? void 0 : backStepData.typeOfWaste;
3012
+ const connetionType = backStepData === null || backStepData === void 0 ? void 0 : backStepData.connectionCategory;
3013
+ const pType = pTypeOptions === null || pTypeOptions === void 0 ? void 0 : pTypeOptions.find(item => item.name == usage);
3014
+ const freType = freqTypeOptions === null || freqTypeOptions === void 0 ? void 0 : freqTypeOptions.find(item => item.name == frequency);
3015
+ const wasteType = wasteTypeOptions === null || wasteTypeOptions === void 0 ? void 0 : wasteTypeOptions.find(item => item.name == typeOfWaste);
3016
+ const connectionCategoryType = connectionCatoptions === null || connectionCatoptions === void 0 ? void 0 : connectionCatoptions.find(item => item.code == connetionType);
2954
3017
  setValue("propertyType", pType || null);
2955
3018
  setValue("frequency", freType || null);
2956
3019
  setValue("typeOfWaste", wasteType || null);
3020
+ setValue("connectionCategory", connectionCategoryType || null);
2957
3021
  }
2958
3022
  }, [propertyDetailsFetch, GCData, setValue, currentStepData]);
2959
3023
  const searchProperty = function () {
@@ -2965,6 +3029,19 @@ const CHBCitizenSecond = _ref => {
2965
3029
  return Promise.reject(e);
2966
3030
  }
2967
3031
  };
3032
+ const closeToast = () => {
3033
+ setShowToast(false);
3034
+ setError("");
3035
+ };
3036
+ const handleReset = () => {
3037
+ setValue("propertyType", null);
3038
+ setValue("plotSize", "");
3039
+ setValue("location", "");
3040
+ setValue("frequency", null);
3041
+ setValue("typeOfWaste", null);
3042
+ setValue("connectionCategory", null);
3043
+ setPropertyId(null);
3044
+ };
2968
3045
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("form", {
2969
3046
  style: {
2970
3047
  paddingBottom: "150px"
@@ -2997,6 +3074,7 @@ const CHBCitizenSecond = _ref => {
2997
3074
  value: props.value,
2998
3075
  onChange: e => {
2999
3076
  props.onChange(e.target.value);
3077
+ handleReset();
3000
3078
  },
3001
3079
  t: t
3002
3080
  })
@@ -3013,7 +3091,7 @@ const CHBCitizenSecond = _ref => {
3013
3091
  style: {
3014
3092
  color: "red"
3015
3093
  }
3016
- }, errors.propertyId.message)), ((propertyDetailsFetch === null || propertyDetailsFetch === void 0 ? void 0 : propertyDetailsFetch.Properties) || (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.venueDetails)) && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
3094
+ }, errors.propertyId.message)), ((propertyDetailsFetch === null || propertyDetailsFetch === void 0 ? void 0 : propertyDetailsFetch.Properties) || (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.venueDetails) || (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.apiResponseData)) && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
3017
3095
  style: {
3018
3096
  marginBottom: "20px"
3019
3097
  }
@@ -3183,7 +3261,7 @@ const CHBCitizenSecond = _ref => {
3183
3261
  required: t("GC_CONNECTION_TYPE_REQUIRED")
3184
3262
  },
3185
3263
  render: props => {
3186
- var _connectionCategory$g;
3264
+ var _connectionCategory$g2;
3187
3265
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
3188
3266
  style: {
3189
3267
  marginBottom: 0
@@ -3193,7 +3271,7 @@ const CHBCitizenSecond = _ref => {
3193
3271
  props.onChange(e);
3194
3272
  },
3195
3273
  selected: props.value,
3196
- option: connectionCategory === null || connectionCategory === void 0 ? void 0 : (_connectionCategory$g = connectionCategory["gc-services-masters"]) === null || _connectionCategory$g === void 0 ? void 0 : _connectionCategory$g.connectionCategory,
3274
+ option: connectionCategory === null || connectionCategory === void 0 ? void 0 : (_connectionCategory$g2 = connectionCategory["gc-services-masters"]) === null || _connectionCategory$g2 === void 0 ? void 0 : _connectionCategory$g2.connectionCategory,
3197
3275
  optionKey: "name"
3198
3276
  });
3199
3277
  }
@@ -3213,7 +3291,12 @@ const CHBCitizenSecond = _ref => {
3213
3291
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
3214
3292
  label: "Next",
3215
3293
  submit: "submit"
3216
- }))), (loader || isLoading || GCLoading || WasteTypeLoading || FreqTypeLoading || connectionCategoryLoading) && /*#__PURE__*/React__default.createElement(Loader, {
3294
+ }))), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
3295
+ isDleteBtn: true,
3296
+ error: true,
3297
+ label: error,
3298
+ onClose: closeToast
3299
+ }), (loader || isLoading || GCLoading || WasteTypeLoading || FreqTypeLoading || connectionCategoryLoading) && /*#__PURE__*/React__default.createElement(Loader, {
3217
3300
  page: true
3218
3301
  }));
3219
3302
  };
@@ -9086,15 +9169,22 @@ const NewADSStepFormOne = _ref => {
9086
9169
  };
9087
9170
 
9088
9171
  const CHBCitizenDetailsNew = _ref => {
9089
- var _user$info, _user$info2, _user$info3;
9172
+ var _history$location, _user$info, _user$info2, _user$info3;
9090
9173
  let {
9091
9174
  t,
9092
9175
  goNext,
9093
9176
  currentStepData,
9094
9177
  onGoBack
9095
9178
  } = _ref;
9179
+ const dispatch = reactRedux.useDispatch();
9096
9180
  const isCitizen = window.location.href.includes("citizen");
9097
9181
  const user = Digit.UserService.getUser();
9182
+ const tenantId = window.location.href.includes("citizen") ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
9183
+ const history = reactRouterDom.useHistory();
9184
+ const [loader, setLoader] = React.useState(false);
9185
+ const pathname = (history === null || history === void 0 ? void 0 : (_history$location = history.location) === null || _history$location === void 0 ? void 0 : _history$location.pathname) || "";
9186
+ const applicationNumber = pathname === null || pathname === void 0 ? void 0 : pathname.split("/").pop();
9187
+ console.log("applicationNumber", applicationNumber);
9098
9188
  const {
9099
9189
  control,
9100
9190
  handleSubmit,
@@ -9111,6 +9201,37 @@ const CHBCitizenDetailsNew = _ref => {
9111
9201
  address: ""
9112
9202
  }
9113
9203
  });
9204
+ const fetchChallans = function (filters) {
9205
+ try {
9206
+ setLoader(true);
9207
+ const _temp = _catch(function () {
9208
+ return Promise.resolve(Digit.GCService.search({
9209
+ tenantId,
9210
+ filters
9211
+ })).then(function (responseData) {
9212
+ var _responseData$Garbage;
9213
+ console.log("search ", responseData);
9214
+ dispatch(UPDATE_GarbageApplication_FORM("apiResponseData", responseData === null || responseData === void 0 ? void 0 : (_responseData$Garbage = responseData.GarbageConnection) === null || _responseData$Garbage === void 0 ? void 0 : _responseData$Garbage[0]));
9215
+ setLoader(false);
9216
+ });
9217
+ }, function (error) {
9218
+ console.log("error", error);
9219
+ setLoader(false);
9220
+ });
9221
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
9222
+ } catch (e) {
9223
+ return Promise.reject(e);
9224
+ }
9225
+ };
9226
+ React.useEffect(() => {
9227
+ console.log("tes===", applicationNumber);
9228
+ if (applicationNumber) {
9229
+ console.log("here");
9230
+ const filters = {};
9231
+ filters.applicationNumber = applicationNumber;
9232
+ fetchChallans(filters);
9233
+ }
9234
+ }, [applicationNumber]);
9114
9235
  const onSubmit = function (data) {
9115
9236
  try {
9116
9237
  console.log("data===", data);
@@ -9123,12 +9244,20 @@ const CHBCitizenDetailsNew = _ref => {
9123
9244
  React.useEffect(() => {
9124
9245
  console.log("currentStepData", currentStepData);
9125
9246
  const formattedData = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.ownerDetails;
9247
+ const apiRes = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.apiResponseData;
9126
9248
  if (formattedData) {
9127
9249
  setValue("address", formattedData === null || formattedData === void 0 ? void 0 : formattedData.address);
9128
9250
  setValue("emailId", formattedData === null || formattedData === void 0 ? void 0 : formattedData.emailId);
9129
9251
  setValue("mobileNumber", formattedData === null || formattedData === void 0 ? void 0 : formattedData.mobileNumber);
9130
9252
  setValue("name", formattedData === null || formattedData === void 0 ? void 0 : formattedData.name);
9131
9253
  }
9254
+ if (apiRes) {
9255
+ var _apiRes$connectionHol, _apiRes$connectionHol2, _apiRes$connectionHol3, _apiRes$connectionHol4, _apiRes$connectionHol5, _apiRes$connectionHol6, _apiRes$connectionHol7, _apiRes$connectionHol8;
9256
+ setValue("address", apiRes === null || apiRes === void 0 ? void 0 : (_apiRes$connectionHol = apiRes.connectionHolders) === null || _apiRes$connectionHol === void 0 ? void 0 : (_apiRes$connectionHol2 = _apiRes$connectionHol[0]) === null || _apiRes$connectionHol2 === void 0 ? void 0 : _apiRes$connectionHol2.permanentAddress);
9257
+ setValue("emailId", apiRes === null || apiRes === void 0 ? void 0 : (_apiRes$connectionHol3 = apiRes.connectionHolders) === null || _apiRes$connectionHol3 === void 0 ? void 0 : (_apiRes$connectionHol4 = _apiRes$connectionHol3[0]) === null || _apiRes$connectionHol4 === void 0 ? void 0 : _apiRes$connectionHol4.emailId);
9258
+ setValue("mobileNumber", apiRes === null || apiRes === void 0 ? void 0 : (_apiRes$connectionHol5 = apiRes.connectionHolders) === null || _apiRes$connectionHol5 === void 0 ? void 0 : (_apiRes$connectionHol6 = _apiRes$connectionHol5[0]) === null || _apiRes$connectionHol6 === void 0 ? void 0 : _apiRes$connectionHol6.mobileNumber);
9259
+ setValue("name", apiRes === null || apiRes === void 0 ? void 0 : (_apiRes$connectionHol7 = apiRes.connectionHolders) === null || _apiRes$connectionHol7 === void 0 ? void 0 : (_apiRes$connectionHol8 = _apiRes$connectionHol7[0]) === null || _apiRes$connectionHol8 === void 0 ? void 0 : _apiRes$connectionHol8.name);
9260
+ }
9132
9261
  }, [currentStepData, setValue]);
9133
9262
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("form", {
9134
9263
  onSubmit: handleSubmit(onSubmit)
@@ -9280,7 +9409,9 @@ const CHBCitizenDetailsNew = _ref => {
9280
9409
  }, errors.address.message))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
9281
9410
  label: "Next",
9282
9411
  submit: "submit"
9283
- }))));
9412
+ }))), loader && /*#__PURE__*/React__default.createElement(Loader, {
9413
+ page: true
9414
+ }));
9284
9415
  };
9285
9416
 
9286
9417
  const NewADSStepFormTwo = _ref => {
@@ -9347,7 +9478,6 @@ const NewADSStepFormThree = _ref => {
9347
9478
  });
9348
9479
  const goNext = function (finalData) {
9349
9480
  try {
9350
- var _checkFormData$docume, _checkFormData$docume2, _checkFormData$venueD;
9351
9481
  const missingFields = validation(finalData);
9352
9482
  if (missingFields.length > 0) {
9353
9483
  setError("" + t("GC_" + missingFields[0].replace(".", "_").toUpperCase()));
@@ -9355,28 +9485,8 @@ const NewADSStepFormThree = _ref => {
9355
9485
  setTimeout(() => setShowToast(false), 3000);
9356
9486
  return Promise.resolve();
9357
9487
  }
9358
- console.log("checkFormData", checkFormData);
9359
- setLoader(true);
9360
- const payload = {
9361
- GarbageConnection: _extends({}, checkFormData === null || checkFormData === void 0 ? void 0 : checkFormData.venueDetails, {
9362
- documents: checkFormData === null || checkFormData === void 0 ? void 0 : (_checkFormData$docume = checkFormData.documents) === null || _checkFormData$docume === void 0 ? void 0 : (_checkFormData$docume2 = _checkFormData$docume.documents) === null || _checkFormData$docume2 === void 0 ? void 0 : _checkFormData$docume2.documents,
9363
- processInstance: _extends({}, checkFormData === null || checkFormData === void 0 ? void 0 : (_checkFormData$venueD = checkFormData.venueDetails) === null || _checkFormData$venueD === void 0 ? void 0 : _checkFormData$venueD.processInstance, {
9364
- action: "DRAFT"
9365
- })
9366
- })
9367
- };
9368
- const _temp = _catch(function () {
9369
- return Promise.resolve(Digit.GCService.update(payload)).then(function (response) {
9370
- var _response$GarbageConn;
9371
- console.log("response", response);
9372
- setLoader(false);
9373
- dispatch(UPDATE_GarbageApplication_FORM("venueDetails", response === null || response === void 0 ? void 0 : (_response$GarbageConn = response.GarbageConnection) === null || _response$GarbageConn === void 0 ? void 0 : _response$GarbageConn[0]));
9374
- onGoNext();
9375
- });
9376
- }, function () {
9377
- setLoader(false);
9378
- });
9379
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
9488
+ onGoNext();
9489
+ return Promise.resolve();
9380
9490
  } catch (e) {
9381
9491
  return Promise.reject(e);
9382
9492
  }
@@ -9579,7 +9689,7 @@ function ChallanDocument(_ref2) {
9579
9689
  }
9580
9690
 
9581
9691
  function CHBSummary(_ref) {
9582
- var _formData$documents, _formData$documents$d, _formData$apiData, _formData$apiData$App, _formData$apiData$App2, _formData$venueDetail, _user$info, _user$info$roles, _workflowDetails$data, _workflowDetails$data2, _workflowDetails$data3, _workflowDetails$data4, _workflowDetails$data5, _formData$ownerDetail, _formData$ownerDetail2, _formData$ownerDetail3, _formData$ownerDetail4, _formData$venueDetail2, _formData$venueDetail3, _formData$venueDetail4, _formData$venueDetail5, _formData$venueDetail6, _workflowDetails$data6, _workflowDetails$data7, _workflowDetails$data8;
9692
+ var _formData$documents, _formData$documents$d, _formData$apiData, _formData$apiData$App, _formData$apiData$App2, _formData$venueDetail, _user$info, _user$info$roles, _workflowDetails$data, _workflowDetails$data2, _workflowDetails$data3, _workflowDetails$data4, _workflowDetails$data5, _formData$ownerDetail, _formData$ownerDetail2, _formData$ownerDetail3, _formData$ownerDetail4, _formData$venueDetail2, _formData$venueDetail3, _formData$venueDetail4, _formData$venueDetail5, _formData$venueDetail6, _formData$venueDetail7, _formData$venueDetail8, _formData$venueDetail9, _workflowDetails$data6, _workflowDetails$data7, _workflowDetails$data8;
9583
9693
  let {
9584
9694
  formData,
9585
9695
  goNext,
@@ -9672,7 +9782,13 @@ function CHBSummary(_ref) {
9672
9782
  style: {
9673
9783
  fontSize: "24px"
9674
9784
  }
9675
- }, t("PT_DETAILS")), renderLabel(t("NDC_MSG_PROPERTY_LABEL"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail2 = formData.venueDetails) === null || _formData$venueDetail2 === void 0 ? void 0 : _formData$venueDetail2.propertyId), renderLabel(t("NDC_MSG_PROPERTY_TYPE_LABEL"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail3 = formData.venueDetails) === null || _formData$venueDetail3 === void 0 ? void 0 : (_formData$venueDetail4 = _formData$venueDetail3.propertyType) === null || _formData$venueDetail4 === void 0 ? void 0 : _formData$venueDetail4.name), renderLabel(t("PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_PLOT_SIZE"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail5 = formData.venueDetails) === null || _formData$venueDetail5 === void 0 ? void 0 : _formData$venueDetail5.plotSize), renderLabel(t("PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_PROPERTY_ADDRESS"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail6 = formData.venueDetails) === null || _formData$venueDetail6 === void 0 ? void 0 : _formData$venueDetail6.location)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSubHeader, {
9785
+ }, t("PT_DETAILS")), renderLabel(t("NDC_MSG_PROPERTY_LABEL"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail2 = formData.venueDetails) === null || _formData$venueDetail2 === void 0 ? void 0 : _formData$venueDetail2.propertyId), renderLabel(t("NDC_MSG_PROPERTY_TYPE_LABEL"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail3 = formData.venueDetails) === null || _formData$venueDetail3 === void 0 ? void 0 : _formData$venueDetail3.propertyType), renderLabel(t("PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_PLOT_SIZE"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail4 = formData.venueDetails) === null || _formData$venueDetail4 === void 0 ? void 0 : _formData$venueDetail4.plotSize), renderLabel(t("PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_PROPERTY_ADDRESS"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail5 = formData.venueDetails) === null || _formData$venueDetail5 === void 0 ? void 0 : _formData$venueDetail5.location)), /*#__PURE__*/React__default.createElement("div", {
9786
+ style: sectionStyle
9787
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSubHeader, {
9788
+ style: {
9789
+ fontSize: "24px"
9790
+ }
9791
+ }, t("GC_CONNECTION_DETAILS")), renderLabel(t("GC_CONNECTION_TYPE"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail6 = formData.venueDetails) === null || _formData$venueDetail6 === void 0 ? void 0 : _formData$venueDetail6.connectionCategory), renderLabel(t("GC_FREQUENCY"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail7 = formData.venueDetails) === null || _formData$venueDetail7 === void 0 ? void 0 : _formData$venueDetail7.frequency), renderLabel(t("GC_WASTE_TYPE"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail8 = formData.venueDetails) === null || _formData$venueDetail8 === void 0 ? void 0 : _formData$venueDetail8.typeOfWaste), renderLabel(t("GC_LOCATION"), formData === null || formData === void 0 ? void 0 : (_formData$venueDetail9 = formData.venueDetails) === null || _formData$venueDetail9 === void 0 ? void 0 : _formData$venueDetail9.location)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSubHeader, {
9676
9792
  style: {
9677
9793
  fontSize: "24px",
9678
9794
  marginTop: "30px"
@@ -9758,13 +9874,20 @@ const NewADSStepFormFour = _ref => {
9758
9874
  };
9759
9875
  const onSubmit = function (data, actionStatus) {
9760
9876
  try {
9761
- var _data$venueDetails;
9877
+ var _data$apiResponseData, _data$documents, _data$documents$docum, _data$venueDetails;
9762
9878
  setLoader(true);
9879
+ console.log("data", data);
9880
+ const apiDocs = (data === null || data === void 0 ? void 0 : (_data$apiResponseData = data.apiResponseData) === null || _data$apiResponseData === void 0 ? void 0 : _data$apiResponseData.documents) || [];
9881
+ const formDocs = (data === null || data === void 0 ? void 0 : (_data$documents = data.documents) === null || _data$documents === void 0 ? void 0 : (_data$documents$docum = _data$documents.documents) === null || _data$documents$docum === void 0 ? void 0 : _data$documents$docum.documents) || [];
9882
+ const existingFileStoreIds = apiDocs === null || apiDocs === void 0 ? void 0 : apiDocs.map(doc => doc.fileStoreId);
9883
+ const newDocuments = formDocs.filter(doc => !(existingFileStoreIds !== null && existingFileStoreIds !== void 0 && existingFileStoreIds.includes(doc.fileStoreId)));
9884
+ console.log("NEW DOCUMENTS TO SEND:", newDocuments);
9763
9885
  const payload = {
9764
9886
  GarbageConnection: _extends({}, data === null || data === void 0 ? void 0 : data.venueDetails, {
9765
9887
  processInstance: _extends({}, data === null || data === void 0 ? void 0 : (_data$venueDetails = data.venueDetails) === null || _data$venueDetails === void 0 ? void 0 : _data$venueDetails.processInstance, {
9766
9888
  action: actionStatus
9767
- })
9889
+ }),
9890
+ documents: newDocuments
9768
9891
  })
9769
9892
  };
9770
9893
  return Promise.resolve(_catch(function () {
@@ -9821,18 +9944,19 @@ const SelectNDCDocuments = _ref => {
9821
9944
  formState
9822
9945
  } = _ref;
9823
9946
  const tenantId = window.location.href.includes("employee") ? Digit.ULBService.getCurrentPermanentCity() : localStorage.getItem("CITIZEN.CITY");
9824
- const checkFormData = reactRedux.useSelector(state => state.ndc.NDCForm.formData || {});
9947
+ const checkFormData = reactRedux.useSelector(state => state.gc.GarbageApplicationFormReducer.formData || {});
9825
9948
  const stateId = Digit.ULBService.getStateId();
9826
9949
  const [documents, setDocuments] = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$documents = formData.documents) === null || _formData$documents === void 0 ? void 0 : _formData$documents.documents) || []);
9827
9950
  const [error, setError] = React.useState(null);
9828
9951
  React.useEffect(() => {
9829
- var _checkFormData$respon, _checkFormData$respon2, _checkFormData$respon3;
9830
- 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) {
9831
- var _checkFormData$respon4, _checkFormData$respon5, _checkFormData$respon6;
9832
- 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 => ({
9952
+ var _checkFormData$venueD, _checkFormData$venueD2;
9953
+ console.log("checkFormData", checkFormData);
9954
+ if (checkFormData !== null && checkFormData !== void 0 && (_checkFormData$venueD = checkFormData.venueDetails) !== null && _checkFormData$venueD !== void 0 && (_checkFormData$venueD2 = _checkFormData$venueD.documents) !== null && _checkFormData$venueD2 !== void 0 && _checkFormData$venueD2.length && documents.length === 0) {
9955
+ var _checkFormData$venueD3, _checkFormData$venueD4;
9956
+ const apiDocs = checkFormData === null || checkFormData === void 0 ? void 0 : (_checkFormData$venueD3 = checkFormData.venueDetails) === null || _checkFormData$venueD3 === void 0 ? void 0 : (_checkFormData$venueD4 = _checkFormData$venueD3.documents) === null || _checkFormData$venueD4 === void 0 ? void 0 : _checkFormData$venueD4.map(doc => ({
9833
9957
  documentType: doc === null || doc === void 0 ? void 0 : doc.documentType,
9834
- fileStoreId: doc === null || doc === void 0 ? void 0 : doc.documentAttachment,
9835
- documentUid: doc === null || doc === void 0 ? void 0 : doc.documentAttachment
9958
+ fileStoreId: doc === null || doc === void 0 ? void 0 : doc.fileStoreId,
9959
+ documentUid: doc === null || doc === void 0 ? void 0 : doc.fileStoreId
9836
9960
  }));
9837
9961
  setDocuments(apiDocs);
9838
9962
  }
@@ -9848,6 +9972,8 @@ const SelectNDCDocuments = _ref => {
9848
9972
  }]);
9849
9973
  const ndcDocuments = data === null || data === void 0 ? void 0 : (_data$gcServicesMas = data["gc-services-masters"]) === null || _data$gcServicesMas === void 0 ? void 0 : _data$gcServicesMas.Documents;
9850
9974
  const goNext = () => {
9975
+ console.log("here stop");
9976
+ console.log("formData", formData);
9851
9977
  onSelect(config.key, {
9852
9978
  documents,
9853
9979
  ndcDocumentsLength: ndcDocuments === null || ndcDocuments === void 0 ? void 0 : ndcDocuments.length
@@ -9891,7 +10017,8 @@ function SelectDocument(_ref2) {
9891
10017
  documents,
9892
10018
  setFormError,
9893
10019
  config,
9894
- formState
10020
+ formState,
10021
+ formData
9895
10022
  } = _ref2;
9896
10023
  const filteredDocument = documents === null || documents === void 0 ? void 0 : documents.filter(item => {
9897
10024
  var _item$documentType;
@@ -9910,6 +10037,7 @@ function SelectDocument(_ref2) {
9910
10037
  }
9911
10038
  }, [filteredDocument]);
9912
10039
  React.useEffect(() => {
10040
+ console.log("here come", documents);
9913
10041
  if (uploadedFile) {
9914
10042
  setDocuments(prev => {
9915
10043
  const filteredDocumentsByDocumentType = prev === null || prev === void 0 ? void 0 : prev.filter(item => (item === null || item === void 0 ? void 0 : item.documentType) !== (doc === null || doc === void 0 ? void 0 : doc.code));
@@ -10688,791 +10816,6 @@ const config = [{
10688
10816
  }]
10689
10817
  }];
10690
10818
 
10691
- var bind = function bind(fn, thisArg) {
10692
- return function wrap() {
10693
- var args = new Array(arguments.length);
10694
- for (var i = 0; i < args.length; i++) {
10695
- args[i] = arguments[i];
10696
- }
10697
- return fn.apply(thisArg, args);
10698
- };
10699
- };
10700
-
10701
- var toString = Object.prototype.toString;
10702
- function isArray(val) {
10703
- return toString.call(val) === '[object Array]';
10704
- }
10705
- function isUndefined(val) {
10706
- return typeof val === 'undefined';
10707
- }
10708
- function isBuffer(val) {
10709
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
10710
- }
10711
- function isArrayBuffer(val) {
10712
- return toString.call(val) === '[object ArrayBuffer]';
10713
- }
10714
- function isFormData(val) {
10715
- return typeof FormData !== 'undefined' && val instanceof FormData;
10716
- }
10717
- function isArrayBufferView(val) {
10718
- var result;
10719
- if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
10720
- result = ArrayBuffer.isView(val);
10721
- } else {
10722
- result = val && val.buffer && val.buffer instanceof ArrayBuffer;
10723
- }
10724
- return result;
10725
- }
10726
- function isString(val) {
10727
- return typeof val === 'string';
10728
- }
10729
- function isNumber(val) {
10730
- return typeof val === 'number';
10731
- }
10732
- function isObject(val) {
10733
- return val !== null && typeof val === 'object';
10734
- }
10735
- function isPlainObject(val) {
10736
- if (toString.call(val) !== '[object Object]') {
10737
- return false;
10738
- }
10739
- var prototype = Object.getPrototypeOf(val);
10740
- return prototype === null || prototype === Object.prototype;
10741
- }
10742
- function isDate$1(val) {
10743
- return toString.call(val) === '[object Date]';
10744
- }
10745
- function isFile(val) {
10746
- return toString.call(val) === '[object File]';
10747
- }
10748
- function isBlob(val) {
10749
- return toString.call(val) === '[object Blob]';
10750
- }
10751
- function isFunction(val) {
10752
- return toString.call(val) === '[object Function]';
10753
- }
10754
- function isStream(val) {
10755
- return isObject(val) && isFunction(val.pipe);
10756
- }
10757
- function isURLSearchParams(val) {
10758
- return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
10759
- }
10760
- function trim(str) {
10761
- return str.replace(/^\s*/, '').replace(/\s*$/, '');
10762
- }
10763
- function isStandardBrowserEnv() {
10764
- if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || navigator.product === 'NativeScript' || navigator.product === 'NS')) {
10765
- return false;
10766
- }
10767
- return typeof window !== 'undefined' && typeof document !== 'undefined';
10768
- }
10769
- function forEach(obj, fn) {
10770
- if (obj === null || typeof obj === 'undefined') {
10771
- return;
10772
- }
10773
- if (typeof obj !== 'object') {
10774
- obj = [obj];
10775
- }
10776
- if (isArray(obj)) {
10777
- for (var i = 0, l = obj.length; i < l; i++) {
10778
- fn.call(null, obj[i], i, obj);
10779
- }
10780
- } else {
10781
- for (var key in obj) {
10782
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
10783
- fn.call(null, obj[key], key, obj);
10784
- }
10785
- }
10786
- }
10787
- }
10788
- function merge() {
10789
- var result = {};
10790
- function assignValue(val, key) {
10791
- if (isPlainObject(result[key]) && isPlainObject(val)) {
10792
- result[key] = merge(result[key], val);
10793
- } else if (isPlainObject(val)) {
10794
- result[key] = merge({}, val);
10795
- } else if (isArray(val)) {
10796
- result[key] = val.slice();
10797
- } else {
10798
- result[key] = val;
10799
- }
10800
- }
10801
- for (var i = 0, l = arguments.length; i < l; i++) {
10802
- forEach(arguments[i], assignValue);
10803
- }
10804
- return result;
10805
- }
10806
- function extend(a, b, thisArg) {
10807
- forEach(b, function assignValue(val, key) {
10808
- if (thisArg && typeof val === 'function') {
10809
- a[key] = bind(val, thisArg);
10810
- } else {
10811
- a[key] = val;
10812
- }
10813
- });
10814
- return a;
10815
- }
10816
- function stripBOM(content) {
10817
- if (content.charCodeAt(0) === 0xFEFF) {
10818
- content = content.slice(1);
10819
- }
10820
- return content;
10821
- }
10822
- var utils = {
10823
- isArray: isArray,
10824
- isArrayBuffer: isArrayBuffer,
10825
- isBuffer: isBuffer,
10826
- isFormData: isFormData,
10827
- isArrayBufferView: isArrayBufferView,
10828
- isString: isString,
10829
- isNumber: isNumber,
10830
- isObject: isObject,
10831
- isPlainObject: isPlainObject,
10832
- isUndefined: isUndefined,
10833
- isDate: isDate$1,
10834
- isFile: isFile,
10835
- isBlob: isBlob,
10836
- isFunction: isFunction,
10837
- isStream: isStream,
10838
- isURLSearchParams: isURLSearchParams,
10839
- isStandardBrowserEnv: isStandardBrowserEnv,
10840
- forEach: forEach,
10841
- merge: merge,
10842
- extend: extend,
10843
- trim: trim,
10844
- stripBOM: stripBOM
10845
- };
10846
-
10847
- function encode(val) {
10848
- return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
10849
- }
10850
- var buildURL = function buildURL(url, params, paramsSerializer) {
10851
- if (!params) {
10852
- return url;
10853
- }
10854
- var serializedParams;
10855
- if (paramsSerializer) {
10856
- serializedParams = paramsSerializer(params);
10857
- } else if (utils.isURLSearchParams(params)) {
10858
- serializedParams = params.toString();
10859
- } else {
10860
- var parts = [];
10861
- utils.forEach(params, function serialize(val, key) {
10862
- if (val === null || typeof val === 'undefined') {
10863
- return;
10864
- }
10865
- if (utils.isArray(val)) {
10866
- key = key + '[]';
10867
- } else {
10868
- val = [val];
10869
- }
10870
- utils.forEach(val, function parseValue(v) {
10871
- if (utils.isDate(v)) {
10872
- v = v.toISOString();
10873
- } else if (utils.isObject(v)) {
10874
- v = JSON.stringify(v);
10875
- }
10876
- parts.push(encode(key) + '=' + encode(v));
10877
- });
10878
- });
10879
- serializedParams = parts.join('&');
10880
- }
10881
- if (serializedParams) {
10882
- var hashmarkIndex = url.indexOf('#');
10883
- if (hashmarkIndex !== -1) {
10884
- url = url.slice(0, hashmarkIndex);
10885
- }
10886
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
10887
- }
10888
- return url;
10889
- };
10890
-
10891
- function InterceptorManager() {
10892
- this.handlers = [];
10893
- }
10894
- InterceptorManager.prototype.use = function use(fulfilled, rejected) {
10895
- this.handlers.push({
10896
- fulfilled: fulfilled,
10897
- rejected: rejected
10898
- });
10899
- return this.handlers.length - 1;
10900
- };
10901
- InterceptorManager.prototype.eject = function eject(id) {
10902
- if (this.handlers[id]) {
10903
- this.handlers[id] = null;
10904
- }
10905
- };
10906
- InterceptorManager.prototype.forEach = function forEach(fn) {
10907
- utils.forEach(this.handlers, function forEachHandler(h) {
10908
- if (h !== null) {
10909
- fn(h);
10910
- }
10911
- });
10912
- };
10913
- var InterceptorManager_1 = InterceptorManager;
10914
-
10915
- var transformData = function transformData(data, headers, fns) {
10916
- utils.forEach(fns, function transform(fn) {
10917
- data = fn(data, headers);
10918
- });
10919
- return data;
10920
- };
10921
-
10922
- var isCancel = function isCancel(value) {
10923
- return !!(value && value.__CANCEL__);
10924
- };
10925
-
10926
- var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
10927
- utils.forEach(headers, function processHeader(value, name) {
10928
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
10929
- headers[normalizedName] = value;
10930
- delete headers[name];
10931
- }
10932
- });
10933
- };
10934
-
10935
- var enhanceError = function enhanceError(error, config, code, request, response) {
10936
- error.config = config;
10937
- if (code) {
10938
- error.code = code;
10939
- }
10940
- error.request = request;
10941
- error.response = response;
10942
- error.isAxiosError = true;
10943
- error.toJSON = function toJSON() {
10944
- return {
10945
- message: this.message,
10946
- name: this.name,
10947
- description: this.description,
10948
- number: this.number,
10949
- fileName: this.fileName,
10950
- lineNumber: this.lineNumber,
10951
- columnNumber: this.columnNumber,
10952
- stack: this.stack,
10953
- config: this.config,
10954
- code: this.code
10955
- };
10956
- };
10957
- return error;
10958
- };
10959
-
10960
- var createError = function createError(message, config, code, request, response) {
10961
- var error = new Error(message);
10962
- return enhanceError(error, config, code, request, response);
10963
- };
10964
-
10965
- var settle = function settle(resolve, reject, response) {
10966
- var validateStatus = response.config.validateStatus;
10967
- if (!response.status || !validateStatus || validateStatus(response.status)) {
10968
- resolve(response);
10969
- } else {
10970
- reject(createError('Request failed with status code ' + response.status, response.config, null, response.request, response));
10971
- }
10972
- };
10973
-
10974
- var cookies = utils.isStandardBrowserEnv() ? function standardBrowserEnv() {
10975
- return {
10976
- write: function write(name, value, expires, path, domain, secure) {
10977
- var cookie = [];
10978
- cookie.push(name + '=' + encodeURIComponent(value));
10979
- if (utils.isNumber(expires)) {
10980
- cookie.push('expires=' + new Date(expires).toGMTString());
10981
- }
10982
- if (utils.isString(path)) {
10983
- cookie.push('path=' + path);
10984
- }
10985
- if (utils.isString(domain)) {
10986
- cookie.push('domain=' + domain);
10987
- }
10988
- if (secure === true) {
10989
- cookie.push('secure');
10990
- }
10991
- document.cookie = cookie.join('; ');
10992
- },
10993
- read: function read(name) {
10994
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
10995
- return match ? decodeURIComponent(match[3]) : null;
10996
- },
10997
- remove: function remove(name) {
10998
- this.write(name, '', Date.now() - 86400000);
10999
- }
11000
- };
11001
- }() : function nonStandardBrowserEnv() {
11002
- return {
11003
- write: function write() {},
11004
- read: function read() {
11005
- return null;
11006
- },
11007
- remove: function remove() {}
11008
- };
11009
- }();
11010
-
11011
- var isAbsoluteURL = function isAbsoluteURL(url) {
11012
- return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
11013
- };
11014
-
11015
- var combineURLs = function combineURLs(baseURL, relativeURL) {
11016
- return relativeURL ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
11017
- };
11018
-
11019
- var buildFullPath = function buildFullPath(baseURL, requestedURL) {
11020
- if (baseURL && !isAbsoluteURL(requestedURL)) {
11021
- return combineURLs(baseURL, requestedURL);
11022
- }
11023
- return requestedURL;
11024
- };
11025
-
11026
- var ignoreDuplicateOf = ['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent'];
11027
- var parseHeaders = function parseHeaders(headers) {
11028
- var parsed = {};
11029
- var key;
11030
- var val;
11031
- var i;
11032
- if (!headers) {
11033
- return parsed;
11034
- }
11035
- utils.forEach(headers.split('\n'), function parser(line) {
11036
- i = line.indexOf(':');
11037
- key = utils.trim(line.substr(0, i)).toLowerCase();
11038
- val = utils.trim(line.substr(i + 1));
11039
- if (key) {
11040
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
11041
- return;
11042
- }
11043
- if (key === 'set-cookie') {
11044
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
11045
- } else {
11046
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
11047
- }
11048
- }
11049
- });
11050
- return parsed;
11051
- };
11052
-
11053
- var isURLSameOrigin = utils.isStandardBrowserEnv() ? function standardBrowserEnv() {
11054
- var msie = /(msie|trident)/i.test(navigator.userAgent);
11055
- var urlParsingNode = document.createElement('a');
11056
- var originURL;
11057
- function resolveURL(url) {
11058
- var href = url;
11059
- if (msie) {
11060
- urlParsingNode.setAttribute('href', href);
11061
- href = urlParsingNode.href;
11062
- }
11063
- urlParsingNode.setAttribute('href', href);
11064
- return {
11065
- href: urlParsingNode.href,
11066
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
11067
- host: urlParsingNode.host,
11068
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
11069
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
11070
- hostname: urlParsingNode.hostname,
11071
- port: urlParsingNode.port,
11072
- pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
11073
- };
11074
- }
11075
- originURL = resolveURL(window.location.href);
11076
- return function isURLSameOrigin(requestURL) {
11077
- var parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
11078
- return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
11079
- };
11080
- }() : function nonStandardBrowserEnv() {
11081
- return function isURLSameOrigin() {
11082
- return true;
11083
- };
11084
- }();
11085
-
11086
- var xhr = function xhrAdapter(config) {
11087
- return new Promise(function dispatchXhrRequest(resolve, reject) {
11088
- var requestData = config.data;
11089
- var requestHeaders = config.headers;
11090
- if (utils.isFormData(requestData)) {
11091
- delete requestHeaders['Content-Type'];
11092
- }
11093
- var request = new XMLHttpRequest();
11094
- if (config.auth) {
11095
- var username = config.auth.username || '';
11096
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
11097
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
11098
- }
11099
- var fullPath = buildFullPath(config.baseURL, config.url);
11100
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
11101
- request.timeout = config.timeout;
11102
- request.onreadystatechange = function handleLoad() {
11103
- if (!request || request.readyState !== 4) {
11104
- return;
11105
- }
11106
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
11107
- return;
11108
- }
11109
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
11110
- var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
11111
- var response = {
11112
- data: responseData,
11113
- status: request.status,
11114
- statusText: request.statusText,
11115
- headers: responseHeaders,
11116
- config: config,
11117
- request: request
11118
- };
11119
- settle(resolve, reject, response);
11120
- request = null;
11121
- };
11122
- request.onabort = function handleAbort() {
11123
- if (!request) {
11124
- return;
11125
- }
11126
- reject(createError('Request aborted', config, 'ECONNABORTED', request));
11127
- request = null;
11128
- };
11129
- request.onerror = function handleError() {
11130
- reject(createError('Network Error', config, null, request));
11131
- request = null;
11132
- };
11133
- request.ontimeout = function handleTimeout() {
11134
- var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
11135
- if (config.timeoutErrorMessage) {
11136
- timeoutErrorMessage = config.timeoutErrorMessage;
11137
- }
11138
- reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', request));
11139
- request = null;
11140
- };
11141
- if (utils.isStandardBrowserEnv()) {
11142
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : undefined;
11143
- if (xsrfValue) {
11144
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
11145
- }
11146
- }
11147
- if ('setRequestHeader' in request) {
11148
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
11149
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
11150
- delete requestHeaders[key];
11151
- } else {
11152
- request.setRequestHeader(key, val);
11153
- }
11154
- });
11155
- }
11156
- if (!utils.isUndefined(config.withCredentials)) {
11157
- request.withCredentials = !!config.withCredentials;
11158
- }
11159
- if (config.responseType) {
11160
- try {
11161
- request.responseType = config.responseType;
11162
- } catch (e) {
11163
- if (config.responseType !== 'json') {
11164
- throw e;
11165
- }
11166
- }
11167
- }
11168
- if (typeof config.onDownloadProgress === 'function') {
11169
- request.addEventListener('progress', config.onDownloadProgress);
11170
- }
11171
- if (typeof config.onUploadProgress === 'function' && request.upload) {
11172
- request.upload.addEventListener('progress', config.onUploadProgress);
11173
- }
11174
- if (config.cancelToken) {
11175
- config.cancelToken.promise.then(function onCanceled(cancel) {
11176
- if (!request) {
11177
- return;
11178
- }
11179
- request.abort();
11180
- reject(cancel);
11181
- request = null;
11182
- });
11183
- }
11184
- if (!requestData) {
11185
- requestData = null;
11186
- }
11187
- request.send(requestData);
11188
- });
11189
- };
11190
-
11191
- var DEFAULT_CONTENT_TYPE = {
11192
- 'Content-Type': 'application/x-www-form-urlencoded'
11193
- };
11194
- function setContentTypeIfUnset(headers, value) {
11195
- if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
11196
- headers['Content-Type'] = value;
11197
- }
11198
- }
11199
- function getDefaultAdapter() {
11200
- var adapter;
11201
- if (typeof XMLHttpRequest !== 'undefined') {
11202
- adapter = xhr;
11203
- } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
11204
- adapter = xhr;
11205
- }
11206
- return adapter;
11207
- }
11208
- var defaults = {
11209
- adapter: getDefaultAdapter(),
11210
- transformRequest: [function transformRequest(data, headers) {
11211
- normalizeHeaderName(headers, 'Accept');
11212
- normalizeHeaderName(headers, 'Content-Type');
11213
- if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {
11214
- return data;
11215
- }
11216
- if (utils.isArrayBufferView(data)) {
11217
- return data.buffer;
11218
- }
11219
- if (utils.isURLSearchParams(data)) {
11220
- setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
11221
- return data.toString();
11222
- }
11223
- if (utils.isObject(data)) {
11224
- setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
11225
- return JSON.stringify(data);
11226
- }
11227
- return data;
11228
- }],
11229
- transformResponse: [function transformResponse(data) {
11230
- if (typeof data === 'string') {
11231
- try {
11232
- data = JSON.parse(data);
11233
- } catch (e) {}
11234
- }
11235
- return data;
11236
- }],
11237
- timeout: 0,
11238
- xsrfCookieName: 'XSRF-TOKEN',
11239
- xsrfHeaderName: 'X-XSRF-TOKEN',
11240
- maxContentLength: -1,
11241
- maxBodyLength: -1,
11242
- validateStatus: function validateStatus(status) {
11243
- return status >= 200 && status < 300;
11244
- }
11245
- };
11246
- defaults.headers = {
11247
- common: {
11248
- 'Accept': 'application/json, text/plain, */*'
11249
- }
11250
- };
11251
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
11252
- defaults.headers[method] = {};
11253
- });
11254
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
11255
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
11256
- });
11257
- var defaults_1 = defaults;
11258
-
11259
- function throwIfCancellationRequested(config) {
11260
- if (config.cancelToken) {
11261
- config.cancelToken.throwIfRequested();
11262
- }
11263
- }
11264
- var dispatchRequest = function dispatchRequest(config) {
11265
- throwIfCancellationRequested(config);
11266
- config.headers = config.headers || {};
11267
- config.data = transformData(config.data, config.headers, config.transformRequest);
11268
- config.headers = utils.merge(config.headers.common || {}, config.headers[config.method] || {}, config.headers);
11269
- utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function cleanHeaderConfig(method) {
11270
- delete config.headers[method];
11271
- });
11272
- var adapter = config.adapter || defaults_1.adapter;
11273
- return adapter(config).then(function onAdapterResolution(response) {
11274
- throwIfCancellationRequested(config);
11275
- response.data = transformData(response.data, response.headers, config.transformResponse);
11276
- return response;
11277
- }, function onAdapterRejection(reason) {
11278
- if (!isCancel(reason)) {
11279
- throwIfCancellationRequested(config);
11280
- if (reason && reason.response) {
11281
- reason.response.data = transformData(reason.response.data, reason.response.headers, config.transformResponse);
11282
- }
11283
- }
11284
- return Promise.reject(reason);
11285
- });
11286
- };
11287
-
11288
- var mergeConfig = function mergeConfig(config1, config2) {
11289
- config2 = config2 || {};
11290
- var config = {};
11291
- var valueFromConfig2Keys = ['url', 'method', 'data'];
11292
- var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
11293
- var defaultToConfig2Keys = ['baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'];
11294
- var directMergeKeys = ['validateStatus'];
11295
- function getMergedValue(target, source) {
11296
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
11297
- return utils.merge(target, source);
11298
- } else if (utils.isPlainObject(source)) {
11299
- return utils.merge({}, source);
11300
- } else if (utils.isArray(source)) {
11301
- return source.slice();
11302
- }
11303
- return source;
11304
- }
11305
- function mergeDeepProperties(prop) {
11306
- if (!utils.isUndefined(config2[prop])) {
11307
- config[prop] = getMergedValue(config1[prop], config2[prop]);
11308
- } else if (!utils.isUndefined(config1[prop])) {
11309
- config[prop] = getMergedValue(undefined, config1[prop]);
11310
- }
11311
- }
11312
- utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
11313
- if (!utils.isUndefined(config2[prop])) {
11314
- config[prop] = getMergedValue(undefined, config2[prop]);
11315
- }
11316
- });
11317
- utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
11318
- utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
11319
- if (!utils.isUndefined(config2[prop])) {
11320
- config[prop] = getMergedValue(undefined, config2[prop]);
11321
- } else if (!utils.isUndefined(config1[prop])) {
11322
- config[prop] = getMergedValue(undefined, config1[prop]);
11323
- }
11324
- });
11325
- utils.forEach(directMergeKeys, function merge(prop) {
11326
- if (prop in config2) {
11327
- config[prop] = getMergedValue(config1[prop], config2[prop]);
11328
- } else if (prop in config1) {
11329
- config[prop] = getMergedValue(undefined, config1[prop]);
11330
- }
11331
- });
11332
- var axiosKeys = valueFromConfig2Keys.concat(mergeDeepPropertiesKeys).concat(defaultToConfig2Keys).concat(directMergeKeys);
11333
- var otherKeys = Object.keys(config1).concat(Object.keys(config2)).filter(function filterAxiosKeys(key) {
11334
- return axiosKeys.indexOf(key) === -1;
11335
- });
11336
- utils.forEach(otherKeys, mergeDeepProperties);
11337
- return config;
11338
- };
11339
-
11340
- function Axios(instanceConfig) {
11341
- this.defaults = instanceConfig;
11342
- this.interceptors = {
11343
- request: new InterceptorManager_1(),
11344
- response: new InterceptorManager_1()
11345
- };
11346
- }
11347
- Axios.prototype.request = function request(config) {
11348
- if (typeof config === 'string') {
11349
- config = arguments[1] || {};
11350
- config.url = arguments[0];
11351
- } else {
11352
- config = config || {};
11353
- }
11354
- config = mergeConfig(this.defaults, config);
11355
- if (config.method) {
11356
- config.method = config.method.toLowerCase();
11357
- } else if (this.defaults.method) {
11358
- config.method = this.defaults.method.toLowerCase();
11359
- } else {
11360
- config.method = 'get';
11361
- }
11362
- var chain = [dispatchRequest, undefined];
11363
- var promise = Promise.resolve(config);
11364
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
11365
- chain.unshift(interceptor.fulfilled, interceptor.rejected);
11366
- });
11367
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
11368
- chain.push(interceptor.fulfilled, interceptor.rejected);
11369
- });
11370
- while (chain.length) {
11371
- promise = promise.then(chain.shift(), chain.shift());
11372
- }
11373
- return promise;
11374
- };
11375
- Axios.prototype.getUri = function getUri(config) {
11376
- config = mergeConfig(this.defaults, config);
11377
- return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
11378
- };
11379
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
11380
- Axios.prototype[method] = function (url, config) {
11381
- return this.request(mergeConfig(config || {}, {
11382
- method: method,
11383
- url: url,
11384
- data: (config || {}).data
11385
- }));
11386
- };
11387
- });
11388
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
11389
- Axios.prototype[method] = function (url, data, config) {
11390
- return this.request(mergeConfig(config || {}, {
11391
- method: method,
11392
- url: url,
11393
- data: data
11394
- }));
11395
- };
11396
- });
11397
- var Axios_1 = Axios;
11398
-
11399
- function Cancel(message) {
11400
- this.message = message;
11401
- }
11402
- Cancel.prototype.toString = function toString() {
11403
- return 'Cancel' + (this.message ? ': ' + this.message : '');
11404
- };
11405
- Cancel.prototype.__CANCEL__ = true;
11406
- var Cancel_1 = Cancel;
11407
-
11408
- function CancelToken(executor) {
11409
- if (typeof executor !== 'function') {
11410
- throw new TypeError('executor must be a function.');
11411
- }
11412
- var resolvePromise;
11413
- this.promise = new Promise(function promiseExecutor(resolve) {
11414
- resolvePromise = resolve;
11415
- });
11416
- var token = this;
11417
- executor(function cancel(message) {
11418
- if (token.reason) {
11419
- return;
11420
- }
11421
- token.reason = new Cancel_1(message);
11422
- resolvePromise(token.reason);
11423
- });
11424
- }
11425
- CancelToken.prototype.throwIfRequested = function throwIfRequested() {
11426
- if (this.reason) {
11427
- throw this.reason;
11428
- }
11429
- };
11430
- CancelToken.source = function source() {
11431
- var cancel;
11432
- var token = new CancelToken(function executor(c) {
11433
- cancel = c;
11434
- });
11435
- return {
11436
- token: token,
11437
- cancel: cancel
11438
- };
11439
- };
11440
- var CancelToken_1 = CancelToken;
11441
-
11442
- var spread = function spread(callback) {
11443
- return function wrap(arr) {
11444
- return callback.apply(null, arr);
11445
- };
11446
- };
11447
-
11448
- var isAxiosError = function isAxiosError(payload) {
11449
- return typeof payload === 'object' && payload.isAxiosError === true;
11450
- };
11451
-
11452
- function createInstance(defaultConfig) {
11453
- var context = new Axios_1(defaultConfig);
11454
- var instance = bind(Axios_1.prototype.request, context);
11455
- utils.extend(instance, Axios_1.prototype, context);
11456
- utils.extend(instance, context);
11457
- return instance;
11458
- }
11459
- var axios = createInstance(defaults_1);
11460
- axios.Axios = Axios_1;
11461
- axios.create = function create(instanceConfig) {
11462
- return createInstance(mergeConfig(axios.defaults, instanceConfig));
11463
- };
11464
- axios.Cancel = Cancel_1;
11465
- axios.CancelToken = CancelToken_1;
11466
- axios.isCancel = isCancel;
11467
- axios.all = function all(promises) {
11468
- return Promise.all(promises);
11469
- };
11470
- axios.spread = spread;
11471
- axios.isAxiosError = isAxiosError;
11472
- var axios_1 = axios;
11473
- var _default = axios;
11474
- axios_1.default = _default;
11475
-
11476
10819
  const MyChallanResult = _ref => {
11477
10820
  let {
11478
10821
  template,
@@ -11486,10 +10829,9 @@ const MyChallanResult = _ref => {
11486
10829
  const userInfo = Digit.UserService.getUser();
11487
10830
  const tenantId = localStorage.getItem("CITIZEN.CITY");
11488
10831
  const [loader, setLoader] = React.useState(false);
11489
- const [getChallanData, setChallanData] = React.useState();
10832
+ const [getChallanData, setChallanData] = React.useState([]);
11490
10833
  const [filters, setFilters] = React.useState(null);
11491
10834
  const [getCount, setCount] = React.useState();
11492
- console.log("userInfo", userInfo);
11493
10835
  let filter = window.location.href.split("/").pop();
11494
10836
  let t1;
11495
10837
  let off;
@@ -11517,20 +10859,17 @@ const MyChallanResult = _ref => {
11517
10859
  }, [filter, tenantId]);
11518
10860
  const fetchChallans = function () {
11519
10861
  try {
11520
- console.log("filters", filters);
11521
10862
  setLoader(true);
11522
10863
  const _temp = _catch(function () {
11523
10864
  return Promise.resolve(Digit.GCService.search({
11524
10865
  tenantId,
11525
10866
  filters
11526
10867
  })).then(function (responseData) {
11527
- console.log("result", responseData);
11528
10868
  setCount(responseData === null || responseData === void 0 ? void 0 : responseData.TotalCount);
11529
10869
  setChallanData(responseData === null || responseData === void 0 ? void 0 : responseData.GarbageConnection);
11530
10870
  setLoader(false);
11531
10871
  });
11532
- }, function (error) {
11533
- console.log("error", error);
10872
+ }, function () {
11534
10873
  setLoader(false);
11535
10874
  });
11536
10875
  return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
@@ -11539,17 +10878,76 @@ const MyChallanResult = _ref => {
11539
10878
  }
11540
10879
  };
11541
10880
  React.useEffect(() => {
11542
- console.log("filters", filters);
11543
10881
  if (filters) fetchChallans();
11544
10882
  }, [filters]);
11545
10883
  const handleMakePayment = id => {
11546
- history.push("/digit-ui/citizen/payment/collect/Challan_Generation/" + id + "/" + tenantId + "?tenantId=" + tenantId);
10884
+ history.push("/digit-ui/citizen/payment/collect/GC.ONE_TIME_FEE/" + id + "/" + tenantId + "?tenantId=" + tenantId);
11547
10885
  };
11548
10886
  const handleLoadMore = () => {
11549
10887
  setFilters(prev => _extends({}, prev, {
11550
10888
  limit: Number(prev.limit) + 5
11551
10889
  }));
11552
10890
  };
10891
+ const handleDiscontinue = function (data) {
10892
+ try {
10893
+ console.log("data", data);
10894
+ setLoader(true);
10895
+ const payload = {
10896
+ GarbageConnection: _extends({}, data, {
10897
+ applicationType: "DISCONNECT_GARBAGE_CONNECTION",
10898
+ processInstance: _extends({}, data === null || data === void 0 ? void 0 : data.processInstance, {
10899
+ action: "INITIATE"
10900
+ })
10901
+ }),
10902
+ disconnectRequest: true
10903
+ };
10904
+ console.log("payload===", payload);
10905
+ const _temp2 = _catch(function () {
10906
+ return Promise.resolve(Digit.GCService.create(payload)).then(function (response) {
10907
+ console.log("response", response);
10908
+ updateApplication(response === null || response === void 0 ? void 0 : response.GarbageConnection[0]);
10909
+ });
10910
+ }, function () {
10911
+ setLoader(false);
10912
+ });
10913
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
10914
+ } catch (e) {
10915
+ return Promise.reject(e);
10916
+ }
10917
+ };
10918
+ const updateApplication = function (response) {
10919
+ try {
10920
+ console.log("uddated response", response);
10921
+ const payload = {
10922
+ GarbageConnection: _extends({}, response, {
10923
+ processInstance: _extends({}, response === null || response === void 0 ? void 0 : response.processInstance, {
10924
+ action: "SUBMIT_APPLICATION"
10925
+ })
10926
+ })
10927
+ };
10928
+ console.log("payload===", payload);
10929
+ const _temp3 = _catch(function () {
10930
+ return Promise.resolve(Digit.GCService.update(payload)).then(function (response) {
10931
+ console.log("response", response);
10932
+ return Promise.resolve(fetchChallans()).then(function () {});
10933
+ });
10934
+ }, function () {
10935
+ setLoader(false);
10936
+ });
10937
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
10938
+ } catch (e) {
10939
+ return Promise.reject(e);
10940
+ }
10941
+ };
10942
+ const connectionCountMap = React.useMemo(() => {
10943
+ const map = {};
10944
+ getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.forEach(item => {
10945
+ if (item !== null && item !== void 0 && item.connectionNo) {
10946
+ map[item.connectionNo] = (map[item.connectionNo] || 0) + 1;
10947
+ }
10948
+ });
10949
+ return map;
10950
+ }, [getChallanData]);
11553
10951
  return /*#__PURE__*/React__default.createElement("div", {
11554
10952
  style: {
11555
10953
  marginTop: "16px"
@@ -11559,6 +10957,9 @@ const MyChallanResult = _ref => {
11559
10957
  marginLeft: "8px"
11560
10958
  }
11561
10959
  }, t(header), " (", getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.length, ")"), getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.map((bill, index) => {
10960
+ const connectionCount = connectionCountMap[bill === null || bill === void 0 ? void 0 : bill.connectionNo] || 0;
10961
+ console.log("bill", bill);
10962
+ const showDiscontinueButton = bill.applicationStatus === "CONNECTION_ACTIVATED" && connectionCount === 1;
11562
10963
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
11563
10964
  key: index
11564
10965
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.KeyNote, {
@@ -11579,9 +10980,21 @@ const MyChallanResult = _ref => {
11579
10980
  to: "/digit-ui/citizen/garbagecollection/application/" + (bill === null || bill === void 0 ? void 0 : bill.applicationNo) + "/" + (bill === null || bill === void 0 ? void 0 : bill.tenantId)
11580
10981
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
11581
10982
  label: t("CS_VIEW_DETAILS")
11582
- })), bill.applicationStatus == "ACTIVE" && /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
10983
+ })), (bill.applicationStatus == "PENDING_FOR_CITIZEN_ACTION" || bill.applicationStatus == "INITIATED") && /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
10984
+ label: t("WF_GC_EDIT"),
10985
+ onSubmit: () => {
10986
+ history.push("/digit-ui/citizen/garbagecollection/create-application/" + (bill === null || bill === void 0 ? void 0 : bill.applicationNo));
10987
+ }
10988
+ }), showDiscontinueButton && /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
10989
+ style: {
10990
+ width: "200px"
10991
+ },
10992
+ label: t("GC_DISCONTINUE_SERVICE"),
10993
+ onSubmit: () => handleDiscontinue(bill),
10994
+ disabled: loader
10995
+ }), bill.applicationStatus == "PENDING_FOR_PAYMENT" && /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
11583
10996
  label: t("CS_APPLICATION_DETAILS_MAKE_PAYMENT"),
11584
- onSubmit: () => handleMakePayment(bill === null || bill === void 0 ? void 0 : bill.challanNo)
10997
+ onSubmit: () => handleMakePayment(bill === null || bill === void 0 ? void 0 : bill.applicationNo)
11585
10998
  })));
11586
10999
  }), (getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.length) === 0 && !loader && /*#__PURE__*/React__default.createElement("p", {
11587
11000
  style: {
@@ -11694,24 +11107,24 @@ function baseGetTag(value) {
11694
11107
  }
11695
11108
  var _baseGetTag = baseGetTag;
11696
11109
 
11697
- function isObject$1(value) {
11110
+ function isObject(value) {
11698
11111
  var type = typeof value;
11699
11112
  return value != null && (type == 'object' || type == 'function');
11700
11113
  }
11701
- var isObject_1 = isObject$1;
11114
+ var isObject_1 = isObject;
11702
11115
 
11703
11116
  var asyncTag = '[object AsyncFunction]',
11704
11117
  funcTag = '[object Function]',
11705
11118
  genTag = '[object GeneratorFunction]',
11706
11119
  proxyTag = '[object Proxy]';
11707
- function isFunction$1(value) {
11120
+ function isFunction(value) {
11708
11121
  if (!isObject_1(value)) {
11709
11122
  return false;
11710
11123
  }
11711
11124
  var tag = _baseGetTag(value);
11712
11125
  return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
11713
11126
  }
11714
- var isFunction_1 = isFunction$1;
11127
+ var isFunction_1 = isFunction;
11715
11128
 
11716
11129
  var coreJsData = _root['__core-js_shared__'];
11717
11130
  var _coreJsData = coreJsData;
@@ -12209,7 +11622,7 @@ const ChallanApplicationDetails = () => {
12209
11622
  React.useEffect(() => {
12210
11623
  if (acknowledgementIds) {
12211
11624
  const filters = {};
12212
- filters.acknowledgementIds = acknowledgementIds;
11625
+ filters.applicationNumber = acknowledgementIds;
12213
11626
  fetchChallans(filters);
12214
11627
  }
12215
11628
  }, [acknowledgementIds]);
@@ -12298,7 +11711,7 @@ const ChallanApplicationDetails = () => {
12298
11711
  text: t(getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.applicationNo) || t("CS_NA")
12299
11712
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
12300
11713
  className: "border-none",
12301
- label: t("reports.mcollect.status"),
11714
+ label: t("ACTION_TEST_APPLICATION_STATUS"),
12302
11715
  text: t(getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.applicationStatus) || t("CS_NA")
12303
11716
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
12304
11717
  className: "border-none",
@@ -12459,13 +11872,10 @@ const GCResponseCitizen = props => {
12459
11872
  return Promise.reject(e);
12460
11873
  }
12461
11874
  };
12462
- const handlePayment = () => {
12463
- history.push("/digit-ui/employee/payment/collect/Challan_Generation/" + applicationNumber + "/" + tenantId + "?tenantId=" + tenantId);
12464
- };
12465
11875
  return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Banner, {
12466
11876
  message: t("GC_APPLICATION_CREATED"),
12467
11877
  applicationNumber: applicationNumber,
12468
- info: (nocData === null || nocData === void 0 ? void 0 : nocData.applicationStatus) == "REJECTED" ? "" : t("CHALLAN_NUMBER"),
11878
+ info: (nocData === null || nocData === void 0 ? void 0 : nocData.applicationStatus) == "REJECTED" ? "" : t("APPLICATION_NUMBER"),
12469
11879
  successful: (nocData === null || nocData === void 0 ? void 0 : nocData.applicationStatus) == "REJECTED" ? false : true,
12470
11880
  style: {
12471
11881
  padding: "10px"
@@ -12497,9 +11907,6 @@ const GCResponseCitizen = props => {
12497
11907
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
12498
11908
  label: t("CORE_COMMON_GO_TO_HOME"),
12499
11909
  onSubmit: onSubmit
12500
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
12501
- label: t("CS_APPLICATION_DETAILS_MAKE_PAYMENT"),
12502
- onSubmit: handlePayment
12503
11910
  }))), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
12504
11911
  error: error,
12505
11912
  label: getLable,
@@ -12523,8 +11930,9 @@ const ModalConfig = _ref => {
12523
11930
  businessService
12524
11931
  } = _ref;
12525
11932
  console.log("action=====", action);
11933
+ console.log("uploadedFile=====", uploadedFile);
12526
11934
  let checkCondtions = true;
12527
- if ((action === null || action === void 0 ? void 0 : action.action) == "SENDBACKTOCITIZEN" || (action === null || action === void 0 ? void 0 : action.action) == "APPROVE" || (action === null || action === void 0 ? void 0 : action.action) == "NOT_VERIFIED" || (action === null || action === void 0 ? void 0 : action.action) == "SENDBACK" || (action === null || action === void 0 ? void 0 : action.action) == "VERIFIED") checkCondtions = false;
11935
+ if ((action === null || action === void 0 ? void 0 : action.action) == "SEND_BACK_TO_CITIZEN" || (action === null || action === void 0 ? void 0 : action.action) == "ACTIVATE_CONNECTION" || (action === null || action === void 0 ? void 0 : action.action) == "REJECT" || (action === null || action === void 0 ? void 0 : action.action) == "SENDBACK" || (action === null || action === void 0 ? void 0 : action.action) == "VERIFIED" || (action === null || action === void 0 ? void 0 : action.action) == "SEND_BACK_FOR_DOCUMENT_VERIFICATION") checkCondtions = false;
12528
11936
  if (action.isTerminateState) checkCondtions = false;
12529
11937
  console.log("action=====", action.action);
12530
11938
  return {
@@ -12601,13 +12009,19 @@ const NDCModal = _ref => {
12601
12009
  errorOne,
12602
12010
  closeToastOne,
12603
12011
  getEmployees,
12604
- tenantId
12012
+ tenantId,
12013
+ businessService,
12014
+ loader,
12015
+ setLoader
12605
12016
  } = _ref;
12606
12017
  const [config, setConfig] = React.useState({});
12607
12018
  const [getAmount, setAmount] = React.useState();
12608
12019
  const [approvers, setApprovers] = React.useState([]);
12020
+ const [selectedApprover, setSelectedApprover] = React.useState({});
12021
+ const [file, setFile] = React.useState(null);
12022
+ const [uploadedFile, setUploadedFile] = React.useState(null);
12023
+ const [error, setError] = React.useState(null);
12609
12024
  const allRolesNew = [...new Set(getEmployees === null || getEmployees === void 0 ? void 0 : getEmployees.flatMap(a => a.roles))];
12610
- console.log("allRolesNew", allRolesNew);
12611
12025
  const {
12612
12026
  data: approverData,
12613
12027
  isLoading: PTALoading
@@ -12639,11 +12053,65 @@ const NDCModal = _ref => {
12639
12053
  }));
12640
12054
  }
12641
12055
  }, [approverData]);
12056
+ function selectFile(e) {
12057
+ setFile(e.target.files[0]);
12058
+ }
12059
+ React.useEffect(() => {
12060
+ (function () {
12061
+ try {
12062
+ setError(null);
12063
+ const _temp3 = function () {
12064
+ if (file) {
12065
+ const _temp2 = function () {
12066
+ if (file.size >= 5242880) {
12067
+ setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
12068
+ } else {
12069
+ setLoader(true);
12070
+ const _temp = _catch(function () {
12071
+ return Promise.resolve(Digit.UploadServices.Filestorage("PT", file, Digit.ULBService.getStateId())).then(function (response) {
12072
+ var _response$data, _response$data$files;
12073
+ if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
12074
+ var _response$data2, _response$data2$files;
12075
+ setUploadedFile(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$files = _response$data2.files[0]) === null || _response$data2$files === void 0 ? void 0 : _response$data2$files.fileStoreId);
12076
+ } else {
12077
+ setError(t("CS_FILE_UPLOAD_ERROR"));
12078
+ }
12079
+ setLoader(false);
12080
+ });
12081
+ }, function () {
12082
+ setLoader(false);
12083
+ setError(t("CS_FILE_UPLOAD_ERROR"));
12084
+ });
12085
+ if (_temp && _temp.then) return _temp.then(function () {});
12086
+ }
12087
+ }();
12088
+ if (_temp2 && _temp2.then) return _temp2.then(function () {});
12089
+ }
12090
+ }();
12091
+ return _temp3 && _temp3.then ? _temp3.then(function () {}) : void 0;
12092
+ } catch (e) {
12093
+ Promise.reject(e);
12094
+ }
12095
+ })();
12096
+ }, [file]);
12642
12097
  function submit(data) {
12098
+ console.log("data", data);
12099
+ console.log("selectedApprover", selectedApprover);
12643
12100
  const payload = {
12644
- amount: getAmount
12101
+ action: action === null || action === void 0 ? void 0 : action.action,
12102
+ comment: data === null || data === void 0 ? void 0 : data.comments,
12103
+ assignes: !(selectedApprover !== null && selectedApprover !== void 0 && selectedApprover.uuid) ? null : [{
12104
+ uuid: selectedApprover === null || selectedApprover === void 0 ? void 0 : selectedApprover.uuid
12105
+ }],
12106
+ documents: uploadedFile ? [{
12107
+ documentType: file === null || file === void 0 ? void 0 : file.type,
12108
+ documentUid: file === null || file === void 0 ? void 0 : file.name,
12109
+ fileStoreId: uploadedFile
12110
+ }] : null
12645
12111
  };
12646
- submitAction(payload);
12112
+ submitAction({
12113
+ Licenses: [payload]
12114
+ });
12647
12115
  }
12648
12116
  React.useEffect(() => {
12649
12117
  if (action) {
@@ -12651,10 +12119,16 @@ const NDCModal = _ref => {
12651
12119
  t,
12652
12120
  action,
12653
12121
  setAmount,
12654
- approvers
12122
+ approvers,
12123
+ selectedApprover,
12124
+ setSelectedApprover,
12125
+ uploadedFile,
12126
+ selectFile,
12127
+ setUploadedFile,
12128
+ businessService
12655
12129
  }));
12656
12130
  }
12657
- }, [action, approvers]);
12131
+ }, [action, approvers, selectedApprover, uploadedFile]);
12658
12132
  if (!action || !config.form) return null;
12659
12133
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
12660
12134
  headerBarMain: /*#__PURE__*/React__default.createElement(Heading, {
@@ -12680,7 +12154,7 @@ const NDCModal = _ref => {
12680
12154
  label: errorOne,
12681
12155
  isDleteBtn: true,
12682
12156
  onClose: closeToastOne
12683
- }), PTALoading && /*#__PURE__*/React__default.createElement(Loader, {
12157
+ }), (PTALoading || loader) && /*#__PURE__*/React__default.createElement(Loader, {
12684
12158
  page: true
12685
12159
  }));
12686
12160
  };
@@ -12727,6 +12201,7 @@ const ChallanApplicationDetails$1 = () => {
12727
12201
  const {
12728
12202
  t
12729
12203
  } = reactI18next.useTranslation();
12204
+ const history = reactRouterDom.useHistory();
12730
12205
  const {
12731
12206
  acknowledgementIds,
12732
12207
  id
@@ -12734,14 +12209,8 @@ const ChallanApplicationDetails$1 = () => {
12734
12209
  const [showToast, setShowToast] = React.useState(false);
12735
12210
  const [getLable, setLable] = React.useState(false);
12736
12211
  const tenantId = window.location.href.includes("citizen") ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
12737
- const [showOptions, setShowOptions] = React.useState(false);
12738
- const {
12739
- data: storeData
12740
- } = Digit.Hooks.useStore.getInitData();
12741
12212
  const [loader, setLoader] = React.useState(false);
12742
12213
  const [getChallanData, setChallanData] = React.useState();
12743
- const [chbPermissionLoading, setChbPermissionLoading] = React.useState(false);
12744
- const [printing, setPrinting] = React.useState(false);
12745
12214
  const [error, setError] = React.useState("");
12746
12215
  const [getWorkflowService, setWorkflowService] = React.useState([]);
12747
12216
  const [displayMenu, setDisplayMenu] = React.useState(false);
@@ -12751,7 +12220,6 @@ const ChallanApplicationDetails$1 = () => {
12751
12220
  const [getEmployees, setEmployees] = React.useState([]);
12752
12221
  const [errorOne, setErrorOne] = React.useState(null);
12753
12222
  const menuRef = React.useRef();
12754
- console.log("acknowledgementIds", acknowledgementIds, id);
12755
12223
  const fetchChallans = function (filters) {
12756
12224
  try {
12757
12225
  setLoader(true);
@@ -12761,12 +12229,10 @@ const ChallanApplicationDetails$1 = () => {
12761
12229
  filters
12762
12230
  })).then(function (responseData) {
12763
12231
  var _responseData$Garbage;
12764
- console.log("search ", responseData);
12765
12232
  setChallanData(responseData === null || responseData === void 0 ? void 0 : (_responseData$Garbage = responseData.GarbageConnection) === null || _responseData$Garbage === void 0 ? void 0 : _responseData$Garbage[0]);
12766
12233
  setLoader(false);
12767
12234
  });
12768
- }, function (error) {
12769
- console.log("error", error);
12235
+ }, function () {
12770
12236
  setLoader(false);
12771
12237
  });
12772
12238
  return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
@@ -12774,7 +12240,6 @@ const ChallanApplicationDetails$1 = () => {
12774
12240
  return Promise.reject(e);
12775
12241
  }
12776
12242
  };
12777
- let challanEmpData = ChallanData(tenantId, id);
12778
12243
  React.useEffect(() => {
12779
12244
  if (id) {
12780
12245
  const filters = {};
@@ -12798,7 +12263,10 @@ const ChallanApplicationDetails$1 = () => {
12798
12263
  const closeToast = () => {
12799
12264
  setShowToast(null);
12800
12265
  };
12801
- console.log("workflowDetails", workflowDetails);
12266
+ const closeMenu = () => {
12267
+ setDisplayMenu(false);
12268
+ };
12269
+ Digit.Hooks.useClickOutside(menuRef, closeMenu, displayMenu);
12802
12270
  if (workflowDetails !== null && workflowDetails !== void 0 && (_workflowDetails$data = workflowDetails.data) !== null && _workflowDetails$data !== void 0 && (_workflowDetails$data2 = _workflowDetails$data.actionState) !== null && _workflowDetails$data2 !== void 0 && _workflowDetails$data2.nextActions && !workflowDetails.isLoading) workflowDetails.data.actionState.nextActions = [...(workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data3 = workflowDetails.data) === null || _workflowDetails$data3 === void 0 ? void 0 : _workflowDetails$data3.nextActions)];
12803
12271
  if (workflowDetails && workflowDetails.data && !workflowDetails.isLoading) {
12804
12272
  var _workflowDetails$data4, _workflowDetails$data5;
@@ -12825,7 +12293,6 @@ const ChallanApplicationDetails$1 = () => {
12825
12293
  return Promise.resolve(Digit.WorkflowService.init(tenantId, "NewGC")).then(function (_Digit$WorkflowServic) {
12826
12294
  var _WorkflowService, _WorkflowService$Busi, _WorkflowService$Busi2;
12827
12295
  WorkflowService = _Digit$WorkflowServic;
12828
- console.log("WorkflowService===", WorkflowService);
12829
12296
  setLoader(false);
12830
12297
  setWorkflowService((_WorkflowService = WorkflowService) === null || _WorkflowService === void 0 ? void 0 : (_WorkflowService$Busi = _WorkflowService.BusinessServices) === null || _WorkflowService$Busi === void 0 ? void 0 : (_WorkflowService$Busi2 = _WorkflowService$Busi[0]) === null || _WorkflowService$Busi2 === void 0 ? void 0 : _WorkflowService$Busi2.states);
12831
12298
  });
@@ -12835,67 +12302,52 @@ const ChallanApplicationDetails$1 = () => {
12835
12302
  }, [tenantId]);
12836
12303
  function onActionSelect(action) {
12837
12304
  var _action$state, _action$state$actions, _filterRoles$;
12838
- console.log("action", action);
12305
+ if ((action === null || action === void 0 ? void 0 : action.action) == "PAY") {
12306
+ history.push("/digit-ui/employee/payment/collect/GC.ONE_TIME_FEE/" + id + "/" + tenantId + "?tenantId=" + tenantId);
12307
+ }
12839
12308
  const filterNexState = action === null || action === void 0 ? void 0 : (_action$state = action.state) === null || _action$state === void 0 ? void 0 : (_action$state$actions = _action$state.actions) === null || _action$state$actions === void 0 ? void 0 : _action$state$actions.filter(item => item.action == (action === null || action === void 0 ? void 0 : action.action));
12840
12309
  const filterRoles = getWorkflowService === null || getWorkflowService === void 0 ? void 0 : getWorkflowService.filter(item => {
12841
12310
  var _filterNexState$;
12842
12311
  return (item === null || item === void 0 ? void 0 : item.uuid) == ((_filterNexState$ = filterNexState[0]) === null || _filterNexState$ === void 0 ? void 0 : _filterNexState$.nextState);
12843
12312
  });
12844
- console.log("filterRoles", filterRoles);
12845
12313
  setEmployees(filterRoles === null || filterRoles === void 0 ? void 0 : (_filterRoles$ = filterRoles[0]) === null || _filterRoles$ === void 0 ? void 0 : _filterRoles$.actions);
12846
12314
  setShowModal(true);
12847
12315
  setSelectedAction(action);
12848
12316
  }
12849
12317
  const submitAction = function (modalData) {
12850
12318
  try {
12851
- console.log("modalData", modalData);
12852
- return Promise.resolve();
12853
- const _temp4 = function () {
12854
- if (!(modalData !== null && modalData !== void 0 && modalData.amount)) {
12855
- setErrorOne("Please Enter Amount");
12856
- setShowErrorToastt(true);
12857
- } else {
12858
- var _getChallanData$amoun, _getChallanData$amoun2;
12859
- const finalAmount = Math.max((getChallanData === null || getChallanData === void 0 ? void 0 : (_getChallanData$amoun = getChallanData.amount) === null || _getChallanData$amoun === void 0 ? void 0 : (_getChallanData$amoun2 = _getChallanData$amoun[0]) === null || _getChallanData$amoun2 === void 0 ? void 0 : _getChallanData$amoun2.amount) || 0, (getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.challanAmount) || 0);
12860
- const _temp3 = function () {
12861
- if ((modalData === null || modalData === void 0 ? void 0 : modalData.amount) > finalAmount) {
12862
- setErrorOne("Amount must be less than or equal to " + finalAmount);
12863
- setShowErrorToastt(true);
12864
- setError("Amount must be less than or equal to " + finalAmount);
12865
- } else {
12866
- console.log("nothing");
12867
- setLoader(true);
12868
- const payload = {
12869
- Challan: _extends({}, getChallanData, {
12870
- workflow: {
12871
- action: "SETTLED"
12872
- },
12873
- feeWaiver: modalData === null || modalData === void 0 ? void 0 : modalData.amount
12874
- })
12875
- };
12876
- console.log("payload", payload);
12877
- const _temp2 = _catch(function () {
12878
- return Promise.resolve(Digit.ChallanGenerationService.update(payload)).then(function (response) {
12879
- setLoader(false);
12880
- setShowModal(false);
12881
- setLable("Challan is Settled");
12882
- setError(false);
12883
- setShowToast(true);
12884
- setTimeout(() => {
12885
- history.push("/digit-ui/employee/challangeneration/inbox");
12886
- window.location.reload();
12887
- }, 2000);
12888
- });
12889
- }, function () {
12890
- setLoader(false);
12891
- });
12892
- if (_temp2 && _temp2.then) return _temp2.then(function () {});
12893
- }
12894
- }();
12895
- if (_temp3 && _temp3.then) return _temp3.then(function () {});
12896
- }
12897
- }();
12898
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
12319
+ const action = modalData === null || modalData === void 0 ? void 0 : modalData.Licenses[0];
12320
+ if (!(action !== null && action !== void 0 && action.assignes) && action.action !== "SEND_BACK_TO_CITIZEN" && action.action !== "ACTIVATE_CONNECTION" && action.action !== "REJECT" && action.action !== "SEND_BACK_FOR_DOCUMENT_VERIFICATION") {
12321
+ setErrorOne("Assignee is Mandatory");
12322
+ setShowErrorToastt(true);
12323
+ return Promise.resolve();
12324
+ } else if (!(action !== null && action !== void 0 && action.comment)) {
12325
+ setErrorOne("Comment is Mandatory");
12326
+ setShowErrorToastt(true);
12327
+ return Promise.resolve();
12328
+ }
12329
+ setLoader(true);
12330
+ const payload = {
12331
+ GarbageConnection: _extends({}, getChallanData, {
12332
+ processInstance: _extends({}, getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.processInstance, modalData === null || modalData === void 0 ? void 0 : modalData.Licenses[0])
12333
+ })
12334
+ };
12335
+ const _temp2 = _catch(function () {
12336
+ return Promise.resolve(Digit.GCService.update(payload)).then(function (response) {
12337
+ setLoader(false);
12338
+ setShowModal(false);
12339
+ setLable("Status is Updated");
12340
+ setError(false);
12341
+ setShowToast(true);
12342
+ setTimeout(() => {
12343
+ history.push("/digit-ui/employee/garbagecollection/inbox");
12344
+ window.location.reload();
12345
+ }, 2000);
12346
+ });
12347
+ }, function () {
12348
+ setLoader(false);
12349
+ });
12350
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
12899
12351
  } catch (e) {
12900
12352
  return Promise.reject(e);
12901
12353
  }
@@ -12926,7 +12378,7 @@ const ChallanApplicationDetails$1 = () => {
12926
12378
  text: t(getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.applicationNo) || t("CS_NA")
12927
12379
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
12928
12380
  className: "border-none",
12929
- label: t("reports.mcollect.status"),
12381
+ label: t("ACTION_TEST_APPLICATION_STATUS"),
12930
12382
  text: t(getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.applicationStatus) || t("CS_NA")
12931
12383
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
12932
12384
  className: "border-none",
@@ -13009,7 +12461,9 @@ const ChallanApplicationDetails$1 = () => {
13009
12461
  errorOne: errorOne,
13010
12462
  closeToastOne: closeToastOne,
13011
12463
  getLable: getLable,
13012
- getChallanData: getChallanData
12464
+ getChallanData: getChallanData,
12465
+ loader: loader,
12466
+ setLoader: setLoader
13013
12467
  }) : null, showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
13014
12468
  isDleteBtn: true,
13015
12469
  error: error,