@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.
@@ -2780,6 +2780,8 @@ const CHBCitizenSecond = ({
2780
2780
  const isCitizen = window.location.href.includes("citizen");
2781
2781
  const [getPropertyId, setPropertyId] = useState(null);
2782
2782
  const [loader, setLoader] = useState(false);
2783
+ const [showToast, setShowToast] = useState(false);
2784
+ const [error, setError] = useState("");
2783
2785
  const {
2784
2786
  data: GCData = [],
2785
2787
  isLoading: GCLoading
@@ -2824,47 +2826,100 @@ const CHBCitizenSecond = ({
2824
2826
  }
2825
2827
  });
2826
2828
  const onSubmit = async data => {
2827
- var _data$frequency, _data$typeOfWaste, _data$propertyType, _data$connectionCateg, _data$connectionCateg2;
2828
- setLoader(true);
2829
- console.log("data", data);
2830
- console.log("currentStepData", currentStepData);
2831
- const ownerData = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.ownerDetails;
2832
- const payload = {
2833
- GarbageConnection: {
2834
- tenantId: tenantId,
2835
- propertyId: data === null || data === void 0 ? void 0 : data.propertyId,
2836
- frequency: data === null || data === void 0 ? void 0 : (_data$frequency = data.frequency) === null || _data$frequency === void 0 ? void 0 : _data$frequency.name,
2837
- typeOfWaste: data === null || data === void 0 ? void 0 : (_data$typeOfWaste = data.typeOfWaste) === null || _data$typeOfWaste === void 0 ? void 0 : _data$typeOfWaste.name,
2838
- propertyType: data === null || data === void 0 ? void 0 : (_data$propertyType = data.propertyType) === null || _data$propertyType === void 0 ? void 0 : _data$propertyType.name,
2839
- plotSize: data === null || data === void 0 ? void 0 : data.plotSize,
2840
- location: data === null || data === void 0 ? void 0 : data.location,
2841
- applicationType: "NEW_GARBAGE_CONNECTION",
2842
- connectionCategory: data === null || data === void 0 ? void 0 : (_data$connectionCateg = data.connectionCategory) === null || _data$connectionCateg === void 0 ? void 0 : _data$connectionCateg.name,
2843
- connectionHolders: [{
2844
- name: ownerData === null || ownerData === void 0 ? void 0 : ownerData.name,
2845
- mobileNumber: ownerData === null || ownerData === void 0 ? void 0 : ownerData.mobileNumber,
2846
- address: ownerData === null || ownerData === void 0 ? void 0 : ownerData.address,
2847
- emailId: ownerData === null || ownerData === void 0 ? void 0 : ownerData.emailId,
2848
- type: "CITIZEN"
2849
- }],
2850
- processInstance: {
2851
- businessService: "NewGC",
2852
- action: "INITIATE",
2853
- moduleName: "gc-services"
2854
- },
2855
- additionalDetails: {
2856
- connectionCategory: data === null || data === void 0 ? void 0 : (_data$connectionCateg2 = data.connectionCategory) === null || _data$connectionCateg2 === void 0 ? void 0 : _data$connectionCateg2.name
2829
+ var _currentStepData$venu, _currentStepData$apiR;
2830
+ 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) {
2831
+ var _data$frequency, _data$typeOfWaste, _data$propertyType, _data$connectionCateg, _currentStepData$venu2, _data$connectionCateg2;
2832
+ const ownerData = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.ownerDetails;
2833
+ const updatedDatacheck = (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.venueDetails) || (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.apiResponseData);
2834
+ const payload = {
2835
+ GarbageConnection: {
2836
+ ...updatedDatacheck,
2837
+ tenantId: tenantId,
2838
+ propertyId: data === null || data === void 0 ? void 0 : data.propertyId,
2839
+ frequency: data === null || data === void 0 ? void 0 : (_data$frequency = data.frequency) === null || _data$frequency === void 0 ? void 0 : _data$frequency.name,
2840
+ typeOfWaste: data === null || data === void 0 ? void 0 : (_data$typeOfWaste = data.typeOfWaste) === null || _data$typeOfWaste === void 0 ? void 0 : _data$typeOfWaste.name,
2841
+ propertyType: data === null || data === void 0 ? void 0 : (_data$propertyType = data.propertyType) === null || _data$propertyType === void 0 ? void 0 : _data$propertyType.name,
2842
+ plotSize: data === null || data === void 0 ? void 0 : data.plotSize,
2843
+ location: data === null || data === void 0 ? void 0 : data.location,
2844
+ connectionCategory: data === null || data === void 0 ? void 0 : (_data$connectionCateg = data.connectionCategory) === null || _data$connectionCateg === void 0 ? void 0 : _data$connectionCateg.name,
2845
+ connectionHolders: [{
2846
+ name: ownerData === null || ownerData === void 0 ? void 0 : ownerData.name,
2847
+ mobileNumber: ownerData === null || ownerData === void 0 ? void 0 : ownerData.mobileNumber,
2848
+ permanentAddress: ownerData === null || ownerData === void 0 ? void 0 : ownerData.address,
2849
+ emailId: ownerData === null || ownerData === void 0 ? void 0 : ownerData.emailId,
2850
+ type: "CITIZEN"
2851
+ }],
2852
+ processInstance: {
2853
+ ...(currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$venu2 = currentStepData.venueDetails) === null || _currentStepData$venu2 === void 0 ? void 0 : _currentStepData$venu2.processInstance),
2854
+ action: "DRAFT"
2855
+ },
2856
+ additionalDetails: {
2857
+ connectionCategory: data === null || data === void 0 ? void 0 : (_data$connectionCateg2 = data.connectionCategory) === null || _data$connectionCateg2 === void 0 ? void 0 : _data$connectionCateg2.name
2858
+ }
2857
2859
  }
2860
+ };
2861
+ console.log("payload check", payload);
2862
+ setLoader(true);
2863
+ try {
2864
+ var _response$GarbageConn;
2865
+ const response = await Digit.GCService.update(payload);
2866
+ setLoader(false);
2867
+ console.log("response", response);
2868
+ goNext(response === null || response === void 0 ? void 0 : (_response$GarbageConn = response.GarbageConnection) === null || _response$GarbageConn === void 0 ? void 0 : _response$GarbageConn[0]);
2869
+ } catch (error) {
2870
+ var _error$response$data, _error$response$data$, _error$response$data$2;
2871
+ setLoader(false);
2872
+ console.log("Response Data:", error.response.data);
2873
+ setShowToast(true);
2874
+ 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);
2875
+ }
2876
+ } else {
2877
+ var _data$frequency2, _data$typeOfWaste2, _data$propertyType2, _data$connectionCateg3, _data$connectionCateg4;
2878
+ setLoader(true);
2879
+ console.log("data", data);
2880
+ console.log("currentStepData", currentStepData);
2881
+ const ownerData = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.ownerDetails;
2882
+ const payload = {
2883
+ GarbageConnection: {
2884
+ tenantId: tenantId,
2885
+ propertyId: data === null || data === void 0 ? void 0 : data.propertyId,
2886
+ frequency: data === null || data === void 0 ? void 0 : (_data$frequency2 = data.frequency) === null || _data$frequency2 === void 0 ? void 0 : _data$frequency2.name,
2887
+ typeOfWaste: data === null || data === void 0 ? void 0 : (_data$typeOfWaste2 = data.typeOfWaste) === null || _data$typeOfWaste2 === void 0 ? void 0 : _data$typeOfWaste2.name,
2888
+ propertyType: data === null || data === void 0 ? void 0 : (_data$propertyType2 = data.propertyType) === null || _data$propertyType2 === void 0 ? void 0 : _data$propertyType2.name,
2889
+ plotSize: data === null || data === void 0 ? void 0 : data.plotSize,
2890
+ location: data === null || data === void 0 ? void 0 : data.location,
2891
+ applicationType: "NEW_GARBAGE_CONNECTION",
2892
+ connectionCategory: data === null || data === void 0 ? void 0 : (_data$connectionCateg3 = data.connectionCategory) === null || _data$connectionCateg3 === void 0 ? void 0 : _data$connectionCateg3.name,
2893
+ connectionHolders: [{
2894
+ name: ownerData === null || ownerData === void 0 ? void 0 : ownerData.name,
2895
+ mobileNumber: ownerData === null || ownerData === void 0 ? void 0 : ownerData.mobileNumber,
2896
+ permanentAddress: ownerData === null || ownerData === void 0 ? void 0 : ownerData.address,
2897
+ emailId: ownerData === null || ownerData === void 0 ? void 0 : ownerData.emailId,
2898
+ type: "CITIZEN"
2899
+ }],
2900
+ processInstance: {
2901
+ businessService: "NewGC",
2902
+ action: "INITIATE",
2903
+ moduleName: "gc-services"
2904
+ },
2905
+ additionalDetails: {
2906
+ connectionCategory: data === null || data === void 0 ? void 0 : (_data$connectionCateg4 = data.connectionCategory) === null || _data$connectionCateg4 === void 0 ? void 0 : _data$connectionCateg4.name
2907
+ }
2908
+ }
2909
+ };
2910
+ try {
2911
+ var _response$GarbageConn2;
2912
+ const response = await Digit.GCService.create(payload);
2913
+ setLoader(false);
2914
+ console.log("response", response);
2915
+ goNext(response === null || response === void 0 ? void 0 : (_response$GarbageConn2 = response.GarbageConnection) === null || _response$GarbageConn2 === void 0 ? void 0 : _response$GarbageConn2[0]);
2916
+ } catch (error) {
2917
+ var _error$response$data2, _error$response$data3, _error$response$data4;
2918
+ setLoader(false);
2919
+ console.log("Response Data:", error.response.data);
2920
+ setShowToast(true);
2921
+ 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);
2858
2922
  }
2859
- };
2860
- try {
2861
- var _response$GarbageConn;
2862
- const response = await Digit.GCService.create(payload);
2863
- setLoader(false);
2864
- console.log("response", response);
2865
- goNext(response === null || response === void 0 ? void 0 : (_response$GarbageConn = response.GarbageConnection) === null || _response$GarbageConn === void 0 ? void 0 : _response$GarbageConn[0]);
2866
- } catch (error) {
2867
- setLoader(false);
2868
2923
  }
2869
2924
  };
2870
2925
  const {
@@ -2885,32 +2940,52 @@ const CHBCitizenSecond = ({
2885
2940
  });
2886
2941
  useEffect(() => {
2887
2942
  console.log("propertyDetailsFetch==", propertyDetailsFetch === null || propertyDetailsFetch === void 0 ? void 0 : propertyDetailsFetch.Properties);
2888
- if (propertyDetailsFetch !== null && propertyDetailsFetch !== void 0 && propertyDetailsFetch.Properties || currentStepData !== null && currentStepData !== void 0 && currentStepData.venueDetails) {
2889
- var _propertyDetailsFetch, _propertyDetailsFetch2, _propertyDetailsFetch3, _propertyDetailsFetch4, _propertyDetailsFetch5, _propertyDetailsFetch6, _GCData$swServicesC, _FreqType$gcServices, _WasteType$gcService, _propertyDetailsFetch7, _propertyDetailsFetch8, _backStepData$propert, _backStepData$frequen, _backStepData$typeOfW;
2890
- const backStepData = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.venueDetails;
2943
+ console.log("currentStepData==", currentStepData);
2944
+ if (propertyDetailsFetch !== null && propertyDetailsFetch !== void 0 && propertyDetailsFetch.Properties || currentStepData !== null && currentStepData !== void 0 && currentStepData.venueDetails || currentStepData !== null && currentStepData !== void 0 && currentStepData.apiResponseData) {
2945
+ var _propertyDetailsFetch, _propertyDetailsFetch2, _propertyDetailsFetch3, _propertyDetailsFetch4, _propertyDetailsFetch5, _propertyDetailsFetch6, _GCData$swServicesC, _FreqType$gcServices, _WasteType$gcService, _connectionCategory$g, _propertyDetailsFetch7, _propertyDetailsFetch8;
2946
+ const backStepData = (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.venueDetails) || (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.apiResponseData);
2891
2947
  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);
2892
2948
  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);
2893
2949
  if (backStepData !== null && backStepData !== void 0 && backStepData.propertyId) setValue("propertyId", backStepData === null || backStepData === void 0 ? void 0 : backStepData.propertyId);
2894
2950
  setValue("location", location);
2895
2951
  setValue("plotSize", plotSize);
2896
2952
  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) || [];
2953
+ console.log("pTypeOptions", pTypeOptions);
2897
2954
  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) || [];
2898
2955
  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) || [];
2899
- 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);
2900
- const frequency = backStepData === null || backStepData === void 0 ? void 0 : (_backStepData$frequen = backStepData.frequency) === null || _backStepData$frequen === void 0 ? void 0 : _backStepData$frequen.code;
2901
- const typeOfWaste = backStepData === null || backStepData === void 0 ? void 0 : (_backStepData$typeOfW = backStepData.typeOfWaste) === null || _backStepData$typeOfW === void 0 ? void 0 : _backStepData$typeOfW.code;
2902
- const pType = pTypeOptions === null || pTypeOptions === void 0 ? void 0 : pTypeOptions.find(item => item.code == usage);
2903
- const freType = freqTypeOptions === null || freqTypeOptions === void 0 ? void 0 : freqTypeOptions.find(item => item.code == frequency);
2904
- const wasteType = wasteTypeOptions === null || wasteTypeOptions === void 0 ? void 0 : wasteTypeOptions.find(item => item.code == typeOfWaste);
2956
+ 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) || [];
2957
+ console.log("connectionCatoptions", connectionCatoptions);
2958
+ 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);
2959
+ const frequency = backStepData === null || backStepData === void 0 ? void 0 : backStepData.frequency;
2960
+ const typeOfWaste = backStepData === null || backStepData === void 0 ? void 0 : backStepData.typeOfWaste;
2961
+ const connetionType = backStepData === null || backStepData === void 0 ? void 0 : backStepData.connectionCategory;
2962
+ const pType = pTypeOptions === null || pTypeOptions === void 0 ? void 0 : pTypeOptions.find(item => item.name == usage);
2963
+ const freType = freqTypeOptions === null || freqTypeOptions === void 0 ? void 0 : freqTypeOptions.find(item => item.name == frequency);
2964
+ const wasteType = wasteTypeOptions === null || wasteTypeOptions === void 0 ? void 0 : wasteTypeOptions.find(item => item.name == typeOfWaste);
2965
+ const connectionCategoryType = connectionCatoptions === null || connectionCatoptions === void 0 ? void 0 : connectionCatoptions.find(item => item.code == connetionType);
2905
2966
  setValue("propertyType", pType || null);
2906
2967
  setValue("frequency", freType || null);
2907
2968
  setValue("typeOfWaste", wasteType || null);
2969
+ setValue("connectionCategory", connectionCategoryType || null);
2908
2970
  }
2909
2971
  }, [propertyDetailsFetch, GCData, setValue, currentStepData]);
2910
2972
  const searchProperty = async () => {
2911
2973
  const pId = watch("propertyId");
2912
2974
  setPropertyId(pId);
2913
2975
  };
2976
+ const closeToast = () => {
2977
+ setShowToast(false);
2978
+ setError("");
2979
+ };
2980
+ const handleReset = () => {
2981
+ setValue("propertyType", null);
2982
+ setValue("plotSize", "");
2983
+ setValue("location", "");
2984
+ setValue("frequency", null);
2985
+ setValue("typeOfWaste", null);
2986
+ setValue("connectionCategory", null);
2987
+ setPropertyId(null);
2988
+ };
2914
2989
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("form", {
2915
2990
  style: {
2916
2991
  paddingBottom: "150px"
@@ -2943,6 +3018,7 @@ const CHBCitizenSecond = ({
2943
3018
  value: props.value,
2944
3019
  onChange: e => {
2945
3020
  props.onChange(e.target.value);
3021
+ handleReset();
2946
3022
  },
2947
3023
  t: t
2948
3024
  })
@@ -2959,7 +3035,7 @@ const CHBCitizenSecond = ({
2959
3035
  style: {
2960
3036
  color: "red"
2961
3037
  }
2962
- }, errors.propertyId.message)), ((propertyDetailsFetch === null || propertyDetailsFetch === void 0 ? void 0 : propertyDetailsFetch.Properties) || (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.venueDetails)) && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
3038
+ }, 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.createElement("div", null, /*#__PURE__*/React.createElement("div", {
2963
3039
  style: {
2964
3040
  marginBottom: "20px"
2965
3041
  }
@@ -3129,7 +3205,7 @@ const CHBCitizenSecond = ({
3129
3205
  required: t("GC_CONNECTION_TYPE_REQUIRED")
3130
3206
  },
3131
3207
  render: props => {
3132
- var _connectionCategory$g;
3208
+ var _connectionCategory$g2;
3133
3209
  return /*#__PURE__*/React.createElement(Dropdown, {
3134
3210
  style: {
3135
3211
  marginBottom: 0
@@ -3139,7 +3215,7 @@ const CHBCitizenSecond = ({
3139
3215
  props.onChange(e);
3140
3216
  },
3141
3217
  selected: props.value,
3142
- option: connectionCategory === null || connectionCategory === void 0 ? void 0 : (_connectionCategory$g = connectionCategory["gc-services-masters"]) === null || _connectionCategory$g === void 0 ? void 0 : _connectionCategory$g.connectionCategory,
3218
+ option: connectionCategory === null || connectionCategory === void 0 ? void 0 : (_connectionCategory$g2 = connectionCategory["gc-services-masters"]) === null || _connectionCategory$g2 === void 0 ? void 0 : _connectionCategory$g2.connectionCategory,
3143
3219
  optionKey: "name"
3144
3220
  });
3145
3221
  }
@@ -3159,7 +3235,12 @@ const CHBCitizenSecond = ({
3159
3235
  }), /*#__PURE__*/React.createElement(SubmitBar, {
3160
3236
  label: "Next",
3161
3237
  submit: "submit"
3162
- }))), (loader || isLoading || GCLoading || WasteTypeLoading || FreqTypeLoading || connectionCategoryLoading) && /*#__PURE__*/React.createElement(Loader, {
3238
+ }))), showToast && /*#__PURE__*/React.createElement(Toast, {
3239
+ isDleteBtn: true,
3240
+ error: true,
3241
+ label: error,
3242
+ onClose: closeToast
3243
+ }), (loader || isLoading || GCLoading || WasteTypeLoading || FreqTypeLoading || connectionCategoryLoading) && /*#__PURE__*/React.createElement(Loader, {
3163
3244
  page: true
3164
3245
  }));
3165
3246
  };
@@ -9036,9 +9117,16 @@ const CHBCitizenDetailsNew = ({
9036
9117
  currentStepData,
9037
9118
  onGoBack
9038
9119
  }) => {
9039
- var _user$info, _user$info2, _user$info3;
9120
+ var _history$location, _user$info, _user$info2, _user$info3;
9121
+ const dispatch = useDispatch();
9040
9122
  const isCitizen = window.location.href.includes("citizen");
9041
9123
  const user = Digit.UserService.getUser();
9124
+ const tenantId = window.location.href.includes("citizen") ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
9125
+ const history = useHistory();
9126
+ const [loader, setLoader] = useState(false);
9127
+ const pathname = (history === null || history === void 0 ? void 0 : (_history$location = history.location) === null || _history$location === void 0 ? void 0 : _history$location.pathname) || "";
9128
+ const applicationNumber = pathname === null || pathname === void 0 ? void 0 : pathname.split("/").pop();
9129
+ console.log("applicationNumber", applicationNumber);
9042
9130
  const {
9043
9131
  control,
9044
9132
  handleSubmit,
@@ -9055,6 +9143,31 @@ const CHBCitizenDetailsNew = ({
9055
9143
  address: ""
9056
9144
  }
9057
9145
  });
9146
+ const fetchChallans = async filters => {
9147
+ setLoader(true);
9148
+ try {
9149
+ var _responseData$Garbage;
9150
+ const responseData = await Digit.GCService.search({
9151
+ tenantId,
9152
+ filters
9153
+ });
9154
+ console.log("search ", responseData);
9155
+ 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]));
9156
+ setLoader(false);
9157
+ } catch (error) {
9158
+ console.log("error", error);
9159
+ setLoader(false);
9160
+ }
9161
+ };
9162
+ useEffect(() => {
9163
+ console.log("tes===", applicationNumber);
9164
+ if (applicationNumber) {
9165
+ console.log("here");
9166
+ const filters = {};
9167
+ filters.applicationNumber = applicationNumber;
9168
+ fetchChallans(filters);
9169
+ }
9170
+ }, [applicationNumber]);
9058
9171
  const onSubmit = async data => {
9059
9172
  console.log("data===", data);
9060
9173
  goNext(data);
@@ -9062,12 +9175,20 @@ const CHBCitizenDetailsNew = ({
9062
9175
  useEffect(() => {
9063
9176
  console.log("currentStepData", currentStepData);
9064
9177
  const formattedData = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.ownerDetails;
9178
+ const apiRes = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.apiResponseData;
9065
9179
  if (formattedData) {
9066
9180
  setValue("address", formattedData === null || formattedData === void 0 ? void 0 : formattedData.address);
9067
9181
  setValue("emailId", formattedData === null || formattedData === void 0 ? void 0 : formattedData.emailId);
9068
9182
  setValue("mobileNumber", formattedData === null || formattedData === void 0 ? void 0 : formattedData.mobileNumber);
9069
9183
  setValue("name", formattedData === null || formattedData === void 0 ? void 0 : formattedData.name);
9070
9184
  }
9185
+ if (apiRes) {
9186
+ var _apiRes$connectionHol, _apiRes$connectionHol2, _apiRes$connectionHol3, _apiRes$connectionHol4, _apiRes$connectionHol5, _apiRes$connectionHol6, _apiRes$connectionHol7, _apiRes$connectionHol8;
9187
+ 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);
9188
+ 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);
9189
+ 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);
9190
+ 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);
9191
+ }
9071
9192
  }, [currentStepData, setValue]);
9072
9193
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("form", {
9073
9194
  onSubmit: handleSubmit(onSubmit)
@@ -9219,7 +9340,9 @@ const CHBCitizenDetailsNew = ({
9219
9340
  }, errors.address.message))), /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
9220
9341
  label: "Next",
9221
9342
  submit: "submit"
9222
- }))));
9343
+ }))), loader && /*#__PURE__*/React.createElement(Loader, {
9344
+ page: true
9345
+ }));
9223
9346
  };
9224
9347
 
9225
9348
  const NewADSStepFormTwo = ({
@@ -9283,7 +9406,6 @@ const NewADSStepFormThree = ({
9283
9406
  return state.gc.GarbageApplicationFormReducer.formData && state.gc.GarbageApplicationFormReducer.formData[config === null || config === void 0 ? void 0 : config.key] ? state.gc.GarbageApplicationFormReducer.formData[config === null || config === void 0 ? void 0 : config.key] : {};
9284
9407
  });
9285
9408
  const goNext = async finalData => {
9286
- var _checkFormData$docume, _checkFormData$docume2, _checkFormData$venueD;
9287
9409
  const missingFields = validation(finalData);
9288
9410
  if (missingFields.length > 0) {
9289
9411
  setError(`${t("GC_" + missingFields[0].replace(".", "_").toUpperCase())}`);
@@ -9291,28 +9413,7 @@ const NewADSStepFormThree = ({
9291
9413
  setTimeout(() => setShowToast(false), 3000);
9292
9414
  return;
9293
9415
  }
9294
- console.log("checkFormData", checkFormData);
9295
- setLoader(true);
9296
- const payload = {
9297
- GarbageConnection: {
9298
- ...(checkFormData === null || checkFormData === void 0 ? void 0 : checkFormData.venueDetails),
9299
- 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,
9300
- processInstance: {
9301
- ...(checkFormData === null || checkFormData === void 0 ? void 0 : (_checkFormData$venueD = checkFormData.venueDetails) === null || _checkFormData$venueD === void 0 ? void 0 : _checkFormData$venueD.processInstance),
9302
- action: "DRAFT"
9303
- }
9304
- }
9305
- };
9306
- try {
9307
- var _response$GarbageConn;
9308
- const response = await Digit.GCService.update(payload);
9309
- console.log("response", response);
9310
- setLoader(false);
9311
- 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]));
9312
- onGoNext();
9313
- } catch (error) {
9314
- setLoader(false);
9315
- }
9416
+ onGoNext();
9316
9417
  };
9317
9418
  function validation(formData) {
9318
9419
  if (!isLoading) {
@@ -9504,7 +9605,7 @@ function CHBSummary({
9504
9605
  goNext,
9505
9606
  onGoBack
9506
9607
  }) {
9507
- 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;
9608
+ 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;
9508
9609
  const {
9509
9610
  t
9510
9611
  } = useTranslation();
@@ -9592,7 +9693,13 @@ function CHBSummary({
9592
9693
  style: {
9593
9694
  fontSize: "24px"
9594
9695
  }
9595
- }, 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.createElement(CardSubHeader, {
9696
+ }, 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.createElement("div", {
9697
+ style: sectionStyle
9698
+ }, /*#__PURE__*/React.createElement(CardSubHeader, {
9699
+ style: {
9700
+ fontSize: "24px"
9701
+ }
9702
+ }, 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.createElement(CardSubHeader, {
9596
9703
  style: {
9597
9704
  fontSize: "24px",
9598
9705
  marginTop: "30px"
@@ -9670,15 +9777,22 @@ const NewADSStepFormFour = ({
9670
9777
  }
9671
9778
  };
9672
9779
  const onSubmit = async (data, actionStatus) => {
9673
- var _data$venueDetails;
9780
+ var _data$apiResponseData, _data$documents, _data$documents$docum, _data$venueDetails;
9674
9781
  setLoader(true);
9782
+ console.log("data", data);
9783
+ const apiDocs = (data === null || data === void 0 ? void 0 : (_data$apiResponseData = data.apiResponseData) === null || _data$apiResponseData === void 0 ? void 0 : _data$apiResponseData.documents) || [];
9784
+ 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) || [];
9785
+ const existingFileStoreIds = apiDocs === null || apiDocs === void 0 ? void 0 : apiDocs.map(doc => doc.fileStoreId);
9786
+ const newDocuments = formDocs.filter(doc => !(existingFileStoreIds !== null && existingFileStoreIds !== void 0 && existingFileStoreIds.includes(doc.fileStoreId)));
9787
+ console.log("NEW DOCUMENTS TO SEND:", newDocuments);
9675
9788
  const payload = {
9676
9789
  GarbageConnection: {
9677
9790
  ...(data === null || data === void 0 ? void 0 : data.venueDetails),
9678
9791
  processInstance: {
9679
9792
  ...(data === null || data === void 0 ? void 0 : (_data$venueDetails = data.venueDetails) === null || _data$venueDetails === void 0 ? void 0 : _data$venueDetails.processInstance),
9680
9793
  action: actionStatus
9681
- }
9794
+ },
9795
+ documents: newDocuments
9682
9796
  }
9683
9797
  };
9684
9798
  try {
@@ -9730,18 +9844,19 @@ const SelectNDCDocuments = ({
9730
9844
  }) => {
9731
9845
  var _formData$documents, _data$gcServicesMas;
9732
9846
  const tenantId = window.location.href.includes("employee") ? Digit.ULBService.getCurrentPermanentCity() : localStorage.getItem("CITIZEN.CITY");
9733
- const checkFormData = useSelector(state => state.ndc.NDCForm.formData || {});
9847
+ const checkFormData = useSelector(state => state.gc.GarbageApplicationFormReducer.formData || {});
9734
9848
  const stateId = Digit.ULBService.getStateId();
9735
9849
  const [documents, setDocuments] = useState((formData === null || formData === void 0 ? void 0 : (_formData$documents = formData.documents) === null || _formData$documents === void 0 ? void 0 : _formData$documents.documents) || []);
9736
9850
  const [error, setError] = useState(null);
9737
9851
  useEffect(() => {
9738
- var _checkFormData$respon, _checkFormData$respon2, _checkFormData$respon3;
9739
- 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) {
9740
- var _checkFormData$respon4, _checkFormData$respon5, _checkFormData$respon6;
9741
- 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 => ({
9852
+ var _checkFormData$venueD, _checkFormData$venueD2;
9853
+ console.log("checkFormData", checkFormData);
9854
+ 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) {
9855
+ var _checkFormData$venueD3, _checkFormData$venueD4;
9856
+ 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 => ({
9742
9857
  documentType: doc === null || doc === void 0 ? void 0 : doc.documentType,
9743
- fileStoreId: doc === null || doc === void 0 ? void 0 : doc.documentAttachment,
9744
- documentUid: doc === null || doc === void 0 ? void 0 : doc.documentAttachment
9858
+ fileStoreId: doc === null || doc === void 0 ? void 0 : doc.fileStoreId,
9859
+ documentUid: doc === null || doc === void 0 ? void 0 : doc.fileStoreId
9745
9860
  }));
9746
9861
  setDocuments(apiDocs);
9747
9862
  }
@@ -9757,6 +9872,8 @@ const SelectNDCDocuments = ({
9757
9872
  }]);
9758
9873
  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;
9759
9874
  const goNext = () => {
9875
+ console.log("here stop");
9876
+ console.log("formData", formData);
9760
9877
  onSelect(config.key, {
9761
9878
  documents,
9762
9879
  ndcDocumentsLength: ndcDocuments === null || ndcDocuments === void 0 ? void 0 : ndcDocuments.length
@@ -9799,7 +9916,8 @@ function SelectDocument({
9799
9916
  documents,
9800
9917
  setFormError,
9801
9918
  config,
9802
- formState
9919
+ formState,
9920
+ formData
9803
9921
  }) {
9804
9922
  const filteredDocument = documents === null || documents === void 0 ? void 0 : documents.filter(item => {
9805
9923
  var _item$documentType;
@@ -9818,6 +9936,7 @@ function SelectDocument({
9818
9936
  }
9819
9937
  }, [filteredDocument]);
9820
9938
  useEffect(() => {
9939
+ console.log("here come", documents);
9821
9940
  if (uploadedFile) {
9822
9941
  setDocuments(prev => {
9823
9942
  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));
@@ -10594,791 +10713,6 @@ const config = [{
10594
10713
  }]
10595
10714
  }];
10596
10715
 
10597
- var bind = function bind(fn, thisArg) {
10598
- return function wrap() {
10599
- var args = new Array(arguments.length);
10600
- for (var i = 0; i < args.length; i++) {
10601
- args[i] = arguments[i];
10602
- }
10603
- return fn.apply(thisArg, args);
10604
- };
10605
- };
10606
-
10607
- var toString = Object.prototype.toString;
10608
- function isArray(val) {
10609
- return toString.call(val) === '[object Array]';
10610
- }
10611
- function isUndefined(val) {
10612
- return typeof val === 'undefined';
10613
- }
10614
- function isBuffer(val) {
10615
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
10616
- }
10617
- function isArrayBuffer(val) {
10618
- return toString.call(val) === '[object ArrayBuffer]';
10619
- }
10620
- function isFormData(val) {
10621
- return typeof FormData !== 'undefined' && val instanceof FormData;
10622
- }
10623
- function isArrayBufferView(val) {
10624
- var result;
10625
- if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
10626
- result = ArrayBuffer.isView(val);
10627
- } else {
10628
- result = val && val.buffer && val.buffer instanceof ArrayBuffer;
10629
- }
10630
- return result;
10631
- }
10632
- function isString(val) {
10633
- return typeof val === 'string';
10634
- }
10635
- function isNumber(val) {
10636
- return typeof val === 'number';
10637
- }
10638
- function isObject(val) {
10639
- return val !== null && typeof val === 'object';
10640
- }
10641
- function isPlainObject(val) {
10642
- if (toString.call(val) !== '[object Object]') {
10643
- return false;
10644
- }
10645
- var prototype = Object.getPrototypeOf(val);
10646
- return prototype === null || prototype === Object.prototype;
10647
- }
10648
- function isDate$1(val) {
10649
- return toString.call(val) === '[object Date]';
10650
- }
10651
- function isFile(val) {
10652
- return toString.call(val) === '[object File]';
10653
- }
10654
- function isBlob(val) {
10655
- return toString.call(val) === '[object Blob]';
10656
- }
10657
- function isFunction(val) {
10658
- return toString.call(val) === '[object Function]';
10659
- }
10660
- function isStream(val) {
10661
- return isObject(val) && isFunction(val.pipe);
10662
- }
10663
- function isURLSearchParams(val) {
10664
- return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
10665
- }
10666
- function trim(str) {
10667
- return str.replace(/^\s*/, '').replace(/\s*$/, '');
10668
- }
10669
- function isStandardBrowserEnv() {
10670
- if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || navigator.product === 'NativeScript' || navigator.product === 'NS')) {
10671
- return false;
10672
- }
10673
- return typeof window !== 'undefined' && typeof document !== 'undefined';
10674
- }
10675
- function forEach(obj, fn) {
10676
- if (obj === null || typeof obj === 'undefined') {
10677
- return;
10678
- }
10679
- if (typeof obj !== 'object') {
10680
- obj = [obj];
10681
- }
10682
- if (isArray(obj)) {
10683
- for (var i = 0, l = obj.length; i < l; i++) {
10684
- fn.call(null, obj[i], i, obj);
10685
- }
10686
- } else {
10687
- for (var key in obj) {
10688
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
10689
- fn.call(null, obj[key], key, obj);
10690
- }
10691
- }
10692
- }
10693
- }
10694
- function merge() {
10695
- var result = {};
10696
- function assignValue(val, key) {
10697
- if (isPlainObject(result[key]) && isPlainObject(val)) {
10698
- result[key] = merge(result[key], val);
10699
- } else if (isPlainObject(val)) {
10700
- result[key] = merge({}, val);
10701
- } else if (isArray(val)) {
10702
- result[key] = val.slice();
10703
- } else {
10704
- result[key] = val;
10705
- }
10706
- }
10707
- for (var i = 0, l = arguments.length; i < l; i++) {
10708
- forEach(arguments[i], assignValue);
10709
- }
10710
- return result;
10711
- }
10712
- function extend(a, b, thisArg) {
10713
- forEach(b, function assignValue(val, key) {
10714
- if (thisArg && typeof val === 'function') {
10715
- a[key] = bind(val, thisArg);
10716
- } else {
10717
- a[key] = val;
10718
- }
10719
- });
10720
- return a;
10721
- }
10722
- function stripBOM(content) {
10723
- if (content.charCodeAt(0) === 0xFEFF) {
10724
- content = content.slice(1);
10725
- }
10726
- return content;
10727
- }
10728
- var utils = {
10729
- isArray: isArray,
10730
- isArrayBuffer: isArrayBuffer,
10731
- isBuffer: isBuffer,
10732
- isFormData: isFormData,
10733
- isArrayBufferView: isArrayBufferView,
10734
- isString: isString,
10735
- isNumber: isNumber,
10736
- isObject: isObject,
10737
- isPlainObject: isPlainObject,
10738
- isUndefined: isUndefined,
10739
- isDate: isDate$1,
10740
- isFile: isFile,
10741
- isBlob: isBlob,
10742
- isFunction: isFunction,
10743
- isStream: isStream,
10744
- isURLSearchParams: isURLSearchParams,
10745
- isStandardBrowserEnv: isStandardBrowserEnv,
10746
- forEach: forEach,
10747
- merge: merge,
10748
- extend: extend,
10749
- trim: trim,
10750
- stripBOM: stripBOM
10751
- };
10752
-
10753
- function encode(val) {
10754
- return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
10755
- }
10756
- var buildURL = function buildURL(url, params, paramsSerializer) {
10757
- if (!params) {
10758
- return url;
10759
- }
10760
- var serializedParams;
10761
- if (paramsSerializer) {
10762
- serializedParams = paramsSerializer(params);
10763
- } else if (utils.isURLSearchParams(params)) {
10764
- serializedParams = params.toString();
10765
- } else {
10766
- var parts = [];
10767
- utils.forEach(params, function serialize(val, key) {
10768
- if (val === null || typeof val === 'undefined') {
10769
- return;
10770
- }
10771
- if (utils.isArray(val)) {
10772
- key = key + '[]';
10773
- } else {
10774
- val = [val];
10775
- }
10776
- utils.forEach(val, function parseValue(v) {
10777
- if (utils.isDate(v)) {
10778
- v = v.toISOString();
10779
- } else if (utils.isObject(v)) {
10780
- v = JSON.stringify(v);
10781
- }
10782
- parts.push(encode(key) + '=' + encode(v));
10783
- });
10784
- });
10785
- serializedParams = parts.join('&');
10786
- }
10787
- if (serializedParams) {
10788
- var hashmarkIndex = url.indexOf('#');
10789
- if (hashmarkIndex !== -1) {
10790
- url = url.slice(0, hashmarkIndex);
10791
- }
10792
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
10793
- }
10794
- return url;
10795
- };
10796
-
10797
- function InterceptorManager() {
10798
- this.handlers = [];
10799
- }
10800
- InterceptorManager.prototype.use = function use(fulfilled, rejected) {
10801
- this.handlers.push({
10802
- fulfilled: fulfilled,
10803
- rejected: rejected
10804
- });
10805
- return this.handlers.length - 1;
10806
- };
10807
- InterceptorManager.prototype.eject = function eject(id) {
10808
- if (this.handlers[id]) {
10809
- this.handlers[id] = null;
10810
- }
10811
- };
10812
- InterceptorManager.prototype.forEach = function forEach(fn) {
10813
- utils.forEach(this.handlers, function forEachHandler(h) {
10814
- if (h !== null) {
10815
- fn(h);
10816
- }
10817
- });
10818
- };
10819
- var InterceptorManager_1 = InterceptorManager;
10820
-
10821
- var transformData = function transformData(data, headers, fns) {
10822
- utils.forEach(fns, function transform(fn) {
10823
- data = fn(data, headers);
10824
- });
10825
- return data;
10826
- };
10827
-
10828
- var isCancel = function isCancel(value) {
10829
- return !!(value && value.__CANCEL__);
10830
- };
10831
-
10832
- var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
10833
- utils.forEach(headers, function processHeader(value, name) {
10834
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
10835
- headers[normalizedName] = value;
10836
- delete headers[name];
10837
- }
10838
- });
10839
- };
10840
-
10841
- var enhanceError = function enhanceError(error, config, code, request, response) {
10842
- error.config = config;
10843
- if (code) {
10844
- error.code = code;
10845
- }
10846
- error.request = request;
10847
- error.response = response;
10848
- error.isAxiosError = true;
10849
- error.toJSON = function toJSON() {
10850
- return {
10851
- message: this.message,
10852
- name: this.name,
10853
- description: this.description,
10854
- number: this.number,
10855
- fileName: this.fileName,
10856
- lineNumber: this.lineNumber,
10857
- columnNumber: this.columnNumber,
10858
- stack: this.stack,
10859
- config: this.config,
10860
- code: this.code
10861
- };
10862
- };
10863
- return error;
10864
- };
10865
-
10866
- var createError = function createError(message, config, code, request, response) {
10867
- var error = new Error(message);
10868
- return enhanceError(error, config, code, request, response);
10869
- };
10870
-
10871
- var settle = function settle(resolve, reject, response) {
10872
- var validateStatus = response.config.validateStatus;
10873
- if (!response.status || !validateStatus || validateStatus(response.status)) {
10874
- resolve(response);
10875
- } else {
10876
- reject(createError('Request failed with status code ' + response.status, response.config, null, response.request, response));
10877
- }
10878
- };
10879
-
10880
- var cookies = utils.isStandardBrowserEnv() ? function standardBrowserEnv() {
10881
- return {
10882
- write: function write(name, value, expires, path, domain, secure) {
10883
- var cookie = [];
10884
- cookie.push(name + '=' + encodeURIComponent(value));
10885
- if (utils.isNumber(expires)) {
10886
- cookie.push('expires=' + new Date(expires).toGMTString());
10887
- }
10888
- if (utils.isString(path)) {
10889
- cookie.push('path=' + path);
10890
- }
10891
- if (utils.isString(domain)) {
10892
- cookie.push('domain=' + domain);
10893
- }
10894
- if (secure === true) {
10895
- cookie.push('secure');
10896
- }
10897
- document.cookie = cookie.join('; ');
10898
- },
10899
- read: function read(name) {
10900
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
10901
- return match ? decodeURIComponent(match[3]) : null;
10902
- },
10903
- remove: function remove(name) {
10904
- this.write(name, '', Date.now() - 86400000);
10905
- }
10906
- };
10907
- }() : function nonStandardBrowserEnv() {
10908
- return {
10909
- write: function write() {},
10910
- read: function read() {
10911
- return null;
10912
- },
10913
- remove: function remove() {}
10914
- };
10915
- }();
10916
-
10917
- var isAbsoluteURL = function isAbsoluteURL(url) {
10918
- return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
10919
- };
10920
-
10921
- var combineURLs = function combineURLs(baseURL, relativeURL) {
10922
- return relativeURL ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
10923
- };
10924
-
10925
- var buildFullPath = function buildFullPath(baseURL, requestedURL) {
10926
- if (baseURL && !isAbsoluteURL(requestedURL)) {
10927
- return combineURLs(baseURL, requestedURL);
10928
- }
10929
- return requestedURL;
10930
- };
10931
-
10932
- 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'];
10933
- var parseHeaders = function parseHeaders(headers) {
10934
- var parsed = {};
10935
- var key;
10936
- var val;
10937
- var i;
10938
- if (!headers) {
10939
- return parsed;
10940
- }
10941
- utils.forEach(headers.split('\n'), function parser(line) {
10942
- i = line.indexOf(':');
10943
- key = utils.trim(line.substr(0, i)).toLowerCase();
10944
- val = utils.trim(line.substr(i + 1));
10945
- if (key) {
10946
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
10947
- return;
10948
- }
10949
- if (key === 'set-cookie') {
10950
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
10951
- } else {
10952
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
10953
- }
10954
- }
10955
- });
10956
- return parsed;
10957
- };
10958
-
10959
- var isURLSameOrigin = utils.isStandardBrowserEnv() ? function standardBrowserEnv() {
10960
- var msie = /(msie|trident)/i.test(navigator.userAgent);
10961
- var urlParsingNode = document.createElement('a');
10962
- var originURL;
10963
- function resolveURL(url) {
10964
- var href = url;
10965
- if (msie) {
10966
- urlParsingNode.setAttribute('href', href);
10967
- href = urlParsingNode.href;
10968
- }
10969
- urlParsingNode.setAttribute('href', href);
10970
- return {
10971
- href: urlParsingNode.href,
10972
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
10973
- host: urlParsingNode.host,
10974
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
10975
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
10976
- hostname: urlParsingNode.hostname,
10977
- port: urlParsingNode.port,
10978
- pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
10979
- };
10980
- }
10981
- originURL = resolveURL(window.location.href);
10982
- return function isURLSameOrigin(requestURL) {
10983
- var parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
10984
- return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
10985
- };
10986
- }() : function nonStandardBrowserEnv() {
10987
- return function isURLSameOrigin() {
10988
- return true;
10989
- };
10990
- }();
10991
-
10992
- var xhr = function xhrAdapter(config) {
10993
- return new Promise(function dispatchXhrRequest(resolve, reject) {
10994
- var requestData = config.data;
10995
- var requestHeaders = config.headers;
10996
- if (utils.isFormData(requestData)) {
10997
- delete requestHeaders['Content-Type'];
10998
- }
10999
- var request = new XMLHttpRequest();
11000
- if (config.auth) {
11001
- var username = config.auth.username || '';
11002
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
11003
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
11004
- }
11005
- var fullPath = buildFullPath(config.baseURL, config.url);
11006
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
11007
- request.timeout = config.timeout;
11008
- request.onreadystatechange = function handleLoad() {
11009
- if (!request || request.readyState !== 4) {
11010
- return;
11011
- }
11012
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
11013
- return;
11014
- }
11015
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
11016
- var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
11017
- var response = {
11018
- data: responseData,
11019
- status: request.status,
11020
- statusText: request.statusText,
11021
- headers: responseHeaders,
11022
- config: config,
11023
- request: request
11024
- };
11025
- settle(resolve, reject, response);
11026
- request = null;
11027
- };
11028
- request.onabort = function handleAbort() {
11029
- if (!request) {
11030
- return;
11031
- }
11032
- reject(createError('Request aborted', config, 'ECONNABORTED', request));
11033
- request = null;
11034
- };
11035
- request.onerror = function handleError() {
11036
- reject(createError('Network Error', config, null, request));
11037
- request = null;
11038
- };
11039
- request.ontimeout = function handleTimeout() {
11040
- var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
11041
- if (config.timeoutErrorMessage) {
11042
- timeoutErrorMessage = config.timeoutErrorMessage;
11043
- }
11044
- reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', request));
11045
- request = null;
11046
- };
11047
- if (utils.isStandardBrowserEnv()) {
11048
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : undefined;
11049
- if (xsrfValue) {
11050
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
11051
- }
11052
- }
11053
- if ('setRequestHeader' in request) {
11054
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
11055
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
11056
- delete requestHeaders[key];
11057
- } else {
11058
- request.setRequestHeader(key, val);
11059
- }
11060
- });
11061
- }
11062
- if (!utils.isUndefined(config.withCredentials)) {
11063
- request.withCredentials = !!config.withCredentials;
11064
- }
11065
- if (config.responseType) {
11066
- try {
11067
- request.responseType = config.responseType;
11068
- } catch (e) {
11069
- if (config.responseType !== 'json') {
11070
- throw e;
11071
- }
11072
- }
11073
- }
11074
- if (typeof config.onDownloadProgress === 'function') {
11075
- request.addEventListener('progress', config.onDownloadProgress);
11076
- }
11077
- if (typeof config.onUploadProgress === 'function' && request.upload) {
11078
- request.upload.addEventListener('progress', config.onUploadProgress);
11079
- }
11080
- if (config.cancelToken) {
11081
- config.cancelToken.promise.then(function onCanceled(cancel) {
11082
- if (!request) {
11083
- return;
11084
- }
11085
- request.abort();
11086
- reject(cancel);
11087
- request = null;
11088
- });
11089
- }
11090
- if (!requestData) {
11091
- requestData = null;
11092
- }
11093
- request.send(requestData);
11094
- });
11095
- };
11096
-
11097
- var DEFAULT_CONTENT_TYPE = {
11098
- 'Content-Type': 'application/x-www-form-urlencoded'
11099
- };
11100
- function setContentTypeIfUnset(headers, value) {
11101
- if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
11102
- headers['Content-Type'] = value;
11103
- }
11104
- }
11105
- function getDefaultAdapter() {
11106
- var adapter;
11107
- if (typeof XMLHttpRequest !== 'undefined') {
11108
- adapter = xhr;
11109
- } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
11110
- adapter = xhr;
11111
- }
11112
- return adapter;
11113
- }
11114
- var defaults = {
11115
- adapter: getDefaultAdapter(),
11116
- transformRequest: [function transformRequest(data, headers) {
11117
- normalizeHeaderName(headers, 'Accept');
11118
- normalizeHeaderName(headers, 'Content-Type');
11119
- if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {
11120
- return data;
11121
- }
11122
- if (utils.isArrayBufferView(data)) {
11123
- return data.buffer;
11124
- }
11125
- if (utils.isURLSearchParams(data)) {
11126
- setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
11127
- return data.toString();
11128
- }
11129
- if (utils.isObject(data)) {
11130
- setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
11131
- return JSON.stringify(data);
11132
- }
11133
- return data;
11134
- }],
11135
- transformResponse: [function transformResponse(data) {
11136
- if (typeof data === 'string') {
11137
- try {
11138
- data = JSON.parse(data);
11139
- } catch (e) {}
11140
- }
11141
- return data;
11142
- }],
11143
- timeout: 0,
11144
- xsrfCookieName: 'XSRF-TOKEN',
11145
- xsrfHeaderName: 'X-XSRF-TOKEN',
11146
- maxContentLength: -1,
11147
- maxBodyLength: -1,
11148
- validateStatus: function validateStatus(status) {
11149
- return status >= 200 && status < 300;
11150
- }
11151
- };
11152
- defaults.headers = {
11153
- common: {
11154
- 'Accept': 'application/json, text/plain, */*'
11155
- }
11156
- };
11157
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
11158
- defaults.headers[method] = {};
11159
- });
11160
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
11161
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
11162
- });
11163
- var defaults_1 = defaults;
11164
-
11165
- function throwIfCancellationRequested(config) {
11166
- if (config.cancelToken) {
11167
- config.cancelToken.throwIfRequested();
11168
- }
11169
- }
11170
- var dispatchRequest = function dispatchRequest(config) {
11171
- throwIfCancellationRequested(config);
11172
- config.headers = config.headers || {};
11173
- config.data = transformData(config.data, config.headers, config.transformRequest);
11174
- config.headers = utils.merge(config.headers.common || {}, config.headers[config.method] || {}, config.headers);
11175
- utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function cleanHeaderConfig(method) {
11176
- delete config.headers[method];
11177
- });
11178
- var adapter = config.adapter || defaults_1.adapter;
11179
- return adapter(config).then(function onAdapterResolution(response) {
11180
- throwIfCancellationRequested(config);
11181
- response.data = transformData(response.data, response.headers, config.transformResponse);
11182
- return response;
11183
- }, function onAdapterRejection(reason) {
11184
- if (!isCancel(reason)) {
11185
- throwIfCancellationRequested(config);
11186
- if (reason && reason.response) {
11187
- reason.response.data = transformData(reason.response.data, reason.response.headers, config.transformResponse);
11188
- }
11189
- }
11190
- return Promise.reject(reason);
11191
- });
11192
- };
11193
-
11194
- var mergeConfig = function mergeConfig(config1, config2) {
11195
- config2 = config2 || {};
11196
- var config = {};
11197
- var valueFromConfig2Keys = ['url', 'method', 'data'];
11198
- var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
11199
- 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'];
11200
- var directMergeKeys = ['validateStatus'];
11201
- function getMergedValue(target, source) {
11202
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
11203
- return utils.merge(target, source);
11204
- } else if (utils.isPlainObject(source)) {
11205
- return utils.merge({}, source);
11206
- } else if (utils.isArray(source)) {
11207
- return source.slice();
11208
- }
11209
- return source;
11210
- }
11211
- function mergeDeepProperties(prop) {
11212
- if (!utils.isUndefined(config2[prop])) {
11213
- config[prop] = getMergedValue(config1[prop], config2[prop]);
11214
- } else if (!utils.isUndefined(config1[prop])) {
11215
- config[prop] = getMergedValue(undefined, config1[prop]);
11216
- }
11217
- }
11218
- utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
11219
- if (!utils.isUndefined(config2[prop])) {
11220
- config[prop] = getMergedValue(undefined, config2[prop]);
11221
- }
11222
- });
11223
- utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
11224
- utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
11225
- if (!utils.isUndefined(config2[prop])) {
11226
- config[prop] = getMergedValue(undefined, config2[prop]);
11227
- } else if (!utils.isUndefined(config1[prop])) {
11228
- config[prop] = getMergedValue(undefined, config1[prop]);
11229
- }
11230
- });
11231
- utils.forEach(directMergeKeys, function merge(prop) {
11232
- if (prop in config2) {
11233
- config[prop] = getMergedValue(config1[prop], config2[prop]);
11234
- } else if (prop in config1) {
11235
- config[prop] = getMergedValue(undefined, config1[prop]);
11236
- }
11237
- });
11238
- var axiosKeys = valueFromConfig2Keys.concat(mergeDeepPropertiesKeys).concat(defaultToConfig2Keys).concat(directMergeKeys);
11239
- var otherKeys = Object.keys(config1).concat(Object.keys(config2)).filter(function filterAxiosKeys(key) {
11240
- return axiosKeys.indexOf(key) === -1;
11241
- });
11242
- utils.forEach(otherKeys, mergeDeepProperties);
11243
- return config;
11244
- };
11245
-
11246
- function Axios(instanceConfig) {
11247
- this.defaults = instanceConfig;
11248
- this.interceptors = {
11249
- request: new InterceptorManager_1(),
11250
- response: new InterceptorManager_1()
11251
- };
11252
- }
11253
- Axios.prototype.request = function request(config) {
11254
- if (typeof config === 'string') {
11255
- config = arguments[1] || {};
11256
- config.url = arguments[0];
11257
- } else {
11258
- config = config || {};
11259
- }
11260
- config = mergeConfig(this.defaults, config);
11261
- if (config.method) {
11262
- config.method = config.method.toLowerCase();
11263
- } else if (this.defaults.method) {
11264
- config.method = this.defaults.method.toLowerCase();
11265
- } else {
11266
- config.method = 'get';
11267
- }
11268
- var chain = [dispatchRequest, undefined];
11269
- var promise = Promise.resolve(config);
11270
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
11271
- chain.unshift(interceptor.fulfilled, interceptor.rejected);
11272
- });
11273
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
11274
- chain.push(interceptor.fulfilled, interceptor.rejected);
11275
- });
11276
- while (chain.length) {
11277
- promise = promise.then(chain.shift(), chain.shift());
11278
- }
11279
- return promise;
11280
- };
11281
- Axios.prototype.getUri = function getUri(config) {
11282
- config = mergeConfig(this.defaults, config);
11283
- return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
11284
- };
11285
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
11286
- Axios.prototype[method] = function (url, config) {
11287
- return this.request(mergeConfig(config || {}, {
11288
- method: method,
11289
- url: url,
11290
- data: (config || {}).data
11291
- }));
11292
- };
11293
- });
11294
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
11295
- Axios.prototype[method] = function (url, data, config) {
11296
- return this.request(mergeConfig(config || {}, {
11297
- method: method,
11298
- url: url,
11299
- data: data
11300
- }));
11301
- };
11302
- });
11303
- var Axios_1 = Axios;
11304
-
11305
- function Cancel(message) {
11306
- this.message = message;
11307
- }
11308
- Cancel.prototype.toString = function toString() {
11309
- return 'Cancel' + (this.message ? ': ' + this.message : '');
11310
- };
11311
- Cancel.prototype.__CANCEL__ = true;
11312
- var Cancel_1 = Cancel;
11313
-
11314
- function CancelToken(executor) {
11315
- if (typeof executor !== 'function') {
11316
- throw new TypeError('executor must be a function.');
11317
- }
11318
- var resolvePromise;
11319
- this.promise = new Promise(function promiseExecutor(resolve) {
11320
- resolvePromise = resolve;
11321
- });
11322
- var token = this;
11323
- executor(function cancel(message) {
11324
- if (token.reason) {
11325
- return;
11326
- }
11327
- token.reason = new Cancel_1(message);
11328
- resolvePromise(token.reason);
11329
- });
11330
- }
11331
- CancelToken.prototype.throwIfRequested = function throwIfRequested() {
11332
- if (this.reason) {
11333
- throw this.reason;
11334
- }
11335
- };
11336
- CancelToken.source = function source() {
11337
- var cancel;
11338
- var token = new CancelToken(function executor(c) {
11339
- cancel = c;
11340
- });
11341
- return {
11342
- token: token,
11343
- cancel: cancel
11344
- };
11345
- };
11346
- var CancelToken_1 = CancelToken;
11347
-
11348
- var spread = function spread(callback) {
11349
- return function wrap(arr) {
11350
- return callback.apply(null, arr);
11351
- };
11352
- };
11353
-
11354
- var isAxiosError = function isAxiosError(payload) {
11355
- return typeof payload === 'object' && payload.isAxiosError === true;
11356
- };
11357
-
11358
- function createInstance(defaultConfig) {
11359
- var context = new Axios_1(defaultConfig);
11360
- var instance = bind(Axios_1.prototype.request, context);
11361
- utils.extend(instance, Axios_1.prototype, context);
11362
- utils.extend(instance, context);
11363
- return instance;
11364
- }
11365
- var axios = createInstance(defaults_1);
11366
- axios.Axios = Axios_1;
11367
- axios.create = function create(instanceConfig) {
11368
- return createInstance(mergeConfig(axios.defaults, instanceConfig));
11369
- };
11370
- axios.Cancel = Cancel_1;
11371
- axios.CancelToken = CancelToken_1;
11372
- axios.isCancel = isCancel;
11373
- axios.all = function all(promises) {
11374
- return Promise.all(promises);
11375
- };
11376
- axios.spread = spread;
11377
- axios.isAxiosError = isAxiosError;
11378
- var axios_1 = axios;
11379
- var _default = axios;
11380
- axios_1.default = _default;
11381
-
11382
10716
  const MyChallanResult = ({
11383
10717
  template,
11384
10718
  header,
@@ -11391,10 +10725,9 @@ const MyChallanResult = ({
11391
10725
  const userInfo = Digit.UserService.getUser();
11392
10726
  const tenantId = localStorage.getItem("CITIZEN.CITY");
11393
10727
  const [loader, setLoader] = useState(false);
11394
- const [getChallanData, setChallanData] = useState();
10728
+ const [getChallanData, setChallanData] = useState([]);
11395
10729
  const [filters, setFilters] = useState(null);
11396
10730
  const [getCount, setCount] = useState();
11397
- console.log("userInfo", userInfo);
11398
10731
  let filter = window.location.href.split("/").pop();
11399
10732
  let t1;
11400
10733
  let off;
@@ -11421,28 +10754,24 @@ const MyChallanResult = ({
11421
10754
  setFilters(initialFilters);
11422
10755
  }, [filter, tenantId]);
11423
10756
  const fetchChallans = async () => {
11424
- console.log("filters", filters);
11425
10757
  setLoader(true);
11426
10758
  try {
11427
10759
  const responseData = await Digit.GCService.search({
11428
10760
  tenantId,
11429
10761
  filters
11430
10762
  });
11431
- console.log("result", responseData);
11432
10763
  setCount(responseData === null || responseData === void 0 ? void 0 : responseData.TotalCount);
11433
10764
  setChallanData(responseData === null || responseData === void 0 ? void 0 : responseData.GarbageConnection);
11434
10765
  setLoader(false);
11435
10766
  } catch (error) {
11436
- console.log("error", error);
11437
10767
  setLoader(false);
11438
10768
  }
11439
10769
  };
11440
10770
  useEffect(() => {
11441
- console.log("filters", filters);
11442
10771
  if (filters) fetchChallans();
11443
10772
  }, [filters]);
11444
10773
  const handleMakePayment = id => {
11445
- history.push(`/digit-ui/citizen/payment/collect/Challan_Generation/${id}/${tenantId}?tenantId=${tenantId}`);
10774
+ history.push(`/digit-ui/citizen/payment/collect/GC.ONE_TIME_FEE/${id}/${tenantId}?tenantId=${tenantId}`);
11446
10775
  };
11447
10776
  const handleLoadMore = () => {
11448
10777
  setFilters(prev => ({
@@ -11450,6 +10779,58 @@ const MyChallanResult = ({
11450
10779
  limit: Number(prev.limit) + 5
11451
10780
  }));
11452
10781
  };
10782
+ const handleDiscontinue = async data => {
10783
+ console.log("data", data);
10784
+ setLoader(true);
10785
+ const payload = {
10786
+ GarbageConnection: {
10787
+ ...data,
10788
+ applicationType: "DISCONNECT_GARBAGE_CONNECTION",
10789
+ processInstance: {
10790
+ ...(data === null || data === void 0 ? void 0 : data.processInstance),
10791
+ action: "INITIATE"
10792
+ }
10793
+ },
10794
+ disconnectRequest: true
10795
+ };
10796
+ console.log("payload===", payload);
10797
+ try {
10798
+ const response = await Digit.GCService.create(payload);
10799
+ console.log("response", response);
10800
+ updateApplication(response === null || response === void 0 ? void 0 : response.GarbageConnection[0]);
10801
+ } catch (error) {
10802
+ setLoader(false);
10803
+ }
10804
+ };
10805
+ const updateApplication = async response => {
10806
+ console.log("uddated response", response);
10807
+ const payload = {
10808
+ GarbageConnection: {
10809
+ ...response,
10810
+ processInstance: {
10811
+ ...(response === null || response === void 0 ? void 0 : response.processInstance),
10812
+ action: "SUBMIT_APPLICATION"
10813
+ }
10814
+ }
10815
+ };
10816
+ console.log("payload===", payload);
10817
+ try {
10818
+ const _response = await Digit.GCService.update(payload);
10819
+ console.log("response", _response);
10820
+ await fetchChallans();
10821
+ } catch (error) {
10822
+ setLoader(false);
10823
+ }
10824
+ };
10825
+ const connectionCountMap = useMemo(() => {
10826
+ const map = {};
10827
+ getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.forEach(item => {
10828
+ if (item !== null && item !== void 0 && item.connectionNo) {
10829
+ map[item.connectionNo] = (map[item.connectionNo] || 0) + 1;
10830
+ }
10831
+ });
10832
+ return map;
10833
+ }, [getChallanData]);
11453
10834
  return /*#__PURE__*/React.createElement("div", {
11454
10835
  style: {
11455
10836
  marginTop: "16px"
@@ -11459,6 +10840,9 @@ const MyChallanResult = ({
11459
10840
  marginLeft: "8px"
11460
10841
  }
11461
10842
  }, t(header), " (", getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.length, ")"), getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.map((bill, index) => {
10843
+ const connectionCount = connectionCountMap[bill === null || bill === void 0 ? void 0 : bill.connectionNo] || 0;
10844
+ console.log("bill", bill);
10845
+ const showDiscontinueButton = bill.applicationStatus === "CONNECTION_ACTIVATED" && connectionCount === 1;
11462
10846
  return /*#__PURE__*/React.createElement(Card, {
11463
10847
  key: index
11464
10848
  }, /*#__PURE__*/React.createElement(KeyNote, {
@@ -11479,9 +10863,21 @@ const MyChallanResult = ({
11479
10863
  to: `/digit-ui/citizen/garbagecollection/application/${bill === null || bill === void 0 ? void 0 : bill.applicationNo}/${bill === null || bill === void 0 ? void 0 : bill.tenantId}`
11480
10864
  }, /*#__PURE__*/React.createElement(SubmitBar, {
11481
10865
  label: t("CS_VIEW_DETAILS")
11482
- })), bill.applicationStatus == "ACTIVE" && /*#__PURE__*/React.createElement(SubmitBar, {
10866
+ })), (bill.applicationStatus == "PENDING_FOR_CITIZEN_ACTION" || bill.applicationStatus == "INITIATED") && /*#__PURE__*/React.createElement(SubmitBar, {
10867
+ label: t("WF_GC_EDIT"),
10868
+ onSubmit: () => {
10869
+ history.push(`/digit-ui/citizen/garbagecollection/create-application/${bill === null || bill === void 0 ? void 0 : bill.applicationNo}`);
10870
+ }
10871
+ }), showDiscontinueButton && /*#__PURE__*/React.createElement(SubmitBar, {
10872
+ style: {
10873
+ width: "200px"
10874
+ },
10875
+ label: t("GC_DISCONTINUE_SERVICE"),
10876
+ onSubmit: () => handleDiscontinue(bill),
10877
+ disabled: loader
10878
+ }), bill.applicationStatus == "PENDING_FOR_PAYMENT" && /*#__PURE__*/React.createElement(SubmitBar, {
11483
10879
  label: t("CS_APPLICATION_DETAILS_MAKE_PAYMENT"),
11484
- onSubmit: () => handleMakePayment(bill === null || bill === void 0 ? void 0 : bill.challanNo)
10880
+ onSubmit: () => handleMakePayment(bill === null || bill === void 0 ? void 0 : bill.applicationNo)
11485
10881
  })));
11486
10882
  }), (getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.length) === 0 && !loader && /*#__PURE__*/React.createElement("p", {
11487
10883
  style: {
@@ -11595,24 +10991,24 @@ function baseGetTag(value) {
11595
10991
  }
11596
10992
  var _baseGetTag = baseGetTag;
11597
10993
 
11598
- function isObject$1(value) {
10994
+ function isObject(value) {
11599
10995
  var type = typeof value;
11600
10996
  return value != null && (type == 'object' || type == 'function');
11601
10997
  }
11602
- var isObject_1 = isObject$1;
10998
+ var isObject_1 = isObject;
11603
10999
 
11604
11000
  var asyncTag = '[object AsyncFunction]',
11605
11001
  funcTag = '[object Function]',
11606
11002
  genTag = '[object GeneratorFunction]',
11607
11003
  proxyTag = '[object Proxy]';
11608
- function isFunction$1(value) {
11004
+ function isFunction(value) {
11609
11005
  if (!isObject_1(value)) {
11610
11006
  return false;
11611
11007
  }
11612
11008
  var tag = _baseGetTag(value);
11613
11009
  return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
11614
11010
  }
11615
- var isFunction_1 = isFunction$1;
11011
+ var isFunction_1 = isFunction;
11616
11012
 
11617
11013
  var coreJsData = _root['__core-js_shared__'];
11618
11014
  var _coreJsData = coreJsData;
@@ -12001,7 +11397,7 @@ const ChallanApplicationDetails = () => {
12001
11397
  useEffect(() => {
12002
11398
  if (acknowledgementIds) {
12003
11399
  const filters = {};
12004
- filters.acknowledgementIds = acknowledgementIds;
11400
+ filters.applicationNumber = acknowledgementIds;
12005
11401
  fetchChallans(filters);
12006
11402
  }
12007
11403
  }, [acknowledgementIds]);
@@ -12173,7 +11569,7 @@ const ChallanApplicationDetails = () => {
12173
11569
  text: t(getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.applicationNo) || t("CS_NA")
12174
11570
  }), /*#__PURE__*/React.createElement(Row, {
12175
11571
  className: "border-none",
12176
- label: t("reports.mcollect.status"),
11572
+ label: t("ACTION_TEST_APPLICATION_STATUS"),
12177
11573
  text: t(getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.applicationStatus) || t("CS_NA")
12178
11574
  }), /*#__PURE__*/React.createElement(Row, {
12179
11575
  className: "border-none",
@@ -12318,13 +11714,10 @@ const GCResponseCitizen = props => {
12318
11714
  setChbPermissionLoading(false);
12319
11715
  }
12320
11716
  };
12321
- const handlePayment = () => {
12322
- history.push(`/digit-ui/employee/payment/collect/Challan_Generation/${applicationNumber}/${tenantId}?tenantId=${tenantId}`);
12323
- };
12324
11717
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Banner, {
12325
11718
  message: t("GC_APPLICATION_CREATED"),
12326
11719
  applicationNumber: applicationNumber,
12327
- info: (nocData === null || nocData === void 0 ? void 0 : nocData.applicationStatus) == "REJECTED" ? "" : t(`CHALLAN_NUMBER`),
11720
+ info: (nocData === null || nocData === void 0 ? void 0 : nocData.applicationStatus) == "REJECTED" ? "" : t(`APPLICATION_NUMBER`),
12328
11721
  successful: (nocData === null || nocData === void 0 ? void 0 : nocData.applicationStatus) == "REJECTED" ? false : true,
12329
11722
  style: {
12330
11723
  padding: "10px"
@@ -12356,9 +11749,6 @@ const GCResponseCitizen = props => {
12356
11749
  }, /*#__PURE__*/React.createElement(SubmitBar, {
12357
11750
  label: t("CORE_COMMON_GO_TO_HOME"),
12358
11751
  onSubmit: onSubmit
12359
- }), /*#__PURE__*/React.createElement(SubmitBar, {
12360
- label: t("CS_APPLICATION_DETAILS_MAKE_PAYMENT"),
12361
- onSubmit: handlePayment
12362
11752
  }))), showToast && /*#__PURE__*/React.createElement(Toast, {
12363
11753
  error: error,
12364
11754
  label: getLable,
@@ -12381,8 +11771,9 @@ const ModalConfig = ({
12381
11771
  businessService
12382
11772
  }) => {
12383
11773
  console.log("action=====", action);
11774
+ console.log("uploadedFile=====", uploadedFile);
12384
11775
  let checkCondtions = true;
12385
- 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;
11776
+ 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;
12386
11777
  if (action.isTerminateState) checkCondtions = false;
12387
11778
  console.log("action=====", action.action);
12388
11779
  return {
@@ -12458,13 +11849,19 @@ const NDCModal = ({
12458
11849
  errorOne,
12459
11850
  closeToastOne,
12460
11851
  getEmployees,
12461
- tenantId
11852
+ tenantId,
11853
+ businessService,
11854
+ loader,
11855
+ setLoader
12462
11856
  }) => {
12463
11857
  const [config, setConfig] = useState({});
12464
11858
  const [getAmount, setAmount] = useState();
12465
11859
  const [approvers, setApprovers] = useState([]);
11860
+ const [selectedApprover, setSelectedApprover] = useState({});
11861
+ const [file, setFile] = useState(null);
11862
+ const [uploadedFile, setUploadedFile] = useState(null);
11863
+ const [error, setError] = useState(null);
12466
11864
  const allRolesNew = [...new Set(getEmployees === null || getEmployees === void 0 ? void 0 : getEmployees.flatMap(a => a.roles))];
12467
- console.log("allRolesNew", allRolesNew);
12468
11865
  const {
12469
11866
  data: approverData,
12470
11867
  isLoading: PTALoading
@@ -12496,11 +11893,53 @@ const NDCModal = ({
12496
11893
  }));
12497
11894
  }
12498
11895
  }, [approverData]);
11896
+ function selectFile(e) {
11897
+ setFile(e.target.files[0]);
11898
+ }
11899
+ useEffect(() => {
11900
+ (async () => {
11901
+ setError(null);
11902
+ if (file) {
11903
+ if (file.size >= 5242880) {
11904
+ setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
11905
+ } else {
11906
+ setLoader(true);
11907
+ try {
11908
+ var _response$data, _response$data$files;
11909
+ const response = await Digit.UploadServices.Filestorage("PT", file, Digit.ULBService.getStateId());
11910
+ 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) {
11911
+ var _response$data2, _response$data2$files;
11912
+ 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);
11913
+ } else {
11914
+ setError(t("CS_FILE_UPLOAD_ERROR"));
11915
+ }
11916
+ setLoader(false);
11917
+ } catch (err) {
11918
+ setLoader(false);
11919
+ setError(t("CS_FILE_UPLOAD_ERROR"));
11920
+ }
11921
+ }
11922
+ }
11923
+ })();
11924
+ }, [file]);
12499
11925
  function submit(data) {
11926
+ console.log("data", data);
11927
+ console.log("selectedApprover", selectedApprover);
12500
11928
  const payload = {
12501
- amount: getAmount
11929
+ action: action === null || action === void 0 ? void 0 : action.action,
11930
+ comment: data === null || data === void 0 ? void 0 : data.comments,
11931
+ assignes: !(selectedApprover !== null && selectedApprover !== void 0 && selectedApprover.uuid) ? null : [{
11932
+ uuid: selectedApprover === null || selectedApprover === void 0 ? void 0 : selectedApprover.uuid
11933
+ }],
11934
+ documents: uploadedFile ? [{
11935
+ documentType: file === null || file === void 0 ? void 0 : file.type,
11936
+ documentUid: file === null || file === void 0 ? void 0 : file.name,
11937
+ fileStoreId: uploadedFile
11938
+ }] : null
12502
11939
  };
12503
- submitAction(payload);
11940
+ submitAction({
11941
+ Licenses: [payload]
11942
+ });
12504
11943
  }
12505
11944
  useEffect(() => {
12506
11945
  if (action) {
@@ -12508,10 +11947,16 @@ const NDCModal = ({
12508
11947
  t,
12509
11948
  action,
12510
11949
  setAmount,
12511
- approvers
11950
+ approvers,
11951
+ selectedApprover,
11952
+ setSelectedApprover,
11953
+ uploadedFile,
11954
+ selectFile,
11955
+ setUploadedFile,
11956
+ businessService
12512
11957
  }));
12513
11958
  }
12514
- }, [action, approvers]);
11959
+ }, [action, approvers, selectedApprover, uploadedFile]);
12515
11960
  if (!action || !config.form) return null;
12516
11961
  return /*#__PURE__*/React.createElement(Modal, {
12517
11962
  headerBarMain: /*#__PURE__*/React.createElement(Heading, {
@@ -12537,7 +11982,7 @@ const NDCModal = ({
12537
11982
  label: errorOne,
12538
11983
  isDleteBtn: true,
12539
11984
  onClose: closeToastOne
12540
- }), PTALoading && /*#__PURE__*/React.createElement(Loader, {
11985
+ }), (PTALoading || loader) && /*#__PURE__*/React.createElement(Loader, {
12541
11986
  page: true
12542
11987
  }));
12543
11988
  };
@@ -12584,6 +12029,7 @@ const ChallanApplicationDetails$1 = () => {
12584
12029
  const {
12585
12030
  t
12586
12031
  } = useTranslation();
12032
+ const history = useHistory();
12587
12033
  const {
12588
12034
  acknowledgementIds,
12589
12035
  id
@@ -12591,14 +12037,8 @@ const ChallanApplicationDetails$1 = () => {
12591
12037
  const [showToast, setShowToast] = useState(false);
12592
12038
  const [getLable, setLable] = useState(false);
12593
12039
  const tenantId = window.location.href.includes("citizen") ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
12594
- const [showOptions, setShowOptions] = useState(false);
12595
- const {
12596
- data: storeData
12597
- } = Digit.Hooks.useStore.getInitData();
12598
12040
  const [loader, setLoader] = useState(false);
12599
12041
  const [getChallanData, setChallanData] = useState();
12600
- const [chbPermissionLoading, setChbPermissionLoading] = useState(false);
12601
- const [printing, setPrinting] = useState(false);
12602
12042
  const [error, setError] = useState("");
12603
12043
  const [getWorkflowService, setWorkflowService] = useState([]);
12604
12044
  const [displayMenu, setDisplayMenu] = useState(false);
@@ -12608,7 +12048,6 @@ const ChallanApplicationDetails$1 = () => {
12608
12048
  const [getEmployees, setEmployees] = useState([]);
12609
12049
  const [errorOne, setErrorOne] = useState(null);
12610
12050
  const menuRef = useRef();
12611
- console.log("acknowledgementIds", acknowledgementIds, id);
12612
12051
  const fetchChallans = async filters => {
12613
12052
  setLoader(true);
12614
12053
  try {
@@ -12617,15 +12056,12 @@ const ChallanApplicationDetails$1 = () => {
12617
12056
  tenantId,
12618
12057
  filters
12619
12058
  });
12620
- console.log("search ", responseData);
12621
12059
  setChallanData(responseData === null || responseData === void 0 ? void 0 : (_responseData$Garbage = responseData.GarbageConnection) === null || _responseData$Garbage === void 0 ? void 0 : _responseData$Garbage[0]);
12622
12060
  setLoader(false);
12623
12061
  } catch (error) {
12624
- console.log("error", error);
12625
12062
  setLoader(false);
12626
12063
  }
12627
12064
  };
12628
- let challanEmpData = ChallanData(tenantId, id);
12629
12065
  useEffect(() => {
12630
12066
  if (id) {
12631
12067
  const filters = {};
@@ -12649,7 +12085,10 @@ const ChallanApplicationDetails$1 = () => {
12649
12085
  const closeToast = () => {
12650
12086
  setShowToast(null);
12651
12087
  };
12652
- console.log("workflowDetails", workflowDetails);
12088
+ const closeMenu = () => {
12089
+ setDisplayMenu(false);
12090
+ };
12091
+ Digit.Hooks.useClickOutside(menuRef, closeMenu, displayMenu);
12653
12092
  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)];
12654
12093
  if (workflowDetails && workflowDetails.data && !workflowDetails.isLoading) {
12655
12094
  var _workflowDetails$data4, _workflowDetails$data5;
@@ -12678,27 +12117,59 @@ const ChallanApplicationDetails$1 = () => {
12678
12117
  (async (_WorkflowService, _WorkflowService$Busi, _WorkflowService$Busi2) => {
12679
12118
  setLoader(true);
12680
12119
  WorkflowService = await Digit.WorkflowService.init(tenantId, "NewGC");
12681
- console.log("WorkflowService===", WorkflowService);
12682
12120
  setLoader(false);
12683
12121
  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);
12684
12122
  })();
12685
12123
  }, [tenantId]);
12686
12124
  function onActionSelect(action) {
12687
12125
  var _action$state, _action$state$actions, _filterRoles$;
12688
- console.log("action", action);
12126
+ if ((action === null || action === void 0 ? void 0 : action.action) == "PAY") {
12127
+ history.push(`/digit-ui/employee/payment/collect/GC.ONE_TIME_FEE/${id}/${tenantId}?tenantId=${tenantId}`);
12128
+ }
12689
12129
  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));
12690
12130
  const filterRoles = getWorkflowService === null || getWorkflowService === void 0 ? void 0 : getWorkflowService.filter(item => {
12691
12131
  var _filterNexState$;
12692
12132
  return (item === null || item === void 0 ? void 0 : item.uuid) == ((_filterNexState$ = filterNexState[0]) === null || _filterNexState$ === void 0 ? void 0 : _filterNexState$.nextState);
12693
12133
  });
12694
- console.log("filterRoles", filterRoles);
12695
12134
  setEmployees(filterRoles === null || filterRoles === void 0 ? void 0 : (_filterRoles$ = filterRoles[0]) === null || _filterRoles$ === void 0 ? void 0 : _filterRoles$.actions);
12696
12135
  setShowModal(true);
12697
12136
  setSelectedAction(action);
12698
12137
  }
12699
12138
  const submitAction = async modalData => {
12700
- console.log("modalData", modalData);
12701
- return;
12139
+ const action = modalData === null || modalData === void 0 ? void 0 : modalData.Licenses[0];
12140
+ 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") {
12141
+ setErrorOne("Assignee is Mandatory");
12142
+ setShowErrorToastt(true);
12143
+ return;
12144
+ } else if (!(action !== null && action !== void 0 && action.comment)) {
12145
+ setErrorOne("Comment is Mandatory");
12146
+ setShowErrorToastt(true);
12147
+ return;
12148
+ }
12149
+ setLoader(true);
12150
+ const payload = {
12151
+ GarbageConnection: {
12152
+ ...getChallanData,
12153
+ processInstance: {
12154
+ ...(getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.processInstance),
12155
+ ...(modalData === null || modalData === void 0 ? void 0 : modalData.Licenses[0])
12156
+ }
12157
+ }
12158
+ };
12159
+ try {
12160
+ const response = await Digit.GCService.update(payload);
12161
+ setLoader(false);
12162
+ setShowModal(false);
12163
+ setLable("Status is Updated");
12164
+ setError(false);
12165
+ setShowToast(true);
12166
+ setTimeout(() => {
12167
+ history.push("/digit-ui/employee/garbagecollection/inbox");
12168
+ window.location.reload();
12169
+ }, 2000);
12170
+ } catch (error) {
12171
+ setLoader(false);
12172
+ }
12702
12173
  };
12703
12174
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(CardSubHeader, {
12704
12175
  style: {
@@ -12726,7 +12197,7 @@ const ChallanApplicationDetails$1 = () => {
12726
12197
  text: t(getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.applicationNo) || t("CS_NA")
12727
12198
  }), /*#__PURE__*/React.createElement(Row, {
12728
12199
  className: "border-none",
12729
- label: t("reports.mcollect.status"),
12200
+ label: t("ACTION_TEST_APPLICATION_STATUS"),
12730
12201
  text: t(getChallanData === null || getChallanData === void 0 ? void 0 : getChallanData.applicationStatus) || t("CS_NA")
12731
12202
  }), /*#__PURE__*/React.createElement(Row, {
12732
12203
  className: "border-none",
@@ -12809,7 +12280,9 @@ const ChallanApplicationDetails$1 = () => {
12809
12280
  errorOne: errorOne,
12810
12281
  closeToastOne: closeToastOne,
12811
12282
  getLable: getLable,
12812
- getChallanData: getChallanData
12283
+ getChallanData: getChallanData,
12284
+ loader: loader,
12285
+ setLoader: setLoader
12813
12286
  }) : null, showToast && /*#__PURE__*/React.createElement(Toast, {
12814
12287
  isDleteBtn: true,
12815
12288
  error: error,