ordering-ui-react-native 0.12.5 → 0.12.9
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/BusinessBasicInformation/index.tsx +14 -8
- package/src/components/PreviousOrders/index.tsx +21 -9
- package/src/components/ProductItemAccordion/index.tsx +1 -1
- package/themes/instacart/src/components/BusinessProductsList/index.tsx +38 -30
- package/themes/instacart/src/components/BusinessProductsListing/index.tsx +44 -3
- package/themes/instacart/src/components/BusinessProductsListing/styles.tsx +1 -1
- package/themes/instacart/src/types/index.tsx +1 -0
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +2 -2
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +2 -2
- package/themes/kiosk/src/components/NavBar/index.tsx +3 -2
- package/themes/kiosk/src/components/OrderDetails/index.tsx +8 -2
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +1 -1
- package/themes/single-business/index.tsx +4 -0
- package/themes/single-business/src/components/AddressForm/index.tsx +39 -44
- package/themes/single-business/src/components/BusinessInformation/styles.tsx +1 -1
- package/themes/single-business/src/components/Cart/index.tsx +301 -234
- package/themes/single-business/src/components/Cart/styles.tsx +34 -0
- package/themes/single-business/src/components/Messages/index.tsx +4 -4
- package/themes/single-business/src/components/Messages/styles.tsx +1 -1
- package/themes/single-business/src/components/PromotionCard/index.tsx +103 -0
- package/themes/single-business/src/components/PromotionCard/styles.tsx +28 -0
- package/themes/single-business/src/components/Promotions/index.tsx +78 -0
- package/themes/single-business/src/components/Promotions/styles.tsx +3 -0
- package/themes/single-business/src/components/UpsellingProducts/styles.tsx +2 -1
- package/themes/uber-eats/src/components/BusinessController/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessProductsCategories/index.tsx +77 -9
- package/themes/uber-eats/src/components/BusinessProductsList/index.tsx +56 -10
- package/themes/uber-eats/src/components/BusinessProductsListing/index.tsx +50 -9
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +4 -0
- package/themes/uber-eats/src/components/HighestRatedBusinesses/index.tsx +132 -0
- package/themes/uber-eats/src/components/HighestRatedBusinesses/styles.tsx +6 -0
- package/themes/uber-eats/src/components/Messages/index.tsx +1 -1
- package/themes/uber-eats/src/components/OrderDetails/index.tsx +4 -2
- package/themes/uber-eats/src/types/index.tsx +12 -1
|
@@ -1,266 +1,333 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
Cart as CartController,
|
|
4
|
+
useOrder,
|
|
5
|
+
useLanguage,
|
|
6
|
+
useConfig,
|
|
7
|
+
useUtils,
|
|
8
|
+
useValidationFields,
|
|
9
9
|
} from 'ordering-components/native';
|
|
10
10
|
import { useTheme } from 'styled-components/native';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
import { ScrollView, View, useWindowDimensions } from 'react-native';
|
|
12
|
+
import {
|
|
13
|
+
CheckoutAction,
|
|
14
|
+
OSBill,
|
|
15
|
+
OSTable,
|
|
16
|
+
OSCoupon,
|
|
17
|
+
OSTotal,
|
|
18
|
+
Title,
|
|
19
|
+
LineDivider
|
|
20
|
+
} from './styles';
|
|
14
21
|
|
|
15
22
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
16
|
-
import { BusinessItemAccordion } from '../BusinessItemAccordion';
|
|
17
23
|
import { CouponControl } from '../CouponControl';
|
|
18
24
|
|
|
19
25
|
import { OButton, OModal, OText } from '../shared';
|
|
20
26
|
import { ProductForm } from '../ProductForm';
|
|
21
27
|
import { UpsellingProducts } from '../UpsellingProducts';
|
|
22
28
|
import { verifyDecimals } from '../../utils';
|
|
29
|
+
import { Container } from '../../layouts/Container';
|
|
30
|
+
import { NotFoundSource } from '../NotFoundSource'
|
|
23
31
|
|
|
24
32
|
const CartUI = (props: any) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} = props
|
|
36
|
-
|
|
37
|
-
const theme = useTheme();
|
|
38
|
-
|
|
39
|
-
const [, t] = useLanguage()
|
|
40
|
-
const [orderState] = useOrder()
|
|
41
|
-
const [{ configs }] = useConfig();
|
|
42
|
-
const [{ parsePrice, parseNumber, parseDate }] = useUtils()
|
|
43
|
-
const [validationFields] = useValidationFields()
|
|
33
|
+
const {
|
|
34
|
+
cart,
|
|
35
|
+
clearCart,
|
|
36
|
+
changeQuantity,
|
|
37
|
+
getProductMax,
|
|
38
|
+
offsetDisabled,
|
|
39
|
+
removeProduct,
|
|
40
|
+
handleCartOpen,
|
|
41
|
+
setIsCartsLoading,
|
|
42
|
+
} = props
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const [openUpselling, setOpenUpselling] = useState(false)
|
|
48
|
-
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
44
|
+
const theme = useTheme();
|
|
45
|
+
const { height } = useWindowDimensions()
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
const [, t] = useLanguage()
|
|
48
|
+
const [orderState] = useOrder()
|
|
49
|
+
const [{ configs }] = useConfig();
|
|
50
|
+
const [{ parsePrice, parseNumber, parseDate }] = useUtils()
|
|
51
|
+
const [validationFields] = useValidationFields()
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const [openProduct, setModalIsOpen] = useState(false)
|
|
54
|
+
const [curProduct, setCurProduct] = useState<any>(null)
|
|
55
|
+
const [openUpselling, setOpenUpselling] = useState(false)
|
|
56
|
+
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
58
|
+
const isCartPending = cart?.status === 2
|
|
59
|
+
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
61
|
+
const handleDeleteClick = (product: any) => {
|
|
62
|
+
removeProduct(product, cart)
|
|
63
|
+
}
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
65
|
+
const handleEditProduct = (product: any) => {
|
|
66
|
+
setCurProduct(product)
|
|
67
|
+
setModalIsOpen(true)
|
|
68
|
+
}
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} catch (error) {
|
|
78
|
-
setIsCartsLoading && setIsCartsLoading(false)
|
|
79
|
-
}
|
|
80
|
-
}
|
|
70
|
+
const handlerProductAction = (product: any) => {
|
|
71
|
+
if (Object.keys(product).length) {
|
|
72
|
+
setModalIsOpen(false)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
81
75
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
})
|
|
92
|
-
}
|
|
76
|
+
// const handleClearProducts = async () => {
|
|
77
|
+
// try {
|
|
78
|
+
// setIsCartsLoading && setIsCartsLoading(true)
|
|
79
|
+
// const result = await clearCart(cart?.uuid)
|
|
80
|
+
// setIsCartsLoading && setIsCartsLoading(false)
|
|
81
|
+
// } catch (error) {
|
|
82
|
+
// setIsCartsLoading && setIsCartsLoading(false)
|
|
83
|
+
// }
|
|
84
|
+
// }
|
|
93
85
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
key={product.code}
|
|
106
|
-
isCartPending={isCartPending}
|
|
107
|
-
isCartProduct
|
|
108
|
-
product={product}
|
|
109
|
-
changeQuantity={changeQuantity}
|
|
110
|
-
getProductMax={getProductMax}
|
|
111
|
-
offsetDisabled={offsetDisabled}
|
|
112
|
-
onDeleteProduct={handleDeleteClick}
|
|
113
|
-
onEditProduct={handleEditProduct}
|
|
114
|
-
/>
|
|
115
|
-
))}
|
|
86
|
+
const handleUpsellingPage = () => {
|
|
87
|
+
setOpenUpselling(false)
|
|
88
|
+
setCanOpenUpselling(false)
|
|
89
|
+
props.onNavigationRedirect('CheckoutNavigator', {
|
|
90
|
+
screen: 'CheckoutPage',
|
|
91
|
+
cartUuid: cart?.uuid,
|
|
92
|
+
businessLogo: cart?.business?.logo,
|
|
93
|
+
businessName: cart?.business?.name,
|
|
94
|
+
cartTotal: cart?.total
|
|
95
|
+
})
|
|
96
|
+
}
|
|
116
97
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
<OText size={12} lineHeight={18}>{`(${verifyDecimals(cart?.discount_rate, parsePrice)}%)`}</OText>
|
|
133
|
-
</OText>
|
|
134
|
-
) : (
|
|
135
|
-
<OText size={12} lineHeight={18}>{t('DISCOUNT', 'Discount')}</OText>
|
|
136
|
-
)}
|
|
137
|
-
<OText size={12} lineHeight={18}>- {parsePrice(cart?.discount || 0)}</OText>
|
|
138
|
-
</OSTable>
|
|
139
|
-
)}
|
|
140
|
-
{cart.business.tax_type !== 1 && (
|
|
141
|
-
<OSTable>
|
|
142
|
-
<OText size={12} lineHeight={18}>
|
|
143
|
-
{t('TAX', 'Tax')}
|
|
144
|
-
{`(${verifyDecimals(cart?.business?.tax, parseNumber)}%)`}
|
|
145
|
-
</OText>
|
|
146
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.tax || 0)}</OText>
|
|
147
|
-
</OSTable>
|
|
148
|
-
)}
|
|
149
|
-
{orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
|
|
150
|
-
<OSTable>
|
|
151
|
-
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
152
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
|
|
153
|
-
</OSTable>
|
|
154
|
-
)}
|
|
155
|
-
{cart?.driver_tip > 0 && (
|
|
156
|
-
<OSTable>
|
|
157
|
-
<OText size={12} lineHeight={18}>
|
|
158
|
-
{t('DRIVER_TIP', 'Driver tip')}
|
|
159
|
-
{cart?.driver_tip_rate > 0 &&
|
|
160
|
-
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
161
|
-
!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
162
|
-
(
|
|
163
|
-
`(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
|
|
164
|
-
)}
|
|
165
|
-
</OText>
|
|
166
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.driver_tip)}</OText>
|
|
167
|
-
</OSTable>
|
|
168
|
-
)}
|
|
169
|
-
{cart?.service_fee > 0 && (
|
|
170
|
-
<OSTable>
|
|
171
|
-
<OText size={12} lineHeight={18}>
|
|
172
|
-
{t('SERVICE_FEE', 'Service Fee')}
|
|
173
|
-
{`(${verifyDecimals(cart?.business?.service_fee, parseNumber)}%)`}
|
|
174
|
-
</OText>
|
|
175
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.service_fee)}</OText>
|
|
176
|
-
</OSTable>
|
|
177
|
-
)}
|
|
178
|
-
{isCouponEnabled && !isCartPending && (
|
|
179
|
-
<OSTable>
|
|
180
|
-
<OSCoupon>
|
|
181
|
-
<CouponControl
|
|
182
|
-
businessId={cart.business_id}
|
|
183
|
-
price={cart.total}
|
|
184
|
-
/>
|
|
185
|
-
</OSCoupon>
|
|
186
|
-
</OSTable>
|
|
187
|
-
)}
|
|
98
|
+
return (
|
|
99
|
+
cart?.products?.length > 0 ? (
|
|
100
|
+
<ScrollView
|
|
101
|
+
showsVerticalScrollIndicator={false}
|
|
102
|
+
showsHorizontalScrollIndicator={false}
|
|
103
|
+
>
|
|
104
|
+
<Container>
|
|
105
|
+
<Title>
|
|
106
|
+
<OText
|
|
107
|
+
size={20}
|
|
108
|
+
weight='bold'
|
|
109
|
+
>
|
|
110
|
+
{t('YOUR_CART', 'Your cart')}
|
|
111
|
+
</OText>
|
|
112
|
+
</Title>
|
|
188
113
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
114
|
+
{cart?.products?.length > 0 && (
|
|
115
|
+
<View>
|
|
116
|
+
{cart?.products?.map((product: any) => (
|
|
117
|
+
<ProductItemAccordion
|
|
118
|
+
key={product.code}
|
|
119
|
+
isCartPending={isCartPending}
|
|
120
|
+
isCartProduct
|
|
121
|
+
product={product}
|
|
122
|
+
changeQuantity={changeQuantity}
|
|
123
|
+
getProductMax={getProductMax}
|
|
124
|
+
offsetDisabled={offsetDisabled}
|
|
125
|
+
onDeleteProduct={handleDeleteClick}
|
|
126
|
+
onEditProduct={handleEditProduct}
|
|
127
|
+
/>
|
|
128
|
+
))}
|
|
129
|
+
|
|
130
|
+
{cart?.valid_products && (
|
|
131
|
+
<OSBill>
|
|
132
|
+
<OSTable>
|
|
133
|
+
<OText size={12} lineHeight={18}>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
134
|
+
<OText size={12} lineHeight={18}>
|
|
135
|
+
{cart.business.tax_type === 1
|
|
136
|
+
? parsePrice((cart?.subtotal + cart?.tax) || 0)
|
|
137
|
+
: parsePrice(cart?.subtotal || 0)}
|
|
138
|
+
</OText>
|
|
139
|
+
</OSTable>
|
|
140
|
+
{cart?.discount > 0 && cart?.total >= 0 && (
|
|
141
|
+
<OSTable>
|
|
142
|
+
{cart?.discount_type === 1 ? (
|
|
143
|
+
<OText size={12} lineHeight={18}>
|
|
144
|
+
{t('DISCOUNT', 'Discount')}
|
|
145
|
+
<OText size={12} lineHeight={18}>{`(${verifyDecimals(cart?.discount_rate, parsePrice)}%)`}</OText>
|
|
146
|
+
</OText>
|
|
147
|
+
) : (
|
|
148
|
+
<OText size={12} lineHeight={18}>{t('DISCOUNT', 'Discount')}</OText>
|
|
149
|
+
)}
|
|
150
|
+
<OText size={12} lineHeight={18}>- {parsePrice(cart?.discount || 0)}</OText>
|
|
151
|
+
</OSTable>
|
|
152
|
+
)}
|
|
153
|
+
{cart.business.tax_type !== 1 && (
|
|
154
|
+
<OSTable>
|
|
155
|
+
<OText size={12} lineHeight={18}>
|
|
156
|
+
{t('TAX', 'Tax')}
|
|
157
|
+
{`(${verifyDecimals(cart?.business?.tax, parseNumber)}%)`}
|
|
158
|
+
</OText>
|
|
159
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.tax || 0)}</OText>
|
|
160
|
+
</OSTable>
|
|
161
|
+
)}
|
|
162
|
+
{orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
|
|
163
|
+
<OSTable>
|
|
164
|
+
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
165
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
|
|
166
|
+
</OSTable>
|
|
167
|
+
)}
|
|
168
|
+
{cart?.driver_tip > 0 && (
|
|
169
|
+
<OSTable>
|
|
170
|
+
<OText size={12} lineHeight={18}>
|
|
171
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
172
|
+
{cart?.driver_tip_rate > 0 &&
|
|
173
|
+
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
174
|
+
!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
175
|
+
(
|
|
176
|
+
`(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
|
|
177
|
+
)}
|
|
178
|
+
</OText>
|
|
179
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.driver_tip)}</OText>
|
|
180
|
+
</OSTable>
|
|
181
|
+
)}
|
|
182
|
+
{cart?.service_fee > 0 && (
|
|
183
|
+
<OSTable>
|
|
184
|
+
<OText size={12} lineHeight={18}>
|
|
185
|
+
{t('SERVICE_FEE', 'Service Fee')}
|
|
186
|
+
{`(${verifyDecimals(cart?.business?.service_fee, parseNumber)}%)`}
|
|
187
|
+
</OText>
|
|
188
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.service_fee)}</OText>
|
|
189
|
+
</OSTable>
|
|
190
|
+
)}
|
|
191
|
+
{isCouponEnabled && !isCartPending && (
|
|
192
|
+
<OSTable>
|
|
193
|
+
<OSCoupon>
|
|
194
|
+
<CouponControl
|
|
195
|
+
businessId={cart.business_id}
|
|
196
|
+
price={cart.total}
|
|
197
|
+
/>
|
|
198
|
+
</OSCoupon>
|
|
199
|
+
</OSTable>
|
|
200
|
+
)}
|
|
201
|
+
|
|
202
|
+
<OSTotal>
|
|
203
|
+
<OSTable style={{ marginTop: 15 }}>
|
|
204
|
+
<OText size={14} lineHeight={21} weight={'600'}>
|
|
205
|
+
{t('TOTAL', 'Total')}
|
|
206
|
+
</OText>
|
|
207
|
+
<OText size={14} lineHeight={21} weight={'600'}>
|
|
208
|
+
{cart?.total >= 1 && parsePrice(cart?.total)}
|
|
209
|
+
</OText>
|
|
210
|
+
</OSTable>
|
|
211
|
+
</OSTotal>
|
|
212
|
+
</OSBill>
|
|
213
|
+
)}
|
|
214
|
+
</View>
|
|
215
|
+
)}
|
|
216
|
+
</Container>
|
|
238
217
|
|
|
239
|
-
|
|
218
|
+
{cart?.products?.length > 0 && (
|
|
219
|
+
<>
|
|
220
|
+
<LineDivider />
|
|
221
|
+
|
|
222
|
+
<Container>
|
|
223
|
+
<ScrollView
|
|
224
|
+
showsVerticalScrollIndicator={false}
|
|
225
|
+
showsHorizontalScrollIndicator={false}
|
|
226
|
+
>
|
|
227
|
+
<View
|
|
228
|
+
style={{
|
|
229
|
+
paddingTop: 20,
|
|
230
|
+
overflow: 'visible'
|
|
231
|
+
}}
|
|
232
|
+
>
|
|
233
|
+
<OText
|
|
234
|
+
size={16}
|
|
235
|
+
lineHeight={24}
|
|
236
|
+
weight={'500'}
|
|
237
|
+
>
|
|
238
|
+
{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}
|
|
239
|
+
</OText>
|
|
240
|
+
<UpsellingProducts
|
|
241
|
+
isCustomMode
|
|
242
|
+
openUpselling={openUpselling}
|
|
243
|
+
businessId={cart?.business_id}
|
|
244
|
+
business={cart?.business}
|
|
245
|
+
cartProducts={cart?.products}
|
|
246
|
+
canOpenUpselling={canOpenUpselling}
|
|
247
|
+
setCanOpenUpselling={setCanOpenUpselling}
|
|
248
|
+
handleUpsellingPage={handleUpsellingPage}
|
|
249
|
+
handleCloseUpsellingPage={() => { }}
|
|
250
|
+
/>
|
|
251
|
+
</View>
|
|
252
|
+
</ScrollView>
|
|
253
|
+
|
|
254
|
+
{cart?.valid_products && (
|
|
255
|
+
<CheckoutAction>
|
|
256
|
+
<OButton
|
|
257
|
+
text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
|
|
258
|
+
!openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
|
|
259
|
+
) : !cart?.valid_address ? (
|
|
260
|
+
`${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
|
|
261
|
+
) : (
|
|
262
|
+
`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
|
|
263
|
+
)}
|
|
264
|
+
bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
265
|
+
isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
|
|
266
|
+
borderColor={theme.colors.primary}
|
|
267
|
+
imgRightSrc={null}
|
|
268
|
+
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
269
|
+
onClick={() => props.onNavigationRedirect('CheckoutNavigator', {
|
|
270
|
+
screen: 'CheckoutPage',
|
|
271
|
+
cartUuid: cart?.uuid,
|
|
272
|
+
businessLogo: cart?.business?.logo,
|
|
273
|
+
businessName: cart?.business?.name,
|
|
274
|
+
cartTotal: cart?.total
|
|
275
|
+
})}
|
|
276
|
+
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
277
|
+
/>
|
|
278
|
+
</CheckoutAction>
|
|
279
|
+
)}
|
|
280
|
+
</Container>
|
|
281
|
+
</>
|
|
282
|
+
)}
|
|
240
283
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
284
|
+
<OModal
|
|
285
|
+
open={openProduct}
|
|
286
|
+
entireModal
|
|
287
|
+
customClose
|
|
288
|
+
onClose={() => setModalIsOpen(false)}
|
|
289
|
+
>
|
|
290
|
+
<ProductForm
|
|
291
|
+
isCartProduct
|
|
292
|
+
productCart={curProduct}
|
|
293
|
+
businessSlug={cart?.business?.slug}
|
|
294
|
+
businessId={cart?.business_id}
|
|
295
|
+
categoryId={curProduct?.category_id}
|
|
296
|
+
productId={curProduct?.id}
|
|
297
|
+
onSave={handlerProductAction}
|
|
298
|
+
onClose={() => setModalIsOpen(false)}
|
|
299
|
+
/>
|
|
300
|
+
|
|
301
|
+
</OModal>
|
|
302
|
+
</ScrollView>
|
|
303
|
+
) : (
|
|
304
|
+
<Container>
|
|
305
|
+
<Title>
|
|
306
|
+
<OText
|
|
307
|
+
size={20}
|
|
308
|
+
weight='bold'
|
|
309
|
+
>
|
|
310
|
+
{t('YOUR_CART', 'Your cart')}
|
|
311
|
+
</OText>
|
|
312
|
+
</Title>
|
|
313
|
+
<View style={{ height: height * 0.7, justifyContent: 'center' }}>
|
|
314
|
+
<NotFoundSource
|
|
315
|
+
content={t('NO_PRODUCTS_FOUND', 'Sorry, no products found')}
|
|
316
|
+
image={theme.images.general.notFound}
|
|
317
|
+
/>
|
|
318
|
+
</View>
|
|
319
|
+
</Container>
|
|
320
|
+
)
|
|
321
|
+
)
|
|
255
322
|
}
|
|
256
323
|
|
|
257
324
|
export const Cart = (props: any) => {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
325
|
+
const cartProps = {
|
|
326
|
+
...props,
|
|
327
|
+
UIComponent: CartUI
|
|
328
|
+
}
|
|
262
329
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
330
|
+
return (
|
|
331
|
+
<CartController {...cartProps} />
|
|
332
|
+
)
|
|
266
333
|
}
|
|
@@ -4,6 +4,15 @@ export const CContainer = styled.View`
|
|
|
4
4
|
/* border-bottom: 1px solid #F0F0F0; */
|
|
5
5
|
`
|
|
6
6
|
|
|
7
|
+
export const Title = styled.View`
|
|
8
|
+
margin: 20px 0;
|
|
9
|
+
`
|
|
10
|
+
|
|
11
|
+
export const LineDivider = styled.View`
|
|
12
|
+
height: 8px;
|
|
13
|
+
background-color: ${(props: any) => props.theme.colors.backgroundGray100};
|
|
14
|
+
`
|
|
15
|
+
|
|
7
16
|
export const OrderBill = styled.View`
|
|
8
17
|
display: flex;
|
|
9
18
|
align-items: center;
|
|
@@ -26,3 +35,28 @@ export const CheckoutAction = styled.View`
|
|
|
26
35
|
margin-top: 10px;
|
|
27
36
|
margin-bottom: 10px;
|
|
28
37
|
`
|
|
38
|
+
|
|
39
|
+
export const OSBill = styled.View`
|
|
40
|
+
padding: 14px 0px 20px;
|
|
41
|
+
border-top-width: 1px;
|
|
42
|
+
border-top-color: ${(props: any) => props.theme.colors.border};
|
|
43
|
+
margin-top: 20px;
|
|
44
|
+
`
|
|
45
|
+
|
|
46
|
+
export const OSTable = styled.View`
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
justify-content: space-between;
|
|
49
|
+
align-items: center;
|
|
50
|
+
padding-vertical: 5px;
|
|
51
|
+
`
|
|
52
|
+
|
|
53
|
+
export const OSTotal = styled.View`
|
|
54
|
+
border-top-width: 1px;
|
|
55
|
+
border-top-color: #d9d9d9;
|
|
56
|
+
margin-top: 15px;
|
|
57
|
+
`
|
|
58
|
+
|
|
59
|
+
export const OSCoupon = styled.View`
|
|
60
|
+
width: 100%;
|
|
61
|
+
padding: 5px 0px;
|
|
62
|
+
`
|
|
@@ -172,7 +172,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
172
172
|
)
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
const renderInputToolbar = (props:
|
|
175
|
+
const renderInputToolbar = (props: any) => (
|
|
176
176
|
<InputToolbar
|
|
177
177
|
{...props}
|
|
178
178
|
containerStyle={{
|
|
@@ -183,7 +183,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
183
183
|
/>
|
|
184
184
|
)
|
|
185
185
|
|
|
186
|
-
const renderComposer = (props:
|
|
186
|
+
const renderComposer = (props: any) => (
|
|
187
187
|
<View style={{
|
|
188
188
|
flexDirection: 'row', width: '80%', alignItems: 'center', backgroundColor: theme.colors.backgroundGray100,
|
|
189
189
|
borderRadius: 7.6,
|
|
@@ -274,10 +274,10 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
274
274
|
)
|
|
275
275
|
|
|
276
276
|
return (
|
|
277
|
-
<View style={{ height:
|
|
277
|
+
<View style={{ height: '100%', width: '100%' }}>
|
|
278
278
|
<Wrapper>
|
|
279
279
|
<Header>
|
|
280
|
-
<OIconButton icon={theme.images.general.arrow_left} style={{
|
|
280
|
+
<OIconButton icon={theme.images.general.arrow_left} style={{ borderColor: theme.colors.clear }} onClick={onClose} />
|
|
281
281
|
<View style={{ marginRight: 10, shadowColor: theme.colors.black, shadowOpacity: 0.1, shadowOffset: { width: 0, height: 1 }, shadowRadius: 2 }}>
|
|
282
282
|
<OIcon
|
|
283
283
|
url={type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo}
|
|
@@ -8,11 +8,11 @@ export const Wrapper = styled.View`
|
|
|
8
8
|
export const Header = styled.View`
|
|
9
9
|
flex-direction: row;
|
|
10
10
|
align-items: center;
|
|
11
|
+
justify-content: flex-start;
|
|
11
12
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
12
13
|
box-shadow: 0 2px 2px #0000001A;
|
|
13
14
|
padding-bottom: 10px;
|
|
14
15
|
padding-top: 14px;
|
|
15
|
-
padding-horizontal: 30px;
|
|
16
16
|
`
|
|
17
17
|
|
|
18
18
|
export const TitleHeader = styled.View`
|