@bjsdistribution/dms-client-return 0.0.80 → 0.0.81

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.
@@ -3,6 +3,7 @@ interface Filter {
3
3
  field: string;
4
4
  op: string;
5
5
  value: any;
6
+ join?: any;
6
7
  }
7
8
  interface Pagination {
8
9
  page: number;
@@ -11588,23 +11588,119 @@ var TablesContainer = /*#__PURE__*/styled__default.div(_templateObject4$v || (_t
11588
11588
  var _templateObject2$1A;
11589
11589
  var StyledBulkItem = /*#__PURE__*/styled__default.div(_templateObject2$1A || (_templateObject2$1A = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 8px 12px;\n display: flex;\n align-items: center;\n /* border-right: 1px solid #d0d5dd; */\n gap: 8px;\n cursor: pointer;\n position: relative;\n\n @media screen and (max-width: 1030px) {\n padding: 8px 11px;\n }\n\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n box-sizing: border-box;\n top: 54px;\n }\n &:last-child {\n border-right: none;\n }\n &.active svg.arrowDown {\n transform: rotate(180deg);\n }\n label {\n color: #6a7378;\n text-align: center;\n font-family: 'Open Sans';\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 18px;\n cursor: pointer;\n }\n\n &.noPadding {\n padding: 0;\n }\n"])));
11590
11590
 
11591
- var _templateObject$26, _templateObject2$1B;
11591
+ var initialState$3 = {
11592
+ 'x-filters': [],
11593
+ 'x-pagination': {
11594
+ page: 1,
11595
+ per_page: 50
11596
+ }
11597
+ };
11598
+ var filterReducer$2 = function filterReducer(state, action) {
11599
+ switch (action.type) {
11600
+ case 'SET_COMP_RETURN_FILTERS':
11601
+ return _extends({}, state, {
11602
+ 'x-filters': [].concat(state['x-filters'].filter(function (f) {
11603
+ return f.field !== 'customer_name' && f.field !== 'trading_as';
11604
+ }), [{
11605
+ field: 'customer_name',
11606
+ op: 'like',
11607
+ value: "%" + action.payload + "%",
11608
+ join: 'or'
11609
+ }, {
11610
+ field: 'trading_as',
11611
+ op: 'like',
11612
+ value: "%" + action.payload + "%",
11613
+ join: 'or'
11614
+ }]),
11615
+ 'x-pagination': _extends({}, state['x-pagination'], {
11616
+ page: 1
11617
+ })
11618
+ });
11619
+ case 'CLEAR_SEARCH':
11620
+ return _extends({}, state, {
11621
+ 'x-filters': [].concat(initialState$3['x-filters']),
11622
+ 'x-pagination': _extends({}, initialState$3['x-pagination'], {
11623
+ page: 1
11624
+ })
11625
+ });
11626
+ case 'CLEAR_ALL_FILTER':
11627
+ return _extends({}, state);
11628
+ case 'SET_PAGE':
11629
+ return _extends({}, state, {
11630
+ 'x-pagination': _extends({}, state['x-pagination'], {
11631
+ page: action.payload
11632
+ })
11633
+ });
11634
+ case 'SET_PERPAGE':
11635
+ return _extends({}, state, {
11636
+ 'x-pagination': _extends({}, state['x-pagination'], {
11637
+ per_page: action.payload
11638
+ })
11639
+ });
11640
+ case 'CLEAR_FILTERS':
11641
+ return _extends({}, state);
11642
+ case 'CLEAR_ALL_FILTER':
11643
+ return _extends({}, state);
11644
+ default:
11645
+ return state;
11646
+ }
11647
+ };
11648
+ var filtersStateAtom$2 = /*#__PURE__*/jotai.atom(initialState$3);
11649
+ var overviewfiltersReducerAtom = /*#__PURE__*/jotai.atom(function (get) {
11650
+ return get(filtersStateAtom$2);
11651
+ }, function (get, set, action) {
11652
+ return set(filtersStateAtom$2, filterReducer$2(get(filtersStateAtom$2), action));
11653
+ });
11654
+
11655
+ var _templateObject$26, _templateObject2$1B, _templateObject3$T;
11592
11656
  var SearchType = function SearchType() {
11593
11657
  var _useState = React.useState(''),
11594
11658
  searchText = _useState[0],
11595
11659
  setSearchText = _useState[1];
11660
+ var _useState2 = React.useState(''),
11661
+ debouncedSearchText = _useState2[0],
11662
+ setDebouncedSearchText = _useState2[1];
11663
+ var _useAtom = jotai.useAtom(overviewfiltersReducerAtom),
11664
+ dispatch = _useAtom[1];
11596
11665
  var handleInputChange = function handleInputChange(event) {
11597
11666
  setSearchText(event.target.value);
11598
11667
  };
11668
+ // Debouncing effect
11669
+ React.useEffect(function () {
11670
+ var handler = setTimeout(function () {
11671
+ setDebouncedSearchText(searchText);
11672
+ }, 1000);
11673
+ return function () {
11674
+ clearTimeout(handler);
11675
+ };
11676
+ }, [searchText]);
11677
+ React.useEffect(function () {
11678
+ if (debouncedSearchText) {
11679
+ dispatch({
11680
+ type: 'SET_COMP_RETURN_FILTERS',
11681
+ payload: debouncedSearchText
11682
+ });
11683
+ }
11684
+ }, [debouncedSearchText, dispatch]);
11685
+ var handleClear = function handleClear() {
11686
+ setSearchText('');
11687
+ dispatch({
11688
+ type: 'CLEAR_SEARCH'
11689
+ });
11690
+ };
11599
11691
  return React__default.createElement(Search, null, React__default.createElement(SearchIcon, null), React__default.createElement(SearchInput, {
11600
11692
  type: "text",
11601
11693
  placeholder: "Search",
11602
11694
  value: searchText,
11603
11695
  onChange: handleInputChange
11604
- }));
11696
+ }), searchText && React__default.createElement(ClearButton, {
11697
+ className: "clear",
11698
+ onClick: handleClear
11699
+ }, React__default.createElement(dmsComponentLibrary.CrossIcon, null)));
11605
11700
  };
11606
- var Search = /*#__PURE__*/styled__default.div(_templateObject$26 || (_templateObject$26 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n svg {\n position: absolute;\n left: 12px;\n top: 50%;\n transform: translateY(-50%);\n }\n"])));
11607
- var SearchInput = /*#__PURE__*/styled__default.input(_templateObject2$1B || (_templateObject2$1B = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-radius: 20px;\n border: 1px solid #e0e2e7;\n background: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n display: flex;\n padding: 8.5px 12px;\n align-items: center;\n gap: 8px;\n align-self: stretch;\n padding-left: 39px;\n"])));
11701
+ var Search = /*#__PURE__*/styled__default.div(_templateObject$26 || (_templateObject$26 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n svg {\n position: absolute;\n left: 12px;\n top: 50%;\n transform: translateY(-50%);\n }\n .clear {\n position: absolute;\n right: 32px;\n top: 50%;\n }\n"])));
11702
+ var ClearButton = /*#__PURE__*/styled__default.button(_templateObject2$1B || (_templateObject2$1B = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n border: none;\n color: rgba(0, 0, 0, 0.25);\n cursor: pointer;\n padding: 0 8px;\n font-size: 14px;\n &:hover {\n color: #000;\n }\n"])));
11703
+ var SearchInput = /*#__PURE__*/styled__default.input(_templateObject3$T || (_templateObject3$T = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-radius: 20px;\n border: 1px solid #e0e2e7;\n background: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n display: flex;\n padding: 8.5px 12px;\n align-items: center;\n gap: 8px;\n align-self: stretch;\n padding-left: 39px;\n &:focus {\n outline: none;\n border-color: gray;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n }\n"])));
11608
11704
 
11609
11705
  var BulkFilter = function BulkFilter() {
11610
11706
  // const [printToogle, setPrintToggle] = useMenuDropDown();
@@ -11902,56 +11998,7 @@ var ReturnTable$1 = function ReturnTable() {
11902
11998
  })))));
11903
11999
  };
11904
12000
 
11905
- // let todayDate = new Date();
11906
- var initialState$3 = {
11907
- 'x-filters': [
11908
- // {
11909
- // field: 'action_date',
11910
- // op: '>=',
11911
- // value: `${format(new Date(todayDate), 'yyyy-MM-dd')}T00:00:00+00:00`,
11912
- // },
11913
- // {
11914
- // field: 'action_date',
11915
- // op: '<=',
11916
- // value: `${format(new Date(todayDate), 'yyyy-MM-dd')}T23:59:59+00:00`,
11917
- // },
11918
- // { field: 'status', op: 'count', value: '' },
11919
- ],
11920
- 'x-pagination': {
11921
- page: 1,
11922
- per_page: 50
11923
- }
11924
- };
11925
- var filterReducer$2 = function filterReducer(state, action) {
11926
- switch (action.type) {
11927
- case 'SET_PAGE':
11928
- return _extends({}, state, {
11929
- 'x-pagination': _extends({}, state['x-pagination'], {
11930
- page: action.payload
11931
- })
11932
- });
11933
- case 'SET_PERPAGE':
11934
- return _extends({}, state, {
11935
- 'x-pagination': _extends({}, state['x-pagination'], {
11936
- per_page: action.payload
11937
- })
11938
- });
11939
- case 'CLEAR_FILTERS':
11940
- return _extends({}, state);
11941
- case 'CLEAR_ALL_FILTER':
11942
- return _extends({}, state);
11943
- default:
11944
- return state;
11945
- }
11946
- };
11947
- var filtersStateAtom$2 = /*#__PURE__*/jotai.atom(initialState$3);
11948
- var overviewfiltersReducerAtom = /*#__PURE__*/jotai.atom(function (get) {
11949
- return get(filtersStateAtom$2);
11950
- }, function (get, set, action) {
11951
- return set(filtersStateAtom$2, filterReducer$2(get(filtersStateAtom$2), action));
11952
- });
11953
-
11954
- var _templateObject$27, _templateObject2$1C, _templateObject3$T;
12001
+ var _templateObject$27, _templateObject2$1C, _templateObject3$U;
11955
12002
  var _excluded$6 = ["count"];
11956
12003
  function ReturnMainTable() {
11957
12004
  var _useAtom = jotai.useAtom(overviewfiltersReducerAtom),
@@ -11964,7 +12011,8 @@ function ReturnMainTable() {
11964
12011
  var _useItemsPerOverviewP = useItemsPerOverviewPage(),
11965
12012
  itemsPerPage = _useItemsPerOverviewP[0],
11966
12013
  setItemsPerPage = _useItemsPerOverviewP[1];
11967
- var pagination = state['x-pagination'];
12014
+ var filters = state['x-filters'],
12015
+ pagination = state['x-pagination'];
11968
12016
  var page = paginationObj.page,
11969
12017
  total = paginationObj.total;
11970
12018
  // const [selectedClient] = useTableName();
@@ -11987,7 +12035,8 @@ function ReturnMainTable() {
11987
12035
  endpoint: "/return_orders/stats/",
11988
12036
  method: 'GET',
11989
12037
  //@ts-ignore
11990
- pagination: pagination
12038
+ pagination: pagination,
12039
+ filters: filters
11991
12040
  }),
11992
12041
  fetchedClientData = _useApiHook.data,
11993
12042
  statsDataLoading = _useApiHook.loading,
@@ -12032,7 +12081,7 @@ function ReturnMainTable() {
12032
12081
  }
12033
12082
  var Row$7 = /*#__PURE__*/styled__default.div(_templateObject$27 || (_templateObject$27 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n"])));
12034
12083
  var Container$1a = /*#__PURE__*/styled__default.div(_templateObject2$1C || (_templateObject2$1C = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n top: -46px;\n"])));
12035
- var DashBoardWrapper$3 = /*#__PURE__*/styled__default.section(_templateObject3$T || (_templateObject3$T = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .Tableconatiner {\n border-radius: 12px;\n background: #fff;\n box-shadow: -2px 0px 12px 0px rgba(56, 71, 109, 0.1);\n display: block;\n padding: 15px 20px;\n }\n .headerWrap,\n .tableData,\n .styleCovered {\n transition: all ease 0.5s;\n }\n &.stickyTableHead {\n h2 {\n font-size: 21px;\n }\n .headerWrap {\n height: 84px;\n padding: 10px;\n border-radius: 0px 0px 15px 15px;\n > div {\n position: relative;\n z-index: 10;\n }\n }\n .styleCovered {\n margin-top: -32px;\n width: 67%;\n float: right;\n gap: 5px;\n padding-right: 11px;\n\n li {\n padding: 4px 10px 5px 5px;\n gap: 5px;\n .svgCover {\n width: 30px;\n height: 30px;\n svg {\n height: auto;\n width: 58%;\n }\n }\n .countDigit {\n font-size: 19px;\n }\n }\n .countMess {\n font-size: 13px;\n }\n }\n .dmsBulkFilter {\n min-height: unset;\n gap: 4px;\n > div {\n padding: 4px 12px;\n label {\n font-size: 11px;\n }\n }\n }\n\n .StyledFilterList {\n gap: 4px;\n li {\n height: 29px;\n padding: 3px 8px;\n gap: 4px;\n .StyledFilterBtnIcon {\n width: 20px;\n height: 20px;\n svh {\n width: 10px;\n height: auto;\n }\n }\n .StyledFilterBtnLabel {\n font-size: 13px;\n }\n }\n }\n .StyledFilterLabel {\n padding-left: 10px;\n span {\n font-size: 13px;\n }\n }\n .cardcontainer.tableData {\n max-height: calc(100vh - 310px);\n min-height: calc(100vh - 310px);\n }\n\n .tableData {\n max-height: calc(100vh - 320px);\n min-height: calc(100vh - 320px);\n\n margin-top: 8px;\n thead {\n position: sticky;\n top: 0;\n z-index: 9;\n th {\n font-size: 13px;\n padding: 2px 15px;\n }\n }\n }\n }\n"])));
12084
+ var DashBoardWrapper$3 = /*#__PURE__*/styled__default.section(_templateObject3$U || (_templateObject3$U = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .Tableconatiner {\n border-radius: 12px;\n background: #fff;\n box-shadow: -2px 0px 12px 0px rgba(56, 71, 109, 0.1);\n display: block;\n padding: 15px 20px;\n }\n .headerWrap,\n .tableData,\n .styleCovered {\n transition: all ease 0.5s;\n }\n &.stickyTableHead {\n h2 {\n font-size: 21px;\n }\n .headerWrap {\n height: 84px;\n padding: 10px;\n border-radius: 0px 0px 15px 15px;\n > div {\n position: relative;\n z-index: 10;\n }\n }\n .styleCovered {\n margin-top: -32px;\n width: 67%;\n float: right;\n gap: 5px;\n padding-right: 11px;\n\n li {\n padding: 4px 10px 5px 5px;\n gap: 5px;\n .svgCover {\n width: 30px;\n height: 30px;\n svg {\n height: auto;\n width: 58%;\n }\n }\n .countDigit {\n font-size: 19px;\n }\n }\n .countMess {\n font-size: 13px;\n }\n }\n .dmsBulkFilter {\n min-height: unset;\n gap: 4px;\n > div {\n padding: 4px 12px;\n label {\n font-size: 11px;\n }\n }\n }\n\n .StyledFilterList {\n gap: 4px;\n li {\n height: 29px;\n padding: 3px 8px;\n gap: 4px;\n .StyledFilterBtnIcon {\n width: 20px;\n height: 20px;\n svh {\n width: 10px;\n height: auto;\n }\n }\n .StyledFilterBtnLabel {\n font-size: 13px;\n }\n }\n }\n .StyledFilterLabel {\n padding-left: 10px;\n span {\n font-size: 13px;\n }\n }\n .cardcontainer.tableData {\n max-height: calc(100vh - 310px);\n min-height: calc(100vh - 310px);\n }\n\n .tableData {\n max-height: calc(100vh - 320px);\n min-height: calc(100vh - 320px);\n\n margin-top: 8px;\n thead {\n position: sticky;\n top: 0;\n z-index: 9;\n th {\n font-size: 13px;\n padding: 2px 15px;\n }\n }\n }\n }\n"])));
12036
12085
 
12037
12086
  var OrderViewQueryHandler = function OrderViewQueryHandler() {
12038
12087
  var _useSearchParams = reactRouterDom.useSearchParams(),