ordering-ui-react-native 0.15.59 → 0.15.61-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 +6 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessController/index.tsx +16 -8
- package/src/components/BusinessInformation/index.tsx +14 -0
- package/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -2
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +7 -2
- package/src/components/LoginForm/index.tsx +120 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/OrderDetails/index.tsx +7 -21
- package/src/components/PaymentOptions/index.tsx +67 -50
- package/src/components/PaymentOptionsWebView/index.tsx +120 -121
- package/src/components/ReviewDriver/index.tsx +1 -1
- package/src/components/ReviewOrder/index.tsx +2 -1
- package/src/components/ReviewProducts/index.tsx +11 -0
- package/src/components/SignupForm/index.tsx +145 -61
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/SingleProductReview/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +1 -2
- package/src/components/UpsellingProducts/index.tsx +1 -1
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +12 -0
- package/src/pages/BusinessesListing.tsx +7 -6
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/OrderDetails.tsx +1 -1
- package/src/pages/ReviewDriver.tsx +2 -2
- package/src/pages/ReviewOrder.tsx +2 -2
- package/src/pages/Sessions.tsx +22 -0
- package/src/theme.json +0 -1
- package/src/types/index.tsx +18 -11
- package/src/utils/index.tsx +68 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
- package/themes/business/src/components/Chat/index.tsx +42 -90
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- package/themes/business/src/components/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +8 -4
- package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +8 -2
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
- package/themes/kiosk/src/components/Cart/index.tsx +11 -12
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
- package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
- package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
- package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
- package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
- package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
- package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
- package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
- package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +1 -0
- package/themes/original/index.tsx +30 -8
- package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
- package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
- package/themes/original/src/components/AddressForm/index.tsx +7 -6
- package/themes/original/src/components/AddressList/index.tsx +30 -18
- package/themes/original/src/components/AppleLogin/index.tsx +9 -13
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +137 -46
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
- package/themes/original/src/components/BusinessController/index.tsx +29 -11
- package/themes/original/src/components/BusinessController/styles.tsx +5 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +205 -61
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +51 -53
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +301 -170
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +27 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +557 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +107 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +519 -0
- package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Original/styles.tsx} +11 -3
- package/themes/original/src/components/BusinessesListing/index.tsx +97 -457
- package/themes/original/src/components/Cart/index.tsx +61 -42
- package/themes/original/src/components/Checkout/index.tsx +88 -38
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/Favorite/index.tsx +92 -0
- package/themes/original/src/components/Favorite/styles.tsx +22 -0
- package/themes/original/src/components/FavoriteList/index.tsx +298 -0
- package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GPSButton/index.tsx +15 -8
- package/themes/original/src/components/GoogleMap/index.tsx +11 -11
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +332 -164
- package/themes/original/src/components/LoginForm/styles.tsx +1 -3
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/MomentSelector/index.tsx +197 -0
- package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
- package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
- package/themes/original/src/components/MyOrders/index.tsx +120 -32
- package/themes/original/src/components/MyOrders/styles.tsx +8 -1
- package/themes/original/src/components/NavBar/index.tsx +4 -4
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +151 -65
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderSummary/index.tsx +3 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +130 -38
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
- package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
- package/themes/original/src/components/ProductForm/index.tsx +70 -62
- package/themes/original/src/components/ProductForm/styles.tsx +0 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
- package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
- package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
- package/themes/original/src/components/Promotions/index.tsx +151 -133
- package/themes/original/src/components/Promotions/styles.tsx +3 -23
- package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
- package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
- package/themes/original/src/components/SearchBar/index.tsx +10 -4
- package/themes/original/src/components/ServiceForm/index.tsx +579 -0
- package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SignupForm/index.tsx +237 -126
- package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
- package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +15 -81
- package/themes/original/src/components/UserFormDetails/index.tsx +98 -66
- package/themes/original/src/components/UserProfile/index.tsx +52 -5
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +76 -9
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/OBottomPopup.tsx +44 -13
- package/themes/original/src/components/shared/OModal.tsx +4 -2
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +186 -35
- package/themes/original/src/utils/index.tsx +96 -2
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { useLanguage
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useLanguage } from 'ordering-components/native';
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import {
|
|
5
|
-
import { OButton
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { OButton } from '../shared';
|
|
6
6
|
import {
|
|
7
|
-
Card,
|
|
8
|
-
Logo,
|
|
9
|
-
Information,
|
|
10
|
-
MyOrderOptions,
|
|
11
|
-
Status,
|
|
12
7
|
WrappButton,
|
|
13
8
|
} from './styles';
|
|
14
9
|
import { PreviousOrdersParams } from '../../types';
|
|
15
|
-
import
|
|
10
|
+
import { SingleOrderCard } from '../SingleOrderCard';
|
|
16
11
|
|
|
17
12
|
export const PreviousOrders = (props: PreviousOrdersParams) => {
|
|
18
13
|
const {
|
|
@@ -24,152 +19,28 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
|
|
|
24
19
|
handleReorder,
|
|
25
20
|
reorderLoading,
|
|
26
21
|
orderID,
|
|
22
|
+
handleUpdateOrderList
|
|
27
23
|
} = props;
|
|
28
24
|
|
|
29
25
|
const theme = useTheme();
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
const styles = StyleSheet.create({
|
|
33
|
-
logo: {
|
|
34
|
-
borderRadius: 10,
|
|
35
|
-
width: 64,
|
|
36
|
-
height: 64,
|
|
37
|
-
},
|
|
38
|
-
reorderbutton: {
|
|
39
|
-
height: 23,
|
|
40
|
-
paddingLeft: 10,
|
|
41
|
-
paddingRight: 10,
|
|
42
|
-
borderRadius: 23,
|
|
43
|
-
shadowOpacity: 0,
|
|
44
|
-
backgroundColor: theme.colors.primaryContrast,
|
|
45
|
-
borderWidth: 0,
|
|
46
|
-
},
|
|
47
|
-
reorderLoading: {
|
|
48
|
-
width: 80,
|
|
49
|
-
height: 40,
|
|
50
|
-
borderRadius: 10,
|
|
51
|
-
},
|
|
52
|
-
reviewButton: {
|
|
53
|
-
height: 23,
|
|
54
|
-
maxHeight: 23,
|
|
55
|
-
backgroundColor: theme.colors.white,
|
|
56
|
-
alignItems: 'center',
|
|
57
|
-
justifyContent: 'center',
|
|
58
|
-
paddingHorizontal: 10,
|
|
59
|
-
borderRadius: 23,
|
|
60
|
-
borderWidth: 1,
|
|
61
|
-
borderColor: theme.colors.primaryContrast,
|
|
62
|
-
},
|
|
63
|
-
buttonText: {
|
|
64
|
-
color: theme.colors.primary,
|
|
65
|
-
fontSize: 10,
|
|
66
|
-
marginLeft: 2,
|
|
67
|
-
marginRight: 2,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
|
|
72
27
|
const [, t] = useLanguage();
|
|
73
|
-
const [reorderSelected, setReorderSelected] = useState<number | null>(null);
|
|
74
|
-
const [{ parseDate, optimizeImage }] = useUtils();
|
|
75
|
-
const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12];
|
|
76
|
-
|
|
77
|
-
const handleClickViewOrder = (uuid: string) => {
|
|
78
|
-
onNavigationRedirect &&
|
|
79
|
-
onNavigationRedirect('OrderDetails', { orderId: uuid });
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const handleClickOrderReview = (order: any) => {
|
|
83
|
-
onNavigationRedirect &&
|
|
84
|
-
onNavigationRedirect('ReviewOrder', {
|
|
85
|
-
order: {
|
|
86
|
-
id: order?.id,
|
|
87
|
-
business_id: order?.business_id,
|
|
88
|
-
logo: order?.business?.logo,
|
|
89
|
-
driver: order?.driver,
|
|
90
|
-
products: order?.products,
|
|
91
|
-
review: order?.review,
|
|
92
|
-
user_review: order?.user_review
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const formatDate = (date: string, option?: any) => {
|
|
98
|
-
return option?.utc ? moment.utc(date).format('DD/MM/YY \u2022 h:m a') : moment(date).format('DD/MM/YY \u2022 h:m a');
|
|
99
|
-
};
|
|
100
28
|
|
|
101
|
-
|
|
102
|
-
setReorderSelected(id);
|
|
103
|
-
handleReorder(id);
|
|
104
|
-
};
|
|
29
|
+
const pastOrders = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
|
|
105
30
|
|
|
106
31
|
return (
|
|
107
32
|
<View style={{ marginBottom: 30 }}>
|
|
108
|
-
{orders.map((order: any) => (
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
style={styles.logo}
|
|
120
|
-
/>
|
|
121
|
-
</Logo>
|
|
122
|
-
)}
|
|
123
|
-
<Information>
|
|
124
|
-
<OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
|
|
125
|
-
{order.business?.name}
|
|
126
|
-
</OText>
|
|
127
|
-
<OText
|
|
128
|
-
size={10}
|
|
129
|
-
lineHeight={15}
|
|
130
|
-
color={theme.colors.textSecondary}
|
|
131
|
-
style={{ marginVertical: 3 }}
|
|
132
|
-
numberOfLines={1}>
|
|
133
|
-
{order?.delivery_datetime_utc
|
|
134
|
-
? formatDate(order?.delivery_datetime_utc)
|
|
135
|
-
: formatDate(order?.delivery_datetime, { utc: false })}
|
|
136
|
-
</OText>
|
|
137
|
-
<OText
|
|
138
|
-
color={theme.colors.primary}
|
|
139
|
-
size={10}
|
|
140
|
-
lineHeight={15}
|
|
141
|
-
numberOfLines={1}>
|
|
142
|
-
{getOrderStatus(order.status)?.value}
|
|
143
|
-
</OText>
|
|
144
|
-
</Information>
|
|
145
|
-
<Status>
|
|
146
|
-
{order.cart && (
|
|
147
|
-
<OButton
|
|
148
|
-
text={t('REORDER', 'Reorder')}
|
|
149
|
-
imgRightSrc={''}
|
|
150
|
-
textStyle={styles.buttonText}
|
|
151
|
-
style={
|
|
152
|
-
reorderLoading && order.id === reorderSelected
|
|
153
|
-
? styles.reorderLoading
|
|
154
|
-
: styles.reorderbutton
|
|
155
|
-
}
|
|
156
|
-
onClick={() => handleReorderClick(order.id)}
|
|
157
|
-
isLoading={reorderLoading && order.id === reorderSelected}
|
|
158
|
-
/>
|
|
159
|
-
)}
|
|
160
|
-
{allowedOrderStatus.includes(parseInt(order?.status)) &&
|
|
161
|
-
!order.review && (
|
|
162
|
-
<TouchableOpacity
|
|
163
|
-
onPress={() => handleClickOrderReview(order)}
|
|
164
|
-
style={styles.reviewButton}>
|
|
165
|
-
<OText size={10} color={theme.colors.primary} numberOfLines={1}>
|
|
166
|
-
{t('REVIEW', 'Review')}
|
|
167
|
-
</OText>
|
|
168
|
-
</TouchableOpacity>
|
|
169
|
-
)}
|
|
170
|
-
</Status>
|
|
171
|
-
</Card>
|
|
172
|
-
</TouchableOpacity>
|
|
33
|
+
{orders.map((order: any, i: number) => (
|
|
34
|
+
<SingleOrderCard
|
|
35
|
+
key={i}
|
|
36
|
+
order={order}
|
|
37
|
+
reorderLoading={reorderLoading}
|
|
38
|
+
handleReorder={handleReorder}
|
|
39
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
40
|
+
getOrderStatus={getOrderStatus}
|
|
41
|
+
pastOrders={pastOrders.includes(order?.status)}
|
|
42
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
43
|
+
/>
|
|
173
44
|
))}
|
|
174
45
|
{pagination.totalPages && pagination.currentPage < pagination.totalPages && (
|
|
175
46
|
<WrappButton>
|
|
@@ -175,6 +175,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
175
175
|
const [optionLayout, setOptionLayout] = useState<any>({})
|
|
176
176
|
const [headerRefHeight, setHeaderRefHeight] = useState(0)
|
|
177
177
|
const [summaryRefHeight, setSummaryRefHeight] = useState(0)
|
|
178
|
+
const [isScrollAvailable, setIsScrollAvailable] = useState(null)
|
|
178
179
|
|
|
179
180
|
const isError = (id: number) => {
|
|
180
181
|
let bgColor = theme.colors.white;
|
|
@@ -278,47 +279,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
278
279
|
setOptionLayout(_optionLayout)
|
|
279
280
|
}
|
|
280
281
|
|
|
281
|
-
useEffect(() => {
|
|
282
|
-
const imageList: any = []
|
|
283
|
-
const videoList: any = []
|
|
284
|
-
product?.images && imageList.push(product.images)
|
|
285
|
-
if (product?.gallery && product?.gallery.length > 0) {
|
|
286
|
-
for (const img of product?.gallery) {
|
|
287
|
-
if (img?.file) {
|
|
288
|
-
imageList.push(img?.file)
|
|
289
|
-
}
|
|
290
|
-
if (img?.video) {
|
|
291
|
-
const keys = img?.video.split('/')
|
|
292
|
-
let _videoId = keys[keys.length - 1]
|
|
293
|
-
|
|
294
|
-
if (_videoId.includes('watch')) {
|
|
295
|
-
const __url = _videoId.split('=')[1]
|
|
296
|
-
_videoId = __url
|
|
297
|
-
} else if (_videoId.includes('?')) {
|
|
298
|
-
const __url = _videoId.split('?')[0]
|
|
299
|
-
_videoId = __url
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if (_videoId.search(/&/i) >= 0) {
|
|
303
|
-
_videoId = _videoId.split('&')[0]
|
|
304
|
-
} else if (_videoId.search(/\?/i) >= 0) {
|
|
305
|
-
_videoId = _videoId.split('?')[0]
|
|
306
|
-
}
|
|
307
|
-
if ((_videoId.length === 11)) {
|
|
308
|
-
videoList.push(_videoId)
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
const gallery = imageList.concat(videoList)
|
|
314
|
-
setGallery(gallery)
|
|
315
|
-
|
|
316
|
-
if (product?.weight && product?.weight_unit) {
|
|
317
|
-
setIsHaveWeight(true)
|
|
318
|
-
setPricePerWeightUnit(product?.price / product?.weight)
|
|
319
|
-
}
|
|
320
|
-
}, [product])
|
|
321
|
-
|
|
322
282
|
const saveErrors =
|
|
323
283
|
orderState.loading ||
|
|
324
284
|
maxProductQuantity === 0 ||
|
|
@@ -326,25 +286,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
326
286
|
|
|
327
287
|
const ExtraOptions = ({ eID, options }: any) => (
|
|
328
288
|
<>
|
|
329
|
-
{product?.ingredients.length > 0 && (
|
|
330
|
-
<TouchableOpacity
|
|
331
|
-
key={`eopt_all_00`}
|
|
332
|
-
onPress={() => setSelectedOpt(-1)}
|
|
333
|
-
style={[
|
|
334
|
-
styles.extraItem,
|
|
335
|
-
{
|
|
336
|
-
borderBottomColor:
|
|
337
|
-
selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
|
|
338
|
-
},
|
|
339
|
-
]}>
|
|
340
|
-
<OText
|
|
341
|
-
color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
|
|
342
|
-
size={selOpt == -1 ? 14 : 12}
|
|
343
|
-
weight={selOpt == -1 ? '600' : 'normal'}>
|
|
344
|
-
{t('INGREDIENTS', 'Ingredients')}
|
|
345
|
-
</OText>
|
|
346
|
-
</TouchableOpacity>
|
|
347
|
-
)}
|
|
348
289
|
{options.map(({ id, name, respect_to, suboptions }: any) => (
|
|
349
290
|
<React.Fragment key={`cont_key_${id}`}>
|
|
350
291
|
{respect_to == null && suboptions?.length > 0 && (
|
|
@@ -377,6 +318,54 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
377
318
|
? () => navigation.goBack()
|
|
378
319
|
: () => navigation.navigate('Business', { store: props.businessSlug })
|
|
379
320
|
|
|
321
|
+
useEffect(() => {
|
|
322
|
+
if (isScrollAvailable) {
|
|
323
|
+
setIsScrollAvailable(null)
|
|
324
|
+
scrollDown(isScrollAvailable)
|
|
325
|
+
}
|
|
326
|
+
}, [errors])
|
|
327
|
+
|
|
328
|
+
useEffect(() => {
|
|
329
|
+
const imageList: any = []
|
|
330
|
+
const videoList: any = []
|
|
331
|
+
product?.images && imageList.push(product.images)
|
|
332
|
+
if (product?.gallery && product?.gallery.length > 0) {
|
|
333
|
+
for (const img of product?.gallery) {
|
|
334
|
+
if (img?.file) {
|
|
335
|
+
imageList.push(img?.file)
|
|
336
|
+
}
|
|
337
|
+
if (img?.video) {
|
|
338
|
+
const keys = img?.video.split('/')
|
|
339
|
+
let _videoId = keys[keys.length - 1]
|
|
340
|
+
|
|
341
|
+
if (_videoId.includes('watch')) {
|
|
342
|
+
const __url = _videoId.split('=')[1]
|
|
343
|
+
_videoId = __url
|
|
344
|
+
} else if (_videoId.includes('?')) {
|
|
345
|
+
const __url = _videoId.split('?')[0]
|
|
346
|
+
_videoId = __url
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (_videoId.search(/&/i) >= 0) {
|
|
350
|
+
_videoId = _videoId.split('&')[0]
|
|
351
|
+
} else if (_videoId.search(/\?/i) >= 0) {
|
|
352
|
+
_videoId = _videoId.split('?')[0]
|
|
353
|
+
}
|
|
354
|
+
if ((_videoId.length === 11)) {
|
|
355
|
+
videoList.push(_videoId)
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
const gallery = imageList.concat(videoList)
|
|
361
|
+
setGallery(gallery)
|
|
362
|
+
|
|
363
|
+
if (product?.weight && product?.weight_unit) {
|
|
364
|
+
setIsHaveWeight(true)
|
|
365
|
+
setPricePerWeightUnit(product?.price / product?.weight)
|
|
366
|
+
}
|
|
367
|
+
}, [product])
|
|
368
|
+
|
|
380
369
|
return (
|
|
381
370
|
<SafeAreaView style={{ flex: 1 }}>
|
|
382
371
|
<TopHeader>
|
|
@@ -665,6 +654,25 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
665
654
|
{t('ALL', 'All')}
|
|
666
655
|
</OText>
|
|
667
656
|
</TouchableOpacity>
|
|
657
|
+
{product?.ingredients.length > 0 && (
|
|
658
|
+
<TouchableOpacity
|
|
659
|
+
key={`eopt_all_00`}
|
|
660
|
+
onPress={() => setSelectedOpt(-1)}
|
|
661
|
+
style={[
|
|
662
|
+
styles.extraItem,
|
|
663
|
+
{
|
|
664
|
+
borderBottomColor:
|
|
665
|
+
selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
|
|
666
|
+
},
|
|
667
|
+
]}>
|
|
668
|
+
<OText
|
|
669
|
+
color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
|
|
670
|
+
size={selOpt == -1 ? 14 : 12}
|
|
671
|
+
weight={selOpt == -1 ? '600' : 'normal'}>
|
|
672
|
+
{t('INGREDIENTS', 'Ingredients')}
|
|
673
|
+
</OText>
|
|
674
|
+
</TouchableOpacity>
|
|
675
|
+
)}
|
|
668
676
|
{product?.extras.map((extra: any) =>
|
|
669
677
|
<ExtraOptions key={extra.id} options={extra.options} />
|
|
670
678
|
)}
|
|
@@ -694,7 +702,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
694
702
|
</WrapperIngredients>
|
|
695
703
|
</View>
|
|
696
704
|
)}
|
|
697
|
-
{product?.extras.map((extra: any) =>
|
|
705
|
+
{product?.extras.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
|
|
698
706
|
extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
|
|
699
707
|
const currentState =
|
|
700
708
|
productCart.options[`id:${option.id}`] || {};
|
|
@@ -738,7 +746,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
738
746
|
isSoldOut ||
|
|
739
747
|
maxProductQuantity <= 0
|
|
740
748
|
}
|
|
741
|
-
|
|
749
|
+
setIsScrollAvailable={setIsScrollAvailable}
|
|
742
750
|
error={errors[`id:${option.id}`]}
|
|
743
751
|
/>
|
|
744
752
|
);
|
|
@@ -40,7 +40,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
40
40
|
|
|
41
41
|
const pickerStyle = StyleSheet.create({
|
|
42
42
|
inputAndroid: {
|
|
43
|
-
width:
|
|
43
|
+
width: 34,
|
|
44
44
|
textAlign: 'center',
|
|
45
45
|
overflow: 'visible',
|
|
46
46
|
fontSize: 12,
|
|
@@ -49,7 +49,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
49
49
|
color: theme.colors.textNormal
|
|
50
50
|
},
|
|
51
51
|
inputIOS: {
|
|
52
|
-
width:
|
|
52
|
+
width: 34,
|
|
53
53
|
textAlign: 'center',
|
|
54
54
|
overflow: 'visible',
|
|
55
55
|
fontSize: 12,
|
|
@@ -28,36 +28,40 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
28
28
|
toggleSelect,
|
|
29
29
|
changePosition,
|
|
30
30
|
disabled,
|
|
31
|
-
|
|
32
|
-
scrollDown
|
|
31
|
+
setIsScrollAvailable
|
|
33
32
|
} = props
|
|
34
33
|
|
|
34
|
+
const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
|
|
35
|
+
const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
|
|
36
|
+
|
|
35
37
|
const theme = useTheme();
|
|
36
|
-
|
|
37
38
|
const [, t] = useLanguage()
|
|
38
39
|
const [{ parsePrice }] = useUtils()
|
|
39
40
|
const [showMessage, setShowMessage] = useState(false)
|
|
41
|
+
const [isDirty, setIsDirty] = useState(false)
|
|
40
42
|
|
|
41
43
|
const handleSuboptionClick = () => {
|
|
42
44
|
toggleSelect()
|
|
43
|
-
|
|
44
|
-
if (balance === option?.max - 1 && !state.selected) {
|
|
45
|
-
scrollDown(option?.id)
|
|
46
|
-
}
|
|
45
|
+
setIsDirty(true)
|
|
47
46
|
|
|
48
47
|
if (balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1)) {
|
|
49
48
|
setShowMessage(true)
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (balance === option?.max && state?.selected && isDirty) {
|
|
54
|
+
setIsDirty(false)
|
|
55
|
+
setIsScrollAvailable(option?.id)
|
|
56
|
+
}
|
|
57
|
+
}, [state?.selected])
|
|
58
|
+
|
|
53
59
|
useEffect(() => {
|
|
54
60
|
if (!(balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1))) {
|
|
55
61
|
setShowMessage(false)
|
|
56
62
|
}
|
|
57
63
|
}, [balance])
|
|
58
64
|
|
|
59
|
-
const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
|
|
60
|
-
const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
|
|
61
65
|
return (
|
|
62
66
|
<View>
|
|
63
67
|
<Container onPress={() => handleSuboptionClick()}>
|
|
@@ -130,9 +134,11 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
130
134
|
</>
|
|
131
135
|
)}
|
|
132
136
|
</PositionControl>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
137
|
+
{price > 0 && (
|
|
138
|
+
<OText size={12} lineHeight={18} color={theme.colors.textSecondary}>
|
|
139
|
+
+ {parsePrice(price)}
|
|
140
|
+
</OText>
|
|
141
|
+
)}
|
|
136
142
|
</Container>
|
|
137
143
|
{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>}
|
|
138
144
|
</View>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { ScrollView, TouchableOpacity, View, StyleSheet, Platform } from 'react-native'
|
|
3
|
+
import { useUtils, useLanguage } from 'ordering-components/native'
|
|
4
|
+
import { useTheme } from 'styled-components/native'
|
|
5
|
+
import FastImage from 'react-native-fast-image'
|
|
6
|
+
import { OIcon, OText, OModal } from '../shared'
|
|
7
|
+
import { ProfessionalProfile } from '../ProfessionalProfile'
|
|
8
|
+
import { ProfessionalFilterParams } from '../../types'
|
|
9
|
+
|
|
10
|
+
export const ProfessionalFilter = (props: ProfessionalFilterParams) => {
|
|
11
|
+
const {
|
|
12
|
+
professionals,
|
|
13
|
+
professionalSelected,
|
|
14
|
+
handleChangeProfessionalSelected
|
|
15
|
+
} = props
|
|
16
|
+
|
|
17
|
+
const theme = useTheme()
|
|
18
|
+
const [{ optimizeImage }] = useUtils()
|
|
19
|
+
const [, t] = useLanguage()
|
|
20
|
+
const [open, setOpen] = useState(false)
|
|
21
|
+
const [currentProfessional, setCurrentProfessional] = useState(null)
|
|
22
|
+
|
|
23
|
+
const handleOpenProfile = (professional: any) => {
|
|
24
|
+
setCurrentProfessional(professional)
|
|
25
|
+
setOpen(true)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const handleCloseProfile = () => {
|
|
29
|
+
setCurrentProfessional(null)
|
|
30
|
+
setOpen(false)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
professionalItem: {
|
|
35
|
+
flexDirection: 'row',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
borderRadius: 7.6,
|
|
38
|
+
padding: 11,
|
|
39
|
+
borderWidth: 1,
|
|
40
|
+
marginRight: 12,
|
|
41
|
+
minHeight: 64
|
|
42
|
+
},
|
|
43
|
+
photoStyle: {
|
|
44
|
+
width: 42,
|
|
45
|
+
height: 42,
|
|
46
|
+
borderRadius: 7.6
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<>
|
|
52
|
+
<ScrollView
|
|
53
|
+
horizontal
|
|
54
|
+
showsVerticalScrollIndicator={false}
|
|
55
|
+
showsHorizontalScrollIndicator={false}
|
|
56
|
+
>
|
|
57
|
+
<TouchableOpacity
|
|
58
|
+
onPress={() => handleChangeProfessionalSelected(null)}
|
|
59
|
+
>
|
|
60
|
+
<View
|
|
61
|
+
style={{
|
|
62
|
+
...styles.professionalItem,
|
|
63
|
+
borderColor: !professionalSelected
|
|
64
|
+
? theme.colors.primary
|
|
65
|
+
: theme.colors.border
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<OText
|
|
69
|
+
size={12}
|
|
70
|
+
weight={'400'}
|
|
71
|
+
>
|
|
72
|
+
{t('ANY_PROFESSIONAL_MEMBER', 'Any professional member')}
|
|
73
|
+
</OText>
|
|
74
|
+
</View>
|
|
75
|
+
</TouchableOpacity>
|
|
76
|
+
{professionals.map((professional: any, i: number) => (
|
|
77
|
+
<TouchableOpacity
|
|
78
|
+
key={i}
|
|
79
|
+
onPress={() => handleOpenProfile(professional)}
|
|
80
|
+
>
|
|
81
|
+
<View
|
|
82
|
+
style={{
|
|
83
|
+
...styles.professionalItem,
|
|
84
|
+
borderColor: (professional?.id === professionalSelected?.id)
|
|
85
|
+
? theme.colors.primary
|
|
86
|
+
: theme.colors.border
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
{professional?.photo ? (
|
|
90
|
+
<FastImage
|
|
91
|
+
style={styles.photoStyle}
|
|
92
|
+
source={{
|
|
93
|
+
uri: optimizeImage(professional?.photo, 'h_250,c_limit'),
|
|
94
|
+
priority: FastImage.priority.normal,
|
|
95
|
+
}}
|
|
96
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
97
|
+
/>
|
|
98
|
+
) : (
|
|
99
|
+
<OIcon
|
|
100
|
+
src={theme?.images?.dummies?.product}
|
|
101
|
+
style={styles.photoStyle}
|
|
102
|
+
/>
|
|
103
|
+
)}
|
|
104
|
+
<OText
|
|
105
|
+
size={12}
|
|
106
|
+
style={{ marginLeft: 12 }}
|
|
107
|
+
weight={'400'}
|
|
108
|
+
>
|
|
109
|
+
{professional?.name} {professional?.lastname}
|
|
110
|
+
</OText>
|
|
111
|
+
</View>
|
|
112
|
+
</TouchableOpacity>
|
|
113
|
+
))}
|
|
114
|
+
</ScrollView>
|
|
115
|
+
<OModal
|
|
116
|
+
open={open}
|
|
117
|
+
onClose={() => handleCloseProfile()}
|
|
118
|
+
entireModal
|
|
119
|
+
>
|
|
120
|
+
<ProfessionalProfile
|
|
121
|
+
professional={currentProfessional}
|
|
122
|
+
onClose={() => handleCloseProfile()}
|
|
123
|
+
handleChangeProfessionalSelected={handleChangeProfessionalSelected}
|
|
124
|
+
/>
|
|
125
|
+
</OModal>
|
|
126
|
+
</>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
File without changes
|