@salesgenterp/ui-components 0.4.551 → 0.4.553

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2835,6 +2835,300 @@ var InfoContainer = styled__default.div(_templateObject$9 || (_templateObject$9
2835
2835
  return props.fontColor;
2836
2836
  });
2837
2837
 
2838
+ var AsyncDataLoad = function AsyncDataLoad(_ref) {
2839
+ var apiEndPoint = _ref.apiEndPoint,
2840
+ token = _ref.token,
2841
+ children = _ref.children,
2842
+ onError = _ref.onError,
2843
+ skeletonHeight = _ref.skeletonHeight,
2844
+ loadingView = _ref.loadingView,
2845
+ errorView = _ref.errorView,
2846
+ asyncService = _ref.asyncService,
2847
+ triggerChange = _ref.triggerChange,
2848
+ apiConfig = _ref.apiConfig;
2849
+ var _useState = React.useState({
2850
+ status: 'loading',
2851
+ data: {}
2852
+ }),
2853
+ apiState = _useState[0],
2854
+ setApiState = _useState[1];
2855
+ var getAPIData = function getAPIData() {
2856
+ try {
2857
+ var _temp3 = _catch(function () {
2858
+ function _temp2() {
2859
+ setApiState({
2860
+ status: API_STATUSES.SUCCESS,
2861
+ data: data
2862
+ });
2863
+ }
2864
+ setApiState({
2865
+ status: API_STATUSES.LOADING,
2866
+ data: {}
2867
+ });
2868
+ var data;
2869
+ var _temp = function () {
2870
+ if (asyncService) {
2871
+ return Promise.resolve(asyncService()).then(function (_asyncService) {
2872
+ data = _asyncService;
2873
+ });
2874
+ } else {
2875
+ return Promise.resolve(API(_extends({
2876
+ apiEndPoint: apiEndPoint,
2877
+ token: token,
2878
+ hideErrorMessage: true
2879
+ }, apiConfig))).then(function (_API) {
2880
+ data = _API;
2881
+ });
2882
+ }
2883
+ }();
2884
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
2885
+ }, function (e) {
2886
+ setApiState({
2887
+ status: API_STATUSES.ERROR,
2888
+ data: {}
2889
+ });
2890
+ if (onError) {
2891
+ onError(e);
2892
+ }
2893
+ });
2894
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
2895
+ } catch (e) {
2896
+ return Promise.reject(e);
2897
+ }
2898
+ };
2899
+ React.useEffect(function () {
2900
+ if (apiConfig || asyncService) {
2901
+ (function () {
2902
+ return getAPIData();
2903
+ })();
2904
+ }
2905
+ }, [apiConfig, triggerChange]);
2906
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, apiState.status === API_STATUSES.LOADING ? loadingView ? loadingView : /*#__PURE__*/React__default.createElement(Loader, {
2907
+ skeleton: skeletonHeight,
2908
+ height: skeletonHeight
2909
+ }) : null, apiState.status === API_STATUSES.SUCCESS ? typeof children === 'function' ? children(apiState.data) : {
2910
+ children: children
2911
+ } : null, apiState.status === API_STATUSES.ERROR ? errorView ? errorView : 'NO DATA' : null);
2912
+ };
2913
+ var AsyncDataLoadComponent = React.memo(AsyncDataLoad);
2914
+
2915
+ var getUpcomingAchPayments = function getUpcomingAchPayments(_ref) {
2916
+ var apiEndPoint = _ref.apiEndPoint,
2917
+ token = _ref.token;
2918
+ try {
2919
+ return Promise.resolve(API({
2920
+ url: '/ecommerce/order/payment/upcoming-auto-ach',
2921
+ apiEndPoint: apiEndPoint,
2922
+ token: token
2923
+ }));
2924
+ } catch (e) {
2925
+ return Promise.reject(e);
2926
+ }
2927
+ };
2928
+ var saveExcessPayment = function saveExcessPayment(_ref2) {
2929
+ var apiEndPoint = _ref2.apiEndPoint,
2930
+ token = _ref2.token,
2931
+ payload = _ref2.payload;
2932
+ try {
2933
+ return Promise.resolve(API({
2934
+ url: '/ecommerce/order/payment/excess',
2935
+ apiEndPoint: apiEndPoint,
2936
+ token: token,
2937
+ method: 'POST',
2938
+ body: payload
2939
+ }));
2940
+ } catch (e) {
2941
+ return Promise.reject(e);
2942
+ }
2943
+ };
2944
+
2945
+ var ExcessPaymentForm = function ExcessPaymentForm(_ref) {
2946
+ var paymentMethods = _ref.paymentMethods,
2947
+ control = _ref.control,
2948
+ styles = _ref.styles,
2949
+ handleSubmit = _ref.handleSubmit,
2950
+ onSubmit = _ref.onSubmit,
2951
+ onClose = _ref.onClose,
2952
+ loading = _ref.loading;
2953
+ return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("form", null, /*#__PURE__*/React__default.createElement(material.Grid, {
2954
+ container: true,
2955
+ spacing: 2
2956
+ }, /*#__PURE__*/React__default.createElement(material.Grid, {
2957
+ item: true,
2958
+ xs: 12
2959
+ }, /*#__PURE__*/React__default.createElement(FormSelect, {
2960
+ label: "Payment Method",
2961
+ name: "paymentModeId",
2962
+ required: true,
2963
+ control: control,
2964
+ options: paymentMethods,
2965
+ valueKey: "id",
2966
+ labelKey: "name",
2967
+ placeholder: "Select Payment Mode",
2968
+ fontColor: styles === null || styles === void 0 ? void 0 : styles.fontColor
2969
+ })), /*#__PURE__*/React__default.createElement(material.Grid, {
2970
+ item: true,
2971
+ xs: 12
2972
+ }, /*#__PURE__*/React__default.createElement(FormTextField, {
2973
+ label: "Excess Amount",
2974
+ name: "excessAmount",
2975
+ type: "number",
2976
+ required: true,
2977
+ control: control,
2978
+ fontColor: styles === null || styles === void 0 ? void 0 : styles.fontColor
2979
+ })), /*#__PURE__*/React__default.createElement(material.Grid, {
2980
+ item: true,
2981
+ xs: 12
2982
+ }, /*#__PURE__*/React__default.createElement(FormTextField, {
2983
+ label: "Transaction Id",
2984
+ name: "transactionId",
2985
+ control: control,
2986
+ fontColor: styles === null || styles === void 0 ? void 0 : styles.fontColor
2987
+ })), /*#__PURE__*/React__default.createElement(material.Grid, {
2988
+ item: true,
2989
+ xs: 12
2990
+ }, /*#__PURE__*/React__default.createElement(FormTextField, {
2991
+ label: "Notes",
2992
+ name: "notes",
2993
+ control: control,
2994
+ fontColor: styles === null || styles === void 0 ? void 0 : styles.fontColor,
2995
+ multiline: true,
2996
+ rows: 3
2997
+ })))), /*#__PURE__*/React__default.createElement(material.DialogActions, {
2998
+ sx: {
2999
+ justifyContent: 'center',
3000
+ px: 0,
3001
+ pt: 2
3002
+ }
3003
+ }, /*#__PURE__*/React__default.createElement(material.Grid, {
3004
+ container: true,
3005
+ spacing: 4,
3006
+ alignItems: "center",
3007
+ justifyContent: "center"
3008
+ }, /*#__PURE__*/React__default.createElement(material.Grid, {
3009
+ item: true
3010
+ }, /*#__PURE__*/React__default.createElement(MuiButton, {
3011
+ primaryColor: styles === null || styles === void 0 ? void 0 : styles.primaryColor,
3012
+ sx: {
3013
+ fontSize: '1.3rem'
3014
+ },
3015
+ onClick: handleSubmit(onSubmit),
3016
+ loading: loading,
3017
+ size: "small"
3018
+ }, "Save")), /*#__PURE__*/React__default.createElement(material.Grid, {
3019
+ item: true
3020
+ }, /*#__PURE__*/React__default.createElement(MuiButton, {
3021
+ primaryColor: styles === null || styles === void 0 ? void 0 : styles.primaryColor,
3022
+ sx: {
3023
+ fontSize: '1.3rem'
3024
+ },
3025
+ onClick: onClose,
3026
+ size: "small"
3027
+ }, "Cancel")))));
3028
+ };
3029
+ var ExcessPaymentDialog = function ExcessPaymentDialog(_ref2) {
3030
+ var visible = _ref2.visible,
3031
+ onClose = _ref2.onClose,
3032
+ defaultStoreId = _ref2.defaultStoreId,
3033
+ apiEndPoint = _ref2.apiEndPoint,
3034
+ token = _ref2.token,
3035
+ styles = _ref2.styles,
3036
+ onSave = _ref2.onSave,
3037
+ customerData = _ref2.customerData;
3038
+ var _useForm = reactHookForm.useForm({
3039
+ defaultValues: {
3040
+ paymentModeId: '',
3041
+ excessAmount: '',
3042
+ transactionId: '',
3043
+ notes: ''
3044
+ }
3045
+ }),
3046
+ handleSubmit = _useForm.handleSubmit,
3047
+ control = _useForm.control,
3048
+ reset = _useForm.reset;
3049
+ var _useState = React.useState(false),
3050
+ loading = _useState[0],
3051
+ setLoading = _useState[1];
3052
+ React.useEffect(function () {
3053
+ if (!visible) {
3054
+ reset({
3055
+ paymentModeId: '',
3056
+ excessAmount: '',
3057
+ transactionId: '',
3058
+ notes: ''
3059
+ });
3060
+ }
3061
+ }, [visible, reset]);
3062
+ var onSubmit = function onSubmit(formData) {
3063
+ try {
3064
+ var _customerData$custome;
3065
+ var payload = {
3066
+ customerId: customerData === null || customerData === void 0 ? void 0 : (_customerData$custome = customerData.customerDto) === null || _customerData$custome === void 0 ? void 0 : _customerData$custome.id,
3067
+ insertedTimestamp: getUTCTime({
3068
+ time: new Date()
3069
+ }),
3070
+ paymentModeId: Number(formData === null || formData === void 0 ? void 0 : formData.paymentModeId),
3071
+ excessAmount: Number(formData === null || formData === void 0 ? void 0 : formData.excessAmount),
3072
+ storeId: defaultStoreId,
3073
+ amount: Number(formData === null || formData === void 0 ? void 0 : formData.excessAmount),
3074
+ transactionId: (formData === null || formData === void 0 ? void 0 : formData.transactionId) || null,
3075
+ notes: (formData === null || formData === void 0 ? void 0 : formData.notes) || null
3076
+ };
3077
+ var _temp = _finallyRethrows(function () {
3078
+ return _catch(function () {
3079
+ setLoading(true);
3080
+ return Promise.resolve(saveExcessPayment({
3081
+ apiEndPoint: apiEndPoint,
3082
+ token: token,
3083
+ payload: payload
3084
+ })).then(function (response) {
3085
+ onSave && onSave(payload);
3086
+ });
3087
+ }, function () {});
3088
+ }, function (_wasThrown, _result) {
3089
+ setLoading(false);
3090
+ if (_wasThrown) throw _result;
3091
+ return _result;
3092
+ });
3093
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
3094
+ } catch (e) {
3095
+ return Promise.reject(e);
3096
+ }
3097
+ };
3098
+ return /*#__PURE__*/React__default.createElement(material.Dialog, {
3099
+ open: visible,
3100
+ onClose: onClose,
3101
+ fullWidth: true,
3102
+ maxWidth: "sm"
3103
+ }, /*#__PURE__*/React__default.createElement(material.DialogTitle, null, "Excess Payment"), /*#__PURE__*/React__default.createElement(material.DialogContent, null, /*#__PURE__*/React__default.createElement(AsyncDataLoadComponent, {
3104
+ apiEndPoint: apiEndPoint,
3105
+ token: token,
3106
+ asyncService: function asyncService() {
3107
+ try {
3108
+ return Promise.resolve(getPaymentMethods({
3109
+ apiEndPoint: apiEndPoint,
3110
+ token: token
3111
+ }));
3112
+ } catch (e) {
3113
+ return Promise.reject(e);
3114
+ }
3115
+ }
3116
+ }, function (data) {
3117
+ var paymentMethods = (data === null || data === void 0 ? void 0 : data.filter(function (item) {
3118
+ return item === null || item === void 0 ? void 0 : item.ecommerce;
3119
+ })) || [];
3120
+ return /*#__PURE__*/React__default.createElement(ExcessPaymentForm, {
3121
+ loading: loading,
3122
+ paymentMethods: paymentMethods,
3123
+ control: control,
3124
+ styles: styles,
3125
+ handleSubmit: handleSubmit,
3126
+ onSubmit: onSubmit,
3127
+ onClose: onClose
3128
+ });
3129
+ })));
3130
+ };
3131
+
2838
3132
  var _templateObject$a, _templateObject2$5, _templateObject3$3, _templateObject4$2, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8$1, _templateObject9$1, _templateObject10$1, _templateObject11$1, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
2839
3133
  var totalIcons = [{
2840
3134
  name: '',
@@ -2848,6 +3142,9 @@ var totalIcons = [{
2848
3142
  }, {
2849
3143
  name: 'Total Number Of Orders',
2850
3144
  icon: /*#__PURE__*/React__default.createElement(gi.GiCardboardBoxClosed, null)
3145
+ }, {
3146
+ name: 'Excess Payment',
3147
+ icon: /*#__PURE__*/React__default.createElement(tb.TbFileDollar, null)
2851
3148
  }];
2852
3149
  var Dashboard = function Dashboard(_ref) {
2853
3150
  var _customerData$custome, _selectDates$salesOrd, _selectDates$recentIn, _selectDates$salesOrd2, _selectDates$recentIn2, _customerData$custome2, _customerData$custome3, _customerData$custome4;
@@ -2878,14 +3175,18 @@ var Dashboard = function Dashboard(_ref) {
2878
3175
  showOnlyRecentOrder = _ref$showOnlyRecentOr === void 0 ? false : _ref$showOnlyRecentOr,
2879
3176
  hidePayActionButton = _ref.hidePayActionButton,
2880
3177
  hideInvoiceTab = _ref.hideInvoiceTab,
2881
- hideSalesOrderTab = _ref.hideSalesOrderTab;
3178
+ hideSalesOrderTab = _ref.hideSalesOrderTab,
3179
+ hideAddAccessPaymentButton = _ref.hideAddAccessPaymentButton;
2882
3180
  var _useState = React.useState({}),
2883
3181
  customerData = _useState[0],
2884
3182
  setCustomerData = _useState[1];
2885
3183
  var _useState2 = React.useState({}),
2886
3184
  dashboardData = _useState2[0],
2887
3185
  setDashboardData = _useState2[1];
2888
- var _useState3 = React.useState({
3186
+ var _useState3 = React.useState(),
3187
+ refetchDashboardData = _useState3[0],
3188
+ setRefetchDashboardData = _useState3[1];
3189
+ var _useState4 = React.useState({
2889
3190
  recentInvoices: {
2890
3191
  startDate: null,
2891
3192
  endDate: null
@@ -2895,25 +3196,24 @@ var Dashboard = function Dashboard(_ref) {
2895
3196
  endDate: null
2896
3197
  }
2897
3198
  }),
2898
- selectDates = _useState3[0],
2899
- setSelectDates = _useState3[1];
2900
- var _useState4 = React.useState(getRandomString()),
2901
- triggerTableData = _useState4[0],
2902
- setTriggerTableData = _useState4[1];
2903
- var _useState5 = React.useState({
2904
- open: false,
2905
- url: ''
2906
- }),
2907
- invoiceModal = _useState5[0],
2908
- setInvoiceModal = _useState5[1];
3199
+ selectDates = _useState4[0],
3200
+ setSelectDates = _useState4[1];
3201
+ var _useState5 = React.useState(getRandomString()),
3202
+ triggerTableData = _useState5[0],
3203
+ setTriggerTableData = _useState5[1];
2909
3204
  var _useState6 = React.useState({
2910
3205
  open: false
2911
3206
  }),
2912
3207
  isPaymentModal = _useState6[0],
2913
3208
  setIsPaymentModal = _useState6[1];
2914
- var _useState7 = React.useState(0),
2915
- value = _useState7[0],
2916
- setValue = _useState7[1];
3209
+ var _useState7 = React.useState({
3210
+ open: false
3211
+ }),
3212
+ isExcessPaymentModal = _useState7[0],
3213
+ setIsExcessPaymentModal = _useState7[1];
3214
+ var _useState8 = React.useState(0),
3215
+ value = _useState8[0],
3216
+ setValue = _useState8[1];
2917
3217
  React.useEffect(function () {
2918
3218
  if (hideSalesOrderTab) {
2919
3219
  setValue(1);
@@ -2933,10 +3233,9 @@ var Dashboard = function Dashboard(_ref) {
2933
3233
  };
2934
3234
  }
2935
3235
  var openInvoiceData = function openInvoiceData(orderId) {
2936
- serviceApiEndPoint && setInvoiceModal({
2937
- open: true,
2938
- url: serviceApiEndPoint + "/" + (value === 0 ? 'salesOrder' : 'sales-order') + "/invoice/" + orderId + "?token=" + token + "&defaultStoreId=" + defaultStoreId + "&storeIdList=" + storeIdList + "&isEcommerce=true"
2939
- });
3236
+ if (serviceApiEndPoint) {
3237
+ window.open(serviceApiEndPoint + "/" + (value === 0 ? 'salesOrder' : 'sales-order') + "/invoice/" + orderId + "?token=" + token + "&defaultStoreId=" + defaultStoreId + "&storeIdList=" + storeIdList + "&isEcommerce=true", '_blank', 'noopener,noreferrer');
3238
+ }
2940
3239
  };
2941
3240
  var onDateChange = function onDateChange(data) {
2942
3241
  var startDate = moment(data === null || data === void 0 ? void 0 : data.startDate).startOf('day');
@@ -3149,7 +3448,7 @@ var Dashboard = function Dashboard(_ref) {
3149
3448
  Promise.reject(e);
3150
3449
  }
3151
3450
  })();
3152
- }, []);
3451
+ }, [refetchDashboardData]);
3153
3452
  React.useEffect(function () {
3154
3453
  try {
3155
3454
  try {
@@ -3202,6 +3501,30 @@ var Dashboard = function Dashboard(_ref) {
3202
3501
  orderId: isPaymentModal === null || isPaymentModal === void 0 ? void 0 : isPaymentModal.orderId,
3203
3502
  setTriggerTableData: setTriggerTableData,
3204
3503
  styles: styles
3504
+ }), (isExcessPaymentModal === null || isExcessPaymentModal === void 0 ? void 0 : isExcessPaymentModal.open) && /*#__PURE__*/React__default.createElement(ExcessPaymentDialog, {
3505
+ customerData: customerData,
3506
+ apiEndPoint: apiEndPoint,
3507
+ token: token,
3508
+ defaultStoreId: defaultStoreId,
3509
+ styles: styles,
3510
+ onSave: function onSave(payload) {
3511
+ try {
3512
+ setRefetchDashboardData(getRandomString());
3513
+ alert("Excess Payment $" + (payload === null || payload === void 0 ? void 0 : payload.excessAmount) + " added successfully");
3514
+ setIsExcessPaymentModal({
3515
+ open: false
3516
+ });
3517
+ return Promise.resolve();
3518
+ } catch (e) {
3519
+ return Promise.reject(e);
3520
+ }
3521
+ },
3522
+ visible: isExcessPaymentModal === null || isExcessPaymentModal === void 0 ? void 0 : isExcessPaymentModal.open,
3523
+ onClose: function onClose() {
3524
+ return setIsExcessPaymentModal({
3525
+ open: false
3526
+ });
3527
+ }
3205
3528
  }), /*#__PURE__*/React__default.createElement(material.Grid, {
3206
3529
  container: true,
3207
3530
  columnSpacing: 4
@@ -3219,7 +3542,8 @@ var Dashboard = function Dashboard(_ref) {
3219
3542
  spacing: 3
3220
3543
  }, totalDataSource === null || totalDataSource === void 0 ? void 0 : totalDataSource.map(function (data) {
3221
3544
  var _data$name, _data$name2, _data$name3, _totalIcons$find;
3222
- var isAmount = (data === null || data === void 0 ? void 0 : (_data$name = data.name) === null || _data$name === void 0 ? void 0 : _data$name.indexOf('Amount')) > 1 || (data === null || data === void 0 ? void 0 : (_data$name2 = data.name) === null || _data$name2 === void 0 ? void 0 : _data$name2.indexOf('Credit')) > 1 || (data === null || data === void 0 ? void 0 : (_data$name3 = data.name) === null || _data$name3 === void 0 ? void 0 : _data$name3.indexOf('Price')) > 1;
3545
+ var isAmount = (data === null || data === void 0 ? void 0 : (_data$name = data.name) === null || _data$name === void 0 ? void 0 : _data$name.indexOf('Amount')) > 1 || (data === null || data === void 0 ? void 0 : (_data$name2 = data.name) === null || _data$name2 === void 0 ? void 0 : _data$name2.indexOf('Credit')) > 1 || (data === null || data === void 0 ? void 0 : (_data$name3 = data.name) === null || _data$name3 === void 0 ? void 0 : _data$name3.indexOf('Price')) > 1 || (data === null || data === void 0 ? void 0 : data.name) === 'Excess Payment';
3546
+ var isExcessPayment = (data === null || data === void 0 ? void 0 : data.name) === 'Excess Payment';
3223
3547
  return /*#__PURE__*/React__default.createElement(material.Grid, {
3224
3548
  item: true,
3225
3549
  xs: 12,
@@ -3239,7 +3563,23 @@ var Dashboard = function Dashboard(_ref) {
3239
3563
  className: "icon-container"
3240
3564
  }, (totalIcons === null || totalIcons === void 0 ? void 0 : (_totalIcons$find = totalIcons.find(function (icons) {
3241
3565
  return (icons === null || icons === void 0 ? void 0 : icons.name) === (data === null || data === void 0 ? void 0 : data.name);
3242
- })) === null || _totalIcons$find === void 0 ? void 0 : _totalIcons$find.icon) || (isAmount ? /*#__PURE__*/React__default.createElement(md.MdMonetizationOn, null) : /*#__PURE__*/React__default.createElement(gr.GrStackOverflow, null))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("p", null, data === null || data === void 0 ? void 0 : data.name), /*#__PURE__*/React__default.createElement("h3", null, "" + (isAmount ? renderMoney(data === null || data === void 0 ? void 0 : data.value) : data === null || data === void 0 ? void 0 : data.value)))));
3566
+ })) === null || _totalIcons$find === void 0 ? void 0 : _totalIcons$find.icon) || (isAmount ? /*#__PURE__*/React__default.createElement(md.MdMonetizationOn, null) : /*#__PURE__*/React__default.createElement(gr.GrStackOverflow, null))), /*#__PURE__*/React__default.createElement("div", {
3567
+ style: {
3568
+ flex: 1
3569
+ }
3570
+ }, /*#__PURE__*/React__default.createElement("p", null, data === null || data === void 0 ? void 0 : data.name), /*#__PURE__*/React__default.createElement("h3", null, "" + (isAmount ? renderMoney(data === null || data === void 0 ? void 0 : data.value) : data === null || data === void 0 ? void 0 : data.value))), isExcessPayment && !hideAddAccessPaymentButton && /*#__PURE__*/React__default.createElement(material.Tooltip, {
3571
+ title: "Add Excess Payment",
3572
+ arrow: true
3573
+ }, /*#__PURE__*/React__default.createElement(AddExcessPaymentButton, {
3574
+ className: "add-excess-payment-btn",
3575
+ primaryColor: primaryColor,
3576
+ onClick: function onClick() {
3577
+ return setIsExcessPaymentModal({
3578
+ open: true
3579
+ });
3580
+ },
3581
+ "aria-label": "Add excess payment"
3582
+ }, /*#__PURE__*/React__default.createElement(md.MdAdd, null), /*#__PURE__*/React__default.createElement("span", null, "Add")))));
3243
3583
  }))), !hideBannerSection && /*#__PURE__*/React__default.createElement(BannerContainer, null, /*#__PURE__*/React__default.createElement(material.Grid, {
3244
3584
  container: true,
3245
3585
  spacing: 3,
@@ -3318,20 +3658,7 @@ var Dashboard = function Dashboard(_ref) {
3318
3658
  style: {
3319
3659
  marginTop: '1rem'
3320
3660
  }
3321
- })))))), /*#__PURE__*/React__default.createElement(TableContainer, null, /*#__PURE__*/React__default.createElement(InvoiceDialog, {
3322
- onClose: function onClose() {
3323
- return setInvoiceModal({
3324
- open: false
3325
- });
3326
- },
3327
- "aria-labelledby": "customized-dialog-title",
3328
- open: invoiceModal === null || invoiceModal === void 0 ? void 0 : invoiceModal.open,
3329
- maxWidth: "lg"
3330
- }, /*#__PURE__*/React__default.createElement(material.DialogContent, {
3331
- dividers: true
3332
- }, /*#__PURE__*/React__default.createElement("iframe", {
3333
- src: invoiceModal.url
3334
- }))), /*#__PURE__*/React__default.createElement(APITable, {
3661
+ })))))), /*#__PURE__*/React__default.createElement(TableContainer, null, /*#__PURE__*/React__default.createElement(APITable, {
3335
3662
  key: value,
3336
3663
  cacheFilters: true,
3337
3664
  extraFilterParams: value === 0 ? selectDates.recentInvoices : selectDates.salesOrders,
@@ -3558,10 +3885,12 @@ var SocialIconContainer = styled__default.a(_templateObject8$1 || (_templateObje
3558
3885
  });
3559
3886
  var ImageContainer = styled__default(material.CardMedia)(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteralLoose(["\n max-width: 100%;\n border-radius: 14px;\n img {\n max-width: 100%;\n }\n"])));
3560
3887
  var TotalRoot = styled__default.div(_templateObject10$1 || (_templateObject10$1 = _taggedTemplateLiteralLoose(["\n margin: 2rem 0;\n"])));
3561
- var TotalContainer = styled__default(material.Stack)(_templateObject11$1 || (_templateObject11$1 = _taggedTemplateLiteralLoose(["\n border-radius: 14px;\n background-color: ", ";\n padding: 1.8rem 1.4rem;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px 0px;\n :hover {\n background-color: ", ";\n p,\n h3 {\n color: #fff !important;\n }\n .icon-container {\n background: #fff;\n }\n }\n p {\n font-size: 1rem;\n font-weight: 600;\n color: ", ";\n margin-bottom: 0rem;\n }\n h3 {\n font-size: 1.7rem;\n font-weight: 600;\n color: ", ";\n }\n .icon-container {\n background: ", ";\n border-radius: 14px;\n padding: 0.6rem;\n display: flex;\n margin: auto 0;\n svg {\n font-size: 2.6rem;\n color: ", ";\n }\n }\n"])), function (props) {
3888
+ var TotalContainer = styled__default(material.Stack)(_templateObject11$1 || (_templateObject11$1 = _taggedTemplateLiteralLoose(["\n border-radius: 14px;\n background-color: ", ";\n padding: 1.8rem 1.4rem;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px 0px;\n align-items: center;\n :hover {\n background-color: ", ";\n p,\n h3 {\n color: #fff !important;\n }\n .icon-container {\n background: #fff;\n }\n .add-excess-payment-btn {\n background: #fff;\n color: ", ";\n }\n }\n p {\n font-size: 1rem;\n font-weight: 600;\n color: ", ";\n margin-bottom: 0rem;\n }\n h3 {\n font-size: 1.7rem;\n font-weight: 600;\n color: ", ";\n }\n .icon-container {\n background: ", ";\n border-radius: 14px;\n padding: 0.6rem;\n display: flex;\n margin: auto 0;\n svg {\n font-size: 2.6rem;\n color: ", ";\n }\n }\n"])), function (props) {
3562
3889
  return props.secondaryColor;
3563
3890
  }, function (props) {
3564
3891
  return props.primaryColor;
3892
+ }, function (props) {
3893
+ return props.primaryColor;
3565
3894
  }, function (props) {
3566
3895
  return props.fontColor;
3567
3896
  }, function (props) {
@@ -3571,12 +3900,15 @@ var TotalContainer = styled__default(material.Stack)(_templateObject11$1 || (_te
3571
3900
  }, function (props) {
3572
3901
  return props.primaryColor;
3573
3902
  });
3574
- var BannerContainer = styled__default(material.Stack)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteralLoose([""])));
3575
- var CategoryContainer = styled__default.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n padding: 1.8rem;\n border-radius: 14px;\n"])), function (props) {
3903
+ var AddExcessPaymentButton = styled__default.button(_templateObject12 || (_templateObject12 = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n margin-left: auto;\n border: none;\n cursor: pointer;\n border-radius: 999px;\n padding: 0.45rem 0.9rem 0.45rem 0.55rem;\n background: ", ";\n color: #fff;\n font-size: 0.85rem;\n font-weight: 600;\n line-height: 1;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n transition: transform 0.15s ease, box-shadow 0.15s ease;\n\n svg {\n font-size: 1.35rem;\n }\n\n &:hover {\n transform: translateY(-1px);\n box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);\n }\n\n &:active {\n transform: translateY(0);\n }\n"])), function (props) {
3904
+ return props.primaryColor;
3905
+ });
3906
+ var BannerContainer = styled__default(material.Stack)(_templateObject13 || (_templateObject13 = _taggedTemplateLiteralLoose([""])));
3907
+ var CategoryContainer = styled__default.div(_templateObject14 || (_templateObject14 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n padding: 1.8rem;\n border-radius: 14px;\n"])), function (props) {
3576
3908
  var _props$theme;
3577
3909
  return (_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.primaryColor;
3578
3910
  });
3579
- var CategoryText = styled__default.div(_templateObject14 || (_templateObject14 = _taggedTemplateLiteralLoose(["\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n h3 {\n color: #fff;\n font-size: 2rem;\n font-weight: 700;\n margin: 1rem 0;\n }\n p {\n color: #fff;\n font-size: 1.2rem;\n text-transform: capitalize;\n }\n button {\n padding: 0.5rem 2rem;\n margin-top: 1rem;\n background-color: ", ";\n color: ", ";\n border-radius: 14px;\n font-size: 1.2rem;\n font-weight: 600;\n &:hover {\n background-color: ", ";\n color: #fff;\n }\n }\n"])), function (props) {
3911
+ var CategoryText = styled__default.div(_templateObject15 || (_templateObject15 = _taggedTemplateLiteralLoose(["\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n h3 {\n color: #fff;\n font-size: 2rem;\n font-weight: 700;\n margin: 1rem 0;\n }\n p {\n color: #fff;\n font-size: 1.2rem;\n text-transform: capitalize;\n }\n button {\n padding: 0.5rem 2rem;\n margin-top: 1rem;\n background-color: ", ";\n color: ", ";\n border-radius: 14px;\n font-size: 1.2rem;\n font-weight: 600;\n &:hover {\n background-color: ", ";\n color: #fff;\n }\n }\n"])), function (props) {
3580
3912
  var _props$theme2;
3581
3913
  return (_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.secondaryColor;
3582
3914
  }, function (props) {
@@ -3586,18 +3918,17 @@ var CategoryText = styled__default.div(_templateObject14 || (_templateObject14 =
3586
3918
  var _props$theme4;
3587
3919
  return (_props$theme4 = props.theme) === null || _props$theme4 === void 0 ? void 0 : _props$theme4.primaryColor;
3588
3920
  });
3589
- var DiscoverContainer = styled__default.div(_templateObject15 || (_templateObject15 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n padding: 1.8rem;\n border-radius: 14px;\n h3,\n svg {\n color: ", ";\n font-size: 2rem;\n font-weight: 700;\n line-height: 2rem;\n }\n"])), function (props) {
3921
+ var DiscoverContainer = styled__default.div(_templateObject16 || (_templateObject16 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n padding: 1.8rem;\n border-radius: 14px;\n h3,\n svg {\n color: ", ";\n font-size: 2rem;\n font-weight: 700;\n line-height: 2rem;\n }\n"])), function (props) {
3590
3922
  var _props$theme5, _props$theme6, _props$theme7;
3591
3923
  return (_props$theme5 = props.theme) !== null && _props$theme5 !== void 0 && _props$theme5.isNightMode ? (_props$theme6 = props.theme) === null || _props$theme6 === void 0 ? void 0 : _props$theme6.secondaryColor : "rgba(" + hexToRgbA((_props$theme7 = props.theme) === null || _props$theme7 === void 0 ? void 0 : _props$theme7.primaryColor) + ",0.1)";
3592
3924
  }, function (props) {
3593
3925
  var _props$theme8;
3594
3926
  return (_props$theme8 = props.theme) === null || _props$theme8 === void 0 ? void 0 : _props$theme8.fontColor;
3595
3927
  });
3596
- var StatusContainer = styled__default(material.Stack)(_templateObject16 || (_templateObject16 = _taggedTemplateLiteralLoose(["\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px 0px;\n padding: 4px 8px;\n border-radius: 6px;\n background-color: ", ";\n color: #fff;\n width: max-content;\n"])), function (props) {
3928
+ var StatusContainer = styled__default(material.Stack)(_templateObject17 || (_templateObject17 = _taggedTemplateLiteralLoose(["\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px 0px;\n padding: 4px 8px;\n border-radius: 6px;\n background-color: ", ";\n color: #fff;\n width: max-content;\n"])), function (props) {
3597
3929
  return props.primaryColor;
3598
3930
  });
3599
- var TableContainer = styled__default.div(_templateObject17 || (_templateObject17 = _taggedTemplateLiteralLoose(["\n margin-top: 2rem;\n border-radius: 14px;\n"])));
3600
- var InvoiceDialog = styled__default(material.Dialog)(_templateObject18 || (_templateObject18 = _taggedTemplateLiteralLoose(["\n iframe {\n width: 900px;\n border: none;\n height: 600px;\n }\n"])));
3931
+ var TableContainer = styled__default.div(_templateObject18 || (_templateObject18 = _taggedTemplateLiteralLoose(["\n margin-top: 2rem;\n border-radius: 14px;\n"])));
3601
3932
  var TabsContainer = styled__default(material.Tabs)(_templateObject19 || (_templateObject19 = _taggedTemplateLiteralLoose(["\n button {\n color: ", " !important;\n font-size: 1.1rem;\n font-weight: 600;\n }\n .Mui-selected {\n color: ", " !important;\n }\n .MuiTabs-indicator {\n background-color: ", " !important;\n }\n"])), function (props) {
3602
3933
  return props.fontColor;
3603
3934
  }, function (props) {
@@ -5289,20 +5620,6 @@ var getDocumentTypes = function getDocumentTypes(_ref3) {
5289
5620
  }
5290
5621
  };
5291
5622
 
5292
- var getUpcomingAchPayments = function getUpcomingAchPayments(_ref) {
5293
- var apiEndPoint = _ref.apiEndPoint,
5294
- token = _ref.token;
5295
- try {
5296
- return Promise.resolve(API({
5297
- url: '/ecommerce/order/payment/upcoming-auto-ach',
5298
- apiEndPoint: apiEndPoint,
5299
- token: token
5300
- }));
5301
- } catch (e) {
5302
- return Promise.reject(e);
5303
- }
5304
- };
5305
-
5306
5623
  var _templateObject$l;
5307
5624
  var columns = [{
5308
5625
  id: 'orderId',
@@ -5366,7 +5683,7 @@ var UpcomingACHPayments = function UpcomingACHPayments(_ref) {
5366
5683
  var TableContainer$2 = styled__default.div(_templateObject$l || (_templateObject$l = _taggedTemplateLiteralLoose(["\n margin: 1.2rem 0;\n border-radius: 14px;\n"])));
5367
5684
 
5368
5685
  var _templateObject$m, _templateObject2$d, _templateObject3$9, _templateObject4$7;
5369
- var _excluded$5 = ["apiEndPoint", "serviceApiEndPoint", "token", "primaryColor", "secondaryColor", "backgroundColor", "fontColor", "darkMode", "onChangeColors", "path", "onChangePath", "maxWidth", "logoUrl", "sectionLeftImageSection", "exploreCategoryImage", "sectionRightImageSection", "discountImageSection", "disabledUpdateProfileFromDashboard", "hideTotalCardInDashboardSummary", "showOnlyRecentOrder", "hidePayActionButton", "hideSalesOrderTab", "hideInvoiceTab"];
5686
+ var _excluded$5 = ["apiEndPoint", "serviceApiEndPoint", "token", "primaryColor", "secondaryColor", "backgroundColor", "fontColor", "darkMode", "onChangeColors", "path", "onChangePath", "maxWidth", "logoUrl", "sectionLeftImageSection", "exploreCategoryImage", "sectionRightImageSection", "discountImageSection", "disabledUpdateProfileFromDashboard", "hideTotalCardInDashboardSummary", "showOnlyRecentOrder", "hidePayActionButton", "hideSalesOrderTab", "hideInvoiceTab", "hideAddAccessPaymentButton"];
5370
5687
  var AccountDetails = function AccountDetails(_ref) {
5371
5688
  var _storeData$map, _storeData$find, _storeData$;
5372
5689
  var apiEndPoint = _ref.apiEndPoint,
@@ -5400,6 +5717,8 @@ var AccountDetails = function AccountDetails(_ref) {
5400
5717
  hideSalesOrderTab = _ref$hideSalesOrderTa === void 0 ? false : _ref$hideSalesOrderTa,
5401
5718
  _ref$hideInvoiceTab = _ref.hideInvoiceTab,
5402
5719
  hideInvoiceTab = _ref$hideInvoiceTab === void 0 ? false : _ref$hideInvoiceTab,
5720
+ _ref$hideAddAccessPay = _ref.hideAddAccessPaymentButton,
5721
+ hideAddAccessPaymentButton = _ref$hideAddAccessPay === void 0 ? false : _ref$hideAddAccessPay,
5403
5722
  props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
5404
5723
  var _useAllSystemFeatureV = useAllSystemFeatureValues({
5405
5724
  apiEndPoint: apiEndPoint,
@@ -5573,7 +5892,8 @@ var AccountDetails = function AccountDetails(_ref) {
5573
5892
  showOnlyRecentOrder: showOnlyRecentOrder,
5574
5893
  hidePayActionButton: hidePayActionButton,
5575
5894
  hideSalesOrderTab: hideSalesOrderTab,
5576
- hideInvoiceTab: hideInvoiceTab
5895
+ hideInvoiceTab: hideInvoiceTab,
5896
+ hideAddAccessPaymentButton: hideAddAccessPaymentButton
5577
5897
  });
5578
5898
  case 'myProfile':
5579
5899
  return /*#__PURE__*/React__default.createElement(MyProfile, {
@@ -5790,83 +6110,6 @@ var TypographyContainer$7 = styled__default(material.Typography)(_templateObject
5790
6110
  return props.fontColor;
5791
6111
  });
5792
6112
 
5793
- var AsyncDataLoad = function AsyncDataLoad(_ref) {
5794
- var apiEndPoint = _ref.apiEndPoint,
5795
- token = _ref.token,
5796
- children = _ref.children,
5797
- onError = _ref.onError,
5798
- skeletonHeight = _ref.skeletonHeight,
5799
- loadingView = _ref.loadingView,
5800
- errorView = _ref.errorView,
5801
- asyncService = _ref.asyncService,
5802
- triggerChange = _ref.triggerChange,
5803
- apiConfig = _ref.apiConfig;
5804
- var _useState = React.useState({
5805
- status: 'loading',
5806
- data: {}
5807
- }),
5808
- apiState = _useState[0],
5809
- setApiState = _useState[1];
5810
- var getAPIData = function getAPIData() {
5811
- try {
5812
- var _temp3 = _catch(function () {
5813
- function _temp2() {
5814
- setApiState({
5815
- status: API_STATUSES.SUCCESS,
5816
- data: data
5817
- });
5818
- }
5819
- setApiState({
5820
- status: API_STATUSES.LOADING,
5821
- data: {}
5822
- });
5823
- var data;
5824
- var _temp = function () {
5825
- if (asyncService) {
5826
- return Promise.resolve(asyncService()).then(function (_asyncService) {
5827
- data = _asyncService;
5828
- });
5829
- } else {
5830
- return Promise.resolve(API(_extends({
5831
- apiEndPoint: apiEndPoint,
5832
- token: token,
5833
- hideErrorMessage: true
5834
- }, apiConfig))).then(function (_API) {
5835
- data = _API;
5836
- });
5837
- }
5838
- }();
5839
- return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
5840
- }, function (e) {
5841
- setApiState({
5842
- status: API_STATUSES.ERROR,
5843
- data: {}
5844
- });
5845
- if (onError) {
5846
- onError(e);
5847
- }
5848
- });
5849
- return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
5850
- } catch (e) {
5851
- return Promise.reject(e);
5852
- }
5853
- };
5854
- React.useEffect(function () {
5855
- if (apiConfig || asyncService) {
5856
- (function () {
5857
- return getAPIData();
5858
- })();
5859
- }
5860
- }, [apiConfig, triggerChange]);
5861
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, apiState.status === API_STATUSES.LOADING ? loadingView ? loadingView : /*#__PURE__*/React__default.createElement(Loader, {
5862
- skeleton: skeletonHeight,
5863
- height: skeletonHeight
5864
- }) : null, apiState.status === API_STATUSES.SUCCESS ? typeof children === 'function' ? children(apiState.data) : {
5865
- children: children
5866
- } : null, apiState.status === API_STATUSES.ERROR ? errorView ? errorView : 'NO DATA' : null);
5867
- };
5868
- var AsyncDataLoadComponent = React.memo(AsyncDataLoad);
5869
-
5870
6113
  var _templateObject$n, _templateObject2$e, _templateObject3$a;
5871
6114
  var BannerImages = function BannerImages(_ref) {
5872
6115
  var config = _ref.config,