ordering-ui-react-native 0.17.83 → 0.17.85

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.
@@ -20,6 +20,8 @@ import {
20
20
  OrderInfoWrapper,
21
21
  OrderProgressWrapper
22
22
  } from './styles'
23
+ import { getOrderStatus } from '../../utils'
24
+
23
25
  const OrderProgressUI = (props: any) => {
24
26
  const {
25
27
  orderList,
@@ -74,40 +76,6 @@ const OrderProgressUI = (props: any) => {
74
76
  }
75
77
  });
76
78
 
77
- const getOrderStatus = (s: any) => {
78
- const status = parseInt(s)
79
- const orderStatus = [
80
- { key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending'), slug: 'PENDING', percentage: 25 },
81
- { key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed'), slug: 'COMPLETED', percentage: 100 },
82
- { key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected'), slug: 'REJECTED', percentage: 0 },
83
- { key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business'), slug: 'DRIVER_IN_BUSINESS', percentage: 60 },
84
- { key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed'), slug: 'PREPARATION_COMPLETED', percentage: 70 },
85
- { key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business'), slug: 'REJECTED_BY_BUSINESS', percentage: 0 },
86
- { key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver'), slug: 'REJECTED_BY_DRIVER', percentage: 0 },
87
- { key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business'), slug: 'ACCEPTED_BY_BUSINESS', percentage: 35 },
88
- { key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver'), slug: 'ACCEPTED_BY_DRIVER', percentage: 45 },
89
- { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver'), slug: 'PICK_UP_COMPLETED_BY_DRIVER', percentage: 80 },
90
- { key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_FAILED_BY_DRIVER || 'Pick up Failed by driver'), slug: 'PICK_UP_FAILED_BY_DRIVER', percentage: 0 },
91
- { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver'), slug: 'DELIVERY_COMPLETED_BY_DRIVER', percentage: 100 },
92
- { key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_FAILED_BY_DRIVER || 'Delivery Failed by driver'), slug: 'DELIVERY_FAILED_BY_DRIVER', percentage: 0 },
93
- { key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder'), slug: 'PREORDER', percentage: 0 },
94
- { key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready'), slug: 'ORDER_NOT_READY', percentage: 65 },
95
- { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer'), slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', percentage: 100 },
96
- { key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer'), slug: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER', percentage: 0 },
97
- { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer'), slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER', percentage: 0 },
98
- { key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business'), slug: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', percentage: 55 },
99
- { key: 19, value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER || 'Driver almost arrived to customer'), slug: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', percentage: 90 },
100
- { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90 },
101
- { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95 },
102
- { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
103
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
104
- ]
105
-
106
- const objectStatus = orderStatus.find((o) => o.key === status)
107
-
108
- return objectStatus && objectStatus
109
- }
110
-
111
79
  const convertDiffToHours = (order: any) => {
112
80
  const minute = order?.eta_time
113
81
  const deliveryTime = order?.delivery_datetime_utc
@@ -18,6 +18,7 @@ import {
18
18
  } from "rn-placeholder";
19
19
 
20
20
  import { View, ScrollView } from 'react-native'
21
+ import { getOrderStatus } from '../../utils'
21
22
 
22
23
  const OrdersOptionUI = (props: OrdersOptionParams) => {
23
24
  const {
@@ -98,40 +99,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
98
99
  setOrders(orders)
99
100
  }, [_orders?.length])
100
101
 
101
- const getOrderStatus = (s: string) => {
102
- const status = parseInt(s)
103
- const orderStatus = [
104
- { key: 0, value: t('PENDING', 'Pending') },
105
- { key: 1, value: t('COMPLETED', 'Completed') },
106
- { key: 2, value: t('REJECTED', 'Rejected') },
107
- { key: 3, value: t('DRIVER_IN_BUSINESS', 'Driver in business') },
108
- { key: 4, value: t('PREPARATION_COMPLETED', 'Preparation Completed') },
109
- { key: 5, value: t('REJECTED_BY_BUSINESS', 'Rejected by business') },
110
- { key: 6, value: t('REJECTED_BY_DRIVER', 'Rejected by Driver') },
111
- { key: 7, value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business') },
112
- { key: 8, value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver') },
113
- { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver') },
114
- { key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver') },
115
- { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', 'Delivery completed by driver') },
116
- { key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver') },
117
- { key: 13, value: t('PREORDER', 'PreOrder') },
118
- { key: 14, value: t('ORDER_NOT_READY', 'Order not ready') },
119
- { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', 'Order picked up completed by customer') },
120
- { key: 16, value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer') },
121
- { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer') },
122
- { key: 18, value: t('DRIVER_ALMOST_ARRIVED_TO_BUSINESS', 'Driver almost arrived to business') },
123
- { key: 19, value: t('DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', 'Driver almost arrived to customer') },
124
- { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
125
- { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
126
- { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
127
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
128
- ]
129
-
130
- const objectStatus = orderStatus.find((o) => o.key === status)
131
-
132
- return objectStatus && objectStatus
133
- }
134
-
135
102
  const onProductClick = (product: any) => {
136
103
  if (product?.product_id && product?.category_id && product?.businessId &&
137
104
  product?.business.slug && product?.business.header && product?.business.logo) {
@@ -72,6 +72,7 @@ const WalletsUI = (props: any) => {
72
72
  const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
73
73
  const [openHistory, setOpenHistory] = useState(false)
74
74
  const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
75
+ const hideWalletsTheme = theme?.bar_menu?.components?.wallets?.hidden
75
76
 
76
77
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
77
78
 
@@ -120,14 +121,47 @@ const WalletsUI = (props: any) => {
120
121
  <>
121
122
  <Container>
122
123
  <Header>
123
- <OText
124
- size={20}
125
- style={{
126
- marginTop: 30,
127
- color: theme.colors.textNormal,
128
- }}
129
- weight={Platform.OS === 'ios' ? '600' : 'bold'}
130
- >{t('WALLETS', 'Wallets')}</OText>
124
+ <View style={{
125
+ ...{
126
+ width: '100%',
127
+ display: 'flex',
128
+ flexDirection: 'row',
129
+ alignItems: 'center',
130
+ },
131
+ }}>
132
+ {(!props.hideBackBtn || !hideWalletsTheme) && !isChewLayout && (
133
+ <OButton
134
+ imgLeftStyle={{ width: 18 }}
135
+ imgRightSrc={null}
136
+ style={{
137
+ borderWidth: 0,
138
+ width: 26,
139
+ height: 26,
140
+ backgroundColor: '#FFF',
141
+ borderColor: '#FFF',
142
+ shadowColor: '#FFF',
143
+ paddingLeft: 0,
144
+ paddingRight: 0,
145
+ marginTop: 30,
146
+ }}
147
+ onClick={goToBack}
148
+ icon={AntDesignIcon}
149
+ iconProps={{
150
+ name: 'arrowleft',
151
+ size: 26
152
+ }}
153
+ />
154
+ )}
155
+ <OText
156
+ size={20}
157
+ style={{
158
+ marginTop: 30,
159
+ marginLeft: (!props.hideBackBtn || !hideWalletsTheme) && !isChewLayout ? 10 : 0,
160
+ color: theme.colors.textNormal,
161
+ }}
162
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
163
+ >{t('WALLETS', 'Wallets')}</OText>
164
+ </View>
131
165
  {isChewLayout && (
132
166
  <OButton
133
167
  text={t('WALLET_HISTORY', 'Wallet history')}
@@ -162,8 +196,8 @@ const WalletsUI = (props: any) => {
162
196
  borderBottomWidth: 1,
163
197
  borderBottomColor:
164
198
  tabSelected === wallet.type
165
- ? theme.colors.textNormal
166
- : theme.colors.border
199
+ ? theme.colors.textNormal
200
+ : theme.colors.border
167
201
  }}
168
202
  >
169
203
  <OText>
@@ -3,9 +3,12 @@ import { useLanguage } from 'ordering-components/native';
3
3
  import FontAwesome from 'react-native-vector-icons/FontAwesome';
4
4
  import { CODES } from 'ordering-components/native'
5
5
  import { ORDER_TYPES } from '../config/constants';
6
+ import { useTheme } from 'styled-components/native';
6
7
 
7
- export const flatArray = (arr: any) => [].concat(...arr)
8
8
  const [languageState, t] = useLanguage();
9
+ const theme = useTheme()
10
+
11
+ export const flatArray = (arr: any) => [].concat(...arr)
9
12
 
10
13
  /**
11
14
  * Function to return the traduction depending of a key 't'
@@ -351,3 +354,202 @@ export const priceList = [
351
354
  { level: '4', content: '$$$$' },
352
355
  { level: '5', content: '$$$$$' }
353
356
  ]
357
+
358
+ export const getOrderStatus = (s: string) => {
359
+ const status = parseInt(s);
360
+ const orderStatus = [
361
+ {
362
+ key: 0,
363
+ value: t('PENDING', 'Pending'),
364
+ slug: 'PENDING',
365
+ percentage: 0.25,
366
+ image: theme.images.order.status0,
367
+ },
368
+ {
369
+ key: 1,
370
+ value: t('COMPLETED', 'Completed'),
371
+ slug: 'COMPLETED',
372
+ percentage: 1,
373
+ image: theme.images.order.status1,
374
+ },
375
+ {
376
+ key: 2,
377
+ value: t('REJECTED', 'Rejected'),
378
+ slug: 'REJECTED',
379
+ percentage: 0,
380
+ image: theme.images.order.status2,
381
+ },
382
+ {
383
+ key: 3,
384
+ value: t('DRIVER_IN_BUSINESS', 'Driver in business'),
385
+ slug: 'DRIVER_IN_BUSINESS',
386
+ percentage: 0.6,
387
+ image: theme.images.order.status3,
388
+ },
389
+ {
390
+ key: 4,
391
+ value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
392
+ slug: 'PREPARATION_COMPLETED',
393
+ percentage: 0.7,
394
+ image: theme.images.order.status4,
395
+ },
396
+ {
397
+ key: 5,
398
+ value: t('REJECTED_BY_BUSINESS', 'Rejected by business'),
399
+ slug: 'REJECTED_BY_BUSINESS',
400
+ percentage: 0,
401
+ image: theme.images.order.status5,
402
+ },
403
+ {
404
+ key: 6,
405
+ value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'),
406
+ slug: 'REJECTED_BY_DRIVER',
407
+ percentage: 0,
408
+ image: theme.images.order.status6,
409
+ },
410
+ {
411
+ key: 7,
412
+ value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
413
+ slug: 'ACCEPTED_BY_BUSINESS',
414
+ percentage: 0.35,
415
+ image: theme.images.order.status7,
416
+ },
417
+ {
418
+ key: 8,
419
+ value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'),
420
+ slug: 'ACCEPTED_BY_DRIVER',
421
+ percentage: 0.45,
422
+ image: theme.images.order.status8,
423
+ },
424
+ {
425
+ key: 9,
426
+ value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
427
+ slug: 'PICK_UP_COMPLETED_BY_DRIVER',
428
+ percentage: 0.8,
429
+ image: theme.images.order.status9,
430
+ },
431
+ {
432
+ key: 10,
433
+ value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
434
+ slug: 'PICK_UP_FAILED_BY_DRIVER',
435
+ percentage: 0,
436
+ image: theme.images.order.status10,
437
+ },
438
+ {
439
+ key: 11,
440
+ value: t(
441
+ 'DELIVERY_COMPLETED_BY_DRIVER',
442
+ 'Delivery completed by driver',
443
+ ),
444
+ slug: 'DELIVERY_COMPLETED_BY_DRIVER',
445
+ percentage: 1,
446
+ image: theme.images.order.status11,
447
+ },
448
+ {
449
+ key: 12,
450
+ value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
451
+ slug: 'DELIVERY_FAILED_BY_DRIVER',
452
+ percentage: 0,
453
+ image: theme.images.order.status12,
454
+ },
455
+ {
456
+ key: 13,
457
+ value: t('PREORDER', 'PreOrder'),
458
+ slug: 'PREORDER',
459
+ percentage: 0,
460
+ image: theme.images.order.status13,
461
+ },
462
+ {
463
+ key: 14,
464
+ value: t('ORDER_NOT_READY', 'Order not ready'),
465
+ slug: 'ORDER_NOT_READY',
466
+ percentage: 0,
467
+ image: theme.images.order.status13,
468
+ },
469
+ {
470
+ key: 15,
471
+ value: t(
472
+ 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
473
+ 'Order picked up completed by customer',
474
+ ),
475
+ slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
476
+ percentage: 100,
477
+ image: theme.images.order.status1,
478
+ },
479
+ {
480
+ key: 16,
481
+ value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
482
+ slug: 'CANCELLED_BY_CUSTOMER',
483
+ percentage: 0,
484
+ image: theme.images.order.status2,
485
+ },
486
+ {
487
+ key: 17,
488
+ value: t(
489
+ 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
490
+ 'Order not picked up by customer',
491
+ ),
492
+ slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
493
+ percentage: 0,
494
+ image: theme.images.order.status2,
495
+ },
496
+ {
497
+ key: 18,
498
+ value: t(
499
+ 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
500
+ 'Driver almost arrived to business',
501
+ ),
502
+ slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
503
+ percentage: 0.15,
504
+ image: theme.images.order.status3,
505
+ },
506
+ {
507
+ key: 19,
508
+ value: t(
509
+ 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
510
+ 'Driver almost arrived to customer',
511
+ ),
512
+ slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
513
+ percentage: 0.9,
514
+ image: theme.images.order.status11,
515
+ },
516
+ {
517
+ key: 20,
518
+ value: t(
519
+ 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
520
+ 'Customer almost arrived to business',
521
+ ),
522
+ slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
523
+ percentage: 90,
524
+ image: theme.images.order.status7,
525
+ },
526
+ {
527
+ key: 21,
528
+ value: t(
529
+ 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
530
+ 'Customer arrived to business',
531
+ ),
532
+ slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
533
+ percentage: 95,
534
+ image: theme.images.order.status7,
535
+ },
536
+ {
537
+ key: 22,
538
+ value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
539
+ slug: 'ORDER_LOOKING_FOR_DRIVER',
540
+ percentage: 35,
541
+ image: theme.images.order.status8
542
+ },
543
+ {
544
+ key: 23,
545
+ value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
546
+ slug: 'ORDER_DRIVER_ON_WAY',
547
+ percentage: 45,
548
+ image: theme.images.order.status8
549
+ }
550
+ ];
551
+
552
+ const objectStatus = orderStatus.find((o) => o.key === status);
553
+
554
+ return objectStatus && objectStatus;
555
+ }