@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.
Files changed (74) hide show
  1. package/README.md +1 -1
  2. package/dist/common/date-picker/header/ClearDate.d.ts +1 -1
  3. package/dist/components/order-daily-overview/common/css/TableStyle.d.ts +4 -4
  4. package/dist/components/order-daily-overview/table/table-data/styles.d.ts +5 -3
  5. package/dist/components/order-daily-overview/table-view/TableStyle.d.ts +4 -4
  6. package/dist/components/order-view/generic-table/AuditLogs.d.ts +4 -0
  7. package/dist/components/order-view/hooks/useGetEventNotes.d.ts +2 -0
  8. package/dist/components/order-view/hooks/useGetSystemLogs.d.ts +2 -0
  9. package/dist/components/order-view/modalsPopup/CreateReturnModal.d.ts +4 -0
  10. package/dist/components/order-view/notes/logs/fakeData.d.ts +7 -7
  11. package/dist/components/order-view/store.d.ts +19 -1
  12. package/dist/components/order-view/system-event-logs/columns/Code.d.ts +3 -0
  13. package/dist/components/order-view/system-event-logs/columns/Date.d.ts +3 -0
  14. package/dist/components/order-view/system-event-logs/columns/Event.d.ts +3 -0
  15. package/dist/components/order-view/system-event-logs/columns/Note.d.ts +3 -0
  16. package/dist/components/order-view/system-event-logs/columns/index.d.ts +4 -0
  17. package/dist/components/order-view/system-event-logs/helper.d.ts +7 -0
  18. package/dist/components/order-view/view-reminder/reminder-styles.d.ts +2 -2
  19. package/dist/dms-client-return.cjs.development.js +3233 -2176
  20. package/dist/dms-client-return.cjs.development.js.map +1 -1
  21. package/dist/dms-client-return.cjs.production.min.js +1 -1
  22. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  23. package/dist/dms-client-return.esm.js +3237 -2180
  24. package/dist/dms-client-return.esm.js.map +1 -1
  25. package/package.json +2 -2
  26. package/src/common/expand-collapse/index.tsx +3 -3
  27. package/src/components/fakeData.ts +14 -23
  28. package/src/components/order-daily-overview/filters/FilterStyle.tsx +1 -1
  29. package/src/components/order-daily-overview/filters/Filters.tsx +6 -6
  30. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +15 -6
  31. package/src/components/order-daily-overview/header-filters/Styledfilters.tsx +1 -0
  32. package/src/components/order-daily-overview/header-filters/filterStore.ts +1 -1
  33. package/src/components/order-daily-overview/index.tsx +36 -32
  34. package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +8 -3
  35. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +25 -19
  36. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +17 -15
  37. package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +10 -3
  38. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +4 -0
  39. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +69 -19
  40. package/src/components/order-daily-overview/return-order-table/return-orders-filters/RightFilters.tsx +35 -38
  41. package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +7 -1
  42. package/src/components/order-daily-overview/table/ReturnTable.tsx +30 -92
  43. package/src/components/order-daily-overview/table/table-data/styles.ts +15 -0
  44. package/src/components/order-view/details-filters/DetailsFilters.tsx +2 -2
  45. package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +0 -2
  46. package/src/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDown.tsx +2 -5
  47. package/src/components/order-view/generic-table/AuditLogs.tsx +96 -0
  48. package/src/components/order-view/hooks/useGetEventNotes.tsx +47 -0
  49. package/src/components/order-view/hooks/useGetSystemLogs.tsx +60 -0
  50. package/src/components/order-view/index.tsx +22 -3
  51. package/src/components/order-view/modalsPopup/CreateReturnModal.tsx +83 -0
  52. package/src/components/order-view/modalsPopup/ModalManager.tsx +49 -49
  53. package/src/components/order-view/notes/AddNote.tsx +127 -13
  54. package/src/components/order-view/notes/index.tsx +100 -3
  55. package/src/components/order-view/notes/logs/fakeData.ts +8 -48
  56. package/src/components/order-view/notes/logs/index.tsx +6 -45
  57. package/src/components/order-view/order-resources/collapsed-content/index.tsx +1 -1
  58. package/src/components/order-view/products-info/expanded-content/index.tsx +2 -2
  59. package/src/components/order-view/products-info/index.tsx +3 -2
  60. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +29 -33
  61. package/src/components/order-view/store.ts +40 -2
  62. package/src/components/order-view/system-event-logs/collapsed-content/index.tsx +1 -1
  63. package/src/components/order-view/system-event-logs/columns/Code.tsx +17 -0
  64. package/src/components/order-view/system-event-logs/columns/Date.tsx +18 -0
  65. package/src/components/order-view/system-event-logs/columns/Event.tsx +26 -0
  66. package/src/components/order-view/system-event-logs/columns/Note.tsx +24 -0
  67. package/src/components/order-view/system-event-logs/columns/index.tsx +6 -0
  68. package/src/components/order-view/system-event-logs/expanded-content/index.tsx +34 -6
  69. package/src/components/order-view/system-event-logs/helper.ts +29 -0
  70. package/src/index.tsx +34 -5
  71. package/dist/components/order-view/system-event-logs/system-logs-table/SystemLogsTables.d.ts +0 -3
  72. package/dist/components/order-view/system-event-logs/system-logs-table/SytemLogsStyles.d.ts +0 -3
  73. package/src/components/order-view/system-event-logs/system-logs-table/SystemLogsTables.tsx +0 -59
  74. 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 fakeData = [
2
- {
3
- product_id: 'GS600',
4
- created_at: '15/01/2024 06:22:47',
5
- updated_at: '15/01/2024 06:22:47',
6
- created_by: 'BJS Validation Via API',
7
- note: 'New Product Added as per above client',
8
- id: 1,
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 { data } from '../../../order-daily-overview/table/table-data/Fakedata';
5
- import { NotesStyledTable, NotesStyledTableWrapper } from './NotestableStyles';
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
- <NotesStyledTableWrapper id="tableScrolling">
15
- <NotesStyledTable>
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: 230px; /* Set height to limit container size */
17
+ height: 295px; /* Set height to limit container size */
57
18
  overflow: auto; /* Enable scrolling */
58
19
  scrollbar-width: thin;
59
20
  `;
@@ -9,6 +9,6 @@ const Font = styled.div`
9
9
  font-size: 16px;
10
10
  font-style: normal;
11
11
  font-weight: 500;
12
- line-height: 24px; /* 150% */
12
+ line-height: 20px; /* 150% */
13
13
  `;
14
14
  export default CollapsedContent;
@@ -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 [Data] = useOrderDetails();
20
- const customerData = Data;
19
+ const [data] = useOrderDetails();
20
+ const customerData = data;
21
+
21
22
  // For API Call
22
23
  const [, setAPidata] = useProductDetails();
23
24
  const [, setLoading] = useLoading();
@@ -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, setSelectedInvoices] = useSelectedOrders();
13
- const [selectAll, setSelectAll] = useState(false);
13
+ const [selectedInvoices] = useSelectedOrders();
14
+ const [selectAll] = useState(false);
15
+ const [productData] = useProductDetails();
14
16
 
15
- const handleSelectAll = (e: any) => {
16
- setSelectAll(e.target.checked);
17
- if (e.target.checked) {
18
- setSelectedInvoices(
19
- data.map((invoice: any) => ({
20
- id: invoice.id,
21
- status_id: 3,
22
- }))
23
- );
24
- } else {
25
- setSelectedInvoices([]);
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={handleSelectAll} />
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
- {data?.map((invoice: any) => (
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>{invoice?.customer_name}</td>
61
+ <td>{'N/A'}</td>
60
62
 
61
63
  <td>
62
- <ul style={{ listStyleType: 'none', padding: 0 }}>
63
- <li
64
- style={{
65
- color: '#0099ff',
66
- fontWeight: 600,
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?.customer_name}</td>
76
- <td>{invoice?.customer_name}</td>
77
- <td>{invoice?.customer_name}</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 === 'bulkUpdate') {
261
- state = 'bulkUpdate';
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';
@@ -11,6 +11,6 @@ const Font = styled.div`
11
11
  font-size: 16px;
12
12
  font-style: normal;
13
13
  font-weight: 500;
14
- line-height: 24px; /* 150% */
14
+ line-height: 20px; /* 150% */
15
15
  `;
16
16
  export default SystemCollapsedContent;
@@ -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;
@@ -0,0 +1,6 @@
1
+ export { default as Event } from './Event';
2
+ export { default as Date } from './Date';
3
+ // export { default as Actions } from './actions/index';
4
+ export { default as Code } from './Code';
5
+
6
+ export { default as Note } from './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
- // import DynamicTable from '../../DynamicTable';
6
- // import { SystemEventColumns, systemLgsEvents } from '../../../fakeData';
7
- import SystemLogsTables from '../system-logs-table/SystemLogsTables';
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
- {/* <DynamicTable columns={SystemEventColumns} data={systemLgsEvents} /> */}
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
+ ];