ordering-ui-react-native 0.22.75 → 0.22.76-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -7
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +40 -39
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/context/OfflineActions/index.tsx +236 -0
- package/src/providers/AlertProvider.tsx +3 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +5 -3
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/BusinessController/index.tsx +8 -3
- package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
- package/themes/business/src/components/Chat/index.tsx +15 -3
- package/themes/business/src/components/DriverMap/index.tsx +44 -33
- package/themes/business/src/components/FloatingButton/index.tsx +3 -2
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -1
- package/themes/business/src/components/LoginForm/index.tsx +123 -98
- package/themes/business/src/components/LogoutButton/index.tsx +13 -4
- package/themes/business/src/components/MapView/RenderMarker.tsx +146 -0
- package/themes/business/src/components/MapView/index.tsx +68 -142
- package/themes/business/src/components/NewOrderNotification/index.tsx +38 -54
- package/themes/business/src/components/OrderDetails/Business.tsx +56 -20
- package/themes/business/src/components/OrderDetails/Delivery.tsx +111 -42
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +146 -36
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +51 -28
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/OrderSummary/index.tsx +271 -176
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +207 -144
- package/themes/business/src/components/OrdersOption/styles.tsx +14 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +20 -8
- package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
- package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
- package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +143 -75
- package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +1 -1
- package/themes/business/src/components/ProductItemAccordion/index.tsx +15 -16
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +48 -10
- package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/config/currency.tsx +1010 -0
- package/themes/business/src/hooks/useLocation.tsx +16 -12
- package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
- package/themes/business/src/types/index.tsx +26 -4
- package/themes/business/src/utils/index.tsx +26 -2
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +9 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +121 -57
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +223 -219
- package/themes/original/src/components/AddressForm/index.tsx +56 -17
- package/themes/original/src/components/AppleLogin/index.tsx +3 -4
- package/themes/original/src/components/BusinessController/index.tsx +4 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +102 -90
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +7 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +8 -13
- package/themes/original/src/components/BusinessPreorder/index.tsx +30 -17
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +72 -69
- package/themes/original/src/components/BusinessProductsList/index.tsx +4 -5
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +5 -4
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +1 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -1
- package/themes/original/src/components/Cart/index.tsx +43 -12
- package/themes/original/src/components/Checkout/index.tsx +126 -98
- package/themes/original/src/components/FloatingButton/index.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +2 -1
- package/themes/original/src/components/GoogleMap/index.tsx +3 -2
- package/themes/original/src/components/Help/functions.tsx +76 -0
- package/themes/original/src/components/Help/index.tsx +74 -29
- package/themes/original/src/components/Help/styles.tsx +4 -1
- package/themes/original/src/components/HelpOptions/index.tsx +53 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +36 -11
- package/themes/original/src/components/LastOrder/index.tsx +1 -1
- package/themes/original/src/components/LoginForm/index.tsx +11 -5
- package/themes/original/src/components/MessageListing/index.tsx +1 -1
- package/themes/original/src/components/Messages/index.tsx +562 -555
- package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
- package/themes/original/src/components/MomentOption/index.tsx +141 -61
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/MomentSelector/index.tsx +5 -2
- package/themes/original/src/components/MultiCheckout/index.tsx +78 -33
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +2 -2
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
- package/themes/original/src/components/NavBar/index.tsx +6 -2
- package/themes/original/src/components/NotFoundSource/index.tsx +40 -39
- package/themes/original/src/components/NotFoundSource/styles.tsx +18 -9
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +11 -4
- package/themes/original/src/components/OrderDetails/index.tsx +44 -20
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +5 -4
- package/themes/original/src/components/OrderSummary/index.tsx +32 -11
- package/themes/original/src/components/OrderTypeSelector/index.tsx +120 -120
- package/themes/original/src/components/OrdersOption/index.tsx +325 -325
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -0
- package/themes/original/src/components/PaymentOptions/index.tsx +471 -459
- package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +28 -37
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +15 -14
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/SignupForm/index.tsx +40 -24
- package/themes/original/src/components/SingleOrderCard/index.tsx +8 -5
- package/themes/original/src/components/SingleProductCard/index.tsx +2 -1
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +7 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +2 -2
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +7 -2
- package/themes/original/src/components/UserDetails/index.tsx +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +109 -67
- package/themes/original/src/components/UserVerification/index.tsx +18 -5
- package/themes/original/src/components/VerifyPhone/index.tsx +1 -1
- package/themes/original/src/components/shared/OInput.tsx +97 -97
- package/themes/original/src/components/shared/OModal.tsx +7 -2
- package/themes/original/src/providers/AlertProvider.tsx +1 -1
- package/themes/original/src/types/index.tsx +700 -695
- package/themes/original/src/utils/index.tsx +50 -34
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -62
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +0 -12
- package/themes/original/src/components/HelpGuide/index.tsx +0 -68
- package/themes/original/src/components/HelpGuide/styles.tsx +0 -12
- package/themes/original/src/components/HelpOrder/index.tsx +0 -71
- package/themes/original/src/components/HelpOrder/styles.tsx +0 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform, TouchableOpacity } from 'react-native';
|
|
3
|
-
import { useLanguage, useUtils,
|
|
3
|
+
import { useLanguage, useUtils, OrderListGroups, useConfig } from 'ordering-components/native';
|
|
4
4
|
import SelectDropdown from 'react-native-select-dropdown'
|
|
5
5
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
6
6
|
import FeatherIcon from 'react-native-vector-icons/Feather';
|
|
@@ -37,7 +37,8 @@ import {
|
|
|
37
37
|
ItemContent,
|
|
38
38
|
TimerInputWrapper,
|
|
39
39
|
OverLine,
|
|
40
|
-
InputContainer
|
|
40
|
+
InputContainer,
|
|
41
|
+
FilterAlert
|
|
41
42
|
} from './styles';
|
|
42
43
|
import { PreviousOrders } from '../PreviousOrders';
|
|
43
44
|
import { OrdersOptionParams } from '../../types';
|
|
@@ -75,7 +76,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
75
76
|
loadLogisticOrders,
|
|
76
77
|
isLogisticActivated,
|
|
77
78
|
handleChangeOrderStatus,
|
|
78
|
-
handleSendCustomerReview
|
|
79
|
+
handleSendCustomerReview,
|
|
80
|
+
ordersFiltered
|
|
79
81
|
} = props;
|
|
80
82
|
|
|
81
83
|
const defaultSearchList = {
|
|
@@ -106,6 +108,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
106
108
|
const [slaSettingTime, setSlaSettingTime] = useState(6000)
|
|
107
109
|
const [currentDeliveryType, setCurrentDeliveryType] = useState('Delivery')
|
|
108
110
|
const [search, setSearch] = useState(defaultSearchList)
|
|
111
|
+
const hasSearchFilters = JSON.stringify(defaultSearchList) !== JSON.stringify(search)
|
|
112
|
+
|
|
109
113
|
const deliveryStatus = [
|
|
110
114
|
{
|
|
111
115
|
key: t('OK', 'Ok'),
|
|
@@ -258,7 +262,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
258
262
|
paddingLeft: 0,
|
|
259
263
|
paddingRight: 0,
|
|
260
264
|
marginBottom: 30,
|
|
261
|
-
marginTop: 30
|
|
265
|
+
marginTop: Platform.OS === 'ios' ? 60 : 30
|
|
262
266
|
},
|
|
263
267
|
rowStyle: {
|
|
264
268
|
display: 'flex',
|
|
@@ -288,13 +292,27 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
288
292
|
|
|
289
293
|
const tagsList = ordersGroup[currentTabSelected]?.defaultFilter ?? []
|
|
290
294
|
const currentOrdersGroup = ordersGroup[currentTabSelected]
|
|
295
|
+
const ordersValidation = hasSearchFilters ? ordersFiltered : currentOrdersGroup
|
|
296
|
+
|
|
297
|
+
const paginationValidation =
|
|
298
|
+
!ordersValidation?.error?.length &&
|
|
299
|
+
!ordersValidation?.loading &&
|
|
300
|
+
ordersValidation?.pagination?.totalPages &&
|
|
301
|
+
ordersValidation?.pagination?.currentPage < ordersValidation?.pagination?.totalPages &&
|
|
302
|
+
ordersValidation?.orders?.length > 0
|
|
303
|
+
|
|
304
|
+
const loadingValidation = (
|
|
305
|
+
ordersValidation?.loading ||
|
|
306
|
+
(ordersValidation?.pagination?.total === null && isNetConnected) ||
|
|
307
|
+
logisticOrders?.loading
|
|
308
|
+
) && !ordersValidation?.error?.length
|
|
291
309
|
|
|
292
310
|
const isEqual = (array1: any, array2: any) => {
|
|
293
311
|
return array1?.every((item: any) => array2.includes(item)) && array2?.every((item: any) => array1.includes(item))
|
|
294
312
|
}
|
|
295
313
|
|
|
296
314
|
const handleLoadMore = () => {
|
|
297
|
-
loadMoreOrders && loadMoreOrders();
|
|
315
|
+
loadMoreOrders && loadMoreOrders({ allStatusses: hasSearchFilters });
|
|
298
316
|
};
|
|
299
317
|
|
|
300
318
|
const getOrderStatus = (key: number) => {
|
|
@@ -302,13 +320,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
302
320
|
};
|
|
303
321
|
|
|
304
322
|
const applyFilters = () => {
|
|
305
|
-
setOrdersGroup({
|
|
306
|
-
...ordersGroup,
|
|
307
|
-
[currentTabSelected]: {
|
|
308
|
-
...ordersGroup[currentTabSelected],
|
|
309
|
-
orders: []
|
|
310
|
-
}
|
|
311
|
-
})
|
|
312
323
|
const dateRange = calculateDate(search.date.type, search.date.from, search.date.to)
|
|
313
324
|
onFiltered && onFiltered({ ...search, date: { ...dateRange } })
|
|
314
325
|
setOpenSearchModal(false)
|
|
@@ -378,6 +389,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
378
389
|
}
|
|
379
390
|
|
|
380
391
|
const handleClose = () => {
|
|
392
|
+
setSearch(defaultSearchList)
|
|
381
393
|
setOpenSearchModal(false)
|
|
382
394
|
setOpenSLASettingModal(false)
|
|
383
395
|
}
|
|
@@ -393,12 +405,12 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
393
405
|
setTags({ values: [] })
|
|
394
406
|
}, [currentTabSelected])
|
|
395
407
|
|
|
396
|
-
|
|
397
|
-
|
|
408
|
+
useEffect(() => {
|
|
409
|
+
const unsubcribe = navigation.addListener('focus', () => {
|
|
398
410
|
currentTabSelected === 'logisticOrders' && loadLogisticOrders && loadLogisticOrders()
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
411
|
+
})
|
|
412
|
+
return unsubcribe
|
|
413
|
+
}, [navigation, loadLogisticOrders])
|
|
402
414
|
|
|
403
415
|
useEffect(() => {
|
|
404
416
|
const orderStatuses = ['active', 'pending', 'inProgress', 'completed', 'cancelled']
|
|
@@ -459,6 +471,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
459
471
|
|
|
460
472
|
return (
|
|
461
473
|
<>
|
|
474
|
+
{hasSearchFilters && (
|
|
475
|
+
<FilterAlert>
|
|
476
|
+
<AntDesignIcon
|
|
477
|
+
name='warning'
|
|
478
|
+
color='#FFC700'
|
|
479
|
+
size={12}
|
|
480
|
+
onPress={() => setOpenSearchModal(true)}
|
|
481
|
+
/>
|
|
482
|
+
<OText size={10} mLeft={5} mRight={5}>
|
|
483
|
+
{t('WARNING_FILTER_APPLIED', 'Filters applied. You may miss new orders.')}
|
|
484
|
+
</OText>
|
|
485
|
+
<Pressable onPress={() => handleClearFilters()}>
|
|
486
|
+
<OText textDecorationLine='underline' size={10} color='rgb(44, 123, 229)'>{t('CLEAR_FILTERS', 'Clear filters')}</OText>
|
|
487
|
+
</Pressable>
|
|
488
|
+
</FilterAlert>
|
|
489
|
+
)}
|
|
462
490
|
<View style={styles.header}>
|
|
463
491
|
<OText style={styles.title}>{t('MY_ORDERS', 'My orders')}</OText>
|
|
464
492
|
<IconWrapper>
|
|
@@ -470,73 +498,95 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
470
498
|
name='refresh-cw'
|
|
471
499
|
color={theme.colors.backgroundDark}
|
|
472
500
|
size={24}
|
|
473
|
-
onPress={() =>
|
|
474
|
-
style={{
|
|
501
|
+
onPress={() => currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true, }, { allStatusses: hasSearchFilters })}
|
|
502
|
+
style={{
|
|
503
|
+
marginRight: 20
|
|
504
|
+
}}
|
|
475
505
|
/>
|
|
476
506
|
)}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
</View>
|
|
485
|
-
<FiltersTab>
|
|
486
|
-
<ScrollView
|
|
487
|
-
ref={scrollRefTab}
|
|
488
|
-
showsVerticalScrollIndicator={false}
|
|
489
|
-
showsHorizontalScrollIndicator={false}
|
|
490
|
-
horizontal
|
|
491
|
-
nestedScrollEnabled={true}
|
|
492
|
-
>
|
|
493
|
-
<TabsContainer>
|
|
494
|
-
{(isLogisticActivated && !isBusinessApp && !combineTabs) && (
|
|
495
|
-
<Pressable
|
|
496
|
-
style={styles.pressable}
|
|
497
|
-
onPress={() => setCurrentTabSelected('logisticOrders')}>
|
|
498
|
-
<OIcon
|
|
499
|
-
src={theme.images?.general?.chronometer}
|
|
500
|
-
borderBottomWidth={currentTabSelected === 'logisticOrders' ? 1 : 0}
|
|
501
|
-
width={currentTabSelected === 'logisticOrders' ? 26 : 24}
|
|
502
|
-
height={currentTabSelected === 'logisticOrders' ? 26 : 24}
|
|
503
|
-
color={
|
|
504
|
-
currentTabSelected === 'logisticOrders'
|
|
505
|
-
? theme.colors.textGray
|
|
506
|
-
: theme.colors.unselectText
|
|
507
|
-
}
|
|
508
|
-
style={styles.icon}
|
|
509
|
-
/>
|
|
510
|
-
</Pressable>
|
|
511
|
-
)}
|
|
512
|
-
{tabs.map((tab: any) => (
|
|
513
|
-
<TabPressable
|
|
514
|
-
key={tab.key}
|
|
515
|
-
onPress={() => setCurrentTabSelected(tab?.title)}
|
|
516
|
-
isSelected={tab.title === currentTabSelected ? 1 : 0}
|
|
517
|
-
>
|
|
518
|
-
<OText
|
|
507
|
+
{currentTabSelected !== 'logisticOrders' && (
|
|
508
|
+
<View>
|
|
509
|
+
{hasSearchFilters && (
|
|
510
|
+
<AntDesignIcon
|
|
511
|
+
name='exclamationcircle'
|
|
512
|
+
color={theme.colors.primary}
|
|
513
|
+
size={16}
|
|
519
514
|
style={{
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
515
|
+
position: 'absolute',
|
|
516
|
+
zIndex: 1000,
|
|
517
|
+
right: -8,
|
|
518
|
+
top: -5
|
|
523
519
|
}}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
520
|
+
onPress={() => setOpenSearchModal(true)}
|
|
521
|
+
/>
|
|
522
|
+
)}
|
|
523
|
+
<FontistoIcon
|
|
524
|
+
name='filter'
|
|
525
|
+
color={theme.colors.backgroundDark}
|
|
526
|
+
size={24}
|
|
527
|
+
onPress={() => setOpenSearchModal(true)}
|
|
528
|
+
/>
|
|
529
|
+
</View>
|
|
530
|
+
)}
|
|
531
|
+
</IconWrapper>
|
|
532
|
+
</View>
|
|
533
|
+
{!hasSearchFilters && (
|
|
534
|
+
<FiltersTab>
|
|
535
|
+
<ScrollView
|
|
536
|
+
ref={scrollRefTab}
|
|
537
|
+
showsVerticalScrollIndicator={false}
|
|
538
|
+
showsHorizontalScrollIndicator={false}
|
|
539
|
+
horizontal
|
|
540
|
+
nestedScrollEnabled={true}
|
|
541
|
+
>
|
|
542
|
+
<TabsContainer>
|
|
543
|
+
{(isLogisticActivated && !isBusinessApp && !combineTabs) && (
|
|
544
|
+
<Pressable
|
|
545
|
+
style={styles.pressable}
|
|
546
|
+
onPress={() => setCurrentTabSelected('logisticOrders')}>
|
|
547
|
+
<OIcon
|
|
548
|
+
src={theme.images?.general?.chronometer}
|
|
549
|
+
borderBottomWidth={currentTabSelected === 'logisticOrders' ? 1 : 0}
|
|
550
|
+
width={currentTabSelected === 'logisticOrders' ? 26 : 24}
|
|
551
|
+
height={currentTabSelected === 'logisticOrders' ? 26 : 24}
|
|
552
|
+
color={
|
|
553
|
+
currentTabSelected === 'logisticOrders'
|
|
554
|
+
? theme.colors.textGray
|
|
555
|
+
: theme.colors.unselectText
|
|
556
|
+
}
|
|
557
|
+
style={styles.icon}
|
|
558
|
+
/>
|
|
559
|
+
</Pressable>
|
|
560
|
+
)}
|
|
561
|
+
{!hasSearchFilters && tabs.map((tab: any) => (
|
|
562
|
+
<TabPressable
|
|
563
|
+
key={tab.key}
|
|
564
|
+
onPress={() => setCurrentTabSelected(tab?.title)}
|
|
565
|
+
isSelected={tab.title === currentTabSelected ? 1 : 0}
|
|
530
566
|
>
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
567
|
+
<OText
|
|
568
|
+
style={{
|
|
569
|
+
...styles.tab,
|
|
570
|
+
fontSize: tab.title === currentTabSelected ? 16 : 14,
|
|
571
|
+
borderBottomWidth: Platform.OS === 'ios' && tab.title === currentTabSelected ? 1 : 0,
|
|
572
|
+
}}
|
|
573
|
+
color={
|
|
574
|
+
tab.title === currentTabSelected
|
|
575
|
+
? theme.colors.textGray
|
|
576
|
+
: theme.colors.unselectText
|
|
577
|
+
}
|
|
578
|
+
weight={tab.title === currentTabSelected ? '600' : 'normal'}
|
|
579
|
+
>
|
|
580
|
+
{tab.text}
|
|
581
|
+
</OText>
|
|
582
|
+
</TabPressable>
|
|
583
|
+
))}
|
|
584
|
+
</TabsContainer>
|
|
585
|
+
</ScrollView>
|
|
586
|
+
</FiltersTab>
|
|
587
|
+
)}
|
|
538
588
|
<View style={{ flex: 1, minHeight: HEIGHT_SCREEN - 450 }}>
|
|
539
|
-
{showTagsList && (
|
|
589
|
+
{showTagsList && !hasSearchFilters && (
|
|
540
590
|
<View
|
|
541
591
|
style={{
|
|
542
592
|
display: 'flex',
|
|
@@ -627,16 +677,17 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
627
677
|
refreshControl={
|
|
628
678
|
<RefreshControl
|
|
629
679
|
refreshing={refreshing}
|
|
630
|
-
onRefresh={() => { isNetConnected && (currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })) }}
|
|
680
|
+
onRefresh={() => { isNetConnected && (currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }, { allStatusses: hasSearchFilters })) }}
|
|
631
681
|
/>
|
|
632
682
|
}
|
|
633
683
|
>
|
|
634
|
-
{!
|
|
635
|
-
|
|
684
|
+
{!ordersValidation?.error?.length &&
|
|
685
|
+
(ordersValidation?.orders?.length > 0 || ordersFiltered?.orders?.length > 0) &&
|
|
636
686
|
currentTabSelected !== 'logisticOrders' &&
|
|
687
|
+
!ordersValidation?.loading &&
|
|
637
688
|
(
|
|
638
689
|
<PreviousOrders
|
|
639
|
-
orders={ordersFormatted}
|
|
690
|
+
orders={hasSearchFilters ? ordersFiltered?.orders : ordersFormatted}
|
|
640
691
|
navigation={props.navigation}
|
|
641
692
|
onNavigationRedirect={onNavigationRedirect}
|
|
642
693
|
getOrderStatus={getOrderStatus}
|
|
@@ -652,7 +703,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
652
703
|
/>
|
|
653
704
|
)}
|
|
654
705
|
{!logisticOrders?.error?.length &&
|
|
655
|
-
logisticOrders?.orders?.length > 0 &&
|
|
706
|
+
logisticOrders && logisticOrders?.orders?.length > 0 &&
|
|
707
|
+
!logisticOrders?.loading &&
|
|
656
708
|
currentTabSelected === 'logisticOrders' && (
|
|
657
709
|
<PreviousOrders
|
|
658
710
|
orders={logisticOrders?.orders?.filter((order: any) => !order?.expired).map((order: any) => ({ ...order, isLogistic: true }))}
|
|
@@ -665,51 +717,39 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
665
717
|
)
|
|
666
718
|
}
|
|
667
719
|
{(
|
|
668
|
-
|
|
669
|
-
(
|
|
670
|
-
currentOrdersGroup?.loading ||
|
|
671
|
-
(currentOrdersGroup?.pagination?.total === null && isNetConnected) ||
|
|
672
|
-
logisticOrders?.loading
|
|
673
|
-
) &&
|
|
674
|
-
!currentOrdersGroup?.error?.length &&
|
|
675
|
-
!currentOrdersGroup?.orders?.length
|
|
676
|
-
) || internetLoading
|
|
720
|
+
loadingValidation || internetLoading
|
|
677
721
|
) && (
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
style={{
|
|
683
|
-
width: '100%',
|
|
684
|
-
flexDirection: 'row',
|
|
685
|
-
marginBottom: 10,
|
|
686
|
-
}}>
|
|
687
|
-
<PlaceholderLine
|
|
688
|
-
width={IS_PORTRAIT ? 22 : 11}
|
|
689
|
-
height={74}
|
|
722
|
+
<View style={{ marginTop: 10 }}>
|
|
723
|
+
{[...Array(5)].map((_, i) => (
|
|
724
|
+
<Placeholder key={i} Animation={Fade}>
|
|
725
|
+
<View
|
|
690
726
|
style={{
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
}}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
727
|
+
width: '100%',
|
|
728
|
+
flexDirection: 'row',
|
|
729
|
+
marginBottom: 10,
|
|
730
|
+
}}>
|
|
731
|
+
<PlaceholderLine
|
|
732
|
+
width={IS_PORTRAIT ? 22 : 11}
|
|
733
|
+
height={74}
|
|
734
|
+
style={{
|
|
735
|
+
marginRight: 20,
|
|
736
|
+
marginBottom: 20,
|
|
737
|
+
borderRadius: 7.6,
|
|
738
|
+
}}
|
|
739
|
+
/>
|
|
740
|
+
<Placeholder>
|
|
741
|
+
<PlaceholderLine width={30} style={{ marginTop: 5 }} />
|
|
742
|
+
<PlaceholderLine width={50} />
|
|
743
|
+
<PlaceholderLine width={20} />
|
|
744
|
+
</Placeholder>
|
|
745
|
+
</View>
|
|
746
|
+
</Placeholder>
|
|
747
|
+
))}
|
|
748
|
+
</View>
|
|
749
|
+
)}
|
|
706
750
|
|
|
707
751
|
{isNetConnected &&
|
|
708
|
-
|
|
709
|
-
!currentOrdersGroup?.loading &&
|
|
710
|
-
currentOrdersGroup?.pagination?.totalPages &&
|
|
711
|
-
currentOrdersGroup?.pagination?.currentPage < currentOrdersGroup?.pagination?.totalPages &&
|
|
712
|
-
currentOrdersGroup?.orders?.length > 0 &&
|
|
752
|
+
paginationValidation &&
|
|
713
753
|
(
|
|
714
754
|
<OButton
|
|
715
755
|
onClick={handleLoadMore}
|
|
@@ -723,23 +763,23 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
723
763
|
)}
|
|
724
764
|
|
|
725
765
|
{!internetLoading &&
|
|
726
|
-
((!
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
766
|
+
((!ordersValidation?.loading &&
|
|
767
|
+
(ordersValidation?.error?.length ||
|
|
768
|
+
ordersValidation?.orders?.length === 0)) ||
|
|
769
|
+
(currentTabSelected === 'logisticOrders' &&
|
|
770
|
+
(logisticOrders && !logisticOrders?.loading && (logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0 || !logisticOrders?.orders?.some(order => !order?.expired))))
|
|
771
|
+
) &&
|
|
732
772
|
(
|
|
733
773
|
<NotFoundSource
|
|
734
774
|
content={
|
|
735
775
|
!isNetConnected ? t('NETWORK_ERROR', 'Network Error') :
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
776
|
+
((currentTabSelected !== 'logisticOrders' && !ordersValidation?.error?.length) ||
|
|
777
|
+
(currentTabSelected === 'logisticOrders' && (!logisticOrders?.error?.length || (logisticOrders?.orders?.length > 0 && !logisticOrders?.orders?.some(order => !order?.expired)))))
|
|
778
|
+
? t('NO_RESULTS_FOUND', 'Sorry, no results found')
|
|
779
|
+
: ordersValidation?.error?.[0]?.message ||
|
|
780
|
+
ordersValidation?.error?.[0] ||
|
|
781
|
+
(currentTabSelected === 'logisticOrders' && logisticOrders?.error) ||
|
|
782
|
+
t('NETWORK_ERROR', 'Network Error')
|
|
743
783
|
}
|
|
744
784
|
image={theme.images.general.notFound}
|
|
745
785
|
conditioned={false}
|
|
@@ -750,9 +790,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
750
790
|
</ScrollView>
|
|
751
791
|
</View>
|
|
752
792
|
|
|
753
|
-
{isBusinessApp
|
|
754
|
-
<NewOrderNotification isBusinessApp={isBusinessApp} />
|
|
755
|
-
)}
|
|
793
|
+
<NewOrderNotification isBusinessApp={isBusinessApp} />
|
|
756
794
|
|
|
757
795
|
{(openSearchModal || openSLASettingModal) && (
|
|
758
796
|
<OModal open={openSearchModal || openSLASettingModal} entireModal customClose>
|
|
@@ -1028,9 +1066,22 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1028
1066
|
const [, t] = useLanguage();
|
|
1029
1067
|
const [configState] = useConfig()
|
|
1030
1068
|
const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
|
|
1069
|
+
const [combineTabs, setCombineTabs] = useState(null)
|
|
1031
1070
|
|
|
1032
|
-
|
|
1033
|
-
|
|
1071
|
+
useEffect(() => {
|
|
1072
|
+
const getCombineTabsStoraged = async () => {
|
|
1073
|
+
try {
|
|
1074
|
+
const storagedValue = await _retrieveStoreData('combine_pending_and_progress_orders');
|
|
1075
|
+
const _combineTabs = typeof configState?.configs?.combine_pending_and_progress_orders === 'object'
|
|
1076
|
+
? configState?.configs?.combine_pending_and_progress_orders?.value === '1'
|
|
1077
|
+
: storagedValue
|
|
1078
|
+
setCombineTabs(_combineTabs)
|
|
1079
|
+
} catch {
|
|
1080
|
+
return null
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
getCombineTabsStoraged()
|
|
1084
|
+
}, [])
|
|
1034
1085
|
|
|
1035
1086
|
const ordersProps = {
|
|
1036
1087
|
...props,
|
|
@@ -1117,13 +1168,25 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1117
1168
|
{
|
|
1118
1169
|
key: 23,
|
|
1119
1170
|
text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
key: 24,
|
|
1174
|
+
text: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order')
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
key: 25,
|
|
1178
|
+
text: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
key: 26,
|
|
1182
|
+
text: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer')
|
|
1120
1183
|
}
|
|
1121
1184
|
],
|
|
1122
1185
|
tabs: combineTabs ? [
|
|
1123
1186
|
{
|
|
1124
1187
|
key: 0,
|
|
1125
1188
|
text: t('ACTIVE', 'Active'),
|
|
1126
|
-
tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
|
|
1189
|
+
tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
|
|
1127
1190
|
title: 'active',
|
|
1128
1191
|
},
|
|
1129
1192
|
{
|
|
@@ -1149,7 +1212,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1149
1212
|
{
|
|
1150
1213
|
key: 1,
|
|
1151
1214
|
text: t('IN_PROGRESS', 'In Progress'),
|
|
1152
|
-
tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
|
|
1215
|
+
tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
|
|
1153
1216
|
title: 'inProgress',
|
|
1154
1217
|
},
|
|
1155
1218
|
{
|
|
@@ -154,3 +154,17 @@ export const Actions = styled.View`
|
|
|
154
154
|
export const InputContainer = styled.View`
|
|
155
155
|
position: relative;
|
|
156
156
|
`
|
|
157
|
+
|
|
158
|
+
export const FilterAlert = styled.View`
|
|
159
|
+
position: absolute;
|
|
160
|
+
z-index: 1000;
|
|
161
|
+
flex-direction: row;
|
|
162
|
+
top: 50px;
|
|
163
|
+
background-color: #FFF9E2;
|
|
164
|
+
flex-wrap: wrap;
|
|
165
|
+
align-items: flex-start;
|
|
166
|
+
justify-content: flex-start;
|
|
167
|
+
right: 10px;
|
|
168
|
+
padding: 5px;
|
|
169
|
+
border-radius: 10px
|
|
170
|
+
`
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { StyleSheet, TouchableOpacity, FlatList, RefreshControl } from 'react-native';
|
|
3
|
+
import FastImage from 'react-native-fast-image';
|
|
3
4
|
import { useTheme } from 'styled-components/native';
|
|
4
5
|
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
5
6
|
import { Card, Logo, Information, Header, Badge } from './styles';
|
|
@@ -201,6 +202,24 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
|
|
|
201
202
|
value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
202
203
|
slug: 'ORDER_DRIVER_ON_WAY',
|
|
203
204
|
percentage: 45
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
key: 24,
|
|
208
|
+
value: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order'),
|
|
209
|
+
slug: 'ORDER_DRIVER_WAITING_FOR_ORDER',
|
|
210
|
+
percentage: 25
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
key: 25,
|
|
214
|
+
value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company'),
|
|
215
|
+
slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
|
|
216
|
+
percentage: 25
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
key: 26,
|
|
220
|
+
value: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer'),
|
|
221
|
+
slug: 'ORDER_DRIVER_ARRIVED_CUSTOMER',
|
|
222
|
+
percentage: 80
|
|
204
223
|
}
|
|
205
224
|
];
|
|
206
225
|
|
|
@@ -284,10 +303,14 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
|
|
|
284
303
|
activeOpacity={1}>
|
|
285
304
|
<Card key={order?.id}>
|
|
286
305
|
<Logo style={styles.logo}>
|
|
287
|
-
<
|
|
288
|
-
url={optimizeImage(order?.business?.logo, 'h_300,c_limit')}
|
|
289
|
-
src={!order?.business?.logo && theme?.images?.dummies?.businessLogo}
|
|
306
|
+
<FastImage
|
|
290
307
|
style={styles.icon}
|
|
308
|
+
source={order.business?.logo?.includes('https') ? {
|
|
309
|
+
uri: order.business?.logo,
|
|
310
|
+
priority: FastImage.priority.high,
|
|
311
|
+
cache: FastImage.cacheControl.immutable
|
|
312
|
+
} : order.business?.logo ?? theme?.images?.dummies?.businessLogo}
|
|
313
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
291
314
|
/>
|
|
292
315
|
</Logo>
|
|
293
316
|
<Information>
|
|
@@ -58,9 +58,14 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
58
58
|
const styles = StyleSheet.create({
|
|
59
59
|
cardButton: {
|
|
60
60
|
flex: 1,
|
|
61
|
-
paddingVertical: (isIpad || isTablet) ? 20 :
|
|
62
|
-
marginBottom: IS_PORTRAIT ?
|
|
61
|
+
paddingVertical: (isIpad || isTablet) ? 20 : 15,
|
|
62
|
+
marginBottom: IS_PORTRAIT ? 15 : 0,
|
|
63
63
|
marginLeft: 3,
|
|
64
|
+
backgroundColor: order?.time_status === 'delayed'
|
|
65
|
+
? theme.colors.danger100
|
|
66
|
+
: order?.time_status === 'at_risk'
|
|
67
|
+
? theme.colors.warning100
|
|
68
|
+
: '#fff'
|
|
64
69
|
},
|
|
65
70
|
icon: {
|
|
66
71
|
borderRadius: 7.6,
|
|
@@ -148,17 +153,18 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
148
153
|
timeState={order?.time_status}
|
|
149
154
|
/>
|
|
150
155
|
)}
|
|
151
|
-
<Logo style={styles.logo}>
|
|
156
|
+
<Logo style={styles.logo} hasExternalAndGroup={showExternalId && order?.order_group_id}>
|
|
152
157
|
<FastImage
|
|
153
158
|
style={styles.icon}
|
|
154
159
|
source={order.business?.logo?.includes('https') ? {
|
|
155
160
|
uri: order.business?.logo,
|
|
156
|
-
priority: FastImage.priority.
|
|
161
|
+
priority: FastImage.priority.high,
|
|
162
|
+
cache: FastImage.cacheControl.immutable
|
|
157
163
|
} : order.business?.logo ?? theme?.images?.dummies?.businessLogo}
|
|
158
164
|
resizeMode={FastImage.resizeMode.cover}
|
|
159
165
|
/>
|
|
160
166
|
</Logo>
|
|
161
|
-
<Information>
|
|
167
|
+
<Information hasExternalAndGroup={showExternalId && order?.order_group_id}>
|
|
162
168
|
{!!order?.order_group_id && (
|
|
163
169
|
<OText>
|
|
164
170
|
<OText>{(t('INVOICE_GROUP_NO', 'Group No.') + order?.order_group_id)}</OText>
|
|
@@ -179,7 +185,7 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
179
185
|
</NotificationIcon>
|
|
180
186
|
)}
|
|
181
187
|
<View>
|
|
182
|
-
{
|
|
188
|
+
{showExternalId && (
|
|
183
189
|
<OText
|
|
184
190
|
style={styles.date}
|
|
185
191
|
color={theme.colors.unselectText}
|
|
@@ -206,7 +212,7 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
206
212
|
: parseDate(order?.delivery_datetime, { utc: false })}`)}
|
|
207
213
|
</OText>
|
|
208
214
|
)}
|
|
209
|
-
{((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
|
|
215
|
+
{((currentTabSelected === 'pending' || currentTabSelected === 'inProgress' || currentTabSelected === 'active') && allowColumns?.timer) && (
|
|
210
216
|
<>
|
|
211
217
|
<OText
|
|
212
218
|
style={styles.date}
|
|
@@ -240,7 +246,13 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
240
246
|
? t('EAT_IN', 'Eat in')
|
|
241
247
|
: order.delivery_type === 4
|
|
242
248
|
? t('CURBSIDE', 'Curbside')
|
|
243
|
-
:
|
|
249
|
+
: order.delivery_type === 5
|
|
250
|
+
? t('DRIVER_THRU', 'Driver thru')
|
|
251
|
+
: order.delivery_type === 7
|
|
252
|
+
? t('CATERING_DELIVERY', 'Catering delivery')
|
|
253
|
+
: order.delivery_type === 8
|
|
254
|
+
? t('CATERING_PICKUP', 'Catering pickup')
|
|
255
|
+
: t('DELIVERY', 'Delivery')}
|
|
244
256
|
{` · ${getOrderStatus(order.status)}`}
|
|
245
257
|
</OText>
|
|
246
258
|
</MyOrderOptions>
|