ordering-ui-react-native 0.14.29 → 0.14.30-release
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 +2 -3
- package/src/components/ProductForm/index.tsx +27 -19
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessProductsList/styles.tsx +1 -1
- package/themes/instacart/src/components/SingleProductCard/index.tsx +19 -24
- package/themes/instacart/src/components/SingleProductCard/styles.tsx +6 -4
- package/themes/original/index.tsx +0 -4
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +31 -50
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +0 -7
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessesListing/index.tsx +19 -25
- package/themes/original/src/components/Cart/index.tsx +9 -29
- package/themes/original/src/components/CartContent/index.tsx +0 -1
- package/themes/original/src/components/Checkout/index.tsx +4 -15
- package/themes/original/src/components/Checkout/styles.tsx +1 -5
- package/themes/original/src/components/FacebookLogin/index.tsx +20 -5
- package/themes/original/src/components/Help/index.tsx +2 -2
- package/themes/original/src/components/Home/index.tsx +5 -3
- package/themes/original/src/components/OrderDetails/index.tsx +3 -55
- package/themes/original/src/components/OrderProgress/index.tsx +2 -2
- package/themes/original/src/components/OrderSummary/index.tsx +3 -21
- package/themes/original/src/components/ProductForm/index.tsx +63 -103
- package/themes/original/src/components/ProductForm/styles.tsx +0 -12
- package/themes/original/src/components/ProductIngredient/index.tsx +4 -5
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +9 -9
- package/themes/original/src/components/UserProfile/index.tsx +0 -5
- package/themes/original/src/types/index.tsx +2 -4
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +0 -163
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +0 -38
- package/themes/original/src/components/WalletTransactionItem/index.tsx +0 -68
- package/themes/original/src/components/WalletTransactionItem/styles.tsx +0 -37
- package/themes/original/src/components/Wallets/index.tsx +0 -204
- package/themes/original/src/components/Wallets/styles.tsx +0 -43
|
@@ -74,10 +74,6 @@ export const ChDriverTips = styled(ChPaymethods)``
|
|
|
74
74
|
|
|
75
75
|
export const ChCart = styled(ChPaymethods)``
|
|
76
76
|
|
|
77
|
-
export const WalletPaymentOptionContainer = styled(ChPaymethods)`
|
|
78
|
-
padding-bottom: 0;
|
|
79
|
-
`
|
|
80
|
-
|
|
81
77
|
export const ChPlaceOrderBtn = styled.View`
|
|
82
78
|
width: 100%;
|
|
83
79
|
display: flex;
|
|
@@ -103,4 +99,4 @@ export const DeliveryOptionItem = styled.View`
|
|
|
103
99
|
align-items: center;
|
|
104
100
|
flex-direction: row;
|
|
105
101
|
background-color: ${(props : any) => props?.backgroundColor ?? '#fff'};
|
|
106
|
-
`;
|
|
102
|
+
`;
|
|
@@ -11,7 +11,8 @@ export const FacebookLogin = (props: any) => {
|
|
|
11
11
|
const {
|
|
12
12
|
handleErrors,
|
|
13
13
|
handleLoading,
|
|
14
|
-
handleSuccessFacebookLogin
|
|
14
|
+
handleSuccessFacebookLogin,
|
|
15
|
+
notificationState
|
|
15
16
|
} = props
|
|
16
17
|
|
|
17
18
|
const [, t] = useLanguage()
|
|
@@ -30,7 +31,14 @@ export const FacebookLogin = (props: any) => {
|
|
|
30
31
|
|
|
31
32
|
const handleLoginClick = async (accessToken: string) => {
|
|
32
33
|
try {
|
|
33
|
-
const
|
|
34
|
+
const body: any = {
|
|
35
|
+
access_token: accessToken
|
|
36
|
+
}
|
|
37
|
+
if (notificationState?.notification_token) {
|
|
38
|
+
body.notification_token = notificationState.notification_token
|
|
39
|
+
body.notification_app = notificationState.notification_app
|
|
40
|
+
}
|
|
41
|
+
const response = await ordering.users().authFacebook(body)
|
|
34
42
|
if (!response.content.error) {
|
|
35
43
|
if (handleSuccessFacebookLogin) {
|
|
36
44
|
handleSuccessFacebookLogin(response.content.result)
|
|
@@ -38,9 +46,10 @@ export const FacebookLogin = (props: any) => {
|
|
|
38
46
|
}
|
|
39
47
|
} else {
|
|
40
48
|
handleLoading && handleLoading(false)
|
|
49
|
+
handleErrors && handleErrors(response.content.result)
|
|
41
50
|
logoutWithFacebook()
|
|
42
51
|
}
|
|
43
|
-
} catch (err) {
|
|
52
|
+
} catch (err: any) {
|
|
44
53
|
handleLoading && handleLoading(false)
|
|
45
54
|
handleErrors && handleErrors(err.message)
|
|
46
55
|
}
|
|
@@ -48,7 +57,7 @@ export const FacebookLogin = (props: any) => {
|
|
|
48
57
|
|
|
49
58
|
const loginWithFacebook = () => {
|
|
50
59
|
handleLoading && handleLoading(true)
|
|
51
|
-
LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
|
|
60
|
+
LoginManager && LoginManager.logInWithPermissions(['public_profile', 'email']).then(
|
|
52
61
|
(login: any) => {
|
|
53
62
|
if (login.isCancelled) {
|
|
54
63
|
const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
|
|
@@ -58,6 +67,9 @@ export const FacebookLogin = (props: any) => {
|
|
|
58
67
|
AccessToken.getCurrentAccessToken().then((data: any) => {
|
|
59
68
|
const accessToken = data.accessToken.toString();
|
|
60
69
|
handleLoginClick(accessToken)
|
|
70
|
+
}).catch((err : any) => {
|
|
71
|
+
handleErrors && handleErrors(err.message)
|
|
72
|
+
handleLoading && handleLoading(false)
|
|
61
73
|
});
|
|
62
74
|
}
|
|
63
75
|
},
|
|
@@ -68,7 +80,10 @@ export const FacebookLogin = (props: any) => {
|
|
|
68
80
|
handleLoading && handleLoading(false)
|
|
69
81
|
handleErrors && handleErrors(err)
|
|
70
82
|
},
|
|
71
|
-
)
|
|
83
|
+
).catch((err : any) => {
|
|
84
|
+
handleErrors && handleErrors(err.message)
|
|
85
|
+
handleLoading && handleLoading(false)
|
|
86
|
+
});
|
|
72
87
|
};
|
|
73
88
|
|
|
74
89
|
const onPressButton = auth
|
|
@@ -48,8 +48,8 @@ export const Help = (props: HelpParams) => {
|
|
|
48
48
|
|
|
49
49
|
<LastOrdersContainer>
|
|
50
50
|
<OText size={18} weight={600}>{t('LAST_ORDERS', 'Last Orders')}</OText>
|
|
51
|
-
<LastOrders
|
|
51
|
+
<LastOrders onRedirect={onRedirect} />
|
|
52
52
|
</LastOrdersContainer>
|
|
53
53
|
</>
|
|
54
54
|
)
|
|
55
|
-
}
|
|
55
|
+
}
|
|
@@ -5,11 +5,11 @@ import { StyleSheet, View } from 'react-native';
|
|
|
5
5
|
import { OButton, OIcon, OText } from '../shared';
|
|
6
6
|
import { LanguageSelector } from '../LanguageSelector';
|
|
7
7
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
8
|
-
import { useWindowDimensions } from 'react-native';
|
|
8
|
+
import { useWindowDimensions, Platform } from 'react-native';
|
|
9
9
|
|
|
10
10
|
export const Home = (props: any) => {
|
|
11
11
|
const { onNavigationRedirect } = props;
|
|
12
|
-
const { width } = useWindowDimensions();
|
|
12
|
+
const { width, height } = useWindowDimensions();
|
|
13
13
|
const [, t] = useLanguage();
|
|
14
14
|
const [orderState] = useOrder();
|
|
15
15
|
|
|
@@ -18,7 +18,9 @@ export const Home = (props: any) => {
|
|
|
18
18
|
return (
|
|
19
19
|
<View style={styles.container}>
|
|
20
20
|
<View>
|
|
21
|
-
<
|
|
21
|
+
<View style={{paddingTop: (height <= 756 && Platform.OS !== 'ios') ? (height * 0.05) : 0 }}>
|
|
22
|
+
<LanguageSelector />
|
|
23
|
+
</View>
|
|
22
24
|
<OIcon
|
|
23
25
|
src={theme.images.logos.logotypeInvert}
|
|
24
26
|
style={{
|
|
@@ -104,15 +104,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
104
104
|
|
|
105
105
|
const { order, businessData } = props.order;
|
|
106
106
|
|
|
107
|
-
const walletName: any = {
|
|
108
|
-
cash: {
|
|
109
|
-
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
110
|
-
},
|
|
111
|
-
credit_point: {
|
|
112
|
-
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
107
|
const getOrderStatus = (s: string) => {
|
|
117
108
|
const status = parseInt(s);
|
|
118
109
|
const orderStatus = [
|
|
@@ -611,7 +602,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
611
602
|
<OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
612
603
|
{t('DELIVERY_PREFERENCE', 'Delivery Preference')}
|
|
613
604
|
</OText>
|
|
614
|
-
<OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
605
|
+
<OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
606
|
+
{order?.delivery_option?.name ? t(order?.delivery_option?.name.toUpperCase().replace(/\s/g, '_')) : t('EITHER_WAY', 'Either way')}
|
|
607
|
+
</OText>
|
|
615
608
|
</View>
|
|
616
609
|
)}
|
|
617
610
|
{order?.comment && (
|
|
@@ -835,51 +828,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
835
828
|
</OText>
|
|
836
829
|
</Table>
|
|
837
830
|
</Total>
|
|
838
|
-
{order?.payment_events?.length > 0 && (
|
|
839
|
-
<View style={{marginTop: 10}}>
|
|
840
|
-
<OText size={20} weight='bold' color={theme.colors.textNormal}>{t('PAYMENTS', 'Payments')}</OText>
|
|
841
|
-
<View
|
|
842
|
-
style={{
|
|
843
|
-
width: '100%',
|
|
844
|
-
marginTop: 10
|
|
845
|
-
}}
|
|
846
|
-
>
|
|
847
|
-
{order?.payment_events?.map((event: any) => (
|
|
848
|
-
<View
|
|
849
|
-
key={event.id}
|
|
850
|
-
style={{
|
|
851
|
-
display: 'flex',
|
|
852
|
-
flexDirection: 'row',
|
|
853
|
-
justifyContent: 'space-between',
|
|
854
|
-
alignItems: 'center',
|
|
855
|
-
marginBottom: 10
|
|
856
|
-
}}
|
|
857
|
-
>
|
|
858
|
-
<View
|
|
859
|
-
style={{
|
|
860
|
-
display: 'flex',
|
|
861
|
-
flexDirection: 'column',
|
|
862
|
-
}}
|
|
863
|
-
>
|
|
864
|
-
<OText>
|
|
865
|
-
{event?.wallet_event
|
|
866
|
-
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
867
|
-
: event?.paymethod?.name}
|
|
868
|
-
</OText>
|
|
869
|
-
{event?.data?.charge_id && (
|
|
870
|
-
<OText>
|
|
871
|
-
{`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
|
|
872
|
-
</OText>
|
|
873
|
-
)}
|
|
874
|
-
</View>
|
|
875
|
-
<OText>
|
|
876
|
-
-{parsePrice(event.amount)}
|
|
877
|
-
</OText>
|
|
878
|
-
</View>
|
|
879
|
-
))}
|
|
880
|
-
</View>
|
|
881
|
-
</View>
|
|
882
|
-
)}
|
|
883
831
|
</OrderBill>
|
|
884
832
|
</OrderContent>
|
|
885
833
|
</>
|
|
@@ -193,13 +193,13 @@ const OrderProgressUI = (props: any) => {
|
|
|
193
193
|
</View>
|
|
194
194
|
</View>
|
|
195
195
|
)}
|
|
196
|
-
{
|
|
196
|
+
{!orderList?.loading && orderList?.orders?.length === 0 && (
|
|
197
197
|
<NotFoundSource
|
|
198
198
|
image={imageFails}
|
|
199
199
|
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
200
200
|
conditioned
|
|
201
201
|
/>
|
|
202
|
-
)}
|
|
202
|
+
)}
|
|
203
203
|
</>
|
|
204
204
|
)
|
|
205
205
|
}
|
|
@@ -28,6 +28,7 @@ import { TouchableOpacity } from 'react-native';
|
|
|
28
28
|
|
|
29
29
|
const OrderSummaryUI = (props: any) => {
|
|
30
30
|
const {
|
|
31
|
+
cart,
|
|
31
32
|
changeQuantity,
|
|
32
33
|
getProductMax,
|
|
33
34
|
offsetDisabled,
|
|
@@ -75,16 +76,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
const cart = orderState?.carts?.[`businessId:${props.cart.business_id}`]
|
|
79
|
-
|
|
80
|
-
const walletName: any = {
|
|
81
|
-
cash: {
|
|
82
|
-
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
83
|
-
},
|
|
84
|
-
credit_point: {
|
|
85
|
-
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
79
|
|
|
89
80
|
return (
|
|
90
81
|
<OSContainer>
|
|
@@ -177,14 +168,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
177
168
|
<OText size={12}>{parsePrice(cart?.driver_tip)}</OText>
|
|
178
169
|
</OSTable>
|
|
179
170
|
)}
|
|
180
|
-
{cart?.payment_events?.length > 0 && cart?.payment_events?.map((event: any) => (
|
|
181
|
-
<OSTable key={event.id}>
|
|
182
|
-
<OText size={12} numberOfLines={1}>
|
|
183
|
-
{walletName[cart?.wallets?.find((wallet: any) => wallet.id === event.wallet_id)?.type]?.name}
|
|
184
|
-
</OText>
|
|
185
|
-
<OText size={12}>-{parsePrice(event.amount)}</OText>
|
|
186
|
-
</OSTable>
|
|
187
|
-
))}
|
|
188
171
|
{isCouponEnabled && !isCartPending && (
|
|
189
172
|
<View>
|
|
190
173
|
<View style={{ paddingVertical: 5 }}>
|
|
@@ -202,7 +185,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
202
185
|
{t('TOTAL', 'Total')}
|
|
203
186
|
</OText>
|
|
204
187
|
<OText size={14} style={{ fontWeight: 'bold' }} >
|
|
205
|
-
{parsePrice(cart?.
|
|
188
|
+
{parsePrice(cart?.total)}
|
|
206
189
|
</OText>
|
|
207
190
|
</OSTable>
|
|
208
191
|
</View>
|
|
@@ -222,8 +205,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
222
205
|
height: 100,
|
|
223
206
|
borderColor: theme.colors.border,
|
|
224
207
|
paddingRight: 50,
|
|
225
|
-
marginTop: 10
|
|
226
|
-
borderRadius: 8
|
|
208
|
+
marginTop: 10
|
|
227
209
|
}}
|
|
228
210
|
multiline
|
|
229
211
|
/>
|
|
@@ -12,9 +12,6 @@ import { ProductOption } from '../ProductOption';
|
|
|
12
12
|
import Swiper from 'react-native-swiper'
|
|
13
13
|
import FastImage from 'react-native-fast-image';
|
|
14
14
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
15
|
-
import {
|
|
16
|
-
Grayscale
|
|
17
|
-
} from 'react-native-color-matrix-image-filters'
|
|
18
15
|
|
|
19
16
|
import { View, TouchableOpacity, StyleSheet, Dimensions, Platform, AppRegistry, I18nManager } from 'react-native';
|
|
20
17
|
|
|
@@ -31,9 +28,7 @@ import {
|
|
|
31
28
|
WrapperSubOption,
|
|
32
29
|
ProductComment,
|
|
33
30
|
ProductActions,
|
|
34
|
-
ExtraOptionWrap
|
|
35
|
-
WeightUnitSwitch,
|
|
36
|
-
WeightUnitItem
|
|
31
|
+
ExtraOptionWrap
|
|
37
32
|
} from './styles';
|
|
38
33
|
import { OButton, OIcon, OInput, OText } from '../shared';
|
|
39
34
|
import { ScrollView } from 'react-native-gesture-handler';
|
|
@@ -132,9 +127,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
132
127
|
height: 32,
|
|
133
128
|
borderRadius: 16,
|
|
134
129
|
backgroundColor: 'rgba(208,208,208,0.5)'
|
|
135
|
-
},
|
|
136
|
-
unitItem: {
|
|
137
|
-
fontSize: 12
|
|
138
130
|
}
|
|
139
131
|
});
|
|
140
132
|
|
|
@@ -149,12 +141,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
149
141
|
const { top, bottom } = useSafeAreaInsets();
|
|
150
142
|
const { height } = useWindowDimensions();
|
|
151
143
|
const [selOpt, setSelectedOpt] = useState(0);
|
|
152
|
-
const [isHaveWeight, setIsHaveWeight] = useState(false)
|
|
153
|
-
const [qtyBy, setQtyBy] = useState({
|
|
154
|
-
weight_unit: false,
|
|
155
|
-
pieces: true
|
|
156
|
-
})
|
|
157
|
-
const [pricePerWeightUnit, setPricePerWeightUnit] = useState(null)
|
|
158
144
|
|
|
159
145
|
const swiperRef: any = useRef(null)
|
|
160
146
|
|
|
@@ -163,12 +149,9 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
163
149
|
if (errors[`id:${id}`]) {
|
|
164
150
|
bgColor = 'rgba(255, 0, 0, 0.05)';
|
|
165
151
|
}
|
|
166
|
-
if (maxProductQuantity <= 0) {
|
|
152
|
+
if (isSoldOut || maxProductQuantity <= 0) {
|
|
167
153
|
bgColor = 'hsl(0, 0%, 72%)';
|
|
168
154
|
}
|
|
169
|
-
if (isSoldOut) {
|
|
170
|
-
bgColor = theme.colors.white;
|
|
171
|
-
}
|
|
172
155
|
return bgColor;
|
|
173
156
|
};
|
|
174
157
|
|
|
@@ -210,10 +193,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
210
193
|
navigation.navigate('Login');
|
|
211
194
|
};
|
|
212
195
|
|
|
213
|
-
const handleSwitchQtyUnit = (val: string) => {
|
|
214
|
-
setQtyBy({ [val]: true, [!val]: false })
|
|
215
|
-
}
|
|
216
|
-
|
|
217
196
|
useEffect(() => {
|
|
218
197
|
const productImgList: any = []
|
|
219
198
|
product?.images && productImgList.push(product.images)
|
|
@@ -223,11 +202,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
223
202
|
}
|
|
224
203
|
}
|
|
225
204
|
setGallery(productImgList)
|
|
226
|
-
|
|
227
|
-
if (product?.weight && product?.weight_unit) {
|
|
228
|
-
setIsHaveWeight(true)
|
|
229
|
-
setPricePerWeightUnit(product?.price / product?.weight)
|
|
230
|
-
}
|
|
231
205
|
}, [product])
|
|
232
206
|
|
|
233
207
|
const saveErrors =
|
|
@@ -342,15 +316,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
342
316
|
style={styles.slide1}
|
|
343
317
|
key={i}
|
|
344
318
|
>
|
|
345
|
-
<
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
/>
|
|
353
|
-
</Grayscale>
|
|
319
|
+
<FastImage
|
|
320
|
+
style={{ height: '100%' }}
|
|
321
|
+
source={{
|
|
322
|
+
uri: optimizeImage(img, 'h_258,c_limit'),
|
|
323
|
+
priority: FastImage.priority.normal,
|
|
324
|
+
}}
|
|
325
|
+
/>
|
|
354
326
|
</View>
|
|
355
327
|
))}
|
|
356
328
|
</Swiper>
|
|
@@ -374,19 +346,17 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
374
346
|
opacity: index === thumbsSwiper ? 1 : 0.8
|
|
375
347
|
}}
|
|
376
348
|
>
|
|
377
|
-
<
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
/>
|
|
389
|
-
</Grayscale>
|
|
349
|
+
<OIcon
|
|
350
|
+
url={img}
|
|
351
|
+
style={{
|
|
352
|
+
borderColor: theme.colors.lightGray,
|
|
353
|
+
borderRadius: 8,
|
|
354
|
+
minHeight: '100%'
|
|
355
|
+
}}
|
|
356
|
+
width={56}
|
|
357
|
+
height={56}
|
|
358
|
+
cover
|
|
359
|
+
/>
|
|
390
360
|
</View>
|
|
391
361
|
</TouchableOpacity>
|
|
392
362
|
|
|
@@ -410,13 +380,30 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
410
380
|
</Placeholder>
|
|
411
381
|
) : (
|
|
412
382
|
<>
|
|
413
|
-
<
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
383
|
+
<View style={{ flexDirection: 'row' }}>
|
|
384
|
+
<OText
|
|
385
|
+
size={20}
|
|
386
|
+
lineHeight={30}
|
|
387
|
+
weight={'600'}
|
|
388
|
+
style={{ flex: 1, marginBottom: 10 }}>
|
|
389
|
+
{product?.name || productCart.name}
|
|
390
|
+
</OText>
|
|
391
|
+
{product?.calories && (
|
|
392
|
+
<OText size={16} style={{ color: '#808080' }}>{product?.calories} cal
|
|
393
|
+
</OText>
|
|
394
|
+
)}
|
|
395
|
+
</View>
|
|
396
|
+
<View style={{ flexDirection: 'row', marginBottom: 10 }}>
|
|
397
|
+
<OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
|
|
398
|
+
{product?.offer_price && (
|
|
399
|
+
<OText style={{ fontSize: 14,
|
|
400
|
+
color: '#808080',
|
|
401
|
+
textDecorationLine: 'line-through',
|
|
402
|
+
marginLeft: 7,
|
|
403
|
+
marginRight: 7
|
|
404
|
+
}}>{parsePrice(product?.offer_price)}</OText>
|
|
405
|
+
)}
|
|
406
|
+
</View>
|
|
420
407
|
{((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (product?.estimated_person)) && (
|
|
421
408
|
<OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'} mBottom={7}>
|
|
422
409
|
{
|
|
@@ -431,13 +418,9 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
431
418
|
}
|
|
432
419
|
</OText>
|
|
433
420
|
)}
|
|
434
|
-
{
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
<OText size={16} lineHeight={24} color={theme.colors.textNormal}>
|
|
438
|
-
{productCart.price ? parsePrice(productCart.price) : ''}
|
|
439
|
-
</OText>
|
|
440
|
-
)}
|
|
421
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal}>
|
|
422
|
+
{productCart.price ? parsePrice(productCart.price) : ''}
|
|
423
|
+
</OText>
|
|
441
424
|
</>
|
|
442
425
|
)}
|
|
443
426
|
</ProductTitle>
|
|
@@ -522,7 +505,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
522
505
|
{t('INGREDIENTS', 'Ingredients')}
|
|
523
506
|
</OText>
|
|
524
507
|
</SectionTitle>
|
|
525
|
-
<WrapperIngredients
|
|
508
|
+
<WrapperIngredients
|
|
509
|
+
style={{
|
|
510
|
+
backgroundColor:
|
|
511
|
+
isSoldOut || maxProductQuantity <= 0
|
|
512
|
+
? 'hsl(0, 0%, 72%)'
|
|
513
|
+
: theme.colors.white,
|
|
514
|
+
}}>
|
|
526
515
|
{product?.ingredients.map((ingredient: any) => (
|
|
527
516
|
<ProductIngredient
|
|
528
517
|
key={ingredient.id}
|
|
@@ -531,7 +520,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
531
520
|
productCart.ingredients[`id:${ingredient.id}`]
|
|
532
521
|
}
|
|
533
522
|
onChange={handleChangeIngredientState}
|
|
534
|
-
isSoldOut={isSoldOut}
|
|
535
523
|
/>
|
|
536
524
|
))}
|
|
537
525
|
</WrapperIngredients>
|
|
@@ -569,7 +557,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
569
557
|
return (
|
|
570
558
|
<ProductOptionSubOption
|
|
571
559
|
key={suboption.id}
|
|
572
|
-
isSoldOut={isSoldOut}
|
|
573
560
|
onChange={
|
|
574
561
|
handleChangeSuboptionState
|
|
575
562
|
}
|
|
@@ -603,7 +590,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
603
590
|
{t('INGREDIENTS', 'Ingredients')}
|
|
604
591
|
</OText>
|
|
605
592
|
</SectionTitle>
|
|
606
|
-
<WrapperIngredients
|
|
593
|
+
<WrapperIngredients
|
|
594
|
+
style={{
|
|
595
|
+
backgroundColor:
|
|
596
|
+
isSoldOut || maxProductQuantity <= 0
|
|
597
|
+
? 'hsl(0, 0%, 72%)'
|
|
598
|
+
: theme.colors.white,
|
|
599
|
+
}}>
|
|
607
600
|
{product?.ingredients.map((ingredient: any) => (
|
|
608
601
|
<ProductIngredient
|
|
609
602
|
key={ingredient.id}
|
|
@@ -612,7 +605,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
612
605
|
productCart.ingredients[`id:${ingredient.id}`]
|
|
613
606
|
}
|
|
614
607
|
onChange={handleChangeIngredientState}
|
|
615
|
-
isSoldOut={isSoldOut}
|
|
616
608
|
/>
|
|
617
609
|
))}
|
|
618
610
|
</WrapperIngredients>
|
|
@@ -745,10 +737,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
745
737
|
<OText
|
|
746
738
|
size={12}
|
|
747
739
|
lineHeight={18}
|
|
748
|
-
style={{ minWidth: 29, textAlign: 'center' }}
|
|
749
|
-
|
|
750
|
-
{qtyBy?.pieces && productCart.quantity}
|
|
751
|
-
{qtyBy?.weight_unit && productCart.quantity * product?.weight}
|
|
740
|
+
style={{ minWidth: 29, textAlign: 'center' }}>
|
|
741
|
+
{productCart.quantity}
|
|
752
742
|
</OText>
|
|
753
743
|
<TouchableOpacity
|
|
754
744
|
onPress={increment}
|
|
@@ -769,36 +759,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
769
759
|
}
|
|
770
760
|
/>
|
|
771
761
|
</TouchableOpacity>
|
|
772
|
-
<WeightUnitSwitch>
|
|
773
|
-
<TouchableOpacity
|
|
774
|
-
onPress={() => handleSwitchQtyUnit('pieces')}
|
|
775
|
-
>
|
|
776
|
-
<WeightUnitItem active={qtyBy?.pieces}>
|
|
777
|
-
<OText
|
|
778
|
-
size={12}
|
|
779
|
-
lineHeight={18}
|
|
780
|
-
color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
|
|
781
|
-
>
|
|
782
|
-
{t('PIECES', 'pieces')}
|
|
783
|
-
</OText>
|
|
784
|
-
</WeightUnitItem>
|
|
785
|
-
</TouchableOpacity>
|
|
786
|
-
<View style={{ alignItems: 'flex-start' }}>
|
|
787
|
-
<TouchableOpacity
|
|
788
|
-
onPress={() => handleSwitchQtyUnit('weight_unit')}
|
|
789
|
-
>
|
|
790
|
-
<WeightUnitItem active={qtyBy?.weight_unit}>
|
|
791
|
-
<OText
|
|
792
|
-
size={12}
|
|
793
|
-
lineHeight={18}
|
|
794
|
-
color={qtyBy?.weight_unit ? theme.colors.primary : theme.colors.textNormal}
|
|
795
|
-
>
|
|
796
|
-
{product?.weight_unit}
|
|
797
|
-
</OText>
|
|
798
|
-
</WeightUnitItem>
|
|
799
|
-
</TouchableOpacity>
|
|
800
|
-
</View>
|
|
801
|
-
</WeightUnitSwitch>
|
|
802
762
|
</View>
|
|
803
763
|
)}
|
|
804
764
|
<View
|
|
@@ -78,15 +78,3 @@ export const ProductActions = styled.View`
|
|
|
78
78
|
export const ExtraOptionWrap = styled.ScrollView`
|
|
79
79
|
margin-horizontal: -40px;
|
|
80
80
|
`;
|
|
81
|
-
|
|
82
|
-
export const WeightUnitSwitch = styled.View`
|
|
83
|
-
margin-left: 10px;
|
|
84
|
-
`
|
|
85
|
-
export const WeightUnitItem = styled.View`
|
|
86
|
-
padding: 1px 5px;
|
|
87
|
-
border-radius: 4px;
|
|
88
|
-
|
|
89
|
-
${({ active }: any) => active && css`
|
|
90
|
-
background-color: ${(props: any) => props.theme.colors.primary}20;
|
|
91
|
-
`}
|
|
92
|
-
`
|
|
@@ -10,19 +10,18 @@ const ProductIngredientUI = (props: any) => {
|
|
|
10
10
|
const {
|
|
11
11
|
state,
|
|
12
12
|
ingredient,
|
|
13
|
-
toggleSelect
|
|
14
|
-
isSoldOut
|
|
13
|
+
toggleSelect
|
|
15
14
|
} = props
|
|
16
15
|
|
|
17
16
|
const theme = useTheme();
|
|
18
17
|
|
|
19
18
|
return (
|
|
20
|
-
<Container
|
|
19
|
+
<Container onPress={() => toggleSelect()}>
|
|
21
20
|
<View>
|
|
22
|
-
{state?.selected
|
|
21
|
+
{state?.selected ? (
|
|
23
22
|
<MaterialCommunityIcon name='checkbox-marked' color={theme.colors.primary} size={24} />
|
|
24
23
|
) : (
|
|
25
|
-
<MaterialCommunityIcon name='checkbox-blank-outline' color=
|
|
24
|
+
<MaterialCommunityIcon name='checkbox-blank-outline' color={theme.colors.backgroundDark} size={24} />
|
|
26
25
|
)}
|
|
27
26
|
</View>
|
|
28
27
|
<OText mLeft={10}>
|
|
@@ -53,8 +53,8 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
53
53
|
const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
|
-
<Container>
|
|
57
|
-
<IconControl
|
|
56
|
+
<Container disabled={disabled}>
|
|
57
|
+
<IconControl onPress={() => handleSuboptionClick()}>
|
|
58
58
|
{((option?.min === 0 && option?.max === 1) || option?.max > 1) ? (
|
|
59
59
|
state?.selected ? (
|
|
60
60
|
<OIcon src={theme.images.general.check_act} color={theme.colors.primary} width={16} />
|
|
@@ -75,28 +75,28 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
75
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
76
|
{option?.allow_suboption_quantity && state?.selected && (
|
|
77
77
|
<QuantityControl>
|
|
78
|
-
<Checkbox disabled={
|
|
78
|
+
<Checkbox disabled={state.quantity === 0} onPress={decrement}>
|
|
79
79
|
<OIcon
|
|
80
80
|
src={theme.images.general.minus}
|
|
81
81
|
width={16}
|
|
82
|
-
color={state.quantity === 0
|
|
82
|
+
color={state.quantity === 0 ? theme.colors.disabled : theme.colors.primary}
|
|
83
83
|
/>
|
|
84
84
|
</Checkbox>
|
|
85
85
|
<OText mLeft={5} mRight={5}>
|
|
86
86
|
{state.quantity}
|
|
87
87
|
</OText>
|
|
88
|
-
<Checkbox disabled={
|
|
88
|
+
<Checkbox disabled={disableIncrement} onPress={increment}>
|
|
89
89
|
<OIcon
|
|
90
90
|
src={theme.images.general.plus}
|
|
91
91
|
width={16}
|
|
92
|
-
color={disableIncrement
|
|
92
|
+
color={disableIncrement ? theme.colors.disabled : theme.colors.primary}
|
|
93
93
|
/>
|
|
94
94
|
</Checkbox>
|
|
95
95
|
</QuantityControl>
|
|
96
96
|
)}
|
|
97
97
|
{option?.with_half_option && state?.selected && (
|
|
98
98
|
<PositionControl>
|
|
99
|
-
<Circle
|
|
99
|
+
<Circle onPress={() => changePosition('left')}>
|
|
100
100
|
<OIcon
|
|
101
101
|
src={theme.images.general.half_l}
|
|
102
102
|
color={state.selected && state.position === 'left' ? theme.colors.primary : '#cbcbcb'}
|
|
@@ -104,14 +104,14 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
104
104
|
style={styles.inverse}
|
|
105
105
|
/>
|
|
106
106
|
</Circle>
|
|
107
|
-
<Circle
|
|
107
|
+
<Circle onPress={() => changePosition('whole')}>
|
|
108
108
|
<OIcon
|
|
109
109
|
src={theme.images.general.half_f}
|
|
110
110
|
color={state.selected && state.position === 'whole' ? theme.colors.primary : '#cbcbcb'}
|
|
111
111
|
width={16}
|
|
112
112
|
/>
|
|
113
113
|
</Circle>
|
|
114
|
-
<Circle
|
|
114
|
+
<Circle onPress={() => changePosition('right')}>
|
|
115
115
|
<OIcon
|
|
116
116
|
src={theme.images.general.half_r}
|
|
117
117
|
color={state.selected && state.position === 'right' ? theme.colors.primary : '#cbcbcb'}
|