@bjsdistribution/dms-client-return 0.1.6-prod → 0.1.7-prod
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/dms-client-return.cjs.development.js +133 -21
- 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 +133 -21
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/order-view/notification/OrderTemplate.tsx +192 -41
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { FlagAlert } from '@bjsdistribution/dms-component-library';
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { useOrderNotify } from '../order-actions/store';
|
|
5
5
|
import { useOrderStaticData } from '../store';
|
|
6
|
+
import { useClientPortal } from '../../store';
|
|
6
7
|
|
|
7
8
|
function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
8
9
|
const [, setOrderCount] = useOrderNotify();
|
|
9
|
-
const precall = false;
|
|
10
|
+
// const precall = false;
|
|
10
11
|
const [orderStaticData] = useOrderStaticData();
|
|
11
12
|
const statusVal = routeInfoData?.status_value;
|
|
12
|
-
|
|
13
|
+
const [isClientPortal] = useClientPortal();
|
|
13
14
|
const unholdReasons = orderStaticData?.cancellation_reasons?.map(
|
|
14
15
|
(x: any) => ({
|
|
15
16
|
id: x?.id,
|
|
@@ -38,13 +39,17 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
38
39
|
isPreCall: true,
|
|
39
40
|
isConfirmed: true,
|
|
40
41
|
isPostcode: true,
|
|
42
|
+
isSubcontracted: true,
|
|
43
|
+
isRouted: true,
|
|
44
|
+
isOnSite: true,
|
|
45
|
+
isFailed: true,
|
|
41
46
|
});
|
|
42
47
|
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}, [precall]);
|
|
48
|
+
// useEffect(() => {
|
|
49
|
+
// if (precall) {
|
|
50
|
+
// setOrderCount(prevCount => prevCount + 1);
|
|
51
|
+
// }
|
|
52
|
+
// }, [precall]);
|
|
48
53
|
|
|
49
54
|
//on close alert functionality
|
|
50
55
|
const onCloseAlert = (alertType: string) => {
|
|
@@ -57,6 +62,28 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
57
62
|
|
|
58
63
|
return (
|
|
59
64
|
<>
|
|
65
|
+
{/* order_red_cross_alerts */}
|
|
66
|
+
{!isClientPortal && routeInfoData?.order_red_cross_alerts?.length > 0 && (
|
|
67
|
+
<FlagAlert
|
|
68
|
+
type="error"
|
|
69
|
+
title=""
|
|
70
|
+
description={
|
|
71
|
+
<FlagsStyle>
|
|
72
|
+
<div className="redCross">
|
|
73
|
+
<div
|
|
74
|
+
className="spanStyle"
|
|
75
|
+
dangerouslySetInnerHTML={{
|
|
76
|
+
__html: routeInfoData?.order_red_cross_alerts,
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
</FlagsStyle>
|
|
81
|
+
}
|
|
82
|
+
showOkButton={false}
|
|
83
|
+
onClose={() => onCloseAlert('isPostcode')}
|
|
84
|
+
/>
|
|
85
|
+
)}
|
|
86
|
+
|
|
60
87
|
{statusVal == 'on hold' && alertVisibility?.isHoldVisible && (
|
|
61
88
|
<StyledAlert>
|
|
62
89
|
<FlagAlert
|
|
@@ -64,7 +91,7 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
64
91
|
title={
|
|
65
92
|
<div
|
|
66
93
|
dangerouslySetInnerHTML={{
|
|
67
|
-
__html: routeInfoData?.
|
|
94
|
+
__html: routeInfoData?.order_info_alerts,
|
|
68
95
|
}}
|
|
69
96
|
></div>
|
|
70
97
|
}
|
|
@@ -81,7 +108,7 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
81
108
|
title={
|
|
82
109
|
<div
|
|
83
110
|
dangerouslySetInnerHTML={{
|
|
84
|
-
__html: routeInfoData?.
|
|
111
|
+
__html: routeInfoData?.order_info_alerts,
|
|
85
112
|
}}
|
|
86
113
|
></div>
|
|
87
114
|
}
|
|
@@ -92,24 +119,6 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
92
119
|
</StyledAlert>
|
|
93
120
|
)}
|
|
94
121
|
|
|
95
|
-
{precall && alertVisibility.isPreCall && (
|
|
96
|
-
<StyledAlert>
|
|
97
|
-
<FlagAlert
|
|
98
|
-
type="success"
|
|
99
|
-
title={
|
|
100
|
-
<div
|
|
101
|
-
dangerouslySetInnerHTML={{
|
|
102
|
-
__html: routeInfoData?.order_alert,
|
|
103
|
-
}}
|
|
104
|
-
></div>
|
|
105
|
-
}
|
|
106
|
-
description={``}
|
|
107
|
-
showOkButton={false}
|
|
108
|
-
onClose={() => onCloseAlert('isPreCall')}
|
|
109
|
-
/>
|
|
110
|
-
</StyledAlert>
|
|
111
|
-
)}
|
|
112
|
-
|
|
113
122
|
{statusVal == 'outstanding' && alertVisibility.isOutstanding && (
|
|
114
123
|
<StyledAlert>
|
|
115
124
|
<FlagAlert
|
|
@@ -117,7 +126,7 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
117
126
|
title={
|
|
118
127
|
<div
|
|
119
128
|
dangerouslySetInnerHTML={{
|
|
120
|
-
__html: routeInfoData?.
|
|
129
|
+
__html: routeInfoData?.order_info_alerts,
|
|
121
130
|
}}
|
|
122
131
|
></div>
|
|
123
132
|
}
|
|
@@ -127,6 +136,7 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
127
136
|
/>
|
|
128
137
|
</StyledAlert>
|
|
129
138
|
)}
|
|
139
|
+
|
|
130
140
|
{statusVal == 'awaiting confirmation' &&
|
|
131
141
|
alertVisibility.isAwaitingConfirmation && (
|
|
132
142
|
<StyledAlert>
|
|
@@ -135,7 +145,7 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
135
145
|
title={
|
|
136
146
|
<div
|
|
137
147
|
dangerouslySetInnerHTML={{
|
|
138
|
-
__html: routeInfoData?.
|
|
148
|
+
__html: routeInfoData?.order_info_alerts,
|
|
139
149
|
}}
|
|
140
150
|
></div>
|
|
141
151
|
}
|
|
@@ -152,7 +162,7 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
152
162
|
title={
|
|
153
163
|
<div
|
|
154
164
|
dangerouslySetInnerHTML={{
|
|
155
|
-
__html: routeInfoData?.
|
|
165
|
+
__html: routeInfoData?.order_info_alerts,
|
|
156
166
|
}}
|
|
157
167
|
></div>
|
|
158
168
|
}
|
|
@@ -165,11 +175,11 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
165
175
|
{statusVal == 'cancelled' && alertVisibility.isCancelled && (
|
|
166
176
|
<StyledAlert>
|
|
167
177
|
<FlagAlert
|
|
168
|
-
type="
|
|
178
|
+
type="info"
|
|
169
179
|
title={
|
|
170
180
|
<div
|
|
171
181
|
dangerouslySetInnerHTML={{
|
|
172
|
-
__html: routeInfoData?.
|
|
182
|
+
__html: routeInfoData?.order_info_alerts,
|
|
173
183
|
}}
|
|
174
184
|
></div>
|
|
175
185
|
}
|
|
@@ -179,6 +189,43 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
179
189
|
/>
|
|
180
190
|
</StyledAlert>
|
|
181
191
|
)}
|
|
192
|
+
|
|
193
|
+
{statusVal == 'confirmed' && alertVisibility.isConfirmed && (
|
|
194
|
+
<StyledAlert>
|
|
195
|
+
<FlagAlert
|
|
196
|
+
type="info"
|
|
197
|
+
title={
|
|
198
|
+
<div
|
|
199
|
+
dangerouslySetInnerHTML={{
|
|
200
|
+
__html: routeInfoData?.order_info_alerts,
|
|
201
|
+
}}
|
|
202
|
+
></div>
|
|
203
|
+
}
|
|
204
|
+
description={``}
|
|
205
|
+
showOkButton={false}
|
|
206
|
+
onClose={() => onCloseAlert('isConfirmed')}
|
|
207
|
+
/>
|
|
208
|
+
</StyledAlert>
|
|
209
|
+
)}
|
|
210
|
+
|
|
211
|
+
{statusVal == 'subcontracted' && alertVisibility.isSubcontracted && (
|
|
212
|
+
<StyledAlert>
|
|
213
|
+
<FlagAlert
|
|
214
|
+
type="info"
|
|
215
|
+
title={
|
|
216
|
+
<div
|
|
217
|
+
dangerouslySetInnerHTML={{
|
|
218
|
+
__html: routeInfoData?.order_info_alerts,
|
|
219
|
+
}}
|
|
220
|
+
></div>
|
|
221
|
+
}
|
|
222
|
+
description={``}
|
|
223
|
+
showOkButton={false}
|
|
224
|
+
onClose={() => onCloseAlert('isRouted')}
|
|
225
|
+
/>
|
|
226
|
+
</StyledAlert>
|
|
227
|
+
)}
|
|
228
|
+
|
|
182
229
|
{statusVal == 'enroute' && alertVisibility.isEnroute && (
|
|
183
230
|
<StyledAlert>
|
|
184
231
|
<FlagAlert
|
|
@@ -186,7 +233,7 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
186
233
|
title={
|
|
187
234
|
<div
|
|
188
235
|
dangerouslySetInnerHTML={{
|
|
189
|
-
__html: routeInfoData?.
|
|
236
|
+
__html: routeInfoData?.order_info_alerts,
|
|
190
237
|
}}
|
|
191
238
|
></div>
|
|
192
239
|
}
|
|
@@ -197,34 +244,89 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
197
244
|
</StyledAlert>
|
|
198
245
|
)}
|
|
199
246
|
|
|
200
|
-
{statusVal == '
|
|
247
|
+
{statusVal == 'routed' && alertVisibility.isRouted && (
|
|
201
248
|
<StyledAlert>
|
|
202
249
|
<FlagAlert
|
|
203
250
|
type="info"
|
|
204
251
|
title={
|
|
205
252
|
<div
|
|
206
253
|
dangerouslySetInnerHTML={{
|
|
207
|
-
__html: routeInfoData?.
|
|
254
|
+
__html: routeInfoData?.order_info_alerts,
|
|
208
255
|
}}
|
|
209
256
|
></div>
|
|
210
257
|
}
|
|
211
258
|
description={``}
|
|
212
259
|
showOkButton={false}
|
|
213
|
-
onClose={() => onCloseAlert('
|
|
260
|
+
onClose={() => onCloseAlert('isRouted')}
|
|
214
261
|
/>
|
|
215
262
|
</StyledAlert>
|
|
216
263
|
)}
|
|
217
264
|
|
|
218
|
-
{
|
|
265
|
+
{statusVal == 'precalled' && alertVisibility.isPreCall && (
|
|
266
|
+
<StyledAlert>
|
|
267
|
+
<FlagAlert
|
|
268
|
+
type="info"
|
|
269
|
+
title={
|
|
270
|
+
<div
|
|
271
|
+
dangerouslySetInnerHTML={{
|
|
272
|
+
__html: routeInfoData?.order_info_alerts,
|
|
273
|
+
}}
|
|
274
|
+
></div>
|
|
275
|
+
}
|
|
276
|
+
description={``}
|
|
277
|
+
showOkButton={false}
|
|
278
|
+
onClose={() => onCloseAlert('isPreCall')}
|
|
279
|
+
/>
|
|
280
|
+
</StyledAlert>
|
|
281
|
+
)}
|
|
282
|
+
|
|
283
|
+
{statusVal == 'on site' && alertVisibility.isOnSite && (
|
|
284
|
+
<StyledAlert>
|
|
285
|
+
<FlagAlert
|
|
286
|
+
type="info"
|
|
287
|
+
title={
|
|
288
|
+
<div
|
|
289
|
+
dangerouslySetInnerHTML={{
|
|
290
|
+
__html: routeInfoData?.order_info_alerts,
|
|
291
|
+
}}
|
|
292
|
+
></div>
|
|
293
|
+
}
|
|
294
|
+
description={``}
|
|
295
|
+
showOkButton={false}
|
|
296
|
+
onClose={() => onCloseAlert('isOnSite')}
|
|
297
|
+
/>
|
|
298
|
+
</StyledAlert>
|
|
299
|
+
)}
|
|
300
|
+
|
|
301
|
+
{statusVal == 'failed' && alertVisibility.isFailed && (
|
|
302
|
+
<StyledAlert>
|
|
303
|
+
<FlagAlert
|
|
304
|
+
type="info"
|
|
305
|
+
title={
|
|
306
|
+
<div
|
|
307
|
+
dangerouslySetInnerHTML={{
|
|
308
|
+
__html: routeInfoData?.order_info_alerts,
|
|
309
|
+
}}
|
|
310
|
+
></div>
|
|
311
|
+
}
|
|
312
|
+
description={``}
|
|
313
|
+
showOkButton={false}
|
|
314
|
+
onClose={() => onCloseAlert('isFailed')}
|
|
315
|
+
/>
|
|
316
|
+
</StyledAlert>
|
|
317
|
+
)}
|
|
318
|
+
|
|
319
|
+
{/* order_warnings_alerts */}
|
|
320
|
+
{!isClientPortal && routeInfoData?.order_warnings_alerts?.length > 0 && (
|
|
219
321
|
<FlagAlert
|
|
220
|
-
type="
|
|
322
|
+
type="warn"
|
|
221
323
|
title=""
|
|
222
324
|
description={
|
|
223
325
|
<FlagsStyle>
|
|
224
|
-
<div className="
|
|
326
|
+
<div className="">
|
|
225
327
|
<div
|
|
226
328
|
dangerouslySetInnerHTML={{
|
|
227
|
-
__html: routeInfoData
|
|
329
|
+
__html: routeInfoData?.order_warnings_alerts,
|
|
228
330
|
}}
|
|
229
331
|
/>
|
|
230
332
|
</div>
|
|
@@ -234,11 +336,58 @@ function OrderTemplate({ orderDetails, routeInfoData }: any) {
|
|
|
234
336
|
onClose={() => onCloseAlert('isPostcode')}
|
|
235
337
|
/>
|
|
236
338
|
)}
|
|
339
|
+
|
|
340
|
+
{/* order_green_check_alerts */}
|
|
341
|
+
{!isClientPortal && routeInfoData?.order_green_check_alerts?.length > 0 && (
|
|
342
|
+
<FlagAlert
|
|
343
|
+
type="success"
|
|
344
|
+
title=""
|
|
345
|
+
description={
|
|
346
|
+
<FlagsStyle>
|
|
347
|
+
<div className="">
|
|
348
|
+
<div
|
|
349
|
+
dangerouslySetInnerHTML={{
|
|
350
|
+
__html: routeInfoData?.order_green_check_alerts,
|
|
351
|
+
}}
|
|
352
|
+
/>
|
|
353
|
+
</div>
|
|
354
|
+
</FlagsStyle>
|
|
355
|
+
}
|
|
356
|
+
showOkButton={false}
|
|
357
|
+
onClose={() => onCloseAlert('isPostcode')}
|
|
358
|
+
/>
|
|
359
|
+
)}
|
|
360
|
+
|
|
361
|
+
{!isClientPortal &&
|
|
362
|
+
routeInfoData?.same_postcode_orders &&
|
|
363
|
+
alertVisibility.isPostcode && (
|
|
364
|
+
<FlagAlert
|
|
365
|
+
type="info"
|
|
366
|
+
title=""
|
|
367
|
+
description={
|
|
368
|
+
<FlagsStyle>
|
|
369
|
+
<div className="postcode-alert-content">
|
|
370
|
+
<div
|
|
371
|
+
dangerouslySetInnerHTML={{
|
|
372
|
+
__html: routeInfoData?.same_postcode_orders,
|
|
373
|
+
}}
|
|
374
|
+
/>
|
|
375
|
+
</div>
|
|
376
|
+
</FlagsStyle>
|
|
377
|
+
}
|
|
378
|
+
showOkButton={false}
|
|
379
|
+
onClose={() => onCloseAlert('isPostcode')}
|
|
380
|
+
/>
|
|
381
|
+
)}
|
|
237
382
|
</>
|
|
238
383
|
);
|
|
239
384
|
}
|
|
240
385
|
|
|
241
386
|
const FlagsStyle = styled.div`
|
|
387
|
+
.redCross {
|
|
388
|
+
font-size: 13px;
|
|
389
|
+
margin-top: 4px;
|
|
390
|
+
}
|
|
242
391
|
.postcode-alert-content {
|
|
243
392
|
> div {
|
|
244
393
|
> h4 {
|
|
@@ -251,6 +400,7 @@ const FlagsStyle = styled.div`
|
|
|
251
400
|
}
|
|
252
401
|
}
|
|
253
402
|
ul {
|
|
403
|
+
margin-bottom: 0;
|
|
254
404
|
}
|
|
255
405
|
|
|
256
406
|
li {
|
|
@@ -268,6 +418,7 @@ const FlagsStyle = styled.div`
|
|
|
268
418
|
> strong {
|
|
269
419
|
> a {
|
|
270
420
|
color: #6396e5;
|
|
421
|
+
|
|
271
422
|
font-family: Roboto;
|
|
272
423
|
font-size: 14px;
|
|
273
424
|
font-style: normal;
|