@bjsdistribution/dms-client-return 0.0.2 → 0.0.3

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.
Files changed (75) hide show
  1. package/dist/components/order-daily-overview/common/interface.d.ts +22 -0
  2. package/dist/components/order-daily-overview/header-filters/Styledfilters.d.ts +1 -2
  3. package/dist/components/order-daily-overview/header-filters/filterStore.d.ts +16 -0
  4. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.d.ts +1 -0
  5. package/dist/components/order-daily-overview/shared/utlis.d.ts +2 -2
  6. package/dist/components/order-daily-overview/store/store.d.ts +4 -0
  7. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDown.d.ts +3 -1
  8. package/dist/components/order-view/store.d.ts +5 -1
  9. package/dist/components/store.d.ts +5 -2
  10. package/dist/components/types.d.ts +1 -1
  11. package/dist/dms-client-return.cjs.development.js +1065 -964
  12. package/dist/dms-client-return.cjs.development.js.map +1 -1
  13. package/dist/dms-client-return.cjs.production.min.js +1 -1
  14. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  15. package/dist/dms-client-return.esm.js +1067 -966
  16. package/dist/dms-client-return.esm.js.map +1 -1
  17. package/package.json +2 -2
  18. package/src/components/order-daily-overview/common/fakedata.tsx +5 -6
  19. package/src/components/order-daily-overview/common/interface.ts +120 -97
  20. package/src/components/order-daily-overview/filters/Filters.tsx +1 -8
  21. package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +56 -67
  22. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +160 -223
  23. package/src/components/order-daily-overview/header-filters/Styledfilters.tsx +19 -7
  24. package/src/components/order-daily-overview/header-filters/filterStore.ts +145 -0
  25. package/src/components/order-daily-overview/index.tsx +59 -6
  26. package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +24 -1
  27. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +177 -234
  28. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +63 -6
  29. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +5 -47
  30. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +51 -185
  31. package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +62 -0
  32. package/src/components/order-daily-overview/store/store.ts +23 -12
  33. package/src/components/order-daily-overview/table/ReturnTable.tsx +193 -205
  34. package/src/components/order-view/details-filters/DetailsFilters.tsx +3 -2
  35. package/src/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDown.tsx +57 -46
  36. package/src/components/order-view/general-information/Status.tsx +1 -1
  37. package/src/components/order-view/index.tsx +6 -4
  38. package/src/components/order-view/modalsPopup/UnReceiveProduct.tsx +1 -1
  39. package/src/components/order-view/order-actions/actions/escalation/EscalationModal.tsx +1 -1
  40. package/src/components/order-view/order-details/expanded-content/customer-section/RecipientName.tsx +1 -0
  41. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactEmail.tsx +1 -0
  42. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.tsx +1 -0
  43. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.tsx +1 -1
  44. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactWork.tsx +1 -0
  45. package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Address.tsx +1 -0
  46. package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Latitude.tsx +1 -0
  47. package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Longitude.tsx +1 -0
  48. package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Postcode.tsx +1 -0
  49. package/src/components/order-view/order-details/expanded-content/customer-section/location-info/What3words.tsx +1 -0
  50. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +3 -2
  51. package/src/components/order-view/order-details/expanded-content/index.tsx +1 -1
  52. package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +2 -1
  53. package/src/components/order-view/order-details/expanded-content/orders-section/Carrier.tsx +7 -1
  54. package/src/components/order-view/order-details/expanded-content/orders-section/DeliveryDate.tsx +1 -0
  55. package/src/components/order-view/order-details/expanded-content/orders-section/Depot.tsx +14 -1
  56. package/src/components/order-view/order-details/expanded-content/orders-section/Droptime.tsx +2 -1
  57. package/src/components/order-view/order-details/expanded-content/orders-section/OrderNumber.tsx +2 -1
  58. package/src/components/order-view/order-details/expanded-content/orders-section/RecipientReference.tsx +2 -1
  59. package/src/components/order-view/order-details/expanded-content/orders-section/ScheduleAfter.tsx +1 -0
  60. package/src/components/order-view/order-details/expanded-content/orders-section/VehicleType.tsx +13 -1
  61. package/src/components/order-view/order-details/expanded-content/services-section/DeliveryPoint.tsx +13 -1
  62. package/src/components/order-view/order-details/expanded-content/services-section/ServiceType.tsx +13 -1
  63. package/src/components/order-view/order-details/expanded-content/services-section/TimedService.tsx +14 -1
  64. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +2 -2
  65. package/src/components/order-view/store.ts +40 -12
  66. package/src/components/store.ts +26 -4
  67. package/src/components/types.ts +2 -6
  68. package/dist/components/order-daily-overview/table/InfiniteScrolling.d.ts +0 -5
  69. package/dist/components/order-daily-overview/table/Return.d.ts +0 -3
  70. package/dist/components/order-daily-overview/table/table-data/MyTable.d.ts +0 -18
  71. package/dist/components/order-daily-overview/table/table-data/Table.d.ts +0 -18
  72. package/src/components/order-daily-overview/table/InfiniteScrolling.tsx +0 -54
  73. package/src/components/order-daily-overview/table/Return.tsx +0 -156
  74. package/src/components/order-daily-overview/table/table-data/MyTable.tsx +0 -433
  75. package/src/components/order-daily-overview/table/table-data/Table.tsx +0 -445
@@ -1,5 +1,10 @@
1
- import React, { useState } from 'react';
2
- import { UsePaginationData, useItemsPerPage } from './store/store';
1
+ import React, { useEffect, useState } from 'react';
2
+ import {
3
+ UsePaginationData,
4
+ useItemsPerPage,
5
+ useLoading,
6
+ useTableName,
7
+ } from './store/store';
3
8
  import Filters from './filters/Filters';
4
9
  // import TableComponent from '../../components/order-daily-overview/table-view/table/Table';
5
10
  // import TableComponent from '../../components/order-daily-overview/Cards/CardsTable'
@@ -10,12 +15,27 @@ import RouterHeader from './header/route-header/RouterHeader';
10
15
  import { useStickyStatus } from '../store';
11
16
  import HeaderFilter from './header-filters/HeaderFilter';
12
17
  import ReturnTable from './table/ReturnTable';
18
+ import { useApiHook } from '@bjsdistribution/dms-component-library';
19
+ import { useClientData } from '../order-view/store';
20
+ import { ClientData } from './common/interface';
21
+ import ReturnOrderTable from './return-order-table/return-orders-filters/ReturnOrderTable';
22
+ import ReturnFilter from './return-order-table/return-orders-filters/ReturnFilter';
23
+ import { Text } from './filters/FilterStyle';
13
24
  // import Loader from '../loader/Loader';
14
25
 
26
+ // interface ApiResponse {
27
+ // message: string;
28
+ // code: number;
29
+ // error: string | null;
30
+ // error_traceback: string | null;
31
+ // data: [];
32
+ // }
33
+
15
34
  function ReturnMainTable() {
16
35
  const [paginationObj] = UsePaginationData();
17
36
  const [, setCurrentPage] = useState(1);
18
37
  const [itemsPerPage, setItemsPerPage] = useItemsPerPage();
38
+ const [selectedClient] = useTableName();
19
39
 
20
40
  const { page, total } = paginationObj;
21
41
 
@@ -26,16 +46,44 @@ function ReturnMainTable() {
26
46
  const handleItemsPerPageChange = (itemsPerPage: number) => {
27
47
  setItemsPerPage(itemsPerPage);
28
48
  };
49
+
29
50
  ////
51
+ const [, setLoading] = useLoading();
52
+ const [, setClientData] = useClientData();
53
+
54
+ const { data: fetchedClientData, loading: staticDataLoading } = useApiHook<{
55
+ data: ClientData[];
56
+ }>({
57
+ endpoint: `/return_orders/get/client-returns/`,
58
+ method: 'GET',
59
+ });
60
+ console.log('fetchedClientData', fetchedClientData?.data);
61
+
62
+ useEffect(() => {
63
+ setLoading(staticDataLoading);
64
+ if (fetchedClientData && fetchedClientData.data) {
65
+ const result = fetchedClientData?.data;
66
+ setClientData(result);
67
+
68
+ // Flatten the nested objects into an array
69
+
70
+ // const data = Object.values(fetchedClientData.data);
71
+ // console.log('data', data);
72
+ // setClientData(data);
73
+ }
74
+ }, [staticDataLoading]);
75
+
30
76
  return (
31
77
  <>
32
- {/* <Loader /> */}
33
78
  <DashBoardWrapper className={` ${isScrolled ? 'stickyTableHead' : ''}`}>
34
79
  <RouterHeader />
35
80
  <div className="Tableconatiner">
36
81
  <HeaderFilter />
37
- <Filters />
38
- <ReturnTable />
82
+ <Row>
83
+ <Text> {selectedClient ? selectedClient : 'Client Return'}</Text>
84
+ {selectedClient ? <ReturnFilter /> : <Filters />}
85
+ </Row>
86
+ {selectedClient ? <ReturnOrderTable /> : <ReturnTable />}
39
87
  {total > 0 && (
40
88
  <Pagination
41
89
  currentPage={page}
@@ -47,13 +95,18 @@ function ReturnMainTable() {
47
95
  )}
48
96
  </div>
49
97
  </DashBoardWrapper>
50
- {/* {<Loader />} */}
51
98
  </>
52
99
  );
53
100
  }
54
101
 
55
102
  export default ReturnMainTable;
56
103
 
104
+ const Row = styled.div`
105
+ display: flex;
106
+ justify-content: space-between;
107
+ align-items: center;
108
+ `;
109
+
57
110
  const DashBoardWrapper = styled.section`
58
111
  .Tableconatiner {
59
112
  border-radius: 12px;
@@ -1,11 +1,34 @@
1
- import React from 'react';
1
+ import React, { useEffect } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import RouterHeader from '../header/route-header/RouterHeader';
4
4
  import HeaderFilter from '../header-filters/HeaderFilter';
5
5
  import OrderTable from './table/OrderTable';
6
6
  import ReturnOrderFilter from './table-filters/ReturnOrderFilter';
7
+ import { useReturnAfterOrderData } from '../../order-view/store';
8
+ import { useLoading } from '../store/store';
9
+ import { ApiResponse } from '../common/interface';
10
+ import { useApiHook } from '@bjsdistribution/dms-component-library';
7
11
 
8
12
  const ReturnAfterTable = () => {
13
+ const [returnAfterOrder, setReturnOrderData] = useReturnAfterOrderData();
14
+ const [, setLoading] = useLoading();
15
+
16
+ const {
17
+ data: fetchedReturnOrderData,
18
+ loading: staticDataLoading,
19
+ } = useApiHook<ApiResponse>({
20
+ endpoint: '/return_orders/?skip_filters=0',
21
+ method: 'GET',
22
+ });
23
+ useEffect(() => {
24
+ setLoading(staticDataLoading);
25
+ if (fetchedReturnOrderData && fetchedReturnOrderData?.data) {
26
+ setReturnOrderData(fetchedReturnOrderData?.data);
27
+ }
28
+ }, [fetchedReturnOrderData, staticDataLoading]);
29
+
30
+ console.log('returnAfterOrder', returnAfterOrder);
31
+
9
32
  return (
10
33
  <div>
11
34
  <DashBoardWrapper>
@@ -1,183 +1,111 @@
1
- // import React, { useEffect } from 'react';
2
-
3
- // import { useApiHook } from '@bjsdistribution/dms-component-library';
4
- // // import { useInQueueData } from '../readyforinvoice/store';
5
- // // import { useStaticData } from './store';
6
- // // import useInfiniteScroll from '../readyforinvoice/InfiniteScrolling';
7
- // import { useAtom } from 'jotai';
8
- // import { ApiResponse, Column } from '../../../types';
9
- // import MyTable from '../../table/table-data/MyTable';
10
- // import { overviewFiltersReducerAtom } from '../FilterStore';
11
- // import { useInQueueData, useStaticData } from '../../../store';
12
- // import useInfiniteScroll from '../../../../common/infiniteScrolling';
13
- // import { data } from '../../table/table-data/Fakedata';
14
- // // import { overviewFiltersReducerAtom } from '../header-for-invoice/invoice-selection/FilterStore';
15
-
16
- // const ReturnOrderTable: React.FC = () => {
17
- // const getStatusId = (data: any) => {
18
- // console.log(data, 'datadatadatadata');
19
- // };
20
-
21
- // const columns: Column[] = [
22
- // { Header: 'Date', accessor: 'name' },
23
- // { Header: 'Client', accessor: 'customer_name' },
24
- // { Header: 'Account No', accessor: 'account_number' },
25
- // { Header: 'Total Orders', accessor: 'total_orders' },
26
- // { Header: 'Total Items', accessor: 'total_items' },
27
- // { Header: 'Discount', accessor: 'discount' },
28
- // { Header: 'Amount', accessor: 'amount' },
29
- // { Header: 'VAT', accessor: 'vat_rate' },
30
- // { Header: 'Total', accessor: 'total_amount' },
31
- // { Header: 'Update Status', accessor: 'status_id', callback: getStatusId },
32
- // ];
33
-
34
- // const [filterState, dispatchOverviewFilter] = useAtom(
35
- // overviewFiltersReducerAtom
36
- // );
37
- // const { 'x-pagination': pagination } = filterState;
38
-
39
- // const [, setQueueData] = useInQueueData(); //data
40
- // const [, setStaticData] = useStaticData();
41
-
42
- // const {
43
- // data: fetchedInvoiceData,
44
- // // loadingskeleton,
45
- // paginationData,
46
- // setShouldPerformAction,
47
- // } = useApiHook<ApiResponse>({
48
- // endpoint: `/invoices/`,
49
- // method: 'GET',
50
- // performAction: true,
51
- // pagination: pagination,
52
- // filters: [
53
- // { field: 'invoice_discount_queues.status_id', op: '=', value: 1 },
54
- // ],
55
- // });
56
-
57
- // // infinite scrolling code start here
58
- // const { page, scrollActivated } = useInfiniteScroll(
59
- // paginationData,
60
- // setShouldPerformAction,
61
- // 'tableScrolling'
62
- // );
63
-
64
- // useEffect(() => {
65
- // dispatchOverviewFilter({ type: 'SET_PAGE', payload: page });
66
- // }, [page]);
67
-
68
- // useEffect(() => {
69
- // if (fetchedInvoiceData && fetchedInvoiceData?.data) {
70
- // const invoiceData = fetchedInvoiceData?.data;
71
-
72
- // if (scrollActivated) {
73
- // setQueueData((prev: any) => {
74
- // const newData = invoiceData?.filter(
75
- // (newItem: any) =>
76
- // !prev?.some((prevItem: any) => prevItem?.id === newItem?.id)
77
- // );
78
- // return [...prev, ...newData];
79
- // });
80
- // } else {
81
- // setQueueData(invoiceData);
82
- // }
83
- // }
84
- // }, [fetchedInvoiceData, scrollActivated, setQueueData]);
85
-
86
- // //for static data
87
- // const { data: fetchedStaticData } = useApiHook<any>({
88
- // endpoint: `/invoices/getStaticData/all/`,
89
- // method: 'GET',
90
- // });
91
-
92
- // useEffect(() => {
93
- // if (fetchedStaticData && fetchedStaticData?.data) {
94
- // const staticData = fetchedStaticData?.data[0];
95
- // setStaticData(staticData);
96
- // }
97
- // }, [fetchedStaticData, setStaticData]);
98
-
99
- // return (
100
- // <div style={{ textTransform: 'capitalize', overflow: 'auto' }}>
101
- // <MyTable
102
- // columns={columns}
103
- // data={data}
104
- // loading={false}
105
- // // loadingskeleton={loadingskeleton}
106
- // />
107
- // </div>
108
- // );
109
- // };
110
-
111
- // export default ReturnOrderTable;
112
- import { AntSelect, Checkbox } from '@bjsdistribution/dms-component-library';
1
+ import {
2
+ AntSelect,
3
+ Checkbox,
4
+ displayValueOrNA,
5
+ } from '@bjsdistribution/dms-component-library';
113
6
  import { Empty } from 'antd';
114
- import { useAtom } from 'jotai';
115
- import React, { useState } from 'react';
116
- // import EmailIcon from '../../assets/EmailIcon';
117
- // import ExcelIcon from '../../assets/ExcelIcon';
118
- // import PdfIcon from '../../assets/PdfIcon';
119
- // import { countReducerAtom } from '../invoice-actions/store';
120
- // import { FormattedDate, getStringValue } from '../utils';
121
- // import { IconContainers, TdWrapper } from './emailStyles';
122
- // import { useEmailInvoice, useSelectedEmail } from './store';
123
- // import Popup from './Popup';
7
+ import React, { useEffect, useRef, useState } from 'react';
124
8
  import { Skeleton } from 'antd';
125
- // import { StyledTable, StyledTableWrapper } from '../styles';
126
- // import { EmptyDataContainer } from './emailStyles';
127
- // import ShareIcon from '../../assets/ShareIcon';
128
- import { data } from '../../table/table-data/Fakedata';
129
- // import { StyledTable, StyledTableWrapper } from '../../table-view/TableStyle';
130
- import { useEmailInvoice, useSelectedEmail } from '../../../store';
131
- import { countReducerAtom } from '../../../order-view/store';
9
+ import { useSelectedOrders } from '../../../store';
10
+ import { useReturnAfterOrderData } from '../../../order-view/store';
132
11
  import { EmptyDataContainer } from '../../table/table-data/styles';
133
- import { FormattedDate, getStringValue } from '../../../utils';
134
- // import ExportIcon from '../../../../assets/icons/ExportIcon';
135
- // import ArrivalIcon from '../../../../assets/icons/ArrivalIcon';
136
12
  import PrinterIcon from '../../../../assets/icons/PrinterIcon';
137
13
  import DownIcon from '../../../../assets/icons/DownIcon';
138
14
  import {
139
15
  StyledTable,
140
16
  StyledTableWrapper,
17
+ CustomDrop,
141
18
  } from '../../return-order-table/return-orders-filters/returnstyles';
142
19
  import LoadIcon from '../../../../assets/icons/LoadIcon';
143
- // import { StyledAntSelect } from '../../Header-filters/Styledfilters';
20
+ import { usePrintOptionTOggle } from '../../store/store';
21
+ import PrintDropDown from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDown';
144
22
 
145
23
  const OrderTable = ({ loadingskeleton }: any) => {
146
- const [emailInvoiceData] = useEmailInvoice();
147
- const [,] = useAtom(countReducerAtom);
148
- const [selectedInvoices, setSelectedInvoices] = useSelectedEmail();
24
+ const [selectedOrders, setSelectedReturnOrder] = useSelectedOrders();
149
25
  const [selectAll, setSelectAll] = useState(false);
150
26
  const defaultSelectStyle = { width: '100%' };
151
27
  const defaultPopupClassName = 'dropDownStyle';
152
28
  const defaultSelectWrapperClass = 'rounded';
29
+ const dropdownRefParent = useRef<HTMLDivElement>(null);
30
+ const dropdownRef = useRef<HTMLDivElement>(null);
31
+ const [printToogle, setPrintToggle] = usePrintOptionTOggle();
32
+
33
+ const [returnAfterOrder] = useReturnAfterOrderData();
34
+
35
+ const OpenDropDown = (index: number) => {
36
+ setPrintToggle(prevIndex => (prevIndex === index ? null : index));
37
+ };
38
+
39
+ // Close dropdown outside click
40
+ useEffect(() => {
41
+ document.addEventListener('mousedown', handleClickOutside);
42
+ return () => {
43
+ document.removeEventListener('mousedown', handleClickOutside);
44
+ };
45
+ }, []);
46
+ const handleClickOutside = (event: MouseEvent) => {
47
+ if (
48
+ dropdownRef.current &&
49
+ !dropdownRef.current.contains(event.target as Node)
50
+ ) {
51
+ setPrintToggle(null);
52
+ }
53
+ };
153
54
 
154
55
  const handleSelectAll = (e: any) => {
155
56
  setSelectAll(e.target.checked);
156
57
  if (e.target.checked) {
157
- setSelectedInvoices(
158
- data.map((invoice: any) => ({
159
- id: invoice.id,
58
+ setSelectedReturnOrder(
59
+ returnAfterOrder.map((e: any) => ({
60
+ id: e.id,
160
61
  status_id: 3,
161
62
  }))
162
63
  );
163
64
  } else {
164
- setSelectedInvoices([]);
65
+ setSelectedReturnOrder([]);
165
66
  }
166
67
  };
167
68
 
168
69
  const handleSelectInvoice = (id: any) => {
169
- setSelectedInvoices((prevSelectedInvoices: any) => {
70
+ setSelectedReturnOrder((prevSelectedInvoices: any) => {
170
71
  const isSelected = prevSelectedInvoices?.some(
171
- (invoice: any) => invoice.id === id
72
+ (item: any) => item.id === id
172
73
  );
173
74
 
174
75
  if (isSelected) {
175
- return prevSelectedInvoices.filter((invoice: any) => invoice.id !== id);
76
+ return prevSelectedInvoices.filter((items: any) => items.id !== id);
176
77
  } else {
177
78
  return [...prevSelectedInvoices, { id, status_id: 3 }];
178
79
  }
179
80
  });
180
81
  };
82
+ console.log('', returnAfterOrder);
83
+
84
+ const assigneOptions = [
85
+ {
86
+ label: 'BJS Distribution',
87
+ value: 'bjs-dist',
88
+ },
89
+ {
90
+ label: 'Haulage',
91
+ value: 'haulage',
92
+ },
93
+ ];
94
+
95
+ const getStatusClass = (status: any) => {
96
+ switch (status) {
97
+ case 'Cancelled':
98
+ return { color: '#E95252', background: 'rgba(233, 82, 82, 0.15)' };
99
+ case 'Pending':
100
+ return { color: '#F4A503', background: '#FFF1D6' };
101
+ case 'Awaiting':
102
+ return { color: '#845ADF', background: 'rgba(132, 90, 223, 0.15)' };
103
+ case 'Completed':
104
+ return { color: '#1F9254', background: 'rgba(41, 204, 106, 0.15)' };
105
+ default:
106
+ return { color: '#000', background: '#fff' };
107
+ }
108
+ };
181
109
 
182
110
  return (
183
111
  <>
@@ -189,7 +117,6 @@ const OrderTable = ({ loadingskeleton }: any) => {
189
117
  <Checkbox checked={selectAll} onChange={handleSelectAll} />
190
118
  </th>
191
119
  <th className="emailInvoiceNo">Created</th>
192
- {/* <th>Created</th> */}
193
120
  <th>Return Location</th>
194
121
  <th>Pick Up Location</th>
195
122
  <th>Recipient</th>
@@ -212,7 +139,7 @@ const OrderTable = ({ loadingskeleton }: any) => {
212
139
  </td>
213
140
  <td colSpan={6}></td>
214
141
  </tr>
215
- ) : emailInvoiceData?.length === 0 ? (
142
+ ) : returnAfterOrder?.length === 0 ? (
216
143
  <tr>
217
144
  <td colSpan={7}>
218
145
  <EmptyDataContainer>
@@ -221,104 +148,120 @@ const OrderTable = ({ loadingskeleton }: any) => {
221
148
  </td>
222
149
  </tr>
223
150
  ) : (
224
- data?.map((invoice: any) => (
225
- <tr key={invoice.id}>
226
- <td>
227
- <Checkbox
228
- checked={selectedInvoices?.some(
229
- (selectedInvoice: any) =>
230
- selectedInvoice?.id === invoice.id
231
- )}
232
- onChange={() => handleSelectInvoice(invoice.id)}
233
- />
234
- </td>
151
+ returnAfterOrder?.map((item: any, index: any) => {
152
+ const statusMapping: any = {
153
+ CO: 'Cancelled',
154
+ OO: 'On Hold',
155
+ SC: 'Sub-Contracted',
156
+ AR: 'Awaiting Route',
157
+ SD: 'Completed',
158
+ AD: 'Outstanding',
159
+ };
160
+ const status = statusMapping[item?.status] || 'Unknown';
161
+ const statusClass = getStatusClass(status);
162
+ return (
163
+ <tr key={item.id}>
164
+ <td>
165
+ <Checkbox
166
+ checked={selectedOrders?.some(
167
+ (selectedInvoice: any) =>
168
+ selectedInvoice?.id === item.id
169
+ )}
170
+ onChange={() => handleSelectInvoice(item.id)}
171
+ />
172
+ </td>
173
+ <td>{displayValueOrNA(item?.created_at)}</td>
174
+ <td>{displayValueOrNA(item?.return_locations)}</td>
175
+ <td>{displayValueOrNA(item?.pick_up_location)}</td>
176
+ <td>
177
+ <ul style={{ listStyleType: 'none', padding: 0 }}>
178
+ <li
179
+ style={{
180
+ color: '#0099ff',
181
+ fontWeight: 600,
182
+ paddingLeft: 0,
183
+ }}
184
+ >
185
+ {displayValueOrNA(
186
+ item?.order_recipient?.recipient_name
187
+ )}
188
+ </li>
189
+ <li style={{ color: '#888075' }}>
190
+ {displayValueOrNA(item?.order_recipient?.postcode)}
191
+ </li>
192
+ </ul>
193
+ </td>
194
+ <td>
195
+ {displayValueOrNA(item?.customer_data?.customer_name)}
196
+ </td>
235
197
 
236
- <td>{invoice?.date}</td>
198
+ <td>{displayValueOrNA(item?.consignment)}</td>
199
+ <td>
200
+ {/* {displayValueOrNA(item?.created_at)} */}
201
+ N/A
202
+ </td>
237
203
 
238
- {/* <td>{invoice?.customer_name}</td> */}
239
- <td>{invoice?.customer_name}</td>
240
-
241
- <td>
242
- <ul style={{ listStyleType: 'none', padding: 0 }}>
243
- <li
244
- style={{
245
- color: '#0099ff',
246
- fontWeight: 600,
247
- paddingLeft: 0,
248
- }}
204
+ <td>{displayValueOrNA(item?.box_count)}</td>
205
+ <td>{displayValueOrNA(item?.weight)}KG</td>
206
+ <td>{displayValueOrNA(item?.cube)}</td>
207
+ <td>
208
+ <AntSelect
209
+ options={assigneOptions}
210
+ placeholder="Select"
211
+ onChange={() => {}}
212
+ // defaultValue={item?.customer_name || ''}
213
+ style={defaultSelectStyle}
214
+ disabled={false}
215
+ // onSearch={handleSearch}
216
+ showSearch
217
+ popupClassName={defaultPopupClassName}
218
+ selectWrapperClass={defaultSelectWrapperClass}
219
+ />
220
+ </td>
221
+ <td>
222
+ <ul
223
+ className="statuscontainer"
224
+ style={{ listStyleType: 'none' }}
249
225
  >
250
- {' '}
251
- {getStringValue(invoice?.account_number)}
252
- </li>
253
- <li style={{ color: '#888075' }}>
254
- {invoice?.customer_name}
255
- </li>
256
- </ul>
257
- </td>
258
- <td>{FormattedDate({ date: invoice?.date })}</td>
259
- <td>
260
- {/* <TdWrapper>{invoice?.account_number}</TdWrapper> */}
261
- {invoice?.vat_rate_amount}
262
- </td>
263
- <td>{invoice?.customer_name}</td>
264
-
265
- <td>{invoice?.customer_name}</td>
266
- <td>{invoice?.customer_name}</td>
267
- <td>{invoice?.customer_name}</td>
268
- <td>{invoice?.customer_name}</td>
269
- <td>
270
- {/* <StyledAntSelect
271
- options={[]}
272
- placeholder="Select Client Name"
273
- onChange={() => {}}
274
- mode="multiple"
275
- value={invoice?.customer_name || ''}
276
- style={{ minWidth: '14vw' }}
277
- /> */}
278
-
279
- <AntSelect
280
- options={[]}
281
- placeholder="Select"
282
- onChange={() => {}}
283
- defaultValue={invoice?.customer_name || ''}
284
- style={defaultSelectStyle}
285
- disabled={false}
286
- // onSearch={handleSearch}
287
- showSearch
288
- popupClassName={defaultPopupClassName}
289
- selectWrapperClass={defaultSelectWrapperClass}
290
- />
291
- </td>
292
-
293
- <td>
294
- <ul
295
- className="statuscontainer"
296
- style={{ listStyleType: 'none' }}
297
- >
298
- <li className="statustext">Completed</li>
299
- </ul>
300
- </td>
301
-
302
- <td>
303
- <ul className="actionbox">
304
- <li className="shareIconContainer">
305
- <PrinterIcon />
306
- <DownIcon />
307
- </li>
308
- <li className="downloadcontainer">
309
- <LoadIcon />
310
- </li>
311
- </ul>
312
- {/* <div className="shareIconContainer">
226
+ <li className={`statustext ${statusClass}`}>
227
+ {status}
228
+ </li>
229
+ </ul>
230
+ </td>
231
+ <td>
232
+ <ul className="actionbox">
233
+ <CustomDrop
234
+ ref={dropdownRefParent}
235
+ className={printToogle === index ? 'active' : ''}
236
+ >
237
+ <li
238
+ className="shareIconContainer"
239
+ onClick={() => OpenDropDown(index)}
240
+ >
241
+ <PrinterIcon />
242
+ <DownIcon />
243
+ </li>
244
+ {printToogle == index && (
245
+ <div ref={dropdownRef}>
246
+ <PrintDropDown />
247
+ </div>
248
+ )}
249
+ </CustomDrop>
250
+ <li className="downloadcontainer">
251
+ <LoadIcon />
252
+ </li>
253
+ </ul>
254
+ {/* <div className="shareIconContainer">
313
255
  <PrinterIcon />
314
256
  <DownIcon />
315
257
  </div>
316
258
  <div className="downloadcontainer">
317
259
  <LoadIcon />
318
260
  </div> */}
319
- </td>
320
- </tr>
321
- ))
261
+ </td>
262
+ </tr>
263
+ );
264
+ })
322
265
  )}
323
266
  </tbody>
324
267
  </StyledTable>