ordering-ui-react-native 0.22.73 → 0.22.74-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 +212 -150
- 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 +28 -3
- 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 +922 -885
- 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']
|
|
@@ -412,9 +424,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
412
424
|
ordersStoraged[status] = await _retrieveStoreData(`${status}_orders`) ?? []
|
|
413
425
|
}
|
|
414
426
|
|
|
415
|
-
if (!_combineTabs && combineTabs) {
|
|
416
|
-
setCombineTabsState(
|
|
417
|
-
_setStoreData('combine_pending_and_progress_orders', combineTabs);
|
|
427
|
+
if (_combineTabs || !_combineTabs && combineTabs) {
|
|
428
|
+
_combineTabs && setCombineTabsState(_combineTabs)
|
|
429
|
+
_setStoreData('combine_pending_and_progress_orders', _combineTabs || combineTabs);
|
|
418
430
|
}
|
|
419
431
|
|
|
420
432
|
if (!lastConnection) {
|
|
@@ -457,12 +469,24 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
457
469
|
}
|
|
458
470
|
}, [isNetConnected]);
|
|
459
471
|
|
|
460
|
-
useEffect(() => {
|
|
461
|
-
setCombineTabsState(combineTabs)
|
|
462
|
-
}, [combineTabs])
|
|
463
|
-
|
|
464
472
|
return (
|
|
465
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
|
+
)}
|
|
466
490
|
<View style={styles.header}>
|
|
467
491
|
<OText style={styles.title}>{t('MY_ORDERS', 'My orders')}</OText>
|
|
468
492
|
<IconWrapper>
|
|
@@ -474,73 +498,95 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
474
498
|
name='refresh-cw'
|
|
475
499
|
color={theme.colors.backgroundDark}
|
|
476
500
|
size={24}
|
|
477
|
-
onPress={() =>
|
|
478
|
-
style={{
|
|
501
|
+
onPress={() => currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true, }, { allStatusses: hasSearchFilters })}
|
|
502
|
+
style={{
|
|
503
|
+
marginRight: 20
|
|
504
|
+
}}
|
|
479
505
|
/>
|
|
480
506
|
)}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
</View>
|
|
489
|
-
<FiltersTab>
|
|
490
|
-
<ScrollView
|
|
491
|
-
ref={scrollRefTab}
|
|
492
|
-
showsVerticalScrollIndicator={false}
|
|
493
|
-
showsHorizontalScrollIndicator={false}
|
|
494
|
-
horizontal
|
|
495
|
-
nestedScrollEnabled={true}
|
|
496
|
-
>
|
|
497
|
-
<TabsContainer>
|
|
498
|
-
{(isLogisticActivated && !isBusinessApp && !combineTabs) && (
|
|
499
|
-
<Pressable
|
|
500
|
-
style={styles.pressable}
|
|
501
|
-
onPress={() => setCurrentTabSelected('logisticOrders')}>
|
|
502
|
-
<OIcon
|
|
503
|
-
src={theme.images?.general?.chronometer}
|
|
504
|
-
borderBottomWidth={currentTabSelected === 'logisticOrders' ? 1 : 0}
|
|
505
|
-
width={currentTabSelected === 'logisticOrders' ? 26 : 24}
|
|
506
|
-
height={currentTabSelected === 'logisticOrders' ? 26 : 24}
|
|
507
|
-
color={
|
|
508
|
-
currentTabSelected === 'logisticOrders'
|
|
509
|
-
? theme.colors.textGray
|
|
510
|
-
: theme.colors.unselectText
|
|
511
|
-
}
|
|
512
|
-
style={styles.icon}
|
|
513
|
-
/>
|
|
514
|
-
</Pressable>
|
|
515
|
-
)}
|
|
516
|
-
{tabs.map((tab: any) => (
|
|
517
|
-
<TabPressable
|
|
518
|
-
key={tab.key}
|
|
519
|
-
onPress={() => setCurrentTabSelected(tab?.title)}
|
|
520
|
-
isSelected={tab.title === currentTabSelected ? 1 : 0}
|
|
521
|
-
>
|
|
522
|
-
<OText
|
|
507
|
+
{currentTabSelected !== 'logisticOrders' && (
|
|
508
|
+
<View>
|
|
509
|
+
{hasSearchFilters && (
|
|
510
|
+
<AntDesignIcon
|
|
511
|
+
name='exclamationcircle'
|
|
512
|
+
color={theme.colors.primary}
|
|
513
|
+
size={16}
|
|
523
514
|
style={{
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
515
|
+
position: 'absolute',
|
|
516
|
+
zIndex: 1000,
|
|
517
|
+
right: -8,
|
|
518
|
+
top: -5
|
|
527
519
|
}}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
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}
|
|
534
566
|
>
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
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
|
+
)}
|
|
542
588
|
<View style={{ flex: 1, minHeight: HEIGHT_SCREEN - 450 }}>
|
|
543
|
-
{showTagsList && (
|
|
589
|
+
{showTagsList && !hasSearchFilters && (
|
|
544
590
|
<View
|
|
545
591
|
style={{
|
|
546
592
|
display: 'flex',
|
|
@@ -631,16 +677,17 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
631
677
|
refreshControl={
|
|
632
678
|
<RefreshControl
|
|
633
679
|
refreshing={refreshing}
|
|
634
|
-
onRefresh={() => { isNetConnected && (currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })) }}
|
|
680
|
+
onRefresh={() => { isNetConnected && (currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }, { allStatusses: hasSearchFilters })) }}
|
|
635
681
|
/>
|
|
636
682
|
}
|
|
637
683
|
>
|
|
638
|
-
{!
|
|
639
|
-
|
|
684
|
+
{!ordersValidation?.error?.length &&
|
|
685
|
+
(ordersValidation?.orders?.length > 0 || ordersFiltered?.orders?.length > 0) &&
|
|
640
686
|
currentTabSelected !== 'logisticOrders' &&
|
|
687
|
+
!ordersValidation?.loading &&
|
|
641
688
|
(
|
|
642
689
|
<PreviousOrders
|
|
643
|
-
orders={ordersFormatted}
|
|
690
|
+
orders={hasSearchFilters ? ordersFiltered?.orders : ordersFormatted}
|
|
644
691
|
navigation={props.navigation}
|
|
645
692
|
onNavigationRedirect={onNavigationRedirect}
|
|
646
693
|
getOrderStatus={getOrderStatus}
|
|
@@ -656,7 +703,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
656
703
|
/>
|
|
657
704
|
)}
|
|
658
705
|
{!logisticOrders?.error?.length &&
|
|
659
|
-
logisticOrders?.orders?.length > 0 &&
|
|
706
|
+
logisticOrders && logisticOrders?.orders?.length > 0 &&
|
|
707
|
+
!logisticOrders?.loading &&
|
|
660
708
|
currentTabSelected === 'logisticOrders' && (
|
|
661
709
|
<PreviousOrders
|
|
662
710
|
orders={logisticOrders?.orders?.filter((order: any) => !order?.expired).map((order: any) => ({ ...order, isLogistic: true }))}
|
|
@@ -669,51 +717,39 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
669
717
|
)
|
|
670
718
|
}
|
|
671
719
|
{(
|
|
672
|
-
|
|
673
|
-
(
|
|
674
|
-
currentOrdersGroup?.loading ||
|
|
675
|
-
(currentOrdersGroup?.pagination?.total === null && isNetConnected) ||
|
|
676
|
-
logisticOrders?.loading
|
|
677
|
-
) &&
|
|
678
|
-
!currentOrdersGroup?.error?.length &&
|
|
679
|
-
!currentOrdersGroup?.orders?.length
|
|
680
|
-
) || internetLoading
|
|
720
|
+
loadingValidation || internetLoading
|
|
681
721
|
) && (
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
style={{
|
|
687
|
-
width: '100%',
|
|
688
|
-
flexDirection: 'row',
|
|
689
|
-
marginBottom: 10,
|
|
690
|
-
}}>
|
|
691
|
-
<PlaceholderLine
|
|
692
|
-
width={IS_PORTRAIT ? 22 : 11}
|
|
693
|
-
height={74}
|
|
722
|
+
<View style={{ marginTop: 10 }}>
|
|
723
|
+
{[...Array(5)].map((_, i) => (
|
|
724
|
+
<Placeholder key={i} Animation={Fade}>
|
|
725
|
+
<View
|
|
694
726
|
style={{
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
}}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
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
|
+
)}
|
|
710
750
|
|
|
711
751
|
{isNetConnected &&
|
|
712
|
-
|
|
713
|
-
!currentOrdersGroup?.loading &&
|
|
714
|
-
currentOrdersGroup?.pagination?.totalPages &&
|
|
715
|
-
currentOrdersGroup?.pagination?.currentPage < currentOrdersGroup?.pagination?.totalPages &&
|
|
716
|
-
currentOrdersGroup?.orders?.length > 0 &&
|
|
752
|
+
paginationValidation &&
|
|
717
753
|
(
|
|
718
754
|
<OButton
|
|
719
755
|
onClick={handleLoadMore}
|
|
@@ -727,23 +763,23 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
727
763
|
)}
|
|
728
764
|
|
|
729
765
|
{!internetLoading &&
|
|
730
|
-
((!
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
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
|
+
) &&
|
|
736
772
|
(
|
|
737
773
|
<NotFoundSource
|
|
738
774
|
content={
|
|
739
775
|
!isNetConnected ? t('NETWORK_ERROR', 'Network Error') :
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
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')
|
|
747
783
|
}
|
|
748
784
|
image={theme.images.general.notFound}
|
|
749
785
|
conditioned={false}
|
|
@@ -754,9 +790,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
754
790
|
</ScrollView>
|
|
755
791
|
</View>
|
|
756
792
|
|
|
757
|
-
{isBusinessApp
|
|
758
|
-
<NewOrderNotification isBusinessApp={isBusinessApp} />
|
|
759
|
-
)}
|
|
793
|
+
<NewOrderNotification isBusinessApp={isBusinessApp} />
|
|
760
794
|
|
|
761
795
|
{(openSearchModal || openSLASettingModal) && (
|
|
762
796
|
<OModal open={openSearchModal || openSLASettingModal} entireModal customClose>
|
|
@@ -1032,7 +1066,23 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1032
1066
|
const [, t] = useLanguage();
|
|
1033
1067
|
const [configState] = useConfig()
|
|
1034
1068
|
const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
|
|
1035
|
-
const combineTabs =
|
|
1069
|
+
const [combineTabs, setCombineTabs] = useState(null)
|
|
1070
|
+
|
|
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
|
+
}, [])
|
|
1085
|
+
|
|
1036
1086
|
const ordersProps = {
|
|
1037
1087
|
...props,
|
|
1038
1088
|
UIComponent: OrdersOptionUI,
|
|
@@ -1118,13 +1168,25 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1118
1168
|
{
|
|
1119
1169
|
key: 23,
|
|
1120
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')
|
|
1121
1183
|
}
|
|
1122
1184
|
],
|
|
1123
1185
|
tabs: combineTabs ? [
|
|
1124
1186
|
{
|
|
1125
1187
|
key: 0,
|
|
1126
1188
|
text: t('ACTIVE', 'Active'),
|
|
1127
|
-
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],
|
|
1128
1190
|
title: 'active',
|
|
1129
1191
|
},
|
|
1130
1192
|
{
|
|
@@ -1150,7 +1212,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1150
1212
|
{
|
|
1151
1213
|
key: 1,
|
|
1152
1214
|
text: t('IN_PROGRESS', 'In Progress'),
|
|
1153
|
-
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],
|
|
1154
1216
|
title: 'inProgress',
|
|
1155
1217
|
},
|
|
1156
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>
|