@bjsdistribution/dms-client-return 0.0.84 → 0.0.86

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 (31) hide show
  1. package/dist/components/order-view/notification/OrderTemplate.d.ts +3 -0
  2. package/dist/components/order-view/order-actions/store.d.ts +1 -0
  3. package/dist/components/order-view/order-details/expanded-content/orders-section/Depot.d.ts +2 -0
  4. package/dist/components/order-view/store.d.ts +1 -0
  5. package/dist/components/order-view/utils.d.ts +1 -0
  6. package/dist/dms-client-return.cjs.development.js +423 -285
  7. package/dist/dms-client-return.cjs.development.js.map +1 -1
  8. package/dist/dms-client-return.cjs.production.min.js +1 -1
  9. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  10. package/dist/dms-client-return.esm.js +424 -286
  11. package/dist/dms-client-return.esm.js.map +1 -1
  12. package/package.json +2 -2
  13. package/src/components/order-view/index.tsx +26 -2
  14. package/src/components/order-view/notification/OrderTemplate.tsx +349 -0
  15. package/src/components/order-view/notification/Tabs.tsx +10 -6
  16. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +6 -63
  17. package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +7 -0
  18. package/src/components/order-view/order-actions/actions/order-lock/index.tsx +13 -1
  19. package/src/components/order-view/order-actions/actions/split-order/index.tsx +15 -20
  20. package/src/components/order-view/order-actions/actions/uncancel-order/UncancelOrder.tsx +4 -3
  21. package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +1 -1
  22. package/src/components/order-view/order-actions/store.ts +6 -0
  23. package/src/components/order-view/order-actions/utils.ts +1 -1
  24. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +6 -0
  25. package/src/components/order-view/order-details/expanded-content/orders-section/Carrier.tsx +1 -1
  26. package/src/components/order-view/order-details/expanded-content/orders-section/Depot.tsx +5 -3
  27. package/src/components/order-view/order-details/expanded-content/orders-section/ScheduleAfter.tsx +2 -1
  28. package/src/components/order-view/order-details/expanded-content/orders-section/VehicleType.tsx +3 -2
  29. package/src/components/order-view/order-details/expanded-content/services-section/DeliveryPoint.tsx +1 -1
  30. package/src/components/order-view/order-details/expanded-content/services-section/TimedService.tsx +1 -1
  31. package/src/components/order-view/store.ts +7 -0
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.84",
2
+ "version": "0.0.86",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -59,7 +59,7 @@
59
59
  "testEnvironment": "jest-environment-jsdom-sixteen"
60
60
  },
61
61
  "devDependencies": {
62
- "@bjsdistribution/dms-component-library": "0.1.58",
62
+ "@bjsdistribution/dms-component-library": "0.1.78",
63
63
  "@size-limit/preset-small-lib": "^11.0.1",
64
64
  "@tippyjs/react": "^4.2.6",
65
65
  "@types/react": "^18.2.47",
@@ -26,6 +26,8 @@ import {
26
26
  useGsitOrderId,
27
27
  useOrderProductId,
28
28
  useLiveRecalling,
29
+ useGlobalStateHitOrder,
30
+ useAtom,
29
31
  } from './store';
30
32
  import { OrdersType } from './types';
31
33
  import { useLocation } from 'react-router-dom';
@@ -36,6 +38,7 @@ import DetailsFilters from './details-filters/DetailsFilters';
36
38
  import { useSubContracterData, useVisibilityData } from '../store';
37
39
  import Notification from './notification';
38
40
  import Order from './order-resources/expanded-content';
41
+ import { setResourcesCall, useAllOrderStatus } from './order-actions/store';
39
42
 
40
43
  interface ApiResponse {
41
44
  message: string;
@@ -71,6 +74,12 @@ function OrderView() {
71
74
  const systemLogsData = useSystemLogs();
72
75
  const [, setVisibilityData] = useVisibilityData();
73
76
  const [, setSubContracterData] = useSubContracterData();
77
+ const [recallOrders] = useGlobalStateHitOrder();
78
+ const [, setStatusVal] = useAllOrderStatus();
79
+
80
+ useEffect(() => {
81
+ setStatusVal(orderDetails?.status_value);
82
+ }, [orderDetails?.status_value]);
74
83
 
75
84
  // query param
76
85
  const location = useLocation();
@@ -167,10 +176,10 @@ function OrderView() {
167
176
  });
168
177
  useEffect(() => {
169
178
  if (orderId) {
170
- orderUpdate(true);
179
+ orderUpdate(recallOrders);
171
180
  liveRecalling ? setLivePerformAction(false) : setLivePerformAction(true);
172
181
  }
173
- }, [orderId, liveRecalling]);
182
+ }, [orderId, liveRecalling, recallOrders]);
174
183
 
175
184
  useEffect(() => {
176
185
  setLoading(staticDataLoading);
@@ -222,6 +231,8 @@ function OrderView() {
222
231
  };
223
232
  }, [statusDataLoading, fetchedStatusData]);
224
233
 
234
+ const [getResources] = useAtom(setResourcesCall);
235
+
225
236
  useEffect(() => {
226
237
  setLoading(depotDataLoading);
227
238
  if (fetchedDepotData && fetchedDepotData.data) {
@@ -255,6 +266,19 @@ function OrderView() {
255
266
  performAction: false,
256
267
  });
257
268
 
269
+ useEffect(() => {
270
+ if (orderId) {
271
+ if (getResources) {
272
+ setActions(false);
273
+ setTimeout(() => {
274
+ setActions(true);
275
+ }, 200);
276
+ } else {
277
+ setActions(true);
278
+ }
279
+ }
280
+ }, [orderId, setActions, getResources]);
281
+
258
282
  useEffect(() => {
259
283
  if (orderId) {
260
284
  setActions(true);
@@ -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.slice(0, 3);
18
- const additionalNotifications = activeNotifications.slice(3);
19
+ const initialNotifications = activeNotifications?.slice(0, 3);
20
+ const additionalNotifications = activeNotifications?.slice(3);
19
21
 
20
- const initialReminders = activeReminders.slice(0, 3);
21
- const additionalReminders = activeReminders.slice(3);
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
- {initialReminders.map((item: any, index: any) => (
31
+ <OrderTemplate orderDetails={orderDetails} />
32
+
33
+ {initialReminders?.map((item: any, index: any) => (
30
34
  <ReminderTemplate
31
35
  key={index}
32
36
  data={item}
@@ -9,6 +9,7 @@ import { useApiHook } from '@bjsdistribution/dms-component-library';
9
9
  import {
10
10
  useCurrentAction,
11
11
  useCustomerInfo,
12
+ useGlobalStateHitOrder,
12
13
  useLiveRecalling,
13
14
  useOrderDetails,
14
15
  useOrderId,
@@ -19,8 +20,7 @@ import {
19
20
  useErrorConfirmOrder,
20
21
  useOrderDetailsConfirmOrder,
21
22
  } from '../../store';
22
- import { ApiResponse, OrdersType } from '../../../types';
23
- import { useLoading } from '../../../../order-daily-overview/store/store';
23
+ import { ApiResponse } from '../../../types';
24
24
  import { notification } from 'antd';
25
25
  import { compareOrderDetailsStates, filterObject } from '../../../utils';
26
26
  import useUpdateOrder from '../../../hooks/useUpdateOrder';
@@ -35,14 +35,14 @@ function ConfirmOrder() {
35
35
  orderDetailsConfirmOrder,
36
36
  setOrderDetailsConfirmOrder,
37
37
  ] = useOrderDetailsConfirmOrder();
38
- const [, setLoading] = useLoading();
39
38
  const [customerInfo] = useCustomerInfo();
40
39
  const infoText = `${customerInfo?.recipient_name}, ${customerInfo?.postcode}`;
41
40
  const [deliveryDate, setDeliveryDate] = useConfirmOrderDate();
42
- const [liveRecalling, setRecalling] = useLiveRecalling();
41
+ const [, setRecalling] = useLiveRecalling();
43
42
  const [orderId] = useOrderId();
44
43
  const [errorState] = useErrorConfirmOrder();
45
44
  const updateOrder = useUpdateOrder();
45
+ const [, setRecallOrders] = useGlobalStateHitOrder();
46
46
 
47
47
  const onClose = () => {
48
48
  setCurrentAction(undefined);
@@ -69,30 +69,6 @@ function ConfirmOrder() {
69
69
  performAction: false,
70
70
  });
71
71
 
72
- const { data: fetchedData, loading, setShouldPerformAction } = useApiHook<{
73
- data: OrdersType[];
74
- }>({
75
- endpoint: `orders/${orderId}`,
76
- method: 'GET',
77
- performAction: false,
78
- });
79
-
80
- useEffect(() => {
81
- setLoading(loading);
82
- if (fetchedData && fetchedData.data) {
83
- const requiredData = fetchedData?.data;
84
- setOrderDetails(requiredData[0]);
85
- setPrevOrderDetails(requiredData[0]);
86
- setCurrentAction(undefined);
87
- }
88
- if (
89
- (fetchedData && fetchedData?.data === null) ||
90
- fetchedData?.data?.length === 0
91
- ) {
92
- setCurrentAction(undefined);
93
- }
94
- }, [loading, liveRecalling]);
95
-
96
72
  useEffect(() => {
97
73
  if (response) {
98
74
  //@ts-ignore
@@ -102,14 +78,11 @@ function ConfirmOrder() {
102
78
  // @ts-ignore
103
79
  description: response?.message || 'Order confirmed successfully',
104
80
  });
105
- setShouldPerformAction(true);
106
81
  setRecalling(true);
107
82
  setTimeout(() => {
108
83
  setRecalling(false);
109
84
  }, 2000);
110
85
  } else {
111
- setShouldPerformAction(false);
112
-
113
86
  notification.error({
114
87
  message: 'Error',
115
88
  description:
@@ -128,6 +101,7 @@ function ConfirmOrder() {
128
101
 
129
102
  const ConfirmOrder = async () => {
130
103
  setRecalling(false);
104
+ setRecallOrders(false);
131
105
 
132
106
  const keysToRemovefromOrders = [
133
107
  'order_locked',
@@ -159,6 +133,7 @@ function ConfirmOrder() {
159
133
  if (response && response?.data?.length > 0) {
160
134
  setOrderDetails(response?.data[0]);
161
135
  setPrevOrderDetails(response?.data[0]);
136
+ setRecallOrders(true);
162
137
  } else {
163
138
  setOrderDetails(prevOrderDetails);
164
139
  }
@@ -172,30 +147,6 @@ function ConfirmOrder() {
172
147
  }
173
148
  };
174
149
 
175
- // const isDifferent = () => {
176
- // const keysToRemovefromOrders = [
177
- // 'order_locked',
178
- // 'order_communications',
179
- // 'updated_at',
180
- // 'updated_by',
181
- // 'order_services',
182
- // ];
183
- // const filteredOrderDetails = filterObject(
184
- // orderDetailsConfirmOrder,
185
- // keysToRemovefromOrders
186
- // );
187
- // const filteredPrevOrderDetails = filterObject(
188
- // prevOrderDetails,
189
- // keysToRemovefromOrders
190
- // );
191
-
192
- // const orderDetailsSorted = JSON.stringify(filteredOrderDetails);
193
- // const prevOrderDetailsSorted = JSON.stringify(filteredPrevOrderDetails);
194
- // const isSame = orderDetailsSorted === prevOrderDetailsSorted;
195
- // // newOrderServicesSorted === prevOrderServicesSorted;
196
- // return !isSame;
197
- // };
198
-
199
150
  const errorFound = () => {
200
151
  const isError =
201
152
  errorState.emailError.length > 0 ||
@@ -217,14 +168,6 @@ function ConfirmOrder() {
217
168
  isSubmitDisabled={errorFound()}
218
169
  >
219
170
  <ContentContainer>
220
- {/* <Alert
221
- description=""
222
- onClose={() => {}}
223
- type="info"
224
- title="There is Orders with identical postcodes that are yet to be delivered.View Orders"
225
- showOkButton={false}
226
- showCloseIcon={false}
227
- /> */}
228
171
  <Wrapper>
229
172
  <CustomerInformation />
230
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',
@@ -4,13 +4,21 @@ import {
4
4
  } from '@bjsdistribution/dms-component-library';
5
5
  import React from 'react';
6
6
  import styled from 'styled-components';
7
- import { useCurrentAction, useOrderDetails } from '../../../store';
7
+ import {
8
+ useCurrentAction,
9
+ useGlobalStateHitAuditLog,
10
+ useGlobalStateHitOrder,
11
+ useOrderDetails,
12
+ } from '../../../store';
8
13
  import useUpdateOrder from '../../../hooks/useUpdateOrder';
9
14
 
10
15
  function OrderLock() {
11
16
  const [, setCurrentAction] = useCurrentAction();
12
17
  const [orderDetails, setOrderdetails] = useOrderDetails();
13
18
  const lockOrder = useUpdateOrder();
19
+ const [, setRecallOrders] = useGlobalStateHitOrder();
20
+ const [, setRecallAuditLog] = useGlobalStateHitAuditLog();
21
+
14
22
  const title =
15
23
  orderDetails?.order_locked === true ? 'Unlocking Order' : 'Locking Order';
16
24
  const action = orderDetails?.order_locked === true ? 'Unlock' : 'Lock';
@@ -20,12 +28,16 @@ function OrderLock() {
20
28
  };
21
29
 
22
30
  const onComplete = async () => {
31
+ setRecallOrders(false);
23
32
  const isLocked =
24
33
  orderDetails?.order_locked === null ? false : orderDetails?.order_locked;
25
34
  const payload = [{ id: orderDetails?.id, order_locked: !isLocked }];
26
35
  const response = await lockOrder(payload);
27
36
  if (response.data) {
28
37
  setOrderdetails(response.data[0]);
38
+ setOrderdetails(response?.data[0]);
39
+ setRecallAuditLog(true);
40
+ setRecallOrders(true);
29
41
  }
30
42
  onClose();
31
43
  };