@bjsdistribution/dms-client-return 0.0.81 → 0.0.83

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 (37) hide show
  1. package/dist/components/order-view/DynamicTable.d.ts +4 -1
  2. package/dist/components/order-view/notification/ReminderTemplate.d.ts +1 -1
  3. package/dist/components/order-view/notification/Tabs.d.ts +1 -1
  4. package/dist/components/order-view/order-actions/Dropdown.d.ts +1 -0
  5. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrder.d.ts +3 -0
  6. package/dist/components/store.d.ts +2 -1
  7. package/dist/dms-client-return.cjs.development.js +948 -400
  8. package/dist/dms-client-return.cjs.development.js.map +1 -1
  9. package/dist/dms-client-return.cjs.production.min.js +1 -1
  10. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  11. package/dist/dms-client-return.esm.js +983 -435
  12. package/dist/dms-client-return.esm.js.map +1 -1
  13. package/package.json +1 -1
  14. package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +1 -1
  15. package/src/components/order-view/DynamicTable.tsx +115 -90
  16. package/src/components/order-view/fakedata.ts +4 -2
  17. package/src/components/order-view/generic-table/AuditLogs.tsx +23 -81
  18. package/src/components/order-view/index.tsx +9 -7
  19. package/src/components/order-view/notes/NoteType.tsx +12 -1
  20. package/src/components/order-view/notes/index.tsx +46 -33
  21. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +17 -4
  22. package/src/components/order-view/notification/ReminderTemplate.tsx +10 -11
  23. package/src/components/order-view/notification/Tabs.tsx +26 -6
  24. package/src/components/order-view/notification/index.tsx +47 -13
  25. package/src/components/order-view/order-actions/Dropdown.tsx +10 -1
  26. package/src/components/order-view/order-actions/actions/cancel-order/index.tsx +21 -2
  27. package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +51 -48
  28. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +3 -0
  29. package/src/components/order-view/order-actions/actions/split-order/SplitOrderTable.tsx +28 -19
  30. package/src/components/order-view/order-actions/actions/split-order/index.tsx +24 -2
  31. package/src/components/order-view/order-actions/actions/uncancel-order/UncancelOrder.tsx +166 -0
  32. package/src/components/order-view/order-actions/index.tsx +3 -2
  33. package/src/components/order-view/order-actions/store.ts +1 -2
  34. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +9 -6
  35. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +16 -4
  36. package/src/components/order-view/view-reminder/reminder-styles.tsx +1 -0
  37. package/src/components/store.ts +7 -1
@@ -4,7 +4,7 @@ import { useApiHook } from '@bjsdistribution/dms-component-library';
4
4
  import { ApiResponse } from '../../types';
5
5
  import { useOrderDetails, useOrderId, useProductDetails } from '../../store';
6
6
  import { Select } from 'antd';
7
- import { useSelectedProducts } from '../../../store';
7
+ import { useNewReturnOrderData, useSelectedProducts } from '../../../store';
8
8
  import { atom, useAtom } from 'jotai';
9
9
 
10
10
  export const payloadAtom = atom<any>(null);
@@ -12,7 +12,7 @@ export const payloadAtom = atom<any>(null);
12
12
  const NewReturnDropdown = () => {
13
13
  const defaultSelectStyle = { width: '100%' };
14
14
  const defaultPopupClassName = 'dropDownStyle';
15
- const [returnOrderData, setReturnOrderData] = useState<any>([]);
15
+ const [returnOrderData, setReturnOrderData] = useNewReturnOrderData();
16
16
  const [selectedOrderId, setSelectedOrderId] = useState<string | null>(null);
17
17
  const [selectedProducts] = useSelectedProducts();
18
18
  const [orderData] = useOrderDetails();
@@ -89,20 +89,33 @@ const NewReturnDropdown = () => {
89
89
  return (
90
90
  <Container>
91
91
  <Text>New Return Order:</Text>
92
- <Select
92
+ <StyledAntSelect
93
93
  options={dropdownOptions}
94
+ value={selectedOrderId}
94
95
  placeholder="Select"
96
+ // @ts-ignore
95
97
  onChange={handleDropdownChange}
96
98
  style={defaultSelectStyle}
97
- disabled={false}
98
99
  showSearch
99
100
  dropdownStyle={{ width: 'max-content' }}
100
101
  popupClassName={defaultPopupClassName}
102
+ status={selectedOrderId ? '' : 'error'}
101
103
  />
102
104
  </Container>
103
105
  );
104
106
  };
105
107
 
108
+ const StyledAntSelect = styled(Select)`
109
+ .ant-select-selector {
110
+ /* width: 22vw; */
111
+ border-radius: 22px;
112
+ }
113
+ .ant-select-clear {
114
+ top: 40% !important;
115
+ font-size: 18px !important;
116
+ }
117
+ `;
118
+
106
119
  const Container = styled.div`
107
120
  display: flex;
108
121
  align-items: center;
@@ -5,7 +5,7 @@ import styled from 'styled-components';
5
5
  import { useReminderRefId } from '../order-actions/store';
6
6
  import { formatDate } from '../order-actions/utils';
7
7
 
8
- function ReminderTemplate({ data }: any) {
8
+ function ReminderTemplate({ data, dismissReminder }: any) {
9
9
  const [, setCurrentAction] = useCurrentAction();
10
10
  const [, setReminderRefId] = useReminderRefId();
11
11
  const openModal = () => {
@@ -15,7 +15,7 @@ function ReminderTemplate({ data }: any) {
15
15
  //getting particular reminder data
16
16
  const handleClick = (Id: number) => {
17
17
  setReminderRefId(Id);
18
- openModal()
18
+ openModal();
19
19
  };
20
20
 
21
21
  const type =
@@ -25,13 +25,12 @@ function ReminderTemplate({ data }: any) {
25
25
  ? 'warn'
26
26
  : 'success';
27
27
 
28
- const titleColor =
29
- data?.reminder_status?.name === 'SD'
30
- ? '#36A053'
31
- : data?.reminder_status?.name === 'pending'
32
- ? '#FEBA30'
33
- : '#3A3630';
34
-
28
+ const titleColor =
29
+ data?.reminder_status?.name === 'SD'
30
+ ? '#36A053'
31
+ : data?.reminder_status?.name === 'pending'
32
+ ? '#FEBA30'
33
+ : '#3A3630';
35
34
 
36
35
  return (
37
36
  <div>
@@ -46,13 +45,13 @@ function ReminderTemplate({ data }: any) {
46
45
  {' '}
47
46
  {data?.reference || 'NA'}{' '}
48
47
  </StyledLink>
49
- {formatDate(data?.due)}, Assigned to : {' '}
48
+ {formatDate(data?.due)}, Assigned to :{' '}
50
49
  </StyledTitle>
51
50
  </>
52
51
  }
53
52
  description={`${data?.details}`}
54
53
  showOkButton={false}
55
- onClose={() => {}}
54
+ onClose={() => dismissReminder(data.id)}
56
55
  />
57
56
  </StyledAlert>
58
57
  </div>
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { useTabType } from '../store';
4
- import OrderTemplate from './OrderTemplate';
4
+ // import OrderTemplate from './OrderTemplate';
5
5
  import FlagTemplate from './FlagTemplate';
6
6
  import ReminderTemplate from './ReminderTemplate';
7
7
 
@@ -10,6 +10,8 @@ function Tabs({
10
10
  closedNotifications,
11
11
  activeReminders,
12
12
  closedReminders,
13
+ dismissReminder,
14
+ dismissFlags,
13
15
  }: any) {
14
16
  const [activeTab] = useTabType();
15
17
 
@@ -25,24 +27,34 @@ function Tabs({
25
27
  <Container className="tab-content">
26
28
  {activeTab === 'active' && (
27
29
  <>
28
- <OrderTemplate />
30
+ {/* <OrderTemplate /> */}
29
31
  {initialReminders.map((item: any, index: any) => (
30
- <ReminderTemplate key={index} data={item} />
32
+ <ReminderTemplate
33
+ key={index}
34
+ data={item}
35
+ dismissReminder={dismissReminder}
36
+ />
31
37
  ))}
32
38
  {initialNotifications.map((item: any, index: any) => (
33
- <FlagTemplate key={index} data={item} />
39
+ <FlagTemplate
40
+ key={index}
41
+ data={item}
42
+ dismissFlags={dismissFlags}
43
+ />
34
44
  ))}
35
45
  <>
36
46
  {additionalReminders.map((item: any, index: any) => (
37
47
  <ReminderTemplate
38
48
  key={index + initialReminders.length}
39
49
  data={item}
50
+ dismissReminder={dismissReminder}
40
51
  />
41
52
  ))}
42
53
  {additionalNotifications.map((item: any, index: any) => (
43
54
  <FlagTemplate
44
55
  key={index + initialNotifications.length}
45
56
  data={item}
57
+ dismissFlags={dismissFlags}
46
58
  />
47
59
  ))}
48
60
  </>
@@ -51,10 +63,18 @@ function Tabs({
51
63
  {activeTab === 'closed' && (
52
64
  <>
53
65
  {closedReminders.map((item: any, index: any) => (
54
- <ReminderTemplate key={index} data={item} />
66
+ <ReminderTemplate
67
+ key={index}
68
+ data={item}
69
+ dismissReminder={dismissReminder}
70
+ />
55
71
  ))}
56
72
  {closedNotifications.map((item: any, index: any) => (
57
- <FlagTemplate key={index} data={item} />
73
+ <FlagTemplate
74
+ key={index}
75
+ data={item}
76
+ dismissFlags={dismissFlags}
77
+ />
58
78
  ))}
59
79
  </>
60
80
  )}
@@ -2,7 +2,7 @@ import {
2
2
  SectionHeader,
3
3
  useApiHook,
4
4
  } from '@bjsdistribution/dms-component-library';
5
- import React, { useEffect } from 'react';
5
+ import React, { useEffect, useState } from 'react';
6
6
  import Tabs from './Tabs';
7
7
  import styled from 'styled-components';
8
8
  import { useInfoType, useOrderDetails, useTabType } from '../store';
@@ -38,6 +38,10 @@ function Notification() {
38
38
  const routeId = OrderData?.order_routes?.route_id;
39
39
  const [, setRouteData] = useRouteDetails();
40
40
  const [orderCount] = useOrderNotify();
41
+ const [activeNotifications, setActiveNotifications] = useState([]);
42
+ const [closedNotifications, setCloseNotifications] = useState([]);
43
+ const [activeReminders, setActiveReminders] = useState([]);
44
+ const [closedReminders, setCloseReminders] = useState([]);
41
45
 
42
46
  const handleTabChange = (tab: string) => {
43
47
  setActiveTab(tab);
@@ -79,19 +83,47 @@ function Notification() {
79
83
  }
80
84
  });
81
85
 
82
- const activeNotifications = notificationData.filter(
83
- (item: any) => item.task_status_id !== 2
84
- );
85
- const closedNotifications = notificationData.filter(
86
- (item: any) => item?.task_status_id === 2
87
- );
86
+ useEffect(() => {
87
+ if (notificationData?.length > 0) {
88
+ setActiveNotifications(
89
+ notificationData?.filter((item: any) => item.task_status_id !== 2)
90
+ );
91
+ setCloseNotifications(
92
+ notificationData?.filter((item: any) => item?.task_status_id === 2)
93
+ );
94
+ }
95
+ }, [notificationData]);
88
96
 
89
- const activeReminders = reminderData.filter(
90
- (item: any) => item.status_id == 1 || item.status_id == 3
91
- );
92
- const closedReminders = reminderData.filter(
93
- (item: any) => item?.status_id === 2
94
- );
97
+ useEffect(() => {
98
+ if (reminderData?.length > 0) {
99
+ setActiveReminders(
100
+ reminderData?.filter(
101
+ (item: any) => item.status_id === 1 || item.status_id === 3
102
+ )
103
+ );
104
+ setCloseReminders(
105
+ reminderData?.filter((item: any) => item?.status_id === 2)
106
+ );
107
+ }
108
+ }, [reminderData]);
109
+
110
+ //dismiss notifcations
111
+ const dismissFlags = (id: any) => {
112
+ setActiveNotifications(prevFlags =>
113
+ prevFlags.filter((flags: any) => flags.id !== id)
114
+ );
115
+ setCloseNotifications(prevFlags =>
116
+ prevFlags.filter((flags: any) => flags.id !== id)
117
+ );
118
+ };
119
+ const dismissReminder = (id: any) => {
120
+ setActiveReminders(prevReminders =>
121
+ prevReminders.filter((reminder: any) => reminder.id !== id)
122
+ );
123
+ setCloseReminders(prevReminders =>
124
+ prevReminders.filter((reminder: any) => reminder.id !== id)
125
+ );
126
+ };
95
127
 
96
128
  const totalActiveCount =
97
129
  activeNotifications.length + activeReminders.length + orderCount;
@@ -136,6 +168,8 @@ function Notification() {
136
168
  closedNotifications={closedNotifications}
137
169
  activeReminders={activeReminders}
138
170
  closedReminders={closedReminders}
171
+ dismissReminder={dismissReminder}
172
+ dismissFlags={dismissFlags}
139
173
  />
140
174
  </TabsWrapper>
141
175
  ) : (
@@ -16,12 +16,16 @@ interface ActionsDropdownProps {
16
16
  disabled?: boolean;
17
17
  defaultValue?: any;
18
18
  onChange?: any;
19
+ required?: boolean;
19
20
  }
20
21
 
21
22
  function OrderActionsDropdown(props: ActionsDropdownProps) {
22
23
  return (
23
24
  <Container className={props.className}>
24
- <Label>{props.label}</Label>
25
+ <Label>
26
+ {props.label}
27
+ {props.required && <RequiredAsterisk>*</RequiredAsterisk>}
28
+ </Label>
25
29
  <AntSelect
26
30
  options={props.options}
27
31
  placeholder={props.placeholder}
@@ -38,6 +42,11 @@ function OrderActionsDropdown(props: ActionsDropdownProps) {
38
42
  );
39
43
  }
40
44
 
45
+ const RequiredAsterisk = styled.span`
46
+ color: red;
47
+ margin-left: 2px;
48
+ `;
49
+
41
50
  const Label = styled.label`
42
51
  color: #6a7378;
43
52
  font-family: 'Lato', sans-serif;
@@ -84,6 +84,12 @@ function CancelOrder() {
84
84
  //@ts-ignore
85
85
  if (response?.data && response?.code === 200) {
86
86
  setShouldPerformAction(true);
87
+ notification.success({
88
+ message: 'Success',
89
+ description:
90
+ //@ts-ignore
91
+ response?.message || 'Sucess',
92
+ });
87
93
  } else {
88
94
  // alert(response?.error_traceback);
89
95
  notification.error({
@@ -132,6 +138,7 @@ function CancelOrder() {
132
138
  <Top>
133
139
  <TopLeft>
134
140
  <OrderActionsDropdown
141
+ required
135
142
  label="Cancelation Reason"
136
143
  placeholder="Select Cancelation Reason"
137
144
  options={cancelReasonOptions || []}
@@ -145,8 +152,11 @@ function CancelOrder() {
145
152
  </TopLeft>
146
153
  <TopRight>
147
154
  <Container>
148
- <Label>Cancelation Note</Label>
149
- <TextArea
155
+ <div style={{ display: 'flex', flexDirection: 'row' }}>
156
+ <Label>Cancelation Note</Label>{' '}
157
+ <RequiredAsterisk>*</RequiredAsterisk>
158
+ </div>
159
+ <TArea
150
160
  rows={5}
151
161
  onChange={onChangeNotes}
152
162
  value={cancelNotes}
@@ -162,6 +172,15 @@ function CancelOrder() {
162
172
  </OrderActionModal>
163
173
  );
164
174
  }
175
+ const RequiredAsterisk = styled.span`
176
+ color: red;
177
+ margin-left: 2px;
178
+ font-size: x-small;
179
+ `;
180
+
181
+ const TArea = styled(TextArea)`
182
+ resize: none;
183
+ `;
165
184
 
166
185
  const Label = styled.label`
167
186
  color: #6a7378;
@@ -5,6 +5,7 @@ import { useOrderId } from '../../../../store';
5
5
 
6
6
  import { Empty, Skeleton } from 'antd';
7
7
  import { format } from 'date-fns';
8
+ import CustomScrollBar from '../../../../../../common/scrollbar';
8
9
  import {
9
10
  EmptyDataContainer,
10
11
  StyledTable,
@@ -56,7 +57,7 @@ function NotesTable() {
56
57
  });
57
58
  useEffect(() => {
58
59
  setNoteLoadingStore(true);
59
- if (moduleIds && orderId) {
60
+ if (moduleIds) {
60
61
  setShouldPerformAction(true);
61
62
  }
62
63
  if (!NotesLoading && NotesData?.data) {
@@ -76,56 +77,58 @@ function NotesTable() {
76
77
  <Container>
77
78
  <Title>Notes ({notes?.length})</Title>
78
79
  <StyledTableWrapper>
79
- <StyledTable className="scrollClass">
80
- <thead>
81
- <tr>
82
- <th>Created</th>
83
- <th>Notes</th>
84
- </tr>
85
- </thead>
86
- <tbody>
87
- {loading ? (
80
+ <CustomScrollBar>
81
+ <StyledTable className="scrollClass">
82
+ <thead>
88
83
  <tr>
89
- <td colSpan={6}>
90
- <Skeleton active />
91
- </td>
92
- <td colSpan={6}></td>
84
+ <th>Created</th>
85
+ <th>Notes</th>
93
86
  </tr>
94
- ) : notes?.length === 0 ? (
95
- <tr>
96
- <td className="emptyTd" colSpan={7}>
97
- <EmptyDataContainer>
98
- <Empty />
99
- </EmptyDataContainer>
100
- </td>
101
- </tr>
102
- ) : (
103
- notes?.map((order: any) => (
104
- <tr key={order.id}>
105
- <td>
106
- <div
107
- style={{
108
- fontWeight: 'bold',
109
- textTransform: 'capitalize',
110
- }}
111
- >
112
- {order?.created_by}
113
- </div>
114
- <div>
115
- {format(
116
- new Date(order?.created_at),
117
- "dd/MM/yyyy '@' HH:mm"
118
- )}
119
- </div>
87
+ </thead>
88
+ <tbody>
89
+ {loading ? (
90
+ <tr>
91
+ <td colSpan={6}>
92
+ <Skeleton active />
93
+ </td>
94
+ <td colSpan={6}></td>
95
+ </tr>
96
+ ) : notes?.length === 0 ? (
97
+ <tr>
98
+ <td className="emptyTd" colSpan={7}>
99
+ <EmptyDataContainer>
100
+ <Empty />
101
+ </EmptyDataContainer>
120
102
  </td>
121
- <td
122
- dangerouslySetInnerHTML={{ __html: order?.description }}
123
- ></td>
124
103
  </tr>
125
- ))
126
- )}
127
- </tbody>
128
- </StyledTable>
104
+ ) : (
105
+ notes?.map((order: any) => (
106
+ <tr key={order.id}>
107
+ <td>
108
+ <div
109
+ style={{
110
+ fontWeight: 'bold',
111
+ textTransform: 'capitalize',
112
+ }}
113
+ >
114
+ {order?.created_by}
115
+ </div>
116
+ <div>
117
+ {format(
118
+ new Date(order?.created_at),
119
+ "dd/MM/yyyy '@' HH:mm"
120
+ )}
121
+ </div>
122
+ </td>
123
+ <td
124
+ dangerouslySetInnerHTML={{ __html: order?.description }}
125
+ ></td>
126
+ </tr>
127
+ ))
128
+ )}
129
+ </tbody>
130
+ </StyledTable>
131
+ </CustomScrollBar>
129
132
  </StyledTableWrapper>
130
133
  </Container>
131
134
  );
@@ -147,7 +150,7 @@ const Container = styled.div`
147
150
  flex-direction: column;
148
151
  gap: 8px;
149
152
  > div {
150
- min-height: 165px;
153
+ min-height: 350px;
151
154
  }
152
155
  `;
153
156
 
@@ -21,6 +21,7 @@ import { StandardOptionsType } from '../../../../../common/radio-group/types';
21
21
  import dayjs from 'dayjs';
22
22
  import { isValid } from 'date-fns';
23
23
  import utc from 'dayjs/plugin/utc';
24
+ import { useOrderId } from '../../../store';
24
25
  dayjs.extend(utc);
25
26
  dayjs.extend(isValid);
26
27
 
@@ -33,6 +34,7 @@ function CreateReminderModal() {
33
34
  const [subCategory] = useTaskTypeExtended();
34
35
  const [createReminder, setPayload] = useCreateReminderPayload();
35
36
  const [displayDate, setDisplayDate] = useState<any | null>();
37
+ const [orderId] = useOrderId();
36
38
 
37
39
  const handleSelectChange = () => console.log('testing log');
38
40
 
@@ -96,6 +98,7 @@ function CreateReminderModal() {
96
98
  setPayload(prevState => ({
97
99
  ...prevState,
98
100
  details: desc,
101
+ order_id: +orderId,
99
102
  }));
100
103
  };
101
104
 
@@ -2,8 +2,8 @@ import React, { useEffect, useState } from 'react';
2
2
  import { useProductDetails } from '../../../store';
3
3
 
4
4
  import { Empty, Skeleton } from 'antd';
5
- import { useLoading } from '../../../../order-daily-overview/store/store';
6
5
  import { Checkbox } from '@bjsdistribution/dms-component-library';
6
+ import { useLoading } from '../../../../order-daily-overview/store/store';
7
7
  import { useSelectedSplit, useSplitOrderPayload } from '../../store';
8
8
  import {
9
9
  EmptyDataContainer,
@@ -18,13 +18,14 @@ function SplitOrderTable() {
18
18
  const [selectAll, setSelectAll] = useState(false);
19
19
  const [payload, setPayload] = useSplitOrderPayload();
20
20
 
21
+ // Handle Select All
21
22
  const handleSelectAll = (e: any) => {
22
- setSelectAll(e.target.checked);
23
- if (e.target.checked) {
23
+ const isChecked = e.target.checked;
24
+ setSelectAll(isChecked);
25
+
26
+ if (isChecked) {
24
27
  setSelectedSplit(
25
- orderProductDetails.map((order: any) => ({
26
- id: order.id,
27
- }))
28
+ orderProductDetails?.map((order: any) => ({ id: order.id }))
28
29
  );
29
30
  } else {
30
31
  setSelectedSplit([]);
@@ -32,16 +33,16 @@ function SplitOrderTable() {
32
33
  };
33
34
 
34
35
  const handleSelectedSplitList = (id: any) => {
35
- setSelectedSplit((prevSelectedOrder: any) => {
36
- const isSelected = prevSelectedOrder?.some(
37
- (order: any) => order.id === id
38
- );
36
+ setSelectedSplit(prevSelectedOrder => {
37
+ const isSelected = prevSelectedOrder?.some(order => order.id === id);
38
+
39
+ const updatedSelection = isSelected
40
+ ? prevSelectedOrder?.filter(order => order.id !== id)
41
+ : [...prevSelectedOrder, { id }];
42
+
43
+ setSelectAll(updatedSelection?.length === orderProductDetails?.length);
39
44
 
40
- if (isSelected) {
41
- return prevSelectedOrder?.filter((order: any) => order.id !== id);
42
- } else {
43
- return [...prevSelectedOrder, { id: id }];
44
- }
45
+ return updatedSelection;
45
46
  });
46
47
  };
47
48
 
@@ -52,7 +53,7 @@ function SplitOrderTable() {
52
53
  products: selectedSplits?.map(order => order.id),
53
54
  force: true,
54
55
  });
55
- }, [orderProductDetails, selectedSplits]);
56
+ }, [selectedSplits, setPayload]);
56
57
 
57
58
  return (
58
59
  <StyledTableWrapper id="tableScrolling">
@@ -60,7 +61,14 @@ function SplitOrderTable() {
60
61
  <thead>
61
62
  <tr>
62
63
  <th>
63
- <Checkbox checked={selectAll} onChange={handleSelectAll} />
64
+ <Checkbox
65
+ checked={selectAll}
66
+ onChange={handleSelectAll}
67
+ disabled={
68
+ orderProductDetails?.length === 0 ||
69
+ orderProductDetails?.length === null
70
+ }
71
+ />
64
72
  </th>
65
73
  <th>Type</th>
66
74
  <th>Code</th>
@@ -82,17 +90,18 @@ function SplitOrderTable() {
82
90
  <tr>
83
91
  <td className="emptyTd" colSpan={7}>
84
92
  <EmptyDataContainer>
85
- <Empty />
93
+ <Empty description="No Data Found" />
86
94
  </EmptyDataContainer>
87
95
  </td>
88
96
  </tr>
89
97
  ) : (
98
+ orderProductDetails?.length > 0 &&
90
99
  orderProductDetails?.map((order: any) => (
91
100
  <tr key={order.id}>
92
101
  <td>
93
102
  <Checkbox
94
103
  checked={selectedSplits?.some(
95
- (selectedInvoice: any) => selectedInvoice?.id === order.id
104
+ selectedOrder => selectedOrder.id === order.id
96
105
  )}
97
106
  onChange={() => handleSelectedSplitList(order.id)}
98
107
  />
@@ -7,6 +7,7 @@ import { useApiHook } from '@bjsdistribution/dms-component-library';
7
7
  import { ApiResponse } from '../../../types';
8
8
 
9
9
  import { useSelectedSplit, useSplitOrderPayload } from '../../store';
10
+ import { notification } from 'antd';
10
11
 
11
12
  function SplitOrder() {
12
13
  const [, setCurrentAction] = useCurrentAction();
@@ -21,7 +22,10 @@ function SplitOrder() {
21
22
  setCurrentAction(undefined);
22
23
  };
23
24
 
24
- const { setShouldPerformAction: setPerformAction } = useApiHook<{
25
+ const {
26
+ data: response,
27
+ setShouldPerformAction: setPerformAction,
28
+ } = useApiHook<{
25
29
  data: ApiResponse[];
26
30
  }>({
27
31
  endpoint: `orders/split_order/${orderId}`,
@@ -33,8 +37,26 @@ function SplitOrder() {
33
37
  const onSubmitSplitOrder = () => {
34
38
  if (orderId) {
35
39
  setPerformAction(true);
40
+ //@ts-ignore
41
+ if (response?.data && response?.code === 200) {
42
+ notification.success({
43
+ message: 'Success',
44
+ description:
45
+ //@ts-ignore
46
+ response?.message || 'Sucess',
47
+ });
48
+ } else {
49
+ // alert(response?.error_traceback);
50
+ notification.error({
51
+ message: 'Error',
52
+ description:
53
+ //@ts-ignore
54
+ response?.message ||
55
+ 'An error has occurred. Please try again later.',
56
+ });
57
+ }
58
+ setSelectedSplit([]);
36
59
  }
37
- setSelectedSplit([]);
38
60
  };
39
61
 
40
62
  const isSubmitDisabled = () => {