@bjsdistribution/dms-client-return 0.0.85 → 0.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/order-view/notification/OrderTemplate.d.ts +3 -0
- package/dist/components/order-view/order-actions/hooks/useFetchSingleReminder.d.ts +2 -0
- package/dist/components/order-view/order-actions/hooks/useUpdateReminder.d.ts +3 -0
- package/dist/components/order-view/order-actions/store.d.ts +1 -0
- package/dist/components/order-view/utils.d.ts +1 -0
- package/dist/components/order-view/view-reminder/AssigneeDropdown.d.ts +3 -0
- package/dist/components/order-view/view-reminder/ViewReminder.d.ts +3 -0
- package/dist/components/order-view/view-reminder/reminder-styles.d.ts +25 -0
- package/dist/dms-client-return.cjs.development.js +613 -114
- 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 +613 -114
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/order-view/index.tsx +6 -1
- package/src/components/order-view/notification/OrderTemplate.tsx +349 -0
- package/src/components/order-view/notification/Tabs.tsx +10 -6
- package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +0 -32
- package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +7 -0
- package/src/components/order-view/order-actions/actions/uncancel-order/UncancelOrder.tsx +4 -3
- package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +1 -1
- package/src/components/order-view/order-actions/hooks/useFetchSingleReminder.ts +56 -0
- package/src/components/order-view/order-actions/hooks/useUpdateReminder.ts +52 -0
- package/src/components/order-view/order-actions/index.tsx +3 -0
- package/src/components/order-view/order-actions/store.ts +6 -0
- package/src/components/order-view/order-actions/utils.ts +1 -1
- package/src/components/order-view/order-details/expanded-content/orders-section/Carrier.tsx +1 -1
- package/src/components/order-view/order-details/expanded-content/services-section/DeliveryPoint.tsx +1 -1
- package/src/components/order-view/order-details/expanded-content/services-section/TimedService.tsx +1 -1
- package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +33 -0
- package/src/components/order-view/view-reminder/ViewReminder.tsx +314 -0
- package/src/components/order-view/view-reminder/reminder-styles.tsx +173 -0
package/package.json
CHANGED
|
@@ -38,7 +38,7 @@ import DetailsFilters from './details-filters/DetailsFilters';
|
|
|
38
38
|
import { useSubContracterData, useVisibilityData } from '../store';
|
|
39
39
|
import Notification from './notification';
|
|
40
40
|
import Order from './order-resources/expanded-content';
|
|
41
|
-
import { setResourcesCall } from './order-actions/store';
|
|
41
|
+
import { setResourcesCall, useAllOrderStatus } from './order-actions/store';
|
|
42
42
|
|
|
43
43
|
interface ApiResponse {
|
|
44
44
|
message: string;
|
|
@@ -75,6 +75,11 @@ function OrderView() {
|
|
|
75
75
|
const [, setVisibilityData] = useVisibilityData();
|
|
76
76
|
const [, setSubContracterData] = useSubContracterData();
|
|
77
77
|
const [recallOrders] = useGlobalStateHitOrder();
|
|
78
|
+
const [, setStatusVal] = useAllOrderStatus();
|
|
79
|
+
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
setStatusVal(orderDetails?.status_value);
|
|
82
|
+
}, [orderDetails?.status_value]);
|
|
78
83
|
|
|
79
84
|
// query param
|
|
80
85
|
const location = useLocation();
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { FlagAlert } from '@bjsdistribution/dms-component-library';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import {
|
|
5
|
+
useAllOrderStatus,
|
|
6
|
+
useOrderNotify,
|
|
7
|
+
useRouteDetails,
|
|
8
|
+
} from '../order-actions/store';
|
|
9
|
+
import { format } from 'date-fns';
|
|
10
|
+
import { useOrderStaticData } from '../store';
|
|
11
|
+
|
|
12
|
+
function OrderTemplate({ orderDetails }: any) {
|
|
13
|
+
const [routeData] = useRouteDetails();
|
|
14
|
+
const [, setOrderCount] = useOrderNotify();
|
|
15
|
+
const [statusVal] = useAllOrderStatus();
|
|
16
|
+
const precall = false;
|
|
17
|
+
const [orderStaticData] = useOrderStaticData();
|
|
18
|
+
|
|
19
|
+
const unholdReasons = orderStaticData?.cancellation_reasons?.map(
|
|
20
|
+
(x: any) => ({
|
|
21
|
+
id: x?.id,
|
|
22
|
+
reason: x?.reason,
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const getReasonById = (id: number) => {
|
|
27
|
+
if (!unholdReasons || unholdReasons?.length === 0) {
|
|
28
|
+
return 'Reason not found';
|
|
29
|
+
}
|
|
30
|
+
const match = unholdReasons?.find((item: any) => item?.id === id);
|
|
31
|
+
return match ? match?.reason : 'Reason not found';
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const reason = getReasonById(orderDetails?.order_cancellations?.reason_id);
|
|
35
|
+
|
|
36
|
+
const [alertVisibility, setAlertVisibility] = useState({
|
|
37
|
+
isHoldVisible: true,
|
|
38
|
+
isCompleted: true,
|
|
39
|
+
isOutstanding: true,
|
|
40
|
+
isAwaitingConfirmation: true,
|
|
41
|
+
isAwaitingRoute: true,
|
|
42
|
+
isCancelled: true,
|
|
43
|
+
isEnroute: true,
|
|
44
|
+
isPreCall: true,
|
|
45
|
+
isConfirmed: true,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const crewDetails =
|
|
49
|
+
routeData?.route_crew_info?.crew1_id +
|
|
50
|
+
' ' +
|
|
51
|
+
routeData?.route_crew_info?.crew1 +
|
|
52
|
+
' ' +
|
|
53
|
+
routeData?.route_crew_info?.crew2_id +
|
|
54
|
+
' ' +
|
|
55
|
+
routeData?.route_crew_info?.crew2 +
|
|
56
|
+
' ';
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (precall) {
|
|
60
|
+
setOrderCount(prevCount => prevCount + 1);
|
|
61
|
+
}
|
|
62
|
+
}, [precall]);
|
|
63
|
+
|
|
64
|
+
//on close alert functionality
|
|
65
|
+
const onCloseAlert = (alertType: string) => {
|
|
66
|
+
setAlertVisibility(prev => ({
|
|
67
|
+
...prev,
|
|
68
|
+
[alertType]: false,
|
|
69
|
+
}));
|
|
70
|
+
setOrderCount(0);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<>
|
|
75
|
+
{statusVal == 'on hold' && alertVisibility?.isHoldVisible && (
|
|
76
|
+
<StyledAlert>
|
|
77
|
+
<FlagAlert
|
|
78
|
+
type="warn"
|
|
79
|
+
title={
|
|
80
|
+
<>
|
|
81
|
+
{orderDetails?.order_on_hold?.hold_indefinitely === false ? (
|
|
82
|
+
<HoldText>
|
|
83
|
+
on hold until:{' '}
|
|
84
|
+
{orderDetails?.order_on_hold?.hold_untill
|
|
85
|
+
? format(
|
|
86
|
+
new Date(orderDetails?.order_on_hold?.hold_untill),
|
|
87
|
+
'dd/MM/yyyy'
|
|
88
|
+
)
|
|
89
|
+
: ''}
|
|
90
|
+
</HoldText>
|
|
91
|
+
) : (
|
|
92
|
+
<HoldText>On Hold Until: Indefinitely</HoldText>
|
|
93
|
+
)}
|
|
94
|
+
</>
|
|
95
|
+
}
|
|
96
|
+
description={''}
|
|
97
|
+
showOkButton={false}
|
|
98
|
+
onClose={() => onCloseAlert('isHoldVisible')}
|
|
99
|
+
/>
|
|
100
|
+
</StyledAlert>
|
|
101
|
+
)}
|
|
102
|
+
{orderDetails.status == 'SD' && alertVisibility.isCompleted && (
|
|
103
|
+
<StyledAlert>
|
|
104
|
+
<FlagAlert
|
|
105
|
+
type="success"
|
|
106
|
+
title={
|
|
107
|
+
<TitleText>
|
|
108
|
+
Completed: {orderDetails?.order_routes?.complete_time}, Signee:{' '}
|
|
109
|
+
{orderDetails?.order_routes?.signee} Notes :
|
|
110
|
+
{orderDetails?.order_routes?.complete_notes}
|
|
111
|
+
</TitleText>
|
|
112
|
+
}
|
|
113
|
+
description={
|
|
114
|
+
<SubtitleText>
|
|
115
|
+
Route: {routeData?.route_name}
|
|
116
|
+
{routeData?.route_lock ? ' *LOCKED* ' : ''} on{' '}
|
|
117
|
+
{routeData?.route_detail?.vehicle_number} | Crew : {crewDetails}
|
|
118
|
+
| {routeData?.route_date}
|
|
119
|
+
</SubtitleText>
|
|
120
|
+
}
|
|
121
|
+
showOkButton={false}
|
|
122
|
+
onClose={() => onCloseAlert('isCompleted')}
|
|
123
|
+
/>
|
|
124
|
+
</StyledAlert>
|
|
125
|
+
)}
|
|
126
|
+
|
|
127
|
+
{precall && alertVisibility.isPreCall && (
|
|
128
|
+
<StyledAlert>
|
|
129
|
+
<FlagAlert
|
|
130
|
+
type="success"
|
|
131
|
+
title={`Order Pre-Call Slot Time : ${orderDetails?.order_eta_updates?.map(
|
|
132
|
+
(i: any) => i?.slot_start
|
|
133
|
+
)} - ${orderDetails?.order_eta_updates?.map(
|
|
134
|
+
(i: any) => i?.slot_end
|
|
135
|
+
)}`}
|
|
136
|
+
description={``}
|
|
137
|
+
showOkButton={false}
|
|
138
|
+
onClose={() => onCloseAlert('isPreCall')}
|
|
139
|
+
/>
|
|
140
|
+
</StyledAlert>
|
|
141
|
+
)}
|
|
142
|
+
|
|
143
|
+
{statusVal == 'outstanding' && alertVisibility.isOutstanding && (
|
|
144
|
+
<StyledAlert>
|
|
145
|
+
<FlagAlert
|
|
146
|
+
type="release"
|
|
147
|
+
title={`Outstanding`}
|
|
148
|
+
description={``}
|
|
149
|
+
showOkButton={false}
|
|
150
|
+
onClose={() => onCloseAlert('isOutstanding')}
|
|
151
|
+
/>
|
|
152
|
+
</StyledAlert>
|
|
153
|
+
)}
|
|
154
|
+
{statusVal == 'awaiting confirmation' &&
|
|
155
|
+
alertVisibility.isAwaitingConfirmation && (
|
|
156
|
+
<StyledAlert>
|
|
157
|
+
<FlagAlert
|
|
158
|
+
type="info"
|
|
159
|
+
title={
|
|
160
|
+
<>
|
|
161
|
+
<ScheduledText>
|
|
162
|
+
Scheduled For :{' '}
|
|
163
|
+
{orderDetails?.action_date
|
|
164
|
+
? format(
|
|
165
|
+
new Date(orderDetails?.action_date),
|
|
166
|
+
'dd/MM/yyyy'
|
|
167
|
+
)
|
|
168
|
+
: ''}{' '}
|
|
169
|
+
<span>, Awaiting Confirmation</span>
|
|
170
|
+
</ScheduledText>
|
|
171
|
+
</>
|
|
172
|
+
}
|
|
173
|
+
description={``}
|
|
174
|
+
showOkButton={false}
|
|
175
|
+
onClose={() => onCloseAlert('isAwaitingConfirmation')}
|
|
176
|
+
/>
|
|
177
|
+
</StyledAlert>
|
|
178
|
+
)}
|
|
179
|
+
{statusVal == 'awaiting route' && alertVisibility.isAwaitingRoute && (
|
|
180
|
+
<StyledAlert>
|
|
181
|
+
<FlagAlert
|
|
182
|
+
type="info"
|
|
183
|
+
title={
|
|
184
|
+
<>
|
|
185
|
+
<ScheduledText>
|
|
186
|
+
Scheduled For :{' '}
|
|
187
|
+
{orderDetails?.action_date
|
|
188
|
+
? format(new Date(orderDetails?.action_date), 'dd/MM/yyyy')
|
|
189
|
+
: ''}{' '}
|
|
190
|
+
,<span> Awaiting Route</span>
|
|
191
|
+
</ScheduledText>
|
|
192
|
+
</>
|
|
193
|
+
}
|
|
194
|
+
description={``}
|
|
195
|
+
showOkButton={false}
|
|
196
|
+
onClose={() => onCloseAlert('isAwaitingRoute')}
|
|
197
|
+
/>
|
|
198
|
+
</StyledAlert>
|
|
199
|
+
)}
|
|
200
|
+
{statusVal == 'cancelled' && alertVisibility.isCancelled && (
|
|
201
|
+
<StyledAlert>
|
|
202
|
+
<FlagAlert
|
|
203
|
+
type="error"
|
|
204
|
+
title={`This order has been cancelled`}
|
|
205
|
+
description={reason}
|
|
206
|
+
showOkButton={false}
|
|
207
|
+
onClose={() => onCloseAlert('isCancelled')}
|
|
208
|
+
/>
|
|
209
|
+
</StyledAlert>
|
|
210
|
+
)}
|
|
211
|
+
{statusVal == 'enroute' && alertVisibility.isEnroute && (
|
|
212
|
+
<StyledAlert>
|
|
213
|
+
<FlagAlert
|
|
214
|
+
type="info"
|
|
215
|
+
title={
|
|
216
|
+
<>
|
|
217
|
+
<EnRouteText>
|
|
218
|
+
Allocated to Route :{' '}
|
|
219
|
+
<span>
|
|
220
|
+
{routeData?.route_name}
|
|
221
|
+
{routeData?.route_lock ? ' *LOCKED* ' : ''} on{' '}
|
|
222
|
+
{routeData?.route_detail?.vehicle_number} | Crew :{' '}
|
|
223
|
+
{crewDetails}|{' '}
|
|
224
|
+
{routeData?.route_date
|
|
225
|
+
? format(new Date(routeData?.route_date), 'dd/MM/yyyy')
|
|
226
|
+
: ''}{' '}
|
|
227
|
+
</span>
|
|
228
|
+
<span>
|
|
229
|
+
{' '}
|
|
230
|
+
, Confirmed: <span className="no">NO</span>
|
|
231
|
+
</span>
|
|
232
|
+
</EnRouteText>
|
|
233
|
+
</>
|
|
234
|
+
}
|
|
235
|
+
description={``}
|
|
236
|
+
showOkButton={false}
|
|
237
|
+
onClose={() => onCloseAlert('isEnroute')}
|
|
238
|
+
/>
|
|
239
|
+
</StyledAlert>
|
|
240
|
+
)}
|
|
241
|
+
|
|
242
|
+
{statusVal == 'confirmed' && alertVisibility.isConfirmed && (
|
|
243
|
+
<StyledAlert>
|
|
244
|
+
<FlagAlert
|
|
245
|
+
type="info"
|
|
246
|
+
title={
|
|
247
|
+
<>
|
|
248
|
+
<EnRouteText>
|
|
249
|
+
Allocated to Route :{' '}
|
|
250
|
+
<span>
|
|
251
|
+
{routeData?.route_name}
|
|
252
|
+
{routeData?.route_lock ? ' *LOCKED* ' : ''} on{' '}
|
|
253
|
+
{routeData?.route_detail?.vehicle_number} | Crew :{' '}
|
|
254
|
+
{crewDetails}|{' '}
|
|
255
|
+
{routeData?.route_date
|
|
256
|
+
? format(new Date(routeData?.route_date), 'dd/MM/yyyy')
|
|
257
|
+
: ''}{' '}
|
|
258
|
+
</span>
|
|
259
|
+
<span>
|
|
260
|
+
{' '}
|
|
261
|
+
, Confirmed: <span className="yes">YES</span>
|
|
262
|
+
</span>
|
|
263
|
+
</EnRouteText>
|
|
264
|
+
</>
|
|
265
|
+
}
|
|
266
|
+
description={``}
|
|
267
|
+
showOkButton={false}
|
|
268
|
+
onClose={() => onCloseAlert('isConfirmed')}
|
|
269
|
+
/>
|
|
270
|
+
</StyledAlert>
|
|
271
|
+
)}
|
|
272
|
+
</>
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const StyledAlert = styled.div`
|
|
277
|
+
margin-bottom: 5px;
|
|
278
|
+
`;
|
|
279
|
+
|
|
280
|
+
const SubtitleText = styled.div`
|
|
281
|
+
color: #36a053;
|
|
282
|
+
font-family: Roboto;
|
|
283
|
+
font-size: 14px;
|
|
284
|
+
font-style: normal;
|
|
285
|
+
font-weight: 600;
|
|
286
|
+
line-height: 24px;
|
|
287
|
+
`;
|
|
288
|
+
|
|
289
|
+
const TitleText = styled.div`
|
|
290
|
+
color: #3a3630;
|
|
291
|
+
font-family: Lato;
|
|
292
|
+
font-size: 14px;
|
|
293
|
+
font-style: normal;
|
|
294
|
+
font-weight: 500;
|
|
295
|
+
line-height: 18px;
|
|
296
|
+
`;
|
|
297
|
+
|
|
298
|
+
const ScheduledText = styled.div`
|
|
299
|
+
color: #6396e5;
|
|
300
|
+
font-family: Roboto;
|
|
301
|
+
font-size: 14px;
|
|
302
|
+
font-style: normal;
|
|
303
|
+
font-weight: 600;
|
|
304
|
+
span {
|
|
305
|
+
color: #36a053;
|
|
306
|
+
font-family: Roboto;
|
|
307
|
+
font-size: 14px;
|
|
308
|
+
font-style: normal;
|
|
309
|
+
font-weight: 600;
|
|
310
|
+
}
|
|
311
|
+
`;
|
|
312
|
+
|
|
313
|
+
const HoldText = styled.div`
|
|
314
|
+
color: #feba30;
|
|
315
|
+
font-family: Roboto;
|
|
316
|
+
font-size: 14px;
|
|
317
|
+
font-style: normal;
|
|
318
|
+
font-weight: 600;
|
|
319
|
+
span {
|
|
320
|
+
color: #6a7378;
|
|
321
|
+
font-family: Roboto;
|
|
322
|
+
font-size: 14px;
|
|
323
|
+
font-style: normal;
|
|
324
|
+
font-weight: 600;
|
|
325
|
+
}
|
|
326
|
+
`;
|
|
327
|
+
|
|
328
|
+
const EnRouteText = styled.div`
|
|
329
|
+
color: #36a053;
|
|
330
|
+
font-family: Roboto;
|
|
331
|
+
font-size: 14px;
|
|
332
|
+
font-style: normal;
|
|
333
|
+
font-weight: 600;
|
|
334
|
+
span {
|
|
335
|
+
color: #6396e5;
|
|
336
|
+
font-family: Roboto;
|
|
337
|
+
font-size: 14px;
|
|
338
|
+
font-style: normal;
|
|
339
|
+
font-weight: 600;
|
|
340
|
+
.yes {
|
|
341
|
+
color: #36a053;
|
|
342
|
+
}
|
|
343
|
+
.no {
|
|
344
|
+
color: #e95252;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
`;
|
|
348
|
+
|
|
349
|
+
export default OrderTemplate;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { useTabType } from '../store';
|
|
3
|
+
import { useOrderDetails, useTabType } from '../store';
|
|
4
4
|
import FlagTemplate from './FlagTemplate';
|
|
5
5
|
import ReminderTemplate from './ReminderTemplate';
|
|
6
|
+
import OrderTemplate from './OrderTemplate';
|
|
6
7
|
|
|
7
8
|
function Tabs({
|
|
8
9
|
activeNotifications,
|
|
@@ -13,12 +14,13 @@ function Tabs({
|
|
|
13
14
|
dismissFlags,
|
|
14
15
|
}: any) {
|
|
15
16
|
const [activeTab] = useTabType();
|
|
17
|
+
const [orderDetails] = useOrderDetails();
|
|
16
18
|
|
|
17
|
-
const initialNotifications = activeNotifications
|
|
18
|
-
const additionalNotifications = activeNotifications
|
|
19
|
+
const initialNotifications = activeNotifications?.slice(0, 3);
|
|
20
|
+
const additionalNotifications = activeNotifications?.slice(3);
|
|
19
21
|
|
|
20
|
-
const initialReminders = activeReminders
|
|
21
|
-
const additionalReminders = activeReminders
|
|
22
|
+
const initialReminders = activeReminders?.slice(0, 3);
|
|
23
|
+
const additionalReminders = activeReminders?.slice(3);
|
|
22
24
|
|
|
23
25
|
return (
|
|
24
26
|
<>
|
|
@@ -26,7 +28,9 @@ function Tabs({
|
|
|
26
28
|
<Container className="tab-content">
|
|
27
29
|
{activeTab === 'active' && (
|
|
28
30
|
<>
|
|
29
|
-
{
|
|
31
|
+
<OrderTemplate orderDetails={orderDetails} />
|
|
32
|
+
|
|
33
|
+
{initialReminders?.map((item: any, index: any) => (
|
|
30
34
|
<ReminderTemplate
|
|
31
35
|
key={index}
|
|
32
36
|
data={item}
|
|
@@ -147,30 +147,6 @@ function ConfirmOrder() {
|
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
|
|
150
|
-
// const isDifferent = () => {
|
|
151
|
-
// const keysToRemovefromOrders = [
|
|
152
|
-
// 'order_locked',
|
|
153
|
-
// 'order_communications',
|
|
154
|
-
// 'updated_at',
|
|
155
|
-
// 'updated_by',
|
|
156
|
-
// 'order_services',
|
|
157
|
-
// ];
|
|
158
|
-
// const filteredOrderDetails = filterObject(
|
|
159
|
-
// orderDetailsConfirmOrder,
|
|
160
|
-
// keysToRemovefromOrders
|
|
161
|
-
// );
|
|
162
|
-
// const filteredPrevOrderDetails = filterObject(
|
|
163
|
-
// prevOrderDetails,
|
|
164
|
-
// keysToRemovefromOrders
|
|
165
|
-
// );
|
|
166
|
-
|
|
167
|
-
// const orderDetailsSorted = JSON.stringify(filteredOrderDetails);
|
|
168
|
-
// const prevOrderDetailsSorted = JSON.stringify(filteredPrevOrderDetails);
|
|
169
|
-
// const isSame = orderDetailsSorted === prevOrderDetailsSorted;
|
|
170
|
-
// // newOrderServicesSorted === prevOrderServicesSorted;
|
|
171
|
-
// return !isSame;
|
|
172
|
-
// };
|
|
173
|
-
|
|
174
150
|
const errorFound = () => {
|
|
175
151
|
const isError =
|
|
176
152
|
errorState.emailError.length > 0 ||
|
|
@@ -192,14 +168,6 @@ function ConfirmOrder() {
|
|
|
192
168
|
isSubmitDisabled={errorFound()}
|
|
193
169
|
>
|
|
194
170
|
<ContentContainer>
|
|
195
|
-
{/* <Alert
|
|
196
|
-
description=""
|
|
197
|
-
onClose={() => {}}
|
|
198
|
-
type="info"
|
|
199
|
-
title="There is Orders with identical postcodes that are yet to be delivered.View Orders"
|
|
200
|
-
showOkButton={false}
|
|
201
|
-
showCloseIcon={false}
|
|
202
|
-
/> */}
|
|
203
171
|
<Wrapper>
|
|
204
172
|
<CustomerInformation />
|
|
205
173
|
<SlotAndInstructions />
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
useCurrentAction,
|
|
9
9
|
useCustomerInfo,
|
|
10
|
+
useLiveRecalling,
|
|
10
11
|
useOrderDetails,
|
|
11
12
|
useOrderId,
|
|
12
13
|
useOrderStaticData,
|
|
@@ -34,6 +35,8 @@ function HoldOrderModal() {
|
|
|
34
35
|
const [, setOrderDetails] = useOrderDetails();
|
|
35
36
|
const [, setPrevOrderDetails] = usePrevOrderDetails();
|
|
36
37
|
const [customerInfo] = useCustomerInfo();
|
|
38
|
+
const [, setRecalling] = useLiveRecalling();
|
|
39
|
+
|
|
37
40
|
const infoText = `${customerInfo?.recipient_name}, ${customerInfo?.postcode}`;
|
|
38
41
|
|
|
39
42
|
const onHoldReasonOptions = orderStaticData?.onhold_reasons?.map(
|
|
@@ -90,6 +93,10 @@ function HoldOrderModal() {
|
|
|
90
93
|
//@ts-ignore
|
|
91
94
|
if (response?.data && response?.code === 200) {
|
|
92
95
|
setShouldPerformAction(true);
|
|
96
|
+
setRecalling(true);
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
setRecalling(false);
|
|
99
|
+
}, 1000);
|
|
93
100
|
} else {
|
|
94
101
|
notification.error({
|
|
95
102
|
message: 'Error',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
AntSelect,
|
|
4
|
+
Label,
|
|
4
5
|
TextArea,
|
|
5
6
|
useApiHook,
|
|
6
7
|
} from '@bjsdistribution/dms-component-library';
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
usePrevOrderDetails,
|
|
14
15
|
} from '../../../store';
|
|
15
16
|
import OrderActionModal from '../../../../../common/modals/order-action-modal/OrderActionModal';
|
|
16
|
-
import { HoldContentContainer, HoldRow,
|
|
17
|
+
import { HoldContentContainer, HoldRow, SplitText } from '../modalstyle';
|
|
17
18
|
import { ApiResponse, OrdersType } from '../../../types';
|
|
18
19
|
import styled from 'styled-components';
|
|
19
20
|
import { useLoading } from '../../../../order-daily-overview/store/store';
|
|
@@ -136,7 +137,7 @@ function UncancelOrder() {
|
|
|
136
137
|
<HoldContentContainer>
|
|
137
138
|
<SplitText>
|
|
138
139
|
<HoldRow>
|
|
139
|
-
<Label
|
|
140
|
+
<Label label="Un-cancel Reason" required></Label>
|
|
140
141
|
<AntSelect
|
|
141
142
|
options={unCancelReasonOptions || []}
|
|
142
143
|
placeholder="Select un-cancel Reason"
|
|
@@ -150,7 +151,7 @@ function UncancelOrder() {
|
|
|
150
151
|
/>
|
|
151
152
|
</HoldRow>
|
|
152
153
|
<HoldRow>
|
|
153
|
-
<Label
|
|
154
|
+
<Label label="Un-cancel Note"></Label>
|
|
154
155
|
<CustomTextArea rows={5} onChange={onChange} />
|
|
155
156
|
</HoldRow>
|
|
156
157
|
</SplitText>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getBaseEndpoint } from '@bjsdistribution/dms-component-library';
|
|
2
|
+
import { useFlagsLoading, useReminderRefId } from '../store';
|
|
3
|
+
import { getCookie } from '../../utils';
|
|
4
|
+
import { notification } from 'antd';
|
|
5
|
+
|
|
6
|
+
function useFetchSingleReminderData() {
|
|
7
|
+
const [reminderRefId] = useReminderRefId();
|
|
8
|
+
|
|
9
|
+
const [, setLoading] = useFlagsLoading();
|
|
10
|
+
const ssoToken = getCookie('id_token');
|
|
11
|
+
|
|
12
|
+
const res = async () => {
|
|
13
|
+
const endpoint = `${getBaseEndpoint()}/tasks/reminder/${reminderRefId}`;
|
|
14
|
+
setLoading(true);
|
|
15
|
+
try {
|
|
16
|
+
const headers = {
|
|
17
|
+
accept: 'application/json',
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
Authorization: `Bearer ${ssoToken}`,
|
|
20
|
+
};
|
|
21
|
+
const response = await fetch(endpoint, {
|
|
22
|
+
method: 'GET',
|
|
23
|
+
headers,
|
|
24
|
+
});
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
const json = await response.json();
|
|
27
|
+
const detail = json?.detail;
|
|
28
|
+
const msg = detail[0]?.msg;
|
|
29
|
+
notification.error({
|
|
30
|
+
message: 'Error',
|
|
31
|
+
description: msg || 'An error has occurred. Please try again later.',
|
|
32
|
+
});
|
|
33
|
+
setLoading(false);
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
const json = await response.json();
|
|
37
|
+
if (json.code === 200) {
|
|
38
|
+
setLoading(false);
|
|
39
|
+
|
|
40
|
+
return { ...json.data[0] };
|
|
41
|
+
}
|
|
42
|
+
return [];
|
|
43
|
+
} catch (err) {
|
|
44
|
+
//setloading(false);
|
|
45
|
+
notification.error({
|
|
46
|
+
message: 'Error',
|
|
47
|
+
description:
|
|
48
|
+
`${err}` || 'An error has occurred. Please try again later.',
|
|
49
|
+
});
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return res;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default useFetchSingleReminderData;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getBaseEndpoint } from '@bjsdistribution/dms-component-library';
|
|
2
|
+
import { useFlagsLoading } from '../store';
|
|
3
|
+
import { UpdateReminderPayload } from '../types';
|
|
4
|
+
import { getCookie } from '../../utils';
|
|
5
|
+
import { notification } from 'antd';
|
|
6
|
+
|
|
7
|
+
function useUpdateReminder() {
|
|
8
|
+
const ssoToken = getCookie('id_token');
|
|
9
|
+
const [, setLoading] = useFlagsLoading();
|
|
10
|
+
|
|
11
|
+
const update = async (data: UpdateReminderPayload[]) => {
|
|
12
|
+
const endpoint = `${getBaseEndpoint()}/tasks/reminder/update/`;
|
|
13
|
+
setLoading(true);
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const requestOptions = {
|
|
17
|
+
headers: {
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
Authorization: `Bearer ${ssoToken}`,
|
|
20
|
+
},
|
|
21
|
+
method: 'PUT',
|
|
22
|
+
body: JSON.stringify(data),
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const response = await fetch(endpoint, requestOptions);
|
|
26
|
+
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
throw new Error('response is not ok');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const json = await response.json();
|
|
32
|
+
notification.success({
|
|
33
|
+
message: 'Success',
|
|
34
|
+
description: 'Reminder has been updated.',
|
|
35
|
+
});
|
|
36
|
+
return json;
|
|
37
|
+
} catch (err) {
|
|
38
|
+
notification.error({
|
|
39
|
+
message: 'Error',
|
|
40
|
+
description:
|
|
41
|
+
`${err}` || 'An error has occurred. Please try again later.',
|
|
42
|
+
});
|
|
43
|
+
} finally {
|
|
44
|
+
setLoading(false);
|
|
45
|
+
}
|
|
46
|
+
setLoading(false);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return update;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default useUpdateReminder;
|
|
@@ -20,6 +20,7 @@ import UncancelOrder from './actions/uncancel-order/UncancelOrder';
|
|
|
20
20
|
import ClearBookingStatus from './actions/clear-booking-status/ClearBookingStatus';
|
|
21
21
|
import RemoveFromRoute from './actions/remove-from-route/RemoveFromRoute';
|
|
22
22
|
import TaskModal from './actions/create-task-reminder/TaskModal';
|
|
23
|
+
import ViewReminderModal from '../view-reminder/ViewReminder';
|
|
23
24
|
|
|
24
25
|
function OrderActions() {
|
|
25
26
|
const [currentAction] = useCurrentAction();
|
|
@@ -54,6 +55,8 @@ function OrderActions() {
|
|
|
54
55
|
return <TaskReminderModal />;
|
|
55
56
|
case 'create-task':
|
|
56
57
|
return <TaskModal />;
|
|
58
|
+
case 'view-reminder':
|
|
59
|
+
return <ViewReminderModal />;
|
|
57
60
|
case 'log-feedback':
|
|
58
61
|
return <LogFeedback />;
|
|
59
62
|
case 'unhold-order':
|
|
@@ -258,6 +258,12 @@ export function useUpdateReminderData() {
|
|
|
258
258
|
export function useRouteDetails() {
|
|
259
259
|
return useAtom(routeDetails);
|
|
260
260
|
}
|
|
261
|
+
const allOrderStatus = atom<string | null>(null);
|
|
262
|
+
|
|
263
|
+
export function useAllOrderStatus() {
|
|
264
|
+
return useAtom(allOrderStatus);
|
|
265
|
+
}
|
|
266
|
+
|
|
261
267
|
|
|
262
268
|
export const selectedCategoryIdAtom = atom<any>(null);
|
|
263
269
|
export const selectedDocumentTypeAtom = atom<any>(null);
|