ordering-ui-react-native 0.12.16 → 0.12.20
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/src/config.json +2 -2
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +168 -156
- package/themes/business/src/components/NewOrderNotification/index.tsx +14 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -1
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +88 -123
- package/themes/business/src/components/PreviousOrders/index.tsx +69 -94
- package/themes/business/src/components/PreviousOrders/styles.tsx +0 -7
- package/themes/business/src/components/ProductItemAccordion/index.tsx +25 -27
- package/themes/business/src/components/shared/OIcon.tsx +0 -2
- package/themes/business/src/types/index.tsx +4 -1
- package/themes/doordash/src/components/BusinessProductsCategories/index.tsx +60 -5
- package/themes/doordash/src/components/BusinessProductsList/index.tsx +144 -79
- package/themes/doordash/src/components/BusinessProductsListing/index.tsx +58 -26
- package/themes/doordash/src/components/ForgotPasswordForm/index.tsx +37 -35
- package/themes/doordash/src/components/ForgotPasswordForm/styles.tsx +7 -0
- package/themes/doordash/src/components/Help/index.tsx +1 -1
- package/themes/doordash/src/components/LastOrders/index.tsx +9 -3
- package/themes/doordash/src/components/LastOrders/styles.tsx +1 -1
- package/themes/doordash/src/components/ProductForm/index.tsx +1 -1
- package/themes/doordash/src/types/index.tsx +11 -1
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +128 -83
- package/themes/kiosk/src/components/DrawerView/index.tsx +57 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +30 -0
- package/themes/kiosk/src/components/ProductForm/index.tsx +22 -20
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
|
@@ -69,10 +69,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
69
69
|
filtered,
|
|
70
70
|
onFiltered,
|
|
71
71
|
handleClickOrder,
|
|
72
|
-
|
|
73
|
-
isBusinessApp,
|
|
74
|
-
logisticOrders,
|
|
75
|
-
loadLogisticOrders
|
|
72
|
+
isBusinessApp
|
|
76
73
|
} = props;
|
|
77
74
|
|
|
78
75
|
const defaultSearchList = {
|
|
@@ -127,11 +124,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
127
124
|
zIndex: 100,
|
|
128
125
|
borderColor: theme.colors.textGray,
|
|
129
126
|
},
|
|
130
|
-
icon: {
|
|
131
|
-
paddingBottom: 10,
|
|
132
|
-
zIndex: 100,
|
|
133
|
-
marginBottom: 2,
|
|
134
|
-
},
|
|
135
127
|
tagsContainer: {
|
|
136
128
|
marginBottom: 20,
|
|
137
129
|
},
|
|
@@ -179,7 +171,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
179
171
|
const currentOrdersGroup = ordersGroup[currentTabSelected]
|
|
180
172
|
|
|
181
173
|
const isEqual = (array1: any, array2: any) => {
|
|
182
|
-
return array1
|
|
174
|
+
return array1.every((item: any) => array2.includes(item)) && array2.every((item: any) => array1.includes(item))
|
|
183
175
|
}
|
|
184
176
|
|
|
185
177
|
const handleLoadMore = () => {
|
|
@@ -345,22 +337,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
345
337
|
nestedScrollEnabled={true}
|
|
346
338
|
>
|
|
347
339
|
<TabsContainer width={WIDTH_SCREEN}>
|
|
348
|
-
<Pressable
|
|
349
|
-
style={styles.pressable}
|
|
350
|
-
onPress={() => setCurrentTabSelected('logisticOrders')}>
|
|
351
|
-
<OIcon
|
|
352
|
-
src={theme.images?.general?.chronometer}
|
|
353
|
-
borderBottomWidth={currentTabSelected === 'logisticOrders' ? 1 : 0}
|
|
354
|
-
width={currentTabSelected === 'logisticOrders' ? 26 : 24}
|
|
355
|
-
height={currentTabSelected === 'logisticOrders' ? 26 : 24}
|
|
356
|
-
color={
|
|
357
|
-
currentTabSelected === 'logisticOrders'
|
|
358
|
-
? theme.colors.textGray
|
|
359
|
-
: theme.colors.unselectText
|
|
360
|
-
}
|
|
361
|
-
style={styles.icon}
|
|
362
|
-
/>
|
|
363
|
-
</Pressable>
|
|
364
340
|
{tabs.map((tab: any) => (
|
|
365
341
|
<Pressable
|
|
366
342
|
key={tab.key}
|
|
@@ -387,73 +363,71 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
387
363
|
</ScrollView>
|
|
388
364
|
</FiltersTab>
|
|
389
365
|
<View style={{ flex: 1, minHeight: HEIGHT_SCREEN - 250 }}>
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
>
|
|
399
|
-
{
|
|
400
|
-
<
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
366
|
+
<View
|
|
367
|
+
style={{
|
|
368
|
+
display: 'flex',
|
|
369
|
+
flexDirection: 'row',
|
|
370
|
+
alignContent: 'center',
|
|
371
|
+
alignItems: 'center',
|
|
372
|
+
}}
|
|
373
|
+
>
|
|
374
|
+
{tagsList && tagsList?.length > 1 && (
|
|
375
|
+
<View style={{ marginBottom: 20 }}>
|
|
376
|
+
<Tag
|
|
377
|
+
onPress={() => handleAllSelect()}
|
|
378
|
+
isSelected={
|
|
379
|
+
isEqual(currentOrdersGroup.currentFilter, tagsList)
|
|
380
|
+
? theme.colors.primary
|
|
381
|
+
: theme.colors.tabBar
|
|
382
|
+
}>
|
|
383
|
+
<OText
|
|
384
|
+
style={styles.tag}
|
|
385
|
+
color={
|
|
404
386
|
isEqual(currentOrdersGroup.currentFilter, tagsList)
|
|
405
|
-
? theme.colors.
|
|
406
|
-
: theme.colors.
|
|
387
|
+
? theme.colors.white
|
|
388
|
+
: theme.colors.black
|
|
407
389
|
}>
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
390
|
+
{t('All', 'All')}
|
|
391
|
+
</OText>
|
|
392
|
+
</Tag>
|
|
393
|
+
</View>
|
|
394
|
+
)}
|
|
395
|
+
<ScrollView
|
|
396
|
+
ref={scrollRef}
|
|
397
|
+
showsVerticalScrollIndicator={false}
|
|
398
|
+
showsHorizontalScrollIndicator={false}
|
|
399
|
+
contentContainerStyle={styles.tagsContainer}
|
|
400
|
+
horizontal
|
|
401
|
+
>
|
|
402
|
+
{tagsList && tagsList.map((key: number) => (
|
|
403
|
+
<Tag
|
|
404
|
+
key={key}
|
|
405
|
+
onPress={() => !currentOrdersGroup.loading && handleTagSelected(key)}
|
|
406
|
+
isSelected={
|
|
407
|
+
currentOrdersGroup.currentFilter.includes(key) &&
|
|
408
|
+
!isEqual(currentOrdersGroup.currentFilter, tagsList)
|
|
409
|
+
? theme.colors.primary
|
|
410
|
+
: theme.colors.tabBar
|
|
411
|
+
}>
|
|
412
|
+
<OText
|
|
413
|
+
style={styles.tag}
|
|
414
|
+
color={
|
|
432
415
|
currentOrdersGroup.currentFilter.includes(key) &&
|
|
433
416
|
!isEqual(currentOrdersGroup.currentFilter, tagsList)
|
|
434
|
-
? theme.colors.
|
|
435
|
-
: theme.colors.
|
|
417
|
+
? theme.colors.white
|
|
418
|
+
: theme.colors.black
|
|
436
419
|
}>
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
!isEqual(currentOrdersGroup.currentFilter, tagsList) &&
|
|
449
|
-
' X'
|
|
450
|
-
}
|
|
451
|
-
</OText>
|
|
452
|
-
</Tag>
|
|
453
|
-
))}
|
|
454
|
-
</ScrollView>
|
|
455
|
-
</View>
|
|
456
|
-
)}
|
|
420
|
+
{getOrderStatus(key)}
|
|
421
|
+
{
|
|
422
|
+
currentOrdersGroup.currentFilter.includes(key) &&
|
|
423
|
+
!isEqual(currentOrdersGroup.currentFilter, tagsList) &&
|
|
424
|
+
' X'
|
|
425
|
+
}
|
|
426
|
+
</OText>
|
|
427
|
+
</Tag>
|
|
428
|
+
))}
|
|
429
|
+
</ScrollView>
|
|
430
|
+
</View>
|
|
457
431
|
|
|
458
432
|
<ScrollView
|
|
459
433
|
ref={scrollListRef}
|
|
@@ -463,13 +437,12 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
463
437
|
refreshControl={
|
|
464
438
|
<RefreshControl
|
|
465
439
|
refreshing={refreshing}
|
|
466
|
-
onRefresh={() =>
|
|
440
|
+
onRefresh={() => loadOrders && loadOrders({ newFetch: true })}
|
|
467
441
|
/>
|
|
468
442
|
}
|
|
469
443
|
>
|
|
470
|
-
{!currentOrdersGroup
|
|
471
|
-
currentOrdersGroup
|
|
472
|
-
currentTabSelected !== 'logisticOrders' &&
|
|
444
|
+
{!currentOrdersGroup.error?.length &&
|
|
445
|
+
currentOrdersGroup.orders?.length > 0 &&
|
|
473
446
|
(
|
|
474
447
|
<PreviousOrders
|
|
475
448
|
orders={currentOrdersGroup.orders}
|
|
@@ -478,21 +451,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
478
451
|
handleClickOrder={handleClickOrder}
|
|
479
452
|
/>
|
|
480
453
|
)}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
<PreviousOrders
|
|
485
|
-
orders={logisticOrders.orders}
|
|
486
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
487
|
-
getOrderStatus={getOrderStatus}
|
|
488
|
-
handleClickOrder={handleClickLogisticOrder}
|
|
489
|
-
isLogisticOrder
|
|
490
|
-
/>
|
|
491
|
-
)
|
|
492
|
-
}
|
|
493
|
-
{((currentOrdersGroup?.loading ||
|
|
494
|
-
currentOrdersGroup?.pagination?.total === null) ||
|
|
495
|
-
(logisticOrders?.loading)) &&
|
|
454
|
+
|
|
455
|
+
{(currentOrdersGroup?.loading ||
|
|
456
|
+
currentOrdersGroup?.pagination?.total === null) &&
|
|
496
457
|
(
|
|
497
458
|
<>
|
|
498
459
|
<View>
|
|
@@ -609,21 +570,25 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
609
570
|
search={search}
|
|
610
571
|
onSearch={setSearch}
|
|
611
572
|
/>
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
573
|
+
{isBusinessApp && (
|
|
574
|
+
<>
|
|
575
|
+
<OrdersOptionDelivery
|
|
576
|
+
{...props}
|
|
577
|
+
search={search}
|
|
578
|
+
onSearch={setSearch}
|
|
579
|
+
/>
|
|
580
|
+
<OrdersOptionDriver
|
|
581
|
+
{...props}
|
|
582
|
+
search={search}
|
|
583
|
+
onSearch={setSearch}
|
|
584
|
+
/>
|
|
585
|
+
<OrdersOptionPaymethod
|
|
586
|
+
{...props}
|
|
587
|
+
search={search}
|
|
588
|
+
onSearch={setSearch}
|
|
589
|
+
/>
|
|
590
|
+
</>
|
|
591
|
+
)}
|
|
627
592
|
<OButton
|
|
628
593
|
text={t('SEARCH', 'Search')}
|
|
629
594
|
textStyle={{ color: theme.colors.white }}
|
|
@@ -644,7 +609,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
644
609
|
|
|
645
610
|
export const OrdersOption = (props: OrdersOptionParams) => {
|
|
646
611
|
const [, t] = useLanguage();
|
|
647
|
-
|
|
612
|
+
|
|
648
613
|
const ordersProps = {
|
|
649
614
|
...props,
|
|
650
615
|
UIComponent: OrdersOptionUI,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { StyleSheet, TouchableOpacity
|
|
2
|
+
import { StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
5
|
-
import {
|
|
6
|
-
import { Card, Logo, Information, MyOrderOptions, NotificationIcon
|
|
5
|
+
import { OIcon, OText } from '../shared';
|
|
6
|
+
import { Card, Logo, Information, MyOrderOptions, NotificationIcon } from './styles';
|
|
7
7
|
import EntypoIcon from 'react-native-vector-icons/Entypo'
|
|
8
8
|
|
|
9
9
|
export const PreviousOrders = (props: any) => {
|
|
10
|
-
const { orders, onNavigationRedirect, getOrderStatus, handleClickOrder
|
|
10
|
+
const { orders, onNavigationRedirect, getOrderStatus, handleClickOrder } = props;
|
|
11
11
|
const [, t] = useLanguage();
|
|
12
12
|
const [{ parseDate, optimizeImage }] = useUtils();
|
|
13
13
|
const theme = useTheme();
|
|
@@ -22,7 +22,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
22
22
|
cardButton: {
|
|
23
23
|
flex: 1,
|
|
24
24
|
minHeight: 64,
|
|
25
|
-
marginBottom:
|
|
25
|
+
marginBottom: 30,
|
|
26
26
|
marginLeft: 3,
|
|
27
27
|
},
|
|
28
28
|
icon: {
|
|
@@ -79,98 +79,73 @@ export const PreviousOrders = (props: any) => {
|
|
|
79
79
|
orders
|
|
80
80
|
.filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
|
|
81
81
|
.map((order: any) =>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
)}
|
|
97
|
-
style={styles.icon}
|
|
98
|
-
/>
|
|
99
|
-
</Logo>
|
|
100
|
-
)}
|
|
101
|
-
<Information>
|
|
102
|
-
<OText numberOfLines={1} style={styles.title}>
|
|
103
|
-
{order.business?.name}
|
|
104
|
-
</OText>
|
|
105
|
-
{order?.showNotification && (
|
|
106
|
-
<NotificationIcon>
|
|
107
|
-
<EntypoIcon
|
|
108
|
-
name="dot-single"
|
|
109
|
-
size={32}
|
|
110
|
-
color={theme.colors.primary}
|
|
111
|
-
/>
|
|
112
|
-
</NotificationIcon>
|
|
82
|
+
(
|
|
83
|
+
<React.Fragment key={order.id}>
|
|
84
|
+
<TouchableOpacity
|
|
85
|
+
onPress={() => handlePressOrder(order)}
|
|
86
|
+
style={styles.cardButton}
|
|
87
|
+
activeOpacity={1}
|
|
88
|
+
>
|
|
89
|
+
<Card key={order.id}>
|
|
90
|
+
{!!order.business?.logo && (
|
|
91
|
+
<Logo style={styles.logo}>
|
|
92
|
+
<OIcon
|
|
93
|
+
url={optimizeImage(
|
|
94
|
+
order.business?.logo,
|
|
95
|
+
'h_300,c_limit',
|
|
113
96
|
)}
|
|
114
|
-
|
|
115
|
-
style={styles.date}
|
|
116
|
-
numberOfLines={1}
|
|
117
|
-
adjustsFontSizeToFit
|
|
118
|
-
size={20}>
|
|
119
|
-
{t('INVOICE_ORDER_NO', 'Order No.') + order.id + ' · '}
|
|
120
|
-
{order?.delivery_datetime_utc
|
|
121
|
-
? parseDate(order?.delivery_datetime_utc)
|
|
122
|
-
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
123
|
-
</OText>
|
|
124
|
-
{!isLogisticOrder && (
|
|
125
|
-
<MyOrderOptions>
|
|
126
|
-
<OText
|
|
127
|
-
style={styles.orderType}
|
|
128
|
-
mRight={5}
|
|
129
|
-
numberOfLines={1}
|
|
130
|
-
adjustsFontSizeToFit
|
|
131
|
-
>
|
|
132
|
-
{order.delivery_type === 1
|
|
133
|
-
? t('DELIVERY', 'Delivery')
|
|
134
|
-
: order.delivery_type === 2
|
|
135
|
-
? t('PICKUP', 'Pickup')
|
|
136
|
-
: order.delivery_type === 3
|
|
137
|
-
? t('EAT_IN', 'Eat in')
|
|
138
|
-
: order.delivery_type === 4
|
|
139
|
-
? t('CURBSIDE', 'Curbside')
|
|
140
|
-
: t('DRIVER_THRU', 'Driver thru')}
|
|
141
|
-
{` · ${getOrderStatus(order.status)}`}
|
|
142
|
-
</OText>
|
|
143
|
-
</MyOrderOptions>
|
|
144
|
-
)}
|
|
145
|
-
</Information>
|
|
146
|
-
</Card>
|
|
147
|
-
</TouchableOpacity>
|
|
148
|
-
{isLogisticOrder && (
|
|
149
|
-
<AcceptOrRejectOrder>
|
|
150
|
-
<OButton
|
|
151
|
-
text={t('REJECT', 'Reject')}
|
|
152
|
-
onClick={() => console.log('reject')}
|
|
153
|
-
bgColor={theme.colors.danger}
|
|
154
|
-
borderColor={theme.colors.danger}
|
|
155
|
-
imgRightSrc={null}
|
|
156
|
-
style={{ borderRadius: 7 }}
|
|
157
|
-
parentStyle={{width: '45%'}}
|
|
158
|
-
textStyle={{ color: theme.colors.dangerText }}
|
|
159
|
-
/>
|
|
160
|
-
<OButton
|
|
161
|
-
text={t('ACCEPT', 'Accept')}
|
|
162
|
-
onClick={() => console.log('Accept')}
|
|
163
|
-
bgColor={theme.colors.successOrder}
|
|
164
|
-
borderColor={theme.colors.successOrder}
|
|
165
|
-
imgRightSrc={null}
|
|
166
|
-
style={{ borderRadius: 7 }}
|
|
167
|
-
parentStyle={{width: '45%'}}
|
|
168
|
-
textStyle={{ color: theme.colors.successText }}
|
|
97
|
+
style={styles.icon}
|
|
169
98
|
/>
|
|
170
|
-
</
|
|
99
|
+
</Logo>
|
|
171
100
|
)}
|
|
172
|
-
|
|
173
|
-
|
|
101
|
+
<Information>
|
|
102
|
+
<OText numberOfLines={1} style={styles.title}>
|
|
103
|
+
{order.business?.name}
|
|
104
|
+
</OText>
|
|
105
|
+
{order?.showNotification && (
|
|
106
|
+
<NotificationIcon>
|
|
107
|
+
<EntypoIcon
|
|
108
|
+
name="dot-single"
|
|
109
|
+
size={32}
|
|
110
|
+
color={theme.colors.primary}
|
|
111
|
+
/>
|
|
112
|
+
</NotificationIcon>
|
|
113
|
+
)}
|
|
114
|
+
<OText
|
|
115
|
+
style={styles.date}
|
|
116
|
+
numberOfLines={1}
|
|
117
|
+
adjustsFontSizeToFit
|
|
118
|
+
size={20}>
|
|
119
|
+
{t('INVOICE_ORDER_NO', 'Order No.') + order.id + ' · '}
|
|
120
|
+
{order?.delivery_datetime_utc
|
|
121
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
122
|
+
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
123
|
+
</OText>
|
|
124
|
+
|
|
125
|
+
<MyOrderOptions>
|
|
126
|
+
<OText
|
|
127
|
+
style={styles.orderType}
|
|
128
|
+
mRight={5}
|
|
129
|
+
numberOfLines={1}
|
|
130
|
+
adjustsFontSizeToFit
|
|
131
|
+
>
|
|
132
|
+
{order.delivery_type === 1
|
|
133
|
+
? t('DELIVERY', 'Delivery')
|
|
134
|
+
: order.delivery_type === 2
|
|
135
|
+
? t('PICKUP', 'Pickup')
|
|
136
|
+
: order.delivery_type === 3
|
|
137
|
+
? t('EAT_IN', 'Eat in')
|
|
138
|
+
: order.delivery_type === 4
|
|
139
|
+
? t('CURBSIDE', 'Curbside')
|
|
140
|
+
: t('DRIVER_THRU', 'Driver thru')}
|
|
141
|
+
{` · ${getOrderStatus(order.status)}`}
|
|
142
|
+
</OText>
|
|
143
|
+
</MyOrderOptions>
|
|
144
|
+
</Information>
|
|
145
|
+
</Card>
|
|
146
|
+
</TouchableOpacity>
|
|
147
|
+
</React.Fragment>
|
|
148
|
+
))}
|
|
174
149
|
</>
|
|
175
150
|
);
|
|
176
151
|
};
|
|
@@ -49,7 +49,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
49
49
|
option.suboptions = Object.values(option.suboptions ?? {});
|
|
50
50
|
return option;
|
|
51
51
|
});
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
return {
|
|
54
54
|
...productInfo,
|
|
55
55
|
ingredients,
|
|
@@ -60,13 +60,11 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
60
60
|
return product;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
const parseOptions = typeof productInfo().options === 'string' ? JSON.parse(productInfo().options) : productInfo().options
|
|
64
|
-
|
|
65
63
|
const getProductPrice = (product: any) => {
|
|
66
64
|
let subOptionPrice = 0;
|
|
67
|
-
if (product
|
|
68
|
-
for (const option of product
|
|
69
|
-
for (const suboption of option
|
|
65
|
+
if (product.options.length > 0) {
|
|
66
|
+
for (const option of product.options) {
|
|
67
|
+
for (const suboption of option.suboptions) {
|
|
70
68
|
subOptionPrice += suboption.quantity * suboption.price;
|
|
71
69
|
}
|
|
72
70
|
}
|
|
@@ -100,8 +98,8 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
100
98
|
|
|
101
99
|
useEffect(() => {
|
|
102
100
|
if (
|
|
103
|
-
productInfo
|
|
104
|
-
productInfo
|
|
101
|
+
productInfo().ingredients.length > 0 ||
|
|
102
|
+
productInfo().options.length > 0 ||
|
|
105
103
|
product.comment !== ''
|
|
106
104
|
) {
|
|
107
105
|
setActiveState(true);
|
|
@@ -152,12 +150,12 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
152
150
|
</OText>
|
|
153
151
|
|
|
154
152
|
{(
|
|
155
|
-
productInfo
|
|
156
|
-
productInfo
|
|
153
|
+
productInfo().ingredients.length > 0 ||
|
|
154
|
+
productInfo().options.length > 0 ||
|
|
157
155
|
product.comment
|
|
158
156
|
) && !isClickableEvent && (
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
<MaterialCommunityIcon name="chevron-down" size={12} />
|
|
158
|
+
)}
|
|
161
159
|
</View>
|
|
162
160
|
|
|
163
161
|
<View
|
|
@@ -203,20 +201,20 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
203
201
|
product?.valid_menu &&
|
|
204
202
|
!product?.valid_quantity) ||
|
|
205
203
|
(!product?.valid_menu && isCartProduct && !isCartPending)) && (
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
204
|
+
<OText
|
|
205
|
+
size={24}
|
|
206
|
+
color={theme.colors.red}
|
|
207
|
+
style={{ textAlign: 'center', marginTop: 10 }}>
|
|
208
|
+
{t('NOT_AVAILABLE', 'Not available')}
|
|
209
|
+
</OText>
|
|
210
|
+
)}
|
|
213
211
|
</Accordion>
|
|
214
212
|
|
|
215
213
|
<View style={{ display: isActive ? 'flex' : 'none' }}>
|
|
216
214
|
<Animated.View>
|
|
217
215
|
<AccordionContent>
|
|
218
|
-
{productInfo
|
|
219
|
-
productInfo
|
|
216
|
+
{productInfo().ingredients.length > 0 &&
|
|
217
|
+
productInfo().ingredients.some(
|
|
220
218
|
(ingredient: any) => !ingredient.selected,
|
|
221
219
|
) && (
|
|
222
220
|
<ProductOptionsList>
|
|
@@ -227,7 +225,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
227
225
|
{t('INGREDIENTS', 'Ingredients')}:
|
|
228
226
|
</OText>
|
|
229
227
|
|
|
230
|
-
{productInfo
|
|
228
|
+
{productInfo().ingredients.map(
|
|
231
229
|
(ingredient: any) =>
|
|
232
230
|
!ingredient.selected && (
|
|
233
231
|
<OText
|
|
@@ -242,9 +240,9 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
242
240
|
</ProductOptionsList>
|
|
243
241
|
)}
|
|
244
242
|
|
|
245
|
-
{
|
|
243
|
+
{productInfo().options.length > 0 && (
|
|
246
244
|
<ProductOptionsList>
|
|
247
|
-
{
|
|
245
|
+
{productInfo().options.map((option: any, i: number) => (
|
|
248
246
|
<ProductOption key={option.id + i}>
|
|
249
247
|
<OText
|
|
250
248
|
size={12}
|
|
@@ -265,9 +263,9 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
265
263
|
position:
|
|
266
264
|
suboption.position !== 'whole'
|
|
267
265
|
? t(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
266
|
+
suboption.position.toUpperCase(),
|
|
267
|
+
suboption.position,
|
|
268
|
+
)
|
|
271
269
|
: '',
|
|
272
270
|
price: parsePrice(suboption.price),
|
|
273
271
|
})}
|
|
@@ -20,7 +20,6 @@ interface Props {
|
|
|
20
20
|
cover?: boolean;
|
|
21
21
|
children?: any;
|
|
22
22
|
borderRadius?: number;
|
|
23
|
-
borderBottomWidth?: number
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
const OImage = (props: Props): React.ReactElement => {
|
|
@@ -31,7 +30,6 @@ const OImage = (props: Props): React.ReactElement => {
|
|
|
31
30
|
borderRadius: props.style?.borderRadius,
|
|
32
31
|
overflow: 'hidden',
|
|
33
32
|
marginHorizontal: props.style?.marginHorizontal,
|
|
34
|
-
borderBottomWidth: props.borderBottomWidth
|
|
35
33
|
}}>
|
|
36
34
|
<SImage
|
|
37
35
|
source={
|
|
@@ -341,6 +341,7 @@ export interface OrderDetailsParams {
|
|
|
341
341
|
actions?: actions;
|
|
342
342
|
titleAccept?: textTranslate;
|
|
343
343
|
titleReject?: textTranslate;
|
|
344
|
+
titleNotReady?: textTranslate;
|
|
344
345
|
appTitle?: textTranslate;
|
|
345
346
|
drivers?: any;
|
|
346
347
|
loadingDriver?: boolean;
|
|
@@ -520,6 +521,7 @@ interface actions {
|
|
|
520
521
|
accept: string;
|
|
521
522
|
reject: string;
|
|
522
523
|
failed: string;
|
|
524
|
+
notReady: string;
|
|
523
525
|
}
|
|
524
526
|
|
|
525
527
|
interface textTranslate {
|
|
@@ -531,13 +533,14 @@ export interface AcceptOrRejectOrderParams {
|
|
|
531
533
|
customerCellphone?: string;
|
|
532
534
|
closeModal?: any;
|
|
533
535
|
loading?: boolean;
|
|
534
|
-
action
|
|
536
|
+
action: string;
|
|
535
537
|
orderId?: number;
|
|
536
538
|
handleUpdateOrder?: (status: number, isAccept: any) => {};
|
|
537
539
|
notShowCustomerPhone?: boolean | undefined;
|
|
538
540
|
actions?: actions;
|
|
539
541
|
titleAccept?: textTranslate;
|
|
540
542
|
titleReject?: textTranslate;
|
|
543
|
+
titleNotReady?: textTranslate;
|
|
541
544
|
appTitle?: textTranslate;
|
|
542
545
|
}
|
|
543
546
|
|