ordering-ui-react-native 0.23.84 → 0.23.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { OText,
|
|
3
|
-
import { StyleSheet, View, Platform, Alert } from 'react-native';
|
|
2
|
+
import { OText, OIcon } from '../shared';
|
|
3
|
+
import { StyleSheet, View, Platform, Alert, TouchableOpacity } from 'react-native';
|
|
4
4
|
import {
|
|
5
5
|
Content,
|
|
6
6
|
OrderCustomer,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
ContentInfo,
|
|
16
16
|
} from './styles';
|
|
17
17
|
import { useUtils, useLanguage, useConfig } from 'ordering-components/native';
|
|
18
|
-
import { verifyDecimals, getProductPrice } from '../../utils';
|
|
18
|
+
import { verifyDecimals, getProductPrice, getCurrenySymbol } from '../../utils';
|
|
19
19
|
import { FloatingButton } from '../FloatingButton';
|
|
20
20
|
import RNHTMLtoPDF from 'react-native-html-to-pdf';
|
|
21
21
|
import RNPrint from 'react-native-print';
|
|
@@ -152,10 +152,10 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
152
152
|
</br>
|
|
153
153
|
|
|
154
154
|
${!!order?.delivery_option
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)
|
|
156
|
+
} </br>`
|
|
157
|
+
: ''
|
|
158
|
+
}
|
|
159
159
|
|
|
160
160
|
${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}
|
|
161
161
|
</br>
|
|
@@ -168,9 +168,9 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
168
168
|
${t('EMAIL', 'Email')}: ${order?.customer?.email}
|
|
169
169
|
</br>
|
|
170
170
|
${!!order?.customer?.cellphone
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone
|
|
172
|
+
} </br>`
|
|
173
|
+
: ''}
|
|
174
174
|
|
|
175
175
|
${!!order?.customer?.phone
|
|
176
176
|
? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone
|
|
@@ -196,10 +196,10 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
196
196
|
${order?.business?.email}
|
|
197
197
|
</br>
|
|
198
198
|
${!!order?.business?.cellphone
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone
|
|
200
|
+
} </br>`
|
|
201
|
+
: ''
|
|
202
|
+
}
|
|
203
203
|
${!!order?.business?.phone
|
|
204
204
|
? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone
|
|
205
205
|
} </br>`
|
|
@@ -216,7 +216,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
216
216
|
</p>
|
|
217
217
|
<h1> ${t('ORDER_DETAILS', 'Order Details')}</h1>
|
|
218
218
|
|
|
219
|
-
${order?.comment ? ('</br>'+ t('ORDER_COMMENT', 'Order Comment') + ':' + order?.comment) : ''}
|
|
219
|
+
${order?.comment ? ('</br>' + t('ORDER_COMMENT', 'Order Comment') + ':' + order?.comment) : ''}
|
|
220
220
|
|
|
221
221
|
${order?.products.length &&
|
|
222
222
|
order?.products.map(
|
|
@@ -301,7 +301,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
301
301
|
</div>
|
|
302
302
|
|
|
303
303
|
<div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
|
|
304
|
-
${parsePrice(order?.summary?.delivery_price
|
|
304
|
+
${parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true), { currency: getCurrenySymbol(order?.currency) })}
|
|
305
305
|
</div>` :
|
|
306
306
|
''}
|
|
307
307
|
|
|
@@ -352,28 +352,28 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
352
352
|
`}
|
|
353
353
|
|
|
354
354
|
${order?.payment_events.length &&
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
355
|
+
order?.payment_events.map(
|
|
356
|
+
(event: any, i: number) =>
|
|
357
|
+
`<div style="display: flex;flexDirection:row;flex-wrap:wrap">
|
|
358
358
|
<div style="display:flex;width:100%">
|
|
359
359
|
<div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
|
|
360
360
|
${event?.wallet_event
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
361
|
+
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
362
|
+
: event?.paymethod?.gateway && event?.paymethod?.gateway === 'cash' && order?.cash > 0
|
|
363
|
+
? `${t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
|
|
364
|
+
: event?.paymethod?.gateway
|
|
365
|
+
? t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)
|
|
366
|
+
: t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}
|
|
367
367
|
</div>
|
|
368
368
|
|
|
369
369
|
<div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
|
|
370
370
|
${(event?.paymethod?.gateway === 'cash' && order?.cash)
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
? parsePrice(order?.cash, { currency: order?.currency })
|
|
372
|
+
: `-${parsePrice(event?.amount, { currency: order?.currency })}`}
|
|
373
373
|
</div>
|
|
374
374
|
</div>
|
|
375
375
|
</div>`
|
|
376
|
-
|
|
376
|
+
)}
|
|
377
377
|
</div>`;
|
|
378
378
|
};
|
|
379
379
|
|
|
@@ -418,8 +418,16 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
418
418
|
|
|
419
419
|
const styles = StyleSheet.create({
|
|
420
420
|
btnBackArrow: {
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
borderWidth: 0,
|
|
422
|
+
width: 32,
|
|
423
|
+
height: 32,
|
|
424
|
+
tintColor: theme.colors.textGray,
|
|
425
|
+
backgroundColor: theme.colors.clear,
|
|
426
|
+
borderColor: theme.colors.clear,
|
|
427
|
+
shadowColor: theme.colors.clear,
|
|
428
|
+
paddingLeft: 0,
|
|
429
|
+
paddingRight: 0,
|
|
430
|
+
marginTop: 10
|
|
423
431
|
},
|
|
424
432
|
textBold: {
|
|
425
433
|
fontWeight: '600',
|
|
@@ -445,18 +453,27 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
445
453
|
}
|
|
446
454
|
};
|
|
447
455
|
|
|
456
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
457
|
+
if (!order?.taxes) return 0
|
|
458
|
+
if (order?.taxes?.length === 0) {
|
|
459
|
+
return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
|
|
460
|
+
} else {
|
|
461
|
+
return order?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
462
|
+
return taxIncluded +
|
|
463
|
+
(((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
|
|
464
|
+
(isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
465
|
+
}, 0)
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
448
469
|
return (
|
|
449
470
|
<>
|
|
450
471
|
<Content>
|
|
451
472
|
<OrderContent>
|
|
452
473
|
<OrderHeader>
|
|
453
|
-
<
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
borderColor={theme.colors.clear}
|
|
457
|
-
style={{ maxWidth: 40, justifyContent: 'flex-end' }}
|
|
458
|
-
onClick={() => handleArrowBack()}
|
|
459
|
-
/>
|
|
474
|
+
<TouchableOpacity onPress={() => handleArrowBack()} style={styles.btnBackArrow}>
|
|
475
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
|
|
476
|
+
</TouchableOpacity>
|
|
460
477
|
<OText
|
|
461
478
|
style={{ marginBottom: 5 }}
|
|
462
479
|
size={15}
|
|
@@ -489,7 +506,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
489
506
|
</OText>
|
|
490
507
|
|
|
491
508
|
<OText style={{ marginBottom: 5 }}>
|
|
492
|
-
{`${t(`${paymethodsLength > 1? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}`, `${paymethodsLength > 1 ? 'Payment methods' : 'Payment method'}`)}: ${order?.payment_events?.length > 0 ? handlePaymethodsListString() : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}`}
|
|
509
|
+
{`${t(`${paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}`, `${paymethodsLength > 1 ? 'Payment methods' : 'Payment method'}`)}: ${order?.payment_events?.length > 0 ? handlePaymethodsListString() : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}`}
|
|
493
510
|
</OText>
|
|
494
511
|
|
|
495
512
|
</OrderHeader>
|
|
@@ -744,7 +761,9 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
744
761
|
{t('DELIVERY_FEE', 'Delivery Fee')}
|
|
745
762
|
</OText>
|
|
746
763
|
|
|
747
|
-
<OText>
|
|
764
|
+
<OText>
|
|
765
|
+
{parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true), { currency: getCurrenySymbol(order?.currency) })}
|
|
766
|
+
</OText>
|
|
748
767
|
</Table>
|
|
749
768
|
)}
|
|
750
769
|
|