ordering-ui-react-native 0.12.57 → 0.12.58
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/single-business/src/components/Cart/index.tsx +91 -15
- package/themes/single-business/src/components/Cart/styles.tsx +39 -0
- package/themes/single-business/src/components/CartContent/index.tsx +56 -52
- package/themes/single-business/src/components/CartContent/styles.tsx +2 -16
- package/themes/franchises/index.tsx +0 -111
- package/themes/franchises/src/components/ActiveOrders/index.tsx +0 -134
- package/themes/franchises/src/components/ActiveOrders/styles.tsx +0 -44
- package/themes/franchises/src/components/AddressDetails/index.tsx +0 -77
- package/themes/franchises/src/components/AddressDetails/styles.tsx +0 -21
- package/themes/franchises/src/components/AddressForm/index.tsx +0 -837
- package/themes/franchises/src/components/AddressForm/styles.tsx +0 -27
- package/themes/franchises/src/components/AddressList/index.tsx +0 -338
- package/themes/franchises/src/components/AddressList/styles.tsx +0 -20
- package/themes/franchises/src/components/AppleLogin/index.tsx +0 -149
- package/themes/franchises/src/components/AppleLogin/styles.tsx +0 -21
- package/themes/franchises/src/components/BottomWrapper/index.tsx +0 -29
- package/themes/franchises/src/components/BusinessBasicInformation/index.tsx +0 -310
- package/themes/franchises/src/components/BusinessBasicInformation/styles.tsx +0 -66
- package/themes/franchises/src/components/BusinessController/index.tsx +0 -184
- package/themes/franchises/src/components/BusinessController/styles.tsx +0 -64
- package/themes/franchises/src/components/BusinessFeaturedController/index.tsx +0 -189
- package/themes/franchises/src/components/BusinessFeaturedController/styles.tsx +0 -50
- package/themes/franchises/src/components/BusinessInformation/index.tsx +0 -202
- package/themes/franchises/src/components/BusinessInformation/styles.tsx +0 -39
- package/themes/franchises/src/components/BusinessItemAccordion/index.tsx +0 -125
- package/themes/franchises/src/components/BusinessItemAccordion/styles.tsx +0 -54
- package/themes/franchises/src/components/BusinessProductsCategories/index.tsx +0 -87
- package/themes/franchises/src/components/BusinessProductsCategories/styles.tsx +0 -8
- package/themes/franchises/src/components/BusinessProductsList/index.tsx +0 -199
- package/themes/franchises/src/components/BusinessProductsList/styles.tsx +0 -14
- package/themes/franchises/src/components/BusinessProductsListing/index.tsx +0 -292
- package/themes/franchises/src/components/BusinessProductsListing/styles.tsx +0 -30
- package/themes/franchises/src/components/BusinessReviews/index.tsx +0 -249
- package/themes/franchises/src/components/BusinessReviews/styles.tsx +0 -59
- package/themes/franchises/src/components/BusinessTypeFilter/index.tsx +0 -127
- package/themes/franchises/src/components/BusinessTypeFilter/styles.tsx +0 -40
- package/themes/franchises/src/components/BusinessesListing/index.tsx +0 -339
- package/themes/franchises/src/components/BusinessesListing/styles.tsx +0 -92
- package/themes/franchises/src/components/Cart/index.tsx +0 -332
- package/themes/franchises/src/components/Cart/styles.tsx +0 -28
- package/themes/franchises/src/components/CartContent/index.tsx +0 -60
- package/themes/franchises/src/components/CartContent/styles.tsx +0 -19
- package/themes/franchises/src/components/Checkout/index.tsx +0 -664
- package/themes/franchises/src/components/Checkout/styles.tsx +0 -89
- package/themes/franchises/src/components/CouponControl/index.tsx +0 -119
- package/themes/franchises/src/components/CouponControl/styles.tsx +0 -22
- package/themes/franchises/src/components/DriverTips/index.tsx +0 -167
- package/themes/franchises/src/components/DriverTips/styles.tsx +0 -63
- package/themes/franchises/src/components/FacebookLogin/index.tsx +0 -107
- package/themes/franchises/src/components/FacebookLogin/styles.tsx +0 -21
- package/themes/franchises/src/components/FloatingButton/index.tsx +0 -100
- package/themes/franchises/src/components/FloatingButton/styles.tsx +0 -26
- package/themes/franchises/src/components/ForgotPasswordForm/index.tsx +0 -156
- package/themes/franchises/src/components/ForgotPasswordForm/styles.tsx +0 -11
- package/themes/franchises/src/components/GPSButton/index.tsx +0 -84
- package/themes/franchises/src/components/GPSButton/styles.ts +0 -6
- package/themes/franchises/src/components/GoogleLogin/index.tsx +0 -122
- package/themes/franchises/src/components/GoogleLogin/styles.tsx +0 -23
- package/themes/franchises/src/components/GoogleMap/index.tsx +0 -229
- package/themes/franchises/src/components/Help/index.tsx +0 -56
- package/themes/franchises/src/components/Help/styles.tsx +0 -11
- package/themes/franchises/src/components/HelpAccountAndPayment/index.tsx +0 -68
- package/themes/franchises/src/components/HelpAccountAndPayment/styles.tsx +0 -6
- package/themes/franchises/src/components/HelpGuide/index.tsx +0 -67
- package/themes/franchises/src/components/HelpGuide/styles.tsx +0 -6
- package/themes/franchises/src/components/HelpOrder/index.tsx +0 -79
- package/themes/franchises/src/components/HelpOrder/styles.tsx +0 -6
- package/themes/franchises/src/components/Home/index.tsx +0 -102
- package/themes/franchises/src/components/Home/styles.tsx +0 -18
- package/themes/franchises/src/components/LanguageSelector/index.tsx +0 -98
- package/themes/franchises/src/components/LanguageSelector/styles.tsx +0 -7
- package/themes/franchises/src/components/LastOrder/index.tsx +0 -168
- package/themes/franchises/src/components/LastOrder/styles.tsx +0 -16
- package/themes/franchises/src/components/LastOrders/index.tsx +0 -104
- package/themes/franchises/src/components/LastOrders/styles.tsx +0 -17
- package/themes/franchises/src/components/LoginForm/index.tsx +0 -512
- package/themes/franchises/src/components/LoginForm/styles.tsx +0 -77
- package/themes/franchises/src/components/LogoutButton/index.tsx +0 -36
- package/themes/franchises/src/components/Messages/index.tsx +0 -359
- package/themes/franchises/src/components/Messages/styles.tsx +0 -20
- package/themes/franchises/src/components/MomentOption/index.tsx +0 -321
- package/themes/franchises/src/components/MomentOption/styles.tsx +0 -66
- package/themes/franchises/src/components/NavBar/index.tsx +0 -129
- package/themes/franchises/src/components/NotFoundSource/index.tsx +0 -50
- package/themes/franchises/src/components/NotFoundSource/styles.tsx +0 -16
- package/themes/franchises/src/components/Notifications/index.tsx +0 -120
- package/themes/franchises/src/components/Notifications/styles.ts +0 -21
- package/themes/franchises/src/components/OrderDetails/index.tsx +0 -828
- package/themes/franchises/src/components/OrderDetails/styles.tsx +0 -120
- package/themes/franchises/src/components/OrderSummary/index.tsx +0 -266
- package/themes/franchises/src/components/OrderSummary/styles.tsx +0 -41
- package/themes/franchises/src/components/OrderTypeSelector/index.tsx +0 -92
- package/themes/franchises/src/components/OrderTypeSelector/styles.tsx +0 -27
- package/themes/franchises/src/components/OrdersOption/index.tsx +0 -243
- package/themes/franchises/src/components/OrdersOption/styles.tsx +0 -5
- package/themes/franchises/src/components/PaymentOptionCash/index.tsx +0 -102
- package/themes/franchises/src/components/PaymentOptionCash/styles.tsx +0 -18
- package/themes/franchises/src/components/PaymentOptionStripe/index.tsx +0 -234
- package/themes/franchises/src/components/PaymentOptionStripe/styles.tsx +0 -71
- package/themes/franchises/src/components/PaymentOptions/index.tsx +0 -430
- package/themes/franchises/src/components/PaymentOptions/styles.tsx +0 -77
- package/themes/franchises/src/components/PhoneInputNumber/index.tsx +0 -127
- package/themes/franchises/src/components/PhoneInputNumber/styles.tsx +0 -3
- package/themes/franchises/src/components/PreviousOrders/index.tsx +0 -188
- package/themes/franchises/src/components/PreviousOrders/styles.tsx +0 -33
- package/themes/franchises/src/components/ProductForm/index.tsx +0 -695
- package/themes/franchises/src/components/ProductForm/styles.tsx +0 -78
- package/themes/franchises/src/components/ProductIngredient/index.tsx +0 -43
- package/themes/franchises/src/components/ProductIngredient/styles.tsx +0 -7
- package/themes/franchises/src/components/ProductItemAccordion/index.tsx +0 -276
- package/themes/franchises/src/components/ProductItemAccordion/styles.tsx +0 -57
- package/themes/franchises/src/components/ProductOption/index.tsx +0 -50
- package/themes/franchises/src/components/ProductOption/styles.tsx +0 -11
- package/themes/franchises/src/components/ProductOptionSubOption/index.tsx +0 -146
- package/themes/franchises/src/components/ProductOptionSubOption/styles.tsx +0 -32
- package/themes/franchises/src/components/ReviewDriver/index.tsx +0 -221
- package/themes/franchises/src/components/ReviewDriver/styles.tsx +0 -46
- package/themes/franchises/src/components/ReviewOrder/index.tsx +0 -325
- package/themes/franchises/src/components/ReviewOrder/styles.tsx +0 -46
- package/themes/franchises/src/components/ReviewProduct/index.tsx +0 -275
- package/themes/franchises/src/components/ReviewProduct/styles.tsx +0 -53
- package/themes/franchises/src/components/SearchBar/index.tsx +0 -139
- package/themes/franchises/src/components/SignupForm/index.tsx +0 -643
- package/themes/franchises/src/components/SignupForm/styles.tsx +0 -27
- package/themes/franchises/src/components/SingleProductCard/index.tsx +0 -124
- package/themes/franchises/src/components/SingleProductCard/styles.tsx +0 -23
- package/themes/franchises/src/components/StripeCardForm/index.tsx +0 -97
- package/themes/franchises/src/components/StripeCardForm/naked.tsx +0 -128
- package/themes/franchises/src/components/StripeCardForm/styles.tsx +0 -32
- package/themes/franchises/src/components/StripeCardsList/index.tsx +0 -182
- package/themes/franchises/src/components/StripeElementsForm/index.tsx +0 -204
- package/themes/franchises/src/components/StripeElementsForm/naked.tsx +0 -90
- package/themes/franchises/src/components/StripeElementsForm/styles.tsx +0 -13
- package/themes/franchises/src/components/StripeRedirectForm/index.tsx +0 -159
- package/themes/franchises/src/components/StripeRedirectForm/styles.tsx +0 -23
- package/themes/franchises/src/components/TagSelector/index.tsx +0 -94
- package/themes/franchises/src/components/TagSelector/styles.ts +0 -0
- package/themes/franchises/src/components/TaxInformation/index.tsx +0 -51
- package/themes/franchises/src/components/TaxInformation/styles.tsx +0 -9
- package/themes/franchises/src/components/UpsellingProducts/index.tsx +0 -222
- package/themes/franchises/src/components/UpsellingProducts/styles.tsx +0 -50
- package/themes/franchises/src/components/UserDetails/index.tsx +0 -134
- package/themes/franchises/src/components/UserDetails/styles.tsx +0 -26
- package/themes/franchises/src/components/UserFormDetails/index.tsx +0 -351
- package/themes/franchises/src/components/UserFormDetails/styles.tsx +0 -35
- package/themes/franchises/src/components/UserProfile/index.tsx +0 -179
- package/themes/franchises/src/components/UserProfile/styles.ts +0 -42
- package/themes/franchises/src/components/UserProfileForm/index.tsx +0 -253
- package/themes/franchises/src/components/UserProfileForm/styles.tsx +0 -29
- package/themes/franchises/src/components/VerifyPhone/index.tsx +0 -188
- package/themes/franchises/src/components/VerifyPhone/styles.tsx +0 -43
- package/themes/franchises/src/components/shared/OAlert.tsx +0 -55
- package/themes/franchises/src/components/shared/OBottomPopup.tsx +0 -73
- package/themes/franchises/src/components/shared/OBottomStickBar.tsx +0 -62
- package/themes/franchises/src/components/shared/OButton.tsx +0 -132
- package/themes/franchises/src/components/shared/ODropDown.tsx +0 -169
- package/themes/franchises/src/components/shared/OIcon.tsx +0 -53
- package/themes/franchises/src/components/shared/OIconButton.tsx +0 -127
- package/themes/franchises/src/components/shared/OIconText.tsx +0 -54
- package/themes/franchises/src/components/shared/OInput.tsx +0 -113
- package/themes/franchises/src/components/shared/OKeyButton.tsx +0 -35
- package/themes/franchises/src/components/shared/OModal.tsx +0 -172
- package/themes/franchises/src/components/shared/OText.tsx +0 -52
- package/themes/franchises/src/components/shared/OTextarea.tsx +0 -36
- package/themes/franchises/src/components/shared/OToast.tsx +0 -93
- package/themes/franchises/src/components/shared/OToggle.tsx +0 -158
- package/themes/franchises/src/components/shared/index.tsx +0 -29
- package/themes/franchises/src/config/constants.tsx +0 -57
- package/themes/franchises/src/layouts/Container.tsx +0 -23
- package/themes/franchises/src/layouts/SafeAreaContainer.tsx +0 -6
- package/themes/franchises/src/providers/AlertProvider.tsx +0 -43
- package/themes/franchises/src/providers/StoreUtil.tsx +0 -50
- package/themes/franchises/src/types/index.tsx +0 -445
- package/themes/franchises/src/utils/index.tsx +0 -222
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components/native'
|
|
2
|
-
|
|
3
|
-
export const WrapHeader = styled.View`
|
|
4
|
-
position: relative;
|
|
5
|
-
z-index: 1;
|
|
6
|
-
`
|
|
7
|
-
|
|
8
|
-
export const TopHeader = styled.View`
|
|
9
|
-
width: 100%;
|
|
10
|
-
flex-direction: row;
|
|
11
|
-
align-items: center;
|
|
12
|
-
justify-content: space-between;
|
|
13
|
-
z-index: 1;
|
|
14
|
-
padding-horizontal: 40px;
|
|
15
|
-
`
|
|
16
|
-
|
|
17
|
-
export const ProductHeader = styled.ImageBackground`
|
|
18
|
-
flex-direction: row;
|
|
19
|
-
width: 100%;
|
|
20
|
-
position: relative;
|
|
21
|
-
max-height: 258px;
|
|
22
|
-
height: 258px;
|
|
23
|
-
resize-mode: contain;
|
|
24
|
-
min-height: 200px;
|
|
25
|
-
z-index: 0;
|
|
26
|
-
`
|
|
27
|
-
|
|
28
|
-
export const WrapContent = styled.View`
|
|
29
|
-
padding: 26px 40px;
|
|
30
|
-
position: relative;
|
|
31
|
-
bottom: 20px;
|
|
32
|
-
background-color: white;
|
|
33
|
-
z-index: 100;
|
|
34
|
-
`
|
|
35
|
-
|
|
36
|
-
export const ProductTitle = styled.View`
|
|
37
|
-
justify-content: flex-start;
|
|
38
|
-
padding-bottom: 7px;
|
|
39
|
-
`
|
|
40
|
-
|
|
41
|
-
export const ProductDescription = styled.View`
|
|
42
|
-
margin-bottom: 30px;
|
|
43
|
-
`
|
|
44
|
-
|
|
45
|
-
export const ProductEditions = styled.View`
|
|
46
|
-
|
|
47
|
-
`
|
|
48
|
-
|
|
49
|
-
export const SectionTitle = styled.View`
|
|
50
|
-
padding: 15px 0px;
|
|
51
|
-
`
|
|
52
|
-
|
|
53
|
-
export const WrapperIngredients = styled.View`
|
|
54
|
-
border-bottom-left-radius: 10px;
|
|
55
|
-
border-bottom-right-radius: 10px;
|
|
56
|
-
`
|
|
57
|
-
|
|
58
|
-
export const WrapperSubOption = styled.View`
|
|
59
|
-
`
|
|
60
|
-
|
|
61
|
-
export const ProductComment = styled.View`
|
|
62
|
-
`
|
|
63
|
-
|
|
64
|
-
export const ProductActions = styled.View`
|
|
65
|
-
min-height: 70px;
|
|
66
|
-
padding: 12px 40px;
|
|
67
|
-
width: 100%;
|
|
68
|
-
flex-direction: row;
|
|
69
|
-
background-color: #FFF;
|
|
70
|
-
z-index: 1000;
|
|
71
|
-
align-items: center;
|
|
72
|
-
justify-content: space-between;
|
|
73
|
-
border-top-width: 1px;
|
|
74
|
-
border-top-color: ${(props: any) => props.theme.colors.border};
|
|
75
|
-
`
|
|
76
|
-
export const ExtraOptionWrap = styled.ScrollView`
|
|
77
|
-
margin-horizontal: -40px;
|
|
78
|
-
`;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { ProductIngredient as ProductIngredientController } from 'ordering-components/native'
|
|
3
|
-
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import { Container } from './styles'
|
|
5
|
-
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
6
|
-
import { View } from 'react-native'
|
|
7
|
-
import { OText } from '../shared'
|
|
8
|
-
|
|
9
|
-
const ProductIngredientUI = (props: any) => {
|
|
10
|
-
const {
|
|
11
|
-
state,
|
|
12
|
-
ingredient,
|
|
13
|
-
toggleSelect
|
|
14
|
-
} = props
|
|
15
|
-
|
|
16
|
-
const theme = useTheme();
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Container onPress={() => toggleSelect()}>
|
|
20
|
-
<View>
|
|
21
|
-
{state?.selected ? (
|
|
22
|
-
<MaterialCommunityIcon name='checkbox-marked' color={theme.colors.primary} size={24} />
|
|
23
|
-
) : (
|
|
24
|
-
<MaterialCommunityIcon name='checkbox-blank-outline' color={theme.colors.backgroundDark} size={24} />
|
|
25
|
-
)}
|
|
26
|
-
</View>
|
|
27
|
-
<OText mLeft={10}>
|
|
28
|
-
{ingredient.name}
|
|
29
|
-
</OText>
|
|
30
|
-
</Container>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const ProductIngredient = (props: any) => {
|
|
35
|
-
const productIngredientProps = {
|
|
36
|
-
...props,
|
|
37
|
-
UIComponent: ProductIngredientUI
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<ProductIngredientController {...productIngredientProps} />
|
|
42
|
-
)
|
|
43
|
-
}
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { View, Animated, StyleSheet, Platform, TouchableOpacity } from 'react-native'
|
|
3
|
-
import { useUtils, useLanguage, useOrder } from 'ordering-components/native'
|
|
4
|
-
import { useTheme } from 'styled-components/native';
|
|
5
|
-
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
6
|
-
import RNPickerSelect from 'react-native-picker-select'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
Accordion,
|
|
10
|
-
AccordionSection,
|
|
11
|
-
ProductInfo,
|
|
12
|
-
ProductQuantity,
|
|
13
|
-
ContentInfo,
|
|
14
|
-
ProductImage,
|
|
15
|
-
AccordionContent,
|
|
16
|
-
ProductOptionsList,
|
|
17
|
-
ProductOption,
|
|
18
|
-
ProductSubOption,
|
|
19
|
-
ProductComment
|
|
20
|
-
} from './styles'
|
|
21
|
-
import { OIcon, OText, OAlert } from '../shared'
|
|
22
|
-
|
|
23
|
-
import { ProductItemAccordionParams } from '../../types'
|
|
24
|
-
|
|
25
|
-
export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
26
|
-
|
|
27
|
-
const {
|
|
28
|
-
isCartPending,
|
|
29
|
-
isCartProduct,
|
|
30
|
-
product,
|
|
31
|
-
changeQuantity,
|
|
32
|
-
getProductMax,
|
|
33
|
-
onDeleteProduct,
|
|
34
|
-
onEditProduct,
|
|
35
|
-
isFromCheckout,
|
|
36
|
-
} = props
|
|
37
|
-
|
|
38
|
-
const theme = useTheme();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const pickerStyle = StyleSheet.create({
|
|
42
|
-
inputAndroid: {
|
|
43
|
-
width: 27,
|
|
44
|
-
textAlign: 'center',
|
|
45
|
-
overflow: 'visible',
|
|
46
|
-
fontSize: 12,
|
|
47
|
-
height: 20,
|
|
48
|
-
padding: 0,
|
|
49
|
-
color: theme.colors.textNormal
|
|
50
|
-
},
|
|
51
|
-
inputIOS: {
|
|
52
|
-
width: 27,
|
|
53
|
-
textAlign: 'center',
|
|
54
|
-
overflow: 'visible',
|
|
55
|
-
fontSize: 12,
|
|
56
|
-
},
|
|
57
|
-
icon: {
|
|
58
|
-
position: 'absolute',
|
|
59
|
-
zIndex: 1,
|
|
60
|
-
top: -4,
|
|
61
|
-
end: -4,
|
|
62
|
-
},
|
|
63
|
-
placeholder: {
|
|
64
|
-
color: theme.colors.secundaryContrast
|
|
65
|
-
},
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const [, t] = useLanguage()
|
|
70
|
-
const [orderState] = useOrder()
|
|
71
|
-
const [{ parsePrice, optimizeImage }] = useUtils()
|
|
72
|
-
|
|
73
|
-
const [isActive, setActiveState] = useState(false)
|
|
74
|
-
// const [setHeight, setHeightState] = useState({ height: new Animated.Value(0) })
|
|
75
|
-
// const [setRotate, setRotateState] = useState({ angle: new Animated.Value(0) })
|
|
76
|
-
|
|
77
|
-
const productInfo = () => {
|
|
78
|
-
if (isCartProduct) {
|
|
79
|
-
const ingredients = JSON.parse(JSON.stringify(Object.values(product.ingredients ?? {})))
|
|
80
|
-
let options = JSON.parse(JSON.stringify(Object.values(product.options ?? {})))
|
|
81
|
-
|
|
82
|
-
options = options.map((option: any) => {
|
|
83
|
-
option.suboptions = Object.values(option.suboptions ?? {})
|
|
84
|
-
return option
|
|
85
|
-
})
|
|
86
|
-
return {
|
|
87
|
-
...productInfo,
|
|
88
|
-
ingredients,
|
|
89
|
-
options
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return product
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/* const toggleAccordion = () => {
|
|
96
|
-
if ((!product?.valid_menu && isCartProduct)) return
|
|
97
|
-
if (isActive) {
|
|
98
|
-
Animated.timing(setHeight.height, {
|
|
99
|
-
toValue: 100,
|
|
100
|
-
duration: 500,
|
|
101
|
-
easing: Easing.linear,
|
|
102
|
-
useNativeDriver: false,
|
|
103
|
-
}).start()
|
|
104
|
-
} else {
|
|
105
|
-
setHeightState({height: new Animated.Value(0)})
|
|
106
|
-
}
|
|
107
|
-
}*/
|
|
108
|
-
|
|
109
|
-
const handleChangeQuantity = (value: string) => {
|
|
110
|
-
if (!orderState.loading) {
|
|
111
|
-
if (parseInt(value) === 0) {
|
|
112
|
-
onDeleteProduct && onDeleteProduct(product)
|
|
113
|
-
} else {
|
|
114
|
-
changeQuantity && changeQuantity(product, parseInt(value))
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const getFormattedSubOptionName = ({ quantity, name, position, price }: { quantity: number, name: string, position: string, price: number }) => {
|
|
120
|
-
const pos = position ? `(${position})` : ''
|
|
121
|
-
return `${quantity} x ${name} ${pos} +${price}`
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/*useEffect(() => {
|
|
125
|
-
toggleAccordion()
|
|
126
|
-
}, [isActive])*/
|
|
127
|
-
|
|
128
|
-
const productOptions = getProductMax && [...Array(getProductMax(product) + 1),].map((_: any, opt: number) => {
|
|
129
|
-
return {
|
|
130
|
-
label: opt === 0 ? t('REMOVE', 'Remove') : opt.toString(),
|
|
131
|
-
value: opt.toString()
|
|
132
|
-
}
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
return (
|
|
136
|
-
<AccordionSection>
|
|
137
|
-
<Accordion
|
|
138
|
-
isValid={product?.valid ?? true}
|
|
139
|
-
onPress={() => (!product?.valid_menu && isCartProduct)
|
|
140
|
-
? {}
|
|
141
|
-
: setActiveState(!isActive)}
|
|
142
|
-
activeOpacity={1}
|
|
143
|
-
>
|
|
144
|
-
<View style={{ flexDirection: 'row', alignItems: 'flex-start' }}>
|
|
145
|
-
<ContentInfo style={{alignItems: 'center'}}>
|
|
146
|
-
{product?.images && (
|
|
147
|
-
<ProductImage>
|
|
148
|
-
{isFromCheckout ? (
|
|
149
|
-
<OIcon url={optimizeImage(product?.images, 'h_100,c_limit')} style={{ ...styles.productImage, ...{ width: 82, height: 82 } }} />
|
|
150
|
-
) : (
|
|
151
|
-
<OIcon url={optimizeImage(product?.images, 'h_100,c_limit')} style={styles.productImage} />
|
|
152
|
-
)}
|
|
153
|
-
</ProductImage>
|
|
154
|
-
)}
|
|
155
|
-
{isCartProduct && !isCartPending && getProductMax && (
|
|
156
|
-
<ProductInfo>
|
|
157
|
-
<RNPickerSelect
|
|
158
|
-
items={productOptions}
|
|
159
|
-
onValueChange={handleChangeQuantity}
|
|
160
|
-
value={product.quantity.toString()}
|
|
161
|
-
style={pickerStyle}
|
|
162
|
-
useNativeAndroidPickerStyle={false}
|
|
163
|
-
placeholder={{}}
|
|
164
|
-
Icon={() => <View style={pickerStyle.icon}><OIcon src={theme.images.general.arrow_down} color={theme.colors.textNormal} width={8} /></View>}
|
|
165
|
-
disabled={orderState.loading}
|
|
166
|
-
/>
|
|
167
|
-
</ProductInfo>
|
|
168
|
-
)}
|
|
169
|
-
{isFromCheckout && (
|
|
170
|
-
<ProductQuantity>
|
|
171
|
-
<OText size={12} lineHeight={18}>
|
|
172
|
-
{product?.quantity}
|
|
173
|
-
</OText>
|
|
174
|
-
</ProductQuantity>
|
|
175
|
-
)}
|
|
176
|
-
<View style={{ flex: 1 }}>
|
|
177
|
-
<OText size={12} lineHeight={18} weight={'400'}>{product.name}</OText>
|
|
178
|
-
</View>
|
|
179
|
-
<View style={{ display: 'flex', flexDirection: 'column', flex: 1, alignItems: 'flex-end' }}>
|
|
180
|
-
<View style={{ flexDirection: 'row' }}>
|
|
181
|
-
<OText size={12} lineHeight={18} weight={'400'}>{parsePrice(product.total || product.price)}</OText>
|
|
182
|
-
{(productInfo().ingredients.length > 0 || productInfo().options.length > 0 || product.comment) && (
|
|
183
|
-
<MaterialCommunityIcon name='chevron-down' size={18} />
|
|
184
|
-
)}
|
|
185
|
-
</View>
|
|
186
|
-
<View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'flex-start' }}>
|
|
187
|
-
{onEditProduct && isCartProduct && !isCartPending && product?.valid_menu && (
|
|
188
|
-
<TouchableOpacity onPress={() => onEditProduct(product)} style={{ marginEnd: 7 }}>
|
|
189
|
-
<OIcon
|
|
190
|
-
src={theme.images.general.pencil}
|
|
191
|
-
width={16}
|
|
192
|
-
color={theme.colors.textSecondary}
|
|
193
|
-
/>
|
|
194
|
-
</TouchableOpacity>
|
|
195
|
-
)}
|
|
196
|
-
{onDeleteProduct && isCartProduct && !isCartPending && (
|
|
197
|
-
<OAlert
|
|
198
|
-
title={t('DELETE_PRODUCT', 'Delete Product')}
|
|
199
|
-
message={t('QUESTION_DELETE_PRODUCT', 'Are you sure that you want to delete the product?')}
|
|
200
|
-
onAccept={() => onDeleteProduct(product)}
|
|
201
|
-
>
|
|
202
|
-
<OIcon
|
|
203
|
-
src={theme.images.general.trash}
|
|
204
|
-
width={17}
|
|
205
|
-
color={theme.colors.textSecondary}
|
|
206
|
-
/>
|
|
207
|
-
</OAlert>
|
|
208
|
-
)}
|
|
209
|
-
</View>
|
|
210
|
-
</View>
|
|
211
|
-
</ContentInfo>
|
|
212
|
-
</View>
|
|
213
|
-
|
|
214
|
-
{((isCartProduct && !isCartPending && product?.valid_menu && !product?.valid_quantity) ||
|
|
215
|
-
(!product?.valid_menu && isCartProduct && !isCartPending)) && (
|
|
216
|
-
<OText size={20} color={theme.colors.red} style={{ textAlign: 'center', marginTop: 10 }}>
|
|
217
|
-
{t('NOT_AVAILABLE', 'Not available')}
|
|
218
|
-
</OText>
|
|
219
|
-
)}
|
|
220
|
-
</Accordion>
|
|
221
|
-
|
|
222
|
-
<View style={{ display: isActive ? 'flex' : 'none', paddingStart: 40 }}>
|
|
223
|
-
<Animated.View>
|
|
224
|
-
<AccordionContent>
|
|
225
|
-
{productInfo().ingredients.length > 0 && productInfo().ingredients.some((ingredient: any) => !ingredient.selected) && (
|
|
226
|
-
<ProductOptionsList>
|
|
227
|
-
<OText size={10} color={theme.colors.textSecondary}>{t('INGREDIENTS', 'Ingredients')}</OText>
|
|
228
|
-
{productInfo().ingredients.map((ingredient: any) => !ingredient.selected && (
|
|
229
|
-
<OText size={10} color={theme.colors.textThird} key={ingredient.id} style={{ marginLeft: 10 }}>{t('NO', 'No')} {ingredient.name}</OText>
|
|
230
|
-
))}
|
|
231
|
-
</ProductOptionsList>
|
|
232
|
-
)}
|
|
233
|
-
{productInfo().options.length > 0 && (
|
|
234
|
-
<ProductOptionsList>
|
|
235
|
-
{productInfo().options.map((option: any, i: number) => (
|
|
236
|
-
<ProductOption key={option.id + i}>
|
|
237
|
-
<OText size={10} color={theme.colors.textSecondary}>{option.name}</OText>
|
|
238
|
-
{option.suboptions.map((suboption: any) => (
|
|
239
|
-
<ProductSubOption key={suboption.id}>
|
|
240
|
-
<OText size={10} color={theme.colors.textThird}>
|
|
241
|
-
{getFormattedSubOptionName({
|
|
242
|
-
quantity: suboption.quantity,
|
|
243
|
-
name: suboption.name,
|
|
244
|
-
position: (suboption.position !== 'whole') ? t(suboption.position.toUpperCase(), suboption.position) : '',
|
|
245
|
-
price: parsePrice(suboption.price)
|
|
246
|
-
})}
|
|
247
|
-
</OText>
|
|
248
|
-
</ProductSubOption>
|
|
249
|
-
))}
|
|
250
|
-
</ProductOption>
|
|
251
|
-
))}
|
|
252
|
-
</ProductOptionsList>
|
|
253
|
-
)}
|
|
254
|
-
{product.comment && (
|
|
255
|
-
<ProductComment>
|
|
256
|
-
<OText size={10} color={theme.colors.textSecondary}>{t('SPECIAL_COMMENT', 'Special Comment')}</OText>
|
|
257
|
-
<OText size={10} color={theme.colors.textThird}>{product.comment}</OText>
|
|
258
|
-
</ProductComment>
|
|
259
|
-
)}
|
|
260
|
-
</AccordionContent>
|
|
261
|
-
</Animated.View>
|
|
262
|
-
</View>
|
|
263
|
-
</AccordionSection>
|
|
264
|
-
)
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
const styles = StyleSheet.create({
|
|
268
|
-
productImage: {
|
|
269
|
-
borderRadius: 7.6,
|
|
270
|
-
width: 48,
|
|
271
|
-
height: 48
|
|
272
|
-
},
|
|
273
|
-
test: {
|
|
274
|
-
overflow: 'hidden',
|
|
275
|
-
}
|
|
276
|
-
})
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components/native'
|
|
2
|
-
|
|
3
|
-
export const AccordionSection = styled.View`
|
|
4
|
-
background: #FFF;
|
|
5
|
-
padding-vertical: 10px;
|
|
6
|
-
`
|
|
7
|
-
|
|
8
|
-
export const Accordion = styled.TouchableOpacity`
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
justify-content: space-between;
|
|
11
|
-
align-items: center;
|
|
12
|
-
|
|
13
|
-
${(props: any) => !props.isValid && css`
|
|
14
|
-
background-color: rgba(0, 0, 0, 0.1);
|
|
15
|
-
`}
|
|
16
|
-
`
|
|
17
|
-
|
|
18
|
-
export const ProductInfo = styled.View`
|
|
19
|
-
margin-horizontal: 7px;
|
|
20
|
-
background-color: ${(props: any) => props.theme.colors.backgroundGray100};
|
|
21
|
-
padding: 4px 12px 4px 0px;
|
|
22
|
-
border-radius: 7.6px;
|
|
23
|
-
`
|
|
24
|
-
|
|
25
|
-
export const ProductQuantity = styled.View`
|
|
26
|
-
background-color: ${(props: any) => props.theme.colors.clear};
|
|
27
|
-
margin-horizontal: 7px;
|
|
28
|
-
min-width: 16px;
|
|
29
|
-
align-items: center;
|
|
30
|
-
`
|
|
31
|
-
|
|
32
|
-
export const ContentInfo = styled.View`
|
|
33
|
-
flex-direction: row;
|
|
34
|
-
justify-content: space-between;
|
|
35
|
-
align-items: flex-start;
|
|
36
|
-
overflow: hidden;
|
|
37
|
-
`
|
|
38
|
-
|
|
39
|
-
export const ProductImage = styled.View`
|
|
40
|
-
`
|
|
41
|
-
|
|
42
|
-
export const AccordionContent = styled.View`
|
|
43
|
-
overflow: hidden;
|
|
44
|
-
`
|
|
45
|
-
|
|
46
|
-
export const ProductOptionsList = styled.View`
|
|
47
|
-
margin-top: 20px;
|
|
48
|
-
margin-left: 20px;
|
|
49
|
-
`
|
|
50
|
-
|
|
51
|
-
export const ProductOption = styled.View``
|
|
52
|
-
|
|
53
|
-
export const ProductSubOption = styled.View`
|
|
54
|
-
margin-left: 10px;
|
|
55
|
-
`
|
|
56
|
-
|
|
57
|
-
export const ProductComment = styled.View``
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { ProductOption as ProductOptionController, useLanguage } from 'ordering-components/native'
|
|
3
|
-
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import {
|
|
5
|
-
Container,
|
|
6
|
-
WrapHeader,
|
|
7
|
-
} from './styles'
|
|
8
|
-
import { OText } from '../shared'
|
|
9
|
-
|
|
10
|
-
const ProductOptionUI = (props: any) => {
|
|
11
|
-
const {
|
|
12
|
-
children,
|
|
13
|
-
option,
|
|
14
|
-
error
|
|
15
|
-
} = props
|
|
16
|
-
|
|
17
|
-
const theme = useTheme();
|
|
18
|
-
|
|
19
|
-
const [, t] = useLanguage()
|
|
20
|
-
|
|
21
|
-
let maxMin = `(${t('MIN', 'Min')}: ${option.min} / ${t('MAX', 'Max')}: ${option.max})`
|
|
22
|
-
if (option.min === 1 && option.max === 1) {
|
|
23
|
-
maxMin = t('REQUIRED', 'Required')
|
|
24
|
-
} else if (option.min === 0 && option.max > 0) {
|
|
25
|
-
maxMin = `(${t('MAX', 'Max')}: ${option.max})`
|
|
26
|
-
} else if (option.min > 0 && option.max === 0) {
|
|
27
|
-
maxMin = `(${t('MIN', 'Min')}: ${option.min})`
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<Container style={{ color: error ? 'orange' : theme.colors.white }}>
|
|
32
|
-
<WrapHeader>
|
|
33
|
-
<OText size={16} lineHeight={24} weight={'600'}>{option.name}</OText>
|
|
34
|
-
<OText color={theme.colors.red}>{maxMin}</OText>
|
|
35
|
-
</WrapHeader>
|
|
36
|
-
{children}
|
|
37
|
-
</Container>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const ProductOption = (props: any) => {
|
|
42
|
-
const productOptionProps = {
|
|
43
|
-
...props,
|
|
44
|
-
UIComponent: ProductOptionUI
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<ProductOptionController {...productOptionProps} />
|
|
49
|
-
)
|
|
50
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
useUtils,
|
|
4
|
-
useLanguage,
|
|
5
|
-
ProductOptionSuboption as ProductSubOptionController,
|
|
6
|
-
} from 'ordering-components/native'
|
|
7
|
-
import { useTheme } from 'styled-components/native';
|
|
8
|
-
import { StyleSheet } from 'react-native'
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
Container,
|
|
12
|
-
IconControl,
|
|
13
|
-
QuantityControl,
|
|
14
|
-
Checkbox,
|
|
15
|
-
PositionControl,
|
|
16
|
-
Circle
|
|
17
|
-
} from './styles'
|
|
18
|
-
import { OIcon, OText } from '../shared'
|
|
19
|
-
|
|
20
|
-
export const ProductOptionSubOptionUI = (props: any) => {
|
|
21
|
-
const {
|
|
22
|
-
state,
|
|
23
|
-
increment,
|
|
24
|
-
decrement,
|
|
25
|
-
balance,
|
|
26
|
-
option,
|
|
27
|
-
suboption,
|
|
28
|
-
toggleSelect,
|
|
29
|
-
changePosition,
|
|
30
|
-
disabled
|
|
31
|
-
} = props
|
|
32
|
-
|
|
33
|
-
const theme = useTheme();
|
|
34
|
-
|
|
35
|
-
const [, t] = useLanguage()
|
|
36
|
-
const [{ parsePrice }] = useUtils()
|
|
37
|
-
const [showMessage, setShowMessage] = useState(false)
|
|
38
|
-
|
|
39
|
-
const handleSuboptionClick = () => {
|
|
40
|
-
toggleSelect()
|
|
41
|
-
if (balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1)) {
|
|
42
|
-
setShowMessage(true)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (!(balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1))) {
|
|
48
|
-
setShowMessage(false)
|
|
49
|
-
}
|
|
50
|
-
}, [balance])
|
|
51
|
-
|
|
52
|
-
const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
|
|
53
|
-
const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<Container disabled={disabled}>
|
|
57
|
-
<IconControl onPress={() => handleSuboptionClick()}>
|
|
58
|
-
{((option?.min === 0 && option?.max === 1) || option?.max > 1) ? (
|
|
59
|
-
state?.selected ? (
|
|
60
|
-
<OIcon src={theme.images.general.check_act} color={theme.colors.primary} width={16} />
|
|
61
|
-
) : (
|
|
62
|
-
<OIcon src={theme.images.general.check_nor} color={theme.colors.disabled} width={16} />
|
|
63
|
-
)
|
|
64
|
-
) : (
|
|
65
|
-
state?.selected ? (
|
|
66
|
-
<OIcon src={theme.images.general.radio_act} color={theme.colors.primary} width={16} />
|
|
67
|
-
) : (
|
|
68
|
-
<OIcon src={theme.images.general.radio_nor} color={theme.colors.disabled} width={16} />
|
|
69
|
-
)
|
|
70
|
-
)}
|
|
71
|
-
<OText size={12} lineHeight={18} color={theme.colors.textSecondary} mLeft={10} style={{ flex: 1 }}>
|
|
72
|
-
{suboption?.name}
|
|
73
|
-
</OText>
|
|
74
|
-
</IconControl>
|
|
75
|
-
{showMessage && <OText size={10} mLeft={4} mRight={4} style={{ flex: 1, textAlign: 'center' }} color={theme.colors.primary}>{`${t('OPTIONS_MAX_LIMIT', 'Maximum options to choose')}: ${option?.max}`}</OText>}
|
|
76
|
-
{option?.allow_suboption_quantity && (
|
|
77
|
-
<QuantityControl>
|
|
78
|
-
<Checkbox disabled={state.quantity === 0} onPress={decrement}>
|
|
79
|
-
<OIcon
|
|
80
|
-
src={theme.images.general.minus}
|
|
81
|
-
width={16}
|
|
82
|
-
color={state.quantity === 0 ? theme.colors.disabled : theme.colors.primary}
|
|
83
|
-
/>
|
|
84
|
-
</Checkbox>
|
|
85
|
-
<OText mLeft={5} mRight={5}>
|
|
86
|
-
{state.quantity}
|
|
87
|
-
</OText>
|
|
88
|
-
<Checkbox disabled={disableIncrement} onPress={increment}>
|
|
89
|
-
<OIcon
|
|
90
|
-
src={theme.images.general.plus}
|
|
91
|
-
width={16}
|
|
92
|
-
color={disableIncrement ? theme.colors.disabled : theme.colors.primary}
|
|
93
|
-
/>
|
|
94
|
-
</Checkbox>
|
|
95
|
-
</QuantityControl>
|
|
96
|
-
)}
|
|
97
|
-
{option?.with_half_option && (
|
|
98
|
-
<PositionControl>
|
|
99
|
-
<Circle onPress={() => changePosition('left')}>
|
|
100
|
-
<OIcon
|
|
101
|
-
src={theme.images.general.half_l}
|
|
102
|
-
color={state.selected && state.position === 'left' ? theme.colors.primary : '#cbcbcb'}
|
|
103
|
-
width={16}
|
|
104
|
-
style={styles.inverse}
|
|
105
|
-
/>
|
|
106
|
-
</Circle>
|
|
107
|
-
<Circle onPress={() => changePosition('whole')}>
|
|
108
|
-
<OIcon
|
|
109
|
-
src={theme.images.general.half_f}
|
|
110
|
-
color={state.selected && state.position === 'whole' ? theme.colors.primary : '#cbcbcb'}
|
|
111
|
-
width={16}
|
|
112
|
-
/>
|
|
113
|
-
</Circle>
|
|
114
|
-
<Circle onPress={() => changePosition('right')}>
|
|
115
|
-
<OIcon
|
|
116
|
-
src={theme.images.general.half_r}
|
|
117
|
-
color={state.selected && state.position === 'right' ? theme.colors.primary : '#cbcbcb'}
|
|
118
|
-
width={16}
|
|
119
|
-
/>
|
|
120
|
-
</Circle>
|
|
121
|
-
</PositionControl>
|
|
122
|
-
)
|
|
123
|
-
}
|
|
124
|
-
<OText size={12} lineHeight={18} color={theme.colors.textSecondary}>
|
|
125
|
-
+ {parsePrice(price)}
|
|
126
|
-
</OText>
|
|
127
|
-
</Container>
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const styles = StyleSheet.create({
|
|
132
|
-
inverse: {
|
|
133
|
-
transform: [{ rotateY: '180deg' }]
|
|
134
|
-
}
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
export const ProductOptionSubOption = (props: any) => {
|
|
138
|
-
const productOptionSubOptionProps = {
|
|
139
|
-
...props,
|
|
140
|
-
UIComponent: ProductOptionSubOptionUI
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return (
|
|
144
|
-
<ProductSubOptionController {...productOptionSubOptionProps} />
|
|
145
|
-
)
|
|
146
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components/native'
|
|
2
|
-
|
|
3
|
-
export const Container = styled.View`
|
|
4
|
-
flex-direction: row;
|
|
5
|
-
align-items: center;
|
|
6
|
-
justify-content: space-between;
|
|
7
|
-
padding: 10px 0;
|
|
8
|
-
`
|
|
9
|
-
|
|
10
|
-
export const IconControl = styled.TouchableOpacity`
|
|
11
|
-
flex-direction: row;
|
|
12
|
-
flex: 1;
|
|
13
|
-
align-items: center;
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
export const QuantityControl = styled.View`
|
|
17
|
-
flex-direction: row;
|
|
18
|
-
align-items: center;
|
|
19
|
-
margin-horizontal: 5px;
|
|
20
|
-
`
|
|
21
|
-
|
|
22
|
-
export const PositionControl = styled.View`
|
|
23
|
-
flex-direction: row;
|
|
24
|
-
align-items: center;
|
|
25
|
-
margin-right: 5px;
|
|
26
|
-
`
|
|
27
|
-
|
|
28
|
-
export const Checkbox = styled.TouchableOpacity`
|
|
29
|
-
`
|
|
30
|
-
|
|
31
|
-
export const Circle = styled.TouchableOpacity`
|
|
32
|
-
`
|