@bjsdistribution/dms-client-return 0.0.18 → 0.0.19
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/assets/icons/DustbinIcon.d.ts +3 -0
- package/dist/common/date-picker/header/ClearDate.d.ts +1 -1
- package/dist/components/order-daily-overview/header-filters/overViewFilter.d.ts +16 -0
- package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.d.ts +1 -1
- package/dist/components/order-daily-overview/store/store.d.ts +2 -0
- package/dist/components/order-daily-overview/table-view/ReturnPagination.d.ts +3 -0
- package/dist/components/order-daily-overview/table-view/TableStyle.d.ts +4 -4
- package/dist/components/order-view/fakedata.d.ts +1 -1
- package/dist/components/order-view/order-actions/Dropdown.d.ts +6 -2
- package/dist/components/order-view/order-actions/actions/confirm-order/customer-info/ContactWith.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.d.ts +1 -1
- package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.d.ts +1 -1
- package/dist/components/order-view/order-actions/actions/confirm-order/tables/ReminderStyles.d.ts +9 -0
- package/dist/components/order-view/order-actions/store.d.ts +34 -1
- package/dist/components/order-view/order-actions/types.d.ts +5 -0
- package/dist/components/order-view/store.d.ts +1 -0
- package/dist/components/order-view/types.d.ts +5 -2
- package/dist/dms-client-return.cjs.development.js +2370 -1678
- 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 +2373 -1681
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/assets/icons/DustbinIcon.tsx +20 -0
- package/src/common/modals/order-action-modal/OrderActionModal.tsx +4 -2
- package/src/components/order-daily-overview/header-filters/filterStore.ts +19 -18
- package/src/components/order-daily-overview/header-filters/overViewFilter.ts +80 -0
- package/src/components/order-daily-overview/index.tsx +27 -33
- package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +47 -5
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +9 -5
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +1 -1
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +2 -2
- package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +25 -1
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +29 -11
- package/src/components/order-daily-overview/store/store.ts +11 -1
- package/src/components/order-daily-overview/table-view/Pagination.tsx +2 -1
- package/src/components/order-daily-overview/table-view/ReturnPagination.tsx +136 -0
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +26 -12
- package/src/components/order-view/details-filters/right-side-filters/Details.tsx +8 -1
- package/src/components/order-view/fakedata.ts +5 -9
- package/src/components/order-view/general-information/dropdowns/BjsMenu.tsx +15 -4
- package/src/components/order-view/general-information/dropdowns/Print.tsx +79 -39
- package/src/components/order-view/general-information/dropdowns/index.tsx +0 -13
- package/src/components/order-view/general-information/index.tsx +3 -19
- package/src/components/order-view/generic-table/AuditLogs.tsx +7 -5
- package/src/components/order-view/index.tsx +1 -2
- package/src/components/order-view/modalsPopup/ModalManager.tsx +44 -203
- package/src/components/order-view/notes/AddNote.tsx +4 -14
- package/src/components/order-view/notes/index.tsx +8 -13
- package/src/components/order-view/order-actions/Dropdown.tsx +8 -3
- package/src/components/order-view/order-actions/actions/cancel-order/index.tsx +146 -12
- package/src/components/order-view/order-actions/actions/charge-log/index.tsx +126 -79
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ActionDropdown.tsx +21 -9
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactMobile.tsx +64 -1
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactPhone.tsx +67 -1
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactTypeDropdown.tsx +19 -7
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactWith.tsx +28 -0
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactWork.tsx +65 -1
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/DeliveryDate.tsx +40 -3
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/EmailAddress.tsx +47 -2
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/TimedServiceDropdown.tsx +38 -9
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/index.tsx +4 -1
- package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +196 -6
- package/src/components/order-view/order-actions/actions/confirm-order/slot-and-instructions/index.tsx +5 -1
- package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +121 -20
- package/src/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.tsx +54 -32
- package/src/components/order-view/order-actions/actions/confirm-order/tables/ReminderStyles.tsx +289 -0
- package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +41 -8
- package/src/components/order-view/order-actions/actions/create-task-reminder/index.tsx +11 -83
- package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +61 -14
- package/src/components/order-view/order-actions/actions/release-order/ReleaseOrder.tsx +93 -25
- package/src/components/order-view/order-actions/actions/split-order/SplitOrderTable.tsx +102 -247
- package/src/components/order-view/order-actions/actions/split-order/index.tsx +57 -9
- package/src/components/order-view/order-actions/index.tsx +7 -2
- package/src/components/order-view/order-actions/store.ts +45 -0
- package/src/components/order-view/order-actions/types.ts +5 -0
- package/src/components/order-view/order-details/expanded-content/footer/index.tsx +15 -12
- package/src/components/order-view/store.ts +7 -0
- package/src/components/order-view/types.ts +5 -2
package/src/components/order-view/order-actions/actions/confirm-order/tables/ReminderStyles.tsx
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
// Styled components
|
|
4
|
+
export const StyledTableWrapper = styled.div`
|
|
5
|
+
overflow-x: auto;
|
|
6
|
+
max-height: calc(100vh - 290px);
|
|
7
|
+
scrollbar-width: none;
|
|
8
|
+
/* box-shadow: 0px 0px 30px 6px rgba(46, 45, 116, 0.05); */
|
|
9
|
+
&::-webkit-scrollbar {
|
|
10
|
+
width: 5px;
|
|
11
|
+
border-radius: 100px;
|
|
12
|
+
height: 5px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&::-webkit-scrollbar-track {
|
|
16
|
+
background: #777;
|
|
17
|
+
border-radius: 100px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&::-webkit-scrollbar-thumb {
|
|
21
|
+
background: #7b61ff;
|
|
22
|
+
border-radius: 100px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
26
|
+
background: #7b61ff;
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
export const StyledTable = styled.table`
|
|
31
|
+
border-spacing: 0 10px;
|
|
32
|
+
width: 100%;
|
|
33
|
+
padding: 10px;
|
|
34
|
+
thead {
|
|
35
|
+
tr {
|
|
36
|
+
border-radius: 40px;
|
|
37
|
+
border-spacing: 0 10px;
|
|
38
|
+
th {
|
|
39
|
+
color: #3a3630;
|
|
40
|
+
font-size: 14px;
|
|
41
|
+
font-style: normal;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
line-height: normal;
|
|
44
|
+
padding: 5px 15px;
|
|
45
|
+
background: #f0f2f2;
|
|
46
|
+
border-right: none;
|
|
47
|
+
border-left: none;
|
|
48
|
+
text-align: left;
|
|
49
|
+
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
50
|
+
border-width: 1px 0;
|
|
51
|
+
text-transform: capitalize;
|
|
52
|
+
&:first-child {
|
|
53
|
+
border-radius: 100px 0 0 100px;
|
|
54
|
+
border-left: 1px solid rgba(0, 0, 0, 0.08);
|
|
55
|
+
}
|
|
56
|
+
&:last-child {
|
|
57
|
+
border-radius: 0px 100px 100px 0;
|
|
58
|
+
border-right: 1px solid rgba(0, 0, 0, 0.08);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
tbody {
|
|
64
|
+
tr {
|
|
65
|
+
td {
|
|
66
|
+
color: #3a3630;
|
|
67
|
+
font-size: 13px;
|
|
68
|
+
font-style: normal;
|
|
69
|
+
font-weight: 400;
|
|
70
|
+
line-height: normal;
|
|
71
|
+
padding: 12px 15px;
|
|
72
|
+
background: #fff;
|
|
73
|
+
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
74
|
+
border-right: none;
|
|
75
|
+
border-left: none;
|
|
76
|
+
}
|
|
77
|
+
.link {
|
|
78
|
+
color: #09f;
|
|
79
|
+
font-family: Roboto;
|
|
80
|
+
font-weight: 400;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
}
|
|
83
|
+
td {
|
|
84
|
+
.flex {
|
|
85
|
+
display: flex;
|
|
86
|
+
gap: 4px;
|
|
87
|
+
align-items: center;
|
|
88
|
+
}
|
|
89
|
+
.overDue {
|
|
90
|
+
border-radius: 20px;
|
|
91
|
+
border: 1px solid #edebe8;
|
|
92
|
+
background: #fff;
|
|
93
|
+
padding: 4px 8px;
|
|
94
|
+
color: #e95252;
|
|
95
|
+
font-size: 12px;
|
|
96
|
+
font-style: normal;
|
|
97
|
+
font-weight: 600;
|
|
98
|
+
line-height: 16px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
&:nth-child(even) td {
|
|
102
|
+
background: #f6fbff;
|
|
103
|
+
}
|
|
104
|
+
td:first-child {
|
|
105
|
+
border-radius: 100px 0 0 100px;
|
|
106
|
+
border-left: 1px solid rgba(0, 0, 0, 0.08);
|
|
107
|
+
}
|
|
108
|
+
td:last-child {
|
|
109
|
+
border-radius: 0px 100px 100px 0;
|
|
110
|
+
border-right: 1px solid rgba(0, 0, 0, 0.08);
|
|
111
|
+
}
|
|
112
|
+
.emptyTd {
|
|
113
|
+
border-radius: 100px !important;
|
|
114
|
+
}
|
|
115
|
+
.flex {
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: row;
|
|
118
|
+
gap: 5px;
|
|
119
|
+
height: 29px;
|
|
120
|
+
align-items: center;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&.insideTable {
|
|
124
|
+
td {
|
|
125
|
+
border-radius: 0;
|
|
126
|
+
border: none;
|
|
127
|
+
&:last-child {
|
|
128
|
+
border-radius: 0;
|
|
129
|
+
border-right: none;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
table {
|
|
133
|
+
border-spacing: 0;
|
|
134
|
+
width: 100%;
|
|
135
|
+
border-radius: 5px;
|
|
136
|
+
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
137
|
+
overflow: hidden;
|
|
138
|
+
border-top-left-radius: 15px;
|
|
139
|
+
border-top-right-radius: 15px;
|
|
140
|
+
thead {
|
|
141
|
+
tr {
|
|
142
|
+
border-bottom: none;
|
|
143
|
+
th {
|
|
144
|
+
padding: 14px 20px;
|
|
145
|
+
text-align: left;
|
|
146
|
+
border-top: 0;
|
|
147
|
+
border-right: 0;
|
|
148
|
+
border-left: 0;
|
|
149
|
+
background: #f8fafc;
|
|
150
|
+
&:first-child {
|
|
151
|
+
border-radius: 0;
|
|
152
|
+
border-left: 1px solid rgba(0, 0, 0, 0.08);
|
|
153
|
+
border-top-left-radius: 15px;
|
|
154
|
+
}
|
|
155
|
+
&:last-child {
|
|
156
|
+
border-radius: 0;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
tbody {
|
|
162
|
+
tr {
|
|
163
|
+
td {
|
|
164
|
+
padding: 14px 20px;
|
|
165
|
+
text-align: left;
|
|
166
|
+
border-bottom: 1px solid rgba(58, 54, 48, 0.15);
|
|
167
|
+
background: #fff;
|
|
168
|
+
> svg {
|
|
169
|
+
transform: scale(1.5);
|
|
170
|
+
background-color: #edebe8;
|
|
171
|
+
border-radius: 20px;
|
|
172
|
+
padding: 5px;
|
|
173
|
+
}
|
|
174
|
+
&:last-child {
|
|
175
|
+
border-radius: 0;
|
|
176
|
+
border-right: none;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
.actions {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
gap: 20px;
|
|
189
|
+
> svg {
|
|
190
|
+
transform: scale(1.5);
|
|
191
|
+
background-color: #edebe8;
|
|
192
|
+
border-radius: 20px;
|
|
193
|
+
padding: 5px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.close-icon {
|
|
197
|
+
transform: scale(1.3);
|
|
198
|
+
background-color: transparent;
|
|
199
|
+
border-radius: 0;
|
|
200
|
+
padding: 0;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
`;
|
|
204
|
+
|
|
205
|
+
export const EmptyDataContainer = styled.div`
|
|
206
|
+
display: flex;
|
|
207
|
+
justify-content: center;
|
|
208
|
+
`;
|
|
209
|
+
|
|
210
|
+
export const Badge = styled.div`
|
|
211
|
+
div {
|
|
212
|
+
display: flex;
|
|
213
|
+
min-width: 85px;
|
|
214
|
+
padding: 6px 10px;
|
|
215
|
+
justify-content: center;
|
|
216
|
+
align-items: center;
|
|
217
|
+
gap: 5px;
|
|
218
|
+
border-radius: 22px;
|
|
219
|
+
font-family: 'Open Sans';
|
|
220
|
+
font-size: 12px;
|
|
221
|
+
font-style: normal;
|
|
222
|
+
font-weight: 600;
|
|
223
|
+
line-height: normal;
|
|
224
|
+
}
|
|
225
|
+
`;
|
|
226
|
+
|
|
227
|
+
export const BadgeStatus = styled.div`
|
|
228
|
+
&.pending {
|
|
229
|
+
background: #fff1d6;
|
|
230
|
+
color: #f4a503;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
&.resolved {
|
|
234
|
+
background: rgba(41, 204, 106, 0.15);
|
|
235
|
+
color: #1f9254;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
&.overdue {
|
|
239
|
+
background: rgba(233, 82, 82, 0.15);
|
|
240
|
+
color: var(--contextual-red, #e95252);
|
|
241
|
+
}
|
|
242
|
+
`;
|
|
243
|
+
|
|
244
|
+
export const ClearAll = styled.div`
|
|
245
|
+
border-radius: 20px;
|
|
246
|
+
border: 1px solid #edebe8;
|
|
247
|
+
background: #fff;
|
|
248
|
+
display: flex;
|
|
249
|
+
padding: 6px 6px;
|
|
250
|
+
justify-content: center;
|
|
251
|
+
align-items: center;
|
|
252
|
+
gap: 8px;
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
|
|
255
|
+
&.active {
|
|
256
|
+
background: #313130;
|
|
257
|
+
& > div {
|
|
258
|
+
color: #fff;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
`;
|
|
262
|
+
export const StyledFilterBtnIcon = styled.div`
|
|
263
|
+
display: flex;
|
|
264
|
+
width: 24px;
|
|
265
|
+
height: 24px;
|
|
266
|
+
justify-content: center;
|
|
267
|
+
align-items: center;
|
|
268
|
+
border-radius: 20px;
|
|
269
|
+
border: 1px solid #e2e0db;
|
|
270
|
+
background: #f1f5f6;
|
|
271
|
+
.cross {
|
|
272
|
+
position: relative;
|
|
273
|
+
&:after {
|
|
274
|
+
display: inline-block;
|
|
275
|
+
content: 'X';
|
|
276
|
+
font-style: normal;
|
|
277
|
+
font-size: 14px;
|
|
278
|
+
color: #000;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
`;
|
|
282
|
+
export const StyledFilterBtnLabel = styled.div`
|
|
283
|
+
color: #6a7378;
|
|
284
|
+
font-size: 13px;
|
|
285
|
+
font-style: normal;
|
|
286
|
+
font-weight: 400;
|
|
287
|
+
line-height: 16px;
|
|
288
|
+
white-space: nowrap;
|
|
289
|
+
`;
|
package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
useTaskTypeExtended,
|
|
7
7
|
} from '../../store';
|
|
8
8
|
import { priorityData, transformOption } from '../../utils';
|
|
9
|
-
import { isValid } from 'date-fns';
|
|
10
9
|
import {
|
|
11
10
|
DoubleDropdownContainer,
|
|
12
11
|
FormRow,
|
|
@@ -20,6 +19,10 @@ import { TextArea } from '@bjsdistribution/dms-component-library';
|
|
|
20
19
|
import { DatePicker, Select } from 'antd';
|
|
21
20
|
import { StandardOptionsType } from '../../../../../common/radio-group/types';
|
|
22
21
|
import dayjs from 'dayjs';
|
|
22
|
+
import { isValid } from 'date-fns';
|
|
23
|
+
import utc from 'dayjs/plugin/utc';
|
|
24
|
+
dayjs.extend(utc);
|
|
25
|
+
dayjs.extend(isValid);
|
|
23
26
|
|
|
24
27
|
function CreateReminderModal() {
|
|
25
28
|
const [CategoryData] = useCategoryData();
|
|
@@ -29,8 +32,9 @@ function CreateReminderModal() {
|
|
|
29
32
|
const [, setSelectedCategory] = useState(null);
|
|
30
33
|
const [subCategory] = useTaskTypeExtended();
|
|
31
34
|
const [createReminder, setPayload] = useCreateReminderPayload();
|
|
35
|
+
const [displayDate, setDisplayDate] = useState<any | null>();
|
|
32
36
|
|
|
33
|
-
const handleSelectChange = () => console.log('
|
|
37
|
+
const handleSelectChange = () => console.log('testing log');
|
|
34
38
|
|
|
35
39
|
//options for department
|
|
36
40
|
const departmentOptions = departmentData.map((option: any) =>
|
|
@@ -54,10 +58,15 @@ function CreateReminderModal() {
|
|
|
54
58
|
}));
|
|
55
59
|
};
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
const handleDateChange = (date: any | null, dateString: any | null) => {
|
|
62
|
+
if (dateString && date && isValid(date?.$d)) {
|
|
63
|
+
setDisplayDate(date?.$d?.toISOString());
|
|
64
|
+
|
|
65
|
+
const localDate = dayjs(dateString, 'DD/MM/YYYY HH:mm A');
|
|
66
|
+
|
|
67
|
+
const formattedDateTime = localDate
|
|
68
|
+
.format('YYYY-MM-DDTHH:mm:ss.SSS')
|
|
69
|
+
.concat('Z');
|
|
61
70
|
|
|
62
71
|
setPayload((prevState: any) => ({
|
|
63
72
|
...prevState,
|
|
@@ -185,11 +194,35 @@ function CreateReminderModal() {
|
|
|
185
194
|
<StyleContainer>
|
|
186
195
|
<DatePickerWrap>
|
|
187
196
|
<DatePicker
|
|
188
|
-
format="YYYY
|
|
189
|
-
value={
|
|
197
|
+
format="DD/MM/YYYY HH:mm A"
|
|
198
|
+
value={displayDate ? dayjs(displayDate) : null}
|
|
190
199
|
onChange={handleDateChange}
|
|
191
200
|
placeholder="Select Date & Time"
|
|
192
201
|
showTime={{ defaultValue: dayjs('00:00', 'HH:mm') }}
|
|
202
|
+
disabledDate={current =>
|
|
203
|
+
current && current < dayjs().startOf('day')
|
|
204
|
+
}
|
|
205
|
+
disabledTime={date => {
|
|
206
|
+
if (date && date.isSame(dayjs(), 'day')) {
|
|
207
|
+
const currentHour = dayjs().hour();
|
|
208
|
+
const currentMinute = dayjs().minute();
|
|
209
|
+
return {
|
|
210
|
+
disabledHours: () =>
|
|
211
|
+
Array.from({ length: 24 }, (_, i) => i).filter(
|
|
212
|
+
hour => hour < currentHour
|
|
213
|
+
),
|
|
214
|
+
disabledMinutes: selectedHour => {
|
|
215
|
+
if (selectedHour === currentHour) {
|
|
216
|
+
return Array.from({ length: 60 }, (_, i) => i).filter(
|
|
217
|
+
minute => minute < currentMinute
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
return [];
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return {};
|
|
225
|
+
}}
|
|
193
226
|
/>
|
|
194
227
|
</DatePickerWrap>
|
|
195
228
|
</StyleContainer>
|
|
@@ -1,29 +1,18 @@
|
|
|
1
|
-
import React, { useEffect
|
|
2
|
-
import {
|
|
3
|
-
Alert,
|
|
4
|
-
RadioButtonGroup,
|
|
5
|
-
useApiHook,
|
|
6
|
-
} from '@bjsdistribution/dms-component-library';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
7
3
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
8
|
-
import CustomSwitchSelector from '../../../../../common/custom-switch';
|
|
9
|
-
import { CustomOptions } from '../../../../fakeData';
|
|
10
4
|
import CreateReminder from './CreateReminderModal';
|
|
11
|
-
import CreateTask from './CreateTaskModal';
|
|
12
5
|
import {
|
|
13
|
-
initialPayload,
|
|
14
6
|
initialValue,
|
|
15
7
|
useAllStaticData,
|
|
16
8
|
useCategoryData,
|
|
17
9
|
useCreateReminderPayload,
|
|
18
|
-
useCreateTaskPayload,
|
|
19
10
|
useDepartmentData,
|
|
20
|
-
useNotiifcationLabel,
|
|
21
11
|
useTaskLoading,
|
|
22
12
|
useTaskPriority,
|
|
23
13
|
useTaskTypeData,
|
|
24
14
|
useTaskTypeExtended,
|
|
25
15
|
} from '../../store';
|
|
26
|
-
import useCreateTask from '../../hooks/useCreateTask';
|
|
27
16
|
import Loader from '../../../../order-daily-overview/header/loader/Loader';
|
|
28
17
|
import useCreateReminder from '../../hooks/useCreateReminder';
|
|
29
18
|
import { allTypes } from '../../types';
|
|
@@ -44,14 +33,10 @@ interface ApiResponse {
|
|
|
44
33
|
}
|
|
45
34
|
|
|
46
35
|
function TaskReminderModal() {
|
|
47
|
-
const createTaskAPI = useCreateTask();
|
|
48
36
|
const createReminderAPI = useCreateReminder();
|
|
49
37
|
const [, setCurrentAction] = useCurrentAction();
|
|
50
|
-
const [modalType, setModalTypeState] = useState<string>('task');
|
|
51
|
-
const handleSwitchChange = (newValue: any) => setModalTypeState(newValue);
|
|
52
|
-
const [createTask, setPayload] = useCreateTaskPayload();
|
|
38
|
+
// const [modalType, setModalTypeState] = useState<string>('task');
|
|
53
39
|
const [createReminder, setReminderPayload] = useCreateReminderPayload();
|
|
54
|
-
const [label] = useNotiifcationLabel();
|
|
55
40
|
const [loading, setLoading] = useTaskLoading();
|
|
56
41
|
const [staticData, setStaticData] = useAllStaticData();
|
|
57
42
|
const [, setPriority] = useTaskPriority();
|
|
@@ -89,30 +74,10 @@ function TaskReminderModal() {
|
|
|
89
74
|
}
|
|
90
75
|
}, [staticData]);
|
|
91
76
|
|
|
92
|
-
const handleRadioButtonChange = (event: any) => {
|
|
93
|
-
const selectedValue = event.target.value;
|
|
94
|
-
const isPrivateValue = selectedValue === 'private';
|
|
95
|
-
setPayload(prevState => ({
|
|
96
|
-
...prevState,
|
|
97
|
-
is_private: isPrivateValue,
|
|
98
|
-
}));
|
|
99
|
-
};
|
|
100
|
-
|
|
101
77
|
const closeModal = () => {
|
|
102
78
|
setCurrentAction(undefined);
|
|
103
|
-
if (modalType === 'task') {
|
|
104
|
-
setPayload(initialPayload);
|
|
105
|
-
} else {
|
|
106
|
-
setReminderPayload(initialValue);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
79
|
|
|
110
|
-
|
|
111
|
-
setLoading(true);
|
|
112
|
-
await createTaskAPI([createTask]);
|
|
113
|
-
fetchData();
|
|
114
|
-
ReminderData();
|
|
115
|
-
closeModal();
|
|
80
|
+
setReminderPayload(initialValue);
|
|
116
81
|
};
|
|
117
82
|
|
|
118
83
|
const handleReminderSubmit = async () => {
|
|
@@ -124,13 +89,9 @@ function TaskReminderModal() {
|
|
|
124
89
|
};
|
|
125
90
|
|
|
126
91
|
const isSubmitDisabled = () => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
} else if (modalType === 'reminder') {
|
|
131
|
-
const { details, due } = createReminder;
|
|
132
|
-
return !details || !due;
|
|
133
|
-
}
|
|
92
|
+
const { details, due } = createReminder;
|
|
93
|
+
return !details || !due;
|
|
94
|
+
|
|
134
95
|
return true;
|
|
135
96
|
};
|
|
136
97
|
|
|
@@ -138,46 +99,13 @@ function TaskReminderModal() {
|
|
|
138
99
|
<>
|
|
139
100
|
{loading && <Loader />}
|
|
140
101
|
<OrderModal
|
|
141
|
-
headerTitle={
|
|
102
|
+
headerTitle={'CREATE REMINDER'}
|
|
142
103
|
onCloseHeader={closeModal}
|
|
143
|
-
onSubmit={
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
submitBtnTitle={modalType === 'task' ? 'Save Details' : 'Save Reminder'}
|
|
147
|
-
headerActions={
|
|
148
|
-
<CustomSwitchSelector onSwitchChange={handleSwitchChange} />
|
|
149
|
-
}
|
|
104
|
+
onSubmit={handleReminderSubmit}
|
|
105
|
+
submitBtnTitle={'Save Reminder'}
|
|
150
106
|
isSubmitDisabled={isSubmitDisabled()}
|
|
151
|
-
footerActions={
|
|
152
|
-
modalType === 'task' && (
|
|
153
|
-
<RadioButtonGroup
|
|
154
|
-
selectedValue={
|
|
155
|
-
createTask.is_private == true ? 'private' : 'public'
|
|
156
|
-
}
|
|
157
|
-
options={CustomOptions}
|
|
158
|
-
onChange={handleRadioButtonChange}
|
|
159
|
-
heading={''}
|
|
160
|
-
required={false}
|
|
161
|
-
/>
|
|
162
|
-
)
|
|
163
|
-
}
|
|
164
107
|
>
|
|
165
|
-
<ContentContainer>
|
|
166
|
-
{modalType == 'task' ? <CreateTask /> : <CreateReminder />}
|
|
167
|
-
|
|
168
|
-
{modalType == 'task' ? (
|
|
169
|
-
<Alert
|
|
170
|
-
type="info"
|
|
171
|
-
title={`A FLEX task will be raised for ${label} Team`}
|
|
172
|
-
description=""
|
|
173
|
-
showOkButton={false}
|
|
174
|
-
showCloseIcon={false}
|
|
175
|
-
onClose={() => {}}
|
|
176
|
-
/>
|
|
177
|
-
) : (
|
|
178
|
-
''
|
|
179
|
-
)}
|
|
180
|
-
</ContentContainer>
|
|
108
|
+
<ContentContainer>{<CreateReminder />}</ContentContainer>
|
|
181
109
|
</OrderModal>
|
|
182
110
|
</>
|
|
183
111
|
);
|
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
AntSelect,
|
|
4
|
+
Label,
|
|
5
|
+
useApiHook,
|
|
6
|
+
} from '@bjsdistribution/dms-component-library';
|
|
3
7
|
import {
|
|
4
8
|
useCurrentAction,
|
|
9
|
+
useCustomerInfo,
|
|
10
|
+
useOrderDetails,
|
|
5
11
|
useOrderId,
|
|
6
12
|
useOrderStaticData,
|
|
13
|
+
usePrevOrderDetails,
|
|
7
14
|
} from '../../../store';
|
|
8
15
|
import OrderActionModal from '../../../../../common/modals/order-action-modal/OrderActionModal';
|
|
9
16
|
import {
|
|
10
17
|
HoldContentContainer,
|
|
11
18
|
HoldDatePickerWrap,
|
|
12
19
|
HoldRow,
|
|
13
|
-
Label,
|
|
14
20
|
SplitText,
|
|
15
21
|
} from '../modalstyle';
|
|
16
|
-
import { DatePicker, DatePickerProps } from 'antd';
|
|
22
|
+
import { DatePicker, DatePickerProps, notification } from 'antd';
|
|
17
23
|
import dayjs from 'dayjs';
|
|
18
|
-
import { ApiResponse } from '../../../types';
|
|
24
|
+
import { ApiResponse, OrdersType } from '../../../types';
|
|
25
|
+
import { useLoading } from '../../../../order-daily-overview/store/store';
|
|
19
26
|
|
|
20
27
|
function HoldOrderModal() {
|
|
21
28
|
const [orderId] = useOrderId();
|
|
22
29
|
const [, setCurrentAction] = useCurrentAction();
|
|
23
|
-
|
|
24
|
-
const onClose = () => {
|
|
25
|
-
setCurrentAction(undefined);
|
|
26
|
-
};
|
|
27
|
-
|
|
30
|
+
const [, setLoading] = useLoading();
|
|
28
31
|
const [orderStaticData] = useOrderStaticData();
|
|
29
32
|
const [selectedDate, setDate] = useState<Date | string | null>(null);
|
|
30
33
|
const [holdReason, setHoldReason] = useState<string | undefined>(undefined);
|
|
34
|
+
const [, setOrderDetails] = useOrderDetails();
|
|
35
|
+
const [, setPrevOrderDetails] = usePrevOrderDetails();
|
|
36
|
+
const [customerInfo] = useCustomerInfo();
|
|
37
|
+
const infoText = `${customerInfo?.recipient_name}, ${customerInfo?.postcode}`;
|
|
31
38
|
|
|
32
39
|
const onHoldReasonOptions = orderStaticData?.onhold_reasons?.map(
|
|
33
40
|
(item: any) => {
|
|
@@ -49,12 +56,52 @@ function HoldOrderModal() {
|
|
|
49
56
|
performAction: false,
|
|
50
57
|
});
|
|
51
58
|
|
|
59
|
+
const { data: fetchedData, loading, setShouldPerformAction } = useApiHook<{
|
|
60
|
+
data: OrdersType[];
|
|
61
|
+
}>({
|
|
62
|
+
endpoint: `orders/${orderId}`,
|
|
63
|
+
method: 'GET',
|
|
64
|
+
performAction: false,
|
|
65
|
+
});
|
|
66
|
+
|
|
52
67
|
useEffect(() => {
|
|
53
|
-
|
|
68
|
+
setLoading(loading);
|
|
69
|
+
if (fetchedData && fetchedData.data) {
|
|
70
|
+
const requiredData = fetchedData?.data;
|
|
71
|
+
setOrderDetails(requiredData[0]);
|
|
72
|
+
setPrevOrderDetails(requiredData[0]);
|
|
73
|
+
setCurrentAction(undefined);
|
|
74
|
+
}
|
|
75
|
+
if (
|
|
76
|
+
(fetchedData && fetchedData?.data === null) ||
|
|
77
|
+
fetchedData?.data?.length === 0
|
|
78
|
+
) {
|
|
54
79
|
setCurrentAction(undefined);
|
|
55
80
|
}
|
|
81
|
+
}, [loading]);
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (response) {
|
|
85
|
+
//@ts-ignore
|
|
86
|
+
if (response?.data && response?.code === 200) {
|
|
87
|
+
setShouldPerformAction(true);
|
|
88
|
+
} else {
|
|
89
|
+
notification.error({
|
|
90
|
+
message: 'Error',
|
|
91
|
+
description:
|
|
92
|
+
//@ts-ignore
|
|
93
|
+
response?.error_traceback ||
|
|
94
|
+
'An error has occurred. Please try again later.',
|
|
95
|
+
});
|
|
96
|
+
setCurrentAction(undefined);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
56
99
|
}, [response]);
|
|
57
100
|
|
|
101
|
+
const onClose = () => {
|
|
102
|
+
setCurrentAction(undefined);
|
|
103
|
+
};
|
|
104
|
+
|
|
58
105
|
const onChangeHold = (value: string) => {
|
|
59
106
|
setHoldReason(value);
|
|
60
107
|
};
|
|
@@ -82,14 +129,14 @@ function HoldOrderModal() {
|
|
|
82
129
|
onCloseHeader={onClose}
|
|
83
130
|
onSubmit={onSubmitHold}
|
|
84
131
|
showAdditionalInfo
|
|
85
|
-
infoText=
|
|
132
|
+
infoText={infoText}
|
|
86
133
|
submitBtnTitle="Save Details"
|
|
87
134
|
isSubmitDisabled={!showSubmitBtn}
|
|
88
135
|
>
|
|
89
136
|
<HoldContentContainer>
|
|
90
137
|
<SplitText>
|
|
91
138
|
<HoldRow>
|
|
92
|
-
<Label
|
|
139
|
+
<Label label="Delivery Date" required />
|
|
93
140
|
<HoldDatePickerWrap>
|
|
94
141
|
<DatePicker
|
|
95
142
|
needConfirm
|
|
@@ -103,9 +150,9 @@ function HoldOrderModal() {
|
|
|
103
150
|
</HoldRow>
|
|
104
151
|
|
|
105
152
|
<HoldRow>
|
|
106
|
-
<Label
|
|
153
|
+
<Label label="Hold Reason" required />
|
|
107
154
|
<AntSelect
|
|
108
|
-
options={onHoldReasonOptions}
|
|
155
|
+
options={onHoldReasonOptions || []}
|
|
109
156
|
placeholder="Select Hold Reason"
|
|
110
157
|
onChange={onChangeHold}
|
|
111
158
|
disabled={false}
|