ordering-ui-react-native 0.16.67 → 0.16.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/ActiveOrders/index.tsx +61 -63
- package/src/components/ActiveOrders/styles.tsx +1 -1
- package/src/components/NotificationSetting/index.tsx +85 -0
- package/src/components/shared/OBottomPopup.tsx +6 -2
- package/src/index.tsx +2 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
- package/themes/business/src/components/OrdersOption/index.tsx +11 -3
- package/themes/business/src/types/index.tsx +8 -7
- package/themes/original/index.tsx +2 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +10 -18
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -0
- package/themes/original/src/components/BusinessProductsListing/index.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +8 -3
- 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 +5 -1
- 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 +1 -34
- package/themes/original/src/components/PlaceSpot/index.tsx +235 -47
- package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +27 -14
- package/themes/original/src/types/index.tsx +24 -4
|
@@ -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,
|
|
@@ -143,7 +144,8 @@ const CheckoutUI = (props: any) => {
|
|
|
143
144
|
const [isOpen, setIsOpen] = useState(false)
|
|
144
145
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
145
146
|
|
|
146
|
-
const placeSpotTypes = [4]
|
|
147
|
+
const placeSpotTypes = [3, 4, 5]
|
|
148
|
+
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
147
149
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
148
150
|
const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
149
151
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
@@ -151,8 +153,9 @@ const CheckoutUI = (props: any) => {
|
|
|
151
153
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
152
154
|
|
|
153
155
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
154
|
-
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
155
|
-
|
|
156
|
+
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
157
|
+
placing || errorCash || cart?.subtotal < cart?.minimum ||
|
|
158
|
+
// (placeSpotTypes.includes(options?.type) && !cart?.place) ||
|
|
156
159
|
(options.type === 1 &&
|
|
157
160
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
158
161
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -595,6 +598,20 @@ const CheckoutUI = (props: any) => {
|
|
|
595
598
|
)}
|
|
596
599
|
|
|
597
600
|
|
|
601
|
+
{!cartState.loading && placeSpotsEnabled && (
|
|
602
|
+
<>
|
|
603
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
|
|
604
|
+
<PlaceSpot
|
|
605
|
+
isCheckout
|
|
606
|
+
isInputMode
|
|
607
|
+
cart={cart}
|
|
608
|
+
spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
|
|
609
|
+
vehicleDefault={cart?.vehicle}
|
|
610
|
+
/>
|
|
611
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
612
|
+
</>
|
|
613
|
+
)}
|
|
614
|
+
|
|
598
615
|
{!cartState.loading && cart && (
|
|
599
616
|
<ChSection>
|
|
600
617
|
<ChCart>
|
|
@@ -683,14 +700,6 @@ const CheckoutUI = (props: any) => {
|
|
|
683
700
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
684
701
|
</OText>
|
|
685
702
|
)}
|
|
686
|
-
{placeSpotTypes.includes(options?.type) && !cart?.place && (
|
|
687
|
-
<OText
|
|
688
|
-
color={theme.colors.error}
|
|
689
|
-
size={12}
|
|
690
|
-
>
|
|
691
|
-
{t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
|
|
692
|
-
</OText>
|
|
693
|
-
)}
|
|
694
703
|
{options.type === 1 &&
|
|
695
704
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
696
705
|
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,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { OText } from '../shared'
|
|
3
|
+
import { useLanguage } from 'ordering-components/native'
|
|
4
|
+
import { useTheme } from 'styled-components/native'
|
|
5
|
+
import { SingleProductCard } from '../SingleProductCard'
|
|
6
|
+
import { OrderItAgainParams } from '../../types'
|
|
7
|
+
import { ScrollView, Dimensions } from 'react-native'
|
|
8
|
+
import moment from 'moment';
|
|
9
|
+
import {
|
|
10
|
+
Container,
|
|
11
|
+
ProductWrapper
|
|
12
|
+
} from './styles'
|
|
13
|
+
|
|
14
|
+
export const OrderItAgain = (props: OrderItAgainParams) => {
|
|
15
|
+
const {
|
|
16
|
+
onProductClick,
|
|
17
|
+
productList,
|
|
18
|
+
businessId,
|
|
19
|
+
categoryState,
|
|
20
|
+
currentCart,
|
|
21
|
+
handleUpdateProducts,
|
|
22
|
+
navigation
|
|
23
|
+
} = props
|
|
24
|
+
|
|
25
|
+
const [, t] = useLanguage()
|
|
26
|
+
const theme = useTheme()
|
|
27
|
+
const { width } = Dimensions.get('window');
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Container>
|
|
31
|
+
<OText
|
|
32
|
+
size={16}
|
|
33
|
+
lineHeight={24}
|
|
34
|
+
color={theme.colors.textNormal}
|
|
35
|
+
style={{
|
|
36
|
+
fontWeight: '600',
|
|
37
|
+
marginBottom: 6
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
{t('ORDER_IT_AGAIN', 'Order it again')}
|
|
41
|
+
</OText>
|
|
42
|
+
<OText
|
|
43
|
+
size={12}
|
|
44
|
+
lineHeight={18}
|
|
45
|
+
color={theme.colors.disabled}
|
|
46
|
+
>
|
|
47
|
+
{t('ORDER_IT_AGAIN_DESC', 'Quickly add items from your past orders.')}
|
|
48
|
+
</OText>
|
|
49
|
+
<ScrollView
|
|
50
|
+
horizontal
|
|
51
|
+
showsVerticalScrollIndicator={false}
|
|
52
|
+
showsHorizontalScrollIndicator={false}
|
|
53
|
+
>
|
|
54
|
+
{productList?.length > 0 && productList?.sort((a: any, b:any) => moment(b?.last_ordered_date).valueOf() - moment(a?.last_ordered_date).valueOf()).map((product: any, i: number) => (
|
|
55
|
+
<ProductWrapper key={'prod_' + product.id + `_${i}`} style={{ width: width - 120, }}>
|
|
56
|
+
<SingleProductCard
|
|
57
|
+
isSoldOut={product.inventoried && !product.quantity}
|
|
58
|
+
product={product}
|
|
59
|
+
businessId={businessId}
|
|
60
|
+
categoryState={categoryState}
|
|
61
|
+
onProductClick={() => onProductClick(product)}
|
|
62
|
+
productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
63
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
64
|
+
navigation={navigation}
|
|
65
|
+
isPreviously
|
|
66
|
+
/>
|
|
67
|
+
</ProductWrapper>
|
|
68
|
+
))}
|
|
69
|
+
</ScrollView>
|
|
70
|
+
</Container>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
@@ -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,29 @@ 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
|
+
const isVehicle = Object.values(vehicle).every(e => e)
|
|
102
|
+
const bodyToSend: any = {}
|
|
103
|
+
spotNumber && (bodyToSend.spot_number = spotNumber)
|
|
104
|
+
isVehicle && (bodyToSend.vehicle = vehicle)
|
|
105
|
+
|
|
106
|
+
if (Object.keys(bodyToSend).length) {
|
|
107
|
+
handleChangeSpot({ bodyToSend, isCheckout: !!isCheckout })
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const manageErrorsToShow = (array = []) => {
|
|
112
|
+
let stringError = ''
|
|
113
|
+
const list = Array.isArray(array) ? array : Object.values(array)
|
|
114
|
+
list.map((item: any, i: number) => {
|
|
115
|
+
stringError += (i + 1) === array.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
|
|
116
|
+
})
|
|
117
|
+
return stringError;
|
|
118
|
+
}
|
|
46
119
|
|
|
47
120
|
useEffect(() => {
|
|
48
121
|
if (!placesState?.loading) {
|
|
@@ -52,51 +125,157 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
|
|
|
52
125
|
}, [placesState])
|
|
53
126
|
|
|
54
127
|
useEffect(() => {
|
|
55
|
-
|
|
56
|
-
|
|
128
|
+
if (spotState?.error?.length > 0) {
|
|
129
|
+
const errorText = manageErrorsToShow(spotState?.errors)
|
|
130
|
+
showToast(ToastType.Error, errorText)
|
|
131
|
+
}
|
|
132
|
+
}, [spotState?.error])
|
|
57
133
|
|
|
58
134
|
return (
|
|
59
135
|
<PlaceSpotContainer>
|
|
60
|
-
{
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
136
|
+
{isInputMode ? (
|
|
137
|
+
<PlaceGroupContainer>
|
|
138
|
+
<OText color={theme.colors.textNormal} size={16} weight='500' mBottom={15}>{orderTypes[currentOrderType]}</OText>
|
|
139
|
+
{vehicleInputAllowed.includes(currentOrderType) && (
|
|
140
|
+
<>
|
|
141
|
+
<View style={styles.optionWrapper}>
|
|
142
|
+
<OText color={theme.colors.textNormal} size={12} mBottom={5}>{t('VEHICLE_TYPE', 'Vehicle type')}</OText>
|
|
143
|
+
<SelectDropdown
|
|
144
|
+
defaultButtonText={t('SELECT_AN_OPTION', 'Select an option')}
|
|
145
|
+
data={vehicleTypeList}
|
|
146
|
+
defaultValue={vehicle?.type ? vehicleTypeList.find((obj: any) => obj.key === vehicle.type) : null}
|
|
147
|
+
onSelect={(selectedItem, index) => {
|
|
148
|
+
setVehicle({ ...vehicle, type: selectedItem.key ?? '' })
|
|
149
|
+
}}
|
|
150
|
+
buttonTextAfterSelection={(selectedItem, index) => {
|
|
151
|
+
return selectedItem.text
|
|
152
|
+
}}
|
|
153
|
+
rowTextForSelection={(item, index) => {
|
|
154
|
+
return item.text
|
|
155
|
+
}}
|
|
156
|
+
buttonStyle={styles.selectOption}
|
|
157
|
+
buttonTextStyle={{
|
|
158
|
+
color: theme.colors.disabled,
|
|
159
|
+
fontSize: 14,
|
|
160
|
+
textAlign: 'left',
|
|
161
|
+
marginHorizontal: 0
|
|
162
|
+
}}
|
|
163
|
+
dropdownStyle={{
|
|
164
|
+
borderRadius: 8,
|
|
165
|
+
borderColor: theme.colors.lightGray
|
|
166
|
+
}}
|
|
167
|
+
rowStyle={{
|
|
168
|
+
borderBottomColor: theme.colors.backgroundGray100,
|
|
169
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
170
|
+
height: 40,
|
|
171
|
+
flexDirection: 'column',
|
|
172
|
+
alignItems: 'flex-start',
|
|
173
|
+
paddingTop: 8,
|
|
174
|
+
paddingHorizontal: 14
|
|
175
|
+
}}
|
|
176
|
+
rowTextStyle={{
|
|
177
|
+
color: theme.colors.disabled,
|
|
178
|
+
fontSize: 14,
|
|
179
|
+
marginHorizontal: 0
|
|
180
|
+
}}
|
|
181
|
+
renderDropdownIcon={() => {
|
|
182
|
+
return (
|
|
183
|
+
<IconAntDesign
|
|
184
|
+
name='down'
|
|
185
|
+
color={theme.colors.textThird}
|
|
186
|
+
size={16}
|
|
187
|
+
/>
|
|
188
|
+
)
|
|
189
|
+
}}
|
|
190
|
+
/>
|
|
191
|
+
</View>
|
|
192
|
+
{vehicleInputList.map((input: any) => (
|
|
193
|
+
<View key={input.key}>
|
|
194
|
+
<OText color={theme.colors.textNormal} size={12} mBottom={5}>{input.text}</OText>
|
|
195
|
+
<OInput
|
|
196
|
+
placeholder={input.text}
|
|
197
|
+
value={vehicle[input.key] ?? ''}
|
|
198
|
+
onChange={(value: string) => setVehicle({ ...vehicle, [input.key]: value })}
|
|
199
|
+
style={{
|
|
200
|
+
borderColor: theme.colors.border,
|
|
201
|
+
borderRadius: 7.6,
|
|
202
|
+
marginBottom: 20
|
|
203
|
+
}}
|
|
204
|
+
inputStyle={{ fontSize: 12, color: theme.colors.textNormal }}
|
|
205
|
+
/>
|
|
206
|
+
</View>
|
|
207
|
+
))}
|
|
208
|
+
</>
|
|
209
|
+
)}
|
|
210
|
+
<OText color={theme.colors.textNormal} size={12} mBottom={5}>{placeholderText}</OText>
|
|
211
|
+
<OInput
|
|
212
|
+
value={spotNumber?.toString() ?? ''}
|
|
213
|
+
placeholder={placeholderText}
|
|
214
|
+
keyboardType='number-pad'
|
|
215
|
+
onChange={(value: string) => setSpotNumber(value)}
|
|
216
|
+
style={{
|
|
217
|
+
borderColor: theme.colors.border,
|
|
218
|
+
borderRadius: 7.6
|
|
219
|
+
}}
|
|
220
|
+
inputStyle={{ fontSize: 12, color: theme.colors.textNormal }}
|
|
221
|
+
/>
|
|
222
|
+
<View style={{ alignItems: 'flex-start' }}>
|
|
223
|
+
<OButton
|
|
224
|
+
onClick={() => onChangeSpot()}
|
|
225
|
+
bgColor={theme.colors.primary}
|
|
226
|
+
borderColor={theme.colors.primary}
|
|
227
|
+
textStyle={{ color: 'white', fontSize: 12 }}
|
|
228
|
+
imgRightSrc={null}
|
|
229
|
+
text={t('UPDATE_SPOT_NUMBER', 'Update')}
|
|
230
|
+
isDisabled={(!spotNumber && !Object.values(vehicle).every(e => e))}
|
|
231
|
+
style={{ borderRadius: 7.6, height: 44, shadowOpacity: 0, marginTop: 20 }}
|
|
232
|
+
/>
|
|
74
233
|
</View>
|
|
75
|
-
</
|
|
76
|
-
)
|
|
77
|
-
{!(placesState.error || placesState?.placeGroups?.length === 0) && !placesState?.loading && (
|
|
234
|
+
</PlaceGroupContainer>
|
|
235
|
+
) : (
|
|
78
236
|
<>
|
|
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
|
|
237
|
+
{(placesState.error || placesState?.placeGroups?.length === 0) && !placesState?.loading && (
|
|
238
|
+
<NotFoundSource
|
|
239
|
+
content={t('NO_PLACES_THIS_BUSINESS', 'There are not places for this business')}
|
|
87
240
|
/>
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
</
|
|
241
|
+
)}
|
|
242
|
+
{placesState?.loading && (
|
|
243
|
+
<Placeholder>
|
|
244
|
+
<PlaceGroupContainer>
|
|
245
|
+
<PlaceholderLine width={100} height={25} />
|
|
246
|
+
<PlaceholderLine height={30} />
|
|
247
|
+
</PlaceGroupContainer>
|
|
248
|
+
<View>
|
|
249
|
+
<PlaceholderLine width={120} height={25} />
|
|
250
|
+
<PlaceholderLine height={30} />
|
|
251
|
+
</View>
|
|
252
|
+
</Placeholder>
|
|
253
|
+
)}
|
|
254
|
+
{!(placesState.error || placesState?.placeGroups?.length === 0) && !placesState?.loading && (
|
|
255
|
+
<>
|
|
256
|
+
<PlaceGroupContainer>
|
|
257
|
+
<OText size={16} mBottom={10}>{t('PLACE_GROUP', 'Place group')}</OText>
|
|
258
|
+
<ODropDown
|
|
259
|
+
placeholder={t('PLACE_GROUP', 'Place group')}
|
|
260
|
+
options={getPlacesGroups()}
|
|
261
|
+
onSelect={(group: any) => setPlaceGroupSelected(group)}
|
|
262
|
+
defaultValue={placeGroupSelected ?? cart?.place}
|
|
263
|
+
isModal
|
|
264
|
+
/>
|
|
265
|
+
</PlaceGroupContainer>
|
|
266
|
+
{placeGroupSelected && (
|
|
267
|
+
<View>
|
|
268
|
+
<OText size={16} mBottom={10}>{t('SELECT_YOUR_SPOT', 'Select your spot')}</OText>
|
|
269
|
+
<ODropDown
|
|
270
|
+
onSelect={(place: any) => handlerChangePlace(place)}
|
|
271
|
+
placeholder={t('SELECT_YOUR_SPOT', 'Select your spot')}
|
|
272
|
+
options={getPlaces()}
|
|
273
|
+
defaultValue={placesState?.places?.find((place : any) => place?.id === cart?.place_id)}
|
|
274
|
+
isModal
|
|
275
|
+
/>
|
|
276
|
+
</View>
|
|
277
|
+
)}
|
|
278
|
+
</>
|
|
100
279
|
)}
|
|
101
280
|
</>
|
|
102
281
|
)}
|
|
@@ -105,9 +284,18 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
|
|
|
105
284
|
}
|
|
106
285
|
|
|
107
286
|
export const PlaceSpot = (props: PlaceSpotParams) => {
|
|
287
|
+
const [, t] = useLanguage()
|
|
288
|
+
|
|
108
289
|
const placeSpotProps = {
|
|
109
290
|
...props,
|
|
110
|
-
UIComponent: PlaceSpotUI
|
|
291
|
+
UIComponent: PlaceSpotUI,
|
|
292
|
+
orderTypes: {
|
|
293
|
+
1: t('DELIVERY', 'Delivery'),
|
|
294
|
+
2: t('PICKUP', 'Pickup'),
|
|
295
|
+
3: t('EAT_IN', 'Eat in'),
|
|
296
|
+
4: t('CURBSIDE', 'Curbside'),
|
|
297
|
+
5: t('DRIVE_THRU', 'Drive thru')
|
|
298
|
+
}
|
|
111
299
|
}
|
|
112
300
|
|
|
113
301
|
return <PlaceSpotController {...placeSpotProps} />
|