ordering-ui-react-native 0.22.72 → 0.22.73-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 +123 -54
- 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 +219 -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 +28 -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/Original/styles.tsx +1 -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 +9 -4
- 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';
|
|
@@ -55,6 +56,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
55
56
|
navigation,
|
|
56
57
|
setCurrentFilters,
|
|
57
58
|
tabs,
|
|
59
|
+
combineTabs,
|
|
60
|
+
setCombineTabsState,
|
|
58
61
|
isNetConnected,
|
|
59
62
|
currentTabSelected,
|
|
60
63
|
setCurrentTabSelected,
|
|
@@ -73,7 +76,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
73
76
|
loadLogisticOrders,
|
|
74
77
|
isLogisticActivated,
|
|
75
78
|
handleChangeOrderStatus,
|
|
76
|
-
handleSendCustomerReview
|
|
79
|
+
handleSendCustomerReview,
|
|
80
|
+
ordersFiltered
|
|
77
81
|
} = props;
|
|
78
82
|
|
|
79
83
|
const defaultSearchList = {
|
|
@@ -104,6 +108,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
104
108
|
const [slaSettingTime, setSlaSettingTime] = useState(6000)
|
|
105
109
|
const [currentDeliveryType, setCurrentDeliveryType] = useState('Delivery')
|
|
106
110
|
const [search, setSearch] = useState(defaultSearchList)
|
|
111
|
+
const hasSearchFilters = JSON.stringify(defaultSearchList) !== JSON.stringify(search)
|
|
112
|
+
|
|
107
113
|
const deliveryStatus = [
|
|
108
114
|
{
|
|
109
115
|
key: t('OK', 'Ok'),
|
|
@@ -127,7 +133,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
127
133
|
backColor: '#E63757'
|
|
128
134
|
}
|
|
129
135
|
]
|
|
130
|
-
const combineTabs = configState?.configs?.combine_pending_and_progress_orders?.value === '1'
|
|
131
136
|
const [selectedTabStatus, setSelectedTabStatus] = useState<any>(deliveryStatus)
|
|
132
137
|
const [openedSelect, setOpenedSelect] = useState('')
|
|
133
138
|
const [lastDateConnection, setLastDateConnection] = useState(null)
|
|
@@ -257,7 +262,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
257
262
|
paddingLeft: 0,
|
|
258
263
|
paddingRight: 0,
|
|
259
264
|
marginBottom: 30,
|
|
260
|
-
marginTop: 30
|
|
265
|
+
marginTop: Platform.OS === 'ios' ? 60 : 30
|
|
261
266
|
},
|
|
262
267
|
rowStyle: {
|
|
263
268
|
display: 'flex',
|
|
@@ -287,13 +292,27 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
287
292
|
|
|
288
293
|
const tagsList = ordersGroup[currentTabSelected]?.defaultFilter ?? []
|
|
289
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
|
|
290
309
|
|
|
291
310
|
const isEqual = (array1: any, array2: any) => {
|
|
292
311
|
return array1?.every((item: any) => array2.includes(item)) && array2?.every((item: any) => array1.includes(item))
|
|
293
312
|
}
|
|
294
313
|
|
|
295
314
|
const handleLoadMore = () => {
|
|
296
|
-
loadMoreOrders && loadMoreOrders();
|
|
315
|
+
loadMoreOrders && loadMoreOrders({ allStatusses: hasSearchFilters });
|
|
297
316
|
};
|
|
298
317
|
|
|
299
318
|
const getOrderStatus = (key: number) => {
|
|
@@ -301,13 +320,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
301
320
|
};
|
|
302
321
|
|
|
303
322
|
const applyFilters = () => {
|
|
304
|
-
setOrdersGroup({
|
|
305
|
-
...ordersGroup,
|
|
306
|
-
[currentTabSelected]: {
|
|
307
|
-
...ordersGroup[currentTabSelected],
|
|
308
|
-
orders: []
|
|
309
|
-
}
|
|
310
|
-
})
|
|
311
323
|
const dateRange = calculateDate(search.date.type, search.date.from, search.date.to)
|
|
312
324
|
onFiltered && onFiltered({ ...search, date: { ...dateRange } })
|
|
313
325
|
setOpenSearchModal(false)
|
|
@@ -377,6 +389,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
377
389
|
}
|
|
378
390
|
|
|
379
391
|
const handleClose = () => {
|
|
392
|
+
setSearch(defaultSearchList)
|
|
380
393
|
setOpenSearchModal(false)
|
|
381
394
|
setOpenSLASettingModal(false)
|
|
382
395
|
}
|
|
@@ -392,12 +405,12 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
392
405
|
setTags({ values: [] })
|
|
393
406
|
}, [currentTabSelected])
|
|
394
407
|
|
|
395
|
-
|
|
396
|
-
|
|
408
|
+
useEffect(() => {
|
|
409
|
+
const unsubcribe = navigation.addListener('focus', () => {
|
|
397
410
|
currentTabSelected === 'logisticOrders' && loadLogisticOrders && loadLogisticOrders()
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
411
|
+
})
|
|
412
|
+
return unsubcribe
|
|
413
|
+
}, [navigation, loadLogisticOrders])
|
|
401
414
|
|
|
402
415
|
useEffect(() => {
|
|
403
416
|
const orderStatuses = ['active', 'pending', 'inProgress', 'completed', 'cancelled']
|
|
@@ -405,11 +418,17 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
405
418
|
const manageStoragedOrders = async () => {
|
|
406
419
|
setInternetLoading(true)
|
|
407
420
|
let lastConnection = await _retrieveStoreData('last_date_connection');
|
|
421
|
+
let _combineTabs = await _retrieveStoreData('combine_pending_and_progress_orders')
|
|
408
422
|
let ordersStoraged: any = {}
|
|
409
423
|
for (const status of orderStatuses) {
|
|
410
424
|
ordersStoraged[status] = await _retrieveStoreData(`${status}_orders`) ?? []
|
|
411
425
|
}
|
|
412
426
|
|
|
427
|
+
if (_combineTabs || !_combineTabs && combineTabs) {
|
|
428
|
+
_combineTabs && setCombineTabsState(_combineTabs)
|
|
429
|
+
_setStoreData('combine_pending_and_progress_orders', _combineTabs || combineTabs);
|
|
430
|
+
}
|
|
431
|
+
|
|
413
432
|
if (!lastConnection) {
|
|
414
433
|
const formattedDate = parseDate(new Date())
|
|
415
434
|
lastConnection = formattedDate
|
|
@@ -443,6 +462,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
443
462
|
|
|
444
463
|
if (isNetConnected) {
|
|
445
464
|
_setStoreData('last_date_connection', null);
|
|
465
|
+
_setStoreData('combine_pending_and_progress_orders', null);
|
|
446
466
|
orderStatuses.forEach((key: any) => _setStoreData(`${key}_orders`, null))
|
|
447
467
|
} else if (isNetConnected === false) {
|
|
448
468
|
manageStoragedOrders()
|
|
@@ -451,6 +471,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
451
471
|
|
|
452
472
|
return (
|
|
453
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
|
+
)}
|
|
454
490
|
<View style={styles.header}>
|
|
455
491
|
<OText style={styles.title}>{t('MY_ORDERS', 'My orders')}</OText>
|
|
456
492
|
<IconWrapper>
|
|
@@ -462,73 +498,95 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
462
498
|
name='refresh-cw'
|
|
463
499
|
color={theme.colors.backgroundDark}
|
|
464
500
|
size={24}
|
|
465
|
-
onPress={() =>
|
|
466
|
-
style={{
|
|
501
|
+
onPress={() => currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true, }, { allStatusses: hasSearchFilters })}
|
|
502
|
+
style={{
|
|
503
|
+
marginRight: 20
|
|
504
|
+
}}
|
|
467
505
|
/>
|
|
468
506
|
)}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
</View>
|
|
477
|
-
<FiltersTab>
|
|
478
|
-
<ScrollView
|
|
479
|
-
ref={scrollRefTab}
|
|
480
|
-
showsVerticalScrollIndicator={false}
|
|
481
|
-
showsHorizontalScrollIndicator={false}
|
|
482
|
-
horizontal
|
|
483
|
-
nestedScrollEnabled={true}
|
|
484
|
-
>
|
|
485
|
-
<TabsContainer>
|
|
486
|
-
{(isLogisticActivated && !isBusinessApp && !combineTabs) && (
|
|
487
|
-
<Pressable
|
|
488
|
-
style={styles.pressable}
|
|
489
|
-
onPress={() => setCurrentTabSelected('logisticOrders')}>
|
|
490
|
-
<OIcon
|
|
491
|
-
src={theme.images?.general?.chronometer}
|
|
492
|
-
borderBottomWidth={currentTabSelected === 'logisticOrders' ? 1 : 0}
|
|
493
|
-
width={currentTabSelected === 'logisticOrders' ? 26 : 24}
|
|
494
|
-
height={currentTabSelected === 'logisticOrders' ? 26 : 24}
|
|
495
|
-
color={
|
|
496
|
-
currentTabSelected === 'logisticOrders'
|
|
497
|
-
? theme.colors.textGray
|
|
498
|
-
: theme.colors.unselectText
|
|
499
|
-
}
|
|
500
|
-
style={styles.icon}
|
|
501
|
-
/>
|
|
502
|
-
</Pressable>
|
|
503
|
-
)}
|
|
504
|
-
{tabs.map((tab: any) => (
|
|
505
|
-
<TabPressable
|
|
506
|
-
key={tab.key}
|
|
507
|
-
onPress={() => setCurrentTabSelected(tab?.title)}
|
|
508
|
-
isSelected={tab.title === currentTabSelected ? 1 : 0}
|
|
509
|
-
>
|
|
510
|
-
<OText
|
|
507
|
+
{currentTabSelected !== 'logisticOrders' && (
|
|
508
|
+
<View>
|
|
509
|
+
{hasSearchFilters && (
|
|
510
|
+
<AntDesignIcon
|
|
511
|
+
name='exclamationcircle'
|
|
512
|
+
color={theme.colors.primary}
|
|
513
|
+
size={16}
|
|
511
514
|
style={{
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
+
position: 'absolute',
|
|
516
|
+
zIndex: 1000,
|
|
517
|
+
right: -8,
|
|
518
|
+
top: -5
|
|
515
519
|
}}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
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}
|
|
522
566
|
>
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
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
|
+
)}
|
|
530
588
|
<View style={{ flex: 1, minHeight: HEIGHT_SCREEN - 450 }}>
|
|
531
|
-
{showTagsList && (
|
|
589
|
+
{showTagsList && !hasSearchFilters && (
|
|
532
590
|
<View
|
|
533
591
|
style={{
|
|
534
592
|
display: 'flex',
|
|
@@ -619,16 +677,17 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
619
677
|
refreshControl={
|
|
620
678
|
<RefreshControl
|
|
621
679
|
refreshing={refreshing}
|
|
622
|
-
onRefresh={() => { isNetConnected && (currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })) }}
|
|
680
|
+
onRefresh={() => { isNetConnected && (currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }, { allStatusses: hasSearchFilters })) }}
|
|
623
681
|
/>
|
|
624
682
|
}
|
|
625
683
|
>
|
|
626
|
-
{!
|
|
627
|
-
|
|
684
|
+
{!ordersValidation?.error?.length &&
|
|
685
|
+
(ordersValidation?.orders?.length > 0 || ordersFiltered?.orders?.length > 0) &&
|
|
628
686
|
currentTabSelected !== 'logisticOrders' &&
|
|
687
|
+
!ordersValidation?.loading &&
|
|
629
688
|
(
|
|
630
689
|
<PreviousOrders
|
|
631
|
-
orders={ordersFormatted}
|
|
690
|
+
orders={hasSearchFilters ? ordersFiltered?.orders : ordersFormatted}
|
|
632
691
|
navigation={props.navigation}
|
|
633
692
|
onNavigationRedirect={onNavigationRedirect}
|
|
634
693
|
getOrderStatus={getOrderStatus}
|
|
@@ -644,7 +703,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
644
703
|
/>
|
|
645
704
|
)}
|
|
646
705
|
{!logisticOrders?.error?.length &&
|
|
647
|
-
logisticOrders?.orders?.length > 0 &&
|
|
706
|
+
logisticOrders && logisticOrders?.orders?.length > 0 &&
|
|
707
|
+
!logisticOrders?.loading &&
|
|
648
708
|
currentTabSelected === 'logisticOrders' && (
|
|
649
709
|
<PreviousOrders
|
|
650
710
|
orders={logisticOrders?.orders?.filter((order: any) => !order?.expired).map((order: any) => ({ ...order, isLogistic: true }))}
|
|
@@ -657,51 +717,39 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
657
717
|
)
|
|
658
718
|
}
|
|
659
719
|
{(
|
|
660
|
-
|
|
661
|
-
(
|
|
662
|
-
currentOrdersGroup?.loading ||
|
|
663
|
-
(currentOrdersGroup?.pagination?.total === null && isNetConnected) ||
|
|
664
|
-
logisticOrders?.loading
|
|
665
|
-
) &&
|
|
666
|
-
!currentOrdersGroup?.error?.length &&
|
|
667
|
-
!currentOrdersGroup?.orders?.length
|
|
668
|
-
) || internetLoading
|
|
720
|
+
loadingValidation || internetLoading
|
|
669
721
|
) && (
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
style={{
|
|
675
|
-
width: '100%',
|
|
676
|
-
flexDirection: 'row',
|
|
677
|
-
marginBottom: 10,
|
|
678
|
-
}}>
|
|
679
|
-
<PlaceholderLine
|
|
680
|
-
width={IS_PORTRAIT ? 22 : 11}
|
|
681
|
-
height={74}
|
|
722
|
+
<View style={{ marginTop: 10 }}>
|
|
723
|
+
{[...Array(5)].map((_, i) => (
|
|
724
|
+
<Placeholder key={i} Animation={Fade}>
|
|
725
|
+
<View
|
|
682
726
|
style={{
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
}}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
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
|
+
)}
|
|
698
750
|
|
|
699
751
|
{isNetConnected &&
|
|
700
|
-
|
|
701
|
-
!currentOrdersGroup?.loading &&
|
|
702
|
-
currentOrdersGroup?.pagination?.totalPages &&
|
|
703
|
-
currentOrdersGroup?.pagination?.currentPage < currentOrdersGroup?.pagination?.totalPages &&
|
|
704
|
-
currentOrdersGroup?.orders?.length > 0 &&
|
|
752
|
+
paginationValidation &&
|
|
705
753
|
(
|
|
706
754
|
<OButton
|
|
707
755
|
onClick={handleLoadMore}
|
|
@@ -715,23 +763,23 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
715
763
|
)}
|
|
716
764
|
|
|
717
765
|
{!internetLoading &&
|
|
718
|
-
((!
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
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
|
+
) &&
|
|
724
772
|
(
|
|
725
773
|
<NotFoundSource
|
|
726
774
|
content={
|
|
727
775
|
!isNetConnected ? t('NETWORK_ERROR', 'Network Error') :
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
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')
|
|
735
783
|
}
|
|
736
784
|
image={theme.images.general.notFound}
|
|
737
785
|
conditioned={false}
|
|
@@ -742,9 +790,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
742
790
|
</ScrollView>
|
|
743
791
|
</View>
|
|
744
792
|
|
|
745
|
-
{isBusinessApp
|
|
746
|
-
<NewOrderNotification isBusinessApp={isBusinessApp} />
|
|
747
|
-
)}
|
|
793
|
+
<NewOrderNotification isBusinessApp={isBusinessApp} />
|
|
748
794
|
|
|
749
795
|
{(openSearchModal || openSLASettingModal) && (
|
|
750
796
|
<OModal open={openSearchModal || openSLASettingModal} entireModal customClose>
|
|
@@ -1020,12 +1066,29 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1020
1066
|
const [, t] = useLanguage();
|
|
1021
1067
|
const [configState] = useConfig()
|
|
1022
1068
|
const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
|
|
1023
|
-
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
|
+
|
|
1024
1086
|
const ordersProps = {
|
|
1025
1087
|
...props,
|
|
1026
1088
|
UIComponent: OrdersOptionUI,
|
|
1027
1089
|
useDefualtSessionManager: true,
|
|
1028
1090
|
asDashboard: true,
|
|
1091
|
+
combineTabs,
|
|
1029
1092
|
isIos: Platform.OS === 'ios',
|
|
1030
1093
|
orderStatus: [
|
|
1031
1094
|
{ key: 0, text: t('PENDING', 'Pending') },
|
|
@@ -1105,13 +1168,25 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1105
1168
|
{
|
|
1106
1169
|
key: 23,
|
|
1107
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')
|
|
1108
1183
|
}
|
|
1109
1184
|
],
|
|
1110
1185
|
tabs: combineTabs ? [
|
|
1111
1186
|
{
|
|
1112
1187
|
key: 0,
|
|
1113
1188
|
text: t('ACTIVE', 'Active'),
|
|
1114
|
-
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],
|
|
1115
1190
|
title: 'active',
|
|
1116
1191
|
},
|
|
1117
1192
|
{
|
|
@@ -1137,7 +1212,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1137
1212
|
{
|
|
1138
1213
|
key: 1,
|
|
1139
1214
|
text: t('IN_PROGRESS', 'In Progress'),
|
|
1140
|
-
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],
|
|
1141
1216
|
title: 'inProgress',
|
|
1142
1217
|
},
|
|
1143
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>
|