ordering-ui-react-native 0.15.81 → 0.15.82-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 +7 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/index.tsx +61 -63
- package/src/components/ActiveOrders/styles.tsx +1 -1
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessBasicInformation/index.tsx +11 -19
- 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 +25 -3
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +24 -15
- package/src/components/LoginForm/index.tsx +120 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/NotificationSetting/index.tsx +85 -0
- package/src/components/OrderDetails/index.tsx +7 -21
- package/src/components/PaymentOptions/index.tsx +335 -365
- 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/StripeElementsForm/index.tsx +25 -16
- package/src/components/StripeMethodForm/index.tsx +22 -24
- 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/OBottomPopup.tsx +6 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/index.tsx +2 -0
- package/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +6 -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/theme.json +0 -1
- package/src/types/index.tsx +18 -11
- package/src/utils/index.tsx +28 -29
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +100 -60
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/Chat/index.tsx +51 -91
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
- package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
- 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 +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +26 -18
- package/themes/business/src/components/OrdersListManager/index.tsx +11 -4
- package/themes/business/src/components/OrdersOption/index.tsx +16 -4
- package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
- package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
- package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
- package/themes/business/src/components/shared/OModal.tsx +41 -38
- package/themes/business/src/types/index.tsx +15 -7
- 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 +25 -26
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
- package/themes/kiosk/src/components/Cart/index.tsx +10 -11
- 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 +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +55 -53
- package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
- 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 +22 -0
- 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 +1 -1
- package/themes/original/src/components/AppleLogin/index.tsx +6 -8
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +291 -150
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
- package/themes/original/src/components/BusinessController/index.tsx +179 -96
- 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 +234 -64
- 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/SubcategoriesComponent/index.tsx +87 -0
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +65 -73
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +315 -176
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +11 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +560 -0
- package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +661 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +104 -462
- package/themes/original/src/components/Cart/index.tsx +84 -39
- package/themes/original/src/components/Cart/styles.tsx +4 -0
- package/themes/original/src/components/Checkout/index.tsx +117 -58
- package/themes/original/src/components/Checkout/styles.tsx +0 -1
- 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/Messages/index.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 +304 -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 +132 -27
- 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 +164 -64
- package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
- package/themes/original/src/components/OrderItAgain/index.tsx +72 -0
- package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
- package/themes/original/src/components/OrderSummary/index.tsx +2 -35
- package/themes/original/src/components/OrderTypeSelector/index.tsx +77 -35
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- 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 +139 -46
- 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 +15 -22
- package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
- package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
- package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
- package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
- package/themes/original/src/components/ProductForm/index.tsx +712 -673
- package/themes/original/src/components/ProductForm/styles.tsx +9 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +13 -9
- 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 +23 -6
- package/themes/original/src/components/Promotions/styles.tsx +2 -0
- 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 +13 -5
- 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/SignupForm/index.tsx +237 -126
- package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +196 -94
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +0 -4
- package/themes/original/src/components/UserDetails/index.tsx +32 -18
- package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
- package/themes/original/src/components/UserProfile/index.tsx +5 -1
- package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- package/themes/original/src/components/Wallets/index.tsx +2 -2
- package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
- package/themes/original/src/components/shared/OButton.tsx +2 -0
- package/themes/original/src/components/shared/OInput.tsx +3 -2
- 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 +208 -44
- package/themes/original/src/utils/index.tsx +94 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -49,7 +49,7 @@ export const ProductDescription = styled.View`
|
|
|
49
49
|
`
|
|
50
50
|
|
|
51
51
|
export const ProductEditions = styled.View`
|
|
52
|
-
|
|
52
|
+
padding: 0 40px;
|
|
53
53
|
`
|
|
54
54
|
|
|
55
55
|
export const SectionTitle = styled.View`
|
|
@@ -65,26 +65,24 @@ export const WrapperSubOption = styled.View`
|
|
|
65
65
|
`
|
|
66
66
|
|
|
67
67
|
export const ProductComment = styled.View`
|
|
68
|
-
padding-bottom:
|
|
68
|
+
padding-bottom: 60px;
|
|
69
69
|
`
|
|
70
70
|
|
|
71
71
|
export const ProductActions = styled.View`
|
|
72
72
|
position: absolute;
|
|
73
73
|
bottom: 0px;
|
|
74
|
-
min-height: 70px;
|
|
75
74
|
padding-top: ${(props: any) => props.ios ? '20px' : '0'};
|
|
76
75
|
padding-horizontal: 40px;
|
|
76
|
+
padding-vertical: 20px;
|
|
77
77
|
width: 100%;
|
|
78
|
-
flex-direction: row;
|
|
78
|
+
flex-direction: ${(props: any) => props.isColumn ? 'column' : 'row'};
|
|
79
79
|
background-color: #FFF;
|
|
80
80
|
z-index: 1000;
|
|
81
|
-
align-items: center;
|
|
82
|
-
justify-content: space-between;
|
|
83
81
|
border-top-width: 1px;
|
|
84
82
|
border-top-color: ${(props: any) => props.theme.colors.border};
|
|
85
83
|
`
|
|
86
84
|
export const ExtraOptionWrap = styled.ScrollView`
|
|
87
|
-
margin-horizontal:
|
|
85
|
+
margin-horizontal: 30px;
|
|
88
86
|
`;
|
|
89
87
|
|
|
90
88
|
export const WeightUnitSwitch = styled.View`
|
|
@@ -99,4 +97,8 @@ export const WeightUnitItem = styled.View`
|
|
|
99
97
|
`}
|
|
100
98
|
`
|
|
101
99
|
export const ProductSummary = styled.View`
|
|
100
|
+
padding: 26px 40px;
|
|
101
|
+
position: relative;
|
|
102
|
+
background-color: white;
|
|
103
|
+
z-index: 100;
|
|
102
104
|
`
|
|
@@ -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,
|
|
@@ -30,7 +30,7 @@ const ProductOptionUI = (props: any) => {
|
|
|
30
30
|
return (
|
|
31
31
|
<Container style={{ color: error ? 'orange' : theme.colors.white }}>
|
|
32
32
|
<WrapHeader>
|
|
33
|
-
<OText size={16} lineHeight={24} weight={'600'}>{option.name}</OText>
|
|
33
|
+
<OText size={16} lineHeight={24} weight={'600'} style={{ flex: 1 }}>{option.name}</OText>
|
|
34
34
|
<OText color={theme.colors.red}>{maxMin}</OText>
|
|
35
35
|
</WrapHeader>
|
|
36
36
|
{children}
|
|
@@ -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()}>
|
|
@@ -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
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react'
|
|
2
|
+
import { StyleSheet, Platform, View, Dimensions } from 'react-native'
|
|
3
|
+
import { useUtils, useLanguage, useConfig } from 'ordering-components/native'
|
|
4
|
+
import { useTheme } from 'styled-components/native'
|
|
5
|
+
import CalendarPicker from 'react-native-calendar-picker'
|
|
6
|
+
import FeatherIcon from 'react-native-vector-icons/Feather';
|
|
7
|
+
import moment from 'moment'
|
|
8
|
+
import SelectDropdown from 'react-native-select-dropdown'
|
|
9
|
+
import { OButton, OText } from '../shared'
|
|
10
|
+
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
11
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
12
|
+
import { ProfessionalProfileParams } from '../../types'
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
Container,
|
|
16
|
+
ProfessionalPhoto,
|
|
17
|
+
InfoWrapper,
|
|
18
|
+
Divider,
|
|
19
|
+
ScheduleWrapper,
|
|
20
|
+
ButtonWrapper,
|
|
21
|
+
CalendarWrapper
|
|
22
|
+
} from './styles'
|
|
23
|
+
|
|
24
|
+
const windowWidth = Dimensions.get('window').width
|
|
25
|
+
|
|
26
|
+
export const ProfessionalProfile = (props: ProfessionalProfileParams) => {
|
|
27
|
+
const {
|
|
28
|
+
professional,
|
|
29
|
+
handleChangeProfessionalSelected,
|
|
30
|
+
onClose
|
|
31
|
+
} = props
|
|
32
|
+
|
|
33
|
+
const [{ optimizeImage }] = useUtils()
|
|
34
|
+
const theme = useTheme()
|
|
35
|
+
const [, t] = useLanguage()
|
|
36
|
+
const [{ configs }] = useConfig()
|
|
37
|
+
const { top } = useSafeAreaInsets()
|
|
38
|
+
|
|
39
|
+
const [selectDate, setSelectedDate] = useState<any>(new Date())
|
|
40
|
+
const [isEnabled, setIsEnabled] = useState(false)
|
|
41
|
+
const [timeList, setTimeList] = useState<any>([])
|
|
42
|
+
const dropdownRef = useRef<any>(null)
|
|
43
|
+
|
|
44
|
+
const styles = StyleSheet.create({
|
|
45
|
+
buttonStyle: {
|
|
46
|
+
borderRadius: 7.6,
|
|
47
|
+
height: 44,
|
|
48
|
+
borderWidth: 0
|
|
49
|
+
},
|
|
50
|
+
selectOption: {
|
|
51
|
+
width: '100%',
|
|
52
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
53
|
+
paddingVertical: 5,
|
|
54
|
+
paddingHorizontal: 14,
|
|
55
|
+
flexDirection: 'row-reverse',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
justifyContent: 'space-between',
|
|
58
|
+
height: 40,
|
|
59
|
+
marginBottom: 30
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const onDateChange = (date: any) => {
|
|
64
|
+
setSelectedDate(date)
|
|
65
|
+
dropdownRef?.current && dropdownRef.current.reset()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const dropDownIcon = () => {
|
|
69
|
+
return (
|
|
70
|
+
<IconAntDesign
|
|
71
|
+
name='down'
|
|
72
|
+
color={theme.colors.textThird}
|
|
73
|
+
size={12}
|
|
74
|
+
/>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const customDayHeaderStylesCallback = () => {
|
|
79
|
+
return {
|
|
80
|
+
textStyle: {
|
|
81
|
+
color: theme.colors.disabled,
|
|
82
|
+
fontSize: 12,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const validateSelectedDate = (curdate: any, menu: any) => {
|
|
88
|
+
const day = moment(curdate).format('d')
|
|
89
|
+
setIsEnabled(menu?.schedule?.[day]?.enabled || false)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const getTimes = (curdate: any, menu: any) => {
|
|
93
|
+
validateSelectedDate(curdate, menu)
|
|
94
|
+
const date = new Date()
|
|
95
|
+
var dateSeleted = new Date(curdate)
|
|
96
|
+
var times = []
|
|
97
|
+
for (var k = 0; k < menu.schedule[dateSeleted.getDay()].lapses.length; k++) {
|
|
98
|
+
var open = {
|
|
99
|
+
hour: menu.schedule[dateSeleted.getDay()].lapses[k].open.hour,
|
|
100
|
+
minute: menu.schedule[dateSeleted.getDay()].lapses[k].open.minute
|
|
101
|
+
}
|
|
102
|
+
var close = {
|
|
103
|
+
hour: menu.schedule[dateSeleted.getDay()].lapses[k].close.hour,
|
|
104
|
+
minute: menu.schedule[dateSeleted.getDay()].lapses[k].close.minute
|
|
105
|
+
}
|
|
106
|
+
for (var i = open.hour; i <= close.hour; i++) {
|
|
107
|
+
if (date.getDate() !== dateSeleted.getDate() || i >= date.getHours()) {
|
|
108
|
+
let hour = ''
|
|
109
|
+
let meridian = ''
|
|
110
|
+
if (configs?.format_time?.value === '12') {
|
|
111
|
+
if (i === 0) {
|
|
112
|
+
hour = '12'
|
|
113
|
+
meridian = ' ' + t('AM', 'AM')
|
|
114
|
+
} else if (i > 0 && i < 12) {
|
|
115
|
+
hour = (i < 10 ? '0' + i : i)
|
|
116
|
+
meridian = ' ' + t('AM', 'AM')
|
|
117
|
+
} else if (i === 12) {
|
|
118
|
+
hour = '12'
|
|
119
|
+
meridian = ' ' + t('PM', 'PM')
|
|
120
|
+
} else {
|
|
121
|
+
hour = ((i - 12 < 10) ? '0' + (i - 12) : `${(i - 12)}`)
|
|
122
|
+
meridian = ' ' + t('PM', 'PM')
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
hour = i < 10 ? '0' + i : i
|
|
126
|
+
}
|
|
127
|
+
for (let j = (i === open.hour ? open.minute : 0); j <= (i === close.hour ? close.minute : 59); j += 15) {
|
|
128
|
+
if (i !== date.getHours() || j >= date.getMinutes() || date.getDate() !== dateSeleted.getDate()) {
|
|
129
|
+
times.push({
|
|
130
|
+
text: hour + ':' + (j < 10 ? '0' + j : j) + meridian,
|
|
131
|
+
value: (i < 10 ? '0' + i : i) + ':' + (j < 10 ? '0' + j : j)
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return times
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const handleSelectProfessional = () => {
|
|
142
|
+
handleChangeProfessionalSelected(professional)
|
|
143
|
+
onClose && onClose()
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
if (selectDate === null) return
|
|
148
|
+
const _times = getTimes(selectDate, professional)
|
|
149
|
+
setTimeList(_times)
|
|
150
|
+
}, [selectDate, professional])
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<Container>
|
|
154
|
+
<ProfessionalPhoto
|
|
155
|
+
source={{
|
|
156
|
+
uri:
|
|
157
|
+
professional?.photo ||
|
|
158
|
+
optimizeImage(theme.images.general.user, 'h_250,c_limit'),
|
|
159
|
+
}}
|
|
160
|
+
/>
|
|
161
|
+
<InfoWrapper>
|
|
162
|
+
<OText
|
|
163
|
+
size={20}
|
|
164
|
+
style={{ marginBottom: 3 }}
|
|
165
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
166
|
+
>
|
|
167
|
+
{professional?.name} {professional?.lastname}
|
|
168
|
+
</OText>
|
|
169
|
+
</InfoWrapper>
|
|
170
|
+
<Divider />
|
|
171
|
+
<ScheduleWrapper>
|
|
172
|
+
<View
|
|
173
|
+
style={{
|
|
174
|
+
flexDirection: 'row',
|
|
175
|
+
justifyContent: 'space-between',
|
|
176
|
+
alignItems: 'center',
|
|
177
|
+
marginBottom: 23
|
|
178
|
+
}}
|
|
179
|
+
>
|
|
180
|
+
<OText
|
|
181
|
+
size={16}
|
|
182
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
183
|
+
>
|
|
184
|
+
{t('SCHEDULE', 'Schedule')}
|
|
185
|
+
</OText>
|
|
186
|
+
<OText
|
|
187
|
+
size={10}
|
|
188
|
+
weight={'400'}
|
|
189
|
+
color={theme.colors?.danger5}
|
|
190
|
+
>
|
|
191
|
+
{t('REQUIRED', 'Required')}
|
|
192
|
+
</OText>
|
|
193
|
+
</View>
|
|
194
|
+
{!!professional?.schedule ? (
|
|
195
|
+
<CalendarWrapper>
|
|
196
|
+
{(timeList?.length > 0 && isEnabled) ? (
|
|
197
|
+
<SelectDropdown
|
|
198
|
+
ref={dropdownRef}
|
|
199
|
+
data={timeList}
|
|
200
|
+
onSelect={(selectedItem, index) => {
|
|
201
|
+
console.log(selectedItem.value)
|
|
202
|
+
}}
|
|
203
|
+
buttonTextAfterSelection={(selectedItem, index) => {
|
|
204
|
+
return selectedItem.text
|
|
205
|
+
}}
|
|
206
|
+
rowTextForSelection={(item, index) => {
|
|
207
|
+
return item.text
|
|
208
|
+
}}
|
|
209
|
+
buttonStyle={{borderRadius: 7.6, ...styles.selectOption}}
|
|
210
|
+
buttonTextStyle={{
|
|
211
|
+
color: theme.colors.disabled,
|
|
212
|
+
fontSize: 14,
|
|
213
|
+
textAlign: 'left',
|
|
214
|
+
marginHorizontal: 0
|
|
215
|
+
}}
|
|
216
|
+
dropdownStyle={{
|
|
217
|
+
borderRadius: 8,
|
|
218
|
+
borderColor: theme.colors.lightGray,
|
|
219
|
+
marginTop: Platform.OS === 'ios' ? 12 : -top
|
|
220
|
+
}}
|
|
221
|
+
rowStyle={{
|
|
222
|
+
borderBottomColor: theme.colors.backgroundGray100,
|
|
223
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
224
|
+
height: 30,
|
|
225
|
+
flexDirection: 'column',
|
|
226
|
+
alignItems: 'flex-start',
|
|
227
|
+
paddingTop: 8,
|
|
228
|
+
paddingHorizontal: 12
|
|
229
|
+
}}
|
|
230
|
+
rowTextStyle={{
|
|
231
|
+
color: theme.colors.disabled,
|
|
232
|
+
fontSize: 14,
|
|
233
|
+
marginHorizontal: 0
|
|
234
|
+
}}
|
|
235
|
+
renderDropdownIcon={() => dropDownIcon()}
|
|
236
|
+
dropdownOverlayColor='transparent'
|
|
237
|
+
/>
|
|
238
|
+
) : (
|
|
239
|
+
<OText
|
|
240
|
+
size={12}
|
|
241
|
+
style={{ marginBottom: 30 }}
|
|
242
|
+
weight={'400'}
|
|
243
|
+
color={theme.colors?.danger5}
|
|
244
|
+
>
|
|
245
|
+
{t('PROFESSIONAL_NOT_AVAILABLE', 'Professional is not available at the moment')}
|
|
246
|
+
</OText>
|
|
247
|
+
)}
|
|
248
|
+
|
|
249
|
+
<CalendarPicker
|
|
250
|
+
previousComponent={
|
|
251
|
+
<FeatherIcon
|
|
252
|
+
name='chevron-left'
|
|
253
|
+
color={theme.colors.disabled}
|
|
254
|
+
size={24}
|
|
255
|
+
style={{ marginHorizontal: 4 }}
|
|
256
|
+
/>
|
|
257
|
+
}
|
|
258
|
+
nextComponent={
|
|
259
|
+
<FeatherIcon
|
|
260
|
+
name='chevron-right'
|
|
261
|
+
color={theme.colors.disabled}
|
|
262
|
+
size={24}
|
|
263
|
+
style={{ marginHorizontal: 4 }}
|
|
264
|
+
/>
|
|
265
|
+
}
|
|
266
|
+
width={windowWidth - 110}
|
|
267
|
+
selectedDayTextColor={theme.colors.white}
|
|
268
|
+
selectedDayColor={theme.colors.primary}
|
|
269
|
+
todayBackgroundColor={theme.colors.border}
|
|
270
|
+
dayLabelsWrapper={{ borderColor: theme.colors.clear }}
|
|
271
|
+
onDateChange={onDateChange}
|
|
272
|
+
minDate={new Date()}
|
|
273
|
+
customDayHeaderStyles={customDayHeaderStylesCallback}
|
|
274
|
+
selectedStartDate={selectDate}
|
|
275
|
+
/>
|
|
276
|
+
</CalendarWrapper>
|
|
277
|
+
) : (
|
|
278
|
+
<OText
|
|
279
|
+
size={20}
|
|
280
|
+
style={{ marginBottom: 30 }}
|
|
281
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
282
|
+
>
|
|
283
|
+
{t('NO_SCHEDULE', 'No schedule')}
|
|
284
|
+
</OText>
|
|
285
|
+
)}
|
|
286
|
+
</ScheduleWrapper>
|
|
287
|
+
<ButtonWrapper>
|
|
288
|
+
<OButton
|
|
289
|
+
bgColor={theme.colors.primary}
|
|
290
|
+
onClick={() => handleSelectProfessional()}
|
|
291
|
+
text={t('BOOK', 'Book')}
|
|
292
|
+
style={styles.buttonStyle}
|
|
293
|
+
textStyle={{ fontSize: 14, color: theme.colors.white }}
|
|
294
|
+
/>
|
|
295
|
+
</ButtonWrapper>
|
|
296
|
+
</Container>
|
|
297
|
+
)
|
|
298
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import styled from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const Container = styled.ScrollView``
|
|
4
|
+
|
|
5
|
+
export const ProfessionalPhoto = styled.ImageBackground`
|
|
6
|
+
width: 100%;
|
|
7
|
+
position: relative;
|
|
8
|
+
max-height: 258px;
|
|
9
|
+
height: 258px;
|
|
10
|
+
resize-mode: cover;
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export const InfoWrapper = styled.View`
|
|
14
|
+
margin-vertical: 30px;
|
|
15
|
+
padding-horizontal: 40px;
|
|
16
|
+
`
|
|
17
|
+
|
|
18
|
+
export const Divider = styled.View`
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 8px;
|
|
21
|
+
background-color: ${(props: any) => props.theme.colors.backgroundGray100};
|
|
22
|
+
`
|
|
23
|
+
|
|
24
|
+
export const ScheduleWrapper = styled.View`
|
|
25
|
+
padding-horizontal: 40px;
|
|
26
|
+
margin-top: 30px;
|
|
27
|
+
`
|
|
28
|
+
|
|
29
|
+
export const ButtonWrapper = styled.View`
|
|
30
|
+
justify-content: center;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
padding-vertical: 13px;
|
|
33
|
+
margin-top: 30px;
|
|
34
|
+
margin-bottom: 40px;
|
|
35
|
+
width: 100%;
|
|
36
|
+
border-top-width: 1px;
|
|
37
|
+
border-top-color: ${(props: any) => props.theme.colors.backgroundGray200};
|
|
38
|
+
`
|
|
39
|
+
|
|
40
|
+
export const CalendarWrapper = styled.View`
|
|
41
|
+
flex: 1;
|
|
42
|
+
border-width: 1px;
|
|
43
|
+
border-color: ${(props: any) => props.theme.colors.backgroundGray200};
|
|
44
|
+
border-radius: 7.6px;
|
|
45
|
+
padding: 15px;
|
|
46
|
+
`
|
|
@@ -17,7 +17,7 @@ import { useTheme } from 'styled-components/native';
|
|
|
17
17
|
import { OButton, OIcon, OModal, OText } from '../shared'
|
|
18
18
|
import { Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
19
19
|
import { NotFoundSource } from '../NotFoundSource'
|
|
20
|
-
import { View, StyleSheet, ScrollView, Platform } from 'react-native'
|
|
20
|
+
import { View, StyleSheet, ScrollView, Platform, RefreshControl } from 'react-native'
|
|
21
21
|
import FastImage from 'react-native-fast-image'
|
|
22
22
|
import { PromotionParams } from '../../types'
|
|
23
23
|
import { Container } from '../../layouts/Container'
|
|
@@ -28,6 +28,7 @@ const PromotionsUI = (props: PromotionParams) => {
|
|
|
28
28
|
offersState,
|
|
29
29
|
handleSearchValue,
|
|
30
30
|
searchValue,
|
|
31
|
+
loadOffers,
|
|
31
32
|
offerSelected,
|
|
32
33
|
setOfferSelected
|
|
33
34
|
} = props
|
|
@@ -68,6 +69,7 @@ const PromotionsUI = (props: PromotionParams) => {
|
|
|
68
69
|
const [, t] = useLanguage()
|
|
69
70
|
const [{ parseDate, parsePrice, optimizeImage }] = useUtils()
|
|
70
71
|
const [openModal, setOpenModal] = useState(false)
|
|
72
|
+
const [refreshing] = useState(false);
|
|
71
73
|
|
|
72
74
|
const handleClickOffer = (offer: any) => {
|
|
73
75
|
setOpenModal(true)
|
|
@@ -79,6 +81,12 @@ const PromotionsUI = (props: PromotionParams) => {
|
|
|
79
81
|
navigation.navigate('Business', { store: store.slug })
|
|
80
82
|
}
|
|
81
83
|
|
|
84
|
+
const handleOnRefresh = () => {
|
|
85
|
+
if (!offersState.loading) {
|
|
86
|
+
loadOffers();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
82
90
|
const filteredOffers = offersState?.offers?.filter((offer: any) => offer.name.toLowerCase().includes(searchValue.toLowerCase()))
|
|
83
91
|
const targetString = offerSelected?.target === 1
|
|
84
92
|
? t('SUBTOTAL', 'Subtotal')
|
|
@@ -87,12 +95,21 @@ const PromotionsUI = (props: PromotionParams) => {
|
|
|
87
95
|
: t('SERVICE_FEE', 'Service fee')
|
|
88
96
|
|
|
89
97
|
return (
|
|
90
|
-
<Container
|
|
98
|
+
<Container
|
|
99
|
+
noPadding
|
|
100
|
+
refreshControl={
|
|
101
|
+
<RefreshControl
|
|
102
|
+
refreshing={refreshing}
|
|
103
|
+
onRefresh={() => handleOnRefresh()}
|
|
104
|
+
/>
|
|
105
|
+
}
|
|
106
|
+
>
|
|
91
107
|
<NavBar
|
|
92
108
|
title={t('PROMOTIONS', 'Promotions')}
|
|
93
109
|
titleAlign={'center'}
|
|
94
110
|
onActionLeft={() => navigation.goBack()}
|
|
95
111
|
showCall={false}
|
|
112
|
+
style={{ paddingVertical: Platform.OS === 'ios' ? 0 : 20, marginLeft: 20 }}
|
|
96
113
|
/>
|
|
97
114
|
<PromotionsContainer>
|
|
98
115
|
<SearchBarContainer>
|
|
@@ -123,7 +140,7 @@ const PromotionsUI = (props: PromotionParams) => {
|
|
|
123
140
|
<SingleOfferContainer key={offer.id}>
|
|
124
141
|
<OfferInformation>
|
|
125
142
|
<OText style={styles.offerTitle} numberOfLines={2}>{offer?.name}</OText>
|
|
126
|
-
{offer?.description && (
|
|
143
|
+
{!!offer?.description && (
|
|
127
144
|
<OText style={styles.offerDescription} numberOfLines={2}>{offer?.description}</OText>
|
|
128
145
|
)}
|
|
129
146
|
<OText style={styles.offerExtraInfo}>
|
|
@@ -169,13 +186,13 @@ const PromotionsUI = (props: PromotionParams) => {
|
|
|
169
186
|
{offerSelected?.auto && (
|
|
170
187
|
<OText>{t('OFFER_AUTOMATIC', 'This offer applies automatic')}</OText>
|
|
171
188
|
)}
|
|
172
|
-
{offerSelected?.minimum && (
|
|
189
|
+
{!!offerSelected?.minimum && (
|
|
173
190
|
<OText>{t('MINIMUM_PURCHASE_FOR_OFFER', 'Minimum purchase for use this offer')}: {parsePrice(offerSelected?.minimum)}</OText>
|
|
174
191
|
)}
|
|
175
|
-
{offerSelected?.max_discount && (
|
|
192
|
+
{!!offerSelected?.max_discount && (
|
|
176
193
|
<OText>{t('MAX_DISCOUNT_ALLOWED', 'Max discount allowed')}: {parsePrice(offerSelected?.max_discount)}</OText>
|
|
177
194
|
)}
|
|
178
|
-
{offerSelected?.description && (
|
|
195
|
+
{!!offerSelected?.description && (
|
|
179
196
|
<OText>{offerSelected?.description}</OText>
|
|
180
197
|
)}
|
|
181
198
|
</OfferData>
|