ordering-ui-react-native 0.12.57 → 0.12.61
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/AppleLogin/index.tsx +14 -8
- package/themes/doordash/src/components/Cart/index.tsx +1 -0
- package/themes/doordash/src/components/LastOrders/index.tsx +1 -1
- package/themes/doordash/src/components/OrderSummary/index.tsx +1 -0
- package/themes/instacart/src/components/OrderDetails/index.tsx +2 -2
- package/themes/single-business/src/components/Cart/index.tsx +127 -16
- 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/single-business/src/components/OrderDetails/index.tsx +724 -708
- package/themes/single-business/src/components/OrderSummary/index.tsx +189 -154
- 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,332 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Cart as CartController,
|
|
4
|
-
useOrder,
|
|
5
|
-
useLanguage,
|
|
6
|
-
useConfig,
|
|
7
|
-
useUtils,
|
|
8
|
-
useValidationFields,
|
|
9
|
-
} from 'ordering-components/native';
|
|
10
|
-
import { useTheme } from 'styled-components/native';
|
|
11
|
-
import { CContainer, CheckoutAction } from './styles';
|
|
12
|
-
|
|
13
|
-
import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from '../OrderSummary/styles';
|
|
14
|
-
|
|
15
|
-
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
16
|
-
import { BusinessItemAccordion } from '../BusinessItemAccordion';
|
|
17
|
-
import { CouponControl } from '../CouponControl';
|
|
18
|
-
|
|
19
|
-
import { OButton, OInput, OModal, OText } from '../shared';
|
|
20
|
-
import { ProductForm } from '../ProductForm';
|
|
21
|
-
import { UpsellingProducts } from '../UpsellingProducts';
|
|
22
|
-
import { verifyDecimals } from '../../utils';
|
|
23
|
-
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
24
|
-
import { TaxInformation } from '../TaxInformation';
|
|
25
|
-
import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
|
|
26
|
-
|
|
27
|
-
const CartUI = (props: any) => {
|
|
28
|
-
const {
|
|
29
|
-
cart,
|
|
30
|
-
clearCart,
|
|
31
|
-
changeQuantity,
|
|
32
|
-
getProductMax,
|
|
33
|
-
offsetDisabled,
|
|
34
|
-
removeProduct,
|
|
35
|
-
handleCartOpen,
|
|
36
|
-
setIsCartsLoading,
|
|
37
|
-
handleChangeComment,
|
|
38
|
-
commentState
|
|
39
|
-
// isFromCart
|
|
40
|
-
} = props
|
|
41
|
-
|
|
42
|
-
const theme = useTheme();
|
|
43
|
-
|
|
44
|
-
const [, t] = useLanguage()
|
|
45
|
-
const [orderState] = useOrder()
|
|
46
|
-
const [{ configs }] = useConfig();
|
|
47
|
-
const [{ parsePrice, parseNumber, parseDate }] = useUtils()
|
|
48
|
-
const [validationFields] = useValidationFields()
|
|
49
|
-
|
|
50
|
-
const [openProduct, setModalIsOpen] = useState(false)
|
|
51
|
-
const [curProduct, setCurProduct] = useState<any>(null)
|
|
52
|
-
const [openUpselling, setOpenUpselling] = useState(false)
|
|
53
|
-
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
54
|
-
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null })
|
|
55
|
-
|
|
56
|
-
const isCartPending = cart?.status === 2
|
|
57
|
-
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
|
|
58
|
-
|
|
59
|
-
const momentFormatted = !orderState?.option?.moment
|
|
60
|
-
? t('RIGHT_NOW', 'Right Now')
|
|
61
|
-
: parseDate(orderState?.option?.moment, { outputFormat: 'YYYY-MM-DD HH:mm' })
|
|
62
|
-
|
|
63
|
-
const handleDeleteClick = (product: any) => {
|
|
64
|
-
removeProduct(product, cart)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const handleEditProduct = (product: any) => {
|
|
68
|
-
setCurProduct(product)
|
|
69
|
-
setModalIsOpen(true)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const handlerProductAction = (product: any) => {
|
|
73
|
-
if (Object.keys(product).length) {
|
|
74
|
-
setModalIsOpen(false)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const handleClearProducts = async () => {
|
|
79
|
-
try {
|
|
80
|
-
setIsCartsLoading && setIsCartsLoading(true)
|
|
81
|
-
const result = await clearCart(cart?.uuid)
|
|
82
|
-
setIsCartsLoading && setIsCartsLoading(false)
|
|
83
|
-
} catch (error) {
|
|
84
|
-
setIsCartsLoading && setIsCartsLoading(false)
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const handleUpsellingPage = () => {
|
|
89
|
-
setOpenUpselling(false)
|
|
90
|
-
setCanOpenUpselling(false)
|
|
91
|
-
props.onNavigationRedirect('CheckoutNavigator', {
|
|
92
|
-
screen: 'CheckoutPage',
|
|
93
|
-
cartUuid: cart?.uuid,
|
|
94
|
-
businessLogo: cart?.business?.logo,
|
|
95
|
-
businessName: cart?.business?.name,
|
|
96
|
-
cartTotal: cart?.total
|
|
97
|
-
})
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const getIncludedTaxes = () => {
|
|
101
|
-
if (cart?.taxes === null) {
|
|
102
|
-
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
103
|
-
} else {
|
|
104
|
-
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
105
|
-
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
106
|
-
}, 0)
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<CContainer>
|
|
112
|
-
<BusinessItemAccordion
|
|
113
|
-
cart={cart}
|
|
114
|
-
moment={momentFormatted}
|
|
115
|
-
handleClearProducts={handleClearProducts}
|
|
116
|
-
handleCartOpen={handleCartOpen}
|
|
117
|
-
onNavigationRedirect={props.onNavigationRedirect}
|
|
118
|
-
>
|
|
119
|
-
{cart?.products?.length > 0 && cart?.products.map((product: any) => (
|
|
120
|
-
<ProductItemAccordion
|
|
121
|
-
key={product.code}
|
|
122
|
-
isCartPending={isCartPending}
|
|
123
|
-
isCartProduct
|
|
124
|
-
product={product}
|
|
125
|
-
changeQuantity={changeQuantity}
|
|
126
|
-
getProductMax={getProductMax}
|
|
127
|
-
offsetDisabled={offsetDisabled}
|
|
128
|
-
onDeleteProduct={handleDeleteClick}
|
|
129
|
-
onEditProduct={handleEditProduct}
|
|
130
|
-
/>
|
|
131
|
-
))}
|
|
132
|
-
|
|
133
|
-
{cart?.valid_products && (
|
|
134
|
-
<OSBill>
|
|
135
|
-
<OSTable>
|
|
136
|
-
<OText size={12} lineHeight={18}>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
137
|
-
<OText size={12} lineHeight={18}>
|
|
138
|
-
{parsePrice(cart?.subtotal + getIncludedTaxes())}
|
|
139
|
-
</OText>
|
|
140
|
-
</OSTable>
|
|
141
|
-
{cart?.discount > 0 && cart?.total >= 0 && (
|
|
142
|
-
<OSTable>
|
|
143
|
-
{cart?.discount_type === 1 ? (
|
|
144
|
-
<OText size={12} lineHeight={18}>
|
|
145
|
-
{t('DISCOUNT', 'Discount')}
|
|
146
|
-
<OText size={12} lineHeight={18}>{`(${verifyDecimals(cart?.discount_rate, parsePrice)}%)`}</OText>
|
|
147
|
-
</OText>
|
|
148
|
-
) : (
|
|
149
|
-
<OText size={12} lineHeight={18}>{t('DISCOUNT', 'Discount')}</OText>
|
|
150
|
-
)}
|
|
151
|
-
<OText size={12} lineHeight={18}>- {parsePrice(cart?.discount || 0)}</OText>
|
|
152
|
-
</OSTable>
|
|
153
|
-
)}
|
|
154
|
-
{
|
|
155
|
-
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
156
|
-
<OSTable key={tax.id}>
|
|
157
|
-
<OSRow>
|
|
158
|
-
<OText numberOfLines={1} >
|
|
159
|
-
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
160
|
-
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
|
|
161
|
-
</OText>
|
|
162
|
-
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax })} >
|
|
163
|
-
<AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
|
|
164
|
-
</TouchableOpacity>
|
|
165
|
-
</OSRow>
|
|
166
|
-
<OText>{parsePrice(tax?.summary?.tax || 0)}</OText>
|
|
167
|
-
</OSTable>
|
|
168
|
-
))
|
|
169
|
-
}
|
|
170
|
-
{
|
|
171
|
-
cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
|
|
172
|
-
<OSTable key={fee?.id}>
|
|
173
|
-
<OSRow>
|
|
174
|
-
<OText numberOfLines={1}>
|
|
175
|
-
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
176
|
-
({parsePrice(fee?.fixed)} + {fee?.percentage}%){' '}
|
|
177
|
-
</OText>
|
|
178
|
-
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })} >
|
|
179
|
-
<AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
|
|
180
|
-
</TouchableOpacity>
|
|
181
|
-
</OSRow>
|
|
182
|
-
<OText>{parsePrice(fee?.summary?.fixed + fee?.summary?.percentage || 0)}</OText>
|
|
183
|
-
</OSTable>
|
|
184
|
-
))
|
|
185
|
-
}
|
|
186
|
-
{orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
|
|
187
|
-
<OSTable>
|
|
188
|
-
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
189
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
|
|
190
|
-
</OSTable>
|
|
191
|
-
)}
|
|
192
|
-
{cart?.driver_tip > 0 && (
|
|
193
|
-
<OSTable>
|
|
194
|
-
<OText size={12} lineHeight={18}>
|
|
195
|
-
{t('DRIVER_TIP', 'Driver tip')}
|
|
196
|
-
{cart?.driver_tip_rate > 0 &&
|
|
197
|
-
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
198
|
-
!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
199
|
-
(
|
|
200
|
-
`(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
|
|
201
|
-
)}
|
|
202
|
-
</OText>
|
|
203
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.driver_tip)}</OText>
|
|
204
|
-
</OSTable>
|
|
205
|
-
)}
|
|
206
|
-
{isCouponEnabled && !isCartPending && (
|
|
207
|
-
<OSTable>
|
|
208
|
-
<OSCoupon>
|
|
209
|
-
<CouponControl
|
|
210
|
-
businessId={cart.business_id}
|
|
211
|
-
price={cart.total}
|
|
212
|
-
/>
|
|
213
|
-
</OSCoupon>
|
|
214
|
-
</OSTable>
|
|
215
|
-
)}
|
|
216
|
-
|
|
217
|
-
<OSTotal>
|
|
218
|
-
<OSTable style={{ marginTop: 15 }}>
|
|
219
|
-
<OText size={14} lineHeight={21} weight={'600'}>
|
|
220
|
-
{t('TOTAL', 'Total')}
|
|
221
|
-
</OText>
|
|
222
|
-
<OText size={14} lineHeight={21} weight={'600'}>
|
|
223
|
-
{cart?.total >= 1 && parsePrice(cart?.total)}
|
|
224
|
-
</OText>
|
|
225
|
-
</OSTable>
|
|
226
|
-
</OSTotal>
|
|
227
|
-
{cart?.status !== 2 && (
|
|
228
|
-
<OSTable>
|
|
229
|
-
<View style={{ width: '100%', marginTop: 20 }}>
|
|
230
|
-
<OText size={12} lineHeight={18}>{t('COMMENTS', 'Comments')}</OText>
|
|
231
|
-
<View style={{ flex: 1, width: '100%' }}>
|
|
232
|
-
<OInput
|
|
233
|
-
value={cart?.comment}
|
|
234
|
-
placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
|
|
235
|
-
onChange={(value: string) => handleChangeComment(value)}
|
|
236
|
-
style={{
|
|
237
|
-
alignItems: 'flex-start',
|
|
238
|
-
width: '100%',
|
|
239
|
-
height: 100,
|
|
240
|
-
borderColor: theme.colors.textSecondary,
|
|
241
|
-
paddingRight: 50,
|
|
242
|
-
marginTop: 10
|
|
243
|
-
}}
|
|
244
|
-
multiline
|
|
245
|
-
/>
|
|
246
|
-
{commentState?.loading && (
|
|
247
|
-
<View style={{ position: 'absolute', right: 20 }}>
|
|
248
|
-
<ActivityIndicator
|
|
249
|
-
size='large'
|
|
250
|
-
style={{ height: 100 }}
|
|
251
|
-
color={theme.colors.primary}
|
|
252
|
-
/>
|
|
253
|
-
</View>
|
|
254
|
-
)}
|
|
255
|
-
</View>
|
|
256
|
-
</View>
|
|
257
|
-
</OSTable>
|
|
258
|
-
)}
|
|
259
|
-
</OSBill>
|
|
260
|
-
)}
|
|
261
|
-
{cart?.valid_products && (
|
|
262
|
-
<CheckoutAction>
|
|
263
|
-
<OButton
|
|
264
|
-
text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
|
|
265
|
-
!openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
|
|
266
|
-
) : !cart?.valid_address ? (
|
|
267
|
-
`${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
|
|
268
|
-
) : (
|
|
269
|
-
`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
|
|
270
|
-
)}
|
|
271
|
-
bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
272
|
-
isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
|
|
273
|
-
borderColor={theme.colors.primary}
|
|
274
|
-
imgRightSrc={null}
|
|
275
|
-
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
276
|
-
onClick={() => setOpenUpselling(true)}
|
|
277
|
-
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
278
|
-
/>
|
|
279
|
-
</CheckoutAction>
|
|
280
|
-
)}
|
|
281
|
-
</BusinessItemAccordion>
|
|
282
|
-
<OModal
|
|
283
|
-
open={openProduct}
|
|
284
|
-
entireModal
|
|
285
|
-
customClose
|
|
286
|
-
onClose={() => setModalIsOpen(false)}
|
|
287
|
-
>
|
|
288
|
-
<ProductForm
|
|
289
|
-
isCartProduct
|
|
290
|
-
productCart={curProduct}
|
|
291
|
-
businessSlug={cart?.business?.slug}
|
|
292
|
-
businessId={cart?.business_id}
|
|
293
|
-
categoryId={curProduct?.category_id}
|
|
294
|
-
productId={curProduct?.id}
|
|
295
|
-
onSave={handlerProductAction}
|
|
296
|
-
onClose={() => setModalIsOpen(false)}
|
|
297
|
-
/>
|
|
298
|
-
|
|
299
|
-
</OModal>
|
|
300
|
-
<OModal
|
|
301
|
-
open={openTaxModal.open}
|
|
302
|
-
onClose={() => setOpenTaxModal({ open: false, data: null })}
|
|
303
|
-
entireModal
|
|
304
|
-
>
|
|
305
|
-
<TaxInformation data={openTaxModal.data} products={cart.products} />
|
|
306
|
-
</OModal>
|
|
307
|
-
{openUpselling && (
|
|
308
|
-
<UpsellingProducts
|
|
309
|
-
handleUpsellingPage={handleUpsellingPage}
|
|
310
|
-
openUpselling={openUpselling}
|
|
311
|
-
businessId={cart?.business_id}
|
|
312
|
-
business={cart?.business}
|
|
313
|
-
cartProducts={cart?.products}
|
|
314
|
-
canOpenUpselling={canOpenUpselling}
|
|
315
|
-
setCanOpenUpselling={setCanOpenUpselling}
|
|
316
|
-
handleCloseUpsellingPage={() => { }}
|
|
317
|
-
/>
|
|
318
|
-
)}
|
|
319
|
-
</CContainer>
|
|
320
|
-
)
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
export const Cart = (props: any) => {
|
|
324
|
-
const cartProps = {
|
|
325
|
-
...props,
|
|
326
|
-
UIComponent: CartUI
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
return (
|
|
330
|
-
<CartController {...cartProps} />
|
|
331
|
-
)
|
|
332
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const CContainer = styled.View`
|
|
4
|
-
/* border-bottom: 1px solid #F0F0F0; */
|
|
5
|
-
`
|
|
6
|
-
|
|
7
|
-
export const OrderBill = styled.View`
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
padding: 10px;
|
|
12
|
-
background-color: #FFF;
|
|
13
|
-
`
|
|
14
|
-
|
|
15
|
-
export const CouponContainer = styled.View`
|
|
16
|
-
width: 100%;
|
|
17
|
-
margin: 10px;
|
|
18
|
-
`
|
|
19
|
-
|
|
20
|
-
export const CheckoutAction = styled.View`
|
|
21
|
-
width: 100%;
|
|
22
|
-
display: flex;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
flex-direction: column;
|
|
25
|
-
align-items: center;
|
|
26
|
-
margin-top: 10px;
|
|
27
|
-
margin-bottom: 10px;
|
|
28
|
-
`
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { useLanguage, useOrder } from 'ordering-components/native';
|
|
3
|
-
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import { CCContainer, CCNotCarts, CCList } from './styles';
|
|
5
|
-
|
|
6
|
-
import { Cart } from '../Cart';
|
|
7
|
-
import { OIcon, OText } from '../shared';
|
|
8
|
-
import Spinner from 'react-native-loading-spinner-overlay';
|
|
9
|
-
import { View } from 'react-native';
|
|
10
|
-
|
|
11
|
-
export const CartContent = (props: any) => {
|
|
12
|
-
const {
|
|
13
|
-
carts,
|
|
14
|
-
isOrderStateCarts
|
|
15
|
-
} = props
|
|
16
|
-
|
|
17
|
-
const theme = useTheme();
|
|
18
|
-
const [, t] = useLanguage()
|
|
19
|
-
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<CCContainer>
|
|
23
|
-
{isOrderStateCarts && carts?.length > 0 && (
|
|
24
|
-
<>
|
|
25
|
-
<OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
|
|
26
|
-
{carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
|
|
27
|
-
</OText>
|
|
28
|
-
{carts.map((cart: any) => (
|
|
29
|
-
<CCList key={cart.uuid} style={{ overflow: 'visible' }}>
|
|
30
|
-
{cart.products.length > 0 && (
|
|
31
|
-
<>
|
|
32
|
-
<Cart
|
|
33
|
-
cart={cart}
|
|
34
|
-
onNavigationRedirect={props.onNavigationRedirect}
|
|
35
|
-
isCartsLoading={isCartsLoading}
|
|
36
|
-
setIsCartsLoading={setIsCartsLoading}
|
|
37
|
-
/>
|
|
38
|
-
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
|
|
39
|
-
</>
|
|
40
|
-
)}
|
|
41
|
-
</CCList>
|
|
42
|
-
))}
|
|
43
|
-
</>
|
|
44
|
-
)}
|
|
45
|
-
{(!carts || carts?.length === 0) && (
|
|
46
|
-
<CCNotCarts>
|
|
47
|
-
{/* <OIcon
|
|
48
|
-
url={props.icon}
|
|
49
|
-
width={200}
|
|
50
|
-
height={122}
|
|
51
|
-
/> */}
|
|
52
|
-
<OText size={24} style={{ textAlign: 'center' }}>
|
|
53
|
-
{t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
|
|
54
|
-
</OText>
|
|
55
|
-
</CCNotCarts>
|
|
56
|
-
)}
|
|
57
|
-
<Spinner visible={isCartsLoading} />
|
|
58
|
-
</CCContainer>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const CCContainer = styled.View`
|
|
4
|
-
padding: 20px 40px;
|
|
5
|
-
`
|
|
6
|
-
|
|
7
|
-
export const CCNotCarts = styled.View`
|
|
8
|
-
height: 300px;
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
align-items: center;
|
|
13
|
-
width: 80%;
|
|
14
|
-
margin: auto;
|
|
15
|
-
`
|
|
16
|
-
|
|
17
|
-
export const CCList = styled.ScrollView`
|
|
18
|
-
padding: 10px 0px;
|
|
19
|
-
`
|