ordering-ui-react-native 0.22.68 → 0.22.69-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 +231 -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 +13 -10
- 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 -888
- package/themes/original/src/components/AppleLogin/index.tsx +3 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +4 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +10 -4
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
- 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 +73 -70
- package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
- 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/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/Cart/index.tsx +44 -12
- package/themes/original/src/components/CartContent/index.tsx +0 -2
- package/themes/original/src/components/Checkout/index.tsx +125 -97
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +1 -2
- package/themes/original/src/components/GPSButton/index.tsx +2 -1
- package/themes/original/src/components/GoogleMap/index.tsx +5 -4
- 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 +67 -49
- package/themes/original/src/components/MomentSelector/index.tsx +5 -2
- package/themes/original/src/components/MultiCheckout/index.tsx +78 -36
- 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 +45 -21
- 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/ProductForm/ActionButton.tsx +6 -10
- 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 +3 -4
- 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/OButton.tsx +2 -2
- 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 -693
- 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
|
-
|
|
397
|
-
currentTabSelected === 'logisticOrders' && loadLogisticOrders()
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
408
|
+
useEffect(() => {
|
|
409
|
+
const unsubcribe = navigation.addListener('focus', () => {
|
|
410
|
+
currentTabSelected === 'logisticOrders' && loadLogisticOrders && loadLogisticOrders()
|
|
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,82 +471,122 @@ 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>
|
|
457
493
|
<View style={{ marginRight: 10 }}>
|
|
458
494
|
<WebsocketStatus />
|
|
459
495
|
</View>
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
showsVerticalScrollIndicator={false}
|
|
479
|
-
showsHorizontalScrollIndicator={false}
|
|
480
|
-
horizontal
|
|
481
|
-
nestedScrollEnabled={true}
|
|
482
|
-
>
|
|
483
|
-
<TabsContainer>
|
|
484
|
-
{(isLogisticActivated && !isBusinessApp && !combineTabs) && (
|
|
485
|
-
<Pressable
|
|
486
|
-
style={styles.pressable}
|
|
487
|
-
onPress={() => setCurrentTabSelected('logisticOrders')}>
|
|
488
|
-
<OIcon
|
|
489
|
-
src={theme.images?.general?.chronometer}
|
|
490
|
-
borderBottomWidth={currentTabSelected === 'logisticOrders' ? 1 : 0}
|
|
491
|
-
width={currentTabSelected === 'logisticOrders' ? 26 : 24}
|
|
492
|
-
height={currentTabSelected === 'logisticOrders' ? 26 : 24}
|
|
493
|
-
color={
|
|
494
|
-
currentTabSelected === 'logisticOrders'
|
|
495
|
-
? theme.colors.textGray
|
|
496
|
-
: theme.colors.unselectText
|
|
497
|
-
}
|
|
498
|
-
style={styles.icon}
|
|
499
|
-
/>
|
|
500
|
-
</Pressable>
|
|
501
|
-
)}
|
|
502
|
-
{tabs.map((tab: any) => (
|
|
503
|
-
<TabPressable
|
|
504
|
-
key={tab.key}
|
|
505
|
-
onPress={() => setCurrentTabSelected(tab?.title)}
|
|
506
|
-
isSelected={tab.title === currentTabSelected ? 1 : 0}
|
|
507
|
-
>
|
|
508
|
-
<OText
|
|
496
|
+
{isNetConnected && (
|
|
497
|
+
<FeatherIcon
|
|
498
|
+
name='refresh-cw'
|
|
499
|
+
color={theme.colors.backgroundDark}
|
|
500
|
+
size={24}
|
|
501
|
+
onPress={() => currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true, }, { allStatusses: hasSearchFilters })}
|
|
502
|
+
style={{
|
|
503
|
+
marginRight: 20
|
|
504
|
+
}}
|
|
505
|
+
/>
|
|
506
|
+
)}
|
|
507
|
+
{currentTabSelected !== 'logisticOrders' && (
|
|
508
|
+
<View>
|
|
509
|
+
{hasSearchFilters && (
|
|
510
|
+
<AntDesignIcon
|
|
511
|
+
name='exclamationcircle'
|
|
512
|
+
color={theme.colors.primary}
|
|
513
|
+
size={16}
|
|
509
514
|
style={{
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
515
|
+
position: 'absolute',
|
|
516
|
+
zIndex: 1000,
|
|
517
|
+
right: -8,
|
|
518
|
+
top: -5
|
|
513
519
|
}}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
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}
|
|
520
566
|
>
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
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
|
+
)}
|
|
528
588
|
<View style={{ flex: 1, minHeight: HEIGHT_SCREEN - 450 }}>
|
|
529
|
-
{showTagsList && (
|
|
589
|
+
{showTagsList && !hasSearchFilters && (
|
|
530
590
|
<View
|
|
531
591
|
style={{
|
|
532
592
|
display: 'flex',
|
|
@@ -617,16 +677,17 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
617
677
|
refreshControl={
|
|
618
678
|
<RefreshControl
|
|
619
679
|
refreshing={refreshing}
|
|
620
|
-
onRefresh={() => { isNetConnected && (currentTabSelected === 'logisticOrders' ? loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })) }}
|
|
680
|
+
onRefresh={() => { isNetConnected && (currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }, { allStatusses: hasSearchFilters })) }}
|
|
621
681
|
/>
|
|
622
682
|
}
|
|
623
683
|
>
|
|
624
|
-
{!
|
|
625
|
-
|
|
684
|
+
{!ordersValidation?.error?.length &&
|
|
685
|
+
(ordersValidation?.orders?.length > 0 || ordersFiltered?.orders?.length > 0) &&
|
|
626
686
|
currentTabSelected !== 'logisticOrders' &&
|
|
687
|
+
!ordersValidation?.loading &&
|
|
627
688
|
(
|
|
628
689
|
<PreviousOrders
|
|
629
|
-
orders={ordersFormatted}
|
|
690
|
+
orders={hasSearchFilters ? ordersFiltered?.orders : ordersFormatted}
|
|
630
691
|
navigation={props.navigation}
|
|
631
692
|
onNavigationRedirect={onNavigationRedirect}
|
|
632
693
|
getOrderStatus={getOrderStatus}
|
|
@@ -642,7 +703,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
642
703
|
/>
|
|
643
704
|
)}
|
|
644
705
|
{!logisticOrders?.error?.length &&
|
|
645
|
-
logisticOrders?.orders?.length > 0 &&
|
|
706
|
+
logisticOrders && logisticOrders?.orders?.length > 0 &&
|
|
707
|
+
!logisticOrders?.loading &&
|
|
646
708
|
currentTabSelected === 'logisticOrders' && (
|
|
647
709
|
<PreviousOrders
|
|
648
710
|
orders={logisticOrders?.orders?.filter((order: any) => !order?.expired).map((order: any) => ({ ...order, isLogistic: true }))}
|
|
@@ -655,51 +717,39 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
655
717
|
)
|
|
656
718
|
}
|
|
657
719
|
{(
|
|
658
|
-
|
|
659
|
-
(
|
|
660
|
-
currentOrdersGroup?.loading ||
|
|
661
|
-
(currentOrdersGroup?.pagination?.total === null && isNetConnected) ||
|
|
662
|
-
logisticOrders?.loading
|
|
663
|
-
) &&
|
|
664
|
-
!currentOrdersGroup?.error?.length &&
|
|
665
|
-
!currentOrdersGroup?.orders?.length
|
|
666
|
-
) || internetLoading
|
|
720
|
+
loadingValidation || internetLoading
|
|
667
721
|
) && (
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
style={{
|
|
673
|
-
width: '100%',
|
|
674
|
-
flexDirection: 'row',
|
|
675
|
-
marginBottom: 10,
|
|
676
|
-
}}>
|
|
677
|
-
<PlaceholderLine
|
|
678
|
-
width={IS_PORTRAIT ? 22 : 11}
|
|
679
|
-
height={74}
|
|
722
|
+
<View style={{ marginTop: 10 }}>
|
|
723
|
+
{[...Array(5)].map((_, i) => (
|
|
724
|
+
<Placeholder key={i} Animation={Fade}>
|
|
725
|
+
<View
|
|
680
726
|
style={{
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
}}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
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
|
+
)}
|
|
696
750
|
|
|
697
751
|
{isNetConnected &&
|
|
698
|
-
|
|
699
|
-
!currentOrdersGroup?.loading &&
|
|
700
|
-
currentOrdersGroup?.pagination?.totalPages &&
|
|
701
|
-
currentOrdersGroup?.pagination?.currentPage < currentOrdersGroup?.pagination?.totalPages &&
|
|
702
|
-
currentOrdersGroup?.orders?.length > 0 &&
|
|
752
|
+
paginationValidation &&
|
|
703
753
|
(
|
|
704
754
|
<OButton
|
|
705
755
|
onClick={handleLoadMore}
|
|
@@ -713,23 +763,23 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
713
763
|
)}
|
|
714
764
|
|
|
715
765
|
{!internetLoading &&
|
|
716
|
-
((!
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
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
|
+
) &&
|
|
722
772
|
(
|
|
723
773
|
<NotFoundSource
|
|
724
774
|
content={
|
|
725
775
|
!isNetConnected ? t('NETWORK_ERROR', 'Network Error') :
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
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')
|
|
733
783
|
}
|
|
734
784
|
image={theme.images.general.notFound}
|
|
735
785
|
conditioned={false}
|
|
@@ -740,9 +790,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
740
790
|
</ScrollView>
|
|
741
791
|
</View>
|
|
742
792
|
|
|
743
|
-
{isBusinessApp
|
|
744
|
-
<NewOrderNotification isBusinessApp={isBusinessApp} />
|
|
745
|
-
)}
|
|
793
|
+
<NewOrderNotification isBusinessApp={isBusinessApp} />
|
|
746
794
|
|
|
747
795
|
{(openSearchModal || openSLASettingModal) && (
|
|
748
796
|
<OModal open={openSearchModal || openSLASettingModal} entireModal customClose>
|
|
@@ -1018,12 +1066,29 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1018
1066
|
const [, t] = useLanguage();
|
|
1019
1067
|
const [configState] = useConfig()
|
|
1020
1068
|
const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
|
|
1021
|
-
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
|
+
|
|
1022
1086
|
const ordersProps = {
|
|
1023
1087
|
...props,
|
|
1024
1088
|
UIComponent: OrdersOptionUI,
|
|
1025
1089
|
useDefualtSessionManager: true,
|
|
1026
1090
|
asDashboard: true,
|
|
1091
|
+
combineTabs,
|
|
1027
1092
|
isIos: Platform.OS === 'ios',
|
|
1028
1093
|
orderStatus: [
|
|
1029
1094
|
{ key: 0, text: t('PENDING', 'Pending') },
|
|
@@ -1103,13 +1168,25 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1103
1168
|
{
|
|
1104
1169
|
key: 23,
|
|
1105
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')
|
|
1106
1183
|
}
|
|
1107
1184
|
],
|
|
1108
1185
|
tabs: combineTabs ? [
|
|
1109
1186
|
{
|
|
1110
1187
|
key: 0,
|
|
1111
1188
|
text: t('ACTIVE', 'Active'),
|
|
1112
|
-
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],
|
|
1113
1190
|
title: 'active',
|
|
1114
1191
|
},
|
|
1115
1192
|
{
|
|
@@ -1135,7 +1212,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1135
1212
|
{
|
|
1136
1213
|
key: 1,
|
|
1137
1214
|
text: t('IN_PROGRESS', 'In Progress'),
|
|
1138
|
-
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],
|
|
1139
1216
|
title: 'inProgress',
|
|
1140
1217
|
},
|
|
1141
1218
|
{
|
|
@@ -1161,3 +1238,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1161
1238
|
)}
|
|
1162
1239
|
</>);
|
|
1163
1240
|
};
|
|
1241
|
+
|
|
1242
|
+
OrdersOption.defaultProps = {
|
|
1243
|
+
isNetConnected: true
|
|
1244
|
+
}
|
|
@@ -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>
|