ordering-ui-react-native 0.15.79-release → 0.15.80-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 +1 -1
- package/themes/original/src/components/Checkout/index.tsx +20 -11
- package/themes/original/src/components/OrderDetails/index.tsx +16 -1
- package/themes/original/src/components/OrderDetails/styles.tsx +4 -0
- package/themes/original/src/components/OrderSummary/index.tsx +1 -34
- package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
- package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
- package/themes/original/src/types/index.tsx +12 -4
package/package.json
CHANGED
|
@@ -24,6 +24,7 @@ import { DriverTips } from '../DriverTips';
|
|
|
24
24
|
import { NotFoundSource } from '../NotFoundSource';
|
|
25
25
|
import { UserDetails } from '../UserDetails';
|
|
26
26
|
import { PaymentOptionWallet } from '../PaymentOptionWallet';
|
|
27
|
+
import { PlaceSpot } from '../PlaceSpot'
|
|
27
28
|
|
|
28
29
|
import {
|
|
29
30
|
ChContainer,
|
|
@@ -142,7 +143,8 @@ const CheckoutUI = (props: any) => {
|
|
|
142
143
|
const [isOpen, setIsOpen] = useState(false)
|
|
143
144
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
144
145
|
|
|
145
|
-
const placeSpotTypes = [4]
|
|
146
|
+
const placeSpotTypes = [3, 4, 5]
|
|
147
|
+
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
146
148
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
147
149
|
const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
148
150
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
@@ -150,8 +152,9 @@ const CheckoutUI = (props: any) => {
|
|
|
150
152
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
151
153
|
|
|
152
154
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
153
|
-
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
154
|
-
|
|
155
|
+
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
156
|
+
placing || errorCash || cart?.subtotal < cart?.minimum ||
|
|
157
|
+
// (placeSpotTypes.includes(options?.type) && !cart?.place) ||
|
|
155
158
|
(options.type === 1 &&
|
|
156
159
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
157
160
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -594,6 +597,20 @@ const CheckoutUI = (props: any) => {
|
|
|
594
597
|
)}
|
|
595
598
|
|
|
596
599
|
|
|
600
|
+
{!cartState.loading && placeSpotsEnabled && (
|
|
601
|
+
<>
|
|
602
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
|
|
603
|
+
<PlaceSpot
|
|
604
|
+
isCheckout
|
|
605
|
+
isInputMode
|
|
606
|
+
cart={cart}
|
|
607
|
+
spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
|
|
608
|
+
vehicleDefault={cart?.vehicle}
|
|
609
|
+
/>
|
|
610
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
611
|
+
</>
|
|
612
|
+
)}
|
|
613
|
+
|
|
597
614
|
{!cartState.loading && cart && (
|
|
598
615
|
<ChSection>
|
|
599
616
|
<ChCart>
|
|
@@ -682,14 +699,6 @@ const CheckoutUI = (props: any) => {
|
|
|
682
699
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
683
700
|
</OText>
|
|
684
701
|
)}
|
|
685
|
-
{placeSpotTypes.includes(options?.type) && !cart?.place && (
|
|
686
|
-
<OText
|
|
687
|
-
color={theme.colors.error}
|
|
688
|
-
size={12}
|
|
689
|
-
>
|
|
690
|
-
{t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
|
|
691
|
-
</OText>
|
|
692
|
-
)}
|
|
693
702
|
{options.type === 1 &&
|
|
694
703
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
695
704
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -30,7 +30,8 @@ import {
|
|
|
30
30
|
OrderDriver,
|
|
31
31
|
Map,
|
|
32
32
|
Divider,
|
|
33
|
-
OrderAction
|
|
33
|
+
OrderAction,
|
|
34
|
+
PlaceSpotWrapper
|
|
34
35
|
} from './styles';
|
|
35
36
|
import { OButton, OIcon, OModal, OText } from '../shared';
|
|
36
37
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
@@ -44,6 +45,7 @@ import { TaxInformation } from '../TaxInformation';
|
|
|
44
45
|
import { Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
45
46
|
import NavBar from '../NavBar'
|
|
46
47
|
import { OrderHistory } from './OrderHistory';
|
|
48
|
+
import { PlaceSpot } from '../PlaceSpot'
|
|
47
49
|
export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
48
50
|
const {
|
|
49
51
|
navigation,
|
|
@@ -105,6 +107,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
105
107
|
const [refreshing] = useState(false);
|
|
106
108
|
const { order, businessData } = props.order;
|
|
107
109
|
const mapValidStatuses = [9, 19, 23]
|
|
110
|
+
const placeSpotTypes = [3, 4, 5]
|
|
108
111
|
|
|
109
112
|
const walletName: any = {
|
|
110
113
|
cash: {
|
|
@@ -680,6 +683,18 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
680
683
|
</OText>
|
|
681
684
|
</View>
|
|
682
685
|
</OrderBusiness>
|
|
686
|
+
|
|
687
|
+
{placeSpotTypes.includes(order?.delivery_type) && (
|
|
688
|
+
<PlaceSpotWrapper>
|
|
689
|
+
<PlaceSpot
|
|
690
|
+
isInputMode
|
|
691
|
+
cart={order}
|
|
692
|
+
spotNumberDefault={order?.spot_number}
|
|
693
|
+
vehicleDefault={order?.vehicle}
|
|
694
|
+
/>
|
|
695
|
+
</PlaceSpotWrapper>
|
|
696
|
+
)}
|
|
697
|
+
|
|
683
698
|
<View
|
|
684
699
|
style={{
|
|
685
700
|
height: 8,
|
|
@@ -26,7 +26,6 @@ import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
|
26
26
|
import { TaxInformation } from '../TaxInformation';
|
|
27
27
|
import { TouchableOpacity } from 'react-native';
|
|
28
28
|
import { OAlert } from '../../../../../src/components/shared'
|
|
29
|
-
import { PlaceSpot } from '../PlaceSpot'
|
|
30
29
|
|
|
31
30
|
const OrderSummaryUI = (props: any) => {
|
|
32
31
|
const {
|
|
@@ -39,8 +38,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
39
38
|
commentState,
|
|
40
39
|
handleChangeComment,
|
|
41
40
|
onNavigationRedirect,
|
|
42
|
-
handleRemoveOfferClick
|
|
43
|
-
placeSpotTypes
|
|
41
|
+
handleRemoveOfferClick
|
|
44
42
|
} = props;
|
|
45
43
|
|
|
46
44
|
const theme = useTheme()
|
|
@@ -51,7 +49,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
51
49
|
const [validationFields] = useValidationFields();
|
|
52
50
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
|
|
53
51
|
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
54
|
-
const [openPlaceModal, setOpenPlaceModal] = useState(false)
|
|
55
52
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
|
|
56
53
|
|
|
57
54
|
const handleDeleteClick = (product: any) => {
|
|
@@ -304,24 +301,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
304
301
|
</OSTable>
|
|
305
302
|
</View>
|
|
306
303
|
)}
|
|
307
|
-
{placeSpotTypes && placeSpotTypes.includes(orderState?.options?.type) && (
|
|
308
|
-
<OSTable style={{ marginTop: 15 }}>
|
|
309
|
-
<OText size={14} lineHeight={21} weight={'600'}>
|
|
310
|
-
{t('SPOT', 'Spot')}: {cart?.place?.name || t('NO_SELECTED', 'No selected')}
|
|
311
|
-
</OText>
|
|
312
|
-
<TouchableOpacity onPress={() => setOpenPlaceModal(true)}>
|
|
313
|
-
<OText
|
|
314
|
-
size={14}
|
|
315
|
-
lineHeight={21}
|
|
316
|
-
weight={'600'}
|
|
317
|
-
color={theme.colors.primary}
|
|
318
|
-
style={{ textDecorationLine: 'underline' }}
|
|
319
|
-
>
|
|
320
|
-
{t('EDIT', 'Edit')}
|
|
321
|
-
</OText>
|
|
322
|
-
</TouchableOpacity>
|
|
323
|
-
</OSTable>
|
|
324
|
-
)}
|
|
325
304
|
{cart?.status !== 2 && (
|
|
326
305
|
<OSTable>
|
|
327
306
|
<View style={{ width: '100%', marginTop: 20 }}>
|
|
@@ -370,18 +349,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
370
349
|
products={cart?.products}
|
|
371
350
|
/>
|
|
372
351
|
</OModal>
|
|
373
|
-
<OModal
|
|
374
|
-
open={openPlaceModal}
|
|
375
|
-
title={t('CHOOSE_YOUR_SPOT', 'Choose your spot')}
|
|
376
|
-
onClose={() => setOpenPlaceModal(false)}
|
|
377
|
-
entireModal
|
|
378
|
-
>
|
|
379
|
-
<PlaceSpot
|
|
380
|
-
cart={cart}
|
|
381
|
-
isOpenPlaceSpot={openPlaceModal}
|
|
382
|
-
setOpenPlaceModal={setOpenPlaceModal}
|
|
383
|
-
/>
|
|
384
|
-
</OModal>
|
|
385
352
|
<OAlert
|
|
386
353
|
open={confirm.open}
|
|
387
354
|
title={confirm.title}
|
|
@@ -1,24 +1,78 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { View } from 'react-native'
|
|
3
|
-
import { PlaceSpot as PlaceSpotController, useLanguage } from 'ordering-components/native'
|
|
2
|
+
import { View, StyleSheet } from 'react-native'
|
|
3
|
+
import { PlaceSpot as PlaceSpotController, useLanguage, useOrder, useToast, ToastType } from 'ordering-components/native'
|
|
4
4
|
import { PlaceGroupContainer, PlaceSpotContainer } from './styles'
|
|
5
5
|
import { NotFoundSource } from '../NotFoundSource'
|
|
6
|
-
import { OText, ODropDown } from '../shared'
|
|
6
|
+
import { OText, ODropDown, OInput, OButton } from '../shared'
|
|
7
7
|
import { Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
8
8
|
import { PlaceSpotParams } from '../../types'
|
|
9
|
+
import { useTheme } from 'styled-components/native'
|
|
10
|
+
import SelectDropdown from 'react-native-select-dropdown'
|
|
11
|
+
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
9
12
|
|
|
10
13
|
const PlaceSpotUI = (props: PlaceSpotParams) => {
|
|
11
14
|
const {
|
|
12
|
-
isOpenPlaceSpot,
|
|
13
15
|
cart,
|
|
16
|
+
orderTypes,
|
|
14
17
|
placesState,
|
|
15
18
|
handleChangePlace,
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
spotNumber,
|
|
20
|
+
spotState,
|
|
21
|
+
isCheckout,
|
|
22
|
+
vehicle,
|
|
23
|
+
isInputMode,
|
|
24
|
+
setSpotNumber,
|
|
25
|
+
setVehicle,
|
|
26
|
+
handleChangeSpot
|
|
18
27
|
} = props
|
|
19
28
|
|
|
29
|
+
const theme = useTheme()
|
|
20
30
|
const [, t] = useLanguage()
|
|
31
|
+
const [orderState] = useOrder()
|
|
32
|
+
const [, { showToast }] = useToast();
|
|
33
|
+
|
|
21
34
|
const [placeGroupSelected, setPlaceGroupSelected] = useState<any>(null)
|
|
35
|
+
const vehicleInputAllowed = [4, 5]
|
|
36
|
+
|
|
37
|
+
const currentOrderType = isCheckout ? orderState?.options?.type : cart?.delivery_type
|
|
38
|
+
const isEatin = currentOrderType === 3
|
|
39
|
+
const isDriveThru = currentOrderType === 5
|
|
40
|
+
const placeholderText = isEatin
|
|
41
|
+
? t('EATIN_SPOT_NUMBER', 'Table number')
|
|
42
|
+
: isDriveThru
|
|
43
|
+
? t('DRIVE_THRU_SPOT_NUMBER', 'Drive thru lane')
|
|
44
|
+
: t('CURBSIDE_SPOT_NUMBER', 'Spot number')
|
|
45
|
+
|
|
46
|
+
const styles = StyleSheet.create({
|
|
47
|
+
selectOption: {
|
|
48
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
49
|
+
borderRadius: 7.6,
|
|
50
|
+
paddingVertical: 10,
|
|
51
|
+
paddingHorizontal: 14,
|
|
52
|
+
flexDirection: 'row-reverse',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
justifyContent: 'space-between',
|
|
55
|
+
height: 50,
|
|
56
|
+
width: '100%'
|
|
57
|
+
},
|
|
58
|
+
optionWrapper: {
|
|
59
|
+
marginBottom: 20
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const vehicleTypeList: any = [
|
|
64
|
+
{ key: 'car', text: t('VEHICLE_TYPE_CAR', 'Car') },
|
|
65
|
+
{ key: 'truck', text: t('VEHICLE_TYPE_TRUCK', 'Truck') },
|
|
66
|
+
{ key: 'suv', text: t('VEHICLE_TYPE_SUV', 'SUV') },
|
|
67
|
+
{ key: 'van', text: t('VEHICLE_TYPE_VAN', 'Van') },
|
|
68
|
+
{ key: 'motorcycle', text: t('VEHICLE_TYPE_MOTORCYCLE', 'Motorcycle') }
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
const vehicleInputList = [
|
|
72
|
+
{ key: 'model', text: t('VEHICLE_MODEL', 'Model') },
|
|
73
|
+
{ key: 'car_registration', text: t('VEHICLE_CAR_REGISTRATION', 'Car registration') },
|
|
74
|
+
{ key: 'color', text: t('VEHICLE_COLOR', 'Color') }
|
|
75
|
+
]
|
|
22
76
|
|
|
23
77
|
const getPlacesGroups = () => {
|
|
24
78
|
const groups = placesState.placeGroups?.filter((group: any) => group?.enabled && placesState?.places?.find((place: any) => place?.enabled && place?.place_group_id === group?.id))
|
|
@@ -39,10 +93,37 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
|
|
|
39
93
|
}
|
|
40
94
|
|
|
41
95
|
const handlerChangePlace = (place: any) => {
|
|
42
|
-
setOpenPlaceModal(false)
|
|
43
96
|
handleChangePlace(place)
|
|
44
97
|
}
|
|
45
98
|
|
|
99
|
+
const onChangeSpot = () => {
|
|
100
|
+
if (orderState.loading) return
|
|
101
|
+
if (!Number.isInteger(Number(spotNumber))) {
|
|
102
|
+
showToast(ToastType.Error, t('VALIDATION_ERROR_INTEGER', 'The _attribute_ must be an integer.').replace('_attribute_', placeholderText))
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
if (Number(spotNumber) < 0) {
|
|
106
|
+
showToast(ToastType.Error, t('VALIDATION_MUST_BIGGER_ZERO', '_attribute_ must be bigger than zero').replace('_attribute_', placeholderText))
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
const isVehicle = Object.values(vehicle).every(e => e)
|
|
110
|
+
const bodyToSend: any = {}
|
|
111
|
+
spotNumber && (bodyToSend.spot_number = spotNumber)
|
|
112
|
+
isVehicle && (bodyToSend.vehicle = vehicle)
|
|
113
|
+
|
|
114
|
+
if (Object.keys(bodyToSend).length) {
|
|
115
|
+
handleChangeSpot({ bodyToSend, isCheckout: !!isCheckout })
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const manageErrorsToShow = (array = []) => {
|
|
120
|
+
let stringError = ''
|
|
121
|
+
const list = Array.isArray(array) ? array : Object.values(array)
|
|
122
|
+
list.map((item: any, i: number) => {
|
|
123
|
+
stringError += (i + 1) === array.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
|
|
124
|
+
})
|
|
125
|
+
return stringError;
|
|
126
|
+
}
|
|
46
127
|
|
|
47
128
|
useEffect(() => {
|
|
48
129
|
if (!placesState?.loading) {
|
|
@@ -52,51 +133,157 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
|
|
|
52
133
|
}, [placesState])
|
|
53
134
|
|
|
54
135
|
useEffect(() => {
|
|
55
|
-
|
|
56
|
-
|
|
136
|
+
if (spotState?.error?.length > 0) {
|
|
137
|
+
const errorText = manageErrorsToShow(spotState?.error)
|
|
138
|
+
showToast(ToastType.Error, errorText)
|
|
139
|
+
}
|
|
140
|
+
}, [spotState?.error])
|
|
57
141
|
|
|
58
142
|
return (
|
|
59
143
|
<PlaceSpotContainer>
|
|
60
|
-
{
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
144
|
+
{isInputMode ? (
|
|
145
|
+
<PlaceGroupContainer>
|
|
146
|
+
<OText color={theme.colors.textNormal} size={16} weight='500' mBottom={15}>{orderTypes[currentOrderType]}</OText>
|
|
147
|
+
{vehicleInputAllowed.includes(currentOrderType) && (
|
|
148
|
+
<>
|
|
149
|
+
<View style={styles.optionWrapper}>
|
|
150
|
+
<OText color={theme.colors.textNormal} size={12} mBottom={5}>{t('VEHICLE_TYPE', 'Vehicle type')}</OText>
|
|
151
|
+
<SelectDropdown
|
|
152
|
+
defaultButtonText={t('SELECT_AN_OPTION', 'Select an option')}
|
|
153
|
+
data={vehicleTypeList}
|
|
154
|
+
defaultValue={vehicle?.type ? vehicleTypeList.find((obj: any) => obj.key === vehicle.type) : null}
|
|
155
|
+
onSelect={(selectedItem, index) => {
|
|
156
|
+
setVehicle({ ...vehicle, type: selectedItem.key ?? '' })
|
|
157
|
+
}}
|
|
158
|
+
buttonTextAfterSelection={(selectedItem, index) => {
|
|
159
|
+
return selectedItem.text
|
|
160
|
+
}}
|
|
161
|
+
rowTextForSelection={(item, index) => {
|
|
162
|
+
return item.text
|
|
163
|
+
}}
|
|
164
|
+
buttonStyle={styles.selectOption}
|
|
165
|
+
buttonTextStyle={{
|
|
166
|
+
color: theme.colors.disabled,
|
|
167
|
+
fontSize: 14,
|
|
168
|
+
textAlign: 'left',
|
|
169
|
+
marginHorizontal: 0
|
|
170
|
+
}}
|
|
171
|
+
dropdownStyle={{
|
|
172
|
+
borderRadius: 8,
|
|
173
|
+
borderColor: theme.colors.lightGray
|
|
174
|
+
}}
|
|
175
|
+
rowStyle={{
|
|
176
|
+
borderBottomColor: theme.colors.backgroundGray100,
|
|
177
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
178
|
+
height: 40,
|
|
179
|
+
flexDirection: 'column',
|
|
180
|
+
alignItems: 'flex-start',
|
|
181
|
+
paddingTop: 8,
|
|
182
|
+
paddingHorizontal: 14
|
|
183
|
+
}}
|
|
184
|
+
rowTextStyle={{
|
|
185
|
+
color: theme.colors.disabled,
|
|
186
|
+
fontSize: 14,
|
|
187
|
+
marginHorizontal: 0
|
|
188
|
+
}}
|
|
189
|
+
renderDropdownIcon={() => {
|
|
190
|
+
return (
|
|
191
|
+
<IconAntDesign
|
|
192
|
+
name='down'
|
|
193
|
+
color={theme.colors.textThird}
|
|
194
|
+
size={16}
|
|
195
|
+
/>
|
|
196
|
+
)
|
|
197
|
+
}}
|
|
198
|
+
/>
|
|
199
|
+
</View>
|
|
200
|
+
{vehicleInputList.map((input: any) => (
|
|
201
|
+
<View key={input.key}>
|
|
202
|
+
<OText color={theme.colors.textNormal} size={12} mBottom={5}>{input.text}</OText>
|
|
203
|
+
<OInput
|
|
204
|
+
placeholder={input.text}
|
|
205
|
+
value={vehicle[input.key] ?? ''}
|
|
206
|
+
onChange={(value: string) => setVehicle({ ...vehicle, [input.key]: value })}
|
|
207
|
+
style={{
|
|
208
|
+
borderColor: theme.colors.border,
|
|
209
|
+
borderRadius: 7.6,
|
|
210
|
+
marginBottom: 20
|
|
211
|
+
}}
|
|
212
|
+
inputStyle={{ fontSize: 12, color: theme.colors.textNormal }}
|
|
213
|
+
/>
|
|
214
|
+
</View>
|
|
215
|
+
))}
|
|
216
|
+
</>
|
|
217
|
+
)}
|
|
218
|
+
<OText color={theme.colors.textNormal} size={12} mBottom={5}>{placeholderText}</OText>
|
|
219
|
+
<OInput
|
|
220
|
+
value={spotNumber?.toString() ?? ''}
|
|
221
|
+
placeholder={placeholderText}
|
|
222
|
+
type='number-pad'
|
|
223
|
+
onChange={(value: string) => setSpotNumber(value)}
|
|
224
|
+
style={{
|
|
225
|
+
borderColor: theme.colors.border,
|
|
226
|
+
borderRadius: 7.6
|
|
227
|
+
}}
|
|
228
|
+
inputStyle={{ fontSize: 12, color: theme.colors.textNormal }}
|
|
229
|
+
/>
|
|
230
|
+
<View style={{ alignItems: 'flex-start' }}>
|
|
231
|
+
<OButton
|
|
232
|
+
onClick={() => onChangeSpot()}
|
|
233
|
+
bgColor={theme.colors.primary}
|
|
234
|
+
borderColor={theme.colors.primary}
|
|
235
|
+
textStyle={{ color: 'white', fontSize: 12 }}
|
|
236
|
+
imgRightSrc={null}
|
|
237
|
+
text={t('UPDATE_SPOT_NUMBER', 'Update')}
|
|
238
|
+
isDisabled={(!spotNumber && !Object.values(vehicle).every(e => e))}
|
|
239
|
+
style={{ borderRadius: 7.6, height: 44, shadowOpacity: 0, marginTop: 20 }}
|
|
240
|
+
/>
|
|
74
241
|
</View>
|
|
75
|
-
</
|
|
76
|
-
)
|
|
77
|
-
{!(placesState.error || placesState?.placeGroups?.length === 0) && !placesState?.loading && (
|
|
242
|
+
</PlaceGroupContainer>
|
|
243
|
+
) : (
|
|
78
244
|
<>
|
|
79
|
-
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
placeholder={t('PLACE_GROUP', 'Place group')}
|
|
83
|
-
options={getPlacesGroups()}
|
|
84
|
-
onSelect={(group: any) => setPlaceGroupSelected(group)}
|
|
85
|
-
defaultValue={placeGroupSelected ?? cart?.place}
|
|
86
|
-
isModal
|
|
245
|
+
{(placesState.error || placesState?.placeGroups?.length === 0) && !placesState?.loading && (
|
|
246
|
+
<NotFoundSource
|
|
247
|
+
content={t('NO_PLACES_THIS_BUSINESS', 'There are not places for this business')}
|
|
87
248
|
/>
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
</
|
|
249
|
+
)}
|
|
250
|
+
{placesState?.loading && (
|
|
251
|
+
<Placeholder>
|
|
252
|
+
<PlaceGroupContainer>
|
|
253
|
+
<PlaceholderLine width={100} height={25} />
|
|
254
|
+
<PlaceholderLine height={30} />
|
|
255
|
+
</PlaceGroupContainer>
|
|
256
|
+
<View>
|
|
257
|
+
<PlaceholderLine width={120} height={25} />
|
|
258
|
+
<PlaceholderLine height={30} />
|
|
259
|
+
</View>
|
|
260
|
+
</Placeholder>
|
|
261
|
+
)}
|
|
262
|
+
{!(placesState.error || placesState?.placeGroups?.length === 0) && !placesState?.loading && (
|
|
263
|
+
<>
|
|
264
|
+
<PlaceGroupContainer>
|
|
265
|
+
<OText size={16} mBottom={10}>{t('PLACE_GROUP', 'Place group')}</OText>
|
|
266
|
+
<ODropDown
|
|
267
|
+
placeholder={t('PLACE_GROUP', 'Place group')}
|
|
268
|
+
options={getPlacesGroups()}
|
|
269
|
+
onSelect={(group: any) => setPlaceGroupSelected(group)}
|
|
270
|
+
defaultValue={placeGroupSelected ?? cart?.place}
|
|
271
|
+
isModal
|
|
272
|
+
/>
|
|
273
|
+
</PlaceGroupContainer>
|
|
274
|
+
{placeGroupSelected && (
|
|
275
|
+
<View>
|
|
276
|
+
<OText size={16} mBottom={10}>{t('SELECT_YOUR_SPOT', 'Select your spot')}</OText>
|
|
277
|
+
<ODropDown
|
|
278
|
+
onSelect={(place: any) => handlerChangePlace(place)}
|
|
279
|
+
placeholder={t('SELECT_YOUR_SPOT', 'Select your spot')}
|
|
280
|
+
options={getPlaces()}
|
|
281
|
+
defaultValue={placesState?.places?.find((place : any) => place?.id === cart?.place_id)}
|
|
282
|
+
isModal
|
|
283
|
+
/>
|
|
284
|
+
</View>
|
|
285
|
+
)}
|
|
286
|
+
</>
|
|
100
287
|
)}
|
|
101
288
|
</>
|
|
102
289
|
)}
|
|
@@ -105,9 +292,18 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
|
|
|
105
292
|
}
|
|
106
293
|
|
|
107
294
|
export const PlaceSpot = (props: PlaceSpotParams) => {
|
|
295
|
+
const [, t] = useLanguage()
|
|
296
|
+
|
|
108
297
|
const placeSpotProps = {
|
|
109
298
|
...props,
|
|
110
|
-
UIComponent: PlaceSpotUI
|
|
299
|
+
UIComponent: PlaceSpotUI,
|
|
300
|
+
orderTypes: {
|
|
301
|
+
1: t('DELIVERY', 'Delivery'),
|
|
302
|
+
2: t('PICKUP', 'Pickup'),
|
|
303
|
+
3: t('EAT_IN', 'Eat in'),
|
|
304
|
+
4: t('CURBSIDE', 'Curbside'),
|
|
305
|
+
5: t('DRIVE_THRU', 'Drive thru')
|
|
306
|
+
}
|
|
111
307
|
}
|
|
112
308
|
|
|
113
309
|
return <PlaceSpotController {...placeSpotProps} />
|
|
@@ -642,12 +642,20 @@ export interface NoNetworkParams {
|
|
|
642
642
|
}
|
|
643
643
|
|
|
644
644
|
export interface PlaceSpotParams {
|
|
645
|
-
|
|
645
|
+
isCheckout?: any,
|
|
646
|
+
isInputMode?: any,
|
|
646
647
|
cart?: any,
|
|
648
|
+
spotNumberDefault?: any,
|
|
649
|
+
vehicleDefault?: any,
|
|
650
|
+
spotNumber?: any,
|
|
651
|
+
setSpotNumber?: any,
|
|
652
|
+
orderTypes?: any,
|
|
647
653
|
placesState?: any,
|
|
648
|
-
handleChangePlace
|
|
649
|
-
|
|
650
|
-
|
|
654
|
+
handleChangePlace? : any,
|
|
655
|
+
spotState?: any,
|
|
656
|
+
vehicle?: any,
|
|
657
|
+
setVehicle?: any,
|
|
658
|
+
handleChangeSpot?: any
|
|
651
659
|
}
|
|
652
660
|
|
|
653
661
|
export interface PromotionParams {
|