@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.
@@ -1,8 +1,8 @@
1
- import { Skeleton as Skeleton$1, CircularProgress, TextField, Button, IconButton, Stack, Typography, Grid, InputAdornment, Popover, TableHead, TableRow, TableSortLabel, Paper, TableContainer as TableContainer$4, Table, TableBody, TableCell, TablePagination, Dialog, DialogContent, DialogActions, DialogTitle as DialogTitle$1, RadioGroup, Radio, FormControlLabel, FormLabel, FormControl, FormHelperText, Select as Select$1, InputLabel, MenuItem, CardMedia, Divider, Tabs, Box, Tab, CardContent, ListItemIcon, ListItem, Collapse, List, ListItemText, Checkbox as Checkbox$1, Card as Card$1, CardHeader as CardHeader$1, CssBaseline, Toolbar, Drawer, useMediaQuery as useMediaQuery$1, Tooltip, Pagination, CardActionArea, Avatar as Avatar$1, alpha, Stepper, Step, StepLabel, StepContent, Container as Container$4 } from '@mui/material';
1
+ import { Skeleton as Skeleton$1, CircularProgress, TextField, Button, IconButton, Stack, Typography, Grid, InputAdornment, Popover, TableHead, TableRow, TableSortLabel, Paper, TableContainer as TableContainer$4, Table, TableBody, TableCell, TablePagination, Dialog, DialogContent, DialogActions, DialogTitle as DialogTitle$1, RadioGroup, Radio, FormControlLabel, FormLabel, FormControl, FormHelperText, Select as Select$1, InputLabel, MenuItem, CardMedia, Divider, Tabs, Tooltip, Box, Tab, CardContent, ListItemIcon, ListItem, Collapse, List, ListItemText, Checkbox as Checkbox$1, Card as Card$1, CardHeader as CardHeader$1, CssBaseline, Toolbar, Drawer, useMediaQuery as useMediaQuery$1, Pagination, CardActionArea, Avatar as Avatar$1, alpha, Stepper, Step, StepLabel, StepContent, Container as Container$4 } from '@mui/material';
2
2
  import { styled as styled$1 } from '@mui/material/styles';
3
3
  import useMediaQuery from '@mui/material/useMediaQuery';
4
- import React__default, { useState, useEffect, forwardRef, createElement, useCallback, memo, Fragment as Fragment$1, useRef, useMemo } from 'react';
5
- import { MdVisibilityOff, MdVisibility, MdClose, MdMonetizationOn, MdOutlineStorefront, MdRemoveRedEye, MdOutlineFileDownload, MdPersonOutline, MdOutlineCall, MdMailOutline, MdExpandMore, MdExpandLess, MdStore, MdOutlineMenuOpen, MdMenu, MdDarkMode, MdOutlineDarkMode, MdLocalOffer, MdDelete, MdCheckCircle, MdArrowBack, MdOutlineCircle, MdOutlineStickyNote2, MdOutlineNumbers, MdDateRange, MdOutlineWarehouse } from 'react-icons/md';
4
+ import React__default, { useState, useEffect, forwardRef, memo, createElement, useCallback, Fragment as Fragment$1, useRef, useMemo } from 'react';
5
+ import { MdVisibilityOff, MdVisibility, MdClose, MdMonetizationOn, MdAdd, MdOutlineStorefront, MdRemoveRedEye, MdOutlineFileDownload, MdPersonOutline, MdOutlineCall, MdMailOutline, MdExpandMore, MdExpandLess, MdStore, MdOutlineMenuOpen, MdMenu, MdDarkMode, MdOutlineDarkMode, MdLocalOffer, MdDelete, MdCheckCircle, MdArrowBack, MdOutlineCircle, MdOutlineStickyNote2, MdOutlineNumbers, MdDateRange, MdOutlineWarehouse } from 'react-icons/md';
6
6
  import styled, { css, ThemeProvider, keyframes } from 'styled-components';
7
7
  import { isEmpty, isString, toNumber, reduce, concat, omit, replace, template, isArray, some, toLower, isPlainObject, includes, values, cloneDeep, filter, sortBy, isObject, sumBy, get, isNumber, remove } from 'lodash';
8
8
  import axios from 'axios';
@@ -2831,6 +2831,300 @@ var InfoContainer = styled.div(_templateObject$9 || (_templateObject$9 = _tagged
2831
2831
  return props.fontColor;
2832
2832
  });
2833
2833
 
2834
+ var AsyncDataLoad = function AsyncDataLoad(_ref) {
2835
+ var apiEndPoint = _ref.apiEndPoint,
2836
+ token = _ref.token,
2837
+ children = _ref.children,
2838
+ onError = _ref.onError,
2839
+ skeletonHeight = _ref.skeletonHeight,
2840
+ loadingView = _ref.loadingView,
2841
+ errorView = _ref.errorView,
2842
+ asyncService = _ref.asyncService,
2843
+ triggerChange = _ref.triggerChange,
2844
+ apiConfig = _ref.apiConfig;
2845
+ var _useState = useState({
2846
+ status: 'loading',
2847
+ data: {}
2848
+ }),
2849
+ apiState = _useState[0],
2850
+ setApiState = _useState[1];
2851
+ var getAPIData = function getAPIData() {
2852
+ try {
2853
+ var _temp3 = _catch(function () {
2854
+ function _temp2() {
2855
+ setApiState({
2856
+ status: API_STATUSES.SUCCESS,
2857
+ data: data
2858
+ });
2859
+ }
2860
+ setApiState({
2861
+ status: API_STATUSES.LOADING,
2862
+ data: {}
2863
+ });
2864
+ var data;
2865
+ var _temp = function () {
2866
+ if (asyncService) {
2867
+ return Promise.resolve(asyncService()).then(function (_asyncService) {
2868
+ data = _asyncService;
2869
+ });
2870
+ } else {
2871
+ return Promise.resolve(API(_extends({
2872
+ apiEndPoint: apiEndPoint,
2873
+ token: token,
2874
+ hideErrorMessage: true
2875
+ }, apiConfig))).then(function (_API) {
2876
+ data = _API;
2877
+ });
2878
+ }
2879
+ }();
2880
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
2881
+ }, function (e) {
2882
+ setApiState({
2883
+ status: API_STATUSES.ERROR,
2884
+ data: {}
2885
+ });
2886
+ if (onError) {
2887
+ onError(e);
2888
+ }
2889
+ });
2890
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
2891
+ } catch (e) {
2892
+ return Promise.reject(e);
2893
+ }
2894
+ };
2895
+ useEffect(function () {
2896
+ if (apiConfig || asyncService) {
2897
+ (function () {
2898
+ return getAPIData();
2899
+ })();
2900
+ }
2901
+ }, [apiConfig, triggerChange]);
2902
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, apiState.status === API_STATUSES.LOADING ? loadingView ? loadingView : /*#__PURE__*/React__default.createElement(Loader, {
2903
+ skeleton: skeletonHeight,
2904
+ height: skeletonHeight
2905
+ }) : null, apiState.status === API_STATUSES.SUCCESS ? typeof children === 'function' ? children(apiState.data) : {
2906
+ children: children
2907
+ } : null, apiState.status === API_STATUSES.ERROR ? errorView ? errorView : 'NO DATA' : null);
2908
+ };
2909
+ var AsyncDataLoadComponent = memo(AsyncDataLoad);
2910
+
2911
+ var getUpcomingAchPayments = function getUpcomingAchPayments(_ref) {
2912
+ var apiEndPoint = _ref.apiEndPoint,
2913
+ token = _ref.token;
2914
+ try {
2915
+ return Promise.resolve(API({
2916
+ url: '/ecommerce/order/payment/upcoming-auto-ach',
2917
+ apiEndPoint: apiEndPoint,
2918
+ token: token
2919
+ }));
2920
+ } catch (e) {
2921
+ return Promise.reject(e);
2922
+ }
2923
+ };
2924
+ var saveExcessPayment = function saveExcessPayment(_ref2) {
2925
+ var apiEndPoint = _ref2.apiEndPoint,
2926
+ token = _ref2.token,
2927
+ payload = _ref2.payload;
2928
+ try {
2929
+ return Promise.resolve(API({
2930
+ url: '/ecommerce/order/payment/excess',
2931
+ apiEndPoint: apiEndPoint,
2932
+ token: token,
2933
+ method: 'POST',
2934
+ body: payload
2935
+ }));
2936
+ } catch (e) {
2937
+ return Promise.reject(e);
2938
+ }
2939
+ };
2940
+
2941
+ var ExcessPaymentForm = function ExcessPaymentForm(_ref) {
2942
+ var paymentMethods = _ref.paymentMethods,
2943
+ control = _ref.control,
2944
+ styles = _ref.styles,
2945
+ handleSubmit = _ref.handleSubmit,
2946
+ onSubmit = _ref.onSubmit,
2947
+ onClose = _ref.onClose,
2948
+ loading = _ref.loading;
2949
+ return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("form", null, /*#__PURE__*/React__default.createElement(Grid, {
2950
+ container: true,
2951
+ spacing: 2
2952
+ }, /*#__PURE__*/React__default.createElement(Grid, {
2953
+ item: true,
2954
+ xs: 12
2955
+ }, /*#__PURE__*/React__default.createElement(FormSelect, {
2956
+ label: "Payment Method",
2957
+ name: "paymentModeId",
2958
+ required: true,
2959
+ control: control,
2960
+ options: paymentMethods,
2961
+ valueKey: "id",
2962
+ labelKey: "name",
2963
+ placeholder: "Select Payment Mode",
2964
+ fontColor: styles === null || styles === void 0 ? void 0 : styles.fontColor
2965
+ })), /*#__PURE__*/React__default.createElement(Grid, {
2966
+ item: true,
2967
+ xs: 12
2968
+ }, /*#__PURE__*/React__default.createElement(FormTextField, {
2969
+ label: "Excess Amount",
2970
+ name: "excessAmount",
2971
+ type: "number",
2972
+ required: true,
2973
+ control: control,
2974
+ fontColor: styles === null || styles === void 0 ? void 0 : styles.fontColor
2975
+ })), /*#__PURE__*/React__default.createElement(Grid, {
2976
+ item: true,
2977
+ xs: 12
2978
+ }, /*#__PURE__*/React__default.createElement(FormTextField, {
2979
+ label: "Transaction Id",
2980
+ name: "transactionId",
2981
+ control: control,
2982
+ fontColor: styles === null || styles === void 0 ? void 0 : styles.fontColor
2983
+ })), /*#__PURE__*/React__default.createElement(Grid, {
2984
+ item: true,
2985
+ xs: 12
2986
+ }, /*#__PURE__*/React__default.createElement(FormTextField, {
2987
+ label: "Notes",
2988
+ name: "notes",
2989
+ control: control,
2990
+ fontColor: styles === null || styles === void 0 ? void 0 : styles.fontColor,
2991
+ multiline: true,
2992
+ rows: 3
2993
+ })))), /*#__PURE__*/React__default.createElement(DialogActions, {
2994
+ sx: {
2995
+ justifyContent: 'center',
2996
+ px: 0,
2997
+ pt: 2
2998
+ }
2999
+ }, /*#__PURE__*/React__default.createElement(Grid, {
3000
+ container: true,
3001
+ spacing: 4,
3002
+ alignItems: "center",
3003
+ justifyContent: "center"
3004
+ }, /*#__PURE__*/React__default.createElement(Grid, {
3005
+ item: true
3006
+ }, /*#__PURE__*/React__default.createElement(MuiButton, {
3007
+ primaryColor: styles === null || styles === void 0 ? void 0 : styles.primaryColor,
3008
+ sx: {
3009
+ fontSize: '1.3rem'
3010
+ },
3011
+ onClick: handleSubmit(onSubmit),
3012
+ loading: loading,
3013
+ size: "small"
3014
+ }, "Save")), /*#__PURE__*/React__default.createElement(Grid, {
3015
+ item: true
3016
+ }, /*#__PURE__*/React__default.createElement(MuiButton, {
3017
+ primaryColor: styles === null || styles === void 0 ? void 0 : styles.primaryColor,
3018
+ sx: {
3019
+ fontSize: '1.3rem'
3020
+ },
3021
+ onClick: onClose,
3022
+ size: "small"
3023
+ }, "Cancel")))));
3024
+ };
3025
+ var ExcessPaymentDialog = function ExcessPaymentDialog(_ref2) {
3026
+ var visible = _ref2.visible,
3027
+ onClose = _ref2.onClose,
3028
+ defaultStoreId = _ref2.defaultStoreId,
3029
+ apiEndPoint = _ref2.apiEndPoint,
3030
+ token = _ref2.token,
3031
+ styles = _ref2.styles,
3032
+ onSave = _ref2.onSave,
3033
+ customerData = _ref2.customerData;
3034
+ var _useForm = useForm({
3035
+ defaultValues: {
3036
+ paymentModeId: '',
3037
+ excessAmount: '',
3038
+ transactionId: '',
3039
+ notes: ''
3040
+ }
3041
+ }),
3042
+ handleSubmit = _useForm.handleSubmit,
3043
+ control = _useForm.control,
3044
+ reset = _useForm.reset;
3045
+ var _useState = useState(false),
3046
+ loading = _useState[0],
3047
+ setLoading = _useState[1];
3048
+ useEffect(function () {
3049
+ if (!visible) {
3050
+ reset({
3051
+ paymentModeId: '',
3052
+ excessAmount: '',
3053
+ transactionId: '',
3054
+ notes: ''
3055
+ });
3056
+ }
3057
+ }, [visible, reset]);
3058
+ var onSubmit = function onSubmit(formData) {
3059
+ try {
3060
+ var _customerData$custome;
3061
+ var payload = {
3062
+ customerId: customerData === null || customerData === void 0 ? void 0 : (_customerData$custome = customerData.customerDto) === null || _customerData$custome === void 0 ? void 0 : _customerData$custome.id,
3063
+ insertedTimestamp: getUTCTime({
3064
+ time: new Date()
3065
+ }),
3066
+ paymentModeId: Number(formData === null || formData === void 0 ? void 0 : formData.paymentModeId),
3067
+ excessAmount: Number(formData === null || formData === void 0 ? void 0 : formData.excessAmount),
3068
+ storeId: defaultStoreId,
3069
+ amount: Number(formData === null || formData === void 0 ? void 0 : formData.excessAmount),
3070
+ transactionId: (formData === null || formData === void 0 ? void 0 : formData.transactionId) || null,
3071
+ notes: (formData === null || formData === void 0 ? void 0 : formData.notes) || null
3072
+ };
3073
+ var _temp = _finallyRethrows(function () {
3074
+ return _catch(function () {
3075
+ setLoading(true);
3076
+ return Promise.resolve(saveExcessPayment({
3077
+ apiEndPoint: apiEndPoint,
3078
+ token: token,
3079
+ payload: payload
3080
+ })).then(function (response) {
3081
+ onSave && onSave(payload);
3082
+ });
3083
+ }, function () {});
3084
+ }, function (_wasThrown, _result) {
3085
+ setLoading(false);
3086
+ if (_wasThrown) throw _result;
3087
+ return _result;
3088
+ });
3089
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
3090
+ } catch (e) {
3091
+ return Promise.reject(e);
3092
+ }
3093
+ };
3094
+ return /*#__PURE__*/React__default.createElement(Dialog, {
3095
+ open: visible,
3096
+ onClose: onClose,
3097
+ fullWidth: true,
3098
+ maxWidth: "sm"
3099
+ }, /*#__PURE__*/React__default.createElement(DialogTitle$1, null, "Excess Payment"), /*#__PURE__*/React__default.createElement(DialogContent, null, /*#__PURE__*/React__default.createElement(AsyncDataLoadComponent, {
3100
+ apiEndPoint: apiEndPoint,
3101
+ token: token,
3102
+ asyncService: function asyncService() {
3103
+ try {
3104
+ return Promise.resolve(getPaymentMethods({
3105
+ apiEndPoint: apiEndPoint,
3106
+ token: token
3107
+ }));
3108
+ } catch (e) {
3109
+ return Promise.reject(e);
3110
+ }
3111
+ }
3112
+ }, function (data) {
3113
+ var paymentMethods = (data === null || data === void 0 ? void 0 : data.filter(function (item) {
3114
+ return item === null || item === void 0 ? void 0 : item.ecommerce;
3115
+ })) || [];
3116
+ return /*#__PURE__*/React__default.createElement(ExcessPaymentForm, {
3117
+ loading: loading,
3118
+ paymentMethods: paymentMethods,
3119
+ control: control,
3120
+ styles: styles,
3121
+ handleSubmit: handleSubmit,
3122
+ onSubmit: onSubmit,
3123
+ onClose: onClose
3124
+ });
3125
+ })));
3126
+ };
3127
+
2834
3128
  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;
2835
3129
  var totalIcons = [{
2836
3130
  name: '',
@@ -2844,6 +3138,9 @@ var totalIcons = [{
2844
3138
  }, {
2845
3139
  name: 'Total Number Of Orders',
2846
3140
  icon: /*#__PURE__*/React__default.createElement(GiCardboardBoxClosed, null)
3141
+ }, {
3142
+ name: 'Excess Payment',
3143
+ icon: /*#__PURE__*/React__default.createElement(TbFileDollar, null)
2847
3144
  }];
2848
3145
  var Dashboard = function Dashboard(_ref) {
2849
3146
  var _customerData$custome, _selectDates$salesOrd, _selectDates$recentIn, _selectDates$salesOrd2, _selectDates$recentIn2, _customerData$custome2, _customerData$custome3, _customerData$custome4;
@@ -2874,14 +3171,18 @@ var Dashboard = function Dashboard(_ref) {
2874
3171
  showOnlyRecentOrder = _ref$showOnlyRecentOr === void 0 ? false : _ref$showOnlyRecentOr,
2875
3172
  hidePayActionButton = _ref.hidePayActionButton,
2876
3173
  hideInvoiceTab = _ref.hideInvoiceTab,
2877
- hideSalesOrderTab = _ref.hideSalesOrderTab;
3174
+ hideSalesOrderTab = _ref.hideSalesOrderTab,
3175
+ hideAddAccessPaymentButton = _ref.hideAddAccessPaymentButton;
2878
3176
  var _useState = useState({}),
2879
3177
  customerData = _useState[0],
2880
3178
  setCustomerData = _useState[1];
2881
3179
  var _useState2 = useState({}),
2882
3180
  dashboardData = _useState2[0],
2883
3181
  setDashboardData = _useState2[1];
2884
- var _useState3 = useState({
3182
+ var _useState3 = useState(),
3183
+ refetchDashboardData = _useState3[0],
3184
+ setRefetchDashboardData = _useState3[1];
3185
+ var _useState4 = useState({
2885
3186
  recentInvoices: {
2886
3187
  startDate: null,
2887
3188
  endDate: null
@@ -2891,25 +3192,24 @@ var Dashboard = function Dashboard(_ref) {
2891
3192
  endDate: null
2892
3193
  }
2893
3194
  }),
2894
- selectDates = _useState3[0],
2895
- setSelectDates = _useState3[1];
2896
- var _useState4 = useState(getRandomString()),
2897
- triggerTableData = _useState4[0],
2898
- setTriggerTableData = _useState4[1];
2899
- var _useState5 = useState({
2900
- open: false,
2901
- url: ''
2902
- }),
2903
- invoiceModal = _useState5[0],
2904
- setInvoiceModal = _useState5[1];
3195
+ selectDates = _useState4[0],
3196
+ setSelectDates = _useState4[1];
3197
+ var _useState5 = useState(getRandomString()),
3198
+ triggerTableData = _useState5[0],
3199
+ setTriggerTableData = _useState5[1];
2905
3200
  var _useState6 = useState({
2906
3201
  open: false
2907
3202
  }),
2908
3203
  isPaymentModal = _useState6[0],
2909
3204
  setIsPaymentModal = _useState6[1];
2910
- var _useState7 = useState(0),
2911
- value = _useState7[0],
2912
- setValue = _useState7[1];
3205
+ var _useState7 = useState({
3206
+ open: false
3207
+ }),
3208
+ isExcessPaymentModal = _useState7[0],
3209
+ setIsExcessPaymentModal = _useState7[1];
3210
+ var _useState8 = useState(0),
3211
+ value = _useState8[0],
3212
+ setValue = _useState8[1];
2913
3213
  useEffect(function () {
2914
3214
  if (hideSalesOrderTab) {
2915
3215
  setValue(1);
@@ -2929,10 +3229,9 @@ var Dashboard = function Dashboard(_ref) {
2929
3229
  };
2930
3230
  }
2931
3231
  var openInvoiceData = function openInvoiceData(orderId) {
2932
- serviceApiEndPoint && setInvoiceModal({
2933
- open: true,
2934
- url: serviceApiEndPoint + "/" + (value === 0 ? 'salesOrder' : 'sales-order') + "/invoice/" + orderId + "?token=" + token + "&defaultStoreId=" + defaultStoreId + "&storeIdList=" + storeIdList + "&isEcommerce=true"
2935
- });
3232
+ if (serviceApiEndPoint) {
3233
+ window.open(serviceApiEndPoint + "/" + (value === 0 ? 'salesOrder' : 'sales-order') + "/invoice/" + orderId + "?token=" + token + "&defaultStoreId=" + defaultStoreId + "&storeIdList=" + storeIdList + "&isEcommerce=true", '_blank', 'noopener,noreferrer');
3234
+ }
2936
3235
  };
2937
3236
  var onDateChange = function onDateChange(data) {
2938
3237
  var startDate = moment(data === null || data === void 0 ? void 0 : data.startDate).startOf('day');
@@ -3145,7 +3444,7 @@ var Dashboard = function Dashboard(_ref) {
3145
3444
  Promise.reject(e);
3146
3445
  }
3147
3446
  })();
3148
- }, []);
3447
+ }, [refetchDashboardData]);
3149
3448
  useEffect(function () {
3150
3449
  try {
3151
3450
  try {
@@ -3198,6 +3497,30 @@ var Dashboard = function Dashboard(_ref) {
3198
3497
  orderId: isPaymentModal === null || isPaymentModal === void 0 ? void 0 : isPaymentModal.orderId,
3199
3498
  setTriggerTableData: setTriggerTableData,
3200
3499
  styles: styles
3500
+ }), (isExcessPaymentModal === null || isExcessPaymentModal === void 0 ? void 0 : isExcessPaymentModal.open) && /*#__PURE__*/React__default.createElement(ExcessPaymentDialog, {
3501
+ customerData: customerData,
3502
+ apiEndPoint: apiEndPoint,
3503
+ token: token,
3504
+ defaultStoreId: defaultStoreId,
3505
+ styles: styles,
3506
+ onSave: function onSave(payload) {
3507
+ try {
3508
+ setRefetchDashboardData(getRandomString());
3509
+ alert("Excess Payment $" + (payload === null || payload === void 0 ? void 0 : payload.excessAmount) + " added successfully");
3510
+ setIsExcessPaymentModal({
3511
+ open: false
3512
+ });
3513
+ return Promise.resolve();
3514
+ } catch (e) {
3515
+ return Promise.reject(e);
3516
+ }
3517
+ },
3518
+ visible: isExcessPaymentModal === null || isExcessPaymentModal === void 0 ? void 0 : isExcessPaymentModal.open,
3519
+ onClose: function onClose() {
3520
+ return setIsExcessPaymentModal({
3521
+ open: false
3522
+ });
3523
+ }
3201
3524
  }), /*#__PURE__*/React__default.createElement(Grid, {
3202
3525
  container: true,
3203
3526
  columnSpacing: 4
@@ -3215,7 +3538,8 @@ var Dashboard = function Dashboard(_ref) {
3215
3538
  spacing: 3
3216
3539
  }, totalDataSource === null || totalDataSource === void 0 ? void 0 : totalDataSource.map(function (data) {
3217
3540
  var _data$name, _data$name2, _data$name3, _totalIcons$find;
3218
- 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;
3541
+ 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';
3542
+ var isExcessPayment = (data === null || data === void 0 ? void 0 : data.name) === 'Excess Payment';
3219
3543
  return /*#__PURE__*/React__default.createElement(Grid, {
3220
3544
  item: true,
3221
3545
  xs: 12,
@@ -3235,7 +3559,23 @@ var Dashboard = function Dashboard(_ref) {
3235
3559
  className: "icon-container"
3236
3560
  }, (totalIcons === null || totalIcons === void 0 ? void 0 : (_totalIcons$find = totalIcons.find(function (icons) {
3237
3561
  return (icons === null || icons === void 0 ? void 0 : icons.name) === (data === null || data === void 0 ? void 0 : data.name);
3238
- })) === null || _totalIcons$find === void 0 ? void 0 : _totalIcons$find.icon) || (isAmount ? /*#__PURE__*/React__default.createElement(MdMonetizationOn, null) : /*#__PURE__*/React__default.createElement(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)))));
3562
+ })) === null || _totalIcons$find === void 0 ? void 0 : _totalIcons$find.icon) || (isAmount ? /*#__PURE__*/React__default.createElement(MdMonetizationOn, null) : /*#__PURE__*/React__default.createElement(GrStackOverflow, null))), /*#__PURE__*/React__default.createElement("div", {
3563
+ style: {
3564
+ flex: 1
3565
+ }
3566
+ }, /*#__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(Tooltip, {
3567
+ title: "Add Excess Payment",
3568
+ arrow: true
3569
+ }, /*#__PURE__*/React__default.createElement(AddExcessPaymentButton, {
3570
+ className: "add-excess-payment-btn",
3571
+ primaryColor: primaryColor,
3572
+ onClick: function onClick() {
3573
+ return setIsExcessPaymentModal({
3574
+ open: true
3575
+ });
3576
+ },
3577
+ "aria-label": "Add excess payment"
3578
+ }, /*#__PURE__*/React__default.createElement(MdAdd, null), /*#__PURE__*/React__default.createElement("span", null, "Add")))));
3239
3579
  }))), !hideBannerSection && /*#__PURE__*/React__default.createElement(BannerContainer, null, /*#__PURE__*/React__default.createElement(Grid, {
3240
3580
  container: true,
3241
3581
  spacing: 3,
@@ -3314,20 +3654,7 @@ var Dashboard = function Dashboard(_ref) {
3314
3654
  style: {
3315
3655
  marginTop: '1rem'
3316
3656
  }
3317
- })))))), /*#__PURE__*/React__default.createElement(TableContainer, null, /*#__PURE__*/React__default.createElement(InvoiceDialog, {
3318
- onClose: function onClose() {
3319
- return setInvoiceModal({
3320
- open: false
3321
- });
3322
- },
3323
- "aria-labelledby": "customized-dialog-title",
3324
- open: invoiceModal === null || invoiceModal === void 0 ? void 0 : invoiceModal.open,
3325
- maxWidth: "lg"
3326
- }, /*#__PURE__*/React__default.createElement(DialogContent, {
3327
- dividers: true
3328
- }, /*#__PURE__*/React__default.createElement("iframe", {
3329
- src: invoiceModal.url
3330
- }))), /*#__PURE__*/React__default.createElement(APITable, {
3657
+ })))))), /*#__PURE__*/React__default.createElement(TableContainer, null, /*#__PURE__*/React__default.createElement(APITable, {
3331
3658
  key: value,
3332
3659
  cacheFilters: true,
3333
3660
  extraFilterParams: value === 0 ? selectDates.recentInvoices : selectDates.salesOrders,
@@ -3554,10 +3881,12 @@ var SocialIconContainer = styled.a(_templateObject8$1 || (_templateObject8$1 = _
3554
3881
  });
3555
3882
  var ImageContainer = styled(CardMedia)(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteralLoose(["\n max-width: 100%;\n border-radius: 14px;\n img {\n max-width: 100%;\n }\n"])));
3556
3883
  var TotalRoot = styled.div(_templateObject10$1 || (_templateObject10$1 = _taggedTemplateLiteralLoose(["\n margin: 2rem 0;\n"])));
3557
- var TotalContainer = styled(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) {
3884
+ var TotalContainer = styled(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) {
3558
3885
  return props.secondaryColor;
3559
3886
  }, function (props) {
3560
3887
  return props.primaryColor;
3888
+ }, function (props) {
3889
+ return props.primaryColor;
3561
3890
  }, function (props) {
3562
3891
  return props.fontColor;
3563
3892
  }, function (props) {
@@ -3567,12 +3896,15 @@ var TotalContainer = styled(Stack)(_templateObject11$1 || (_templateObject11$1 =
3567
3896
  }, function (props) {
3568
3897
  return props.primaryColor;
3569
3898
  });
3570
- var BannerContainer = styled(Stack)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteralLoose([""])));
3571
- var CategoryContainer = styled.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n padding: 1.8rem;\n border-radius: 14px;\n"])), function (props) {
3899
+ var AddExcessPaymentButton = styled.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) {
3900
+ return props.primaryColor;
3901
+ });
3902
+ var BannerContainer = styled(Stack)(_templateObject13 || (_templateObject13 = _taggedTemplateLiteralLoose([""])));
3903
+ var CategoryContainer = styled.div(_templateObject14 || (_templateObject14 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n padding: 1.8rem;\n border-radius: 14px;\n"])), function (props) {
3572
3904
  var _props$theme;
3573
3905
  return (_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.primaryColor;
3574
3906
  });
3575
- var CategoryText = styled.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) {
3907
+ var CategoryText = styled.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) {
3576
3908
  var _props$theme2;
3577
3909
  return (_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.secondaryColor;
3578
3910
  }, function (props) {
@@ -3582,18 +3914,17 @@ var CategoryText = styled.div(_templateObject14 || (_templateObject14 = _taggedT
3582
3914
  var _props$theme4;
3583
3915
  return (_props$theme4 = props.theme) === null || _props$theme4 === void 0 ? void 0 : _props$theme4.primaryColor;
3584
3916
  });
3585
- var DiscoverContainer = styled.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) {
3917
+ var DiscoverContainer = styled.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) {
3586
3918
  var _props$theme5, _props$theme6, _props$theme7;
3587
3919
  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)";
3588
3920
  }, function (props) {
3589
3921
  var _props$theme8;
3590
3922
  return (_props$theme8 = props.theme) === null || _props$theme8 === void 0 ? void 0 : _props$theme8.fontColor;
3591
3923
  });
3592
- var StatusContainer = styled(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) {
3924
+ var StatusContainer = styled(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) {
3593
3925
  return props.primaryColor;
3594
3926
  });
3595
- var TableContainer = styled.div(_templateObject17 || (_templateObject17 = _taggedTemplateLiteralLoose(["\n margin-top: 2rem;\n border-radius: 14px;\n"])));
3596
- var InvoiceDialog = styled(Dialog)(_templateObject18 || (_templateObject18 = _taggedTemplateLiteralLoose(["\n iframe {\n width: 900px;\n border: none;\n height: 600px;\n }\n"])));
3927
+ var TableContainer = styled.div(_templateObject18 || (_templateObject18 = _taggedTemplateLiteralLoose(["\n margin-top: 2rem;\n border-radius: 14px;\n"])));
3597
3928
  var TabsContainer = styled(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) {
3598
3929
  return props.fontColor;
3599
3930
  }, function (props) {
@@ -5285,20 +5616,6 @@ var getDocumentTypes = function getDocumentTypes(_ref3) {
5285
5616
  }
5286
5617
  };
5287
5618
 
5288
- var getUpcomingAchPayments = function getUpcomingAchPayments(_ref) {
5289
- var apiEndPoint = _ref.apiEndPoint,
5290
- token = _ref.token;
5291
- try {
5292
- return Promise.resolve(API({
5293
- url: '/ecommerce/order/payment/upcoming-auto-ach',
5294
- apiEndPoint: apiEndPoint,
5295
- token: token
5296
- }));
5297
- } catch (e) {
5298
- return Promise.reject(e);
5299
- }
5300
- };
5301
-
5302
5619
  var _templateObject$l;
5303
5620
  var columns = [{
5304
5621
  id: 'orderId',
@@ -5362,7 +5679,7 @@ var UpcomingACHPayments = function UpcomingACHPayments(_ref) {
5362
5679
  var TableContainer$2 = styled.div(_templateObject$l || (_templateObject$l = _taggedTemplateLiteralLoose(["\n margin: 1.2rem 0;\n border-radius: 14px;\n"])));
5363
5680
 
5364
5681
  var _templateObject$m, _templateObject2$d, _templateObject3$9, _templateObject4$7;
5365
- 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"];
5682
+ 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"];
5366
5683
  var AccountDetails = function AccountDetails(_ref) {
5367
5684
  var _storeData$map, _storeData$find, _storeData$;
5368
5685
  var apiEndPoint = _ref.apiEndPoint,
@@ -5396,6 +5713,8 @@ var AccountDetails = function AccountDetails(_ref) {
5396
5713
  hideSalesOrderTab = _ref$hideSalesOrderTa === void 0 ? false : _ref$hideSalesOrderTa,
5397
5714
  _ref$hideInvoiceTab = _ref.hideInvoiceTab,
5398
5715
  hideInvoiceTab = _ref$hideInvoiceTab === void 0 ? false : _ref$hideInvoiceTab,
5716
+ _ref$hideAddAccessPay = _ref.hideAddAccessPaymentButton,
5717
+ hideAddAccessPaymentButton = _ref$hideAddAccessPay === void 0 ? false : _ref$hideAddAccessPay,
5399
5718
  props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
5400
5719
  var _useAllSystemFeatureV = useAllSystemFeatureValues({
5401
5720
  apiEndPoint: apiEndPoint,
@@ -5569,7 +5888,8 @@ var AccountDetails = function AccountDetails(_ref) {
5569
5888
  showOnlyRecentOrder: showOnlyRecentOrder,
5570
5889
  hidePayActionButton: hidePayActionButton,
5571
5890
  hideSalesOrderTab: hideSalesOrderTab,
5572
- hideInvoiceTab: hideInvoiceTab
5891
+ hideInvoiceTab: hideInvoiceTab,
5892
+ hideAddAccessPaymentButton: hideAddAccessPaymentButton
5573
5893
  });
5574
5894
  case 'myProfile':
5575
5895
  return /*#__PURE__*/React__default.createElement(MyProfile, {
@@ -5786,83 +6106,6 @@ var TypographyContainer$7 = styled(Typography)(_templateObject4$7 || (_templateO
5786
6106
  return props.fontColor;
5787
6107
  });
5788
6108
 
5789
- var AsyncDataLoad = function AsyncDataLoad(_ref) {
5790
- var apiEndPoint = _ref.apiEndPoint,
5791
- token = _ref.token,
5792
- children = _ref.children,
5793
- onError = _ref.onError,
5794
- skeletonHeight = _ref.skeletonHeight,
5795
- loadingView = _ref.loadingView,
5796
- errorView = _ref.errorView,
5797
- asyncService = _ref.asyncService,
5798
- triggerChange = _ref.triggerChange,
5799
- apiConfig = _ref.apiConfig;
5800
- var _useState = useState({
5801
- status: 'loading',
5802
- data: {}
5803
- }),
5804
- apiState = _useState[0],
5805
- setApiState = _useState[1];
5806
- var getAPIData = function getAPIData() {
5807
- try {
5808
- var _temp3 = _catch(function () {
5809
- function _temp2() {
5810
- setApiState({
5811
- status: API_STATUSES.SUCCESS,
5812
- data: data
5813
- });
5814
- }
5815
- setApiState({
5816
- status: API_STATUSES.LOADING,
5817
- data: {}
5818
- });
5819
- var data;
5820
- var _temp = function () {
5821
- if (asyncService) {
5822
- return Promise.resolve(asyncService()).then(function (_asyncService) {
5823
- data = _asyncService;
5824
- });
5825
- } else {
5826
- return Promise.resolve(API(_extends({
5827
- apiEndPoint: apiEndPoint,
5828
- token: token,
5829
- hideErrorMessage: true
5830
- }, apiConfig))).then(function (_API) {
5831
- data = _API;
5832
- });
5833
- }
5834
- }();
5835
- return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
5836
- }, function (e) {
5837
- setApiState({
5838
- status: API_STATUSES.ERROR,
5839
- data: {}
5840
- });
5841
- if (onError) {
5842
- onError(e);
5843
- }
5844
- });
5845
- return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
5846
- } catch (e) {
5847
- return Promise.reject(e);
5848
- }
5849
- };
5850
- useEffect(function () {
5851
- if (apiConfig || asyncService) {
5852
- (function () {
5853
- return getAPIData();
5854
- })();
5855
- }
5856
- }, [apiConfig, triggerChange]);
5857
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, apiState.status === API_STATUSES.LOADING ? loadingView ? loadingView : /*#__PURE__*/React__default.createElement(Loader, {
5858
- skeleton: skeletonHeight,
5859
- height: skeletonHeight
5860
- }) : null, apiState.status === API_STATUSES.SUCCESS ? typeof children === 'function' ? children(apiState.data) : {
5861
- children: children
5862
- } : null, apiState.status === API_STATUSES.ERROR ? errorView ? errorView : 'NO DATA' : null);
5863
- };
5864
- var AsyncDataLoadComponent = memo(AsyncDataLoad);
5865
-
5866
6109
  var _templateObject$n, _templateObject2$e, _templateObject3$a;
5867
6110
  var BannerImages = function BannerImages(_ref) {
5868
6111
  var config = _ref.config,