ordering-ui-react-native 0.16.82 → 0.16.84
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/BusinessProductsList/index.tsx +4 -4
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +1 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
- package/themes/business/src/types/index.tsx +1 -0
- package/themes/original/src/components/BusinessController/index.tsx +1 -23
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +3 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +11 -115
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +4 -12
- package/themes/original/src/components/BusinessProductsList/index.tsx +1 -0
- package/themes/original/src/components/CartContent/index.tsx +3 -3
- package/themes/original/src/components/Checkout/index.tsx +17 -10
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
- package/themes/original/src/components/HelpGuide/index.tsx +8 -3
- package/themes/original/src/components/HelpOrder/index.tsx +8 -3
- package/themes/original/src/components/Messages/index.tsx +17 -17
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
- package/themes/original/src/components/NavBar/index.tsx +7 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +5 -4
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -3
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +91 -104
- package/themes/original/src/components/OrdersOption/index.tsx +9 -10
- package/themes/original/src/components/PlaceSpot/index.tsx +4 -0
- package/themes/original/src/components/ProductForm/index.tsx +7 -7
- package/themes/original/src/components/SingleProductCard/index.tsx +9 -33
- package/themes/original/src/components/UpsellingProducts/index.tsx +7 -3
- package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
- package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
- package/themes/original/src/components/Wallets/index.tsx +172 -162
- package/themes/original/src/components/Wallets/styles.tsx +10 -8
- package/themes/original/src/components/shared/OButton.tsx +8 -3
- package/themes/original/src/types/index.tsx +6 -2
|
@@ -5,6 +5,7 @@ import { launchImageLibrary } from 'react-native-image-picker'
|
|
|
5
5
|
import { GiftedChat, Actions, ActionsProps, InputToolbar, Composer, Send, Bubble, MessageImage, InputToolbarProps, ComposerProps } from 'react-native-gifted-chat'
|
|
6
6
|
import { USER_TYPE } from '../../config/constants'
|
|
7
7
|
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
8
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
8
9
|
import { OIcon, OIconButton, OText, OButton } from '../shared'
|
|
9
10
|
import { TouchableOpacity, ActivityIndicator, StyleSheet, View, Platform, Keyboard } from 'react-native'
|
|
10
11
|
import { Header, TitleHeader, Wrapper, QuickMessageContainer, ProfileMessageHeader, MessageTypeItem } from './styles'
|
|
@@ -36,7 +37,7 @@ const ORDER_STATUS: any = {
|
|
|
36
37
|
20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
37
38
|
21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
38
39
|
22: 'ORDER_LOOKING_FOR_DRIVER',
|
|
39
|
-
|
|
40
|
+
23: 'ORDER_DRIVER_ON_WAY'
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
const filterSpecialStatus = ['prepared_in', 'delivered_in', 'delivery_datetime']
|
|
@@ -122,18 +123,17 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
122
123
|
|
|
123
124
|
const messageConsole = (message: any) => {
|
|
124
125
|
return message.change?.attribute !== 'driver_id'
|
|
125
|
-
?
|
|
126
|
-
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${
|
|
127
|
-
filterSpecialStatus.includes(message.change.attribute) ?
|
|
128
|
-
`${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
|
|
129
|
-
`${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
|
|
130
|
-
}`
|
|
131
|
-
: message.change.new
|
|
132
126
|
?
|
|
133
|
-
`${
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
127
|
+
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute) ?
|
|
128
|
+
`${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
|
|
129
|
+
`${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
|
|
130
|
+
}`
|
|
131
|
+
: message.change.new
|
|
132
|
+
?
|
|
133
|
+
`${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
|
|
134
|
+
:
|
|
135
|
+
`${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`
|
|
136
|
+
}
|
|
137
137
|
|
|
138
138
|
useEffect(() => {
|
|
139
139
|
let newMessages: Array<any> = []
|
|
@@ -402,7 +402,9 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
402
402
|
<Wrapper>
|
|
403
403
|
{!isMeesageListing ? (
|
|
404
404
|
<Header>
|
|
405
|
-
<
|
|
405
|
+
<TouchableOpacity onPress={onClose} style={{ paddingStart: 10, borderColor: theme.colors.clear }}>
|
|
406
|
+
<AntDesignIcon name='arrowleft' size={26} />
|
|
407
|
+
</TouchableOpacity>
|
|
406
408
|
<View style={{ marginRight: 10, shadowColor: theme.colors.black, shadowOpacity: 0.1, shadowOffset: { width: 0, height: 1 }, shadowRadius: 2 }}>
|
|
407
409
|
<OIcon
|
|
408
410
|
url={type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo}
|
|
@@ -419,10 +421,8 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
419
421
|
) : (
|
|
420
422
|
<ProfileMessageHeader>
|
|
421
423
|
<View style={{ ...styles.headerTitle }}>
|
|
422
|
-
<TouchableOpacity
|
|
423
|
-
|
|
424
|
-
onPress={onClose}>
|
|
425
|
-
<OIcon src={theme.images.general.arrow_left} width={16} />
|
|
424
|
+
<TouchableOpacity onPress={onClose} style={styles.headerItem}>
|
|
425
|
+
<AntDesignIcon name='arrowleft' size={26} />
|
|
426
426
|
</TouchableOpacity>
|
|
427
427
|
<OText size={18}>{t('ORDER', theme?.defaultLanguages?.ORDER || 'Order')} #{order?.id}</OText>
|
|
428
428
|
</View>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useEffect } from 'react'
|
|
2
|
-
import { useLanguage, useUtils, useToast,
|
|
3
|
-
import { View, StyleSheet, BackHandler } from 'react-native'
|
|
2
|
+
import { useLanguage, useUtils, useToast, ToastType, MultiOrdersDetails as MultiOrdersDetailsController } from 'ordering-components/native'
|
|
3
|
+
import { View, StyleSheet, BackHandler, TouchableOpacity } from 'react-native'
|
|
4
4
|
import { useTheme } from 'styled-components/native'
|
|
5
5
|
import { OText, OButton } from '../shared'
|
|
6
6
|
import { Container } from '../../layouts/Container'
|
|
7
7
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder'
|
|
8
8
|
import { SingleOrderCard } from './SingleOrderCard'
|
|
9
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
9
10
|
|
|
10
11
|
import {
|
|
11
12
|
OrdersDetailsContainer,
|
|
@@ -29,20 +30,20 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
29
30
|
} = props
|
|
30
31
|
|
|
31
32
|
const theme = useTheme()
|
|
32
|
-
|
|
33
|
+
const styles = StyleSheet.create({
|
|
33
34
|
btnBackArrow: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
borderWidth: 0,
|
|
36
|
+
backgroundColor: theme.colors.clear,
|
|
37
|
+
shadowColor: theme.colors.clear,
|
|
38
|
+
padding: 0,
|
|
38
39
|
marginLeft: -20
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
|
|
42
43
|
const { loading, orders, error } = props.ordersList
|
|
43
44
|
const [, t] = useLanguage()
|
|
44
45
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils();
|
|
45
|
-
|
|
46
|
+
const [, { showToast }] = useToast();
|
|
46
47
|
|
|
47
48
|
const walletName: any = {
|
|
48
49
|
cash: {
|
|
@@ -60,7 +61,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
60
61
|
}
|
|
61
62
|
navigation.navigate('BusinessList');
|
|
62
63
|
return true
|
|
63
|
-
|
|
64
|
+
}
|
|
64
65
|
|
|
65
66
|
const handleGoToOrderDetails = (uuid: any) => {
|
|
66
67
|
navigation.navigate('OrderDetails', { orderId: uuid })
|
|
@@ -68,7 +69,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
68
69
|
|
|
69
70
|
useEffect(() => {
|
|
70
71
|
if (error) {
|
|
71
|
-
|
|
72
|
+
showToast(ToastType.Error, error)
|
|
72
73
|
}
|
|
73
74
|
}, [error])
|
|
74
75
|
|
|
@@ -83,11 +84,14 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
83
84
|
<OrdersDetailsContainer keyboardShouldPersistTaps="handled" contentContainerStyle={{ paddingHorizontal: 40 }}>
|
|
84
85
|
<View style={{ flexDirection: 'row' }}>
|
|
85
86
|
<OButton
|
|
86
|
-
imgLeftSrc={theme.images.general.arrow_left}
|
|
87
87
|
imgRightSrc={null}
|
|
88
88
|
style={styles.btnBackArrow}
|
|
89
89
|
onClick={() => handleArrowBack()}
|
|
90
|
-
|
|
90
|
+
icon={AntDesignIcon}
|
|
91
|
+
iconProps={{
|
|
92
|
+
name: 'arrowleft',
|
|
93
|
+
size: 26
|
|
94
|
+
}}
|
|
91
95
|
/>
|
|
92
96
|
</View>
|
|
93
97
|
<Header>
|
|
@@ -202,7 +206,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
202
206
|
</Row>
|
|
203
207
|
<Row>
|
|
204
208
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
205
|
-
|
|
209
|
+
{t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected')}:
|
|
206
210
|
</OText>
|
|
207
211
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
208
212
|
{parsePrice(ordersSummary?.tax)}
|
|
@@ -2,6 +2,7 @@ import * as React from 'react'
|
|
|
2
2
|
import styled, { useTheme } from 'styled-components/native'
|
|
3
3
|
import { OButton, OIcon, OText } from '../shared'
|
|
4
4
|
import { Platform, TextStyle, ViewStyle, I18nManager, TouchableOpacity } from 'react-native'
|
|
5
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
5
6
|
|
|
6
7
|
const TitleWrapper = styled.View`
|
|
7
8
|
flex-direction: column;
|
|
@@ -61,11 +62,16 @@ const NavBar = (props: Props) => {
|
|
|
61
62
|
return (
|
|
62
63
|
<Wrapper style={{ paddingTop: props.paddingTop, ...{ flexDirection: props.isVertical ? 'column' : 'row', alignItems: props.isVertical ? 'flex-start' : 'center' }, ...props.style }}>
|
|
63
64
|
<OButton
|
|
64
|
-
imgLeftSrc={props.leftImg
|
|
65
|
+
imgLeftSrc={props.leftImg}
|
|
65
66
|
imgLeftStyle={{ width: 18 }}
|
|
66
67
|
imgRightSrc={null}
|
|
67
68
|
style={{ ...btnBackArrow, ...props.btnStyle, ...props.isVertical ? (I18nManager.isRTL ? { paddingRight: 0 } : { paddingLeft: 0 }) : {} }}
|
|
68
69
|
onClick={props?.onActionLeft}
|
|
70
|
+
icon={AntDesignIcon}
|
|
71
|
+
iconProps={{
|
|
72
|
+
name: 'arrowleft',
|
|
73
|
+
size: 26
|
|
74
|
+
}}
|
|
69
75
|
/>
|
|
70
76
|
<TitleTopWrapper>
|
|
71
77
|
{props.withIcon
|
|
@@ -19,15 +19,16 @@ export const OrderItAgain = (props: OrderItAgainParams) => {
|
|
|
19
19
|
categoryState,
|
|
20
20
|
currentCart,
|
|
21
21
|
handleUpdateProducts,
|
|
22
|
-
navigation
|
|
22
|
+
navigation,
|
|
23
|
+
searchValue
|
|
23
24
|
} = props
|
|
24
25
|
|
|
25
26
|
const [, t] = useLanguage()
|
|
26
27
|
const theme = useTheme()
|
|
27
28
|
const { width } = Dimensions.get('window');
|
|
28
|
-
|
|
29
|
+
const productsFilterd = productList?.length > 0 && productList?.sort((a: any, b:any) => moment(b?.last_ordered_date).valueOf() - moment(a?.last_ordered_date).valueOf()).filter((product : any) => product?.name?.toLowerCase()?.includes(searchValue?.toLowerCase()))
|
|
29
30
|
return (
|
|
30
|
-
<Container>
|
|
31
|
+
<Container hide={productsFilterd?.length === 0}>
|
|
31
32
|
<OText
|
|
32
33
|
size={16}
|
|
33
34
|
lineHeight={24}
|
|
@@ -51,7 +52,7 @@ export const OrderItAgain = (props: OrderItAgainParams) => {
|
|
|
51
52
|
showsVerticalScrollIndicator={false}
|
|
52
53
|
showsHorizontalScrollIndicator={false}
|
|
53
54
|
>
|
|
54
|
-
{
|
|
55
|
+
{productsFilterd.map((product: any, i: number) => (
|
|
55
56
|
<ProductWrapper key={'prod_' + product.id + `_${i}`} style={{ width: width - 120, }}>
|
|
56
57
|
<SingleProductCard
|
|
57
58
|
isSoldOut={product.inventoried && !product.quantity}
|
|
@@ -11,6 +11,7 @@ import { OrderTypeSelectParams } from '../../types'
|
|
|
11
11
|
import { OIcon, OText } from '../shared'
|
|
12
12
|
import NavBar from '../NavBar';
|
|
13
13
|
import { ORDER_TYPES } from '../../config/constants';
|
|
14
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
14
15
|
|
|
15
16
|
const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
16
17
|
const {
|
|
@@ -44,7 +45,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
44
45
|
if (!orderState.loading) {
|
|
45
46
|
setOrderTypeValue && setOrderTypeValue(orderType)
|
|
46
47
|
handleChangeOrderType(orderType)
|
|
47
|
-
if(!isChewLayout){
|
|
48
|
+
if (!isChewLayout) {
|
|
48
49
|
goToBack();
|
|
49
50
|
}
|
|
50
51
|
}
|
|
@@ -58,7 +59,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
58
59
|
horizontal
|
|
59
60
|
showsHorizontalScrollIndicator={false}
|
|
60
61
|
>
|
|
61
|
-
{chewOrderTypes?.map((type
|
|
62
|
+
{chewOrderTypes?.map((type: any) => (
|
|
62
63
|
<TabBtn
|
|
63
64
|
key={type.value}
|
|
64
65
|
onPress={() => handleChangeOrderTypeCallback(type.value)}
|
|
@@ -108,7 +109,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
108
109
|
<OText size={10} lineHeight={15} color={theme.colors.white}>{item?.description}</OText>
|
|
109
110
|
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
110
111
|
<OText size={10} lineHeight={15} color={theme.colors.white}>{t('START_MY_ORDER', 'Start my order')}</OText>
|
|
111
|
-
<
|
|
112
|
+
<AntDesignIcon name='arrowleft' size={26} color={theme.colors.white} style={{ transform: [{ rotate: '180deg' }], marginStart: 4 }} />
|
|
112
113
|
</View>
|
|
113
114
|
</MaskCont>
|
|
114
115
|
</BgImage>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useOrder } from 'ordering-components/native'
|
|
3
3
|
import { BusinessController } from '../../BusinessController'
|
|
4
4
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
5
5
|
|
|
@@ -12,30 +12,93 @@ import {
|
|
|
12
12
|
} from 'react-native';
|
|
13
13
|
import { PreviousBusinessOrderedParams } from '../../../types';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const BusinessControllerList = ({ businesses, onBusinessClick, navigation, orderState, style }: any) => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
{businesses?.result?.map((business: any, i: number) => (
|
|
19
|
+
<BusinessController
|
|
20
|
+
key={`${business.id}_` + i}
|
|
21
|
+
business={business}
|
|
22
|
+
isBusinessOpen={business.open}
|
|
23
|
+
handleCustomClick={() => onBusinessClick(business)}
|
|
24
|
+
orderType={orderState?.options?.type}
|
|
25
|
+
navigation={navigation}
|
|
26
|
+
businessHeader={business?.header}
|
|
27
|
+
businessFeatured={business?.featured}
|
|
28
|
+
businessLogo={business?.logo}
|
|
29
|
+
businessReviews={business?.reviews}
|
|
30
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
31
|
+
businessDeliveryTime={business?.delivery_time}
|
|
32
|
+
businessPickupTime={business?.pickup_time}
|
|
33
|
+
businessDistance={business?.distance}
|
|
34
|
+
style={style}
|
|
35
|
+
/>
|
|
36
|
+
))}
|
|
37
|
+
</>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const BusinessSkeletons = () => {
|
|
42
|
+
return (
|
|
43
|
+
<>
|
|
44
|
+
{[...Array(4).keys()].map((item, i) => (
|
|
45
|
+
<Placeholder
|
|
46
|
+
Animation={Fade}
|
|
47
|
+
key={i}
|
|
48
|
+
style={{ marginBottom: 20 }}>
|
|
49
|
+
<View style={{ width: '100%' }}>
|
|
50
|
+
<PlaceholderLine
|
|
51
|
+
height={200}
|
|
52
|
+
style={{ marginBottom: 20, borderRadius: 25 }}
|
|
53
|
+
/>
|
|
54
|
+
<View style={{ paddingHorizontal: 10 }}>
|
|
55
|
+
<View
|
|
56
|
+
style={{
|
|
57
|
+
flexDirection: 'row',
|
|
58
|
+
justifyContent: 'space-between',
|
|
59
|
+
}}>
|
|
60
|
+
<PlaceholderLine
|
|
61
|
+
height={25}
|
|
62
|
+
width={40}
|
|
63
|
+
style={{ marginBottom: 10 }}
|
|
64
|
+
/>
|
|
65
|
+
<PlaceholderLine
|
|
66
|
+
height={25}
|
|
67
|
+
width={20}
|
|
68
|
+
style={{ marginBottom: 10 }}
|
|
69
|
+
/>
|
|
70
|
+
</View>
|
|
71
|
+
<PlaceholderLine
|
|
72
|
+
height={20}
|
|
73
|
+
width={30}
|
|
74
|
+
style={{ marginBottom: 10 }}
|
|
75
|
+
/>
|
|
76
|
+
<PlaceholderLine
|
|
77
|
+
height={20}
|
|
78
|
+
width={80}
|
|
79
|
+
style={{ marginBottom: 10 }}
|
|
80
|
+
/>
|
|
81
|
+
</View>
|
|
82
|
+
</View>
|
|
83
|
+
</Placeholder>
|
|
84
|
+
))}
|
|
85
|
+
</>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) => {
|
|
16
90
|
const {
|
|
17
91
|
navigation,
|
|
18
|
-
|
|
19
|
-
setBusinessLoading,
|
|
20
|
-
businessId,
|
|
92
|
+
businesses,
|
|
21
93
|
onNavigationRedirect,
|
|
22
94
|
isBusinessesSearchList,
|
|
23
|
-
businessLoading
|
|
24
95
|
} = props
|
|
25
96
|
|
|
26
97
|
const [orderState] = useOrder()
|
|
27
98
|
const windowWidth = Dimensions.get('window').width;
|
|
28
|
-
|
|
29
99
|
const onBusinessClick = (business: any) => {
|
|
30
100
|
onNavigationRedirect('Business', { store: business.slug })
|
|
31
101
|
}
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (businessesList?.loading && businessesList?.businesses?.length === 0) {
|
|
34
|
-
setBusinessLoading(true)
|
|
35
|
-
} else {
|
|
36
|
-
setBusinessLoading(false)
|
|
37
|
-
}
|
|
38
|
-
}, [businessesList?.loading])
|
|
39
102
|
|
|
40
103
|
const styles = StyleSheet.create({
|
|
41
104
|
container: {
|
|
@@ -43,95 +106,31 @@ export const PreviousBusinessOrderedUI = (props: PreviousBusinessOrderedParams)
|
|
|
43
106
|
},
|
|
44
107
|
});
|
|
45
108
|
|
|
46
|
-
const BusinessControllerList = ({ style }: any) => {
|
|
47
|
-
return (
|
|
48
|
-
<>
|
|
49
|
-
{businessesList.businesses?.filter((business: any) => businessId?.includes(business?.id))?.map((business: any, i: number) => (
|
|
50
|
-
<BusinessController
|
|
51
|
-
key={`${business.id}_` + i}
|
|
52
|
-
business={business}
|
|
53
|
-
isBusinessOpen={business.open}
|
|
54
|
-
handleCustomClick={() => onBusinessClick(business)}
|
|
55
|
-
orderType={orderState?.options?.type}
|
|
56
|
-
navigation={navigation}
|
|
57
|
-
businessHeader={business?.header}
|
|
58
|
-
businessFeatured={business?.featured}
|
|
59
|
-
businessLogo={business?.logo}
|
|
60
|
-
businessReviews={business?.reviews}
|
|
61
|
-
businessDeliveryPrice={business?.delivery_price}
|
|
62
|
-
businessDeliveryTime={business?.delivery_time}
|
|
63
|
-
businessPickupTime={business?.pickup_time}
|
|
64
|
-
businessDistance={business?.distance}
|
|
65
|
-
style={style}
|
|
66
|
-
/>
|
|
67
|
-
))}
|
|
68
|
-
</>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const BusinessSkeletons = () => {
|
|
73
|
-
return (
|
|
74
|
-
<>
|
|
75
|
-
{[...Array(4).keys()].map((item, i) => (
|
|
76
|
-
<Placeholder
|
|
77
|
-
Animation={Fade}
|
|
78
|
-
key={i}
|
|
79
|
-
style={{ marginBottom: 20 }}>
|
|
80
|
-
<View style={{ width: '100%' }}>
|
|
81
|
-
<PlaceholderLine
|
|
82
|
-
height={200}
|
|
83
|
-
style={{ marginBottom: 20, borderRadius: 25 }}
|
|
84
|
-
/>
|
|
85
|
-
<View style={{ paddingHorizontal: 10 }}>
|
|
86
|
-
<View
|
|
87
|
-
style={{
|
|
88
|
-
flexDirection: 'row',
|
|
89
|
-
justifyContent: 'space-between',
|
|
90
|
-
}}>
|
|
91
|
-
<PlaceholderLine
|
|
92
|
-
height={25}
|
|
93
|
-
width={40}
|
|
94
|
-
style={{ marginBottom: 10 }}
|
|
95
|
-
/>
|
|
96
|
-
<PlaceholderLine
|
|
97
|
-
height={25}
|
|
98
|
-
width={20}
|
|
99
|
-
style={{ marginBottom: 10 }}
|
|
100
|
-
/>
|
|
101
|
-
</View>
|
|
102
|
-
<PlaceholderLine
|
|
103
|
-
height={20}
|
|
104
|
-
width={30}
|
|
105
|
-
style={{ marginBottom: 10 }}
|
|
106
|
-
/>
|
|
107
|
-
<PlaceholderLine
|
|
108
|
-
height={20}
|
|
109
|
-
width={80}
|
|
110
|
-
style={{ marginBottom: 10 }}
|
|
111
|
-
/>
|
|
112
|
-
</View>
|
|
113
|
-
</View>
|
|
114
|
-
</Placeholder>
|
|
115
|
-
))}
|
|
116
|
-
</>
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
109
|
return (
|
|
121
110
|
<ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
|
|
122
111
|
{isBusinessesSearchList ? (
|
|
123
112
|
<>
|
|
124
|
-
{!
|
|
113
|
+
{!businesses?.loading && (
|
|
125
114
|
<BusinessControllerList
|
|
126
115
|
style={{ width: windowWidth - 120, marginRight: 20 }}
|
|
116
|
+
onBusinessClick={onBusinessClick}
|
|
117
|
+
orderState={orderState}
|
|
118
|
+
navigation={navigation}
|
|
119
|
+
businesses={businesses}
|
|
127
120
|
/>
|
|
128
121
|
)}
|
|
129
122
|
</>
|
|
130
123
|
) : (
|
|
131
124
|
<ListWrapper>
|
|
132
|
-
|
|
133
|
-
{businessesList.loading && (
|
|
125
|
+
{businesses?.loading ? (
|
|
134
126
|
<BusinessSkeletons />
|
|
127
|
+
) : (
|
|
128
|
+
<BusinessControllerList
|
|
129
|
+
onBusinessClick={onBusinessClick}
|
|
130
|
+
orderState={orderState}
|
|
131
|
+
navigation={navigation}
|
|
132
|
+
businesses={businesses}
|
|
133
|
+
/>
|
|
135
134
|
)}
|
|
136
135
|
</ListWrapper>
|
|
137
136
|
)}
|
|
@@ -139,15 +138,3 @@ export const PreviousBusinessOrderedUI = (props: PreviousBusinessOrderedParams)
|
|
|
139
138
|
</ScrollView>
|
|
140
139
|
)
|
|
141
140
|
}
|
|
142
|
-
|
|
143
|
-
export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) => {
|
|
144
|
-
const previousBusinessOrderedController = {
|
|
145
|
-
...props,
|
|
146
|
-
UIComponent: PreviousBusinessOrderedUI,
|
|
147
|
-
paginationSettings: { initialPage: 1, pageSize: 50, controlType: 'infinity' }
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<BusinessListController {...previousBusinessOrderedController} />
|
|
152
|
-
)
|
|
153
|
-
}
|
|
@@ -47,6 +47,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
47
47
|
businessesSearchList,
|
|
48
48
|
hideOrders,
|
|
49
49
|
BusinessControllerSkeletons,
|
|
50
|
+
businesses,
|
|
51
|
+
businessPaginationProps
|
|
50
52
|
} = props
|
|
51
53
|
|
|
52
54
|
const theme = useTheme();
|
|
@@ -213,23 +215,20 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
213
215
|
)}
|
|
214
216
|
</>
|
|
215
217
|
)}
|
|
216
|
-
{isBusiness && !!businessesSearchList &&
|
|
218
|
+
{isBusiness && !!businessesSearchList && businesses?.loading && (
|
|
217
219
|
<ScrollView horizontal>
|
|
218
|
-
<BusinessControllerSkeletons />
|
|
220
|
+
<BusinessControllerSkeletons paginationProps={businessPaginationProps} />
|
|
219
221
|
</ScrollView>
|
|
220
222
|
)}
|
|
221
|
-
{isBusiness &&
|
|
223
|
+
{isBusiness && (
|
|
222
224
|
<PreviousBusinessOrdered
|
|
223
|
-
businessId={businessOrderIds}
|
|
224
|
-
businessLoading={businessLoading}
|
|
225
|
-
setBusinessLoading={setBusinessLoading}
|
|
226
225
|
onNavigationRedirect={onNavigationRedirect}
|
|
227
|
-
isLoadingOrders={loading}
|
|
228
226
|
isBusinessesSearchList={!!businessesSearchList}
|
|
227
|
+
businesses={businesses}
|
|
229
228
|
/>
|
|
230
229
|
)}
|
|
231
230
|
|
|
232
|
-
{isProducts && (
|
|
231
|
+
{isProducts && !loading && (
|
|
233
232
|
<PreviousProductsOrdered
|
|
234
233
|
products={products}
|
|
235
234
|
onProductClick={onProductClick}
|
|
@@ -238,9 +237,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
238
237
|
)}
|
|
239
238
|
{(loading && isProducts) && (
|
|
240
239
|
<>
|
|
241
|
-
{[...Array(4).keys()].map(
|
|
240
|
+
{[...Array(!!businessesSearchList ? 1 : 4).keys()].map(
|
|
242
241
|
(item, i) => (
|
|
243
|
-
<Placeholder key={i} style={{ padding: 5, paddingLeft: 40 }} Animation={Fade}>
|
|
242
|
+
<Placeholder key={i} style={{ padding: 5, paddingLeft: !!businessesSearchList ? 0 : 40, marginBottom: !!businessesSearchList ? 38 : 0 }} Animation={Fade}>
|
|
244
243
|
<View style={{ flexDirection: 'row' }}>
|
|
245
244
|
<PlaceholderLine
|
|
246
245
|
width={24}
|
|
@@ -102,6 +102,10 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
|
|
|
102
102
|
showToast(ToastType.Error, t('VALIDATION_ERROR_INTEGER', 'The _attribute_ must be an integer.').replace('_attribute_', placeholderText))
|
|
103
103
|
return
|
|
104
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
|
+
}
|
|
105
109
|
const isVehicle = Object.values(vehicle).every(e => e)
|
|
106
110
|
const bodyToSend: any = {}
|
|
107
111
|
spotNumber && (bodyToSend.spot_number = spotNumber)
|
|
@@ -458,7 +458,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
458
458
|
<SafeAreaView style={{ flex: 1 }}>
|
|
459
459
|
<TopHeader>
|
|
460
460
|
<TopActions onPress={() => handleGoBack()}>
|
|
461
|
-
<
|
|
461
|
+
<IconAntDesign name='arrowleft' size={26} />
|
|
462
462
|
</TopActions>
|
|
463
463
|
</TopHeader>
|
|
464
464
|
{!error && (
|
|
@@ -981,15 +981,15 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
981
981
|
<OText size={16} lineHeight={24} weight={'600'}>
|
|
982
982
|
{productCart.total ? parsePrice(productCart?.total) : ''}
|
|
983
983
|
</OText>
|
|
984
|
-
{product?.minimum_per_order && productCart?.quantity
|
|
985
|
-
{product?.maximum_per_order && productCart?.quantity
|
|
984
|
+
{product?.minimum_per_order && productCart?.quantity <= product?.minimum_per_order && productCart?.quantity !== 1 && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MINIMUM_TO_ORDER', 'Min. _number_ ').replace('_number_', product?.minimum_per_order)}</OText>}
|
|
985
|
+
{product?.maximum_per_order && productCart?.quantity >= product?.maximum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MAXIMUM_TO_ORDER', 'Max. _number_'.replace('_number_', product?.maximum_per_order))}</OText>}
|
|
986
986
|
</View>
|
|
987
987
|
{productCart && !isSoldOut && maxProductQuantity > 0 && (
|
|
988
988
|
<>
|
|
989
989
|
<View style={styles.quantityControl}>
|
|
990
990
|
<TouchableOpacity
|
|
991
991
|
onPress={decrement}
|
|
992
|
-
disabled={productCart.quantity === 1 || isSoldOut}>
|
|
992
|
+
disabled={productCart.quantity === 1 || !productCart.quantity || isSoldOut || (productCart?.quantity <= product?.minimum_per_order)}>
|
|
993
993
|
<OIcon
|
|
994
994
|
src={theme.images.general.minus}
|
|
995
995
|
width={16}
|
|
@@ -1031,7 +1031,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
1031
1031
|
disabled={
|
|
1032
1032
|
maxProductQuantity <= 0 ||
|
|
1033
1033
|
productCart.quantity >= maxProductQuantity ||
|
|
1034
|
-
productCart.quantity >= product?.maximum_per_order ||
|
|
1034
|
+
(productCart.quantity >= product?.maximum_per_order && product?.maximum_per_order) ||
|
|
1035
1035
|
isSoldOut
|
|
1036
1036
|
}>
|
|
1037
1037
|
<OIcon
|
|
@@ -1040,7 +1040,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
1040
1040
|
color={
|
|
1041
1041
|
maxProductQuantity <= 0 ||
|
|
1042
1042
|
productCart.quantity >= maxProductQuantity ||
|
|
1043
|
-
productCart.quantity >= product?.maximum_per_order ||
|
|
1043
|
+
(productCart.quantity >= product?.maximum_per_order && product?.maximum_per_order) ||
|
|
1044
1044
|
isSoldOut
|
|
1045
1045
|
? theme.colors.backgroundGray
|
|
1046
1046
|
: theme.colors.backgroundDark
|
|
@@ -1095,7 +1095,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
1095
1095
|
export const ProductForm = (props: any) => {
|
|
1096
1096
|
const productOptionsProps = {
|
|
1097
1097
|
...props,
|
|
1098
|
-
productCart: { quantity: props?.product?.maximum_per_order || 1 },
|
|
1098
|
+
productCart: { quantity: props?.product?.maximum_per_order || props?.product?.minimum_per_order || 1 },
|
|
1099
1099
|
UIComponent: ProductOptionsUI,
|
|
1100
1100
|
};
|
|
1101
1101
|
|