ordering-ui-react-native 0.23.23 → 0.23.25
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/package.json +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +6 -16
- package/themes/business/src/components/OrderDetails/Business.tsx +10 -3
- package/themes/business/src/components/OrderDetails/Delivery.tsx +14 -6
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +3 -2
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +9 -3
- package/themes/business/src/components/PreviousOrders/index.tsx +63 -62
- package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
- package/themes/original/src/components/MomentOption/index.tsx +33 -45
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +3 -2
- package/themes/original/src/components/OrderDetails/index.tsx +2 -1
- package/themes/original/src/components/OrderProgress/index.tsx +2 -1
package/package.json
CHANGED
|
@@ -156,7 +156,7 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
156
156
|
setCurrentEvent({ evt: 2, orderId: value?.id ?? value?.order_id })
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
if ((!orderStatus.includes(value.status) && evtType !== 1 && isBusinessApp && orderStatus?.length > 0) || value?.author_id === user.id) return
|
|
159
|
+
if ((!orderStatus.includes(value.status) && evtType !== 1 && isBusinessApp && orderStatus?.length > 0) || value?.author_id === user.id) return
|
|
160
160
|
setCurrentEvent({
|
|
161
161
|
evt: evtType,
|
|
162
162
|
orderId: value?.driver
|
|
@@ -178,21 +178,11 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
178
178
|
handleEventNotification(3, o, orderStatus)
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
if (!events?._events?.order_updated_notification || events?._events?.order_updated_notification?.length < 2) {
|
|
188
|
-
events.on('order_updated_notification', handleEventTypeThree)
|
|
189
|
-
}
|
|
190
|
-
if (!events?._events?.request_register_notification || events?._events?.request_register_notification?.length < 2) {
|
|
191
|
-
events.on('request_register_notification', handleEventTypeTwo)
|
|
192
|
-
}
|
|
193
|
-
if (!events?._events?.request_update_notification || events?._events?.request_update_notification?.length < 2) {
|
|
194
|
-
events.on('request_update_notification', handleEventTypeThree)
|
|
195
|
-
}
|
|
181
|
+
events.on('message_added_notification', handleEventTypeOne)
|
|
182
|
+
events.on('order_added_notification', handleEventTypeTwo)
|
|
183
|
+
events.on('order_updated_notification', handleEventTypeThree)
|
|
184
|
+
events.on('request_register_notification', handleEventTypeTwo)
|
|
185
|
+
events.on('request_update_notification', handleEventTypeThree)
|
|
196
186
|
|
|
197
187
|
return () => {
|
|
198
188
|
events.off('message_added_notification', handleEventTypeOne)
|
|
@@ -81,6 +81,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
81
81
|
|
|
82
82
|
const orderToComplete = [4, 20, 21]
|
|
83
83
|
const orderToReady = [7, 14]
|
|
84
|
+
const deliveryTypes = [1, 7]
|
|
84
85
|
|
|
85
86
|
if (order?.status === 7 || order?.status === 4) {
|
|
86
87
|
if (drivers?.length > 0 && drivers) {
|
|
@@ -211,7 +212,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
211
212
|
? t('EAT_IN', 'Eat in')
|
|
212
213
|
: order.delivery_type === 4
|
|
213
214
|
? t('CURBSIDE', 'Curbside')
|
|
214
|
-
:
|
|
215
|
+
: order.delivery_type === 5
|
|
216
|
+
? t('DRIVER_THRU', 'Driver thru')
|
|
217
|
+
: order.delivery_type === 7
|
|
218
|
+
? t('CATERING_DELIVERY', 'Catering delivery')
|
|
219
|
+
: order.delivery_type === 8
|
|
220
|
+
? t('CATERING_PICKUP', 'Catering pickup')
|
|
221
|
+
: t('DELIVERY', 'Delivery')
|
|
215
222
|
}\n`
|
|
216
223
|
: '';
|
|
217
224
|
|
|
@@ -497,7 +504,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
497
504
|
<>
|
|
498
505
|
<OrderContentComponent order={order} />
|
|
499
506
|
{(order?.status === 7 || order?.status === 4) &&
|
|
500
|
-
order?.delivery_type
|
|
507
|
+
deliveryTypes.includes(order?.delivery_type) && configs?.assign_driver_enabled?.value === '1' && (
|
|
501
508
|
<AssignDriver>
|
|
502
509
|
<OText style={{ marginBottom: 5 }} size={16} weight="600">
|
|
503
510
|
{t('ASSIGN_DRIVER', 'Assign driver')}
|
|
@@ -665,7 +672,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
665
672
|
disabled={loading}
|
|
666
673
|
/>
|
|
667
674
|
)}
|
|
668
|
-
{orderToComplete.includes(order?.status) && !
|
|
675
|
+
{orderToComplete.includes(order?.status) && !deliveryTypes.includes(order?.delivery_type) && (
|
|
669
676
|
<FloatingButton
|
|
670
677
|
btnText={t(
|
|
671
678
|
'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
@@ -92,7 +92,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
92
92
|
const pendingOrderStatus = [1, 4, 7, 13]
|
|
93
93
|
|
|
94
94
|
const logisticOrderStatus = [4, 6, 7]
|
|
95
|
-
|
|
95
|
+
|
|
96
|
+
const deliveryTypes = [1, 7]
|
|
97
|
+
|
|
96
98
|
const showFloatButtonsPickUp: any = {
|
|
97
99
|
8: !isHideRejectButtons,
|
|
98
100
|
3: true,
|
|
@@ -233,7 +235,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
233
235
|
? t('EAT_IN', 'Eat in')
|
|
234
236
|
: order.delivery_type === 4
|
|
235
237
|
? t('CURBSIDE', 'Curbside')
|
|
236
|
-
:
|
|
238
|
+
: order.delivery_type === 5
|
|
239
|
+
? t('DRIVER_THRU', 'Driver thru')
|
|
240
|
+
: order.delivery_type === 7
|
|
241
|
+
? t('CATERING_DELIVERY', 'Catering delivery')
|
|
242
|
+
: order.delivery_type === 8
|
|
243
|
+
? t('CATERING_PICKUP', 'Catering pickup')
|
|
244
|
+
: t('DELIVERY', 'Delivery')
|
|
237
245
|
}\n`
|
|
238
246
|
: '';
|
|
239
247
|
|
|
@@ -500,7 +508,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
500
508
|
isOrderGroup={isOrderGroup}
|
|
501
509
|
lastOrder={lastOrder}
|
|
502
510
|
/>
|
|
503
|
-
{(order?.status === 8 || order?.status === 18) && order?.delivery_type
|
|
511
|
+
{(order?.status === 8 || order?.status === 18) && deliveryTypes?.includes(order?.delivery_type) && !props.order?.loading && (
|
|
504
512
|
<Pickup>
|
|
505
513
|
<OButton
|
|
506
514
|
style={styles.btnPickUp}
|
|
@@ -515,7 +523,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
515
523
|
</Pickup>
|
|
516
524
|
)}
|
|
517
525
|
|
|
518
|
-
{(order?.status === 9 || order?.status === 19) && order?.delivery_type
|
|
526
|
+
{(order?.status === 9 || order?.status === 19) && deliveryTypes?.includes(order?.delivery_type) && !props.order?.loading && (
|
|
519
527
|
<View style={{ paddingVertical: 20, marginBottom: 20 }}>
|
|
520
528
|
<OButton
|
|
521
529
|
style={styles.btnPickUp}
|
|
@@ -529,7 +537,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
529
537
|
/>
|
|
530
538
|
</View>
|
|
531
539
|
)}
|
|
532
|
-
{order?.status === 3 && order?.delivery_type
|
|
540
|
+
{order?.status === 3 && deliveryTypes?.includes(order?.delivery_type) && !isHideRejectButtons && isEnabledOrderNotReady && !props.order?.loading && (
|
|
533
541
|
<View style={{ paddingVertical: 20, marginBottom: 20 }}>
|
|
534
542
|
<OButton
|
|
535
543
|
style={styles.btnPickUp}
|
|
@@ -546,7 +554,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
546
554
|
<View
|
|
547
555
|
style={{
|
|
548
556
|
height:
|
|
549
|
-
order?.status === 8 && order?.delivery_type
|
|
557
|
+
order?.status === 8 && deliveryTypes?.includes(order?.delivery_type) ? 50 : 35,
|
|
550
558
|
}}
|
|
551
559
|
/>
|
|
552
560
|
|
|
@@ -68,6 +68,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
68
68
|
})
|
|
69
69
|
|
|
70
70
|
const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
|
|
71
|
+
const deliveryTypes = [1, 7]
|
|
71
72
|
|
|
72
73
|
const walletName: any = {
|
|
73
74
|
cash: {
|
|
@@ -412,9 +413,9 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
412
413
|
{t('ON_BEHALF_OF', 'On behalf of')}{': '} {order?.on_behalf_of}
|
|
413
414
|
</OText>
|
|
414
415
|
)}
|
|
415
|
-
{(order?.delivery_option !== undefined && order?.delivery_type
|
|
416
|
+
{(order?.delivery_option !== undefined && deliveryTypes.includes(order?.delivery_type)) && (
|
|
416
417
|
<View style={{ marginTop: 10 }}>
|
|
417
|
-
{order?.delivery_option !== undefined && order?.delivery_type
|
|
418
|
+
{order?.delivery_option !== undefined && deliveryTypes.includes(order?.delivery_type) && (
|
|
418
419
|
<OText>
|
|
419
420
|
{t(order?.delivery_option?.name?.toUpperCase?.()?.replace(/ /g, '_'), order?.delivery_option?.name)}
|
|
420
421
|
</OText>
|
|
@@ -44,6 +44,7 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
|
|
|
44
44
|
}>({ open: false, content: [], key: null });
|
|
45
45
|
|
|
46
46
|
const logisticOrderStatus = [4, 6, 7]
|
|
47
|
+
const deliveryTypes = [1, 7]
|
|
47
48
|
const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1'
|
|
48
49
|
|
|
49
50
|
const showFloatButtonsAcceptOrReject: any = {
|
|
@@ -99,7 +100,7 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
|
|
|
99
100
|
<View
|
|
100
101
|
style={{
|
|
101
102
|
height:
|
|
102
|
-
order?.status === 8 && order?.delivery_type
|
|
103
|
+
order?.status === 8 && deliveryTypes?.includes(order?.delivery_type) ? 50 : 35,
|
|
103
104
|
}}
|
|
104
105
|
/>
|
|
105
106
|
|
|
@@ -170,7 +171,7 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
|
|
|
170
171
|
secondButton={true}
|
|
171
172
|
firstColorCustom={theme.colors.red}
|
|
172
173
|
secondColorCustom={theme.colors.green}
|
|
173
|
-
widthButton={isHideRejectButtons ? '100%': '45%'}
|
|
174
|
+
widthButton={isHideRejectButtons ? '100%' : '45%'}
|
|
174
175
|
isHideRejectButtons={isHideRejectButtons}
|
|
175
176
|
/>
|
|
176
177
|
)}
|
|
@@ -64,9 +64,9 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
64
64
|
paddingVertical: (isIpad || isTablet) ? 20 : 15,
|
|
65
65
|
marginBottom: IS_PORTRAIT ? 15 : 0,
|
|
66
66
|
marginLeft: 3,
|
|
67
|
-
backgroundColor: order?.time_status === 'delayed'
|
|
67
|
+
backgroundColor: order?.time_status === 'delayed'
|
|
68
68
|
? theme.colors.danger100
|
|
69
|
-
: order?.time_status === 'at_risk'
|
|
69
|
+
: order?.time_status === 'at_risk'
|
|
70
70
|
? theme.colors.warning100
|
|
71
71
|
: theme.colors.primaryContrast
|
|
72
72
|
},
|
|
@@ -278,7 +278,13 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
278
278
|
? t('EAT_IN', 'Eat in')
|
|
279
279
|
: order.delivery_type === 4
|
|
280
280
|
? t('CURBSIDE', 'Curbside')
|
|
281
|
-
:
|
|
281
|
+
: order.delivery_type === 5
|
|
282
|
+
? t('DRIVER_THRU', 'Driver thru')
|
|
283
|
+
: order.delivery_type === 7
|
|
284
|
+
? t('CATERING_DELIVERY', 'Catering delivery')
|
|
285
|
+
: order.delivery_type === 8
|
|
286
|
+
? t('CATERING_PICKUP', 'Catering pickup')
|
|
287
|
+
: t('DELIVERY', 'Delivery')}
|
|
282
288
|
{` · ${getOrderStatus(order.status)}`}
|
|
283
289
|
</OText>
|
|
284
290
|
</MyOrderOptions>
|
|
@@ -43,6 +43,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
43
43
|
|
|
44
44
|
const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
|
|
45
45
|
const viewMapStatus = [9, 18, 19, 23, 26]
|
|
46
|
+
const deliveryTypes = [1, 7]
|
|
46
47
|
const deliveryPickupBtn = props.appTitle?.text?.includes('Delivery') && [3, 8, 18]
|
|
47
48
|
const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23, 26]
|
|
48
49
|
const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1' && !isBusinessApp
|
|
@@ -228,7 +229,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
228
229
|
</View>
|
|
229
230
|
)}
|
|
230
231
|
{(_ordersGrouped[k][0]?.status === 8 || _ordersGrouped[k][0]?.status === 18) &&
|
|
231
|
-
_ordersGrouped[k][0]?.delivery_type
|
|
232
|
+
deliveryTypes?.includes(_ordersGrouped[k][0]?.delivery_type) && !disabledActionsByInternet &&
|
|
232
233
|
(
|
|
233
234
|
<AcceptOrRejectOrderStyle>
|
|
234
235
|
<OButton
|
|
@@ -246,7 +247,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
246
247
|
/>
|
|
247
248
|
</AcceptOrRejectOrderStyle>
|
|
248
249
|
)}
|
|
249
|
-
{_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type
|
|
250
|
+
{_ordersGrouped[k][0]?.status === 3 && deliveryTypes?.includes(_ordersGrouped[k][0]?.delivery_type) && !isHideRejectButtons && isEnabledOrderNotReady &&
|
|
250
251
|
!disabledActionsByInternet &&
|
|
251
252
|
(
|
|
252
253
|
<AcceptOrRejectOrderStyle>
|
|
@@ -338,75 +339,75 @@ export const PreviousOrders = (props: any) => {
|
|
|
338
339
|
/>
|
|
339
340
|
)}
|
|
340
341
|
{!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && isEnabledFailedPickupDriver &&
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
342
|
+
!disabledActionsByInternet && (
|
|
343
|
+
<AcceptOrRejectOrderStyle>
|
|
344
|
+
{!isHideRejectButtons && isEnabledOrderNotReady && (
|
|
345
|
+
<OButton
|
|
346
|
+
text={t('PICKUP_FAILED', 'Pickup failed')}
|
|
347
|
+
bgColor={theme.colors.danger100}
|
|
348
|
+
borderColor={theme.colors.danger100}
|
|
349
|
+
imgRightSrc={null}
|
|
350
|
+
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
351
|
+
parentStyle={{ width: '45%' }}
|
|
352
|
+
textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
|
|
353
|
+
onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
|
|
354
|
+
action: 'pickupFailed',
|
|
355
|
+
order: _ordersGrouped[k][0],
|
|
356
|
+
ids: _ordersGrouped[k].map((o: any) => o.id),
|
|
357
|
+
handleChangeOrderStatus
|
|
358
|
+
})}
|
|
359
|
+
/>
|
|
360
|
+
)}
|
|
344
361
|
<OButton
|
|
345
|
-
text={t('
|
|
346
|
-
bgColor={theme.colors.
|
|
347
|
-
borderColor={theme.colors.
|
|
362
|
+
text={t('PICKUP_COMPLETE', 'Pickup complete')}
|
|
363
|
+
bgColor={theme.colors.success100}
|
|
364
|
+
borderColor={theme.colors.success100}
|
|
348
365
|
imgRightSrc={null}
|
|
349
366
|
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
350
|
-
parentStyle={{ width: '45%' }}
|
|
351
|
-
textStyle={{ color: theme.colors.
|
|
352
|
-
onClick={() =>
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
handleChangeOrderStatus
|
|
357
|
-
})}
|
|
367
|
+
parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
|
|
368
|
+
textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
|
|
369
|
+
onClick={() => handleChangeOrderStatus(
|
|
370
|
+
9,
|
|
371
|
+
_ordersGrouped[k].map((o: any) => o.id),
|
|
372
|
+
)}
|
|
358
373
|
/>
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
text={t('PICKUP_COMPLETE', 'Pickup complete')}
|
|
362
|
-
bgColor={theme.colors.success100}
|
|
363
|
-
borderColor={theme.colors.success100}
|
|
364
|
-
imgRightSrc={null}
|
|
365
|
-
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
366
|
-
parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
|
|
367
|
-
textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
|
|
368
|
-
onClick={() => handleChangeOrderStatus(
|
|
369
|
-
9,
|
|
370
|
-
_ordersGrouped[k].map((o: any) => o.id),
|
|
371
|
-
)}
|
|
372
|
-
/>
|
|
373
|
-
</AcceptOrRejectOrderStyle>
|
|
374
|
-
)}
|
|
374
|
+
</AcceptOrRejectOrderStyle>
|
|
375
|
+
)}
|
|
375
376
|
{!!deliveryStatusCompleteBtn && deliveryStatusCompleteBtn.includes(_ordersGrouped[k][0]?.status) &&
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
377
|
+
!disabledActionsByInternet && (
|
|
378
|
+
<AcceptOrRejectOrderStyle>
|
|
379
|
+
{!isHideRejectButtons && (
|
|
380
|
+
<OButton
|
|
381
|
+
text={t('DELIVERY_FAILED', 'Delivery Failed')}
|
|
382
|
+
bgColor={theme.colors.danger100}
|
|
383
|
+
borderColor={theme.colors.danger100}
|
|
384
|
+
imgRightSrc={null}
|
|
385
|
+
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
386
|
+
parentStyle={{ width: '45%' }}
|
|
387
|
+
textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
|
|
388
|
+
onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
|
|
389
|
+
action: 'deliveryFailed',
|
|
390
|
+
order: _ordersGrouped[k][0],
|
|
391
|
+
ids: _ordersGrouped[k].map((o: any) => o.id),
|
|
392
|
+
handleChangeOrderStatus
|
|
393
|
+
})}
|
|
394
|
+
/>
|
|
395
|
+
)}
|
|
379
396
|
<OButton
|
|
380
|
-
text={t('
|
|
381
|
-
bgColor={theme.colors.
|
|
382
|
-
borderColor={theme.colors.
|
|
397
|
+
text={t('DELIVERY_COMPLETE', 'Delivery complete')}
|
|
398
|
+
bgColor={theme.colors.success100}
|
|
399
|
+
borderColor={theme.colors.success100}
|
|
383
400
|
imgRightSrc={null}
|
|
384
401
|
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
385
|
-
parentStyle={{ width: '45%' }}
|
|
386
|
-
textStyle={{ color: theme.colors.
|
|
387
|
-
onClick={() =>
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
handleChangeOrderStatus
|
|
392
|
-
})}
|
|
402
|
+
parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
|
|
403
|
+
textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
|
|
404
|
+
onClick={() => handleChangeOrderStatus(
|
|
405
|
+
11,
|
|
406
|
+
_ordersGrouped[k].map((o: any) => o.id),
|
|
407
|
+
)}
|
|
393
408
|
/>
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
text={t('DELIVERY_COMPLETE', 'Delivery complete')}
|
|
397
|
-
bgColor={theme.colors.success100}
|
|
398
|
-
borderColor={theme.colors.success100}
|
|
399
|
-
imgRightSrc={null}
|
|
400
|
-
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
401
|
-
parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
|
|
402
|
-
textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
|
|
403
|
-
onClick={() => handleChangeOrderStatus(
|
|
404
|
-
11,
|
|
405
|
-
_ordersGrouped[k].map((o: any) => o.id),
|
|
406
|
-
)}
|
|
407
|
-
/>
|
|
408
|
-
</AcceptOrRejectOrderStyle>
|
|
409
|
-
)}
|
|
409
|
+
</AcceptOrRejectOrderStyle>
|
|
410
|
+
)}
|
|
410
411
|
</OrdersGroupedItem>
|
|
411
412
|
))}
|
|
412
413
|
</View>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Pressable } from 'react-native'
|
|
3
|
+
import {
|
|
4
|
+
TimeItem,
|
|
5
|
+
} from './styles'
|
|
6
|
+
import { OIcon, OText } from '../shared'
|
|
7
|
+
import { useTheme } from 'styled-components/native'
|
|
8
|
+
|
|
9
|
+
const timeListItemPropsAreEqual = (prevProps: any, nextProps: any) => {
|
|
10
|
+
return JSON.stringify(prevProps.time) === JSON.stringify(nextProps.time) &&
|
|
11
|
+
JSON.stringify(prevProps.selectedTime) === JSON.stringify(nextProps.selectedTime) &&
|
|
12
|
+
JSON.stringify(prevProps.cateringPreorder) === JSON.stringify(nextProps.cateringPreorder)
|
|
13
|
+
}
|
|
14
|
+
export const TimeListItem = React.memo((props : any) => {
|
|
15
|
+
const {
|
|
16
|
+
time,
|
|
17
|
+
selectedTime,
|
|
18
|
+
handleChangeTimeSelected,
|
|
19
|
+
cateringPreorder
|
|
20
|
+
} = props
|
|
21
|
+
const theme = useTheme()
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Pressable onPress={() => handleChangeTimeSelected(time.value)}>
|
|
25
|
+
<TimeItem
|
|
26
|
+
active={selectedTime === time.value}
|
|
27
|
+
cateringPreorder={cateringPreorder}
|
|
28
|
+
>
|
|
29
|
+
{cateringPreorder && (
|
|
30
|
+
<>
|
|
31
|
+
{selectedTime === time.value ? (
|
|
32
|
+
<OIcon
|
|
33
|
+
src={theme.images.general.option_checked}
|
|
34
|
+
width={18}
|
|
35
|
+
style={{ marginEnd: 24, bottom: 2 }}
|
|
36
|
+
/>
|
|
37
|
+
) : (
|
|
38
|
+
<OIcon
|
|
39
|
+
src={theme.images.general.option_normal}
|
|
40
|
+
width={18}
|
|
41
|
+
style={{ marginEnd: 24, bottom: 2 }}
|
|
42
|
+
/>
|
|
43
|
+
)}
|
|
44
|
+
</>
|
|
45
|
+
)}
|
|
46
|
+
<OText
|
|
47
|
+
size={cateringPreorder ? 18 : 16}
|
|
48
|
+
color={selectedTime === time.value ? theme.colors.primary : theme.colors.textNormal}
|
|
49
|
+
style={{
|
|
50
|
+
lineHeight: 24
|
|
51
|
+
}}
|
|
52
|
+
>{time.text} {cateringPreorder && `- ${time.endText}`}</OText>
|
|
53
|
+
</TimeItem>
|
|
54
|
+
</Pressable>
|
|
55
|
+
)
|
|
56
|
+
}, timeListItemPropsAreEqual)
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
} from './styles';
|
|
31
31
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
32
32
|
import { monthsEnum, setLocalMoment } from '../../utils';
|
|
33
|
+
import { TimeListItem } from './TimeListItem';
|
|
33
34
|
|
|
34
35
|
const MomentOptionUI = (props: MomentOptionParams) => {
|
|
35
36
|
const {
|
|
@@ -161,6 +162,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
161
162
|
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
162
163
|
const [selectDate, setSelectedDate] = useState<any>(dateSelected)
|
|
163
164
|
const [timeList, setTimeList] = useState<any>(hoursList)
|
|
165
|
+
const [nextTime, setNextTime] = useState(null)
|
|
166
|
+
|
|
164
167
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack();
|
|
165
168
|
|
|
166
169
|
const _handleAsap = () => {
|
|
@@ -256,7 +259,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
256
259
|
setDateWhitelist([{ start: _minDate, end: _maxDate }])
|
|
257
260
|
}
|
|
258
261
|
}
|
|
259
|
-
}, [JSON.stringify(datesList), preorderMinimumDays, preorderMaximumDays
|
|
262
|
+
}, [JSON.stringify(datesList), preorderMinimumDays, preorderMaximumDays])
|
|
260
263
|
|
|
261
264
|
useEffect(() => {
|
|
262
265
|
if (dateSelected) {
|
|
@@ -281,7 +284,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
281
284
|
return
|
|
282
285
|
}
|
|
283
286
|
_timeLists = hoursList
|
|
284
|
-
.filter(hour => (
|
|
287
|
+
.filter(hour => (Object.keys(business || {})?.length === 0 || schedule?.lapses?.some((lapse : any) =>
|
|
285
288
|
moment(dateSelected + ` ${hour.startTime}`) >= moment(dateSelected + ` ${lapse.open.hour}:${lapse.open.minute}`).add(preorderLeadTime, 'minutes') && moment(dateSelected + ` ${hour.endTime}`) <= moment(dateSelected + ` ${lapse.close.hour}:${lapse.close.minute}`))) &&
|
|
286
289
|
moment(dateSelected + ` ${hour.startTime}`) < moment(dateSelected + ` ${hour.endTime}`) &&
|
|
287
290
|
(moment().add(preorderLeadTime, 'minutes') < moment(dateSelected + ` ${hour.startTime}`) || !cateringPreorder))
|
|
@@ -321,12 +324,29 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
321
324
|
}
|
|
322
325
|
}))
|
|
323
326
|
}
|
|
324
|
-
}, [dateSelected,
|
|
327
|
+
}, [dateSelected, hoursList, JSON.stringify(datesWhitelist), JSON.stringify(business)])
|
|
325
328
|
|
|
326
329
|
useEffect(() => {
|
|
327
330
|
setLocalMoment(moment, t)
|
|
328
331
|
}, [])
|
|
329
332
|
|
|
333
|
+
useEffect(() => {
|
|
334
|
+
if (preorderMinimumDays === 0 && preorderLeadTime === 0) return
|
|
335
|
+
const isToday = dateSelected === moment().format('YYYY-MM-DD')
|
|
336
|
+
if (isCart && isToday && !orderState?.loading && timeList?.length > 0) {
|
|
337
|
+
setNextTime(timeList?.[0] ?? null)
|
|
338
|
+
}
|
|
339
|
+
}, [timeList?.length])
|
|
340
|
+
|
|
341
|
+
useEffect(() => {
|
|
342
|
+
if (nextTime?.value && timeList?.length > 0 && isCart && !orderState?.loading && !(preorderMinimumDays === 0 && preorderLeadTime === 0)) {
|
|
343
|
+
const notime = timeList?.filter((_ : any, i : number) => i !== 0)?.find?.((time : any) => time?.value === timeSelected)
|
|
344
|
+
if (!notime) {
|
|
345
|
+
handleChangeTime(nextTime?.value)
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}, [nextTime?.value])
|
|
349
|
+
|
|
330
350
|
return (
|
|
331
351
|
<>
|
|
332
352
|
<Container
|
|
@@ -399,26 +419,18 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
399
419
|
{selectDate && datesWhitelist[0]?.start !== null && (
|
|
400
420
|
<CalendarStrip
|
|
401
421
|
scrollable
|
|
402
|
-
style={styles.calendar}
|
|
403
|
-
calendarHeaderContainerStyle={styles.calendarHeaderContainer}
|
|
404
|
-
calendarHeaderStyle={styles.calendarHeader}
|
|
405
|
-
dateNumberStyle={styles.dateNumber}
|
|
406
|
-
dateNameStyle={styles.dateName}
|
|
407
|
-
iconContainer={{ flex: 0.1 }}
|
|
408
|
-
highlightDateNameStyle={styles.highlightDateName}
|
|
409
|
-
highlightDateNumberStyle={styles.highlightDateNumber}
|
|
410
|
-
dayContainerStyle={{ height: '100%' }}
|
|
411
|
-
highlightDateContainerStyle={{ height: '100%' }}
|
|
412
422
|
calendarHeaderFormat='MMMM, YYYY'
|
|
413
423
|
iconStyle={{ borderWidth: 1 }}
|
|
414
424
|
selectedDate={dateSelected}
|
|
415
425
|
datesWhitelist={datesWhitelist}
|
|
426
|
+
highlightDateNumberStyle={styles.highlightDateNumber}
|
|
427
|
+
highlightDateNameStyle={styles.highlightDateName}
|
|
416
428
|
minDate={moment()}
|
|
417
429
|
maxDate={cateringPreorder ? moment().add(preorderMaximumDays, 'days') : undefined}
|
|
418
430
|
disabledDateNameStyle={styles.disabledDateName}
|
|
419
431
|
disabledDateNumberStyle={styles.disabledDateNumber}
|
|
420
432
|
disabledDateOpacity={0.6}
|
|
421
|
-
onDateSelected={(date) => onSelectDate(date)}
|
|
433
|
+
onDateSelected={(date : any) => onSelectDate(date)}
|
|
422
434
|
leftSelector={<LeftSelector />}
|
|
423
435
|
rightSelector={<RightSelector />}
|
|
424
436
|
/>
|
|
@@ -428,37 +440,13 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
428
440
|
<TimeListWrapper nestedScrollEnabled={true} cateringPreorder={cateringPreorder}>
|
|
429
441
|
<TimeContentWrapper>
|
|
430
442
|
{timeList.map((time: any, i: number) => (
|
|
431
|
-
<
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
{selectedTime === time.value ? (
|
|
439
|
-
<OIcon
|
|
440
|
-
src={theme.images.general.option_checked}
|
|
441
|
-
width={18}
|
|
442
|
-
style={{ marginEnd: 24, bottom: 2 }}
|
|
443
|
-
/>
|
|
444
|
-
) : (
|
|
445
|
-
<OIcon
|
|
446
|
-
src={theme.images.general.option_normal}
|
|
447
|
-
width={18}
|
|
448
|
-
style={{ marginEnd: 24, bottom: 2 }}
|
|
449
|
-
/>
|
|
450
|
-
)}
|
|
451
|
-
</>
|
|
452
|
-
)}
|
|
453
|
-
<OText
|
|
454
|
-
size={cateringPreorder ? 18 : 16}
|
|
455
|
-
color={selectedTime === time.value ? theme.colors.primary : theme.colors.textNormal}
|
|
456
|
-
style={{
|
|
457
|
-
lineHeight: 24
|
|
458
|
-
}}
|
|
459
|
-
>{time.text} {cateringPreorder && `- ${time.endText}`}</OText>
|
|
460
|
-
</TimeItem>
|
|
461
|
-
</Pressable>
|
|
443
|
+
<TimeListItem
|
|
444
|
+
key={i}
|
|
445
|
+
time={time}
|
|
446
|
+
selectedTime={selectedTime}
|
|
447
|
+
handleChangeTimeSelected={handleChangeTimeSelected}
|
|
448
|
+
cateringPreorder={cateringPreorder}
|
|
449
|
+
/>
|
|
462
450
|
))}
|
|
463
451
|
{timeList.length % 3 === 2 && (
|
|
464
452
|
<TimeItem style={{ backgroundColor: 'transparent' }} />
|
|
@@ -10,13 +10,14 @@ export const OrderEta = (props: any) => {
|
|
|
10
10
|
|
|
11
11
|
const [{ parseDate }] = useUtils()
|
|
12
12
|
const [estimatedDeliveryTime, setEstimatedDeliveryTime] = useState(null)
|
|
13
|
-
|
|
13
|
+
const deliveryTypes = [1, 7]
|
|
14
|
+
|
|
14
15
|
const getEstimatedDeliveryTime = () => {
|
|
15
16
|
let estimatedUtcTime = null
|
|
16
17
|
let totalEta = 0
|
|
17
18
|
if (order?.delivered_in) totalEta += order?.delivered_in
|
|
18
19
|
if (order?.prepared_in) totalEta += order?.prepared_in
|
|
19
|
-
if (order?.delivery_type
|
|
20
|
+
if (deliveryTypes?.includes?.(order?.delivery_type) && order?.eta_drive_time) {
|
|
20
21
|
totalEta += order?.eta_drive_time
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -135,6 +135,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
135
135
|
const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26]
|
|
136
136
|
const reorderStatus = [1, 2, 5, 6, 10, 11, 12]
|
|
137
137
|
const cateringTypes = [7, 8]
|
|
138
|
+
const deliveryTypes = [1, 7]
|
|
138
139
|
const [isPickup, setIsPickup] = useState(order?.delivery_type === 2)
|
|
139
140
|
const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
|
|
140
141
|
const isGiftCardOrder = !order?.business_id
|
|
@@ -723,7 +724,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
723
724
|
)}
|
|
724
725
|
</InfoBlock>
|
|
725
726
|
</Customer>
|
|
726
|
-
{!isGiftCardOrder && order?.delivery_option !== undefined && order?.delivery_type
|
|
727
|
+
{!isGiftCardOrder && order?.delivery_option !== undefined && deliveryTypes?.includes?.(order?.delivery_type) && (
|
|
727
728
|
<View style={{ marginTop: 15 }}>
|
|
728
729
|
<OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
729
730
|
{t('DELIVERY_PREFERENCE', 'Delivery Preference')}
|
|
@@ -42,6 +42,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
42
42
|
const imageFails = theme.images.general.emptyActiveOrders
|
|
43
43
|
const [initialLoaded, setInitialLoaded] = useState(false)
|
|
44
44
|
const statusToShow = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26]
|
|
45
|
+
const deliveryTypes = [1, 7]
|
|
45
46
|
|
|
46
47
|
const styles = StyleSheet.create({
|
|
47
48
|
main: {
|
|
@@ -172,7 +173,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
172
173
|
<ProgressTextWrapper>
|
|
173
174
|
<OText size={12} style={{ width: '50%' }}>{progressBarObjt(lastOrder.status)?.value}</OText>
|
|
174
175
|
<TimeWrapper>
|
|
175
|
-
<OText size={11}>{lastOrder?.delivery_type
|
|
176
|
+
<OText size={11}>{deliveryTypes?.includes?.(lastOrder?.delivery_type) ? t('ESTIMATED_DELIVERY', 'Estimated delivery') : t('ESTIMATED_TIME', 'Estimated time')}</OText>
|
|
176
177
|
<OText size={11}>
|
|
177
178
|
{lastOrder?.delivery_datetime_utc
|
|
178
179
|
? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: configs?.general_hour_format?.value || 'HH:mm' })
|