@bjsdistribution/dms-client-return 0.0.80 → 0.0.82
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/components/order-daily-overview/header-filters/overViewFilter.d.ts +1 -0
- package/dist/components/order-view/DynamicTable.d.ts +4 -1
- package/dist/components/order-view/order-actions/Dropdown.d.ts +1 -0
- package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrder.d.ts +3 -0
- package/dist/dms-client-return.cjs.development.js +609 -391
- package/dist/dms-client-return.cjs.development.js.map +1 -1
- package/dist/dms-client-return.cjs.production.min.js +1 -1
- package/dist/dms-client-return.cjs.production.min.js.map +1 -1
- package/dist/dms-client-return.esm.js +609 -391
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/order-daily-overview/header/route-header/search/SearchType.tsx +58 -2
- package/src/components/order-daily-overview/header-filters/overViewFilter.ts +37 -14
- package/src/components/order-daily-overview/index.tsx +2 -1
- package/src/components/order-view/DynamicTable.tsx +115 -90
- package/src/components/order-view/fakedata.ts +4 -2
- package/src/components/order-view/generic-table/AuditLogs.tsx +23 -81
- package/src/components/order-view/index.tsx +6 -7
- package/src/components/order-view/notes/NoteType.tsx +12 -1
- package/src/components/order-view/notes/index.tsx +46 -33
- package/src/components/order-view/order-actions/Dropdown.tsx +10 -1
- package/src/components/order-view/order-actions/actions/cancel-order/index.tsx +21 -2
- package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +51 -48
- package/src/components/order-view/order-actions/actions/split-order/SplitOrderTable.tsx +28 -19
- package/src/components/order-view/order-actions/actions/split-order/index.tsx +24 -2
- package/src/components/order-view/order-actions/actions/uncancel-order/UncancelOrder.tsx +166 -0
- package/src/components/order-view/order-actions/index.tsx +3 -2
- package/src/components/order-view/order-details/expanded-content/footer/index.tsx +9 -6
package/package.json
CHANGED
|
@@ -1,14 +1,45 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
//common
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { SearchIcon } from '../../../../../assets/icons';
|
|
5
|
+
import { useAtom } from 'jotai';
|
|
6
|
+
import { overviewfiltersReducerAtom } from '../../../header-filters/overViewFilter';
|
|
7
|
+
import { CrossIcon } from '@bjsdistribution/dms-component-library';
|
|
5
8
|
|
|
6
9
|
const SearchType = () => {
|
|
7
10
|
const [searchText, setSearchText] = useState('');
|
|
11
|
+
const [debouncedSearchText, setDebouncedSearchText] = useState('');
|
|
12
|
+
const [, dispatch] = useAtom(overviewfiltersReducerAtom);
|
|
13
|
+
|
|
8
14
|
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
9
15
|
setSearchText(event.target.value);
|
|
10
16
|
};
|
|
11
17
|
|
|
18
|
+
// Debouncing effect
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const handler = setTimeout(() => {
|
|
21
|
+
setDebouncedSearchText(searchText);
|
|
22
|
+
}, 1000);
|
|
23
|
+
return () => {
|
|
24
|
+
clearTimeout(handler);
|
|
25
|
+
};
|
|
26
|
+
}, [searchText]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (debouncedSearchText) {
|
|
29
|
+
dispatch({
|
|
30
|
+
type: 'SET_COMP_RETURN_FILTERS',
|
|
31
|
+
payload: debouncedSearchText,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}, [debouncedSearchText, dispatch]);
|
|
35
|
+
|
|
36
|
+
const handleClear = () => {
|
|
37
|
+
setSearchText('');
|
|
38
|
+
dispatch({
|
|
39
|
+
type: 'CLEAR_SEARCH',
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
12
43
|
return (
|
|
13
44
|
<Search>
|
|
14
45
|
<SearchIcon />
|
|
@@ -18,6 +49,11 @@ const SearchType = () => {
|
|
|
18
49
|
value={searchText}
|
|
19
50
|
onChange={handleInputChange}
|
|
20
51
|
/>
|
|
52
|
+
{searchText && (
|
|
53
|
+
<ClearButton className="clear" onClick={handleClear}>
|
|
54
|
+
<CrossIcon />
|
|
55
|
+
</ClearButton>
|
|
56
|
+
)}
|
|
21
57
|
</Search>
|
|
22
58
|
);
|
|
23
59
|
};
|
|
@@ -29,8 +65,23 @@ const Search = styled.div`
|
|
|
29
65
|
top: 50%;
|
|
30
66
|
transform: translateY(-50%);
|
|
31
67
|
}
|
|
68
|
+
.clear {
|
|
69
|
+
position: absolute;
|
|
70
|
+
right: 32px;
|
|
71
|
+
top: 50%;
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
const ClearButton = styled.button`
|
|
75
|
+
position: relative;
|
|
76
|
+
border: none;
|
|
77
|
+
color: rgba(0, 0, 0, 0.25);
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
padding: 0 8px;
|
|
80
|
+
font-size: 14px;
|
|
81
|
+
&:hover {
|
|
82
|
+
color: #000;
|
|
83
|
+
}
|
|
32
84
|
`;
|
|
33
|
-
Search;
|
|
34
85
|
const SearchInput = styled.input`
|
|
35
86
|
border-radius: 20px;
|
|
36
87
|
border: 1px solid #e0e2e7;
|
|
@@ -42,5 +93,10 @@ const SearchInput = styled.input`
|
|
|
42
93
|
gap: 8px;
|
|
43
94
|
align-self: stretch;
|
|
44
95
|
padding-left: 39px;
|
|
96
|
+
&:focus {
|
|
97
|
+
outline: none;
|
|
98
|
+
border-color: gray;
|
|
99
|
+
box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
|
|
100
|
+
}
|
|
45
101
|
`;
|
|
46
102
|
export default SearchType;
|
|
@@ -9,6 +9,7 @@ interface Filter {
|
|
|
9
9
|
field: string;
|
|
10
10
|
op: string;
|
|
11
11
|
value: any;
|
|
12
|
+
join?: any;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
interface Pagination {
|
|
@@ -20,26 +21,48 @@ interface FilterState {
|
|
|
20
21
|
'x-filters': Filter[];
|
|
21
22
|
'x-pagination': Pagination;
|
|
22
23
|
}
|
|
23
|
-
// let todayDate = new Date();
|
|
24
24
|
const initialState: FilterState = {
|
|
25
|
-
'x-filters': [
|
|
26
|
-
// {
|
|
27
|
-
// field: 'action_date',
|
|
28
|
-
// op: '>=',
|
|
29
|
-
// value: `${format(new Date(todayDate), 'yyyy-MM-dd')}T00:00:00+00:00`,
|
|
30
|
-
// },
|
|
31
|
-
// {
|
|
32
|
-
// field: 'action_date',
|
|
33
|
-
// op: '<=',
|
|
34
|
-
// value: `${format(new Date(todayDate), 'yyyy-MM-dd')}T23:59:59+00:00`,
|
|
35
|
-
// },
|
|
36
|
-
// { field: 'status', op: 'count', value: '' },
|
|
37
|
-
],
|
|
25
|
+
'x-filters': [],
|
|
38
26
|
'x-pagination': { page: 1, per_page: 50 },
|
|
39
27
|
};
|
|
40
28
|
|
|
41
29
|
const filterReducer = (state: FilterState, action: any): FilterState => {
|
|
42
30
|
switch (action.type) {
|
|
31
|
+
case 'SET_COMP_RETURN_FILTERS':
|
|
32
|
+
return {
|
|
33
|
+
...state,
|
|
34
|
+
'x-filters': [
|
|
35
|
+
...state['x-filters'].filter(
|
|
36
|
+
f => f.field !== 'customer_name' && f.field !== 'trading_as'
|
|
37
|
+
),
|
|
38
|
+
{
|
|
39
|
+
field: 'customer_name',
|
|
40
|
+
op: 'like',
|
|
41
|
+
value: `%${action.payload}%`,
|
|
42
|
+
join: 'or',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
field: 'trading_as',
|
|
46
|
+
op: 'like',
|
|
47
|
+
value: `%${action.payload}%`,
|
|
48
|
+
join: 'or',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
'x-pagination': { ...state['x-pagination'], page: 1 },
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
case 'CLEAR_SEARCH':
|
|
55
|
+
return {
|
|
56
|
+
...state,
|
|
57
|
+
'x-filters': [...initialState['x-filters']],
|
|
58
|
+
'x-pagination': { ...initialState['x-pagination'], page: 1 },
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
case 'CLEAR_ALL_FILTER':
|
|
62
|
+
return {
|
|
63
|
+
...state,
|
|
64
|
+
};
|
|
65
|
+
|
|
43
66
|
case 'SET_PAGE':
|
|
44
67
|
return {
|
|
45
68
|
...state,
|
|
@@ -23,7 +23,7 @@ function ReturnMainTable() {
|
|
|
23
23
|
const [paginationObj, setPaginationObject] = UsePaginationOverviewData();
|
|
24
24
|
const [, setCurrentPage] = useState(1);
|
|
25
25
|
const [itemsPerPage, setItemsPerPage] = useItemsPerOverviewPage();
|
|
26
|
-
const { 'x-pagination': pagination } = state;
|
|
26
|
+
const { 'x-filters': filters, 'x-pagination': pagination } = state;
|
|
27
27
|
const { page, total } = paginationObj;
|
|
28
28
|
// const [selectedClient] = useTableName();
|
|
29
29
|
const [isScrolled] = useStickyStatus();
|
|
@@ -52,6 +52,7 @@ function ReturnMainTable() {
|
|
|
52
52
|
method: 'GET',
|
|
53
53
|
//@ts-ignore
|
|
54
54
|
pagination: pagination,
|
|
55
|
+
filters: filters,
|
|
55
56
|
});
|
|
56
57
|
|
|
57
58
|
useEffect(() => {
|
|
@@ -7,16 +7,18 @@ import {
|
|
|
7
7
|
import React, { useMemo } from 'react';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
9
|
import CustomScrollBar from '../../common/scrollbar';
|
|
10
|
-
|
|
10
|
+
import { atom, useAtom } from 'jotai';
|
|
11
|
+
export const selectedID = atom<any>([]);
|
|
11
12
|
|
|
12
13
|
interface DynamicTableProps {
|
|
13
14
|
columns: any;
|
|
14
15
|
data: any[];
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
function DynamicTable({ columns, data }: DynamicTableProps) {
|
|
18
|
+
function DynamicTable({ columns, data }: DynamicTableProps, props: any) {
|
|
18
19
|
const tableColumns = useMemo(() => columns, [columns]);
|
|
19
20
|
const tableData = useMemo(() => data, [data]);
|
|
21
|
+
|
|
20
22
|
const table = useReactTable({
|
|
21
23
|
columns: tableColumns,
|
|
22
24
|
data: tableData,
|
|
@@ -26,6 +28,9 @@ function DynamicTable({ columns, data }: DynamicTableProps) {
|
|
|
26
28
|
|
|
27
29
|
const rows = table.getRowModel().rows;
|
|
28
30
|
const headerGroups = table.getHeaderGroups();
|
|
31
|
+
const action = props;
|
|
32
|
+
const [selectedRows] = useAtom(selectedID);
|
|
33
|
+
|
|
29
34
|
const smallColumns = [
|
|
30
35
|
'types',
|
|
31
36
|
'sources',
|
|
@@ -33,11 +38,11 @@ function DynamicTable({ columns, data }: DynamicTableProps) {
|
|
|
33
38
|
'code',
|
|
34
39
|
'type',
|
|
35
40
|
'route',
|
|
36
|
-
'category',
|
|
37
41
|
'action',
|
|
38
42
|
];
|
|
39
|
-
const mediumColumns = ['date'];
|
|
40
|
-
const largeColumns = ['
|
|
43
|
+
const mediumColumns = ['date', 'reference', 'note', 'category'];
|
|
44
|
+
const largeColumns = ['details', 'datetime'];
|
|
45
|
+
const noFlexColumns = ['id'];
|
|
41
46
|
|
|
42
47
|
return (
|
|
43
48
|
<MainContainer>
|
|
@@ -46,79 +51,76 @@ function DynamicTable({ columns, data }: DynamicTableProps) {
|
|
|
46
51
|
<CustomScrollBar>
|
|
47
52
|
<Table>
|
|
48
53
|
<TableHead>
|
|
49
|
-
{headerGroups
|
|
54
|
+
{headerGroups?.map(headerGroup => (
|
|
50
55
|
<TableRow key={headerGroup.id}>
|
|
51
|
-
{headerGroup.headers.map(header =>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
{header.column.getCanSort() ? (
|
|
73
|
-
header.column.getIsSorted() === false ? (
|
|
74
|
-
<ChevronUpIcon />
|
|
75
|
-
) : header.column.getIsSorted() === 'asc' ? (
|
|
76
|
-
<ChevronUpIcon />
|
|
77
|
-
) : (
|
|
78
|
-
<ChevronDownIcon
|
|
79
|
-
style={{ cursor: 'pointer' }}
|
|
80
|
-
/>
|
|
81
|
-
)
|
|
82
|
-
) : (
|
|
83
|
-
''
|
|
84
|
-
)}
|
|
85
|
-
</span> */}
|
|
86
|
-
</TableHeadData>
|
|
87
|
-
);
|
|
88
|
-
})}
|
|
56
|
+
{headerGroup.headers.map(header => (
|
|
57
|
+
<TableHeadData
|
|
58
|
+
className={`col
|
|
59
|
+
${
|
|
60
|
+
smallColumns.includes(header?.id)
|
|
61
|
+
? 'sm'
|
|
62
|
+
: mediumColumns.includes(header?.id)
|
|
63
|
+
? 'md'
|
|
64
|
+
: largeColumns.includes(header?.id)
|
|
65
|
+
? 'lg'
|
|
66
|
+
: ''
|
|
67
|
+
}`}
|
|
68
|
+
key={header.id}
|
|
69
|
+
onClick={header.column.getToggleSortingHandler()}
|
|
70
|
+
>
|
|
71
|
+
{flexRender(
|
|
72
|
+
header.column.columnDef.header,
|
|
73
|
+
header.getContext()
|
|
74
|
+
)}
|
|
75
|
+
</TableHeadData>
|
|
76
|
+
))}
|
|
89
77
|
</TableRow>
|
|
90
78
|
))}
|
|
91
79
|
</TableHead>
|
|
92
80
|
<TableBody>
|
|
93
|
-
{rows
|
|
94
|
-
rows
|
|
95
|
-
<TableRow
|
|
96
|
-
{row.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
81
|
+
{rows?.length > 0 ? (
|
|
82
|
+
rows?.map(row => (
|
|
83
|
+
<TableRow
|
|
84
|
+
key={row.id}
|
|
85
|
+
className={`${
|
|
86
|
+
selectedRows?.length > 0 &&
|
|
87
|
+
selectedRows?.filter(
|
|
88
|
+
(f: any) => f?.id === (row?.original as any)?.id
|
|
89
|
+
)?.length
|
|
90
|
+
? 'isSelectedRow'
|
|
91
|
+
: ''
|
|
92
|
+
}`}
|
|
93
|
+
>
|
|
94
|
+
{row.getVisibleCells().map(cell => (
|
|
95
|
+
<TableData
|
|
96
|
+
className={`col
|
|
97
|
+
${
|
|
98
|
+
noFlexColumns.includes(cell?.column.id)
|
|
99
|
+
? 'noFlex'
|
|
100
|
+
: smallColumns.includes(cell?.column.id)
|
|
101
|
+
? 'sm'
|
|
102
|
+
: mediumColumns.includes(cell?.column.id)
|
|
103
|
+
? 'md'
|
|
104
|
+
: largeColumns.includes(cell?.column.id)
|
|
105
|
+
? 'lg'
|
|
106
|
+
: ''
|
|
107
|
+
} ${cell?.column.id}`}
|
|
108
|
+
key={cell.id}
|
|
109
|
+
>
|
|
110
|
+
{flexRender(cell.column.columnDef.cell, {
|
|
111
|
+
...cell.getContext(),
|
|
112
|
+
action,
|
|
113
|
+
})}
|
|
114
|
+
</TableData>
|
|
115
|
+
))}
|
|
118
116
|
</TableRow>
|
|
119
117
|
))
|
|
120
118
|
) : (
|
|
121
|
-
|
|
119
|
+
<TableRow>
|
|
120
|
+
<TableData colSpan={columns.length}>
|
|
121
|
+
No entries found.
|
|
122
|
+
</TableData>
|
|
123
|
+
</TableRow>
|
|
122
124
|
)}
|
|
123
125
|
</TableBody>
|
|
124
126
|
</Table>
|
|
@@ -129,11 +131,6 @@ function DynamicTable({ columns, data }: DynamicTableProps) {
|
|
|
129
131
|
);
|
|
130
132
|
}
|
|
131
133
|
|
|
132
|
-
// const ChevronUpIcon = styled(ChevronDownIcon)`
|
|
133
|
-
// transform: rotate(180deg);
|
|
134
|
-
// cursor: pointer;
|
|
135
|
-
// `;
|
|
136
|
-
|
|
137
134
|
const Container = styled.div`
|
|
138
135
|
height: 30vh;
|
|
139
136
|
pointer-events: initial;
|
|
@@ -151,7 +148,7 @@ const TableWrapper = styled.div`
|
|
|
151
148
|
`;
|
|
152
149
|
|
|
153
150
|
const TableHeadData = styled.th`
|
|
154
|
-
padding:
|
|
151
|
+
padding: 10px 5px;
|
|
155
152
|
font-family: 'Roboto', sans-serif;
|
|
156
153
|
font-size: 14px;
|
|
157
154
|
font-weight: 500;
|
|
@@ -161,7 +158,7 @@ const TableHeadData = styled.th`
|
|
|
161
158
|
|
|
162
159
|
const TableData = styled.td`
|
|
163
160
|
border-spacing: 0px;
|
|
164
|
-
padding:
|
|
161
|
+
padding: 10px 5px;
|
|
165
162
|
font-family: 'Lato', sans-serif;
|
|
166
163
|
font-size: 13px;
|
|
167
164
|
font-weight: 400;
|
|
@@ -201,29 +198,57 @@ const Table = styled.table`
|
|
|
201
198
|
`;
|
|
202
199
|
|
|
203
200
|
const MainContainer = styled.div`
|
|
204
|
-
// width: 40%;
|
|
205
201
|
.col {
|
|
206
|
-
flex: 2;
|
|
207
|
-
// padding: 0 0 0 10px;
|
|
208
|
-
word-break: break-all;
|
|
209
202
|
display: flex;
|
|
210
|
-
color: #3a3630;
|
|
211
203
|
align-items: center;
|
|
212
|
-
|
|
204
|
+
color: #3a3630;
|
|
205
|
+
padding: 10px 5px;
|
|
206
|
+
text-align: left;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.col.noFlex {
|
|
210
|
+
flex: 0;
|
|
213
211
|
}
|
|
214
212
|
|
|
215
213
|
.col.sm {
|
|
216
|
-
flex: 1
|
|
217
|
-
|
|
214
|
+
flex: 1;
|
|
215
|
+
min-width: 100px;
|
|
218
216
|
}
|
|
217
|
+
|
|
219
218
|
.col.md {
|
|
220
|
-
flex: 2
|
|
221
|
-
|
|
219
|
+
flex: 2;
|
|
220
|
+
justify-content: flex-start;
|
|
221
|
+
min-width: 85px;
|
|
222
222
|
}
|
|
223
|
+
|
|
223
224
|
.col.lg {
|
|
224
|
-
flex:
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
flex: 4;
|
|
226
|
+
justify-content: flex-start;
|
|
227
|
+
min-width: 180px;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.col.date {
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.col.amount,
|
|
234
|
+
.col.price {
|
|
235
|
+
justify-content: flex-end;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.TableHeadData,
|
|
239
|
+
.TableData {
|
|
240
|
+
padding: 10px 5px;
|
|
241
|
+
text-align: left;
|
|
242
|
+
white-space: nowrap;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.TableRow {
|
|
246
|
+
display: flex;
|
|
247
|
+
width: 100%;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.Table {
|
|
251
|
+
width: 100%;
|
|
227
252
|
}
|
|
228
253
|
`;
|
|
229
254
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ChargeLogData } from './types';
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
export const bjsMenu = [
|
|
5
4
|
// {
|
|
6
5
|
// label: 'Add Order Resources',
|
|
@@ -17,7 +16,10 @@ export const optionsMenu = [
|
|
|
17
16
|
{ label: 'Confirm', value: 'confirm-order' },
|
|
18
17
|
{ label: 'Hold', value: 'hold-order' },
|
|
19
18
|
{ label: 'Cancel', value: 'cancel-order' },
|
|
20
|
-
{label:
|
|
19
|
+
{ label: 'Un Hold', value: 'unhold-order' },
|
|
20
|
+
{
|
|
21
|
+
label: 'Un-Cancel',
|
|
22
|
+
value: 'uncancel-order',
|
|
21
23
|
},
|
|
22
24
|
// { label: 'Charge Log', value: 'charge-log' },
|
|
23
25
|
];
|
|
@@ -2,69 +2,53 @@ import styled from 'styled-components';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Skeleton } from 'antd';
|
|
4
4
|
import { formatDateTime } from '@bjsdistribution/dms-component-library';
|
|
5
|
-
import { usegetNotes } from '../store';
|
|
5
|
+
import { useAuditLogLoadingState, usegetNotes } from '../store';
|
|
6
6
|
import { NotesTableData } from '../notes/logs/fakeData';
|
|
7
|
-
import {
|
|
8
|
-
IconCover,
|
|
9
|
-
Td as BaseTd,
|
|
10
|
-
Th,
|
|
11
|
-
Table,
|
|
12
|
-
} from '../../order-daily-overview/common/css/TableStyle';
|
|
13
7
|
|
|
14
8
|
const GenericAuditLogsTable = () => {
|
|
15
9
|
const tableHeadData = NotesTableData[0].tableHead; // Assuming NotesTableData contains table header information
|
|
16
10
|
const [getNotes] = usegetNotes();
|
|
17
|
-
|
|
18
|
-
// const [isLoading] = UseNotesLoading();
|
|
19
|
-
// console.log(getNotes,'getNotesgetNotes');
|
|
11
|
+
const [auditLogLoadingStatus] = useAuditLogLoadingState();
|
|
20
12
|
|
|
21
13
|
return (
|
|
22
14
|
<ScrollableTableWrapper>
|
|
23
15
|
<AuditTableWrapper>
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
))}
|
|
33
|
-
</tr>
|
|
34
|
-
</thead>
|
|
35
|
-
</StyledTable>
|
|
36
|
-
</StickyHeaderWrapper>
|
|
37
|
-
<StyledTable>
|
|
16
|
+
<table>
|
|
17
|
+
<thead>
|
|
18
|
+
<tr>
|
|
19
|
+
{tableHeadData?.map(column => (
|
|
20
|
+
<th key={column.key}>{column.label}</th>
|
|
21
|
+
))}
|
|
22
|
+
</tr>
|
|
23
|
+
</thead>
|
|
38
24
|
<tbody>
|
|
39
|
-
{
|
|
25
|
+
{auditLogLoadingStatus ? (
|
|
40
26
|
<tr>
|
|
41
27
|
<td className="noBoder" colSpan={tableHeadData?.length}>
|
|
42
28
|
<Skeleton />
|
|
43
29
|
</td>
|
|
44
30
|
</tr>
|
|
45
|
-
) : getNotes
|
|
46
|
-
getNotes?.
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
<
|
|
31
|
+
) : getNotes && getNotes?.length > 0 ? (
|
|
32
|
+
getNotes?.map((note: any) => (
|
|
33
|
+
<tr key={note?.id}>
|
|
34
|
+
<td>
|
|
35
|
+
<div className="bold" title={note?.created_by}>
|
|
50
36
|
{note?.created_by}
|
|
51
|
-
</
|
|
37
|
+
</div>
|
|
52
38
|
<div>{formatDateTime(note?.created_at)}</div>
|
|
53
|
-
</
|
|
54
|
-
<
|
|
39
|
+
</td>
|
|
40
|
+
<td
|
|
55
41
|
dangerouslySetInnerHTML={{ __html: note?.description }}
|
|
56
|
-
></
|
|
57
|
-
</
|
|
42
|
+
></td>
|
|
43
|
+
</tr>
|
|
58
44
|
))
|
|
59
45
|
) : (
|
|
60
46
|
<tr>
|
|
61
|
-
<
|
|
62
|
-
No data found
|
|
63
|
-
</NoDataFound>
|
|
47
|
+
<td colSpan={tableHeadData?.length}>No data found</td>
|
|
64
48
|
</tr>
|
|
65
49
|
)}
|
|
66
50
|
</tbody>
|
|
67
|
-
</
|
|
51
|
+
</table>
|
|
68
52
|
</AuditTableWrapper>
|
|
69
53
|
</ScrollableTableWrapper>
|
|
70
54
|
);
|
|
@@ -109,52 +93,10 @@ export const AuditTableWrapper = styled.div`
|
|
|
109
93
|
}
|
|
110
94
|
`;
|
|
111
95
|
|
|
112
|
-
const DateTd = styled(BaseTd)`
|
|
113
|
-
color: #6d6d6d;
|
|
114
|
-
`;
|
|
115
|
-
|
|
116
|
-
const NoDataFound = styled(BaseTd)`
|
|
117
|
-
text-align: center;
|
|
118
|
-
padding: 16px;
|
|
119
|
-
font-size: 16px;
|
|
120
|
-
color: #999;
|
|
121
|
-
`;
|
|
122
|
-
|
|
123
|
-
const StyledTable = styled(Table)`
|
|
124
|
-
width: 100%;
|
|
125
|
-
table-layout: fixed;
|
|
126
|
-
td.noBoder {
|
|
127
|
-
background: none !important;
|
|
128
|
-
border: none !important;
|
|
129
|
-
padding: 0;
|
|
130
|
-
}
|
|
131
|
-
`;
|
|
132
|
-
|
|
133
|
-
const StyledTr = styled.tr`
|
|
134
|
-
&:nth-child(even) {
|
|
135
|
-
background-color: #f3fbff;
|
|
136
|
-
}
|
|
137
|
-
`;
|
|
138
|
-
|
|
139
|
-
const StyledTd = styled(BaseTd)`
|
|
140
|
-
padding: 10px;
|
|
141
|
-
`;
|
|
142
|
-
|
|
143
|
-
const CreatedBy = styled.div`
|
|
144
|
-
font-weight: bold;
|
|
145
|
-
`;
|
|
146
|
-
|
|
147
96
|
const ScrollableTableWrapper = styled.div`
|
|
148
97
|
height: 250px;
|
|
149
98
|
min-height: 200px;
|
|
150
99
|
overflow: auto;
|
|
151
100
|
`;
|
|
152
101
|
|
|
153
|
-
const StickyHeaderWrapper = styled.div`
|
|
154
|
-
position: sticky;
|
|
155
|
-
top: 0;
|
|
156
|
-
z-index: 1;
|
|
157
|
-
background-color: #fff;
|
|
158
|
-
`;
|
|
159
|
-
|
|
160
102
|
export default GenericAuditLogsTable;
|
|
@@ -136,13 +136,6 @@ function OrderView() {
|
|
|
136
136
|
performAction: false,
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
useEffect(() => {
|
|
140
|
-
if (orderId) {
|
|
141
|
-
orderUpdate(true);
|
|
142
|
-
liveRecalling ? setLivePerformAction(false) : setLivePerformAction(true);
|
|
143
|
-
}
|
|
144
|
-
}, [orderId, liveRecalling]);
|
|
145
|
-
|
|
146
139
|
const { data: fetchedStaticData, loading: staticDataLoading } = useApiHook<{
|
|
147
140
|
data: ApiResponse[];
|
|
148
141
|
}>({
|
|
@@ -169,6 +162,12 @@ function OrderView() {
|
|
|
169
162
|
method: 'GET',
|
|
170
163
|
filters: [{ field: 'visibility', op: '=', value: true }],
|
|
171
164
|
});
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
if (orderId) {
|
|
167
|
+
orderUpdate(true);
|
|
168
|
+
liveRecalling ? setLivePerformAction(false) : setLivePerformAction(true);
|
|
169
|
+
}
|
|
170
|
+
}, [orderId, liveRecalling]);
|
|
172
171
|
|
|
173
172
|
useEffect(() => {
|
|
174
173
|
setLoading(staticDataLoading);
|