ordering-ui-react-native 0.16.69-release → 0.16.70-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.16.69-release",
3
+ "version": "0.16.70-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -315,9 +315,11 @@ const CartUI = (props: any) => {
315
315
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
316
316
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
317
317
  </TouchableOpacity>
318
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
319
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
320
- </TouchableOpacity>
318
+ {!offer?.type && (
319
+ <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
320
+ <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
321
+ </TouchableOpacity>
322
+ )}
321
323
  </OSRow>
322
324
  <OText size={12} lineHeight={18}>
323
325
  - {parsePrice(offer?.summary?.discount)}
@@ -328,7 +330,7 @@ const CartUI = (props: any) => {
328
330
  {orderState?.options?.type === 1 && cart?.delivery_price > 0 && !hideDeliveryFee && (
329
331
  <OSTable>
330
332
  <OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
331
- <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
333
+ <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount ?? cart?.delivery_price)}</OText>
332
334
  </OSTable>
333
335
  )}
334
336
  {
@@ -352,6 +354,12 @@ const CartUI = (props: any) => {
352
354
  </OSTable>
353
355
  ))
354
356
  }
357
+ {orderState?.options?.type === 1 && cart?.delivery_price > 0 && cart?.delivery_price_with_discount >= 0 && !hideDeliveryFee && (
358
+ <OSTable>
359
+ <OText size={12} lineHeight={18}>{t('DELIVERY_FEE_AFTER_DISCOUNT', 'Delivery Fee After Discount')}</OText>
360
+ <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
361
+ </OSTable>
362
+ )}
355
363
  {cart?.driver_tip > 0 && !hideDriverTip && (
356
364
  <OSTable>
357
365
  <OText size={12} lineHeight={18}>
@@ -16,7 +16,7 @@ import { BusinessController } from '../BusinessController';
16
16
  import { SingleProductCard } from '../SingleProductCard';
17
17
  import { NotFoundSource } from '../NotFoundSource';
18
18
  import moment from 'moment';
19
-
19
+ import { getOrderStatus } from '../../utils'
20
20
 
21
21
  const FavoriteListUI = (props: FavoriteParams) => {
22
22
  const {
@@ -40,40 +40,6 @@ const FavoriteListUI = (props: FavoriteParams) => {
40
40
 
41
41
  const pastOrders = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
42
42
 
43
- const getOrderStatus = (s: any) => {
44
- const status = parseInt(s)
45
- const orderStatus = [
46
- { key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending') },
47
- { key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed') },
48
- { key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected') },
49
- { key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business') },
50
- { key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed') },
51
- { key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business') },
52
- { key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver') },
53
- { key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business') },
54
- { key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver') },
55
- { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver') },
56
- { key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_FAILED_BY_DRIVER || 'Pick up Failed by driver') },
57
- { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver') },
58
- { key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_FAILED_BY_DRIVER || 'Delivery Failed by driver') },
59
- { key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder') },
60
- { key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready') },
61
- { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer') },
62
- { key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer') },
63
- { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer') },
64
- { key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business') },
65
- { key: 19, value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER || 'Driver almost arrived to customer') },
66
- { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business') },
67
- { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business') },
68
- { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver') },
69
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way') }
70
- ]
71
-
72
- const objectStatus = orderStatus.find((o) => o.key === status)
73
-
74
- return objectStatus && objectStatus
75
- }
76
-
77
43
  const onProductClick = (product: any) => {
78
44
  const categoryId = product?.category?.id
79
45
  const businessId = product?.category?.business?.id
@@ -6,6 +6,7 @@ import { NotFoundSource } from '../NotFoundSource'
6
6
 
7
7
  import { ItemWrap } from './styles'
8
8
  import { OrdersOptionParams } from '../../types'
9
+ import { getOrderStatus } from '../../utils'
9
10
 
10
11
  import {
11
12
  Placeholder,
@@ -67,40 +68,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
67
68
  return moment(dateStr).format('MMMM DD,YYYY - hh:mm a');
68
69
  }
69
70
 
70
- const getOrderStatus = (s: string) => {
71
- const status = parseInt(s)
72
- const orderStatus = [
73
- { key: 0, value: t('PENDING', 'Pending') },
74
- { key: 1, value: t('COMPLETED', 'Completed') },
75
- { key: 2, value: t('REJECTED', 'Rejected') },
76
- { key: 3, value: t('DRIVER_IN_BUSINESS', 'Driver in business') },
77
- { key: 4, value: t('PREPARATION_COMPLETED', 'Preparation Completed') },
78
- { key: 5, value: t('REJECTED_BY_BUSINESS', 'Rejected by business') },
79
- { key: 6, value: t('REJECTED_BY_DRIVER', 'Rejected by Driver') },
80
- { key: 7, value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business') },
81
- { key: 8, value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver') },
82
- { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver') },
83
- { key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver') },
84
- { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', 'Delivery completed by driver') },
85
- { key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver') },
86
- { key: 13, value: t('PREORDER', 'PreOrder') },
87
- { key: 14, value: t('ORDER_NOT_READY', 'Order not ready') },
88
- { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', 'Order picked up completed by customer') },
89
- { key: 16, value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer') },
90
- { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer') },
91
- { key: 18, value: t('DRIVER_ALMOST_ARRIVED_TO_BUSINESS', 'Driver almost arrived to business') },
92
- { key: 19, value: t('DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', 'Driver almost arrived to customer') },
93
- { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
94
- { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
95
- { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
96
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
97
- ]
98
-
99
- const objectStatus = orderStatus.find((o) => o.key === status)
100
-
101
- return objectStatus && objectStatus
102
- }
103
-
104
71
  return (
105
72
  <>
106
73
  {/* {(orders.length > 0) && (
@@ -21,6 +21,7 @@ import {
21
21
  MessageListingWrapper,
22
22
  MessageContainer
23
23
  } from './styles';
24
+ import { getOrderStatus } from '../../utils'
24
25
 
25
26
  const OrdersOptionUI = (props: OrdersOptionParams) => {
26
27
  const {
@@ -51,40 +52,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
51
52
  : theme.images.general.emptyPastOrders
52
53
  const orders = customArray || values || []
53
54
 
54
- const getOrderStatus = (s: string) => {
55
- const status = parseInt(s)
56
- const orderStatus = [
57
- { key: 0, value: t('PENDING', 'Pending') },
58
- { key: 1, value: t('COMPLETED', 'Completed') },
59
- { key: 2, value: t('REJECTED', 'Rejected') },
60
- { key: 3, value: t('DRIVER_IN_BUSINESS', 'Driver in business') },
61
- { key: 4, value: t('PREPARATION_COMPLETED', 'Preparation Completed') },
62
- { key: 5, value: t('REJECTED_BY_BUSINESS', 'Rejected by business') },
63
- { key: 6, value: t('REJECTED_BY_DRIVER', 'Rejected by Driver') },
64
- { key: 7, value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business') },
65
- { key: 8, value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver') },
66
- { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver') },
67
- { key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver') },
68
- { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', 'Delivery completed by driver') },
69
- { key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver') },
70
- { key: 13, value: t('PREORDER', 'PreOrder') },
71
- { key: 14, value: t('ORDER_NOT_READY', 'Order not ready') },
72
- { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', 'Order picked up completed by customer') },
73
- { key: 16, value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer') },
74
- { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer') },
75
- { key: 18, value: t('DRIVER_ALMOST_ARRIVED_TO_BUSINESS', 'Driver almost arrived to business') },
76
- { key: 19, value: t('DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', 'Driver almost arrived to customer') },
77
- { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
78
- { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
79
- { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
80
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
81
- ]
82
-
83
- const objectStatus = orderStatus.find((o) => o.key === status)
84
-
85
- return objectStatus && objectStatus
86
- }
87
-
88
55
  const handleClickOrder = (uuid: string) => {
89
56
  setSelectedOrderId(uuid)
90
57
  setOpenMessges(true)
@@ -3,6 +3,7 @@ import {
3
3
  useLanguage,
4
4
  useEvent,
5
5
  useUtils,
6
+ useConfig,
6
7
  OrderDetails as OrderDetailsController
7
8
  } from 'ordering-components/native'
8
9
  import { View, StyleSheet, TouchableOpacity, Linking } from 'react-native'
@@ -15,6 +16,7 @@ import {
15
16
  StaturBar,
16
17
  Icons
17
18
  } from './styles'
19
+ import { getOrderStatus } from '../../utils'
18
20
 
19
21
  const SingleOrderCardUI = (props: any) => {
20
22
  const {
@@ -23,13 +25,17 @@ const SingleOrderCardUI = (props: any) => {
23
25
  readMessages,
24
26
  messages,
25
27
  setMessages,
26
- handleGoToOrderDetails
28
+ handleGoToOrderDetails,
29
+ showProgressBar
27
30
  } = props
28
31
 
29
32
  const { order } = props.order
30
33
  const theme = useTheme()
31
34
  const [, t] = useLanguage()
32
35
  const [{ parseDate, parsePrice }] = useUtils()
36
+ const [{ configs }] = useConfig()
37
+
38
+ const hideIndividualButton = configs.multi_business_checkout_remove_individual_buttons?.value === '1'
33
39
 
34
40
  const styles = StyleSheet.create({
35
41
  statusBar: {
@@ -37,205 +43,6 @@ const SingleOrderCardUI = (props: any) => {
37
43
  }
38
44
  })
39
45
 
40
- const getOrderStatus = (s: string) => {
41
- const status = parseInt(s);
42
- const orderStatus = [
43
- {
44
- key: 0,
45
- value: t('PENDING', 'Pending'),
46
- slug: 'PENDING',
47
- percentage: 0.25,
48
- image: theme.images.order.status0,
49
- },
50
- {
51
- key: 1,
52
- value: t('COMPLETED', 'Completed'),
53
- slug: 'COMPLETED',
54
- percentage: 1,
55
- image: theme.images.order.status1,
56
- },
57
- {
58
- key: 2,
59
- value: t('REJECTED', 'Rejected'),
60
- slug: 'REJECTED',
61
- percentage: 0,
62
- image: theme.images.order.status2,
63
- },
64
- {
65
- key: 3,
66
- value: t('DRIVER_IN_BUSINESS', 'Driver in business'),
67
- slug: 'DRIVER_IN_BUSINESS',
68
- percentage: 0.6,
69
- image: theme.images.order.status3,
70
- },
71
- {
72
- key: 4,
73
- value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
74
- slug: 'PREPARATION_COMPLETED',
75
- percentage: 0.7,
76
- image: theme.images.order.status4,
77
- },
78
- {
79
- key: 5,
80
- value: t('REJECTED_BY_BUSINESS', 'Rejected by business'),
81
- slug: 'REJECTED_BY_BUSINESS',
82
- percentage: 0,
83
- image: theme.images.order.status5,
84
- },
85
- {
86
- key: 6,
87
- value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'),
88
- slug: 'REJECTED_BY_DRIVER',
89
- percentage: 0,
90
- image: theme.images.order.status6,
91
- },
92
- {
93
- key: 7,
94
- value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
95
- slug: 'ACCEPTED_BY_BUSINESS',
96
- percentage: 0.35,
97
- image: theme.images.order.status7,
98
- },
99
- {
100
- key: 8,
101
- value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'),
102
- slug: 'ACCEPTED_BY_DRIVER',
103
- percentage: 0.45,
104
- image: theme.images.order.status8,
105
- },
106
- {
107
- key: 9,
108
- value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
109
- slug: 'PICK_UP_COMPLETED_BY_DRIVER',
110
- percentage: 0.8,
111
- image: theme.images.order.status9,
112
- },
113
- {
114
- key: 10,
115
- value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
116
- slug: 'PICK_UP_FAILED_BY_DRIVER',
117
- percentage: 0,
118
- image: theme.images.order.status10,
119
- },
120
- {
121
- key: 11,
122
- value: t(
123
- 'DELIVERY_COMPLETED_BY_DRIVER',
124
- 'Delivery completed by driver',
125
- ),
126
- slug: 'DELIVERY_COMPLETED_BY_DRIVER',
127
- percentage: 1,
128
- image: theme.images.order.status11,
129
- },
130
- {
131
- key: 12,
132
- value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
133
- slug: 'DELIVERY_FAILED_BY_DRIVER',
134
- percentage: 0,
135
- image: theme.images.order.status12,
136
- },
137
- {
138
- key: 13,
139
- value: t('PREORDER', 'PreOrder'),
140
- slug: 'PREORDER',
141
- percentage: 0,
142
- image: theme.images.order.status13,
143
- },
144
- {
145
- key: 14,
146
- value: t('ORDER_NOT_READY', 'Order not ready'),
147
- slug: 'ORDER_NOT_READY',
148
- percentage: 0,
149
- image: theme.images.order.status13,
150
- },
151
- {
152
- key: 15,
153
- value: t(
154
- 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
155
- 'Order picked up completed by customer',
156
- ),
157
- slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
158
- percentage: 100,
159
- image: theme.images.order.status1,
160
- },
161
- {
162
- key: 16,
163
- value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
164
- slug: 'CANCELLED_BY_CUSTOMER',
165
- percentage: 0,
166
- image: theme.images.order.status2,
167
- },
168
- {
169
- key: 17,
170
- value: t(
171
- 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
172
- 'Order not picked up by customer',
173
- ),
174
- slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
175
- percentage: 0,
176
- image: theme.images.order.status2,
177
- },
178
- {
179
- key: 18,
180
- value: t(
181
- 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
182
- 'Driver almost arrived to business',
183
- ),
184
- slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
185
- percentage: 0.15,
186
- image: theme.images.order.status3,
187
- },
188
- {
189
- key: 19,
190
- value: t(
191
- 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
192
- 'Driver almost arrived to customer',
193
- ),
194
- slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
195
- percentage: 0.9,
196
- image: theme.images.order.status11,
197
- },
198
- {
199
- key: 20,
200
- value: t(
201
- 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
202
- 'Customer almost arrived to business',
203
- ),
204
- slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
205
- percentage: 90,
206
- image: theme.images.order.status7,
207
- },
208
- {
209
- key: 21,
210
- value: t(
211
- 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
212
- 'Customer arrived to business',
213
- ),
214
- slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
215
- percentage: 95,
216
- image: theme.images.order.status7,
217
- },
218
- {
219
- key: 22,
220
- value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
221
- slug: 'ORDER_LOOKING_FOR_DRIVER',
222
- percentage: 35,
223
- image: theme.images.order.status8
224
- },
225
- {
226
- key: 23,
227
- value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
228
- slug: 'ORDER_DRIVER_ON_WAY',
229
- percentage: 45,
230
- image: theme.images.order.status8
231
- }
232
- ];
233
-
234
- const objectStatus = orderStatus.find((o) => o.key === status);
235
-
236
- return objectStatus && objectStatus;
237
- };
238
-
239
46
  const handleGoToMessages = (type: string) => {
240
47
  readMessages && readMessages();
241
48
  navigation.navigate(
@@ -275,14 +82,16 @@ const SingleOrderCardUI = (props: any) => {
275
82
  </View>
276
83
  </View>
277
84
  </View>
278
- <OButton
279
- onClick={() => handleGoToOrderDetails(order?.uuid)}
280
- textStyle={{ color: theme.colors.primary, textAlign: 'center', fontSize: 14 }}
281
- style={{ flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0, paddingLeft: 5, paddingRight: 5, height: 44 }}
282
- text={t('ORDER_DETAILS', 'Order Details')}
283
- bgColor={theme.colors.white}
284
- borderColor={theme.colors.primary}
285
- />
85
+ {!hideIndividualButton && (
86
+ <OButton
87
+ onClick={() => handleGoToOrderDetails(order?.uuid)}
88
+ textStyle={{ color: theme.colors.primary, textAlign: 'center', fontSize: 14 }}
89
+ style={{ flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0, paddingLeft: 5, paddingRight: 5, height: 44 }}
90
+ text={t('ORDER_DETAILS', 'Order Details')}
91
+ bgColor={theme.colors.white}
92
+ borderColor={theme.colors.primary}
93
+ />
94
+ )}
286
95
  </View>
287
96
  <OText size={16} lineHeight={24} mBottom={17} weight={'500'} color={theme.colors.textNormal}>
288
97
  {t('FROM', 'From')}
@@ -324,25 +133,29 @@ const SingleOrderCardUI = (props: any) => {
324
133
  <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
325
134
  {order?.business?.cellphone}
326
135
  </OText>
327
- )}
136
+ )}
328
137
  <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
329
138
  {order?.business?.address}
330
139
  </OText>
331
- <StaturBar>
332
- <LinearGradient
333
- start={{ x: 0.0, y: 0.0 }}
334
- end={{
335
- x: getOrderStatus(order?.status)?.percentage || 0,
336
- y: 0,
337
- }}
338
- locations={[0.9999, 0.9999]}
339
- colors={[theme.colors.primary, theme.colors.backgroundGray100]}
340
- style={styles.statusBar}
341
- />
342
- </StaturBar>
343
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
344
- {getOrderStatus(order?.status)?.value}
345
- </OText>
140
+ {showProgressBar && (
141
+ <>
142
+ <StaturBar>
143
+ <LinearGradient
144
+ start={{ x: 0.0, y: 0.0 }}
145
+ end={{
146
+ x: getOrderStatus(order?.status)?.percentage || 0,
147
+ y: 0,
148
+ }}
149
+ locations={[0.9999, 0.9999]}
150
+ colors={[theme.colors.primary, theme.colors.backgroundGray100]}
151
+ style={styles.statusBar}
152
+ />
153
+ </StaturBar>
154
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
155
+ {getOrderStatus(order?.status)?.value}
156
+ </OText>
157
+ </>
158
+ )}
346
159
  <View style={{ flexDirection: 'row', justifyContent: 'flex-end', marginTop: 20 }}>
347
160
  <OText size={16} lineHeight={24} weight={'600'} color={theme.colors.textNormal}>
348
161
  {t('EXPORT_ORDER_TOTAL', 'Order total')}: {parsePrice(order?.summary?.total ?? order?.total)}
@@ -1,11 +1,12 @@
1
1
  import React, { useEffect } from 'react'
2
- import { useLanguage, useUtils, useToast, ToastType, MultiOrdersDetails as MultiOrdersDetailsController } from 'ordering-components/native'
2
+ import { useLanguage, useUtils, useToast, ToastType, useConfig, MultiOrdersDetails as MultiOrdersDetailsController } from 'ordering-components/native'
3
3
  import { View, StyleSheet, BackHandler, TouchableOpacity } from 'react-native'
4
4
  import { useTheme } from 'styled-components/native'
5
5
  import { OText, OButton } from '../shared'
6
6
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder'
7
7
  import { SingleOrderCard } from './SingleOrderCard'
8
8
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
9
+ import { getOrderStatus } from '../../utils'
9
10
 
10
11
  import {
11
12
  OrdersDetailsContainer,
@@ -16,9 +17,11 @@ import {
16
17
  InfoBlock,
17
18
  Row,
18
19
  OrdersSummary,
19
- BorderLine
20
+ BorderLine,
21
+ StaturBar
20
22
  } from './styles'
21
23
  import { NotFoundSource } from '../NotFoundSource'
24
+ import LinearGradient from 'react-native-linear-gradient'
22
25
 
23
26
  export const MultiOrdersDetailsUI = (props: any) => {
24
27
  const {
@@ -38,6 +41,9 @@ export const MultiOrdersDetailsUI = (props: any) => {
38
41
  padding: 0,
39
42
  marginLeft: -20
40
43
  },
44
+ statusBar: {
45
+ height: 12,
46
+ }
41
47
  })
42
48
 
43
49
  const { loading, orders, error } = props.ordersList
@@ -191,6 +197,23 @@ export const MultiOrdersDetailsUI = (props: any) => {
191
197
  <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={20}>
192
198
  {t('ORDER_SUMMARY', 'Order summary')}
193
199
  </OText>
200
+ {(showBarInOrder.includes(progressBarStyle)) && (
201
+ <StaturBar isOrderDetails>
202
+ <LinearGradient
203
+ start={{ x: 0.0, y: 0.0 }}
204
+ end={{
205
+ x: getOrderStatus(orders[0]?.status)?.percentage || 0,
206
+ y: 0,
207
+ }}
208
+ locations={[0.9999, 0.9999]}
209
+ colors={[theme.colors.primary, theme.colors.backgroundGray100]}
210
+ style={styles.statusBar}
211
+ />
212
+ </StaturBar>
213
+ )}
214
+ <OText size={14} lineHeight={18} weight={'400'} color={theme.colors.textNormal} mBottom={10}>
215
+ {getOrderStatus(orders[0]?.status)?.value}
216
+ </OText>
194
217
  {orders.map((order: any) => (
195
218
  <Row key={order.id}>
196
219
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
@@ -252,6 +275,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
252
275
  navigation={navigation}
253
276
  order={order}
254
277
  handleGoToOrderDetails={handleGoToOrderDetails}
278
+ showProgressBar={showBarInIndividual.includes(progressBarStyle)}
255
279
  />
256
280
  <Divider />
257
281
  </React.Fragment>
@@ -41,7 +41,7 @@ export const SingleOrderContainer = styled.View`
41
41
  padding: 40px 0;
42
42
  `
43
43
  export const StaturBar = styled.View`
44
- margin-top: 30px;
44
+ margin-top: ${(props: any) => props.isOrderDetails ? '10px' : '30px'};
45
45
  margin-bottom: 10px;
46
46
  `
47
47
  export const Icons = styled.View`
@@ -40,7 +40,7 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
40
40
  import { TouchableOpacity } from 'react-native-gesture-handler';
41
41
  import { OrderDetailsParams } from '../../types';
42
42
  import { GoogleMap } from '../GoogleMap';
43
- import { verifyDecimals } from '../../utils';
43
+ import { verifyDecimals, getOrderStatus } from '../../utils';
44
44
  import { OSRow } from '../OrderSummary/styles';
45
45
  import AntIcon from 'react-native-vector-icons/AntDesign'
46
46
  import { TaxInformation } from '../TaxInformation';
@@ -129,205 +129,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
129
129
  }
130
130
  }
131
131
 
132
- const getOrderStatus = (s: string) => {
133
- const status = parseInt(s);
134
- const orderStatus = [
135
- {
136
- key: 0,
137
- value: t('PENDING', 'Pending'),
138
- slug: 'PENDING',
139
- percentage: 0.25,
140
- image: theme.images.order.status0,
141
- },
142
- {
143
- key: 1,
144
- value: t('COMPLETED', 'Completed'),
145
- slug: 'COMPLETED',
146
- percentage: 1,
147
- image: theme.images.order.status1,
148
- },
149
- {
150
- key: 2,
151
- value: t('REJECTED', 'Rejected'),
152
- slug: 'REJECTED',
153
- percentage: 0,
154
- image: theme.images.order.status2,
155
- },
156
- {
157
- key: 3,
158
- value: t('DRIVER_IN_BUSINESS', 'Driver in business'),
159
- slug: 'DRIVER_IN_BUSINESS',
160
- percentage: 0.6,
161
- image: theme.images.order.status3,
162
- },
163
- {
164
- key: 4,
165
- value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
166
- slug: 'PREPARATION_COMPLETED',
167
- percentage: 0.7,
168
- image: theme.images.order.status4,
169
- },
170
- {
171
- key: 5,
172
- value: t('REJECTED_BY_BUSINESS', 'Rejected by business'),
173
- slug: 'REJECTED_BY_BUSINESS',
174
- percentage: 0,
175
- image: theme.images.order.status5,
176
- },
177
- {
178
- key: 6,
179
- value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'),
180
- slug: 'REJECTED_BY_DRIVER',
181
- percentage: 0,
182
- image: theme.images.order.status6,
183
- },
184
- {
185
- key: 7,
186
- value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
187
- slug: 'ACCEPTED_BY_BUSINESS',
188
- percentage: 0.35,
189
- image: theme.images.order.status7,
190
- },
191
- {
192
- key: 8,
193
- value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'),
194
- slug: 'ACCEPTED_BY_DRIVER',
195
- percentage: 0.45,
196
- image: theme.images.order.status8,
197
- },
198
- {
199
- key: 9,
200
- value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
201
- slug: 'PICK_UP_COMPLETED_BY_DRIVER',
202
- percentage: 0.8,
203
- image: theme.images.order.status9,
204
- },
205
- {
206
- key: 10,
207
- value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
208
- slug: 'PICK_UP_FAILED_BY_DRIVER',
209
- percentage: 0,
210
- image: theme.images.order.status10,
211
- },
212
- {
213
- key: 11,
214
- value: t(
215
- 'DELIVERY_COMPLETED_BY_DRIVER',
216
- 'Delivery completed by driver',
217
- ),
218
- slug: 'DELIVERY_COMPLETED_BY_DRIVER',
219
- percentage: 1,
220
- image: theme.images.order.status11,
221
- },
222
- {
223
- key: 12,
224
- value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
225
- slug: 'DELIVERY_FAILED_BY_DRIVER',
226
- percentage: 0,
227
- image: theme.images.order.status12,
228
- },
229
- {
230
- key: 13,
231
- value: t('PREORDER', 'PreOrder'),
232
- slug: 'PREORDER',
233
- percentage: 0,
234
- image: theme.images.order.status13,
235
- },
236
- {
237
- key: 14,
238
- value: t('ORDER_NOT_READY', 'Order not ready'),
239
- slug: 'ORDER_NOT_READY',
240
- percentage: 0,
241
- image: theme.images.order.status13,
242
- },
243
- {
244
- key: 15,
245
- value: t(
246
- 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
247
- 'Order picked up completed by customer',
248
- ),
249
- slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
250
- percentage: 100,
251
- image: theme.images.order.status1,
252
- },
253
- {
254
- key: 16,
255
- value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
256
- slug: 'CANCELLED_BY_CUSTOMER',
257
- percentage: 0,
258
- image: theme.images.order.status2,
259
- },
260
- {
261
- key: 17,
262
- value: t(
263
- 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
264
- 'Order not picked up by customer',
265
- ),
266
- slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
267
- percentage: 0,
268
- image: theme.images.order.status2,
269
- },
270
- {
271
- key: 18,
272
- value: t(
273
- 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
274
- 'Driver almost arrived to business',
275
- ),
276
- slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
277
- percentage: 0.15,
278
- image: theme.images.order.status3,
279
- },
280
- {
281
- key: 19,
282
- value: t(
283
- 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
284
- 'Driver almost arrived to customer',
285
- ),
286
- slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
287
- percentage: 0.9,
288
- image: theme.images.order.status11,
289
- },
290
- {
291
- key: 20,
292
- value: t(
293
- 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
294
- 'Customer almost arrived to business',
295
- ),
296
- slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
297
- percentage: 90,
298
- image: theme.images.order.status7,
299
- },
300
- {
301
- key: 21,
302
- value: t(
303
- 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
304
- 'Customer arrived to business',
305
- ),
306
- slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
307
- percentage: 95,
308
- image: theme.images.order.status7,
309
- },
310
- {
311
- key: 22,
312
- value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
313
- slug: 'ORDER_LOOKING_FOR_DRIVER',
314
- percentage: 35,
315
- image: theme.images.order.status8
316
- },
317
- {
318
- key: 23,
319
- value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
320
- slug: 'ORDER_DRIVER_ON_WAY',
321
- percentage: 45,
322
- image: theme.images.order.status8
323
- }
324
- ];
325
-
326
- const objectStatus = orderStatus.find((o) => o.key === status);
327
-
328
- return objectStatus && objectStatus;
329
- };
330
-
331
132
  const handleGoToMessages = (type: string) => {
332
133
  readMessages && readMessages();
333
134
  navigation.navigate(
@@ -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 time = order.delivery_type === 1 ? order?.business?.delivery_time : order?.business?.pickup_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 {
@@ -100,40 +101,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
100
101
  setOrders(orders)
101
102
  }, [_orders?.length])
102
103
 
103
- const getOrderStatus = (s: string) => {
104
- const status = parseInt(s)
105
- const orderStatus = [
106
- { key: 0, value: t('PENDING', 'Pending') },
107
- { key: 1, value: t('COMPLETED', 'Completed') },
108
- { key: 2, value: t('REJECTED', 'Rejected') },
109
- { key: 3, value: t('DRIVER_IN_BUSINESS', 'Driver in business') },
110
- { key: 4, value: t('PREPARATION_COMPLETED', 'Preparation Completed') },
111
- { key: 5, value: t('REJECTED_BY_BUSINESS', 'Rejected by business') },
112
- { key: 6, value: t('REJECTED_BY_DRIVER', 'Rejected by Driver') },
113
- { key: 7, value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business') },
114
- { key: 8, value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver') },
115
- { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver') },
116
- { key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver') },
117
- { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', 'Delivery completed by driver') },
118
- { key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver') },
119
- { key: 13, value: t('PREORDER', 'PreOrder') },
120
- { key: 14, value: t('ORDER_NOT_READY', 'Order not ready') },
121
- { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', 'Order picked up completed by customer') },
122
- { key: 16, value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer') },
123
- { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer') },
124
- { key: 18, value: t('DRIVER_ALMOST_ARRIVED_TO_BUSINESS', 'Driver almost arrived to business') },
125
- { key: 19, value: t('DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', 'Driver almost arrived to customer') },
126
- { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
127
- { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
128
- { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
129
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
130
- ]
131
-
132
- const objectStatus = orderStatus.find((o) => o.key === status)
133
-
134
- return objectStatus && objectStatus
135
- }
136
-
137
104
  const onProductClick = (product: any) => {
138
105
  if (product?.product_id && product?.category_id && product?.businessId &&
139
106
  product?.business.slug && product?.business.header && product?.business.logo) {
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { Pressable, StyleSheet, View, ScrollView, TouchableOpacity } from 'react-native';
2
+ import { Pressable, StyleSheet, View, ScrollView, TouchableOpacity, Platform } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native'
4
4
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
5
  import FastImage from 'react-native-fast-image'
@@ -27,6 +27,7 @@ import {
27
27
  import { OButton, OIcon, OText, OModal } from '../shared';
28
28
  import { NotFoundSource } from '../NotFoundSource';
29
29
  import { WalletTransactions } from '../WalletTransactions'
30
+ import { GiftCardUI } from '../GiftCard/GiftCardUI'
30
31
 
31
32
  const WalletsUI = (props: any) => {
32
33
  const {
@@ -47,6 +48,7 @@ const WalletsUI = (props: any) => {
47
48
  const [{ parsePrice }] = useUtils()
48
49
  const [{ configs }] = useConfig()
49
50
 
51
+
50
52
  const styles = StyleSheet.create({
51
53
  logoStyle: {
52
54
  width: 120,
@@ -57,12 +59,20 @@ const WalletsUI = (props: any) => {
57
59
  flexDirection: 'column',
58
60
  justifyContent: 'center',
59
61
  alignItems: 'center',
62
+ },
63
+ dividerStyle: {
64
+ height: 8,
65
+ backgroundColor: theme.colors.backgroundGray100,
66
+ marginVertical: 25,
67
+ marginHorizontal: -40,
68
+ width: '100%'
60
69
  }
61
70
  });
62
71
 
63
72
  const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
64
73
  const [openHistory, setOpenHistory] = useState(false)
65
74
  const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
75
+ const hideWalletsTheme = theme?.bar_menu?.components?.wallets?.hidden
66
76
 
67
77
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
68
78
 
@@ -111,7 +121,47 @@ const WalletsUI = (props: any) => {
111
121
  <>
112
122
  <Container>
113
123
  <Header>
114
- <OText size={24} style={{ marginTop: 30 }}>{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>
115
165
  {isChewLayout && (
116
166
  <OButton
117
167
  text={t('WALLET_HISTORY', 'Wallet history')}
@@ -146,8 +196,8 @@ const WalletsUI = (props: any) => {
146
196
  borderBottomWidth: 1,
147
197
  borderBottomColor:
148
198
  tabSelected === wallet.type
149
- ? theme.colors.textNormal
150
- : theme.colors.border
199
+ ? theme.colors.textNormal
200
+ : theme.colors.border
151
201
  }}
152
202
  >
153
203
  <OText>
@@ -206,6 +256,10 @@ const WalletsUI = (props: any) => {
206
256
  </OText>
207
257
  </BalanceElement>
208
258
 
259
+ <View style={styles.dividerStyle} />
260
+ <GiftCardUI navigation={navigation} />
261
+ <View style={styles.dividerStyle} />
262
+
209
263
  {!isChewLayout && (
210
264
  <WalletTransactions
211
265
  transactionsList={transactionsList}
@@ -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
+ }