ordering-ui-react-native 0.15.29 → 0.15.32

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.
Files changed (24) hide show
  1. package/package.json +1 -1
  2. package/themes/business/index.tsx +2 -0
  3. package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
  4. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
  5. package/themes/business/src/components/OrdersListManager/index.tsx +871 -0
  6. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  7. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  8. package/themes/business/src/components/OrdersOption/index.tsx +1 -1
  9. package/themes/business/src/components/PreviousOrders/index.tsx +25 -8
  10. package/themes/original/src/components/BusinessController/index.tsx +25 -17
  11. package/themes/original/src/components/BusinessProductsList/index.tsx +1 -1
  12. package/themes/original/src/components/BusinessProductsListing/index.tsx +11 -23
  13. package/themes/original/src/components/BusinessesListing/index.tsx +16 -30
  14. package/themes/original/src/components/Checkout/index.tsx +2 -2
  15. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  16. package/themes/original/src/components/Messages/index.tsx +28 -24
  17. package/themes/original/src/components/OrderProgress/index.tsx +1 -1
  18. package/themes/original/src/components/OrdersOption/index.tsx +2 -2
  19. package/themes/original/src/components/PreviousOrders/index.tsx +1 -1
  20. package/themes/original/src/components/ProductForm/styles.tsx +2 -1
  21. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  22. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  23. package/themes/original/src/components/UserProfile/index.tsx +4 -6
  24. package/themes/original/src/types/index.tsx +9 -1
@@ -0,0 +1,871 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform } from 'react-native';
3
+ import { useLanguage, OrderListGroups, useConfig } from 'ordering-components/native';
4
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
5
+ import FontistoIcon from 'react-native-vector-icons/Fontisto'
6
+ import FeatherIcon from 'react-native-vector-icons/Feather';
7
+ import SelectDropdown from 'react-native-select-dropdown'
8
+ import { useTheme } from 'styled-components/native';
9
+
10
+ import {
11
+ FiltersTab,
12
+ TabsContainer,
13
+ Tag,
14
+ IconWrapper,
15
+ ModalContainer,
16
+ ModalTitle,
17
+ TabPressable,
18
+ OrderStatus,
19
+ SlaOption,
20
+ SearchModalContent,
21
+ SlaSettingModalContent,
22
+ DeliveryStatusWrapper,
23
+ VerticalLine,
24
+ LeftSide,
25
+ RightSide,
26
+ Sides
27
+ } from './styles';
28
+
29
+ import { OText, OButton, OModal, OIconButton, OInput, OIcon } from '../shared';
30
+ import { NotFoundSource } from '../NotFoundSource';
31
+ import { useOrderUtils, StatusBlock, Timer } from './utils'
32
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
33
+ import { NewOrderNotification } from '../NewOrderNotification';
34
+ import { PreviousOrders } from '../PreviousOrders';
35
+ import { OrdersOptionParams } from '../../types';
36
+ import { OrdersOptionCity } from '../OrdersOptionCity';
37
+ import { OrdersOptionBusiness } from '../OrdersOptionBusiness';
38
+ import { OrdersOptionDelivery } from '../OrdersOptionDelivery';
39
+ import { OrdersOptionPaymethod } from '../OrdersOptionPaymethod';
40
+ import { OrdersOptionDriver } from '../OrdersOptionDriver';
41
+ import { OrdersOptionDate } from '../OrdersOptionDate';
42
+ import { OrderDetailsBusiness } from '../OrderDetails/Business';
43
+
44
+ const { useDeviceOrientation, PORTRAIT } = DeviceOrientationMethods
45
+
46
+ const OrdersListManagerUI = (props: OrdersOptionParams) => {
47
+ const {
48
+ setCurrentFilters,
49
+ tabs,
50
+ currentTabSelected,
51
+ setCurrentTabSelected,
52
+ ordersGroup,
53
+ setOrdersGroup,
54
+ orderStatus,
55
+ loadOrders,
56
+ loadMoreOrders,
57
+ onNavigationRedirect,
58
+ onFiltered,
59
+ handleClickOrder,
60
+ isBusinessApp,
61
+ handleClickLogisticOrder,
62
+ logisticOrders,
63
+ loadLogisticOrders,
64
+ isLogisticActivated
65
+ } = props;
66
+
67
+ const theme = useTheme();
68
+ const [, t] = useLanguage();
69
+ const [{
70
+ calculateDate,
71
+ preorderTypeList,
72
+ defaultOrderTypes,
73
+ deliveryStatus,
74
+ defaultSearchList
75
+ }] = useOrderUtils()
76
+ const [orientationState] = useDeviceOrientation();
77
+ const [openSearchModal, setOpenSearchModal] = useState(false)
78
+ const [openSLASettingModal, setOpenSLASettingModal] = useState(false)
79
+ const [slaSettingTime, setSlaSettingTime] = useState(6000)
80
+ const [currentDeliveryType, setCurrentDeliveryType] = useState('Delivery')
81
+ const [search, setSearch] = useState(defaultSearchList)
82
+ const [selectedTabStatus, setSelectedTabStatus] = useState<any>([])
83
+
84
+ const HEIGHT_SCREEN = orientationState?.dimensions?.height
85
+ const IS_PORTRAIT = orientationState.orientation === PORTRAIT
86
+
87
+ const styles = StyleSheet.create({
88
+ header: {
89
+ marginBottom: isBusinessApp ? 10 : 20,
90
+ flexDirection: 'row',
91
+ justifyContent: 'space-between',
92
+ alignItems: 'center'
93
+ },
94
+ title: {
95
+ fontFamily: 'Poppins',
96
+ fontStyle: 'normal',
97
+ fontWeight: '600',
98
+ fontSize: 26,
99
+ color: theme.colors.textGray,
100
+ },
101
+ icons: {
102
+ flexDirection: 'row',
103
+ },
104
+ tab: {
105
+ fontFamily: 'Poppins',
106
+ fontStyle: 'normal',
107
+ fontSize: 14,
108
+ paddingBottom: 10,
109
+ marginBottom: -1,
110
+ zIndex: 100,
111
+ borderColor: theme.colors.textGray,
112
+ textTransform: 'capitalize'
113
+ },
114
+ icon: {
115
+ paddingBottom: 10,
116
+ zIndex: 100,
117
+ marginBottom: 5,
118
+ },
119
+ tagsContainer: {
120
+ marginBottom: 20,
121
+ height: '100%'
122
+ },
123
+ tag: {
124
+ fontFamily: 'Poppins',
125
+ fontStyle: 'normal',
126
+ fontWeight: 'normal',
127
+ fontSize: 14,
128
+ },
129
+ pressable: {
130
+ alignItems: 'center',
131
+ },
132
+ loadButton: {
133
+ borderRadius: 7.6,
134
+ height: 44,
135
+ marginRight: 10,
136
+ marginBottom: 10,
137
+ marginTop: 5,
138
+ },
139
+ loadButtonText: {
140
+ color: theme.colors.inputTextColor,
141
+ fontFamily: 'Poppins',
142
+ fontStyle: 'normal',
143
+ fontWeight: 'normal',
144
+ fontSize: 18,
145
+ },
146
+ inputStyle: {
147
+ width: '100%',
148
+ borderWidth: 1,
149
+ borderColor: '#DEE2E6',
150
+ borderRadius: 7.6,
151
+ marginBottom: 24
152
+ },
153
+ SLAwrapper: {
154
+ flexDirection: 'row',
155
+ marginBottom: 15
156
+ },
157
+ selectOption: {
158
+ alignItems: 'center',
159
+ justifyContent: 'space-between',
160
+ minHeight: 40,
161
+ width: '100%',
162
+ paddingHorizontal: 15,
163
+ backgroundColor: theme.colors.inputChat,
164
+ borderRadius: 7.6,
165
+ },
166
+ buttonTextStyle: {
167
+ textAlign: 'left',
168
+ marginHorizontal: 0,
169
+ fontSize: 16,
170
+ lineHeight: 24,
171
+ color: '#748194'
172
+ },
173
+ dropdownStyle: {
174
+ borderWidth: 1,
175
+ borderRadius: 8,
176
+ paddingTop: 5,
177
+ backgroundColor: '#fff',
178
+ borderColor: theme.colors.lightGray,
179
+ overflow: 'hidden',
180
+ minHeight: 155
181
+ },
182
+ rowStyle: {
183
+ display: 'flex',
184
+ borderBottomWidth: 0,
185
+ height: 36,
186
+ alignItems: 'center',
187
+ paddingHorizontal: 10
188
+ },
189
+ acceptButtonStyle: {
190
+ borderRadius: 7.6,
191
+ width: 130,
192
+ height: 42,
193
+ },
194
+ errorMessage: {
195
+ marginBottom: 10,
196
+ color: theme.colors.error,
197
+ }
198
+ });
199
+
200
+ const scrollRef = useRef() as React.MutableRefObject<ScrollView>;
201
+ const scrollListRef = useRef() as React.MutableRefObject<ScrollView>;
202
+ const scrollRefTab = useRef() as React.MutableRefObject<ScrollView>;
203
+
204
+ const [refreshing] = useState(false);
205
+ const [currentOrderSelected, setCurrentOrderSelected] = useState<any>(null)
206
+
207
+ const [tagsState, setTags] = useState<any>({ values: [] })
208
+
209
+ const tagsList = ordersGroup[currentTabSelected]?.defaultFilter ?? []
210
+ const currentOrdersGroup = ordersGroup[currentTabSelected]
211
+
212
+ const isEqual = (array1: any, array2: any) => {
213
+ return array1?.every((item: any) => array2.includes(item)) && array2?.every((item: any) => array1.includes(item))
214
+ }
215
+
216
+ const getOrderStatus = (key: number) => {
217
+ return orderStatus.find((status: any) => status?.key === key)?.text;
218
+ };
219
+
220
+ const applyFilters = () => {
221
+ setOrdersGroup({
222
+ ...ordersGroup,
223
+ [currentTabSelected]: {
224
+ ...ordersGroup[currentTabSelected],
225
+ orders: []
226
+ }
227
+ })
228
+ const dateRange = calculateDate(search.date.type, search.date.from, search.date.to)
229
+ onFiltered && onFiltered({ ...search, date: { ...dateRange } })
230
+ setOpenSearchModal(false)
231
+ }
232
+
233
+ const handleTagSelected = (tag: any) => {
234
+ const tags = tagsState?.values.includes(tag)
235
+ ? tagsState?.values.filter((t: any) => t !== tag)
236
+ : [...tagsState?.values, tag]
237
+
238
+ setCurrentFilters(!tags.length ? tagsList : tags)
239
+ setTags({ values: isEqual(tags, tagsList) ? [] : tags })
240
+
241
+ setOrdersGroup({
242
+ ...ordersGroup,
243
+ [currentTabSelected]: {
244
+ ...ordersGroup[currentTabSelected],
245
+ currentFilter: !tags.length ? tagsList : tags
246
+ }
247
+ })
248
+ }
249
+
250
+ const handleAllSelect = () => {
251
+ setCurrentFilters(tagsList)
252
+ setTags({ values: [] })
253
+ setOrdersGroup({
254
+ ...ordersGroup,
255
+ [currentTabSelected]: {
256
+ ...ordersGroup[currentTabSelected],
257
+ currentFilter: tagsList
258
+ }
259
+ })
260
+ }
261
+
262
+ const onClickSetting = () => {
263
+ setOpenSLASettingModal(true)
264
+ }
265
+
266
+ const handleClose = () => {
267
+ setOpenSearchModal(false)
268
+ setOpenSLASettingModal(false)
269
+ }
270
+
271
+ useEffect(() => {
272
+ setCurrentFilters(null)
273
+ onFiltered && onFiltered(null)
274
+ setSearch(defaultSearchList)
275
+ scrollRefTab.current?.scrollTo({ animated: true });
276
+ scrollListRef.current?.scrollTo({ animated: true });
277
+ scrollRef.current?.scrollTo({ y: 0, animated: true });
278
+ }, [currentTabSelected])
279
+
280
+ useEffect(() => {
281
+ setSelectedTabStatus(deliveryStatus)
282
+ }, [])
283
+
284
+ useEffect(() => {
285
+ if (currentOrdersGroup?.orders?.length > 0 && !tagsList.includes(currentOrderSelected?.status)) {
286
+ setCurrentOrderSelected(currentOrdersGroup?.orders[0])
287
+ }
288
+ }, [currentOrdersGroup?.orders, currentTabSelected])
289
+
290
+ return (
291
+ <>
292
+ <View style={styles.header}>
293
+ <OText style={styles.title}>{t('MY_ORDERS', 'My orders')}</OText>
294
+ <IconWrapper>
295
+ <FeatherIcon
296
+ name='refresh-cw'
297
+ color={theme.colors.backgroundDark}
298
+ size={24}
299
+ onPress={() => {
300
+ currentTabSelected === 'logisticOrders'
301
+ ? loadLogisticOrders && loadLogisticOrders()
302
+ : loadOrders && loadOrders({ newFetch: true })
303
+ }}
304
+ style={{ marginRight: 20 }}
305
+ />
306
+ <FontistoIcon
307
+ name='search'
308
+ color={theme.colors.backgroundDark}
309
+ size={24}
310
+ onPress={() => setOpenSearchModal(true)}
311
+ />
312
+ </IconWrapper>
313
+ </View>
314
+ <View style={styles.SLAwrapper}>
315
+ <View style={{ flex: 0.5 }}>
316
+ <OButton
317
+ text={t('SLA_SETTING', 'SLA’s Settings')}
318
+ textStyle={{ color: theme.colors.backArrow }}
319
+ imgRightSrc={null}
320
+ style={{
321
+ backgroundColor: theme.colors.inputChat,
322
+ borderRadius: 7.6,
323
+ zIndex: 10,
324
+ borderWidth: 0,
325
+ minHeight: 40
326
+ }}
327
+ onClick={onClickSetting}
328
+ />
329
+ </View>
330
+ <View style={{ width: 10, height: '100%' }} />
331
+ <View style={{ flex: 0.5, justifyContent: 'center' }}>
332
+ <SelectDropdown
333
+ defaultButtonText={t('SLA', 'SLA\'s')}
334
+ data={preorderTypeList}
335
+ onSelect={(selectedItem, index) => {
336
+ onFiltered && onFiltered({ ...search, timeStatus: selectedItem?.key })
337
+ }}
338
+ buttonTextAfterSelection={(selectedItem, index) => {
339
+ return selectedItem.name
340
+ }}
341
+ rowTextForSelection={(item, index) => {
342
+ return item.key
343
+ }}
344
+ buttonStyle={styles.selectOption}
345
+ buttonTextStyle={styles.buttonTextStyle}
346
+ renderDropdownIcon={isOpened => {
347
+ return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
348
+ }}
349
+ dropdownStyle={styles.dropdownStyle}
350
+ dropdownOverlayColor='transparent'
351
+ rowStyle={styles.rowStyle}
352
+ renderCustomizedRowChild={(item, index) => {
353
+ return (
354
+ <SlaOption>
355
+ {index !== 0 && <OrderStatus timeState={item?.key} />}
356
+ <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
357
+ </SlaOption>
358
+ );
359
+ }}
360
+ />
361
+ </View>
362
+ </View>
363
+
364
+ <Sides>
365
+ <LeftSide>
366
+ <FiltersTab>
367
+ <ScrollView
368
+ ref={scrollRefTab}
369
+ showsVerticalScrollIndicator={false}
370
+ showsHorizontalScrollIndicator={false}
371
+ horizontal
372
+ nestedScrollEnabled={true}
373
+ >
374
+ <TabsContainer>
375
+ {(isLogisticActivated && !isBusinessApp) && (
376
+ <Pressable
377
+ style={styles.pressable}
378
+ onPress={() => setCurrentTabSelected('logisticOrders')}>
379
+ <OIcon
380
+ src={theme.images?.general?.chronometer}
381
+ borderBottomWidth={currentTabSelected === 'logisticOrders' ? 1 : 0}
382
+ width={currentTabSelected === 'logisticOrders' ? 26 : 24}
383
+ height={currentTabSelected === 'logisticOrders' ? 26 : 24}
384
+ color={
385
+ currentTabSelected === 'logisticOrders'
386
+ ? theme.colors.textGray
387
+ : theme.colors.unselectText
388
+ }
389
+ style={styles.icon}
390
+ />
391
+ </Pressable>
392
+ )}
393
+ {tabs.map((tab: any) => (
394
+ <TabPressable
395
+ key={tab.key}
396
+ onPress={() => setCurrentTabSelected(tab?.title)}
397
+ isSelected={tab.title === currentTabSelected ? 1 : 0}
398
+ >
399
+ <OText
400
+ style={{
401
+ ...styles.tab,
402
+ fontSize: tab.title === currentTabSelected ? 16 : 14,
403
+ borderBottomWidth: Platform.OS === 'ios' && tab.title === currentTabSelected ? 1 : 0,
404
+ }}
405
+ color={
406
+ tab.title === currentTabSelected
407
+ ? theme.colors.textGra
408
+ : theme.colors.unselectText
409
+ }
410
+ weight={tab.title === currentTabSelected ? '600' : 'normal'}
411
+ >
412
+ {tab.text}
413
+ </OText>
414
+ </TabPressable>
415
+ ))}
416
+ </TabsContainer>
417
+ </ScrollView>
418
+ </FiltersTab>
419
+
420
+ {currentTabSelected !== 'logisticOrders' && (
421
+ <View
422
+ style={{
423
+ display: 'flex',
424
+ flexDirection: 'row',
425
+ alignContent: 'center',
426
+ alignItems: 'center',
427
+ }}
428
+ >
429
+ {tagsList && tagsList?.length > 1 && (
430
+ <View style={{ marginBottom: 20 }}>
431
+ <Tag
432
+ onPress={() => handleAllSelect()}
433
+ isSelected={
434
+ isEqual(currentOrdersGroup.currentFilter, tagsList)
435
+ ? theme.colors.primary
436
+ : theme.colors.tabBar
437
+ }>
438
+ <OText
439
+ style={styles.tag}
440
+ color={
441
+ isEqual(currentOrdersGroup.currentFilter, tagsList)
442
+ ? theme.colors.white
443
+ : theme.colors.black
444
+ }>
445
+ {t('All', 'All')}
446
+ </OText>
447
+ </Tag>
448
+ </View>
449
+ )}
450
+ <ScrollView
451
+ ref={scrollRef}
452
+ showsVerticalScrollIndicator={false}
453
+ showsHorizontalScrollIndicator={false}
454
+ contentContainerStyle={styles.tagsContainer}
455
+ horizontal
456
+ >
457
+ {tagsList && tagsList.map((key: number) => (
458
+ <Tag
459
+ key={key}
460
+ onPress={() => !currentOrdersGroup.loading && handleTagSelected(key)}
461
+ isSelected={
462
+ currentOrdersGroup.currentFilter.includes(key) &&
463
+ !isEqual(currentOrdersGroup.currentFilter, tagsList)
464
+ ? theme.colors.primary
465
+ : theme.colors.tabBar
466
+ }>
467
+ <OText
468
+ style={styles.tag}
469
+ color={
470
+ currentOrdersGroup.currentFilter.includes(key) &&
471
+ !isEqual(currentOrdersGroup.currentFilter, tagsList)
472
+ ? theme.colors.white
473
+ : theme.colors.black
474
+ }>
475
+ {getOrderStatus(key)}
476
+ {
477
+ currentOrdersGroup.currentFilter.includes(key) &&
478
+ !isEqual(currentOrdersGroup.currentFilter, tagsList) &&
479
+ ' X'
480
+ }
481
+ </OText>
482
+ </Tag>
483
+ ))}
484
+ </ScrollView>
485
+ </View>
486
+ )}
487
+
488
+ <View style={{ paddingBottom: 220 }}>
489
+ <ScrollView
490
+ ref={scrollListRef}
491
+ showsVerticalScrollIndicator={false}
492
+ nestedScrollEnabled={true}
493
+ refreshControl={
494
+ <RefreshControl
495
+ refreshing={refreshing}
496
+ onRefresh={() => {
497
+ currentTabSelected === 'logisticOrders'
498
+ ? loadLogisticOrders && loadLogisticOrders()
499
+ : loadOrders && loadOrders({ newFetch: true })
500
+ }}
501
+ />
502
+ }
503
+ >
504
+ {!currentOrdersGroup?.error?.length &&
505
+ currentOrdersGroup?.orders?.length > 0 &&
506
+ currentTabSelected !== 'logisticOrders' &&
507
+ (
508
+ <PreviousOrders
509
+ orders={currentOrdersGroup?.orders}
510
+ onNavigationRedirect={onNavigationRedirect}
511
+ getOrderStatus={getOrderStatus}
512
+ handleClickOrder={handleClickOrder}
513
+ slaSettingTime={slaSettingTime}
514
+ currentTabSelected={currentTabSelected}
515
+ handleClickEvent={setCurrentOrderSelected}
516
+ currentOrdenSelected={currentOrderSelected?.id}
517
+ />
518
+ )}
519
+ {!logisticOrders?.error?.length &&
520
+ logisticOrders && logisticOrders?.orders?.length > 0 &&
521
+ currentTabSelected === 'logisticOrders' && (
522
+ <PreviousOrders
523
+ orders={logisticOrders?.orders?.filter((order: any) => !order?.expired).map((order: any) => ({ ...order, isLogistic: true }))}
524
+ onNavigationRedirect={onNavigationRedirect}
525
+ getOrderStatus={getOrderStatus}
526
+ handleClickLogisticOrder={handleClickLogisticOrder}
527
+ isLogisticOrder
528
+ handleClickEvent={setCurrentOrderSelected}
529
+ currentOrdenSelected={currentOrderSelected?.id}
530
+ />
531
+ )
532
+ }
533
+ {((currentOrdersGroup?.loading ||
534
+ currentOrdersGroup?.pagination?.total === null) ||
535
+ (logisticOrders?.loading)) &&
536
+ (
537
+ <>
538
+ <View>
539
+ {[...Array(8)].map((_, i) => (
540
+ <Placeholder key={i} Animation={Fade}>
541
+ <View
542
+ style={{
543
+ width: '100%',
544
+ flexDirection: 'row',
545
+ marginBottom: 10,
546
+ }}>
547
+ <PlaceholderLine
548
+ width={IS_PORTRAIT ? 22 : 11}
549
+ height={74}
550
+ style={{
551
+ marginRight: 20,
552
+ marginBottom: 20,
553
+ borderRadius: 7.6,
554
+ }}
555
+ />
556
+ <Placeholder>
557
+ <PlaceholderLine width={30} style={{ marginTop: 5 }} />
558
+ <PlaceholderLine width={50} />
559
+ <PlaceholderLine width={20} />
560
+ </Placeholder>
561
+ </View>
562
+ </Placeholder>
563
+ ))}
564
+ </View>
565
+ </>
566
+ )}
567
+
568
+ {!currentOrdersGroup?.error?.length &&
569
+ !currentOrdersGroup?.loading &&
570
+ currentOrdersGroup?.pagination?.totalPages &&
571
+ currentOrdersGroup?.pagination?.currentPage < currentOrdersGroup?.pagination?.totalPages &&
572
+ currentOrdersGroup?.orders?.length > 0 &&
573
+ (
574
+ <OButton
575
+ onClick={() => loadMoreOrders && loadMoreOrders()}
576
+ text={t('LOAD_MORE_ORDERS', 'Load more orders')}
577
+ imgRightSrc={null}
578
+ textStyle={styles.loadButtonText}
579
+ style={styles.loadButton}
580
+ bgColor={theme.colors.primary}
581
+ borderColor={theme.colors.primary}
582
+ />
583
+ )}
584
+
585
+ {((!currentOrdersGroup?.loading &&
586
+ (currentOrdersGroup?.error?.length ||
587
+ currentOrdersGroup?.orders?.length === 0)) ||
588
+ (currentTabSelected === 'logisticOrders' &&
589
+ (logisticOrders && logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0 || !logisticOrders?.orders?.some(order => !order?.expired)))
590
+ ) &&
591
+ (
592
+ <NotFoundSource
593
+ content={
594
+ ((currentTabSelected !== 'logisticOrders' && !currentOrdersGroup?.error?.length) ||
595
+ (currentTabSelected === 'logisticOrders' && (!logisticOrders?.error?.length || (logisticOrders?.orders?.length > 0 && !logisticOrders?.orders?.some(order => !order?.expired)))))
596
+ ? t('NO_RESULTS_FOUND', 'Sorry, no results found')
597
+ : currentOrdersGroup?.error?.[0]?.message ||
598
+ currentOrdersGroup?.error?.[0] ||
599
+ (currentTabSelected === 'logisticOrders' && logisticOrders?.error) ||
600
+ t('NETWORK_ERROR', 'Network Error')
601
+ }
602
+ image={theme.images.general.notFound}
603
+ conditioned={false}
604
+ />
605
+ )}
606
+ </ScrollView>
607
+ </View>
608
+ </LeftSide>
609
+
610
+ <RightSide style={{ paddingBottom: 110, paddingHorizontal: 20 }}>
611
+ {currentOrderSelected && (
612
+ <OrderDetailsBusiness {...props.orderDetailsProps} order={currentOrderSelected} isCustomView />
613
+ )}
614
+ </RightSide>
615
+ </Sides>
616
+
617
+ <NewOrderNotification />
618
+ {(openSearchModal || openSLASettingModal) && (
619
+ <OModal open={openSearchModal || openSLASettingModal} entireModal customClose>
620
+ <ModalContainer
621
+ nestedScrollEnabled={true}
622
+ >
623
+ <OIconButton
624
+ icon={theme.images.general.arrow_left}
625
+ borderColor={theme.colors.clear}
626
+ iconColor={theme.colors.backArrow}
627
+ iconStyle={{ width: 20, height: 13 }}
628
+ style={{
629
+ maxWidth: 40,
630
+ height: 35,
631
+ justifyContent: 'flex-end',
632
+ marginBottom: 30,
633
+ marginTop: 30
634
+ }}
635
+ onClick={() => handleClose()}
636
+ />
637
+ {openSearchModal && (
638
+ <SearchModalContent>
639
+ <ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
640
+ <OInput
641
+ value={search.id}
642
+ onChange={(value: any) => setSearch({ ...search, id: value })}
643
+ style={styles.inputStyle}
644
+ placeholder={t('ORDER_NUMBER', 'Order number')}
645
+ autoCorrect={false}
646
+ />
647
+ <OrdersOptionDate
648
+ {...props}
649
+ search={search}
650
+ onSearch={setSearch}
651
+ />
652
+ <OrdersOptionCity
653
+ {...props}
654
+ search={search}
655
+ onSearch={setSearch}
656
+ />
657
+ {isBusinessApp && (
658
+ <>
659
+ <OrdersOptionBusiness
660
+ {...props}
661
+ search={search}
662
+ onSearch={setSearch}
663
+ />
664
+ <OrdersOptionDelivery
665
+ {...props}
666
+ search={search}
667
+ onSearch={setSearch}
668
+ />
669
+ <OrdersOptionDriver
670
+ {...props}
671
+ search={search}
672
+ onSearch={setSearch}
673
+ />
674
+ <OrdersOptionPaymethod
675
+ {...props}
676
+ search={search}
677
+ onSearch={setSearch}
678
+ />
679
+ </>
680
+ )}
681
+ <OButton
682
+ text={t('SEARCH', 'Search')}
683
+ textStyle={{ color: theme.colors.white }}
684
+ imgRightSrc={null}
685
+ style={{
686
+ borderRadius: 7.6,
687
+ marginBottom: 70,
688
+ marginTop: 60,
689
+ zIndex: 12
690
+ }}
691
+ onClick={applyFilters}
692
+ />
693
+
694
+ </SearchModalContent>
695
+ )}
696
+ {openSLASettingModal && (
697
+ <SlaSettingModalContent>
698
+ <ModalTitle>{t('SLA_SETTINGS', 'SLA’s Settings')}</ModalTitle>
699
+ <FiltersTab>
700
+ <ScrollView
701
+ ref={scrollRefTab}
702
+ showsVerticalScrollIndicator={false}
703
+ showsHorizontalScrollIndicator={false}
704
+ horizontal
705
+ nestedScrollEnabled={true}
706
+ >
707
+ <TabsContainer>
708
+ {defaultOrderTypes && defaultOrderTypes.map((tab: any) => (
709
+ <TabPressable
710
+ key={tab.key}
711
+ onPress={() => setCurrentDeliveryType(tab?.name)}
712
+ isSelected={tab.name.toUpperCase() === currentDeliveryType.toUpperCase() ? 1 : 0}
713
+ >
714
+ <OText
715
+ style={{
716
+ ...styles.tab,
717
+ fontSize: tab.name.toUpperCase() === currentDeliveryType.toUpperCase() ? 14 : 12,
718
+ borderBottomWidth: Platform.OS === 'ios' && tab.name.toUpperCase() === currentDeliveryType.toUpperCase() ? 1 : 0,
719
+ }}
720
+ color={
721
+ tab.name.toUpperCase() === currentDeliveryType.toUpperCase()
722
+ ? theme.colors.textGray
723
+ : theme.colors.unselectText
724
+ }
725
+ weight={tab.name.toUpperCase() === currentDeliveryType ? '600' : 'normal'}
726
+ >
727
+ {tab.name}
728
+ </OText>
729
+ </TabPressable>
730
+ ))}
731
+ </TabsContainer>
732
+ </ScrollView>
733
+ </FiltersTab>
734
+ <DeliveryStatusWrapper>
735
+ {selectedTabStatus && selectedTabStatus.length > 0 && selectedTabStatus.map((item: any, i: any) => (
736
+ <StatusBlock
737
+ key={i}
738
+ item={item}
739
+ last={i + 1 === selectedTabStatus.length}
740
+ />
741
+ ))}
742
+ <VerticalLine />
743
+ </DeliveryStatusWrapper>
744
+ </SlaSettingModalContent>
745
+ )}
746
+ </ModalContainer>
747
+ </OModal>
748
+ )}
749
+ </>
750
+ );
751
+ };
752
+
753
+
754
+ export const OrdersListManager = (props: OrdersOptionParams) => {
755
+ const [, t] = useLanguage();
756
+ const ordersProps = {
757
+ ...props,
758
+ UIComponent: OrdersListManagerUI,
759
+ useDefualtSessionManager: true,
760
+ asDashboard: true,
761
+ isIos: Platform.OS === 'ios',
762
+ orderStatus: [
763
+ { key: 0, text: t('PENDING', 'Pending') },
764
+ { key: 1, text: t('COMPLETED', 'Completed') },
765
+ { key: 2, text: t('REJECTED', 'Rejected') },
766
+ { key: 3, text: t('DRIVER_IN_BUSINESS', 'Driver in business') },
767
+ { key: 4, text: t('READY_FOR_PICKUP', 'Ready for pickup') },
768
+ { key: 5, text: t('REJECTED_BY_BUSINESS', 'Rejected by business') },
769
+ { key: 6, text: t('REJECTED_BY_DRIVER', 'Rejected by Driver') },
770
+ { key: 7, text: t('ACCEPTED_BY_BUSINESS', 'Accepted by business') },
771
+ { key: 8, text: t('ACCEPTED_BY_DRIVER', 'Accepted by driver') },
772
+ {
773
+ key: 9,
774
+ text: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
775
+ },
776
+ {
777
+ key: 10,
778
+ text: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
779
+ },
780
+ {
781
+ key: 11,
782
+ text: t('DELIVERY_COMPLETED_BY_DRIVER', 'Delivery completed by driver'),
783
+ },
784
+ {
785
+ key: 12,
786
+ text: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
787
+ },
788
+ { key: 13, text: t('PREORDER', 'Preorder') },
789
+ { key: 14, text: t('ORDER_NOT_READY', 'Order not ready') },
790
+ {
791
+ key: 15,
792
+ text: t(
793
+ 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
794
+ 'Order picked up completed by customer',
795
+ ),
796
+ },
797
+ { key: 16, text: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer') },
798
+ {
799
+ key: 17,
800
+ text: t(
801
+ 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
802
+ 'Order not picked up by customer',
803
+ ),
804
+ },
805
+ {
806
+ key: 18,
807
+ text: t(
808
+ 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
809
+ 'Driver almost arrived to business',
810
+ ),
811
+ },
812
+ {
813
+ key: 19,
814
+ text: t(
815
+ 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
816
+ 'Driver almost arrived to customer',
817
+ ),
818
+ },
819
+ {
820
+ key: 20,
821
+ text: t(
822
+ 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
823
+ 'Customer almost arrived to business',
824
+ ),
825
+ },
826
+ {
827
+ key: 21,
828
+ text: t(
829
+ 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
830
+ 'Customer arrived to business',
831
+ ),
832
+ },
833
+ {
834
+ key: 22,
835
+ text: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver')
836
+ },
837
+ {
838
+ key: 23,
839
+ text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
840
+ }
841
+ ],
842
+ tabs: [
843
+ {
844
+ key: 0,
845
+ text: t('PENDING', 'Pending'),
846
+ tags: props?.orderGroupStatusCustom?.pending ?? [0, 13],
847
+ title: 'pending'
848
+ },
849
+ {
850
+ key: 1,
851
+ text: t('IN_PROGRESS', 'In Progress'),
852
+ tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
853
+ title: 'inProgress',
854
+ },
855
+ {
856
+ key: 2,
857
+ text: t('COMPLETED', 'Completed'),
858
+ tags: props?.orderGroupStatusCustom?.completed ?? [1, 11, 15],
859
+ title: 'completed',
860
+ },
861
+ {
862
+ key: 3,
863
+ text: t('CANCELLED', 'Cancelled'),
864
+ tags: props?.orderGroupStatusCustom?.cancelled ?? [2, 5, 6, 10, 12, 16, 17],
865
+ title: 'cancelled',
866
+ },
867
+ ]
868
+ };
869
+
870
+ return <OrderListGroups {...ordersProps} />;
871
+ };