@bjsdistribution/dms-client-return 0.0.3 → 0.0.5
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/README.md +1 -1
- package/dist/common/date-picker/header/ClearDate.d.ts +1 -1
- package/dist/components/order-daily-overview/common/css/TableStyle.d.ts +4 -4
- package/dist/components/order-daily-overview/table/table-data/styles.d.ts +5 -3
- package/dist/components/order-daily-overview/table-view/TableStyle.d.ts +4 -4
- package/dist/components/order-view/generic-table/AuditLogs.d.ts +4 -0
- package/dist/components/order-view/hooks/useGetEventNotes.d.ts +2 -0
- package/dist/components/order-view/hooks/useGetSystemLogs.d.ts +2 -0
- package/dist/components/order-view/modalsPopup/CreateReturnModal.d.ts +4 -0
- package/dist/components/order-view/notes/logs/fakeData.d.ts +7 -7
- package/dist/components/order-view/store.d.ts +19 -1
- package/dist/components/order-view/system-event-logs/columns/Code.d.ts +3 -0
- package/dist/components/order-view/system-event-logs/columns/Date.d.ts +3 -0
- package/dist/components/order-view/system-event-logs/columns/Event.d.ts +3 -0
- package/dist/components/order-view/system-event-logs/columns/Note.d.ts +3 -0
- package/dist/components/order-view/system-event-logs/columns/index.d.ts +4 -0
- package/dist/components/order-view/system-event-logs/helper.d.ts +7 -0
- package/dist/components/order-view/view-reminder/reminder-styles.d.ts +2 -2
- package/dist/dms-client-return.cjs.development.js +3233 -2176
- 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 +3237 -2180
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/common/expand-collapse/index.tsx +3 -3
- package/src/components/fakeData.ts +14 -23
- package/src/components/order-daily-overview/filters/FilterStyle.tsx +1 -1
- package/src/components/order-daily-overview/filters/Filters.tsx +6 -6
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +15 -6
- package/src/components/order-daily-overview/header-filters/Styledfilters.tsx +1 -0
- package/src/components/order-daily-overview/header-filters/filterStore.ts +1 -1
- package/src/components/order-daily-overview/index.tsx +36 -32
- package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +8 -3
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +25 -19
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +17 -15
- package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +10 -3
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +4 -0
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +69 -19
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/RightFilters.tsx +35 -38
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +7 -1
- package/src/components/order-daily-overview/table/ReturnTable.tsx +30 -92
- package/src/components/order-daily-overview/table/table-data/styles.ts +15 -0
- package/src/components/order-view/details-filters/DetailsFilters.tsx +2 -2
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +0 -2
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDown.tsx +2 -5
- package/src/components/order-view/generic-table/AuditLogs.tsx +96 -0
- package/src/components/order-view/hooks/useGetEventNotes.tsx +47 -0
- package/src/components/order-view/hooks/useGetSystemLogs.tsx +60 -0
- package/src/components/order-view/index.tsx +22 -3
- package/src/components/order-view/modalsPopup/CreateReturnModal.tsx +83 -0
- package/src/components/order-view/modalsPopup/ModalManager.tsx +49 -49
- package/src/components/order-view/notes/AddNote.tsx +127 -13
- package/src/components/order-view/notes/index.tsx +100 -3
- package/src/components/order-view/notes/logs/fakeData.ts +8 -48
- package/src/components/order-view/notes/logs/index.tsx +6 -45
- package/src/components/order-view/order-resources/collapsed-content/index.tsx +1 -1
- package/src/components/order-view/products-info/expanded-content/index.tsx +2 -2
- package/src/components/order-view/products-info/index.tsx +3 -2
- package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +29 -33
- package/src/components/order-view/store.ts +40 -2
- package/src/components/order-view/system-event-logs/collapsed-content/index.tsx +1 -1
- package/src/components/order-view/system-event-logs/columns/Code.tsx +17 -0
- package/src/components/order-view/system-event-logs/columns/Date.tsx +18 -0
- package/src/components/order-view/system-event-logs/columns/Event.tsx +26 -0
- package/src/components/order-view/system-event-logs/columns/Note.tsx +24 -0
- package/src/components/order-view/system-event-logs/columns/index.tsx +6 -0
- package/src/components/order-view/system-event-logs/expanded-content/index.tsx +34 -6
- package/src/components/order-view/system-event-logs/helper.ts +29 -0
- package/src/index.tsx +34 -5
- package/dist/components/order-view/system-event-logs/system-logs-table/SystemLogsTables.d.ts +0 -3
- package/dist/components/order-view/system-event-logs/system-logs-table/SytemLogsStyles.d.ts +0 -3
- package/src/components/order-view/system-event-logs/system-logs-table/SystemLogsTables.tsx +0 -59
- package/src/components/order-view/system-event-logs/system-logs-table/SytemLogsStyles.tsx +0 -239
|
@@ -1,9 +1,107 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import AddNote from './AddNote';
|
|
4
4
|
import AuditLogs from './logs';
|
|
5
|
-
|
|
5
|
+
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
6
|
+
import {
|
|
7
|
+
useCallAPi,
|
|
8
|
+
usegetNotes,
|
|
9
|
+
usemoduleIds,
|
|
10
|
+
UseNotesLoading,
|
|
11
|
+
useOrderId,
|
|
12
|
+
} from '../store';
|
|
13
|
+
import { useLocation } from 'react-router-dom';
|
|
6
14
|
function Notes() {
|
|
15
|
+
const [moduleIds, setModuleIds] = usemoduleIds();
|
|
16
|
+
const [orderId] = useOrderId();
|
|
17
|
+
const location = useLocation();
|
|
18
|
+
const pathname = location.pathname;
|
|
19
|
+
const orderIdLocaation = pathname.split('/')[1];
|
|
20
|
+
const [, setNoteLoadingStore] = UseNotesLoading();
|
|
21
|
+
const [, setNotes] = usegetNotes();
|
|
22
|
+
const [loderStatus] = useCallAPi();
|
|
23
|
+
|
|
24
|
+
// Declare `allIds` state to store the comma-separated IDs
|
|
25
|
+
// const [allIds, setAllIds] = useState<string | null>(null);
|
|
26
|
+
|
|
27
|
+
// Fetch module IDs
|
|
28
|
+
const { data: fetchedData, loading: apiLoading } = useApiHook<{ data: any }>({
|
|
29
|
+
endpoint: 'audit_logs/modules/',
|
|
30
|
+
method: 'GET',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!apiLoading && fetchedData?.data) {
|
|
35
|
+
const modules =
|
|
36
|
+
fetchedData?.data
|
|
37
|
+
.filter((item: any) => item?.name === 'ORDER')
|
|
38
|
+
.flatMap((item: any) =>
|
|
39
|
+
item?.static_child_mappings?.map((child: any) => ({
|
|
40
|
+
id: child?.child_module?.id,
|
|
41
|
+
name: child?.child_module?.name,
|
|
42
|
+
parentId: child?.parent_module?.id,
|
|
43
|
+
parentName: child?.parent_module?.name,
|
|
44
|
+
}))
|
|
45
|
+
) || [];
|
|
46
|
+
|
|
47
|
+
// console.log(modules, 'modulesmodules');
|
|
48
|
+
|
|
49
|
+
// const ids = modules?.map((module: any) => module.id).join(',');
|
|
50
|
+
// setAllIds(ids);
|
|
51
|
+
|
|
52
|
+
// console.log(ids, 'allIds');
|
|
53
|
+
|
|
54
|
+
const orderNoteModule = modules?.find(
|
|
55
|
+
(module: any) => module?.name === 'ORDER-NOTE'
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
setModuleIds(orderNoteModule || modules[0] || null);
|
|
59
|
+
}
|
|
60
|
+
}, [apiLoading, fetchedData]);
|
|
61
|
+
|
|
62
|
+
// Fetch Notes Data when `allIds` is available
|
|
63
|
+
const {
|
|
64
|
+
data: NotesData,
|
|
65
|
+
loading: NotesLoading,
|
|
66
|
+
setShouldPerformAction,
|
|
67
|
+
} = useApiHook<{ data: any }>({
|
|
68
|
+
// Use `allIds` in the endpoint if it's set
|
|
69
|
+
endpoint: `audit_logs/?module_id=${
|
|
70
|
+
moduleIds?.parentId
|
|
71
|
+
}&module_object_id=${orderId || orderIdLocaation}
|
|
72
|
+
`,
|
|
73
|
+
method: 'GET',
|
|
74
|
+
performAction: false,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// &sub_module_ids=${allIds}
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
setNoteLoadingStore(true);
|
|
81
|
+
if (moduleIds) {
|
|
82
|
+
// Ensure `allIds` is set
|
|
83
|
+
setShouldPerformAction(true);
|
|
84
|
+
}
|
|
85
|
+
if (!NotesLoading && NotesData?.data) {
|
|
86
|
+
const updatedData = NotesData?.data
|
|
87
|
+
// .filter((item: any) => item['ORDER-NOTE'] || item['ORDER'])
|
|
88
|
+
// .map((item: any) => [item['ORDER-NOTE'], item['ORDER']])
|
|
89
|
+
.flat()
|
|
90
|
+
.filter(Boolean);
|
|
91
|
+
|
|
92
|
+
const combinedArray = updatedData.flat();
|
|
93
|
+
combinedArray.sort(
|
|
94
|
+
(a: any, b: any) =>
|
|
95
|
+
new Date(b.created_at).getTime() - new Date(a.created_at).getTime()
|
|
96
|
+
);
|
|
97
|
+
setNotes(combinedArray);
|
|
98
|
+
setNoteLoadingStore(NotesLoading);
|
|
99
|
+
loderStatus
|
|
100
|
+
? setShouldPerformAction(true)
|
|
101
|
+
: setShouldPerformAction(false);
|
|
102
|
+
}
|
|
103
|
+
}, [moduleIds, NotesLoading, loderStatus]); // Add `allIds` to dependencies
|
|
104
|
+
|
|
7
105
|
return (
|
|
8
106
|
<Container>
|
|
9
107
|
<CardHeader>NOTES</CardHeader>
|
|
@@ -31,7 +129,6 @@ const CardHeader = styled.div`
|
|
|
31
129
|
text-transform: uppercase;
|
|
32
130
|
font-family: 'Roboto', sans-serif;
|
|
33
131
|
font-weight: 600;
|
|
34
|
-
|
|
35
132
|
`;
|
|
36
133
|
|
|
37
134
|
const CustomizedFormSection = styled.div`
|
|
@@ -1,50 +1,10 @@
|
|
|
1
|
-
export const
|
|
2
|
-
{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
product_id: 'GS601',
|
|
12
|
-
created_at: '22/01/2024 07:22:47',
|
|
13
|
-
updated_at: '22/01/2024 07:22:47',
|
|
14
|
-
created_by: 'Manpreet - DMS @ Upload Doc',
|
|
15
|
-
note: 'Uploaded doc for Assemble and Disassemble service instruction.',
|
|
16
|
-
id: 2,
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
product_id: 'GS601',
|
|
20
|
-
created_at: '22/01/2024 07:22:47',
|
|
21
|
-
updated_at: '22/01/2024 07:22:47',
|
|
22
|
-
created_by: 'Manpreet - DMS @ Upload Doc',
|
|
23
|
-
note: 'Uploaded doc for Assemble and Disassemble service instruction.',
|
|
24
|
-
id: 3,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
product_id: 'GS601',
|
|
28
|
-
created_at: '22/01/2024 07:22:47',
|
|
29
|
-
updated_at: '22/01/2024 07:22:47',
|
|
30
|
-
created_by: 'Manpreet - DMS @ Upload Doc',
|
|
31
|
-
note: 'Uploaded doc for Assemble and Disassemble service instruction.',
|
|
32
|
-
id: 4,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
product_id: 'GS601',
|
|
36
|
-
created_at: '22/01/2024 07:22:47',
|
|
37
|
-
updated_at: '22/01/2024 07:22:47',
|
|
38
|
-
created_by: 'Manpreet - DMS @ Upload Doc',
|
|
39
|
-
note: 'Uploaded doc for Assemble and Disassemble service instruction.',
|
|
40
|
-
id: 5,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
product_id: 'GS601',
|
|
44
|
-
created_at: '22/01/2024 07:22:47',
|
|
45
|
-
updated_at: '22/01/2024 07:22:47',
|
|
46
|
-
created_by: 'Manpreet - DMS @ Upload Doc',
|
|
47
|
-
note: 'Uploaded doc for Assemble and Disassemble service instruction.',
|
|
48
|
-
id: 6,
|
|
1
|
+
export const NotesTableData = [
|
|
2
|
+
{
|
|
3
|
+
tableHead: [
|
|
4
|
+
{ key: 'startFinish', label: 'Created', alwaysVisible: true },
|
|
5
|
+
{ key: 'routeDetails', label: 'Notes', alwaysVisible: true },
|
|
6
|
+
],
|
|
7
|
+
tableBody: [
|
|
8
|
+
],
|
|
49
9
|
},
|
|
50
10
|
];
|
|
@@ -1,59 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
// import { tableColumns } from './helper';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import CustomScrollBar from '../../../../common/scrollbar';
|
|
7
|
-
// import GenericAuditLogsTable from '../../../add-order/order-details/common/generic-table/AuditLogs';
|
|
8
|
-
// import { fakeData } from './fakeData';
|
|
3
|
+
import GenericAuditLogsTable from '../../generic-table/AuditLogs';
|
|
4
|
+
// import CustomScrollBar from '../../../../common/scrollbar';
|
|
9
5
|
|
|
10
6
|
function AuditLogs() {
|
|
11
7
|
return (
|
|
12
8
|
<Container>
|
|
13
|
-
<CustomScrollBar>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<thead>
|
|
17
|
-
<tr>
|
|
18
|
-
{/* <th className="emailInvoiceNo">Invoice No.</th> */}
|
|
19
|
-
<th>Created</th>
|
|
20
|
-
<th>Notes</th>
|
|
21
|
-
</tr>
|
|
22
|
-
</thead>
|
|
23
|
-
<tbody>
|
|
24
|
-
{data?.map((invoice: any) => (
|
|
25
|
-
<tr key={invoice.id}>
|
|
26
|
-
<td>
|
|
27
|
-
<ul style={{ listStyleType: 'none', padding: 0 }}>
|
|
28
|
-
<li
|
|
29
|
-
style={{
|
|
30
|
-
color: '#3A3630',
|
|
31
|
-
fontWeight: 600,
|
|
32
|
-
paddingLeft: 0,
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
{' '}
|
|
36
|
-
{invoice?.notes}
|
|
37
|
-
</li>
|
|
38
|
-
<li style={{ color: '#888075' }}>{invoice?.date}</li>
|
|
39
|
-
</ul>
|
|
40
|
-
</td>
|
|
41
|
-
<td>{invoice?.customer_name}</td>
|
|
42
|
-
</tr>
|
|
43
|
-
))}
|
|
44
|
-
</tbody>
|
|
45
|
-
</NotesStyledTable>
|
|
46
|
-
</NotesStyledTableWrapper>
|
|
47
|
-
{/* <CustomScrollBar> */}
|
|
48
|
-
{/* <GenericAuditLogsTable columns={tableColumns} data={fakeData} /> */}
|
|
49
|
-
{/* </CustomScrollBar> */}
|
|
50
|
-
</CustomScrollBar>
|
|
9
|
+
{/* <CustomScrollBar> */}
|
|
10
|
+
<GenericAuditLogsTable />
|
|
11
|
+
{/* </CustomScrollBar> */}
|
|
51
12
|
</Container>
|
|
52
13
|
);
|
|
53
14
|
}
|
|
54
15
|
|
|
55
16
|
const Container = styled.div`
|
|
56
|
-
height:
|
|
17
|
+
height: 295px; /* Set height to limit container size */
|
|
57
18
|
overflow: auto; /* Enable scrolling */
|
|
58
19
|
scrollbar-width: thin;
|
|
59
20
|
`;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import ProductTable from '../../return-client-products/ProductTable';
|
|
4
4
|
// import OrderDetailsFooter from '../../order-details/expanded-content/footer';
|
|
5
|
-
import NewReturnDropdown from '../../notes/order-dropdown/NewReturnDropdown';
|
|
5
|
+
// import NewReturnDropdown from '../../notes/order-dropdown/NewReturnDropdown';
|
|
6
6
|
import { Button } from '@bjsdistribution/dms-component-library';
|
|
7
7
|
|
|
8
8
|
function ExpandedContent() {
|
|
@@ -17,7 +17,7 @@ function ExpandedContent() {
|
|
|
17
17
|
<Button style={{ borderRadius: '20px' }} onClick={SaveNote}>
|
|
18
18
|
SAVE Details
|
|
19
19
|
</Button>
|
|
20
|
-
<NewReturnDropdown />
|
|
20
|
+
{/* <NewReturnDropdown /> */}
|
|
21
21
|
</SaveNoteContainer>
|
|
22
22
|
</MidConatiner>
|
|
23
23
|
</Container>
|
|
@@ -16,8 +16,9 @@ interface ApiResponse {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function ProductsInfo() {
|
|
19
|
-
const [
|
|
20
|
-
const customerData =
|
|
19
|
+
const [data] = useOrderDetails();
|
|
20
|
+
const customerData = data;
|
|
21
|
+
|
|
21
22
|
// For API Call
|
|
22
23
|
const [, setAPidata] = useProductDetails();
|
|
23
24
|
const [, setLoading] = useLoading();
|
package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx
CHANGED
|
@@ -4,27 +4,29 @@ import {
|
|
|
4
4
|
StyledTableWrapper,
|
|
5
5
|
} from '../../../order-daily-overview/return-order-table/return-orders-filters/returnstyles';
|
|
6
6
|
import { Checkbox } from '@bjsdistribution/dms-component-library';
|
|
7
|
-
import { data } from '../../../order-daily-overview/table/table-data/Fakedata';
|
|
7
|
+
// import { data } from '../../../order-daily-overview/table/table-data/Fakedata';
|
|
8
8
|
import ActionIcon from '../../../../assets/icons/ActionIcon';
|
|
9
9
|
import { useSelectedOrders } from '../../../store';
|
|
10
|
+
import { useProductDetails } from '../../store';
|
|
10
11
|
|
|
11
12
|
const ReturnProductTable = () => {
|
|
12
|
-
const [selectedInvoices
|
|
13
|
-
const [selectAll
|
|
13
|
+
const [selectedInvoices] = useSelectedOrders();
|
|
14
|
+
const [selectAll] = useState(false);
|
|
15
|
+
const [productData] = useProductDetails();
|
|
14
16
|
|
|
15
|
-
const handleSelectAll = (e: any) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
17
|
+
// const handleSelectAll = (e: any) => {
|
|
18
|
+
// setSelectAll(e.target.checked);
|
|
19
|
+
// if (e.target.checked) {
|
|
20
|
+
// setSelectedInvoices(
|
|
21
|
+
// productData.map((invoice: any) => ({
|
|
22
|
+
// id: invoice.id,
|
|
23
|
+
// status_id: 3,
|
|
24
|
+
// }))
|
|
25
|
+
// );
|
|
26
|
+
// } else {
|
|
27
|
+
// setSelectedInvoices([]);
|
|
28
|
+
// }
|
|
29
|
+
// };
|
|
28
30
|
|
|
29
31
|
return (
|
|
30
32
|
<div>
|
|
@@ -33,7 +35,7 @@ const ReturnProductTable = () => {
|
|
|
33
35
|
<thead>
|
|
34
36
|
<tr>
|
|
35
37
|
<th className="emailInvoiceCheckbox">
|
|
36
|
-
<Checkbox checked={selectAll} onChange={
|
|
38
|
+
<Checkbox checked={selectAll} onChange={() => {}} />
|
|
37
39
|
</th>
|
|
38
40
|
<th> Location</th>
|
|
39
41
|
<th>Sender</th>
|
|
@@ -45,7 +47,7 @@ const ReturnProductTable = () => {
|
|
|
45
47
|
</tr>
|
|
46
48
|
</thead>
|
|
47
49
|
<tbody>
|
|
48
|
-
{
|
|
50
|
+
{productData?.map((invoice: any) => (
|
|
49
51
|
<tr key={invoice.id}>
|
|
50
52
|
<td>
|
|
51
53
|
<Checkbox
|
|
@@ -56,25 +58,19 @@ const ReturnProductTable = () => {
|
|
|
56
58
|
/>
|
|
57
59
|
</td>
|
|
58
60
|
|
|
59
|
-
<td>{
|
|
61
|
+
<td>{'N/A'}</td>
|
|
60
62
|
|
|
61
63
|
<td>
|
|
62
|
-
<ul style={{ listStyleType: 'none', padding: 0 }}>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
paddingLeft: 0,
|
|
68
|
-
}}
|
|
69
|
-
>
|
|
70
|
-
{invoice?.customer_name}
|
|
71
|
-
</li>
|
|
72
|
-
</ul>
|
|
64
|
+
{/* <ul style={{ listStyleType: 'none', padding: 0 }}> */}
|
|
65
|
+
{/* <li> */}
|
|
66
|
+
{'N/A'}
|
|
67
|
+
{/* </li> */}
|
|
68
|
+
{/* </ul> */}
|
|
73
69
|
</td>
|
|
74
70
|
|
|
75
|
-
<td>{invoice?.
|
|
76
|
-
<td>{invoice?.
|
|
77
|
-
<td>{
|
|
71
|
+
<td>{invoice?.code}</td>
|
|
72
|
+
<td>{invoice?.description}</td>
|
|
73
|
+
<td>{'N/A'}</td>
|
|
78
74
|
<td>1 of 1</td>
|
|
79
75
|
|
|
80
76
|
{/* <td onClick={() => dispatch({ type: 'email-sent' })}>
|
|
@@ -230,6 +230,42 @@ export const selectedProductIdAtom = atom<number | null>(null);
|
|
|
230
230
|
|
|
231
231
|
export const selectedTabKeyAtom = atom<string>('1');
|
|
232
232
|
|
|
233
|
+
const eventNotesData = atom<any>([]);
|
|
234
|
+
function useEventNotesData() {
|
|
235
|
+
return useAtom(eventNotesData);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const orderProductSystemLogs = atom<any>([]);
|
|
239
|
+
function useOrderProductSystemLogs() {
|
|
240
|
+
return useAtom(orderProductSystemLogs);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const moduleIds = atom<{
|
|
244
|
+
id?: string;
|
|
245
|
+
parentId?: string;
|
|
246
|
+
} | null>(null);
|
|
247
|
+
|
|
248
|
+
export function usemoduleIds() {
|
|
249
|
+
return useAtom(moduleIds);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const CallAPi = atom(false);
|
|
253
|
+
|
|
254
|
+
export function useCallAPi() {
|
|
255
|
+
return useAtom(CallAPi);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const NotesLoading = atom<boolean>(true);
|
|
259
|
+
export const UseNotesLoading = () => {
|
|
260
|
+
return useAtom(NotesLoading);
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
const notes = atom<any>([]);
|
|
264
|
+
|
|
265
|
+
export function usegetNotes() {
|
|
266
|
+
return useAtom(notes);
|
|
267
|
+
}
|
|
268
|
+
|
|
233
269
|
export const errorAtom = atom({
|
|
234
270
|
homeError: '',
|
|
235
271
|
mobileError: '',
|
|
@@ -253,12 +289,14 @@ export {
|
|
|
253
289
|
useClientData,
|
|
254
290
|
useReturnData,
|
|
255
291
|
useReturnAfterOrderData,
|
|
292
|
+
useEventNotesData,
|
|
293
|
+
useOrderProductSystemLogs,
|
|
256
294
|
};
|
|
257
295
|
// Popup state Manage
|
|
258
296
|
const initialState = null;
|
|
259
297
|
const popupReducer = (state: any, action: any) => {
|
|
260
|
-
if (action.type === '
|
|
261
|
-
state = '
|
|
298
|
+
if (action.type === 'create-return') {
|
|
299
|
+
state = 'create-return';
|
|
262
300
|
return { state };
|
|
263
301
|
} else if (action.type === 'addProduct') {
|
|
264
302
|
state = 'addProduct';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
function Code(props: any) {
|
|
5
|
+
const data = props?.row?.original.event_code;
|
|
6
|
+
return (
|
|
7
|
+
<RowContainer>
|
|
8
|
+
<Row>{data}</Row>
|
|
9
|
+
</RowContainer>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const RowContainer = styled.div``;
|
|
14
|
+
|
|
15
|
+
const Row = styled.div``;
|
|
16
|
+
|
|
17
|
+
export default Code;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { formatDate } from '../../order-actions/utils';
|
|
4
|
+
|
|
5
|
+
function Date(props: any) {
|
|
6
|
+
const data = props?.row?.original.created_at;
|
|
7
|
+
return (
|
|
8
|
+
<RowContainer>
|
|
9
|
+
<Row>{formatDate(data)}</Row>
|
|
10
|
+
</RowContainer>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const RowContainer = styled.div``;
|
|
15
|
+
|
|
16
|
+
const Row = styled.div``;
|
|
17
|
+
|
|
18
|
+
export default Date;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { useEventNotesData } from '../../store';
|
|
4
|
+
|
|
5
|
+
function Event(props: any) {
|
|
6
|
+
const data = props?.row?.original.event_information_id;
|
|
7
|
+
const [notesData] = useEventNotesData();
|
|
8
|
+
|
|
9
|
+
const getDescription = (eventId: number | undefined) => {
|
|
10
|
+
if (eventId === undefined || notesData?.length === 0) return '';
|
|
11
|
+
|
|
12
|
+
const eventData = notesData?.find((note: any) => note?.id === eventId);
|
|
13
|
+
return eventData ? eventData?.description : 'N/A';
|
|
14
|
+
};
|
|
15
|
+
return (
|
|
16
|
+
<RowContainer>
|
|
17
|
+
<Row>{getDescription(data)}</Row>
|
|
18
|
+
</RowContainer>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const RowContainer = styled.div``;
|
|
23
|
+
|
|
24
|
+
const Row = styled.div``;
|
|
25
|
+
|
|
26
|
+
export default Event;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
function Note(props: any) {
|
|
5
|
+
const data = props?.row?.original?.event_notes;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<RowContainer title={data}>
|
|
9
|
+
<Row>{data}</Row>
|
|
10
|
+
</RowContainer>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const RowContainer = styled.div`
|
|
15
|
+
display: inline-block;
|
|
16
|
+
max-width: 200px;
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
text-overflow: ellipsis;
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const Row = styled.div``;
|
|
23
|
+
|
|
24
|
+
export default Note;
|
|
@@ -1,17 +1,45 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import CollapsedContent from '../collapsed-content';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import CollapsableForm from '../../../../common/expand-collapse';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import DynamicTable from '../../DynamicTable';
|
|
6
|
+
import {
|
|
7
|
+
useEventNotesData,
|
|
8
|
+
useOrderDetails,
|
|
9
|
+
useOrderProductSystemLogs,
|
|
10
|
+
} from '../../store';
|
|
11
|
+
import { tableColumns } from '../helper';
|
|
12
|
+
import useGetEventNotes from '../../hooks/useGetEventNotes';
|
|
8
13
|
|
|
9
14
|
function SystemLogs() {
|
|
15
|
+
const [systemLogs] = useOrderProductSystemLogs();
|
|
16
|
+
|
|
17
|
+
const [orderDetails] = useOrderDetails();
|
|
18
|
+
const systemLogsData = useGetEventNotes();
|
|
19
|
+
const [, setNotesData] = useEventNotesData();
|
|
20
|
+
const gsitId = orderDetails?.gsit_order_id;
|
|
21
|
+
|
|
22
|
+
const fetchReminderData = async () => {
|
|
23
|
+
try {
|
|
24
|
+
const result = await systemLogsData();
|
|
25
|
+
if (result) {
|
|
26
|
+
setNotesData(result);
|
|
27
|
+
}
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error('Error fetching event notes:', error);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (gsitId) {
|
|
35
|
+
fetchReminderData();
|
|
36
|
+
}
|
|
37
|
+
}, [gsitId, setNotesData]);
|
|
38
|
+
|
|
10
39
|
return (
|
|
11
40
|
<Table>
|
|
12
41
|
<CollapsableForm collapsedContent={<CollapsedContent />}>
|
|
13
|
-
|
|
14
|
-
<SystemLogsTables />
|
|
42
|
+
<DynamicTable columns={tableColumns} data={systemLogs} />
|
|
15
43
|
</CollapsableForm>
|
|
16
44
|
</Table>
|
|
17
45
|
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {Note, Code, Event, Date } from "./columns";
|
|
2
|
+
|
|
3
|
+
export const tableColumns = [
|
|
4
|
+
{
|
|
5
|
+
header: 'Date',
|
|
6
|
+
accessorKey: 'date',
|
|
7
|
+
cell: Date,
|
|
8
|
+
enableSorting: false,
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
{
|
|
12
|
+
header: 'Code',
|
|
13
|
+
accessorKey: 'code',
|
|
14
|
+
cell: Code,
|
|
15
|
+
enableSorting: false,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
header: 'Event',
|
|
19
|
+
accessorKey: 'event',
|
|
20
|
+
cell: Event,
|
|
21
|
+
enableSorting: false,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
header: 'Note',
|
|
25
|
+
accessorKey: 'note',
|
|
26
|
+
cell: Note,
|
|
27
|
+
enableSorting: false,
|
|
28
|
+
},
|
|
29
|
+
];
|