ordering-ui-react-native 0.22.89 → 0.22.91
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 +1 -1
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +35 -5
- package/themes/business/src/components/OrderDetails/styles.tsx +12 -2
- package/themes/original/src/components/Cart/index.tsx +24 -6
- package/themes/original/src/components/OrderDetails/index.tsx +23 -5
- package/themes/original/src/components/OrderSummary/index.tsx +23 -5
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
Total,
|
|
15
15
|
OSRow,
|
|
16
16
|
OrderVehicle,
|
|
17
|
+
OrderSpot,
|
|
17
18
|
} from './styles';
|
|
18
19
|
|
|
19
20
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
@@ -98,19 +99,21 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
98
99
|
}
|
|
99
100
|
})
|
|
100
101
|
|
|
101
|
-
const getIncludedTaxes = () => {
|
|
102
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
102
103
|
if (!order?.taxes) return 0
|
|
103
104
|
if (order?.taxes?.length === 0) {
|
|
104
105
|
return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
|
|
105
106
|
} else {
|
|
106
107
|
return order?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
107
|
-
return taxIncluded +
|
|
108
|
+
return taxIncluded +
|
|
109
|
+
(((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
|
|
110
|
+
(isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
108
111
|
}, 0)
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
const getIncludedTaxesDiscounts = () => {
|
|
113
|
-
return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
116
|
+
return order?.taxes?.filter((tax: any) => tax?.type === 1 && tax?.target === 'product')?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
const containsOnlyNumbers = (str: string) => {
|
|
@@ -517,7 +520,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
517
520
|
)
|
|
518
521
|
}
|
|
519
522
|
{
|
|
520
|
-
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
523
|
+
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any) => (
|
|
521
524
|
<Table key={tax.id}>
|
|
522
525
|
<OSRow>
|
|
523
526
|
<OText mBottom={4}>
|
|
@@ -565,11 +568,24 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
565
568
|
</OText>
|
|
566
569
|
|
|
567
570
|
<OText mBottom={4}>
|
|
568
|
-
{parsePrice(order?.summary?.delivery_price, { currency: order?.currency })}
|
|
571
|
+
{parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true), { currency: order?.currency })}
|
|
569
572
|
</OText>
|
|
570
573
|
</Table>
|
|
571
574
|
)
|
|
572
575
|
}
|
|
576
|
+
{
|
|
577
|
+
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
|
|
578
|
+
<Table key={`${tax.description}_${i}`}>
|
|
579
|
+
<OSRow>
|
|
580
|
+
<OText size={12} lineHeight={18} numberOfLines={1}>
|
|
581
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
582
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
|
|
583
|
+
</OText>
|
|
584
|
+
</OSRow>
|
|
585
|
+
<OText size={12} lineHeight={18}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
586
|
+
</Table>
|
|
587
|
+
))
|
|
588
|
+
}
|
|
573
589
|
{
|
|
574
590
|
order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
|
|
575
591
|
<Table key={offer.id}>
|
|
@@ -662,6 +678,20 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
662
678
|
)}
|
|
663
679
|
|
|
664
680
|
</OrderBill >
|
|
681
|
+
|
|
682
|
+
{!!order?.spot_number && (
|
|
683
|
+
<OrderSpot vehicleExists={!!order?.vehicle}>
|
|
684
|
+
<Table>
|
|
685
|
+
<OText style={{ marginBottom: 5 }}>
|
|
686
|
+
{t('SPOT_NUMBER', 'Spot number')}
|
|
687
|
+
</OText>
|
|
688
|
+
<OText style={{ marginBottom: 5 }}>
|
|
689
|
+
{order?.spot_number}
|
|
690
|
+
</OText>
|
|
691
|
+
</Table>
|
|
692
|
+
</OrderSpot>
|
|
693
|
+
)}
|
|
694
|
+
|
|
665
695
|
{!!order?.vehicle && (
|
|
666
696
|
<OrderVehicle>
|
|
667
697
|
<OText
|
|
@@ -83,6 +83,16 @@ export const OrderVehicle = styled.View`
|
|
|
83
83
|
flex: 1;
|
|
84
84
|
`;
|
|
85
85
|
|
|
86
|
+
export const OrderSpot = styled.View`
|
|
87
|
+
border-top-width: 1px;
|
|
88
|
+
border-top-color: ${(props: any) => props.theme.colors.borderTops};
|
|
89
|
+
padding-vertical: 20px;
|
|
90
|
+
${(props: any) => !props.vehicleExists && css`
|
|
91
|
+
padding-bottom: 50px;
|
|
92
|
+
`}
|
|
93
|
+
flex: 1;
|
|
94
|
+
`;
|
|
95
|
+
|
|
86
96
|
export const Total = styled.View`
|
|
87
97
|
border-top-width: 1px;
|
|
88
98
|
border-top-color: ${(props: any) => props.theme.colors.borderTops};
|
|
@@ -120,7 +130,7 @@ position: absolute;
|
|
|
120
130
|
height: 8px;
|
|
121
131
|
border-radius: 4px;
|
|
122
132
|
background-color: ${(props: any) => props.theme.colors.red};
|
|
123
|
-
top:
|
|
124
|
-
right:
|
|
133
|
+
top: 10px;
|
|
134
|
+
right: 10px;
|
|
125
135
|
z-index: 99;
|
|
126
136
|
`;
|
|
@@ -156,18 +156,20 @@ const CartUI = (props: any) => {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
const getIncludedTaxes = () => {
|
|
159
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
160
160
|
if (cart?.taxes === null || !cart?.taxes) {
|
|
161
|
-
return cart
|
|
161
|
+
return cart?.business.tax_type === 1 ? cart?.tax : 0
|
|
162
162
|
} else {
|
|
163
163
|
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
164
|
-
return taxIncluded +
|
|
164
|
+
return taxIncluded +
|
|
165
|
+
(((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
|
|
166
|
+
(isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
165
167
|
}, 0)
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
const getIncludedTaxesDiscounts = () => {
|
|
170
|
-
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
172
|
+
return cart?.taxes?.filter((tax: any) => (tax?.type === 1 && tax?.target === 'product'))?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
const OfferAlert = ({ offerId }: any) => {
|
|
@@ -329,7 +331,7 @@ const CartUI = (props: any) => {
|
|
|
329
331
|
</OSTable>
|
|
330
332
|
)}
|
|
331
333
|
{
|
|
332
|
-
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any, i: number) => (
|
|
334
|
+
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any, i: number) => (
|
|
333
335
|
<OSTable key={`${tax.id}_${i}`}>
|
|
334
336
|
<OSRow>
|
|
335
337
|
<OText size={12} lineHeight={18} numberOfLines={1} >
|
|
@@ -384,9 +386,25 @@ const CartUI = (props: any) => {
|
|
|
384
386
|
{orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
|
|
385
387
|
<OSTable>
|
|
386
388
|
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
387
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
389
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount + getIncludedTaxes(true))}</OText>
|
|
388
390
|
</OSTable>
|
|
389
391
|
)}
|
|
392
|
+
{
|
|
393
|
+
cart?.taxes?.length > 0 && cart?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
|
|
394
|
+
<OSTable key={`${tax.description}_${i}`}>
|
|
395
|
+
<OSRow>
|
|
396
|
+
<OText size={12} lineHeight={18} numberOfLines={1}>
|
|
397
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
398
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
|
|
399
|
+
</OText>
|
|
400
|
+
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
|
|
401
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
402
|
+
</TouchableOpacity>
|
|
403
|
+
</OSRow>
|
|
404
|
+
<OText size={12} lineHeight={18}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
405
|
+
</OSTable>
|
|
406
|
+
))
|
|
407
|
+
}
|
|
390
408
|
{
|
|
391
409
|
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any, i: number) => (
|
|
392
410
|
<OSTable key={`${offer.id}_${i}`}>
|
|
@@ -185,18 +185,18 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
185
185
|
navigation.navigate('BottomTab');
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
-
const getIncludedTaxes = () => {
|
|
188
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
189
189
|
if (order?.taxes?.length === 0 || !order?.taxes) {
|
|
190
190
|
return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
|
|
191
191
|
} else {
|
|
192
192
|
return order?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
193
|
-
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
193
|
+
return taxIncluded + (((!isDeliveryFee && tax.type === 1 && tax.target === 'product') || (isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
194
194
|
}, 0)
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
const getIncludedTaxesDiscounts = () => {
|
|
199
|
-
return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
199
|
+
return order?.taxes?.filter((tax: any) => tax?.type === 1 && tax?.target === 'product')?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
const handleClickOrderReview = (order: any) => {
|
|
@@ -933,7 +933,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
933
933
|
)
|
|
934
934
|
}
|
|
935
935
|
{
|
|
936
|
-
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
936
|
+
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any) => (
|
|
937
937
|
<Table key={tax.id}>
|
|
938
938
|
<OSRow>
|
|
939
939
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
|
|
@@ -985,9 +985,27 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
985
985
|
{typeof order?.summary?.delivery_price === 'number' && (
|
|
986
986
|
<Table>
|
|
987
987
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
988
|
-
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price)}</OText>
|
|
988
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price) + getIncludedTaxes(true)}</OText>
|
|
989
989
|
</Table>
|
|
990
990
|
)}
|
|
991
|
+
{
|
|
992
|
+
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
|
|
993
|
+
<Table key={`${tax?.description}_${i}`}>
|
|
994
|
+
<OSRow>
|
|
995
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
|
|
996
|
+
{t(tax?.name?.toUpperCase()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
997
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
|
|
998
|
+
</OText>
|
|
999
|
+
{setOpenTaxModal && (
|
|
1000
|
+
<TouchableOpacity onClick={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
|
|
1001
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
1002
|
+
</TouchableOpacity>
|
|
1003
|
+
)}
|
|
1004
|
+
</OSRow>
|
|
1005
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
1006
|
+
</Table>
|
|
1007
|
+
))
|
|
1008
|
+
}
|
|
991
1009
|
{
|
|
992
1010
|
order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
|
|
993
1011
|
<Table key={offer.id}>
|
|
@@ -72,12 +72,14 @@ const OrderSummaryUI = (props: any) => {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const getIncludedTaxes = () => {
|
|
75
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
76
76
|
if (cart?.taxes === null || !cart?.taxes) {
|
|
77
77
|
return cart?.business?.tax_type === 1 ? cart?.tax : 0
|
|
78
78
|
} else {
|
|
79
79
|
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
80
|
-
return taxIncluded +
|
|
80
|
+
return taxIncluded +
|
|
81
|
+
(((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
|
|
82
|
+
(isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
81
83
|
}, 0)
|
|
82
84
|
}
|
|
83
85
|
}
|
|
@@ -102,7 +104,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
const getIncludedTaxesDiscounts = () => {
|
|
105
|
-
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
107
|
+
return cart?.taxes?.filter((tax: any) => (tax?.type === 1 && tax?.target === 'product'))?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
const OfferAlert = ({ offerId }: any) => {
|
|
@@ -194,7 +196,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
194
196
|
</OSTable>
|
|
195
197
|
)}
|
|
196
198
|
{
|
|
197
|
-
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
199
|
+
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any, i: number) => (
|
|
198
200
|
<OSTable key={tax.id}>
|
|
199
201
|
<OSRow>
|
|
200
202
|
<OText size={12} numberOfLines={1} >
|
|
@@ -249,9 +251,25 @@ const OrderSummaryUI = (props: any) => {
|
|
|
249
251
|
{orderState?.options?.type === 1 && !hideDeliveryFee && (
|
|
250
252
|
<OSTable>
|
|
251
253
|
<OText size={12}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
252
|
-
<OText size={12}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
254
|
+
<OText size={12}>{parsePrice(cart?.delivery_price_with_discount + getIncludedTaxes(true))}</OText>
|
|
253
255
|
</OSTable>
|
|
254
256
|
)}
|
|
257
|
+
{
|
|
258
|
+
cart?.taxes?.length > 0 && cart?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
|
|
259
|
+
<OSTable key={`${tax.description}_${i}`}>
|
|
260
|
+
<OSRow>
|
|
261
|
+
<OText size={12} numberOfLines={1}>
|
|
262
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
263
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
|
|
264
|
+
</OText>
|
|
265
|
+
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
|
|
266
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
267
|
+
</TouchableOpacity>
|
|
268
|
+
</OSRow>
|
|
269
|
+
<OText size={12}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
270
|
+
</OSTable>
|
|
271
|
+
))
|
|
272
|
+
}
|
|
255
273
|
{
|
|
256
274
|
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
|
|
257
275
|
<OSTable key={offer.id}>
|
|
@@ -14,7 +14,8 @@ interface taxInformationParams {
|
|
|
14
14
|
percentage?: number,
|
|
15
15
|
id: number,
|
|
16
16
|
discounts?: any,
|
|
17
|
-
rate_type?: number
|
|
17
|
+
rate_type?: number,
|
|
18
|
+
target?: string
|
|
18
19
|
},
|
|
19
20
|
products: Array<any>,
|
|
20
21
|
type: string
|
|
@@ -34,7 +35,7 @@ export const TaxInformation = (props: taxInformationParams) => {
|
|
|
34
35
|
const offersHideArray = ['offer_target_2', 'offer_target_3']
|
|
35
36
|
const hideProductsSectionOffers = offersHideArray.includes(type)
|
|
36
37
|
const dataHideArray : Array<string | number> = ['platform', 'business']
|
|
37
|
-
const hideProductsSectionData = dataHideArray.includes(data.type)
|
|
38
|
+
const hideProductsSectionData = dataHideArray.includes(data.type) || data?.target === 'delivery_fee'
|
|
38
39
|
|
|
39
40
|
const getFilterValidation = (product: any) => {
|
|
40
41
|
return (
|