ordering-ui-react-native 0.17.84 → 0.17.86
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/ProductItemAccordion/index.tsx +21 -3
- package/themes/original/src/components/AddressForm/index.tsx +26 -22
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +91 -70
- package/themes/original/src/components/BusinessController/index.tsx +71 -49
- package/themes/original/src/components/BusinessProductsListing/index.tsx +2 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +47 -29
- package/themes/original/src/components/Cart/index.tsx +34 -9
- package/themes/original/src/components/CartContent/index.tsx +5 -1
- package/themes/original/src/components/Checkout/index.tsx +39 -31
- package/themes/original/src/components/Messages/index.tsx +8 -7
- package/themes/original/src/components/MultiCheckout/index.tsx +15 -7
- package/themes/original/src/components/MyOrders/index.tsx +9 -7
- package/themes/original/src/components/OrderDetails/index.tsx +99 -73
- package/themes/original/src/components/OrderTypeSelector/index.tsx +6 -4
- package/themes/original/src/components/SingleOrderCard/index.tsx +44 -28
- package/themes/original/src/components/SingleProductCard/index.tsx +51 -21
- package/themes/original/src/components/SingleProductCard/styles.tsx +11 -1
- package/themes/original/src/components/UserProfile/index.tsx +82 -53
- package/themes/original/src/components/shared/OButton.tsx +5 -1
- package/themes/original/src/components/shared/OInput.tsx +8 -2
- package/themes/original/src/types/index.tsx +1 -0
- package/themes/original/src/utils/index.tsx +12 -0
|
@@ -18,8 +18,7 @@ import {
|
|
|
18
18
|
useSession,
|
|
19
19
|
useOrder,
|
|
20
20
|
useConfig,
|
|
21
|
-
useUtils
|
|
22
|
-
useOrderingTheme
|
|
21
|
+
useUtils
|
|
23
22
|
} from 'ordering-components/native';
|
|
24
23
|
import { useTheme } from 'styled-components/native';
|
|
25
24
|
import Ionicons from 'react-native-vector-icons/Ionicons'
|
|
@@ -74,13 +73,25 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
74
73
|
logosLayout
|
|
75
74
|
} = props;
|
|
76
75
|
const theme = useTheme();
|
|
77
|
-
const [orderingTheme] = useOrderingTheme()
|
|
78
76
|
const isFocused = useIsFocused();
|
|
77
|
+
|
|
78
|
+
const [, t] = useLanguage();
|
|
79
|
+
const [{ user, auth }] = useSession();
|
|
80
|
+
const [orderState, { changeCityFilter }] = useOrder();
|
|
81
|
+
const [{ configs }] = useConfig();
|
|
82
|
+
const [{ parseDate }] = useUtils();
|
|
83
|
+
|
|
79
84
|
const appState = useRef(AppState.currentState)
|
|
80
85
|
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
81
|
-
const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
|
|
82
86
|
const [refreshing] = useState(false);
|
|
83
|
-
const
|
|
87
|
+
const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2) ?? true
|
|
88
|
+
const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
|
|
89
|
+
const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
|
|
90
|
+
const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
|
|
91
|
+
const isAllCategoriesHidden = theme?.business_listing_view?.components?.categories?.hidden
|
|
92
|
+
const bgHeader = theme?.business_listing_view?.components?.business_hero?.components?.image
|
|
93
|
+
const bgHeaderHeight = theme?.business_listing_view?.components?.business_hero?.components?.style?.height
|
|
94
|
+
|
|
84
95
|
const styles = StyleSheet.create({
|
|
85
96
|
container: {
|
|
86
97
|
marginBottom: 0,
|
|
@@ -144,13 +155,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
144
155
|
},
|
|
145
156
|
});
|
|
146
157
|
|
|
147
|
-
|
|
148
|
-
const [, t] = useLanguage();
|
|
149
|
-
const [{ user, auth }] = useSession();
|
|
150
|
-
const [orderState, { changeCityFilter }] = useOrder();
|
|
151
|
-
const [{ configs }] = useConfig();
|
|
152
|
-
const [{ parseDate }] = useUtils();
|
|
153
|
-
|
|
154
158
|
const { top } = useSafeAreaInsets();
|
|
155
159
|
|
|
156
160
|
const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
|
|
@@ -466,18 +470,30 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
466
470
|
)}
|
|
467
471
|
</View>
|
|
468
472
|
{!isChewLayout ? (
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
473
|
+
<>
|
|
474
|
+
{!hideHero ? (
|
|
475
|
+
<HeaderWrapper
|
|
476
|
+
source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
|
|
477
|
+
style={{ paddingTop: top + 20 }}
|
|
478
|
+
resizeMode='cover'
|
|
479
|
+
bgHeaderHeight={bgHeaderHeight}
|
|
480
|
+
>
|
|
481
|
+
{!auth && (
|
|
482
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
|
|
483
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
|
|
484
|
+
</TouchableOpacity>
|
|
485
|
+
)}
|
|
486
|
+
</HeaderWrapper>
|
|
487
|
+
) : (
|
|
488
|
+
<>
|
|
489
|
+
{!auth && (
|
|
490
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
|
|
491
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
|
|
492
|
+
</TouchableOpacity>
|
|
493
|
+
)}
|
|
494
|
+
</>
|
|
479
495
|
)}
|
|
480
|
-
|
|
496
|
+
</>
|
|
481
497
|
) : (
|
|
482
498
|
<OrderTypesContainer>
|
|
483
499
|
<OrderTypeSelector
|
|
@@ -502,10 +518,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
502
518
|
</TouchableOpacity>
|
|
503
519
|
</View>
|
|
504
520
|
)}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
521
|
+
{!hidePreviousOrders && (
|
|
522
|
+
<OrderProgress
|
|
523
|
+
{...props}
|
|
524
|
+
isFocused={isFocused}
|
|
525
|
+
/>
|
|
526
|
+
)}
|
|
509
527
|
{
|
|
510
528
|
!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
|
|
511
529
|
<FeaturedWrapper>
|
|
@@ -538,7 +556,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
538
556
|
</FeaturedWrapper>
|
|
539
557
|
)
|
|
540
558
|
}
|
|
541
|
-
{!isChewLayout && (
|
|
559
|
+
{!isChewLayout && !hideHighestBusiness && (
|
|
542
560
|
<>
|
|
543
561
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
544
562
|
{
|
|
@@ -558,7 +576,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
558
576
|
|
|
559
577
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
560
578
|
<ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
|
|
561
|
-
{!businessId && (
|
|
579
|
+
{!businessId && !isAllCategoriesHidden && (
|
|
562
580
|
<BusinessTypeFilter
|
|
563
581
|
images={props.images}
|
|
564
582
|
businessTypes={props.businessTypes}
|
|
@@ -41,7 +41,10 @@ const CartUI = (props: any) => {
|
|
|
41
41
|
commentState,
|
|
42
42
|
onNavigationRedirect,
|
|
43
43
|
handleRemoveOfferClick,
|
|
44
|
-
isMultiCheckout
|
|
44
|
+
isMultiCheckout,
|
|
45
|
+
hideDeliveryFee,
|
|
46
|
+
hideDriverTip,
|
|
47
|
+
showGeneralBtn
|
|
45
48
|
} = props
|
|
46
49
|
|
|
47
50
|
const theme = useTheme();
|
|
@@ -67,7 +70,8 @@ const CartUI = (props: any) => {
|
|
|
67
70
|
const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
|
|
68
71
|
const businessId = business?.business_id ?? null
|
|
69
72
|
const placeSpotTypes = [4]
|
|
70
|
-
|
|
73
|
+
const hideCartComments = theme?.business_view?.components?.cart?.components?.comments?.hidden
|
|
74
|
+
const hideCartDiscount = theme?.business_view?.components?.cart?.components?.discount?.hidden
|
|
71
75
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
72
76
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
73
77
|
: configs?.driver_tip_options?.value || []
|
|
@@ -191,6 +195,26 @@ const CartUI = (props: any) => {
|
|
|
191
195
|
|
|
192
196
|
return (
|
|
193
197
|
<CContainer>
|
|
198
|
+
{showGeneralBtn && cart?.valid_products &&(
|
|
199
|
+
<CheckoutAction style={{ marginTop: 0 }}>
|
|
200
|
+
<OButton
|
|
201
|
+
text={(subtotalWithTaxes >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
|
|
202
|
+
!openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
|
|
203
|
+
) : !cart?.valid_address ? (
|
|
204
|
+
`${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
|
|
205
|
+
) : (
|
|
206
|
+
`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
|
|
207
|
+
)}
|
|
208
|
+
bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
209
|
+
isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
210
|
+
borderColor={theme.colors.primary}
|
|
211
|
+
imgRightSrc={null}
|
|
212
|
+
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
213
|
+
onClick={() => handleUpsellingPage()}
|
|
214
|
+
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
215
|
+
/>
|
|
216
|
+
</CheckoutAction>
|
|
217
|
+
)}
|
|
194
218
|
{openUpselling && (
|
|
195
219
|
<UpsellingProducts
|
|
196
220
|
handleUpsellingPage={handleUpsellingPage}
|
|
@@ -228,6 +252,7 @@ const CartUI = (props: any) => {
|
|
|
228
252
|
offsetDisabled={offsetDisabled}
|
|
229
253
|
onDeleteProduct={handleDeleteClick}
|
|
230
254
|
onEditProduct={handleEditProduct}
|
|
255
|
+
viewString='business_view'
|
|
231
256
|
/>
|
|
232
257
|
))}
|
|
233
258
|
|
|
@@ -239,7 +264,7 @@ const CartUI = (props: any) => {
|
|
|
239
264
|
{parsePrice(cart?.subtotal + getIncludedTaxes())}
|
|
240
265
|
</OText>
|
|
241
266
|
</OSTable>
|
|
242
|
-
{cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && (
|
|
267
|
+
{!hideCartDiscount && cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && (
|
|
243
268
|
<OSTable>
|
|
244
269
|
{cart?.discount_type === 1 ? (
|
|
245
270
|
<OText size={12} lineHeight={18}>
|
|
@@ -253,7 +278,7 @@ const CartUI = (props: any) => {
|
|
|
253
278
|
</OSTable>
|
|
254
279
|
)}
|
|
255
280
|
{
|
|
256
|
-
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any, i: number) => (
|
|
281
|
+
!hideCartDiscount && cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any, i: number) => (
|
|
257
282
|
<OSTable key={`${offer.id}_${i}`}>
|
|
258
283
|
<OSRow>
|
|
259
284
|
<OText size={12} lineHeight={18}>{offer.name}</OText>
|
|
@@ -274,7 +299,7 @@ const CartUI = (props: any) => {
|
|
|
274
299
|
))
|
|
275
300
|
}
|
|
276
301
|
{/* <Divider /> */}
|
|
277
|
-
{cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
|
|
302
|
+
{!hideCartDiscount && cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
|
|
278
303
|
<OSTable>
|
|
279
304
|
<OText size={12} lineHeight={18} numberOfLines={1}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
|
|
280
305
|
{cart?.business?.tax_type === 1 ? (
|
|
@@ -337,10 +362,10 @@ const CartUI = (props: any) => {
|
|
|
337
362
|
</OSTable>
|
|
338
363
|
))
|
|
339
364
|
}
|
|
340
|
-
{orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
|
|
365
|
+
{orderState?.options?.type === 1 && cart?.delivery_price > 0 && !hideDeliveryFee && (
|
|
341
366
|
<OSTable>
|
|
342
367
|
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
343
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.
|
|
368
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
|
|
344
369
|
</OSTable>
|
|
345
370
|
)}
|
|
346
371
|
{
|
|
@@ -364,7 +389,7 @@ const CartUI = (props: any) => {
|
|
|
364
389
|
</OSTable>
|
|
365
390
|
))
|
|
366
391
|
}
|
|
367
|
-
{cart?.driver_tip > 0 && (
|
|
392
|
+
{cart?.driver_tip > 0 && !hideDriverTip && (
|
|
368
393
|
<OSTable>
|
|
369
394
|
<OText size={12} lineHeight={18}>
|
|
370
395
|
{t('DRIVER_TIP', 'Driver tip')}
|
|
@@ -451,7 +476,7 @@ const CartUI = (props: any) => {
|
|
|
451
476
|
</TouchableOpacity>
|
|
452
477
|
</OSTable>
|
|
453
478
|
)}
|
|
454
|
-
{cart?.status !== 2 && (
|
|
479
|
+
{cart?.status !== 2 && !hideCartComments && (
|
|
455
480
|
<OSTable>
|
|
456
481
|
<View style={{ width: '100%', marginTop: 20 }}>
|
|
457
482
|
<OText size={16} lineHeight={18}>{t('COMMENTS', 'Comments')}</OText>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { useLanguage } from 'ordering-components/native';
|
|
3
|
+
import { useLanguage, useConfig } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { CCContainer, CCNotCarts, CCList } from './styles';
|
|
6
6
|
|
|
@@ -17,9 +17,11 @@ export const CartContent = (props: any) => {
|
|
|
17
17
|
|
|
18
18
|
const theme = useTheme();
|
|
19
19
|
const [, t] = useLanguage()
|
|
20
|
+
const [{ configs }] = useConfig()
|
|
20
21
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
21
22
|
|
|
22
23
|
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
24
|
+
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
23
25
|
|
|
24
26
|
return (
|
|
25
27
|
<CCContainer
|
|
@@ -32,6 +34,7 @@ export const CartContent = (props: any) => {
|
|
|
32
34
|
{cart.products.length > 0 && (
|
|
33
35
|
<>
|
|
34
36
|
<Cart
|
|
37
|
+
showGeneralBtn={i === 0 && isMultiCheckout}
|
|
35
38
|
singleBusiness={props.singleBusiness}
|
|
36
39
|
isFranchiseApp={props.isFranchiseApp}
|
|
37
40
|
cart={cart}
|
|
@@ -39,6 +42,7 @@ export const CartContent = (props: any) => {
|
|
|
39
42
|
onNavigationRedirect={props.onNavigationRedirect}
|
|
40
43
|
isCartsLoading={isCartsLoading}
|
|
41
44
|
setIsCartsLoading={setIsCartsLoading}
|
|
45
|
+
isMultiCheckout={isMultiCheckout}
|
|
42
46
|
hideUpselling
|
|
43
47
|
/>
|
|
44
48
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
|
|
@@ -155,6 +155,10 @@ const CheckoutUI = (props: any) => {
|
|
|
155
155
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
156
156
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
157
157
|
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
158
|
+
const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
|
|
159
|
+
const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
|
|
160
|
+
const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
|
|
161
|
+
const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
|
|
158
162
|
|
|
159
163
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
160
164
|
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
@@ -353,7 +357,7 @@ const CheckoutUI = (props: any) => {
|
|
|
353
357
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
|
|
354
358
|
</ChSection>
|
|
355
359
|
|
|
356
|
-
{!isGiftCardCart && (
|
|
360
|
+
{!isGiftCardCart && !hideBusinessDetails && (
|
|
357
361
|
<ChSection>
|
|
358
362
|
<ChBusinessDetails>
|
|
359
363
|
{
|
|
@@ -384,9 +388,11 @@ const CheckoutUI = (props: any) => {
|
|
|
384
388
|
<OText size={12} lineHeight={18} weight={'400'}>
|
|
385
389
|
{businessDetails?.business?.cellphone}
|
|
386
390
|
</OText>
|
|
387
|
-
|
|
388
|
-
{
|
|
389
|
-
|
|
391
|
+
{!hideBusinessAddress && (
|
|
392
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
393
|
+
{businessDetails?.business?.address}
|
|
394
|
+
</OText>
|
|
395
|
+
)}
|
|
390
396
|
</View>
|
|
391
397
|
</>
|
|
392
398
|
)}
|
|
@@ -402,33 +408,35 @@ const CheckoutUI = (props: any) => {
|
|
|
402
408
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
403
409
|
</ChSection>
|
|
404
410
|
)}
|
|
411
|
+
{!hideCustomerDetails && (
|
|
405
412
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
413
|
+
<ChSection>
|
|
414
|
+
<ChUserDetails>
|
|
415
|
+
{cartState.loading ? (
|
|
416
|
+
<Placeholder Animation={Fade}>
|
|
417
|
+
<PlaceholderLine height={20} />
|
|
418
|
+
<PlaceholderLine height={12} />
|
|
419
|
+
<PlaceholderLine height={12} />
|
|
420
|
+
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
421
|
+
</Placeholder>
|
|
422
|
+
) : (
|
|
423
|
+
<UserDetails
|
|
424
|
+
isUserDetailsEdit={isUserDetailsEdit}
|
|
425
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
426
|
+
cartStatus={cart?.status}
|
|
427
|
+
businessId={cart?.business_id}
|
|
428
|
+
useValidationFields
|
|
429
|
+
useDefualtSessionManager
|
|
430
|
+
useSessionUser
|
|
431
|
+
isCheckout
|
|
432
|
+
phoneUpdate={phoneUpdate}
|
|
433
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
434
|
+
/>
|
|
435
|
+
)}
|
|
436
|
+
</ChUserDetails>
|
|
437
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
438
|
+
</ChSection>
|
|
439
|
+
)}
|
|
432
440
|
|
|
433
441
|
{options?.type === 1 && !isGiftCardCart && (
|
|
434
442
|
<DeliveryOptionsContainer>
|
|
@@ -509,7 +517,7 @@ const CheckoutUI = (props: any) => {
|
|
|
509
517
|
</ChSection>
|
|
510
518
|
)}
|
|
511
519
|
|
|
512
|
-
{!isGiftCardCart && (
|
|
520
|
+
{!isGiftCardCart && !hideBusinessMap && (
|
|
513
521
|
<ChSection>
|
|
514
522
|
<ChAddress>
|
|
515
523
|
{(businessDetails?.loading || cartState.loading) ? (
|
|
@@ -13,6 +13,7 @@ import { Header, TitleHeader, Wrapper, QuickMessageContainer, ProfileMessageHead
|
|
|
13
13
|
import { MessagesParams } from '../../types'
|
|
14
14
|
import { useWindowDimensions } from 'react-native'
|
|
15
15
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
16
|
+
import { getLogisticTag } from '../../utils'
|
|
16
17
|
|
|
17
18
|
const ORDER_STATUS: any = {
|
|
18
19
|
0: 'ORDER_STATUS_PENDING',
|
|
@@ -127,7 +128,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
127
128
|
?
|
|
128
129
|
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute) ?
|
|
129
130
|
`${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
|
|
130
|
-
`${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
|
|
131
|
+
`${message.change?.attribute !== 'logistic_status' ? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)]) : message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status' ? t(ORDER_STATUS[parseInt(message.change.new, 10)]) : getLogisticTag(message.change.new)}`
|
|
131
132
|
}`
|
|
132
133
|
: message.change.new
|
|
133
134
|
?
|
|
@@ -155,9 +156,9 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
155
156
|
image: message.source,
|
|
156
157
|
system: message.type === 1,
|
|
157
158
|
user: {
|
|
158
|
-
_id: message.author.id,
|
|
159
|
-
name: message.author.name,
|
|
160
|
-
avatar: message.author.id !== user.id && type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo
|
|
159
|
+
_id: message.author && message.author.id,
|
|
160
|
+
name: message.author && message.author.name,
|
|
161
|
+
avatar: message.author && (message.author.id !== user.id && type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo)
|
|
161
162
|
}
|
|
162
163
|
});
|
|
163
164
|
}
|
|
@@ -170,9 +171,9 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
170
171
|
image: message.source,
|
|
171
172
|
system: message.type === 1,
|
|
172
173
|
user: {
|
|
173
|
-
_id: message.author.id,
|
|
174
|
-
name: message.author.name,
|
|
175
|
-
avatar: message.author.id !== user.id && type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo
|
|
174
|
+
_id: message.author && message.author.id ,
|
|
175
|
+
name: message.author && message.author.name,
|
|
176
|
+
avatar: message.author && (message.author.id !== user.id && type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo)
|
|
176
177
|
}
|
|
177
178
|
});
|
|
178
179
|
}
|
|
@@ -65,9 +65,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
65
65
|
paddingLeft: 40,
|
|
66
66
|
paddingRight: 40
|
|
67
67
|
},
|
|
68
|
-
wrapperNavbar:
|
|
69
|
-
? { paddingVertical: 0, paddingHorizontal: 40 }
|
|
70
|
-
: { paddingVertical: 20, paddingHorizontal: 40 }
|
|
68
|
+
wrapperNavbar: { paddingHorizontal: 40 }
|
|
71
69
|
})
|
|
72
70
|
|
|
73
71
|
const [, { showToast }] = useToast();
|
|
@@ -150,15 +148,12 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
150
148
|
<Container noPadding>
|
|
151
149
|
<View style={styles.wrapperNavbar}>
|
|
152
150
|
<NavBar
|
|
153
|
-
isVertical
|
|
154
151
|
title={t('CHECKOUT', 'Checkout')}
|
|
155
152
|
titleAlign={'center'}
|
|
156
153
|
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
157
154
|
showCall={false}
|
|
155
|
+
paddingTop={Platform.OS === 'ios' ? 0 : 4}
|
|
158
156
|
btnStyle={{ paddingLeft: 0 }}
|
|
159
|
-
style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
|
|
160
|
-
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
161
|
-
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
162
157
|
/>
|
|
163
158
|
</View>
|
|
164
159
|
<ChContainer style={styles.pagePadding}>
|
|
@@ -246,6 +241,8 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
246
241
|
cart={cart}
|
|
247
242
|
cartuuid={cart.uuid}
|
|
248
243
|
isMultiCheckout
|
|
244
|
+
hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
|
|
245
|
+
hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
|
|
249
246
|
onNavigationRedirect={(route: string, params: any) => props.navigation.navigate(route, params)}
|
|
250
247
|
/>
|
|
251
248
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
@@ -273,6 +270,17 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
273
270
|
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>{parsePrice(totalCartsFee)}</OText>
|
|
274
271
|
</View>
|
|
275
272
|
)}
|
|
273
|
+
{openCarts.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
274
|
+
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
275
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
276
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
277
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
278
|
+
</OText>
|
|
279
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
280
|
+
{parsePrice(openCarts.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
|
|
281
|
+
</OText>
|
|
282
|
+
</View>
|
|
283
|
+
)}
|
|
276
284
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
277
285
|
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
|
|
278
286
|
{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
|
|
@@ -30,15 +30,17 @@ export const MyOrders = (props: any) => {
|
|
|
30
30
|
|
|
31
31
|
const notOrderOptions = ['business', 'products']
|
|
32
32
|
const allEmpty = (ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) || ((isEmptyBusinesses || businessOrderIds?.length === 0) && hideOrders)
|
|
33
|
-
|
|
34
|
-
{ key: 'orders', value: t('ORDERS', 'Orders') },
|
|
35
|
-
{ key: 'business', value: t('BUSINESS', 'Business') },
|
|
36
|
-
{ key: 'products', value: t('PRODUCTS', 'Products') }
|
|
37
|
-
]
|
|
33
|
+
|
|
38
34
|
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
39
35
|
const showNavbar = theme?.bar_menu?.components?.orders?.hidden
|
|
40
36
|
const hideOrdersTheme = theme?.bar_menu?.components?.orders?.hidden
|
|
41
|
-
|
|
37
|
+
const hideProductsTab = theme?.orders?.components?.products_tab?.hidden
|
|
38
|
+
const hideBusinessTab = theme?.orders?.components?.business_tab?.hidden
|
|
39
|
+
const MyOrdersMenu = [
|
|
40
|
+
{ key: 'orders', value: t('ORDERS', 'Orders'), disabled: false },
|
|
41
|
+
{ key: 'business', value: t('BUSINESS', 'Business'), disabled: hideBusinessTab },
|
|
42
|
+
{ key: 'products', value: t('PRODUCTS', 'Products'), disabled: hideProductsTab }
|
|
43
|
+
]
|
|
42
44
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack()
|
|
43
45
|
|
|
44
46
|
const handleOnRefresh = () => {
|
|
@@ -125,7 +127,7 @@ export const MyOrders = (props: any) => {
|
|
|
125
127
|
showsHorizontalScrollIndicator={false}
|
|
126
128
|
scrollEventThrottle={16}
|
|
127
129
|
>
|
|
128
|
-
{MyOrdersMenu.filter(option => !hideOrders || option.key !== 'orders').map(option => (
|
|
130
|
+
{MyOrdersMenu.filter(option => (!hideOrders || option.key !== 'orders') && !option.disabled).map(option => (
|
|
129
131
|
<Tab
|
|
130
132
|
key={option.key}
|
|
131
133
|
onPress={() => setSelectedOption(option.key)}
|