ordering-ui-react-native 0.16.58 → 0.16.61
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/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
- package/themes/business/src/types/index.tsx +1 -0
- package/themes/original/src/components/BusinessController/index.tsx +7 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +5 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +4 -1
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +1 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +14 -4
- package/themes/original/src/components/BusinessesListing/index.tsx +3 -2
- 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/ProductForm/index.tsx +175 -154
- package/themes/original/src/components/ProductForm/styles.tsx +3 -5
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/SingleOrderCard/index.tsx +156 -121
- package/themes/original/src/components/SingleProductCard/index.tsx +11 -4
- package/themes/original/src/components/shared/OBottomPopup.tsx +5 -3
- package/themes/original/src/types/index.tsx +10 -3
package/package.json
CHANGED
|
@@ -36,6 +36,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
36
36
|
handleCancelEdit,
|
|
37
37
|
toggleIsEdit,
|
|
38
38
|
isCheckout,
|
|
39
|
+
isAlsea
|
|
39
40
|
} = props;
|
|
40
41
|
|
|
41
42
|
const theme = useTheme();
|
|
@@ -265,7 +266,9 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
265
266
|
}).map(
|
|
266
267
|
(field: any) =>
|
|
267
268
|
showField &&
|
|
268
|
-
showField(field.code) &&
|
|
269
|
+
showField(field.code) &&
|
|
270
|
+
!isAlsea
|
|
271
|
+
&& (
|
|
269
272
|
<React.Fragment key={field.id}>
|
|
270
273
|
<OText style={styles.label}>
|
|
271
274
|
{t(field?.code.toUpperCase(), field?.name)}
|
|
@@ -442,7 +445,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
442
445
|
</OText>
|
|
443
446
|
)}
|
|
444
447
|
|
|
445
|
-
{!!showInputPhoneNumber && (
|
|
448
|
+
{!!showInputPhoneNumber && !isAlsea && (
|
|
446
449
|
<WrapperPhone>
|
|
447
450
|
<PhoneInputNumber
|
|
448
451
|
data={phoneInputData}
|
|
@@ -49,6 +49,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
49
49
|
handleToggleAvalaibleStatusDriver,
|
|
50
50
|
userState,
|
|
51
51
|
isAvailableLoading,
|
|
52
|
+
isAlsea
|
|
52
53
|
} = props;
|
|
53
54
|
|
|
54
55
|
const [{ user }] = useSession();
|
|
@@ -459,6 +460,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
459
460
|
hideUpdateButton
|
|
460
461
|
handleCancelEdit={handleCancelEdit}
|
|
461
462
|
toggleIsEdit={toggleIsEdit}
|
|
463
|
+
isAlsea={isAlsea}
|
|
462
464
|
/>
|
|
463
465
|
</View>
|
|
464
466
|
)}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
useLanguage,
|
|
8
8
|
useConfig,
|
|
9
9
|
useToast,
|
|
10
|
+
useSession,
|
|
10
11
|
ToastType
|
|
11
12
|
} from 'ordering-components/native';
|
|
12
13
|
import { OIcon, OText } from '../shared';
|
|
@@ -53,6 +54,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
53
54
|
const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] = useUtils();
|
|
54
55
|
const [, { showToast }] = useToast()
|
|
55
56
|
const [orderState] = useOrder();
|
|
57
|
+
const [ { auth }] = useSession()
|
|
56
58
|
const [configState] = useConfig();
|
|
57
59
|
const [, t] = useLanguage();
|
|
58
60
|
const theme = useTheme()
|
|
@@ -135,7 +137,11 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
const handleChangeFavorite = () => {
|
|
138
|
-
|
|
140
|
+
if (auth) {
|
|
141
|
+
handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
|
|
142
|
+
} else {
|
|
143
|
+
navigation && navigation.navigate('Login');
|
|
144
|
+
}
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
return (
|
|
@@ -35,7 +35,8 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
35
35
|
onClickCategory,
|
|
36
36
|
lazyLoadProductsRecommended,
|
|
37
37
|
handleUpdateProducts,
|
|
38
|
-
isFiltMode
|
|
38
|
+
isFiltMode,
|
|
39
|
+
navigation
|
|
39
40
|
} = props;
|
|
40
41
|
|
|
41
42
|
const [, t] = useLanguage();
|
|
@@ -128,6 +129,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
128
129
|
onProductClick={() => onProductClick(product)}
|
|
129
130
|
productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
130
131
|
handleUpdateProducts={handleUpdateProducts}
|
|
132
|
+
navigation={navigation}
|
|
131
133
|
/>
|
|
132
134
|
))
|
|
133
135
|
}
|
|
@@ -153,6 +155,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
153
155
|
onProductClick={onProductClick}
|
|
154
156
|
handleUpdateProducts={handleUpdateProducts}
|
|
155
157
|
productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
158
|
+
navigation={navigation}
|
|
156
159
|
/>
|
|
157
160
|
),
|
|
158
161
|
)}
|
|
@@ -246,6 +249,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
246
249
|
categoryState={categoryState}
|
|
247
250
|
onProductClick={onProductClick}
|
|
248
251
|
handleUpdateProducts={handleUpdateProducts}
|
|
252
|
+
navigation={navigation}
|
|
249
253
|
productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
250
254
|
/>
|
|
251
255
|
))}
|
|
@@ -277,7 +277,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
277
277
|
</WrapSearchBar>
|
|
278
278
|
)}
|
|
279
279
|
</TopHeader>
|
|
280
|
-
{showBusinessNearCity && (
|
|
280
|
+
{showBusinessNearCity && businessState?.business?.city_id && (
|
|
281
281
|
<NearBusiness>
|
|
282
282
|
<BusinessesListing
|
|
283
283
|
logosLayout
|
|
@@ -323,6 +323,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
323
323
|
setSubcategoriesSelected={setSubcategoriesSelected}
|
|
324
324
|
onClickCategory={handleChangeCategory}
|
|
325
325
|
handleUpdateProducts={handleUpdateProducts}
|
|
326
|
+
navigation={navigation}
|
|
326
327
|
isFiltMode
|
|
327
328
|
/>
|
|
328
329
|
</View>
|
|
@@ -425,6 +426,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
425
426
|
setSubcategoriesSelected={setSubcategoriesSelected}
|
|
426
427
|
onClickCategory={handleChangeCategory}
|
|
427
428
|
handleUpdateProducts={handleUpdateProducts}
|
|
429
|
+
navigation={navigation}
|
|
428
430
|
/>
|
|
429
431
|
</WrapContent>
|
|
430
432
|
</>
|
|
@@ -447,6 +449,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
447
449
|
isBusinessLoading={loading}
|
|
448
450
|
errorQuantityProducts={errorQuantityProducts}
|
|
449
451
|
handleUpdateProducts={handleUpdateProducts}
|
|
452
|
+
navigation={navigation}
|
|
450
453
|
/>
|
|
451
454
|
</WrapContent>
|
|
452
455
|
</>
|
|
@@ -133,7 +133,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
133
133
|
borderRadius: 8,
|
|
134
134
|
marginHorizontal: 40,
|
|
135
135
|
height: 45
|
|
136
|
-
}
|
|
136
|
+
},
|
|
137
|
+
businessSkeleton: {
|
|
138
|
+
borderRadius: 8,
|
|
139
|
+
marginRight: 20,
|
|
140
|
+
width: 56,
|
|
141
|
+
height: 56
|
|
142
|
+
},
|
|
137
143
|
});
|
|
138
144
|
|
|
139
145
|
|
|
@@ -286,9 +292,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
286
292
|
<BusinessLogosContainer horizontal>
|
|
287
293
|
{businessesList?.loading ? (
|
|
288
294
|
<Placeholder Animation={Fade}>
|
|
289
|
-
{
|
|
290
|
-
|
|
291
|
-
|
|
295
|
+
<View style={{ flexDirection: 'row' }}>
|
|
296
|
+
{[...Array(10).keys()].map(i => (
|
|
297
|
+
<View style={styles.businessSkeleton} key={i}>
|
|
298
|
+
<PlaceholderLine style={{ width: '100%', height: '100%' }} />
|
|
299
|
+
</View>
|
|
300
|
+
))}
|
|
301
|
+
</View>
|
|
292
302
|
</Placeholder>
|
|
293
303
|
) : (
|
|
294
304
|
<>
|
|
@@ -9,6 +9,7 @@ import { OBottomPopup } from '../shared';
|
|
|
9
9
|
import { ReviewTrigger } from '../ReviewTrigger';
|
|
10
10
|
|
|
11
11
|
export const BusinessesListing = (props: any) => {
|
|
12
|
+
const { logosLayout } = props
|
|
12
13
|
const theme = useTheme()
|
|
13
14
|
const layout = theme?.layouts?.business_listing_view?.components?.layout?.type || 'original'
|
|
14
15
|
const [, t] = useLanguage();
|
|
@@ -76,8 +77,8 @@ export const BusinessesListing = (props: any) => {
|
|
|
76
77
|
|
|
77
78
|
return (
|
|
78
79
|
<>
|
|
79
|
-
{(layout === 'original') && <OriginalBusinessListing {...props} />}
|
|
80
|
-
{(layout === 'appointment') && <AppointmentBusinessListing {...props} />}
|
|
80
|
+
{((layout === 'original') || logosLayout) && <OriginalBusinessListing {...props} />}
|
|
81
|
+
{(layout === 'appointment') && !logosLayout && <AppointmentBusinessListing {...props} />}
|
|
81
82
|
|
|
82
83
|
{lastOrderReview?.isReviewOpen && (
|
|
83
84
|
<OBottomPopup
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from 'ordering-components/native'
|
|
7
7
|
import { useTheme } from 'styled-components/native';
|
|
8
8
|
import { Platform, View } from 'react-native'
|
|
9
|
-
import { BgImage, ListWrapper, MaskCont, OrderTypeWrapper, Wrapper } from './styles'
|
|
9
|
+
import { BgImage, ListWrapper, MaskCont, OrderTypeWrapper, OTab, OTabs, TabBtn, Wrapper } from './styles'
|
|
10
10
|
import { OrderTypeSelectParams } from '../../types'
|
|
11
11
|
import { OIcon, OText } from '../shared'
|
|
12
12
|
import NavBar from '../NavBar';
|
|
@@ -20,14 +20,16 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
20
20
|
defaultValue,
|
|
21
21
|
configTypes,
|
|
22
22
|
orderTypes,
|
|
23
|
-
setOrderTypeValue
|
|
23
|
+
setOrderTypeValue,
|
|
24
|
+
isChewLayout,
|
|
25
|
+
chewOrderTypes
|
|
24
26
|
} = props
|
|
25
27
|
|
|
26
28
|
const theme = useTheme();
|
|
27
29
|
const [orderState] = useOrder();
|
|
28
30
|
const [, t] = useLanguage();
|
|
29
31
|
const _orderTypes = orderTypes.filter((type: any) => configTypes?.includes(type.value));
|
|
30
|
-
|
|
32
|
+
|
|
31
33
|
const items = _orderTypes.map((type) => {
|
|
32
34
|
return {
|
|
33
35
|
value: type.value,
|
|
@@ -42,43 +44,83 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
42
44
|
if (!orderState.loading) {
|
|
43
45
|
setOrderTypeValue && setOrderTypeValue(orderType)
|
|
44
46
|
handleChangeOrderType(orderType)
|
|
45
|
-
|
|
47
|
+
if(!isChewLayout){
|
|
48
|
+
goToBack();
|
|
49
|
+
}
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
return (
|
|
50
54
|
<Wrapper>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<OText
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
55
|
+
{isChewLayout ? (
|
|
56
|
+
<View>
|
|
57
|
+
<OTabs
|
|
58
|
+
horizontal
|
|
59
|
+
showsHorizontalScrollIndicator={false}
|
|
60
|
+
>
|
|
61
|
+
{chewOrderTypes?.map((type : any) => (
|
|
62
|
+
<TabBtn
|
|
63
|
+
key={type.value}
|
|
64
|
+
onPress={() => handleChangeOrderTypeCallback(type.value)}
|
|
65
|
+
>
|
|
66
|
+
<OTab
|
|
67
|
+
style={{
|
|
68
|
+
borderBottomColor:
|
|
69
|
+
type.value === typeSelected
|
|
70
|
+
? theme.colors.textNormal
|
|
71
|
+
: theme.colors.border,
|
|
72
|
+
}}>
|
|
73
|
+
<OText
|
|
74
|
+
size={14}
|
|
75
|
+
color={
|
|
76
|
+
type.value === typeSelected
|
|
77
|
+
? theme.colors.textNormal
|
|
78
|
+
: theme.colors.disabled
|
|
79
|
+
}
|
|
80
|
+
weight={type.value === typeSelected ? 'bold' : 'normal'}>
|
|
81
|
+
{type.name}
|
|
82
|
+
</OText>
|
|
83
|
+
</OTab>
|
|
84
|
+
</TabBtn>
|
|
85
|
+
))}
|
|
86
|
+
</OTabs>
|
|
87
|
+
</View>
|
|
88
|
+
) : (
|
|
89
|
+
<>
|
|
90
|
+
<NavBar
|
|
91
|
+
onActionLeft={() => goToBack()}
|
|
92
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
93
|
+
paddingTop={0}
|
|
94
|
+
style={{ paddingBottom: 0 }}
|
|
95
|
+
title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
|
|
96
|
+
titleAlign={'center'}
|
|
97
|
+
titleStyle={{ fontSize: 14 }}
|
|
98
|
+
/>
|
|
99
|
+
{
|
|
100
|
+
items.length > 0 && (
|
|
101
|
+
<ListWrapper>
|
|
102
|
+
{
|
|
103
|
+
items && items.map((item: any, idx: number) =>
|
|
104
|
+
<OrderTypeWrapper activeOpacity={0.8} key={idx} disabled={orderState.loading} onPress={() => handleChangeOrderTypeCallback(item.value)}>
|
|
105
|
+
<BgImage source={theme.images.orderTypes[`type${item?.value || 1}`]} resizeMode={'cover'} style={{ opacity: item?.value == typeSelected || typeSelected === undefined ? 1 : 0.4 }}>
|
|
106
|
+
<MaskCont>
|
|
107
|
+
<OText size={12} lineHeight={18} color={theme.colors.white} weight={Platform.OS === 'android' ? 'bold' : '600'}>{item?.label}</OText>
|
|
108
|
+
<OText size={10} lineHeight={15} color={theme.colors.white}>{item?.description}</OText>
|
|
109
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
110
|
+
<OText size={10} lineHeight={15} color={theme.colors.white}>{t('START_MY_ORDER', 'Start my order')}</OText>
|
|
111
|
+
<OIcon src={theme.images.general.arrow_left} width={16} color={theme.colors.white} style={{ transform: [{ rotate: '180deg' }], marginStart: 4 }} />
|
|
112
|
+
</View>
|
|
113
|
+
</MaskCont>
|
|
114
|
+
</BgImage>
|
|
115
|
+
</OrderTypeWrapper>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
</ListWrapper>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
</>
|
|
122
|
+
)}
|
|
123
|
+
|
|
82
124
|
</Wrapper>
|
|
83
125
|
)
|
|
84
126
|
}
|
|
@@ -24,4 +24,22 @@ export const MaskCont = styled.View`
|
|
|
24
24
|
padding: 16px 39px;
|
|
25
25
|
background-color: #0000004D;
|
|
26
26
|
height: 100%;
|
|
27
|
-
`;
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const OTabs = styled.View`
|
|
30
|
+
flex-direction: row;
|
|
31
|
+
width: 100%;
|
|
32
|
+
margin-bottom: -1px;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const OTab = styled.View`
|
|
37
|
+
padding-bottom: 10px;
|
|
38
|
+
border-bottom-width: 1px;
|
|
39
|
+
padding-horizontal: 10px;
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
export const TabBtn = styled.TouchableOpacity`
|
|
43
|
+
min-height: 30px;
|
|
44
|
+
height: 30px;
|
|
45
|
+
`;
|
|
@@ -151,6 +151,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
151
151
|
productTagNameStyle: {
|
|
152
152
|
paddingHorizontal: 6,
|
|
153
153
|
marginRight: 5
|
|
154
|
+
},
|
|
155
|
+
actionContainer: {
|
|
156
|
+
flexDirection: 'row',
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
justifyContent: 'space-between',
|
|
159
|
+
width: '100%',
|
|
160
|
+
marginTop: 10
|
|
154
161
|
}
|
|
155
162
|
});
|
|
156
163
|
|
|
@@ -304,7 +311,9 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
304
311
|
selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
|
|
305
312
|
}
|
|
306
313
|
size={selOpt == id ? 14 : 12}
|
|
307
|
-
weight={selOpt == id ? '600' : 'normal'}
|
|
314
|
+
weight={selOpt == id ? '600' : 'normal'}
|
|
315
|
+
style={{ maxWidth: 150 }}
|
|
316
|
+
numberOfLines={1}>
|
|
308
317
|
{name}
|
|
309
318
|
</OText>
|
|
310
319
|
</TouchableOpacity>
|
|
@@ -366,6 +375,77 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
366
375
|
}
|
|
367
376
|
}, [product])
|
|
368
377
|
|
|
378
|
+
const ActionButton = () => {
|
|
379
|
+
return (
|
|
380
|
+
<View
|
|
381
|
+
style={{
|
|
382
|
+
width: isHaveWeight ? '100%' : ((isSoldOut || maxProductQuantity <= 0) ? '60%' : '40%'),
|
|
383
|
+
}}>
|
|
384
|
+
{((productCart &&
|
|
385
|
+
auth &&
|
|
386
|
+
orderState.options?.address_id) || (isSoldOut || maxProductQuantity <= 0)) && (
|
|
387
|
+
<OButton
|
|
388
|
+
onClick={() => handleSaveProduct()}
|
|
389
|
+
imgRightSrc=""
|
|
390
|
+
text={`${orderState.loading
|
|
391
|
+
? t('LOADING', 'Loading')
|
|
392
|
+
: (isSoldOut || maxProductQuantity <= 0)
|
|
393
|
+
? t('SOLD_OUT', 'Sold out')
|
|
394
|
+
: editMode
|
|
395
|
+
? t('UPDATE', 'Update')
|
|
396
|
+
: t('ADD', 'Add')
|
|
397
|
+
}`}
|
|
398
|
+
isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order))}
|
|
399
|
+
textStyle={{
|
|
400
|
+
color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
|
|
401
|
+
fontSize: orderState.loading || editMode ? 10 : 14
|
|
402
|
+
}}
|
|
403
|
+
style={{
|
|
404
|
+
backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
|
|
405
|
+
borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
|
|
406
|
+
opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
|
|
407
|
+
borderRadius: 7.6,
|
|
408
|
+
height: 44,
|
|
409
|
+
shadowOpacity: 0,
|
|
410
|
+
borderWidth: 1,
|
|
411
|
+
marginTop: isHaveWeight ? 10: 0
|
|
412
|
+
}}
|
|
413
|
+
/>
|
|
414
|
+
)}
|
|
415
|
+
{auth &&
|
|
416
|
+
!orderState.options?.address_id &&
|
|
417
|
+
(orderState.loading ? (
|
|
418
|
+
<OButton
|
|
419
|
+
isDisabled
|
|
420
|
+
text={t('LOADING', 'Loading')}
|
|
421
|
+
imgRightSrc=""
|
|
422
|
+
textStyle={{ fontSize: 10 }}
|
|
423
|
+
/>
|
|
424
|
+
) : (
|
|
425
|
+
<OButton onClick={navigation.navigate('AddressList')} />
|
|
426
|
+
))}
|
|
427
|
+
{!auth && (
|
|
428
|
+
<OButton
|
|
429
|
+
isDisabled={isSoldOut || maxProductQuantity <= 0}
|
|
430
|
+
onClick={() => handleRedirectLogin()}
|
|
431
|
+
text={
|
|
432
|
+
isSoldOut || maxProductQuantity <= 0
|
|
433
|
+
? t('SOLD_OUT', 'Sold out')
|
|
434
|
+
: t('LOGIN_SIGNUP', 'Login / Sign Up')
|
|
435
|
+
}
|
|
436
|
+
imgRightSrc=""
|
|
437
|
+
textStyle={{ color: theme.colors.primary, fontSize: 14 }}
|
|
438
|
+
style={{
|
|
439
|
+
height: 44,
|
|
440
|
+
borderColor: theme.colors.primary,
|
|
441
|
+
backgroundColor: theme.colors.white,
|
|
442
|
+
}}
|
|
443
|
+
/>
|
|
444
|
+
)}
|
|
445
|
+
</View>
|
|
446
|
+
)
|
|
447
|
+
}
|
|
448
|
+
|
|
369
449
|
return (
|
|
370
450
|
<SafeAreaView style={{ flex: 1 }}>
|
|
371
451
|
<TopHeader>
|
|
@@ -886,173 +966,114 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
886
966
|
</ScrollView>
|
|
887
967
|
)}
|
|
888
968
|
{!loading && !error && product && (
|
|
889
|
-
<ProductActions ios={Platform?.OS === 'ios'}>
|
|
890
|
-
<View>
|
|
891
|
-
<
|
|
892
|
-
{
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
}>
|
|
945
|
-
<OIcon
|
|
946
|
-
src={theme.images.general.plus}
|
|
947
|
-
width={16}
|
|
948
|
-
color={
|
|
949
|
-
maxProductQuantity <= 0 ||
|
|
969
|
+
<ProductActions ios={Platform?.OS === 'ios'} isColumn={isHaveWeight}>
|
|
970
|
+
<View style={styles.actionContainer}>
|
|
971
|
+
<View>
|
|
972
|
+
<OText size={16} lineHeight={24} weight={'600'}>
|
|
973
|
+
{productCart.total ? parsePrice(productCart?.total) : ''}
|
|
974
|
+
</OText>
|
|
975
|
+
{product?.minimum_per_order && productCart?.quantity < product?.minimum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MINIMUM_TO_ORDER', 'Min. _number_ ').replace('_number_', product?.minimum_per_order)}</OText>}
|
|
976
|
+
{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>}
|
|
977
|
+
</View>
|
|
978
|
+
{productCart && !isSoldOut && maxProductQuantity > 0 && (
|
|
979
|
+
<>
|
|
980
|
+
<View style={styles.quantityControl}>
|
|
981
|
+
<TouchableOpacity
|
|
982
|
+
onPress={decrement}
|
|
983
|
+
disabled={productCart.quantity === 1 || isSoldOut}>
|
|
984
|
+
<OIcon
|
|
985
|
+
src={theme.images.general.minus}
|
|
986
|
+
width={16}
|
|
987
|
+
color={
|
|
988
|
+
productCart.quantity === 1 || isSoldOut
|
|
989
|
+
? theme.colors.backgroundGray
|
|
990
|
+
: theme.colors.backgroundDark
|
|
991
|
+
}
|
|
992
|
+
/>
|
|
993
|
+
</TouchableOpacity>
|
|
994
|
+
{qtyBy?.pieces && (
|
|
995
|
+
<TextInput
|
|
996
|
+
keyboardType='numeric'
|
|
997
|
+
value={`${productCart?.quantity > 0 ? productCart?.quantity : ''}`}
|
|
998
|
+
onChangeText={(val: any) => onChangeProductCartQuantity(parseInt(val))}
|
|
999
|
+
editable={!orderState.loading}
|
|
1000
|
+
style={{
|
|
1001
|
+
borderWidth: 1,
|
|
1002
|
+
textAlign: 'center',
|
|
1003
|
+
minWidth: 60,
|
|
1004
|
+
borderRadius: 8,
|
|
1005
|
+
borderColor: theme.colors.inputBorderColor,
|
|
1006
|
+
height: 44,
|
|
1007
|
+
marginHorizontal: 10
|
|
1008
|
+
}}
|
|
1009
|
+
/>
|
|
1010
|
+
)}
|
|
1011
|
+
{qtyBy?.weight_unit && (
|
|
1012
|
+
<OText
|
|
1013
|
+
size={12}
|
|
1014
|
+
lineHeight={18}
|
|
1015
|
+
style={{ minWidth: 40, textAlign: 'center' }}
|
|
1016
|
+
>
|
|
1017
|
+
{productCart.quantity * product?.weight}
|
|
1018
|
+
</OText>
|
|
1019
|
+
)}
|
|
1020
|
+
<TouchableOpacity
|
|
1021
|
+
onPress={increment}
|
|
1022
|
+
disabled={
|
|
1023
|
+
maxProductQuantity <= 0 ||
|
|
950
1024
|
productCart.quantity >= maxProductQuantity ||
|
|
951
1025
|
isSoldOut
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
size={12}
|
|
965
|
-
lineHeight={18}
|
|
966
|
-
color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
|
|
967
|
-
>
|
|
968
|
-
{t('PIECES', 'pcs')}
|
|
969
|
-
</OText>
|
|
970
|
-
</WeightUnitItem>
|
|
1026
|
+
}>
|
|
1027
|
+
<OIcon
|
|
1028
|
+
src={theme.images.general.plus}
|
|
1029
|
+
width={16}
|
|
1030
|
+
color={
|
|
1031
|
+
maxProductQuantity <= 0 ||
|
|
1032
|
+
productCart.quantity >= maxProductQuantity ||
|
|
1033
|
+
isSoldOut
|
|
1034
|
+
? theme.colors.backgroundGray
|
|
1035
|
+
: theme.colors.backgroundDark
|
|
1036
|
+
}
|
|
1037
|
+
/>
|
|
971
1038
|
</TouchableOpacity>
|
|
972
|
-
|
|
1039
|
+
</View>
|
|
1040
|
+
{isHaveWeight && (
|
|
1041
|
+
<WeightUnitSwitch>
|
|
973
1042
|
<TouchableOpacity
|
|
974
|
-
onPress={() => handleSwitchQtyUnit('
|
|
1043
|
+
onPress={() => handleSwitchQtyUnit('pieces')}
|
|
975
1044
|
>
|
|
976
|
-
<WeightUnitItem active={qtyBy?.
|
|
1045
|
+
<WeightUnitItem active={qtyBy?.pieces}>
|
|
977
1046
|
<OText
|
|
978
1047
|
size={12}
|
|
979
1048
|
lineHeight={18}
|
|
980
|
-
color={qtyBy?.
|
|
1049
|
+
color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
|
|
981
1050
|
>
|
|
982
|
-
{
|
|
1051
|
+
{t('PIECES', 'pcs')}
|
|
983
1052
|
</OText>
|
|
984
1053
|
</WeightUnitItem>
|
|
985
1054
|
</TouchableOpacity>
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
? t('SOLD_OUT', 'Sold out')
|
|
1005
|
-
: editMode
|
|
1006
|
-
? t('UPDATE', 'Update')
|
|
1007
|
-
: t('ADD', 'Add')
|
|
1008
|
-
}`}
|
|
1009
|
-
isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order))}
|
|
1010
|
-
textStyle={{
|
|
1011
|
-
color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
|
|
1012
|
-
fontSize: orderState.loading || editMode ? 10 : 14
|
|
1013
|
-
}}
|
|
1014
|
-
style={{
|
|
1015
|
-
backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
|
|
1016
|
-
borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
|
|
1017
|
-
opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
|
|
1018
|
-
borderRadius: 7.6,
|
|
1019
|
-
height: 44,
|
|
1020
|
-
shadowOpacity: 0,
|
|
1021
|
-
borderWidth: 1,
|
|
1022
|
-
}}
|
|
1023
|
-
/>
|
|
1024
|
-
)}
|
|
1025
|
-
{auth &&
|
|
1026
|
-
!orderState.options?.address_id &&
|
|
1027
|
-
(orderState.loading ? (
|
|
1028
|
-
<OButton
|
|
1029
|
-
isDisabled
|
|
1030
|
-
text={t('LOADING', 'Loading')}
|
|
1031
|
-
imgRightSrc=""
|
|
1032
|
-
textStyle={{ fontSize: 10 }}
|
|
1033
|
-
/>
|
|
1034
|
-
) : (
|
|
1035
|
-
<OButton onClick={navigation.navigate('AddressList')} />
|
|
1036
|
-
))}
|
|
1037
|
-
{!auth && (
|
|
1038
|
-
<OButton
|
|
1039
|
-
isDisabled={isSoldOut || maxProductQuantity <= 0}
|
|
1040
|
-
onClick={() => handleRedirectLogin()}
|
|
1041
|
-
text={
|
|
1042
|
-
isSoldOut || maxProductQuantity <= 0
|
|
1043
|
-
? t('SOLD_OUT', 'Sold out')
|
|
1044
|
-
: t('LOGIN_SIGNUP', 'Login / Sign Up')
|
|
1045
|
-
}
|
|
1046
|
-
imgRightSrc=""
|
|
1047
|
-
textStyle={{ color: theme.colors.primary, fontSize: 14 }}
|
|
1048
|
-
style={{
|
|
1049
|
-
height: 44,
|
|
1050
|
-
borderColor: theme.colors.primary,
|
|
1051
|
-
backgroundColor: theme.colors.white,
|
|
1052
|
-
}}
|
|
1053
|
-
/>
|
|
1055
|
+
<View style={{ alignItems: 'flex-start' }}>
|
|
1056
|
+
<TouchableOpacity
|
|
1057
|
+
onPress={() => handleSwitchQtyUnit('weight_unit')}
|
|
1058
|
+
>
|
|
1059
|
+
<WeightUnitItem active={qtyBy?.weight_unit}>
|
|
1060
|
+
<OText
|
|
1061
|
+
size={12}
|
|
1062
|
+
lineHeight={18}
|
|
1063
|
+
color={qtyBy?.weight_unit ? theme.colors.primary : theme.colors.textNormal}
|
|
1064
|
+
>
|
|
1065
|
+
{product?.weight_unit}
|
|
1066
|
+
</OText>
|
|
1067
|
+
</WeightUnitItem>
|
|
1068
|
+
</TouchableOpacity>
|
|
1069
|
+
</View>
|
|
1070
|
+
</WeightUnitSwitch>
|
|
1071
|
+
)}
|
|
1072
|
+
</>
|
|
1054
1073
|
)}
|
|
1074
|
+
{!isHaveWeight && <ActionButton />}
|
|
1055
1075
|
</View>
|
|
1076
|
+
{isHaveWeight && <ActionButton />}
|
|
1056
1077
|
</ProductActions>
|
|
1057
1078
|
)}
|
|
1058
1079
|
</SafeAreaView>
|
|
@@ -65,21 +65,19 @@ 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
|
`
|
|
@@ -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}
|
|
@@ -84,7 +84,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
|
|
|
84
84
|
justifyContent: 'space-between'
|
|
85
85
|
},
|
|
86
86
|
professionalItem: {
|
|
87
|
-
|
|
87
|
+
paddingVertical: 11,
|
|
88
88
|
borderColor: theme.colors.backgroundGray200,
|
|
89
89
|
borderTopWidth: 1
|
|
90
90
|
},
|
|
@@ -517,7 +517,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
|
|
|
517
517
|
entireModal
|
|
518
518
|
>
|
|
519
519
|
<ScrollView contentContainerStyle={styles.professionalList}>
|
|
520
|
-
<View style={{
|
|
520
|
+
<View style={{ paddingVertical: 11 }}>
|
|
521
521
|
<OText
|
|
522
522
|
size={14}
|
|
523
523
|
weight={'400'}
|
|
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
SingleOrderCard as SingleOrderCardController,
|
|
4
4
|
useUtils,
|
|
5
|
+
useOrder,
|
|
5
6
|
useLanguage
|
|
6
7
|
} from 'ordering-components/native';
|
|
7
8
|
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
@@ -9,6 +10,7 @@ import { useTheme } from 'styled-components/native';
|
|
|
9
10
|
import { OIcon, OText, OButton } from '../shared';
|
|
10
11
|
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
11
12
|
import { SingleOrderCardParams } from '../../types';
|
|
13
|
+
import { OAlert } from '../../../../../src/components/shared'
|
|
12
14
|
|
|
13
15
|
import {
|
|
14
16
|
Container,
|
|
@@ -32,14 +34,18 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
32
34
|
onNavigationRedirect,
|
|
33
35
|
pastOrders,
|
|
34
36
|
isMessageView,
|
|
35
|
-
handleClickOrder
|
|
37
|
+
handleClickOrder,
|
|
38
|
+
handleRemoveCart,
|
|
39
|
+
cartState
|
|
36
40
|
} = props;
|
|
37
41
|
|
|
38
42
|
const [{ parsePrice, optimizeImage, parseDate }] = useUtils();
|
|
39
43
|
const [, t] = useLanguage();
|
|
44
|
+
const [{ carts }] = useOrder()
|
|
40
45
|
const theme = useTheme();
|
|
41
46
|
|
|
42
47
|
const [reorderSelected, setReorderSelected] = useState<number | null>(null);
|
|
48
|
+
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
43
49
|
|
|
44
50
|
const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12];
|
|
45
51
|
|
|
@@ -97,9 +103,21 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
97
103
|
}
|
|
98
104
|
});
|
|
99
105
|
|
|
100
|
-
const handleReorderClick = (
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
const handleReorderClick = (order: any) => {
|
|
107
|
+
if (carts[`businessId:${order?.business_id}`] && carts[`businessId:${order?.business_id}`]?.products?.length > 0) {
|
|
108
|
+
setConfirm({
|
|
109
|
+
open: true,
|
|
110
|
+
content: [t('QUESTION_DELETE_PRODUCTS_FROM_CART', 'Are you sure that you want to delete all products from cart?')],
|
|
111
|
+
title: t('ORDER', 'Order'),
|
|
112
|
+
handleOnAccept: async () => {
|
|
113
|
+
handleRemoveCart()
|
|
114
|
+
setConfirm({ ...confirm, open: false })
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
} else {
|
|
118
|
+
setReorderSelected(order?.id);
|
|
119
|
+
handleReorder && handleReorder(order?.id);
|
|
120
|
+
}
|
|
103
121
|
};
|
|
104
122
|
|
|
105
123
|
const handleClickOrderReview = (order: any) => {
|
|
@@ -135,134 +153,151 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
135
153
|
handleFavoriteOrder && handleFavoriteOrder(!order?.favorite)
|
|
136
154
|
};
|
|
137
155
|
|
|
156
|
+
const handleOriginalReorder = () => {
|
|
157
|
+
setConfirm({ ...confirm, open: false, title: null })
|
|
158
|
+
setReorderSelected(order?.id);
|
|
159
|
+
handleReorder && handleReorder(order?.id);
|
|
160
|
+
}
|
|
161
|
+
|
|
138
162
|
return (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
<
|
|
154
|
-
<
|
|
155
|
-
<
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
<
|
|
166
|
-
{
|
|
163
|
+
<>
|
|
164
|
+
<Container
|
|
165
|
+
onPress={() => handleClickViewOrder(order?.uuid)}
|
|
166
|
+
activeOpacity={0.7}
|
|
167
|
+
>
|
|
168
|
+
<InnerContainer>
|
|
169
|
+
{!!order.business?.logo && (
|
|
170
|
+
<Logo style={styles.logoWrapper}>
|
|
171
|
+
<OIcon
|
|
172
|
+
url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
|
|
173
|
+
style={styles.logo}
|
|
174
|
+
/>
|
|
175
|
+
</Logo>
|
|
176
|
+
)}
|
|
177
|
+
<CardInfoWrapper>
|
|
178
|
+
<ContentHeader>
|
|
179
|
+
<View style={{ flex: 1 }}>
|
|
180
|
+
<OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
|
|
181
|
+
{order.business?.name}
|
|
182
|
+
</OText>
|
|
183
|
+
</View>
|
|
184
|
+
{!!!pastOrders && (
|
|
185
|
+
<>
|
|
186
|
+
{isMessageView ? (
|
|
187
|
+
<>
|
|
188
|
+
{order?.unread_count > 0 && (
|
|
189
|
+
<UnreadMessageCounter>
|
|
190
|
+
<OText size={12} color={theme.colors.primary} lineHeight={18} >
|
|
191
|
+
{order?.unread_count}
|
|
192
|
+
</OText>
|
|
193
|
+
</UnreadMessageCounter>
|
|
194
|
+
)}
|
|
195
|
+
</>
|
|
196
|
+
) : (
|
|
197
|
+
<Price>
|
|
198
|
+
<OText size={12} lineHeight={18}>
|
|
199
|
+
{parsePrice(order?.summary?.total || order?.total)}
|
|
200
|
+
</OText>
|
|
201
|
+
</Price>
|
|
202
|
+
)}
|
|
203
|
+
</>
|
|
204
|
+
)}
|
|
205
|
+
{!!pastOrders && (
|
|
206
|
+
<ButtonWrapper>
|
|
207
|
+
{allowedOrderStatus.includes(parseInt(order?.status)) &&
|
|
208
|
+
!order.review && (
|
|
209
|
+
<TouchableOpacity
|
|
210
|
+
onPress={() => handleClickOrderReview(order)}
|
|
211
|
+
style={styles.reviewButton}>
|
|
212
|
+
<OText size={10} color={theme.colors.primary} numberOfLines={1}>
|
|
213
|
+
{t('REVIEW', 'Review')}
|
|
167
214
|
</OText>
|
|
168
|
-
</
|
|
215
|
+
</TouchableOpacity>
|
|
169
216
|
)}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
{
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
217
|
+
{order.cart && (
|
|
218
|
+
<OButton
|
|
219
|
+
text={t('REORDER', 'Reorder')}
|
|
220
|
+
imgRightSrc={''}
|
|
221
|
+
textStyle={styles.buttonText}
|
|
222
|
+
style={
|
|
223
|
+
((reorderLoading && order.id === reorderSelected) || cartState?.loading)
|
|
224
|
+
? styles.reorderLoading
|
|
225
|
+
: styles.reorderbutton
|
|
226
|
+
}
|
|
227
|
+
onClick={() => handleReorderClick(order)}
|
|
228
|
+
isLoading={(reorderLoading && order.id === reorderSelected) || cartState?.loading}
|
|
229
|
+
/>
|
|
230
|
+
)}
|
|
231
|
+
</ButtonWrapper>
|
|
232
|
+
)}
|
|
233
|
+
</ContentHeader>
|
|
234
|
+
<ContentFooter>
|
|
235
|
+
<View style={{ flex: 1 }}>
|
|
236
|
+
<View style={styles.infoText}>
|
|
237
|
+
{!!!pastOrders && (
|
|
238
|
+
<>
|
|
239
|
+
<OText
|
|
240
|
+
size={10}
|
|
241
|
+
space
|
|
242
|
+
color={theme.colors.textSecondary}
|
|
243
|
+
style={{ marginVertical: 3 }}
|
|
244
|
+
lineHeight={15}
|
|
245
|
+
numberOfLines={1}
|
|
246
|
+
>
|
|
247
|
+
{t('ORDER_NO', 'Order No') + '.'}
|
|
189
248
|
</OText>
|
|
190
|
-
|
|
249
|
+
<OText
|
|
250
|
+
size={10}
|
|
251
|
+
color={theme.colors.textSecondary}
|
|
252
|
+
style={{ marginVertical: 3 }}
|
|
253
|
+
lineHeight={15}
|
|
254
|
+
numberOfLines={1}
|
|
255
|
+
>
|
|
256
|
+
{order.id + ` \u2022 `}
|
|
257
|
+
</OText>
|
|
258
|
+
</>
|
|
191
259
|
)}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
onClick={() => handleReorderClick(order.id)}
|
|
203
|
-
isLoading={reorderLoading && order.id === reorderSelected}
|
|
204
|
-
/>
|
|
205
|
-
)}
|
|
206
|
-
</ButtonWrapper>
|
|
207
|
-
)}
|
|
208
|
-
</ContentHeader>
|
|
209
|
-
<ContentFooter>
|
|
210
|
-
<View style={{ flex: 1 }}>
|
|
211
|
-
<View style={styles.infoText}>
|
|
212
|
-
{!!!pastOrders && (
|
|
213
|
-
<>
|
|
214
|
-
<OText
|
|
215
|
-
size={10}
|
|
216
|
-
space
|
|
217
|
-
color={theme.colors.textSecondary}
|
|
218
|
-
style={{ marginVertical: 3 }}
|
|
219
|
-
lineHeight={15}
|
|
220
|
-
numberOfLines={1}
|
|
221
|
-
>
|
|
222
|
-
{t('ORDER_NO', 'Order No') + '.'}
|
|
223
|
-
</OText>
|
|
224
|
-
<OText
|
|
225
|
-
size={10}
|
|
226
|
-
color={theme.colors.textSecondary}
|
|
227
|
-
style={{ marginVertical: 3 }}
|
|
228
|
-
lineHeight={15}
|
|
229
|
-
numberOfLines={1}
|
|
230
|
-
>
|
|
231
|
-
{order.id + ` \u2022 `}
|
|
232
|
-
</OText>
|
|
233
|
-
</>
|
|
234
|
-
)}
|
|
260
|
+
<OText
|
|
261
|
+
size={10}
|
|
262
|
+
lineHeight={15}
|
|
263
|
+
color={theme.colors.textSecondary}
|
|
264
|
+
style={{ marginVertical: 3 }}
|
|
265
|
+
numberOfLines={1}>
|
|
266
|
+
{order?.delivery_datetime_utc ? parseDate(order?.delivery_datetime_utc) : parseDate(order?.delivery_datetime, { utc: false })}
|
|
267
|
+
</OText>
|
|
268
|
+
</View>
|
|
235
269
|
<OText
|
|
270
|
+
color={theme.colors.primary}
|
|
236
271
|
size={10}
|
|
237
272
|
lineHeight={15}
|
|
238
|
-
color={theme.colors.textSecondary}
|
|
239
|
-
style={{ marginVertical: 3 }}
|
|
240
273
|
numberOfLines={1}>
|
|
241
|
-
{
|
|
274
|
+
{getOrderStatus(order.status)?.value}
|
|
242
275
|
</OText>
|
|
243
276
|
</View>
|
|
244
|
-
<
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
277
|
+
<TouchableOpacity
|
|
278
|
+
onPress={handleChangeFavorite}
|
|
279
|
+
style={{ marginTop: 5 }}
|
|
280
|
+
>
|
|
281
|
+
<IconAntDesign
|
|
282
|
+
name={order?.favorite ? 'heart' : 'hearto'}
|
|
283
|
+
color={theme.colors.danger5}
|
|
284
|
+
size={16}
|
|
285
|
+
/>
|
|
286
|
+
</TouchableOpacity>
|
|
287
|
+
</ContentFooter>
|
|
288
|
+
</CardInfoWrapper>
|
|
289
|
+
</InnerContainer>
|
|
290
|
+
</Container>
|
|
291
|
+
<OAlert
|
|
292
|
+
open={confirm.open}
|
|
293
|
+
title={confirm.title}
|
|
294
|
+
content={confirm.content}
|
|
295
|
+
onAccept={confirm.handleOnAccept}
|
|
296
|
+
onCancel={() => handleOriginalReorder()}
|
|
297
|
+
onClose={() => handleOriginalReorder()}
|
|
298
|
+
/>
|
|
299
|
+
</>
|
|
300
|
+
|
|
266
301
|
)
|
|
267
302
|
}
|
|
268
303
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
useConfig,
|
|
5
5
|
useOrder,
|
|
6
6
|
useUtils,
|
|
7
|
+
useSession,
|
|
7
8
|
SingleProductCard as SingleProductCardController
|
|
8
9
|
} from 'ordering-components/native';
|
|
9
10
|
import { useTheme } from 'styled-components/native';
|
|
@@ -32,7 +33,9 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
32
33
|
productAddedToCartLength,
|
|
33
34
|
style,
|
|
34
35
|
handleFavoriteProduct,
|
|
35
|
-
enableIntersection
|
|
36
|
+
enableIntersection,
|
|
37
|
+
navigation,
|
|
38
|
+
businessId
|
|
36
39
|
} = props;
|
|
37
40
|
|
|
38
41
|
const theme = useTheme();
|
|
@@ -86,9 +89,9 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
86
89
|
}
|
|
87
90
|
});
|
|
88
91
|
|
|
89
|
-
|
|
90
92
|
const [, t] = useLanguage();
|
|
91
93
|
const [stateConfig] = useConfig();
|
|
94
|
+
const [{ auth }] = useSession()
|
|
92
95
|
const [{ parsePrice, optimizeImage }] = useUtils();
|
|
93
96
|
const [orderState] = useOrder()
|
|
94
97
|
const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
|
|
@@ -118,7 +121,11 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
118
121
|
);
|
|
119
122
|
|
|
120
123
|
const handleChangeFavorite = () => {
|
|
121
|
-
|
|
124
|
+
if (auth) {
|
|
125
|
+
handleFavoriteProduct && handleFavoriteProduct(!product?.favorite)
|
|
126
|
+
} else {
|
|
127
|
+
navigation && navigation.navigate('Login');
|
|
128
|
+
}
|
|
122
129
|
}
|
|
123
130
|
|
|
124
131
|
return (
|
|
@@ -148,7 +155,7 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
148
155
|
weight={'500'}
|
|
149
156
|
numberOfLines={1}
|
|
150
157
|
ellipsizeMode="tail"
|
|
151
|
-
style={styles.line18}>
|
|
158
|
+
style={{ ...styles.line18, flex: 1 }}>
|
|
152
159
|
{product?.name}
|
|
153
160
|
</OText>
|
|
154
161
|
<TouchableOpacity
|
|
@@ -49,10 +49,11 @@ const OBottomPopup = (props: Props) => {
|
|
|
49
49
|
<View style={{ paddingTop: top, paddingBottom: bottom }}>
|
|
50
50
|
<View style={styles.modalTitleStyle}>
|
|
51
51
|
{closeIcon && (
|
|
52
|
-
<TouchableOpacity onPress={onClose} style={styles.closeIconStyle}>
|
|
52
|
+
<TouchableOpacity onPress={() => onClose()} style={styles.closeIconStyle}>
|
|
53
53
|
<OIcon
|
|
54
54
|
src={closeIcon}
|
|
55
|
-
width={
|
|
55
|
+
width={20}
|
|
56
|
+
height={20}
|
|
56
57
|
/>
|
|
57
58
|
</TouchableOpacity>
|
|
58
59
|
)}
|
|
@@ -93,7 +94,8 @@ const styles = StyleSheet.create({
|
|
|
93
94
|
closeIconStyle: {
|
|
94
95
|
position: 'absolute',
|
|
95
96
|
left: 25,
|
|
96
|
-
top:
|
|
97
|
+
top: 25,
|
|
98
|
+
zIndex: 100
|
|
97
99
|
},
|
|
98
100
|
modalTitleStyle: {
|
|
99
101
|
position: 'relative',
|
|
@@ -169,6 +169,7 @@ export interface BusinessesListingParams {
|
|
|
169
169
|
priceLevelSelected?: any;
|
|
170
170
|
handleChangePriceLevel?: any;
|
|
171
171
|
businessTypeSelected?: any;
|
|
172
|
+
logosLayout?: boolean;
|
|
172
173
|
}
|
|
173
174
|
export interface HighestRatedBusinessesParams {
|
|
174
175
|
businessesList: { businesses: Array<any>, loading: boolean, error: null | string };
|
|
@@ -287,7 +288,8 @@ export interface BusinessProductsListParams {
|
|
|
287
288
|
onClickCategory?: any,
|
|
288
289
|
lazyLoadProductsRecommended?: boolean,
|
|
289
290
|
isFiltMode?: boolean,
|
|
290
|
-
handleUpdateProducts?: any
|
|
291
|
+
handleUpdateProducts?: any,
|
|
292
|
+
navigation?: any;
|
|
291
293
|
}
|
|
292
294
|
export interface SingleProductCardParams {
|
|
293
295
|
businessId: any;
|
|
@@ -300,6 +302,7 @@ export interface SingleProductCardParams {
|
|
|
300
302
|
handleFavoriteProduct?: any;
|
|
301
303
|
handleUpdateProducts?: any;
|
|
302
304
|
enableIntersection?: boolean;
|
|
305
|
+
navigation?: any;
|
|
303
306
|
}
|
|
304
307
|
export interface BusinessInformationParams {
|
|
305
308
|
navigation?: any,
|
|
@@ -549,7 +552,9 @@ export interface OrderTypeSelectParams {
|
|
|
549
552
|
defaultValue?: number;
|
|
550
553
|
configTypes?: Array<any>;
|
|
551
554
|
orderTypes: Array<any>;
|
|
552
|
-
setOrderTypeValue?: (value: number) => any
|
|
555
|
+
setOrderTypeValue?: (value: number) => any,
|
|
556
|
+
isChewLayout?: boolean;
|
|
557
|
+
chewOrderTypes?: any;
|
|
553
558
|
}
|
|
554
559
|
export interface UpsellingProductsParams {
|
|
555
560
|
isCustomMode?: boolean;
|
|
@@ -692,7 +697,9 @@ export interface SingleOrderCardParams {
|
|
|
692
697
|
onNavigationRedirect?: (route: string, params?: any) => {},
|
|
693
698
|
pastOrders: any,
|
|
694
699
|
isMessageView?: any,
|
|
695
|
-
handleClickOrder: (value: any) => {}
|
|
700
|
+
handleClickOrder: (value: any) => {},
|
|
701
|
+
handleRemoveCart: () => {},
|
|
702
|
+
cartState: any
|
|
696
703
|
}
|
|
697
704
|
|
|
698
705
|
export interface PreviousBusinessOrderedParams {
|