@salesgenterp/ui-components 0.4.465 → 0.4.467

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
@@ -2764,7 +2764,7 @@ var InfoContainer = styled__default.div(_templateObject$9 || (_templateObject$9
2764
2764
  return props.fontColor;
2765
2765
  });
2766
2766
 
2767
- 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;
2767
+ 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;
2768
2768
  var totalIcons = [{
2769
2769
  name: '',
2770
2770
  icon: /*#__PURE__*/React__default.createElement(ai.AiOutlineShoppingCart, null)
@@ -2779,7 +2779,7 @@ var totalIcons = [{
2779
2779
  icon: /*#__PURE__*/React__default.createElement(gi.GiCardboardBoxClosed, null)
2780
2780
  }];
2781
2781
  var Dashboard = function Dashboard(_ref) {
2782
- var _customerData$custome, _customerData$custome2, _customerData$custome3, _customerData$custome4;
2782
+ var _customerData$custome, _selectDates$recentIn, _selectDates$salesOrd, _selectDates$recentIn2, _selectDates$salesOrd2, _customerData$custome2, _customerData$custome3, _customerData$custome4;
2783
2783
  var apiEndPoint = _ref.apiEndPoint,
2784
2784
  serviceApiEndPoint = _ref.serviceApiEndPoint,
2785
2785
  token = _ref.token,
@@ -2804,14 +2804,24 @@ var Dashboard = function Dashboard(_ref) {
2804
2804
  removeSocialLinks = _ref.removeSocialLinks,
2805
2805
  hideTotalCardInDashboardSummary = _ref.hideTotalCardInDashboardSummary,
2806
2806
  _ref$showOnlyRecentOr = _ref.showOnlyRecentOrder,
2807
- showOnlyRecentOrder = _ref$showOnlyRecentOr === void 0 ? false : _ref$showOnlyRecentOr;
2807
+ showOnlyRecentOrder = _ref$showOnlyRecentOr === void 0 ? false : _ref$showOnlyRecentOr,
2808
+ hidePayActionButton = _ref.hidePayActionButton;
2808
2809
  var _useState = React.useState({}),
2809
2810
  customerData = _useState[0],
2810
2811
  setCustomerData = _useState[1];
2811
2812
  var _useState2 = React.useState({}),
2812
2813
  dashboardData = _useState2[0],
2813
2814
  setDashboardData = _useState2[1];
2814
- var _useState3 = React.useState({}),
2815
+ var _useState3 = React.useState({
2816
+ recentInvoices: {
2817
+ startDate: null,
2818
+ endDate: null
2819
+ },
2820
+ salesOrders: {
2821
+ startDate: null,
2822
+ endDate: null
2823
+ }
2824
+ }),
2815
2825
  selectDates = _useState3[0],
2816
2826
  setSelectDates = _useState3[1];
2817
2827
  var _useState4 = React.useState(getRandomString()),
@@ -2828,20 +2838,37 @@ var Dashboard = function Dashboard(_ref) {
2828
2838
  }),
2829
2839
  isPaymentModal = _useState6[0],
2830
2840
  setIsPaymentModal = _useState6[1];
2841
+ var _useState7 = React.useState(0),
2842
+ value = _useState7[0],
2843
+ setValue = _useState7[1];
2844
+ var handleChange = function handleChange(event, newValue) {
2845
+ setValue(newValue);
2846
+ setTriggerTableData(getRandomString());
2847
+ };
2848
+ function a11yProps(index) {
2849
+ return {
2850
+ id: "simple-tab-" + index,
2851
+ 'aria-controls': "simple-tabpanel-" + index
2852
+ };
2853
+ }
2831
2854
  var openInvoiceData = function openInvoiceData(orderId) {
2832
2855
  serviceApiEndPoint && setInvoiceModal({
2833
2856
  open: true,
2834
- url: serviceApiEndPoint + "/sales-order/invoice/" + orderId + "?token=" + token + "&defaultStoreId=" + defaultStoreId + "&storeIdList=" + storeIdList + "&isEcommerce=true"
2857
+ url: serviceApiEndPoint + "/" + (value === 0 ? 'sales-order' : 'salesOrder') + "/invoice/" + orderId + "?token=" + token + "&defaultStoreId=" + defaultStoreId + "&storeIdList=" + storeIdList + "&isEcommerce=true"
2835
2858
  });
2836
2859
  };
2837
2860
  var onDateChange = function onDateChange(data) {
2838
- setSelectDates({
2861
+ var newDates = {
2839
2862
  startDate: getUTCTime({
2840
2863
  time: data === null || data === void 0 ? void 0 : data.startDate
2841
2864
  }),
2842
2865
  endDate: getUTCTime({
2843
2866
  time: data === null || data === void 0 ? void 0 : data.endDate
2844
2867
  })
2868
+ };
2869
+ setSelectDates(function (prev) {
2870
+ var _extends2;
2871
+ return _extends({}, prev, (_extends2 = {}, _extends2[value === 0 ? 'recentInvoices' : 'salesOrders'] = newDates, _extends2));
2845
2872
  });
2846
2873
  setTriggerTableData(getRandomString());
2847
2874
  };
@@ -2948,7 +2975,7 @@ var Dashboard = function Dashboard(_ref) {
2948
2975
  style: {
2949
2976
  fontSize: '1.6rem'
2950
2977
  }
2951
- })), payInvoiceFromDashboard && /*#__PURE__*/React__default.createElement(MuiButton, {
2978
+ })), payInvoiceFromDashboard && !hidePayActionButton && /*#__PURE__*/React__default.createElement(MuiButton, {
2952
2979
  onClick: function onClick() {
2953
2980
  setIsPaymentModal({
2954
2981
  open: true,
@@ -2960,6 +2987,72 @@ var Dashboard = function Dashboard(_ref) {
2960
2987
  }, "Pay"));
2961
2988
  }
2962
2989
  }];
2990
+ var salesOrderColumns = [{
2991
+ id: 'salesOrderId',
2992
+ label: 'SO #'
2993
+ }, {
2994
+ id: 'orderId',
2995
+ label: 'Invoice #'
2996
+ }, {
2997
+ id: 'insertedTimestamp',
2998
+ label: 'Date',
2999
+ format: function format(value) {
3000
+ return getLocalTime({
3001
+ time: value
3002
+ });
3003
+ }
3004
+ }, {
3005
+ id: 'totalQuantity',
3006
+ label: 'Total Quantity'
3007
+ }, {
3008
+ id: 'totalAmount',
3009
+ label: 'Total Amount',
3010
+ format: function format(value) {
3011
+ return renderMoney(value);
3012
+ }
3013
+ }, {
3014
+ id: 'status',
3015
+ label: 'Status',
3016
+ format: function format(value) {
3017
+ return /*#__PURE__*/React__default.createElement(material.Grid, {
3018
+ container: true
3019
+ }, /*#__PURE__*/React__default.createElement(StatusContainer, {
3020
+ item: true,
3021
+ primaryColor: primaryColor
3022
+ }, value));
3023
+ }
3024
+ }, !hideInvoiceAction && {
3025
+ id: 'salesOrderId',
3026
+ label: 'Action',
3027
+ align: 'center',
3028
+ format: function format(value, record) {
3029
+ return /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(material.IconButton, {
3030
+ onClick: function onClick() {
3031
+ return openInvoiceData(value);
3032
+ },
3033
+ style: {
3034
+ color: primaryColor,
3035
+ padding: 2
3036
+ }
3037
+ }, /*#__PURE__*/React__default.createElement(md.MdRemoveRedEye, {
3038
+ style: {
3039
+ fontSize: '1.6rem'
3040
+ }
3041
+ })), /*#__PURE__*/React__default.createElement(material.IconButton, {
3042
+ onClick: function onClick() {
3043
+ return downloadInvoice(value);
3044
+ },
3045
+ style: {
3046
+ color: primaryColor,
3047
+ padding: 2
3048
+ }
3049
+ }, /*#__PURE__*/React__default.createElement(md.MdOutlineFileDownload, {
3050
+ style: {
3051
+ fontSize: '1.6rem'
3052
+ }
3053
+ })));
3054
+ }
3055
+ }];
2963
3056
  React.useEffect(function () {
2964
3057
  (function () {
2965
3058
  try {
@@ -3168,13 +3261,32 @@ var Dashboard = function Dashboard(_ref) {
3168
3261
  }, /*#__PURE__*/React__default.createElement("iframe", {
3169
3262
  src: invoiceModal.url
3170
3263
  }))), /*#__PURE__*/React__default.createElement(APITable, {
3264
+ key: value,
3171
3265
  cacheFilters: true,
3172
- extraFilterParams: selectDates,
3266
+ extraFilterParams: value === 0 ? selectDates.recentInvoices : selectDates.salesOrders,
3173
3267
  tableHeaderContent: /*#__PURE__*/React__default.createElement(material.Grid, {
3174
3268
  container: true,
3175
3269
  justifyContent: "space-between",
3176
3270
  alignItems: "center"
3177
- }, /*#__PURE__*/React__default.createElement(TypographyContainer$2, {
3271
+ }, /*#__PURE__*/React__default.createElement(material.Grid, {
3272
+ item: true,
3273
+ xs: 12
3274
+ }, /*#__PURE__*/React__default.createElement(material.Box, {
3275
+ sx: {
3276
+ borderBottom: 1,
3277
+ borderColor: 'divider'
3278
+ }
3279
+ }, /*#__PURE__*/React__default.createElement(TabsContainer, {
3280
+ value: value,
3281
+ onChange: handleChange,
3282
+ "aria-label": "basic tabs example",
3283
+ primaryColor: primaryColor,
3284
+ fontColor: fontColor
3285
+ }, /*#__PURE__*/React__default.createElement(material.Tab, _extends({
3286
+ label: "Recent Invoices"
3287
+ }, a11yProps(0))), /*#__PURE__*/React__default.createElement(material.Tab, _extends({
3288
+ label: "Sales Orders"
3289
+ }, a11yProps(1)))))), /*#__PURE__*/React__default.createElement(TypographyContainer$2, {
3178
3290
  variant: "h4",
3179
3291
  gutterBottom: true,
3180
3292
  fontColor: fontColor,
@@ -3184,14 +3296,14 @@ var Dashboard = function Dashboard(_ref) {
3184
3296
  padding: '1rem 0',
3185
3297
  margin: 0
3186
3298
  }
3187
- }, "Recent Invoices"), /*#__PURE__*/React__default.createElement(material.Grid, {
3299
+ }, value === 0 ? 'Recent Invoices' : 'Sales orders'), /*#__PURE__*/React__default.createElement(material.Grid, {
3188
3300
  item: true
3189
3301
  }, /*#__PURE__*/React__default.createElement(DateRangePicker, {
3190
3302
  fontColor: fontColor,
3191
3303
  primaryColor: primaryColor,
3192
3304
  onChange: onDateChange,
3193
- initialStartDate: null,
3194
- initialEndDate: null
3305
+ initialStartDate: value === 0 ? selectDates === null || selectDates === void 0 ? void 0 : (_selectDates$recentIn = selectDates.recentInvoices) === null || _selectDates$recentIn === void 0 ? void 0 : _selectDates$recentIn.startDate : selectDates === null || selectDates === void 0 ? void 0 : (_selectDates$salesOrd = selectDates.salesOrders) === null || _selectDates$salesOrd === void 0 ? void 0 : _selectDates$salesOrd.startDate,
3306
+ initialEndDate: value === 0 ? selectDates === null || selectDates === void 0 ? void 0 : (_selectDates$recentIn2 = selectDates.recentInvoices) === null || _selectDates$recentIn2 === void 0 ? void 0 : _selectDates$recentIn2.endDate : selectDates === null || selectDates === void 0 ? void 0 : (_selectDates$salesOrd2 = selectDates.salesOrders) === null || _selectDates$salesOrd2 === void 0 ? void 0 : _selectDates$salesOrd2.endDate
3195
3307
  }))),
3196
3308
  listUpdate: triggerTableData,
3197
3309
  pagination: false,
@@ -3199,9 +3311,9 @@ var Dashboard = function Dashboard(_ref) {
3199
3311
  x: 1000
3200
3312
  },
3201
3313
  tableId: "master-child-map",
3202
- columns: columns,
3314
+ columns: value === 0 ? columns : salesOrderColumns,
3203
3315
  apiData: {
3204
- url: "/ecommerce/dashboard/orderTable",
3316
+ url: "/ecommerce/dashboard/" + (value === 0 ? 'orderTable' : 'salesOrderTable'),
3205
3317
  apiEndPoint: apiEndPoint,
3206
3318
  token: token
3207
3319
  },
@@ -3409,6 +3521,13 @@ var StatusContainer = styled__default(material.Stack)(_templateObject16 || (_tem
3409
3521
  });
3410
3522
  var TableContainer = styled__default.div(_templateObject17 || (_templateObject17 = _taggedTemplateLiteralLoose(["\n margin-top: 2rem;\n border-radius: 14px;\n"])));
3411
3523
  var InvoiceDialog = styled__default(material.Dialog)(_templateObject18 || (_templateObject18 = _taggedTemplateLiteralLoose(["\n iframe {\n width: 900px;\n border: none;\n height: 600px;\n }\n"])));
3524
+ 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) {
3525
+ return props.fontColor;
3526
+ }, function (props) {
3527
+ return props.primaryColor;
3528
+ }, function (props) {
3529
+ return props.primaryColor;
3530
+ });
3412
3531
 
3413
3532
  var _templateObject$b, _templateObject2$6, _templateObject3$4, _templateObject4$3, _templateObject5$2;
3414
3533
  var MyProfile = function MyProfile(_ref) {
@@ -4628,7 +4747,7 @@ var StoreTabs = function StoreTabs(_ref) {
4628
4747
  borderBottom: 1,
4629
4748
  borderColor: 'divider'
4630
4749
  }
4631
- }, /*#__PURE__*/React__default.createElement(TabsContainer, {
4750
+ }, /*#__PURE__*/React__default.createElement(TabsContainer$1, {
4632
4751
  value: value,
4633
4752
  onChange: handleChange,
4634
4753
  "aria-label": "basic tabs example",
@@ -4651,7 +4770,7 @@ var StoreTabs = function StoreTabs(_ref) {
4651
4770
  customer: customer
4652
4771
  })))));
4653
4772
  };
4654
- var TabsContainer = styled__default(material.Tabs)(_templateObject$i || (_templateObject$i = _taggedTemplateLiteralLoose(["\n button {\n color: ", " !important;\n font-size: 1.1rem;\n }\n .Mui-selected {\n color: ", " !important;\n }\n .MuiTabs-indicator {\n background-color: ", " !important;\n }\n"])), function (props) {
4773
+ var TabsContainer$1 = styled__default(material.Tabs)(_templateObject$i || (_templateObject$i = _taggedTemplateLiteralLoose(["\n button {\n color: ", " !important;\n font-size: 1.1rem;\n }\n .Mui-selected {\n color: ", " !important;\n }\n .MuiTabs-indicator {\n background-color: ", " !important;\n }\n"])), function (props) {
4655
4774
  return props.fontColor;
4656
4775
  }, function (props) {
4657
4776
  return props.primaryColor;
@@ -4739,7 +4858,9 @@ var AccountDetails = function AccountDetails(_ref) {
4739
4858
  _ref$hideTotalCardInD = _ref.hideTotalCardInDashboardSummary,
4740
4859
  hideTotalCardInDashboardSummary = _ref$hideTotalCardInD === void 0 ? false : _ref$hideTotalCardInD,
4741
4860
  _ref$showOnlyRecentOr = _ref.showOnlyRecentOrder,
4742
- showOnlyRecentOrder = _ref$showOnlyRecentOr === void 0 ? false : _ref$showOnlyRecentOr;
4861
+ showOnlyRecentOrder = _ref$showOnlyRecentOr === void 0 ? false : _ref$showOnlyRecentOr,
4862
+ _ref$hidePayActionBut = _ref.hidePayActionButton,
4863
+ hidePayActionButton = _ref$hidePayActionBut === void 0 ? false : _ref$hidePayActionBut;
4743
4864
  var _useAllSystemFeatureV = useAllSystemFeatureValues({
4744
4865
  apiEndPoint: apiEndPoint,
4745
4866
  token: token
@@ -4908,7 +5029,8 @@ var AccountDetails = function AccountDetails(_ref) {
4908
5029
  payInvoiceFromDashboard: authoriseDotNet,
4909
5030
  removeSocialLinks: removeSocialLinks,
4910
5031
  hideTotalCardInDashboardSummary: hideTotalCardInDashboardSummary,
4911
- showOnlyRecentOrder: showOnlyRecentOrder
5032
+ showOnlyRecentOrder: showOnlyRecentOrder,
5033
+ hidePayActionButton: hidePayActionButton
4912
5034
  });
4913
5035
  case 'myProfile':
4914
5036
  return /*#__PURE__*/React__default.createElement(MyProfile, {
@@ -13071,7 +13193,7 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
13071
13193
  try {
13072
13194
  var taxAmount = totalTaxAmount || 0;
13073
13195
  var _temp11 = function (_cartData$cartLineIte) {
13074
- if (shippingAddressId && (cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.length) > 0 && shippingAddressId !== previousShippingAddressIdRef.current) {
13196
+ if (shippingAddressId && (cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.length) > 0 && shippingAddressId && (shippingAddressId !== previousShippingAddressIdRef.current || (cartData === null || cartData === void 0 ? void 0 : cartData.cartSubTotal) !== previousSubTotalRef.current)) {
13075
13197
  previousShippingAddressIdRef.current = shippingAddressId;
13076
13198
  var _temp10 = _catch(function () {
13077
13199
  return Promise.resolve(getTaxData({