ordering-ui-react-native 0.14.61 → 0.14.62

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.14.61",
3
+ "version": "0.14.62",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -45,6 +45,15 @@ export const OrderContentComponent = (props: OrderContent) => {
45
45
 
46
46
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
47
47
 
48
+ const walletName: any = {
49
+ cash: {
50
+ name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
51
+ },
52
+ credit_point: {
53
+ name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
54
+ }
55
+ }
56
+
48
57
  const styles = StyleSheet.create({
49
58
  linkWithIcons: {
50
59
  flexDirection: 'row',
@@ -441,7 +450,7 @@ export const OrderContentComponent = (props: OrderContent) => {
441
450
  )
442
451
  }
443
452
 
444
- <Total>
453
+ <Total style={{ paddingBottom: 10 }}>
445
454
  <Table>
446
455
  <OText mBottom={4} style={styles.textBold}>
447
456
  {t('TOTAL', 'Total')}
@@ -455,6 +464,52 @@ export const OrderContentComponent = (props: OrderContent) => {
455
464
  </OText>
456
465
  </Table>
457
466
  </Total>
467
+
468
+ {order?.payment_events?.length > 0 && (
469
+ <View>
470
+ <OText size={14} color={theme.colors.textNormal}>{t('PAYMENTS', 'Payments')}</OText>
471
+ <View
472
+ style={{
473
+ width: '100%',
474
+ marginTop: 5
475
+ }}
476
+ >
477
+ {order?.payment_events?.map((event: any) => (
478
+ <View
479
+ key={event.id}
480
+ style={{
481
+ display: 'flex',
482
+ flexDirection: 'row',
483
+ justifyContent: 'space-between',
484
+ alignItems: 'center',
485
+ marginBottom: 10
486
+ }}
487
+ >
488
+ <View
489
+ style={{
490
+ display: 'flex',
491
+ flexDirection: 'column',
492
+ }}
493
+ >
494
+ <OText>
495
+ {event?.wallet_event
496
+ ? walletName[event?.wallet_event?.wallet?.type]?.name
497
+ : event?.paymethod?.name}
498
+ </OText>
499
+ {event?.data?.charge_id && (
500
+ <OText>
501
+ {`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
502
+ </OText>
503
+ )}
504
+ </View>
505
+ <OText>
506
+ -{parsePrice(event.amount)}
507
+ </OText>
508
+ </View>
509
+ ))}
510
+ </View>
511
+ </View>
512
+ )}
458
513
  </OrderBill >
459
514
  <OModal
460
515
  open={openReviewModal}
@@ -14,7 +14,7 @@ import {
14
14
  } from '../shared'
15
15
 
16
16
  import { useTheme } from 'styled-components/native';
17
- import { StyleSheet } from 'react-native';
17
+ import { StyleSheet, View } from 'react-native';
18
18
 
19
19
  import {
20
20
  useLanguage,
@@ -84,6 +84,25 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
84
84
  17: theme.colors.statusOrderRed,
85
85
  };
86
86
 
87
+ const walletName: any = {
88
+ cash: {
89
+ name: t('CASH_WALLET', 'Cash Wallet'),
90
+ },
91
+ credit_point: {
92
+ name: t('CREDITS_POINTS_WALLET', 'Credit Points Wallet'),
93
+ }
94
+ }
95
+
96
+ const orderTypes = (type: number) => type === 1
97
+ ? t('DELIVERY', 'Delivery')
98
+ : order.delivery_type === 2
99
+ ? t('PICKUP', 'Pickup')
100
+ : order.delivery_type === 3
101
+ ? t('EAT_IN', 'Eat in')
102
+ : order.delivery_type === 4
103
+ ? t('CURBSIDE', 'Curbside')
104
+ : t('DRIVER_THRU', 'Driver thru')
105
+
87
106
  return (
88
107
  <>
89
108
  <Header>
@@ -176,18 +195,30 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
176
195
  </>
177
196
  </OText>
178
197
  {!order?.isLogistic && order?.delivery_type && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
179
- <OText size={13}>
180
- {`${order?.paymethod?.name} - ${order.delivery_type === 1
181
- ? t('DELIVERY', 'Delivery')
182
- : order.delivery_type === 2
183
- ? t('PICKUP', 'Pickup')
184
- : order.delivery_type === 3
185
- ? t('EAT_IN', 'Eat in')
186
- : order.delivery_type === 4
187
- ? t('CURBSIDE', 'Curbside')
188
- : t('DRIVER_THRU', 'Driver thru')
189
- }`}
190
- </OText>
198
+ <>
199
+ <OText size={13}>
200
+ <OText size={13} weight='bold'>{`${t('ORDER_TYPE', 'Order Type')}: `}</OText>
201
+ {orderTypes(order.delivery_type)}
202
+ </OText>
203
+ {order?.payment_events?.length > 0 && (
204
+ <View>
205
+ <OText size={13}>
206
+ <OText size={13} weight='bold'>
207
+ {`${t('PAYMENT_METHODS', 'Payment methods')}: `}
208
+ </OText>
209
+ {order?.payment_events?.map((event: any, idx: number) => {
210
+ return event?.wallet_event
211
+ ? idx < order?.payment_events?.length - 1
212
+ ? `${walletName[event?.wallet_event?.wallet?.type]?.name} - `
213
+ : walletName[event?.wallet_event?.wallet?.type]?.name
214
+ : idx < order?.payment_events?.length - 1
215
+ ? `${event?.paymethod?.name} - `
216
+ : event?.paymethod?.name
217
+ })}
218
+ </OText>
219
+ </View>
220
+ )}
221
+ </>
191
222
  )}
192
223
  </OrderHeader>
193
224
  </>