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,243 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { OrderList, useLanguage, useOrder, ToastType, useToast } from 'ordering-components/native'
|
|
3
|
-
import { useFocusEffect } from '@react-navigation/native'
|
|
4
|
-
import { OText } from '../shared'
|
|
5
|
-
import { NotFoundSource } from '../NotFoundSource'
|
|
6
|
-
import { ActiveOrders } from '../ActiveOrders'
|
|
7
|
-
import { PreviousOrders } from '../PreviousOrders'
|
|
8
|
-
|
|
9
|
-
import { OptionTitle } from './styles'
|
|
10
|
-
import { OrdersOptionParams } from '../../types'
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
Placeholder,
|
|
14
|
-
PlaceholderLine,
|
|
15
|
-
Fade
|
|
16
|
-
} from "rn-placeholder";
|
|
17
|
-
import { View } from 'react-native'
|
|
18
|
-
import { useTheme } from 'styled-components/native'
|
|
19
|
-
|
|
20
|
-
const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
21
|
-
const {
|
|
22
|
-
navigation,
|
|
23
|
-
activeOrders,
|
|
24
|
-
orderList,
|
|
25
|
-
pagination,
|
|
26
|
-
titleContent,
|
|
27
|
-
customArray,
|
|
28
|
-
onNavigationRedirect,
|
|
29
|
-
orderStatus,
|
|
30
|
-
loadMoreOrders,
|
|
31
|
-
loadOrders,
|
|
32
|
-
ordersLength,
|
|
33
|
-
setOrdersLength,
|
|
34
|
-
businessId,
|
|
35
|
-
preOrders
|
|
36
|
-
} = props
|
|
37
|
-
|
|
38
|
-
const theme = useTheme()
|
|
39
|
-
const [, t] = useLanguage()
|
|
40
|
-
const [, { reorder }] = useOrder()
|
|
41
|
-
const [, { showToast }] = useToast()
|
|
42
|
-
const { loading, error, orders: values } = orderList
|
|
43
|
-
|
|
44
|
-
const imageFails = activeOrders
|
|
45
|
-
? theme.images.general.emptyActiveOrders
|
|
46
|
-
: theme.images.general.emptyPastOrders
|
|
47
|
-
|
|
48
|
-
const orders = customArray || values || []
|
|
49
|
-
|
|
50
|
-
const [reorderLoading, setReorderLoading] = useState(false)
|
|
51
|
-
const [isLoadingFirstRender, setIsLoadingFirstRender] = useState(false)
|
|
52
|
-
const [screen, setScreen] = useState({ name: '', uuid: null })
|
|
53
|
-
const handleReorder = async (orderId: number) => {
|
|
54
|
-
setReorderLoading(true)
|
|
55
|
-
try {
|
|
56
|
-
const { error, result } = await reorder(orderId)
|
|
57
|
-
if (!error) {
|
|
58
|
-
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: result.uuid })
|
|
59
|
-
setReorderLoading(false)
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
setReorderLoading(false)
|
|
63
|
-
|
|
64
|
-
} catch (err: any) {
|
|
65
|
-
showToast(ToastType.Error, t('ERROR', err.message))
|
|
66
|
-
setReorderLoading(false)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const getOrderStatus = (s: string) => {
|
|
71
|
-
const status = parseInt(s)
|
|
72
|
-
const orderStatus = [
|
|
73
|
-
{ key: 0, value: t('PENDING', 'Pending') },
|
|
74
|
-
{ key: 1, value: t('COMPLETED', 'Completed') },
|
|
75
|
-
{ key: 2, value: t('REJECTED', 'Rejected') },
|
|
76
|
-
{ key: 3, value: t('DRIVER_IN_BUSINESS', 'Driver in business') },
|
|
77
|
-
{ key: 4, value: t('PREPARATION_COMPLETED', 'Preparation Completed') },
|
|
78
|
-
{ key: 5, value: t('REJECTED_BY_BUSINESS', 'Rejected by business') },
|
|
79
|
-
{ key: 6, value: t('REJECTED_BY_DRIVER', 'Rejected by Driver') },
|
|
80
|
-
{ key: 7, value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business') },
|
|
81
|
-
{ key: 8, value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver') },
|
|
82
|
-
{ key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver') },
|
|
83
|
-
{ key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver') },
|
|
84
|
-
{ key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', 'Delivery completed by driver') },
|
|
85
|
-
{ key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver') },
|
|
86
|
-
{ key: 13, value: t('PREORDER', 'PreOrder') },
|
|
87
|
-
{ key: 14, value: t('ORDER_NOT_READY', 'Order not ready') },
|
|
88
|
-
{ key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', 'Order picked up completed by customer') },
|
|
89
|
-
{ key: 16, value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer') },
|
|
90
|
-
{ key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer') },
|
|
91
|
-
{ key: 18, value: t('DRIVER_ALMOST_ARRIVED_TO_BUSINESS', 'Driver almost arrived to business') },
|
|
92
|
-
{ key: 19, value: t('DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', 'Driver almost arrived to customer') },
|
|
93
|
-
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
|
|
94
|
-
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') }
|
|
95
|
-
]
|
|
96
|
-
|
|
97
|
-
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
98
|
-
|
|
99
|
-
return objectStatus && objectStatus
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
useFocusEffect(
|
|
103
|
-
React.useCallback(() => {
|
|
104
|
-
loadOrders && loadOrders()
|
|
105
|
-
setIsLoadingFirstRender(false)
|
|
106
|
-
return () => {
|
|
107
|
-
setIsLoadingFirstRender(true)
|
|
108
|
-
}
|
|
109
|
-
}, [navigation])
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
setOrdersLength && setOrdersLength({
|
|
114
|
-
...ordersLength,
|
|
115
|
-
[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength']: orders.length
|
|
116
|
-
})
|
|
117
|
-
}, [orders.length])
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<>
|
|
122
|
-
<OptionTitle>
|
|
123
|
-
{(!activeOrders || (activeOrders && ordersLength.activeOrdersLength > 0) || (ordersLength.previousOrdersLength === 0 && ordersLength.activeOrdersLength === 0)) && !isLoadingFirstRender && (
|
|
124
|
-
<OText size={16} color={theme.colors.textPrimary} mBottom={10} style={activeOrders ? { paddingHorizontal: 0 } : {}}>
|
|
125
|
-
{titleContent || (
|
|
126
|
-
preOrders ? t('UPCOMING', 'UPCOMING')
|
|
127
|
-
: activeOrders ? t('ACTIVE', 'Active')
|
|
128
|
-
: t('PAST', 'Past'))}
|
|
129
|
-
</OText>
|
|
130
|
-
)}
|
|
131
|
-
</OptionTitle>
|
|
132
|
-
{!loading && orders.length === 0 && !isLoadingFirstRender && activeOrders && ordersLength.previousOrdersLength === 0 && ordersLength.activeOrdersLength !== 0 && (
|
|
133
|
-
<NotFoundSource
|
|
134
|
-
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
135
|
-
image={imageFails}
|
|
136
|
-
conditioned
|
|
137
|
-
/>
|
|
138
|
-
)}
|
|
139
|
-
{!loading && orders.length === 0 && !isLoadingFirstRender && ordersLength.previousOrdersLength === 0 && (
|
|
140
|
-
<NotFoundSource
|
|
141
|
-
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
142
|
-
image={imageFails}
|
|
143
|
-
conditioned
|
|
144
|
-
/>
|
|
145
|
-
)}
|
|
146
|
-
{loading && (
|
|
147
|
-
<>
|
|
148
|
-
{activeOrders ? (
|
|
149
|
-
<>
|
|
150
|
-
{[...Array(2)].map((_, idx) =>
|
|
151
|
-
<Placeholder key={idx} Animation={Fade}>
|
|
152
|
-
<View style={{ width: '100%', flexDirection: 'row' }}>
|
|
153
|
-
<PlaceholderLine width={20} height={70} style={{ marginRight: 20, marginBottom: 35 }} />
|
|
154
|
-
<Placeholder>
|
|
155
|
-
<PlaceholderLine width={30} style={{ marginTop: 5 }} />
|
|
156
|
-
<PlaceholderLine width={50} />
|
|
157
|
-
<PlaceholderLine width={70} />
|
|
158
|
-
</Placeholder>
|
|
159
|
-
</View>
|
|
160
|
-
</Placeholder>
|
|
161
|
-
)}
|
|
162
|
-
</>
|
|
163
|
-
) : (
|
|
164
|
-
<View style={{ marginTop: 30 }}>
|
|
165
|
-
{[...Array(3)].map((item, i) => (
|
|
166
|
-
<Placeholder key={i} Animation={Fade}>
|
|
167
|
-
<View style={{ width: '100%', flexDirection: 'row' }}>
|
|
168
|
-
<PlaceholderLine width={20} height={70} style={{ marginRight: 20, marginBottom: 20 }} />
|
|
169
|
-
<Placeholder>
|
|
170
|
-
<PlaceholderLine width={30} style={{ marginTop: 5 }} />
|
|
171
|
-
<PlaceholderLine width={50} />
|
|
172
|
-
<PlaceholderLine width={20} />
|
|
173
|
-
</Placeholder>
|
|
174
|
-
</View>
|
|
175
|
-
</Placeholder>
|
|
176
|
-
))}
|
|
177
|
-
</View>
|
|
178
|
-
)}
|
|
179
|
-
</>
|
|
180
|
-
)}
|
|
181
|
-
{!loading && !error && orders.length > 0 && !isLoadingFirstRender && (
|
|
182
|
-
activeOrders ? (
|
|
183
|
-
<ActiveOrders
|
|
184
|
-
orders={orders.filter((order: any) => businessId !== null ? order?.business_id === parseInt(businessId) : true)}
|
|
185
|
-
pagination={pagination}
|
|
186
|
-
loadMoreOrders={loadMoreOrders}
|
|
187
|
-
reorderLoading={reorderLoading}
|
|
188
|
-
customArray={customArray}
|
|
189
|
-
getOrderStatus={getOrderStatus}
|
|
190
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
191
|
-
setScreen={setScreen}
|
|
192
|
-
screen={screen}
|
|
193
|
-
/>
|
|
194
|
-
) : (
|
|
195
|
-
<>
|
|
196
|
-
{preOrders ?
|
|
197
|
-
<ActiveOrders
|
|
198
|
-
orders={orders.filter((order: any) => businessId !== null ? order?.business_id === parseInt(businessId) : true)}
|
|
199
|
-
pagination={pagination}
|
|
200
|
-
loadMoreOrders={loadMoreOrders}
|
|
201
|
-
reorderLoading={reorderLoading}
|
|
202
|
-
customArray={customArray}
|
|
203
|
-
getOrderStatus={getOrderStatus}
|
|
204
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
205
|
-
setScreen={setScreen}
|
|
206
|
-
screen={screen}
|
|
207
|
-
isPreorders
|
|
208
|
-
/>
|
|
209
|
-
: <PreviousOrders
|
|
210
|
-
reorderLoading={reorderLoading}
|
|
211
|
-
orders={orders.filter((order: any) => businessId !== null ? order?.business_id === parseInt(businessId) : true)}
|
|
212
|
-
pagination={pagination}
|
|
213
|
-
loadMoreOrders={loadMoreOrders}
|
|
214
|
-
getOrderStatus={getOrderStatus}
|
|
215
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
216
|
-
handleReorder={handleReorder}
|
|
217
|
-
/>
|
|
218
|
-
}
|
|
219
|
-
</>
|
|
220
|
-
)
|
|
221
|
-
)}
|
|
222
|
-
</>
|
|
223
|
-
)
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export const OrdersOption = (props: OrdersOptionParams) => {
|
|
227
|
-
const MyOrdersProps = {
|
|
228
|
-
...props,
|
|
229
|
-
UIComponent: OrdersOptionUI,
|
|
230
|
-
orderStatus: props.preOrders ? [13] : props.activeOrders
|
|
231
|
-
? [0, 3, 4, 7, 8, 9, 14, 15, 18, 19, 20, 21]
|
|
232
|
-
: [1, 2, 5, 6, 10, 11, 12, 16, 17],
|
|
233
|
-
useDefualtSessionManager: true,
|
|
234
|
-
paginationSettings: {
|
|
235
|
-
initialPage: 1,
|
|
236
|
-
pageSize: 10,
|
|
237
|
-
controlType: 'infinity'
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return <OrderList {...MyOrdersProps} />
|
|
242
|
-
|
|
243
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import { StyleSheet } from 'react-native';
|
|
3
|
-
import { useUtils, useLanguage } from 'ordering-components/native';
|
|
4
|
-
import { useTheme } from 'styled-components/native';
|
|
5
|
-
import { useForm, Controller } from 'react-hook-form';
|
|
6
|
-
|
|
7
|
-
import { PCContainer, PCForm, PCWrapper } from './styles';
|
|
8
|
-
import { OInput, OText } from '../shared';
|
|
9
|
-
|
|
10
|
-
export const PaymentOptionCash = (props: any) => {
|
|
11
|
-
const {
|
|
12
|
-
defaultValue,
|
|
13
|
-
orderTotal,
|
|
14
|
-
onChangeData,
|
|
15
|
-
setErrorCash
|
|
16
|
-
} = props;
|
|
17
|
-
|
|
18
|
-
const theme = useTheme();
|
|
19
|
-
|
|
20
|
-
const styles = StyleSheet.create({
|
|
21
|
-
inputsStyle: {
|
|
22
|
-
borderColor: theme.colors.border,
|
|
23
|
-
borderRadius: 7.6,
|
|
24
|
-
marginTop: 10,
|
|
25
|
-
width: '100%',
|
|
26
|
-
height: 44,
|
|
27
|
-
maxHeight: 44
|
|
28
|
-
},
|
|
29
|
-
errorMsg: {
|
|
30
|
-
marginTop: 10,
|
|
31
|
-
color: theme.colors.error,
|
|
32
|
-
fontSize: 16,
|
|
33
|
-
fontWeight: 'bold',
|
|
34
|
-
textAlign: 'center'
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const [, t] = useLanguage();
|
|
39
|
-
const [{ parsePrice }] = useUtils();
|
|
40
|
-
const { control } = useForm();
|
|
41
|
-
|
|
42
|
-
const [value, setvalue] = useState(defaultValue?.toString() || '');
|
|
43
|
-
let timeout: any = null;
|
|
44
|
-
|
|
45
|
-
const onChangeCash = (value: any) => {
|
|
46
|
-
clearTimeout(timeout)
|
|
47
|
-
timeout = setTimeout(() => {
|
|
48
|
-
let cash: any = parseFloat(value)
|
|
49
|
-
cash = isNaN(cash) ? '' : cash
|
|
50
|
-
setvalue(cash.toString())
|
|
51
|
-
if (cash >= orderTotal || !cash) {
|
|
52
|
-
onChangeData && onChangeData(!cash ? { cash: null } : { cash })
|
|
53
|
-
}
|
|
54
|
-
}, 750)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
if (value && parseFloat(value) < orderTotal) {
|
|
59
|
-
setErrorCash && setErrorCash(true)
|
|
60
|
-
} else {
|
|
61
|
-
setErrorCash && setErrorCash(false)
|
|
62
|
-
}
|
|
63
|
-
}, [value, orderTotal])
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<PCContainer>
|
|
67
|
-
<PCForm>
|
|
68
|
-
<PCWrapper>
|
|
69
|
-
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
70
|
-
{t('NOT_EXACT_CASH_AMOUNT', 'Don\'t have exact amount? Let us know with how much will you pay')}
|
|
71
|
-
</OText>
|
|
72
|
-
<Controller
|
|
73
|
-
control={control}
|
|
74
|
-
name='cash'
|
|
75
|
-
defaultValue={value}
|
|
76
|
-
render={() => (
|
|
77
|
-
<OInput
|
|
78
|
-
name='cash'
|
|
79
|
-
placeholder='0'
|
|
80
|
-
style={styles.inputsStyle}
|
|
81
|
-
value={value}
|
|
82
|
-
onChange={(val: any) => onChangeCash(val?.target.value)}
|
|
83
|
-
type='numeric'
|
|
84
|
-
returnKeyType='done'
|
|
85
|
-
/>
|
|
86
|
-
)}
|
|
87
|
-
/>
|
|
88
|
-
</PCWrapper>
|
|
89
|
-
{!!value && parseFloat(value) < orderTotal && (
|
|
90
|
-
<OText style={styles.errorMsg}>
|
|
91
|
-
{`${t('VALUE_GREATER_THAN_TOTAL', 'This value must be greater than order total')}: ${parsePrice(orderTotal)}`}
|
|
92
|
-
</OText>
|
|
93
|
-
)}
|
|
94
|
-
</PCForm>
|
|
95
|
-
</PCContainer>
|
|
96
|
-
)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
PaymentOptionCash.defaultProps = {
|
|
100
|
-
defaultValue: ''
|
|
101
|
-
}
|
|
102
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const PCContainer = styled.View`
|
|
4
|
-
margin: 20px 0px 0px;
|
|
5
|
-
`;
|
|
6
|
-
|
|
7
|
-
export const PCForm = styled.View`
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
align-items: center;
|
|
11
|
-
`
|
|
12
|
-
|
|
13
|
-
export const PCWrapper = styled.View`
|
|
14
|
-
display: flex;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
align-items: center;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
`
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { View, StyleSheet, Dimensions, FlatList, KeyboardAvoidingView, Platform } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
PaymentOptionStripe as PaymentOptionStripeController,
|
|
5
|
-
useSession,
|
|
6
|
-
useLanguage,
|
|
7
|
-
} from 'ordering-components/native';
|
|
8
|
-
import { useTheme } from 'styled-components/native';
|
|
9
|
-
import { PlaceholderLine } from 'rn-placeholder';
|
|
10
|
-
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
11
|
-
|
|
12
|
-
import { getIconCard } from '../../utils';
|
|
13
|
-
import { OAlert, OButton, OModal, OText } from '../shared';
|
|
14
|
-
|
|
15
|
-
import { NotFoundSource } from '../NotFoundSource';
|
|
16
|
-
import { StripeElementsForm } from '../StripeElementsForm';
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
OSContainer,
|
|
20
|
-
OSMessage,
|
|
21
|
-
OSItem,
|
|
22
|
-
OSItemContent,
|
|
23
|
-
OSItemActions,
|
|
24
|
-
OSWrapper,
|
|
25
|
-
OSActions
|
|
26
|
-
} from './styles';
|
|
27
|
-
|
|
28
|
-
const PaymentOptionStripeUI = (props: any) => {
|
|
29
|
-
const {
|
|
30
|
-
onSelectCard,
|
|
31
|
-
onCancel,
|
|
32
|
-
deleteCard,
|
|
33
|
-
cardSelected,
|
|
34
|
-
cardsList,
|
|
35
|
-
handleCardClick,
|
|
36
|
-
handleNewCard
|
|
37
|
-
} = props;
|
|
38
|
-
|
|
39
|
-
const theme = useTheme();
|
|
40
|
-
|
|
41
|
-
const [{ token }] = useSession();
|
|
42
|
-
const [, t] = useLanguage();
|
|
43
|
-
|
|
44
|
-
const [addCartOpen, setAddCardOpen] = useState(false)
|
|
45
|
-
|
|
46
|
-
const _handleNewCard = (card: any) => {
|
|
47
|
-
setAddCardOpen(false);
|
|
48
|
-
handleNewCard(card);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const handleDeleteCard = (card: any) => {
|
|
52
|
-
deleteCard(card);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const renderCards = ({ item }: any) => {
|
|
56
|
-
return (
|
|
57
|
-
<OSItem key={item.id}>
|
|
58
|
-
<OSItemContent onPress={() => handleCardClick(item)}>
|
|
59
|
-
<View style={styles.viewStyle}>
|
|
60
|
-
{item.id === cardSelected?.id ? (
|
|
61
|
-
<MaterialCommunityIcons
|
|
62
|
-
name='radiobox-marked'
|
|
63
|
-
size={24}
|
|
64
|
-
color={theme.colors.primary}
|
|
65
|
-
/>
|
|
66
|
-
) : (
|
|
67
|
-
<MaterialCommunityIcons
|
|
68
|
-
name='radiobox-blank'
|
|
69
|
-
size={24}
|
|
70
|
-
color={theme.colors.primary}
|
|
71
|
-
/>
|
|
72
|
-
)}
|
|
73
|
-
</View>
|
|
74
|
-
<View style={styles.viewStyle}>
|
|
75
|
-
{getIconCard(item.brand, 26)}
|
|
76
|
-
</View>
|
|
77
|
-
<View style={styles.viewStyle}>
|
|
78
|
-
<OText size={20}>
|
|
79
|
-
XXXX-XXXX-XXXX-{item.last4}
|
|
80
|
-
</OText>
|
|
81
|
-
</View>
|
|
82
|
-
</OSItemContent>
|
|
83
|
-
<OSItemActions>
|
|
84
|
-
<OAlert
|
|
85
|
-
title={t('CARD', 'Card')}
|
|
86
|
-
message={t('QUESTION_DELETE_CARD', 'Are you sure that you want to delete the card?')}
|
|
87
|
-
onAccept={() => handleDeleteCard(item)}
|
|
88
|
-
>
|
|
89
|
-
<MaterialCommunityIcons
|
|
90
|
-
name='trash-can-outline'
|
|
91
|
-
size={28}
|
|
92
|
-
color={theme.colors.primary}
|
|
93
|
-
/>
|
|
94
|
-
</OAlert>
|
|
95
|
-
</OSItemActions>
|
|
96
|
-
</OSItem>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<OSContainer style={styles.container}>
|
|
102
|
-
{token && !cardsList.loading && cardsList.cards && cardsList.cards.length === 0 && (
|
|
103
|
-
<OSItem>
|
|
104
|
-
<OText size={22}>
|
|
105
|
-
{t('YOU_DONT_HAVE_CARDS', 'You don\'t have cards')}
|
|
106
|
-
</OText>
|
|
107
|
-
</OSItem>
|
|
108
|
-
)}
|
|
109
|
-
|
|
110
|
-
{token && cardsList.error && cardsList.error.length > 0 && (
|
|
111
|
-
<NotFoundSource
|
|
112
|
-
content={cardsList?.error[0]?.message || cardsList?.error[0]}
|
|
113
|
-
/>
|
|
114
|
-
)}
|
|
115
|
-
|
|
116
|
-
{token && cardsList.cards && cardsList.cards.length > 0 && (
|
|
117
|
-
<FlatList
|
|
118
|
-
horizontal={false}
|
|
119
|
-
showsHorizontalScrollIndicator={false}
|
|
120
|
-
data={cardsList.cards}
|
|
121
|
-
renderItem={renderCards}
|
|
122
|
-
keyExtractor={card => card.id?.toString()}
|
|
123
|
-
style={{ height: '65%', flexGrow: 0 }}
|
|
124
|
-
/>
|
|
125
|
-
)}
|
|
126
|
-
|
|
127
|
-
{token && !cardsList.loading && (
|
|
128
|
-
<OSWrapper style={styles.bottom}>
|
|
129
|
-
<OButton
|
|
130
|
-
text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
|
|
131
|
-
bgColor={theme.colors.backgroundGray}
|
|
132
|
-
borderColor={theme.colors.backgroundGray}
|
|
133
|
-
style={styles.btnAddStyle}
|
|
134
|
-
textStyle={{ color: 'white' }}
|
|
135
|
-
imgRightSrc={null}
|
|
136
|
-
onClick={() => setAddCardOpen(true)}
|
|
137
|
-
/>
|
|
138
|
-
<OSActions>
|
|
139
|
-
<View style={{ width: '48%' }}>
|
|
140
|
-
<OButton
|
|
141
|
-
text={t('CANCEL', 'Cancel')}
|
|
142
|
-
bgColor={theme.colors.backgroundGray}
|
|
143
|
-
borderColor={theme.colors.backgroundGray}
|
|
144
|
-
textStyle={{ color: 'white' }}
|
|
145
|
-
style={styles.btnAction}
|
|
146
|
-
imgRightSrc={null}
|
|
147
|
-
onClick={() => onCancel()}
|
|
148
|
-
/>
|
|
149
|
-
</View>
|
|
150
|
-
<View style={{ width: '48%' }}>
|
|
151
|
-
<OButton
|
|
152
|
-
text={t('ACCEPT', 'Accept')}
|
|
153
|
-
bgColor={theme.colors.primary}
|
|
154
|
-
borderColor={theme.colors.primary}
|
|
155
|
-
textStyle={{ color: 'white' }}
|
|
156
|
-
style={styles.btnAction}
|
|
157
|
-
imgRightSrc={null}
|
|
158
|
-
isDisabled={!cardSelected || cardsList?.cards?.length === 0}
|
|
159
|
-
onClick={() => onSelectCard(cardSelected)}
|
|
160
|
-
/>
|
|
161
|
-
</View>
|
|
162
|
-
</OSActions>
|
|
163
|
-
</OSWrapper>
|
|
164
|
-
)}
|
|
165
|
-
|
|
166
|
-
<OModal
|
|
167
|
-
isNotDecoration
|
|
168
|
-
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
169
|
-
open={addCartOpen}
|
|
170
|
-
onClose={() => setAddCardOpen(false)}
|
|
171
|
-
>
|
|
172
|
-
<KeyboardAvoidingView
|
|
173
|
-
behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
|
|
174
|
-
keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
|
|
175
|
-
enabled={Platform.OS === 'ios' ? true : false}
|
|
176
|
-
>
|
|
177
|
-
<StripeElementsForm
|
|
178
|
-
toSave
|
|
179
|
-
businessId={props.businessId}
|
|
180
|
-
publicKey={props.publicKey}
|
|
181
|
-
requirements={props.clientSecret}
|
|
182
|
-
onNewCard={_handleNewCard}
|
|
183
|
-
onCancel={() => setAddCardOpen(false)}
|
|
184
|
-
/>
|
|
185
|
-
</KeyboardAvoidingView>
|
|
186
|
-
</OModal>
|
|
187
|
-
|
|
188
|
-
{token && cardsList.loading && (
|
|
189
|
-
<>
|
|
190
|
-
{[...Array(5)].map((_, i) => (
|
|
191
|
-
<PlaceholderLine
|
|
192
|
-
key={i}
|
|
193
|
-
height={50}
|
|
194
|
-
width={90}
|
|
195
|
-
noMargin
|
|
196
|
-
style={{ marginVertical: 20 }}
|
|
197
|
-
/>
|
|
198
|
-
))}
|
|
199
|
-
</>
|
|
200
|
-
)}
|
|
201
|
-
</OSContainer>
|
|
202
|
-
)
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const screenHeight = Dimensions.get('window').height;
|
|
206
|
-
const styles = StyleSheet.create({
|
|
207
|
-
container: {
|
|
208
|
-
height: screenHeight - 90
|
|
209
|
-
},
|
|
210
|
-
bottom: {
|
|
211
|
-
position: 'absolute',
|
|
212
|
-
bottom: 0,
|
|
213
|
-
marginBottom: 20
|
|
214
|
-
},
|
|
215
|
-
viewStyle: {
|
|
216
|
-
marginRight: 10
|
|
217
|
-
},
|
|
218
|
-
btnAddStyle: {
|
|
219
|
-
marginTop: 20
|
|
220
|
-
},
|
|
221
|
-
btnAction: {
|
|
222
|
-
paddingHorizontal: 20
|
|
223
|
-
}
|
|
224
|
-
})
|
|
225
|
-
|
|
226
|
-
export const PaymentOptionStripe = (props: any) => {
|
|
227
|
-
const paymentOptionStripeProps = {
|
|
228
|
-
...props,
|
|
229
|
-
UIComponent: PaymentOptionStripeUI
|
|
230
|
-
}
|
|
231
|
-
return (
|
|
232
|
-
<PaymentOptionStripeController {...paymentOptionStripeProps} />
|
|
233
|
-
)
|
|
234
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const OSContainer = styled.View`
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
align-items: center;
|
|
7
|
-
margin-top: 30px;
|
|
8
|
-
width: 100%;
|
|
9
|
-
position: relative;
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
export const OSMessage = styled.Text`
|
|
13
|
-
color: #D81212;
|
|
14
|
-
font-size: 24px;
|
|
15
|
-
padding-left: 10px;
|
|
16
|
-
font-weight: bold;
|
|
17
|
-
opacity: 0.8;
|
|
18
|
-
/* ${(props: any) => props.theme?.rtl && css`
|
|
19
|
-
padding-right: 10px;
|
|
20
|
-
padding-left: 0;
|
|
21
|
-
`} */
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
export const OSWrapper = styled.View`
|
|
25
|
-
display: flex;
|
|
26
|
-
width: 100%;
|
|
27
|
-
flex-direction: column;
|
|
28
|
-
align-items: center;
|
|
29
|
-
justify-content: center;
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
export const OSCardList = styled.ScrollView`
|
|
33
|
-
flex: 1;
|
|
34
|
-
`
|
|
35
|
-
|
|
36
|
-
export const OSItem = styled.View`
|
|
37
|
-
width: 100%;
|
|
38
|
-
display: flex;
|
|
39
|
-
flex-direction: row;
|
|
40
|
-
justify-content: space-between;
|
|
41
|
-
align-items: center;
|
|
42
|
-
padding: 20px 0px;
|
|
43
|
-
border-bottom-width: 1px;
|
|
44
|
-
border-bottom-color: ${(props: any) => props.theme.colors.border};
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
export const OSItemContent = styled.TouchableOpacity`
|
|
48
|
-
display: flex;
|
|
49
|
-
flex-direction: row;
|
|
50
|
-
align-items: center;
|
|
51
|
-
width: 90%;
|
|
52
|
-
|
|
53
|
-
/* > * {
|
|
54
|
-
${(props: any) => props.theme?.rtl && css`
|
|
55
|
-
margin-left: 10px;
|
|
56
|
-
margin-right: 0;
|
|
57
|
-
`}
|
|
58
|
-
} */
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
export const OSItemActions = styled.View`
|
|
62
|
-
max-width: 10%;
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
|
-
export const OSActions = styled.View`
|
|
66
|
-
width: 100%;
|
|
67
|
-
display: flex;
|
|
68
|
-
padding: 30px 20px 0px;
|
|
69
|
-
flex-direction: row;
|
|
70
|
-
justify-content: space-between;
|
|
71
|
-
`;
|