ordering-ui-react-native 0.11.24 → 0.11.28
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/components/BusinessTypeFilter/index.tsx +155 -105
- package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -2
- package/themes/business/src/components/OrdersOption/index.tsx +4 -4
- package/themes/business/src/types/index.tsx +6 -0
- package/themes/doordash/src/components/BusinessTypeFilter/index.tsx +152 -84
- package/themes/doordash/src/components/BusinessTypeFilter/styles.tsx +1 -2
- package/themes/kiosk/src/components/BusinessMenu/index.tsx +5 -6
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +6 -14
- package/themes/kiosk/src/components/Cart/index.tsx +75 -60
- package/themes/kiosk/src/components/Cart/styles.tsx +19 -1
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +5 -2
- package/themes/kiosk/src/components/CartItem/index.tsx +144 -57
- package/themes/kiosk/src/components/CartItem/styles.tsx +24 -0
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +9 -18
- package/themes/kiosk/src/components/LoginForm/index.tsx +1 -8
- package/themes/kiosk/src/components/OrderDetails/index.tsx +132 -82
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +22 -1
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +2 -1
- package/themes/kiosk/src/components/ProductForm/index.tsx +7 -2
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/styles.tsx +2 -2
- package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +56 -52
- package/themes/kiosk/src/components/ProductOptionSubOption/styles.tsx +10 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +41 -38
- package/themes/kiosk/src/components/shared/OCard.tsx +1 -1
- package/themes/kiosk/src/components/shared/OInput.tsx +4 -0
- package/themes/kiosk/src/types/index.d.ts +3 -0
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +118 -44
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +4 -4
- package/themes/original/src/components/BusinessesListing/index.tsx +3 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +122 -0
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +7 -0
- package/themes/original/src/types/index.tsx +4 -0
- package/themes/uber-eats/src/components/BusinessTypeFilter/index.tsx +151 -76
- package/themes/uber-eats/src/components/BusinessTypeFilter/styles.tsx +0 -9
|
@@ -48,7 +48,7 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
48
48
|
height: VISIBLE_CART_BOTTOM_SHEET_HEIGHT,
|
|
49
49
|
visible: bottomSheetVisibility,
|
|
50
50
|
},
|
|
51
|
-
showNotFound: false
|
|
51
|
+
showNotFound: false
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
const goToBack = () => navigation.goBack()
|
|
@@ -72,7 +72,7 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
72
72
|
}}
|
|
73
73
|
>
|
|
74
74
|
<Container nopadding nestedScrollEnabled>
|
|
75
|
-
<View style={{
|
|
75
|
+
<View style={{ paddingTop: 20 }}>
|
|
76
76
|
<NavBar
|
|
77
77
|
title={t('MENU', 'Menu')}
|
|
78
78
|
onActionLeft={goToBack}
|
|
@@ -104,17 +104,16 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
104
104
|
</Container>
|
|
105
105
|
</View>
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
(<View
|
|
107
|
+
<View
|
|
109
108
|
style={{
|
|
110
109
|
flex: bottomSheetVisibility && orientationState?.orientation === PORTRAIT ? 0 : 0.8,
|
|
110
|
+
display: bottomSheetVisibility ? 'flex' : 'none'
|
|
111
111
|
}}
|
|
112
112
|
>
|
|
113
113
|
<CartContent
|
|
114
114
|
{...cartProps}
|
|
115
115
|
/>
|
|
116
|
-
</View>
|
|
117
|
-
}
|
|
116
|
+
</View>
|
|
118
117
|
</View>
|
|
119
118
|
);
|
|
120
119
|
};
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import { View, StyleSheet } from 'react-native'
|
|
3
|
-
import {
|
|
4
|
-
BusinessAndProductList,
|
|
5
|
-
useLanguage,
|
|
6
|
-
useOrder,
|
|
7
|
-
useSession,
|
|
8
|
-
useConfig,
|
|
9
|
-
useApi
|
|
10
|
-
} from 'ordering-components/native'
|
|
3
|
+
import { BusinessAndProductList, useLanguage } from 'ordering-components/native'
|
|
11
4
|
import Carousel from 'react-native-snap-carousel';
|
|
12
5
|
import { BusinessProductsListingParams, Business, Product } from '../../types'
|
|
13
|
-
import { OCard, OText } from '../shared'
|
|
6
|
+
import { OCard, OText, OIcon } from '../shared'
|
|
14
7
|
import GridContainer from '../../layouts/GridContainer'
|
|
15
8
|
import PromoCard from '../PromoCard';
|
|
16
9
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
17
10
|
import { LANDSCAPE, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
|
|
18
11
|
import { useTheme } from 'styled-components/native';
|
|
19
|
-
import { OIcon } from '../shared';
|
|
20
12
|
|
|
21
13
|
const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
22
14
|
const {navigation, businessState} = props;
|
|
@@ -40,8 +32,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
40
32
|
});
|
|
41
33
|
|
|
42
34
|
const _renderTitle = (title: string): React.ReactElement => (
|
|
43
|
-
<View style={{paddingHorizontal: 20, paddingVertical:
|
|
44
|
-
<OText size={orientationState?.dimensions?.width * 0.
|
|
35
|
+
<View style={{paddingHorizontal: 20, paddingVertical: 15 }}>
|
|
36
|
+
<OText size={orientationState?.dimensions?.width * 0.022} weight="bold">
|
|
45
37
|
{title}
|
|
46
38
|
</OText>
|
|
47
39
|
</View>
|
|
@@ -69,7 +61,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
69
61
|
|
|
70
62
|
const _renderPromos = (): React.ReactElement => (
|
|
71
63
|
<>
|
|
72
|
-
{_renderTitle(t('
|
|
64
|
+
{_renderTitle(t('FEATURED', 'Featured'))}
|
|
73
65
|
<Carousel
|
|
74
66
|
keyExtractor={(item: any) => item.id}
|
|
75
67
|
ref={(c: any) => {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useValidationFields,
|
|
11
11
|
} from 'ordering-components/native';
|
|
12
12
|
|
|
13
|
-
import { CheckoutAction,
|
|
13
|
+
import { CheckoutAction, OrderTypeWrapper, FloatingLayout } from './styles';
|
|
14
14
|
|
|
15
15
|
import { OSBill, OSCoupon, OSTable } from '../OrderSummary/styles';
|
|
16
16
|
|
|
@@ -22,8 +22,8 @@ import CartItem from '../CartItem';
|
|
|
22
22
|
import NavBar from '../NavBar';
|
|
23
23
|
import { CouponControl } from '../CouponControl';
|
|
24
24
|
import { LANDSCAPE, PORTRAIT, useDeviceOrientation} from "../../../../../src/hooks/DeviceOrientation";
|
|
25
|
-
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
26
25
|
import { useCartBottomSheet } from '../../providers/CartBottomSheetProvider';
|
|
26
|
+
import { Container } from '../../../../../src/layouts/Container';
|
|
27
27
|
|
|
28
28
|
const CartUI = (props: any) => {
|
|
29
29
|
const {
|
|
@@ -91,16 +91,8 @@ const CartUI = (props: any) => {
|
|
|
91
91
|
const goToBack = () => navigation.goBack();
|
|
92
92
|
|
|
93
93
|
return (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
97
|
-
>
|
|
98
|
-
<SafeAreaView style={{
|
|
99
|
-
flex: 1,
|
|
100
|
-
padding: 20,
|
|
101
|
-
backgroundColor: '#fff',
|
|
102
|
-
}}>
|
|
103
|
-
|
|
94
|
+
<>
|
|
95
|
+
<Container>
|
|
104
96
|
<NavBar
|
|
105
97
|
title={t('CONFIRM_YOUR_ORDER', 'Confirm your order')}
|
|
106
98
|
onActionLeft={goToBack}
|
|
@@ -141,29 +133,50 @@ const CartUI = (props: any) => {
|
|
|
141
133
|
/>
|
|
142
134
|
</OrderTypeWrapper>
|
|
143
135
|
|
|
144
|
-
<ScrollView
|
|
145
|
-
{
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
isCartPending={isCartPending}
|
|
149
|
-
isCartProduct
|
|
150
|
-
product={product}
|
|
151
|
-
changeQuantity={changeQuantity}
|
|
152
|
-
getProductMax={getProductMax}
|
|
153
|
-
offsetDisabled={offsetDisabled}
|
|
154
|
-
onDeleteProduct={handleDeleteClick}
|
|
155
|
-
onEditProduct={handleEditProduct}
|
|
156
|
-
/>
|
|
157
|
-
))}
|
|
158
|
-
</ScrollView>
|
|
159
|
-
|
|
160
|
-
<Actions
|
|
136
|
+
<ScrollView
|
|
137
|
+
nestedScrollEnabled={true}
|
|
138
|
+
showsVerticalScrollIndicator={false}
|
|
139
|
+
showsHorizontalScrollIndicator={false}
|
|
161
140
|
style={{
|
|
162
|
-
|
|
141
|
+
minHeight: orientationState?.dimensions?.height * 0.5,
|
|
142
|
+
maxHeight: orientationState?.dimensions?.height * 0.5,
|
|
163
143
|
}}
|
|
164
144
|
>
|
|
145
|
+
<View
|
|
146
|
+
style={{
|
|
147
|
+
display: 'flex',
|
|
148
|
+
flexDirection: 'column',
|
|
149
|
+
width: '100%',
|
|
150
|
+
opacity: 1
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
{cart?.products?.length > 0 && cart?.products.map((product: any) => (
|
|
154
|
+
<CartItem
|
|
155
|
+
isCartProduct
|
|
156
|
+
key={product.code}
|
|
157
|
+
product={product}
|
|
158
|
+
isCartPending={isCartPending}
|
|
159
|
+
changeQuantity={changeQuantity}
|
|
160
|
+
getProductMax={getProductMax}
|
|
161
|
+
offsetDisabled={offsetDisabled}
|
|
162
|
+
onDeleteProduct={handleDeleteClick}
|
|
163
|
+
onEditProduct={handleEditProduct}
|
|
164
|
+
/>
|
|
165
|
+
))}
|
|
166
|
+
</View>
|
|
167
|
+
</ScrollView>
|
|
168
|
+
|
|
169
|
+
<View style={{ marginTop: 10 }}>
|
|
165
170
|
{cart?.valid_products && (
|
|
166
171
|
<OSBill>
|
|
172
|
+
<OSTable>
|
|
173
|
+
<OText>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
174
|
+
<OText>
|
|
175
|
+
{cart.business.tax_type === 1
|
|
176
|
+
? parsePrice((cart?.subtotal + cart?.tax) || 0)
|
|
177
|
+
: parsePrice(cart?.subtotal || 0)}
|
|
178
|
+
</OText>
|
|
179
|
+
</OSTable>
|
|
167
180
|
{cart?.discount > 0 && cart?.total >= 0 && orientationState?.orientation == PORTRAIT && (
|
|
168
181
|
<OSTable
|
|
169
182
|
style={{
|
|
@@ -260,19 +273,21 @@ const CartUI = (props: any) => {
|
|
|
260
273
|
</OSCoupon>
|
|
261
274
|
</OSTable>
|
|
262
275
|
)}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
{/* </OText>*/}
|
|
272
|
-
{/* </OSTable>*/}
|
|
273
|
-
{/*</OSTotal>*/}
|
|
276
|
+
<OSTable>
|
|
277
|
+
<OText weight='bold'>
|
|
278
|
+
{t('TOTAL', 'Total')}
|
|
279
|
+
</OText>
|
|
280
|
+
<OText weight='bold' color={theme.colors.primary}>
|
|
281
|
+
{cart?.total >= 1 && parsePrice(cart?.total)}
|
|
282
|
+
</OText>
|
|
283
|
+
</OSTable>
|
|
274
284
|
</OSBill>
|
|
275
285
|
)}
|
|
286
|
+
</View>
|
|
287
|
+
</Container>
|
|
288
|
+
|
|
289
|
+
<>
|
|
290
|
+
<FloatingLayout isIos={Platform.OS === 'ios'}>
|
|
276
291
|
<CheckoutAction>
|
|
277
292
|
<View style={{display: 'flex', flexDirection: 'row'}}>
|
|
278
293
|
{cart?.discount > 0 && cart?.total >= 0 && orientationState?.orientation == LANDSCAPE && (
|
|
@@ -337,7 +352,7 @@ const CartUI = (props: any) => {
|
|
|
337
352
|
}}>
|
|
338
353
|
<OButton
|
|
339
354
|
text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
|
|
340
|
-
`${t('
|
|
355
|
+
`${t('CONFIRM_THIS_ORDER', 'Confirm this order')}`
|
|
341
356
|
) : !cart?.valid_address ? (
|
|
342
357
|
`${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
|
|
343
358
|
) : (
|
|
@@ -354,27 +369,27 @@ const CartUI = (props: any) => {
|
|
|
354
369
|
</View>
|
|
355
370
|
</View>
|
|
356
371
|
</CheckoutAction>
|
|
357
|
-
</
|
|
372
|
+
</FloatingLayout>
|
|
373
|
+
</>
|
|
358
374
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
375
|
+
<OModal
|
|
376
|
+
open={openProduct}
|
|
377
|
+
entireModal
|
|
378
|
+
customClose
|
|
379
|
+
onClose={() => setModalIsOpen(false)}
|
|
380
|
+
>
|
|
381
|
+
<ProductForm
|
|
382
|
+
productCart={curProduct}
|
|
383
|
+
businessSlug={cart?.business?.slug}
|
|
384
|
+
businessId={curProduct?.business_id}
|
|
385
|
+
categoryId={curProduct?.category_id}
|
|
386
|
+
productId={curProduct?.id}
|
|
387
|
+
onSave={handlerProductAction}
|
|
363
388
|
onClose={() => setModalIsOpen(false)}
|
|
364
|
-
|
|
365
|
-
<ProductForm
|
|
366
|
-
productCart={curProduct}
|
|
367
|
-
businessSlug={cart?.business?.slug}
|
|
368
|
-
businessId={curProduct?.business_id}
|
|
369
|
-
categoryId={curProduct?.category_id}
|
|
370
|
-
productId={curProduct?.id}
|
|
371
|
-
onSave={handlerProductAction}
|
|
372
|
-
onClose={() => setModalIsOpen(false)}
|
|
373
|
-
/>
|
|
389
|
+
/>
|
|
374
390
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
</KeyboardView>
|
|
391
|
+
</OModal>
|
|
392
|
+
</>
|
|
378
393
|
)
|
|
379
394
|
}
|
|
380
395
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
1
|
+
import styled, { css } from 'styled-components/native';
|
|
2
2
|
|
|
3
3
|
export const CContainer = styled.View`
|
|
4
4
|
padding: 0 20px;
|
|
@@ -50,3 +50,21 @@ export const OrderTypeWrapper = styled.View`
|
|
|
50
50
|
border-bottom-width: 1px;
|
|
51
51
|
margin-bottom: 30px;
|
|
52
52
|
`;
|
|
53
|
+
|
|
54
|
+
export const FloatingLayout = styled.View`
|
|
55
|
+
position: absolute;
|
|
56
|
+
flex: 1;
|
|
57
|
+
bottom: 0px;
|
|
58
|
+
left: 0;
|
|
59
|
+
padding: 10px;
|
|
60
|
+
width: 100%;
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
background-color: #FFF;
|
|
65
|
+
z-index: 1000;
|
|
66
|
+
|
|
67
|
+
${((props: any) => props.isIos && css`
|
|
68
|
+
padding-bottom: 20px;
|
|
69
|
+
`)}
|
|
70
|
+
`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState} from 'react';
|
|
1
|
+
import React, { useEffect, useState} from 'react';
|
|
2
2
|
import { View, TouchableOpacity } from 'react-native';
|
|
3
3
|
import {
|
|
4
4
|
Cart as CartController,
|
|
@@ -45,7 +45,7 @@ const CartBottomSheetUI = (props: CartBottomSheetUIProps): React.ReactElement |
|
|
|
45
45
|
const [curProduct, setCurProduct] = useState<any>(null)
|
|
46
46
|
const [openUpselling, setOpenUpselling] = useState(false)
|
|
47
47
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
48
|
-
const [, {
|
|
48
|
+
const [, {hideCartBottomSheet }] = useCartBottomSheet();
|
|
49
49
|
|
|
50
50
|
const selectedOrderType = orderState?.options?.type;
|
|
51
51
|
|
|
@@ -53,6 +53,9 @@ const CartBottomSheetUI = (props: CartBottomSheetUIProps): React.ReactElement |
|
|
|
53
53
|
|
|
54
54
|
const handleDeleteClick = (product: any) => {
|
|
55
55
|
removeProduct(product, cart)
|
|
56
|
+
if(cart?.products?.length === 1){
|
|
57
|
+
hideCartBottomSheet()
|
|
58
|
+
}
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
const handleEditProduct = (product: any) => {
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, Animated, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
StyledCartItem,
|
|
7
|
+
AccordionContent,
|
|
8
|
+
ProductOptionsList,
|
|
9
|
+
ProductOption,
|
|
10
|
+
ProductSubOption,
|
|
11
|
+
ProductComment
|
|
12
|
+
} from './styles';
|
|
6
13
|
import { OButton, OImage, OText } from '../shared';
|
|
7
14
|
import { Product } from '../../types';
|
|
8
15
|
import QuantityControl from '../QuantityControl';
|
|
@@ -15,6 +22,8 @@ const CartItem = (props: CartItemProps) => {
|
|
|
15
22
|
const [orientationState] = useDeviceOrientation();
|
|
16
23
|
const [{ parsePrice }] = useUtils();
|
|
17
24
|
|
|
25
|
+
const [isActive, setActiveState] = useState(false);
|
|
26
|
+
|
|
18
27
|
const {
|
|
19
28
|
isCartPending,
|
|
20
29
|
isCartProduct,
|
|
@@ -26,66 +35,144 @@ const CartItem = (props: CartItemProps) => {
|
|
|
26
35
|
isFromCheckout,
|
|
27
36
|
} = props
|
|
28
37
|
|
|
38
|
+
const productInfo = () => {
|
|
39
|
+
if (isCartProduct) {
|
|
40
|
+
const ingredients = JSON.parse(JSON.stringify(Object.values(product?.ingredients ?? {})))
|
|
41
|
+
let options = JSON.parse(JSON.stringify(Object.values(product?.options ?? {})))
|
|
42
|
+
|
|
43
|
+
options = options.map((option: any) => {
|
|
44
|
+
option.suboptions = Object.values(option.suboptions ?? {})
|
|
45
|
+
return option
|
|
46
|
+
})
|
|
47
|
+
return {
|
|
48
|
+
...productInfo,
|
|
49
|
+
ingredients,
|
|
50
|
+
options
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return product
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const getFormattedSubOptionName = ({ quantity, name, position, price }: { quantity: number, name: string, position: string, price: number }) => {
|
|
57
|
+
const pos = position ? `(${position})` : ''
|
|
58
|
+
return `${quantity} x ${name} ${pos} +${price}`
|
|
59
|
+
}
|
|
60
|
+
|
|
29
61
|
return (
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
62
|
+
<>
|
|
63
|
+
<TouchableOpacity
|
|
64
|
+
onPress={() => (!product?.valid_menu && isCartProduct)
|
|
65
|
+
? {}
|
|
66
|
+
: setActiveState(!isActive)}
|
|
67
|
+
activeOpacity={1}
|
|
68
|
+
>
|
|
69
|
+
<StyledCartItem>
|
|
70
|
+
<View style={{ flexDirection: 'row' }}>
|
|
71
|
+
<OImage
|
|
72
|
+
source={{ uri: product?.images || '' }}
|
|
73
|
+
height={60}
|
|
74
|
+
width={60}
|
|
75
|
+
resizeMode="cover"
|
|
76
|
+
borderRadius={6}
|
|
77
|
+
/>
|
|
39
78
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
79
|
+
<View style={{ flexDirection: 'column', justifyContent: 'space-evenly', marginHorizontal: 15, marginTop: 10 }}>
|
|
80
|
+
<View>
|
|
81
|
+
<OText
|
|
82
|
+
style={{
|
|
83
|
+
maxWidth: orientationState?.orientation === LANDSCAPE
|
|
84
|
+
? orientationState.dimensions.width * 0.2
|
|
85
|
+
: orientationState.dimensions.width * 0.5
|
|
86
|
+
}}
|
|
87
|
+
numberOfLines={2}
|
|
88
|
+
size={18}
|
|
89
|
+
weight="700"
|
|
90
|
+
>
|
|
91
|
+
{product?.name || ''}
|
|
92
|
+
</OText>
|
|
93
|
+
</View>
|
|
53
94
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
95
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}>
|
|
96
|
+
<OButton
|
|
97
|
+
bgColor="transparent"
|
|
98
|
+
borderColor="transparent"
|
|
99
|
+
imgLeftSrc={theme.images.general.edit}
|
|
100
|
+
text={t('EDIT', 'Edit')}
|
|
101
|
+
style={{ justifyContent: 'flex-start', paddingLeft: 0, maxWidth: 80 }}
|
|
102
|
+
textStyle={{
|
|
103
|
+
color: theme.colors.primary,
|
|
104
|
+
marginLeft: 6,
|
|
105
|
+
}}
|
|
106
|
+
onClick={() => { onEditProduct ? onEditProduct(product) : null }}
|
|
107
|
+
/>
|
|
108
|
+
</View>
|
|
109
|
+
</View>
|
|
110
|
+
</View>
|
|
111
|
+
|
|
112
|
+
<View style={{ alignItems: "flex-end" }} >
|
|
113
|
+
<OText
|
|
114
|
+
size={18}
|
|
115
|
+
weight="700"
|
|
116
|
+
color={theme.colors.primary}
|
|
117
|
+
>
|
|
118
|
+
{parsePrice(product?.total || product?.price)}
|
|
119
|
+
</OText>
|
|
68
120
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
121
|
+
<QuantityControl
|
|
122
|
+
val={product?.quantity || 0}
|
|
123
|
+
onDecremet={(product?.quantity || 0 > 1)
|
|
124
|
+
? (() => { changeQuantity && changeQuantity(product, (product?.quantity || 0) - 1) })
|
|
125
|
+
: undefined
|
|
126
|
+
}
|
|
127
|
+
onIncrement={changeQuantity && (() => { changeQuantity(product, (product?.quantity || 0) + 1) })}
|
|
128
|
+
onDelete={onDeleteProduct && (() => { onDeleteProduct(product) })}
|
|
129
|
+
/>
|
|
130
|
+
</View>
|
|
131
|
+
</StyledCartItem>
|
|
132
|
+
</TouchableOpacity>
|
|
77
133
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
134
|
+
<View style={{ display: isActive ? 'flex' : 'none' }}>
|
|
135
|
+
<Animated.View>
|
|
136
|
+
<AccordionContent>
|
|
137
|
+
{productInfo()?.ingredients.length > 0 && productInfo()?.ingredients.some((ingredient: any) => !ingredient.selected) && (
|
|
138
|
+
<ProductOptionsList>
|
|
139
|
+
<OText>{t('INGREDIENTS', 'Ingredients')}</OText>
|
|
140
|
+
{productInfo()?.ingredients.map((ingredient: any) => !ingredient.selected && (
|
|
141
|
+
<OText key={ingredient.id} style={{ marginLeft: 10 }}>{t('NO', 'No')} {ingredient.name}</OText>
|
|
142
|
+
))}
|
|
143
|
+
</ProductOptionsList>
|
|
144
|
+
)}
|
|
145
|
+
{productInfo()?.options.length > 0 && (
|
|
146
|
+
<ProductOptionsList>
|
|
147
|
+
{productInfo()?.options.map((option: any, i: number) => (
|
|
148
|
+
<ProductOption key={option.id + i}>
|
|
149
|
+
<OText>{option.name}</OText>
|
|
150
|
+
{option.suboptions.map((suboption: any) => (
|
|
151
|
+
<ProductSubOption key={suboption.id}>
|
|
152
|
+
<OText>
|
|
153
|
+
{getFormattedSubOptionName({
|
|
154
|
+
quantity: suboption.quantity,
|
|
155
|
+
name: suboption.name,
|
|
156
|
+
position: (suboption.position !== 'whole') ? t(suboption.position.toUpperCase(), suboption.position) : '',
|
|
157
|
+
price: parsePrice(suboption.price)
|
|
158
|
+
})}
|
|
159
|
+
</OText>
|
|
160
|
+
</ProductSubOption>
|
|
161
|
+
))}
|
|
162
|
+
</ProductOption>
|
|
163
|
+
))}
|
|
164
|
+
</ProductOptionsList>
|
|
165
|
+
)}
|
|
166
|
+
{product && product?.comment && (
|
|
167
|
+
<ProductComment>
|
|
168
|
+
<OText>{t('SPECIAL_COMMENT', 'Special Comment')}</OText>
|
|
169
|
+
<OText>{product.comment}</OText>
|
|
170
|
+
</ProductComment>
|
|
171
|
+
)}
|
|
172
|
+
</AccordionContent>
|
|
173
|
+
</Animated.View>
|
|
87
174
|
</View>
|
|
88
|
-
|
|
175
|
+
</>
|
|
89
176
|
);
|
|
90
177
|
}
|
|
91
178
|
|
|
@@ -7,3 +7,27 @@ export const StyledCartItem = styled.View`
|
|
|
7
7
|
justify-content: space-between;
|
|
8
8
|
margin-bottom: 14px;
|
|
9
9
|
`
|
|
10
|
+
|
|
11
|
+
export const AccordionContent = styled.View`
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
align-items: flex-start;
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
export const ProductOptionsList = styled.View`
|
|
17
|
+
margin-left: 20px;
|
|
18
|
+
margin-bottom: 10px;
|
|
19
|
+
align-items: flex-start;
|
|
20
|
+
`
|
|
21
|
+
|
|
22
|
+
export const ProductOption = styled.View`
|
|
23
|
+
align-items: flex-start;
|
|
24
|
+
`
|
|
25
|
+
|
|
26
|
+
export const ProductSubOption = styled.View`
|
|
27
|
+
align-items: flex-start;
|
|
28
|
+
margin-left: 10px;
|
|
29
|
+
`
|
|
30
|
+
|
|
31
|
+
export const ProductComment = styled.View`
|
|
32
|
+
align-items: flex-start;
|
|
33
|
+
`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { Platform, View } from 'react-native';
|
|
3
3
|
import { useLanguage, useOrder, useUtils } from 'ordering-components/native';
|
|
4
4
|
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
@@ -66,6 +66,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
66
66
|
visible: bottomSheetVisibility,
|
|
67
67
|
},
|
|
68
68
|
showNotFound: false,
|
|
69
|
+
showCartBottomSheet,
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
const onToggleCart = () => {
|
|
@@ -87,7 +88,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
87
88
|
}}
|
|
88
89
|
>
|
|
89
90
|
<Container nopadding nestedScrollEnabled>
|
|
90
|
-
<View style={{
|
|
91
|
+
<View style={{ paddingTop: 20 }}>
|
|
91
92
|
<NavBar
|
|
92
93
|
title={t('CATEGORY', 'Category')}
|
|
93
94
|
onActionLeft={goToBack}
|
|
@@ -114,21 +115,12 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
114
115
|
items={categories.map((category) => ({
|
|
115
116
|
text: category.name
|
|
116
117
|
}))}
|
|
117
|
-
selectedIdx={curIndexCateg}
|
|
118
|
+
selectedIdx={curIndexCateg}
|
|
118
119
|
onSelectItem={onChangeTabs}
|
|
119
120
|
/>
|
|
120
121
|
</View>
|
|
121
|
-
|
|
122
|
-
<View style={{ paddingHorizontal: 20, paddingVertical: 8 }}>
|
|
123
|
-
<OText
|
|
124
|
-
size={orientationState?.dimensions?.width * 0.048}
|
|
125
|
-
weight="bold"
|
|
126
|
-
>
|
|
127
|
-
{categories[curIndexCateg].name}
|
|
128
|
-
</OText>
|
|
129
|
-
</View>
|
|
130
122
|
|
|
131
|
-
<GridContainer>
|
|
123
|
+
<GridContainer style={{ marginTop: 20 }}>
|
|
132
124
|
{categories[curIndexCateg].products.map((product) => (
|
|
133
125
|
<OCard
|
|
134
126
|
key={product.id}
|
|
@@ -137,7 +129,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
137
129
|
style={{
|
|
138
130
|
width: orientationState?.orientation === LANDSCAPE
|
|
139
131
|
? orientationState?.dimensions?.width * 0.16
|
|
140
|
-
: orientationState?.dimensions?.width * 0.21
|
|
132
|
+
: orientationState?.dimensions?.width * 0.21
|
|
141
133
|
}}
|
|
142
134
|
titleStyle={{marginTop: Platform.OS === 'ios' ? 10 : 0}}
|
|
143
135
|
onPress={() => {
|
|
@@ -156,17 +148,16 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
156
148
|
</Container>
|
|
157
149
|
</View>
|
|
158
150
|
|
|
159
|
-
|
|
160
|
-
(<View
|
|
151
|
+
<View
|
|
161
152
|
style={{
|
|
162
153
|
flex: bottomSheetVisibility && orientationState?.orientation === PORTRAIT ? 0 : 0.8,
|
|
154
|
+
display: bottomSheetVisibility ? 'flex' : 'none'
|
|
163
155
|
}}
|
|
164
156
|
>
|
|
165
157
|
<CartContent
|
|
166
158
|
{...cartProps}
|
|
167
159
|
/>
|
|
168
|
-
</View>
|
|
169
|
-
}
|
|
160
|
+
</View>
|
|
170
161
|
</View>
|
|
171
162
|
);
|
|
172
163
|
};
|