ordering-ui-react-native 0.15.21 → 0.15.23-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 +5 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessTypeFilter/index.tsx +12 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/LanguageSelector/index.tsx +1 -0
- package/src/components/OrderDetails/index.tsx +26 -5
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/Checkout.tsx +1 -1
- package/src/pages/Sessions.tsx +22 -0
- package/src/types/index.tsx +3 -9
- package/src/utils/index.tsx +68 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +56 -8
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +5 -0
- package/themes/business/src/components/Chat/index.tsx +38 -86
- package/themes/business/src/components/Home/index.tsx +128 -55
- package/themes/business/src/components/Home/styles.tsx +8 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +22 -13
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +53 -49
- package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
- package/themes/business/src/types/index.tsx +2 -1
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
- package/themes/kiosk/src/components/Cart/index.tsx +98 -24
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +178 -1
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +56 -18
- package/themes/original/src/components/AppleLogin/index.tsx +117 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +52 -22
- package/themes/original/src/components/BusinessController/styles.tsx +22 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +127 -20
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +48 -57
- package/themes/original/src/components/Cart/index.tsx +18 -14
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +42 -27
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GoogleMap/index.tsx +1 -0
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/index.tsx +73 -2
- package/themes/original/src/components/LoginForm/styles.tsx +6 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +34 -25
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +34 -27
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderProgress/index.tsx +4 -4
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/index.tsx +25 -33
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -4
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +40 -33
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
- package/themes/original/src/components/Promotions/index.tsx +250 -0
- package/themes/original/src/components/Promotions/styles.tsx +60 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/TaxInformation/index.tsx +10 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
- package/themes/original/src/components/UserProfile/index.tsx +62 -14
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +75 -8
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +46 -4
- package/themes/original/src/utils/index.tsx +12 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -168
|
@@ -51,7 +51,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
51
51
|
orderTitle,
|
|
52
52
|
appTitle,
|
|
53
53
|
handleClickLogisticOrder,
|
|
54
|
-
forceUpdate
|
|
54
|
+
forceUpdate,
|
|
55
|
+
getPermissions
|
|
55
56
|
} = props;
|
|
56
57
|
const [, { showToast }] = useToast();
|
|
57
58
|
const { order } = props.order
|
|
@@ -72,6 +73,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
72
73
|
key?: string | null;
|
|
73
74
|
}>({ open: false, content: [], key: null });
|
|
74
75
|
|
|
76
|
+
const validStatusComplete = [9, 19, 23]
|
|
77
|
+
|
|
75
78
|
const logisticOrderStatus = [4, 6, 7]
|
|
76
79
|
|
|
77
80
|
const showFloatButtonsPickUp: any = {
|
|
@@ -101,9 +104,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
101
104
|
};
|
|
102
105
|
|
|
103
106
|
const handleOpenMapView = async () => {
|
|
104
|
-
|
|
107
|
+
const _permissions = await getPermissions()
|
|
108
|
+
|
|
109
|
+
const isBlocked = _permissions.some((_permission: string) => permissions?.locationStatus?.[_permission] === 'blocked')
|
|
110
|
+
const isGranted = _permissions.reduce((allPermissions: boolean, _permission: string) => allPermissions && permissions?.locationStatus?.[_permission] === 'granted', true)
|
|
111
|
+
|
|
112
|
+
if (isGranted) {
|
|
105
113
|
setOpenModalForMapView(!openModalForMapView);
|
|
106
|
-
} else if (
|
|
114
|
+
} else if (isBlocked) {
|
|
107
115
|
// redirectToSettings();
|
|
108
116
|
showToast(
|
|
109
117
|
ToastType.Error,
|
|
@@ -114,8 +122,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
114
122
|
);
|
|
115
123
|
} else {
|
|
116
124
|
const response = await askLocationPermission();
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
const isGranted = _permissions.reduce((allPermissions: boolean, _permission: string) => allPermissions && response?.locationStatus?.[_permission] === 'granted', true)
|
|
126
|
+
if (isGranted) {
|
|
127
|
+
setOpenModalForMapView(true)
|
|
119
128
|
}
|
|
120
129
|
}
|
|
121
130
|
};
|
|
@@ -141,9 +150,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
141
150
|
handleArrowBack()
|
|
142
151
|
}
|
|
143
152
|
|
|
144
|
-
const handleAcceptLogisticOrder = (order
|
|
153
|
+
const handleAcceptLogisticOrder = (order: any) => {
|
|
145
154
|
handleClickLogisticOrder?.(1, order?.logistic_order_id)
|
|
146
|
-
if(order?.order_group){
|
|
155
|
+
if (order?.order_group) {
|
|
147
156
|
handleArrowBack()
|
|
148
157
|
}
|
|
149
158
|
}
|
|
@@ -166,10 +175,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
166
175
|
];
|
|
167
176
|
|
|
168
177
|
useEffect(() => {
|
|
169
|
-
if (permissions
|
|
178
|
+
if (permissions?.locationStatus !== 'granted' && openModalForMapView) {
|
|
170
179
|
setOpenModalForMapView(false);
|
|
171
180
|
}
|
|
172
|
-
}, [permissions
|
|
181
|
+
}, [permissions?.locationStatus]);
|
|
173
182
|
|
|
174
183
|
useEffect(() => {
|
|
175
184
|
if (openModalForAccept) {
|
|
@@ -215,8 +224,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
215
224
|
}, [messagesReadList]);
|
|
216
225
|
|
|
217
226
|
useEffect(() => {
|
|
218
|
-
forceUpdate && handleViewActionOrder && handleViewActionOrder(forceUpdate === 9 ? 'forcePickUp': 'forceDelivery')
|
|
219
|
-
},[forceUpdate])
|
|
227
|
+
forceUpdate && handleViewActionOrder && handleViewActionOrder(forceUpdate === 9 ? 'forcePickUp' : 'forceDelivery')
|
|
228
|
+
}, [forceUpdate])
|
|
220
229
|
|
|
221
230
|
const styles = StyleSheet.create({
|
|
222
231
|
btnPickUp: {
|
|
@@ -254,7 +263,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
254
263
|
);
|
|
255
264
|
}
|
|
256
265
|
|
|
257
|
-
const OrderDetailsInformation = (props
|
|
266
|
+
const OrderDetailsInformation = (props: { order: any, isOrderGroup?: boolean, lastOrder?: boolean }) => {
|
|
258
267
|
const {
|
|
259
268
|
order,
|
|
260
269
|
isOrderGroup,
|
|
@@ -378,7 +387,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
378
387
|
widthButton={'45%'}
|
|
379
388
|
/>
|
|
380
389
|
)}
|
|
381
|
-
{(order?.status
|
|
390
|
+
{(validStatusComplete.includes(order?.status)) && (
|
|
382
391
|
<>
|
|
383
392
|
<FloatingButton
|
|
384
393
|
disabled={props.order?.loading}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
Table,
|
|
12
12
|
OrderBill,
|
|
13
13
|
Total,
|
|
14
|
+
OSRow,
|
|
14
15
|
} from './styles';
|
|
15
16
|
|
|
16
17
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
@@ -75,11 +76,53 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
75
76
|
}
|
|
76
77
|
})
|
|
77
78
|
|
|
79
|
+
const getIncludedTaxes = () => {
|
|
80
|
+
if (!order?.taxes) return 0
|
|
81
|
+
if (order?.taxes?.length === 0) {
|
|
82
|
+
return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
|
|
83
|
+
} else {
|
|
84
|
+
return order?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
85
|
+
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
86
|
+
}, 0)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const getIncludedTaxesDiscounts = () => {
|
|
91
|
+
return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
92
|
+
}
|
|
93
|
+
|
|
78
94
|
return (
|
|
79
95
|
<OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
|
|
80
96
|
{isOrderGroup && (
|
|
81
97
|
<OText size={18}>{t('ORDER', 'Order')} #{isOrderGroup ? order?.order_group_id : order?.id}</OText>
|
|
82
98
|
)}
|
|
99
|
+
|
|
100
|
+
{order?.metafields?.length > 0 && (
|
|
101
|
+
<OrderBusiness>
|
|
102
|
+
<OText style={{ marginBottom: 5 }} size={16} weight="600">
|
|
103
|
+
{t('CUSTOM_FIELDS', 'Custom fields')}
|
|
104
|
+
</OText>
|
|
105
|
+
|
|
106
|
+
{order.metafields.map((field: any) => (
|
|
107
|
+
<View
|
|
108
|
+
key={field.id}
|
|
109
|
+
style={{
|
|
110
|
+
width: '100%',
|
|
111
|
+
flexDirection: 'row',
|
|
112
|
+
marginBottom: 5
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
<OText style={{ width: '50%' }}>
|
|
116
|
+
{field.key}
|
|
117
|
+
</OText>
|
|
118
|
+
<OText style={{ width: '45%', textAlign: 'right' }}>
|
|
119
|
+
{field.value}
|
|
120
|
+
</OText>
|
|
121
|
+
</View>
|
|
122
|
+
))}
|
|
123
|
+
</OrderBusiness>
|
|
124
|
+
)}
|
|
125
|
+
|
|
83
126
|
<OrderBusiness>
|
|
84
127
|
<OText style={{ marginBottom: 5 }} size={16} weight="600">
|
|
85
128
|
{t('BUSINESS_DETAILS', 'Business details')}
|
|
@@ -281,14 +324,14 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
281
324
|
</OText>
|
|
282
325
|
)}
|
|
283
326
|
{((order?.delivery_option !== undefined && order?.delivery_type === 1) || !!order?.comment) && (
|
|
284
|
-
<View style={{marginTop: 10}}>
|
|
327
|
+
<View style={{ marginTop: 10 }}>
|
|
285
328
|
{order?.delivery_option !== undefined && order?.delivery_type === 1 && (
|
|
286
329
|
<OText>
|
|
287
330
|
{order?.delivery_option?.name}
|
|
288
331
|
</OText>
|
|
289
332
|
)}
|
|
290
333
|
{!!order?.comment && (
|
|
291
|
-
<OText style={{fontStyle: 'italic', opacity: 0.6, marginBottom: 5}}>
|
|
334
|
+
<OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 5 }}>
|
|
292
335
|
{order?.comment}
|
|
293
336
|
</OText>
|
|
294
337
|
)}
|
|
@@ -323,84 +366,109 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
323
366
|
<Table>
|
|
324
367
|
<OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
325
368
|
<OText mBottom={4}>
|
|
326
|
-
{parsePrice(
|
|
327
|
-
order.tax_type === 1
|
|
328
|
-
? order?.summary?.subtotal + order?.summary?.tax ?? 0
|
|
329
|
-
: order?.summary?.subtotal ?? 0,
|
|
330
|
-
)}
|
|
369
|
+
{parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()))}
|
|
331
370
|
</OText>
|
|
332
371
|
</Table>
|
|
333
|
-
|
|
334
|
-
|
|
372
|
+
{(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
|
|
373
|
+
<Table>
|
|
374
|
+
{order?.offer_type === 1 ? (
|
|
375
|
+
<OText mBottom={4}>
|
|
376
|
+
{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}{' '}
|
|
377
|
+
<OText>{`(${verifyDecimals(order?.offer_rate, parsePrice)}%)`}</OText>
|
|
378
|
+
</OText>
|
|
379
|
+
) : (
|
|
380
|
+
<OText mBottom={4}>{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}</OText>
|
|
381
|
+
)}
|
|
382
|
+
<OText>- {parsePrice(order?.summary?.discount ?? order?.discount)}</OText>
|
|
383
|
+
</Table>
|
|
384
|
+
)}
|
|
385
|
+
{
|
|
386
|
+
order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
|
|
387
|
+
<Table key={offer.id}>
|
|
388
|
+
<OSRow>
|
|
389
|
+
<OText mBottom={4}>
|
|
390
|
+
{offer.name}
|
|
391
|
+
{offer.rate_type === 1 && (
|
|
392
|
+
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
393
|
+
)}
|
|
394
|
+
</OText>
|
|
395
|
+
</OSRow>
|
|
396
|
+
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount)}</OText>
|
|
397
|
+
</Table>
|
|
398
|
+
))
|
|
399
|
+
}
|
|
400
|
+
{order?.summary?.subtotal_with_discount > 0 && order?.summary?.discount > 0 && order?.summary?.total >= 0 && (
|
|
401
|
+
<Table>
|
|
402
|
+
<OText mBottom={4}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
|
|
403
|
+
{order?.tax_type === 1 ? (
|
|
404
|
+
<OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0))}</OText>
|
|
405
|
+
) : (
|
|
406
|
+
<OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0)}</OText>
|
|
407
|
+
)}
|
|
408
|
+
</Table>
|
|
409
|
+
)}
|
|
410
|
+
{order?.taxes?.length === 0 && order?.tax_type === 2 && order?.summary?.tax > 0 && (
|
|
335
411
|
<Table>
|
|
336
412
|
<OText mBottom={4}>
|
|
337
|
-
{t('TAX', 'Tax')}
|
|
338
|
-
{`(${verifyDecimals(
|
|
339
|
-
order?.summary?.tax_rate,
|
|
340
|
-
parseNumber,
|
|
341
|
-
)}%)`}
|
|
413
|
+
{t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
|
|
342
414
|
</OText>
|
|
343
|
-
|
|
344
415
|
<OText mBottom={4}>
|
|
345
416
|
{parsePrice(order?.summary?.tax ?? 0)}
|
|
346
417
|
</OText>
|
|
347
|
-
</Table
|
|
418
|
+
</Table>
|
|
348
419
|
)}
|
|
349
|
-
|
|
350
420
|
{
|
|
351
|
-
order?.summary?.
|
|
421
|
+
order?.fees?.length === 0 && order?.summary?.service_fee > 0 && (
|
|
352
422
|
<Table>
|
|
353
|
-
{order?.offer_type === 1 ? (
|
|
354
|
-
<OText mBottom={4}>
|
|
355
|
-
<OText>{t('DISCOUNT', 'Discount')}</OText>
|
|
356
|
-
|
|
357
|
-
<OText>
|
|
358
|
-
{`(${verifyDecimals(
|
|
359
|
-
order?.offer_rate,
|
|
360
|
-
parsePrice,
|
|
361
|
-
)}%)`}
|
|
362
|
-
</OText>
|
|
363
|
-
</OText>
|
|
364
|
-
) : (
|
|
365
|
-
<OText mBottom={4}>{t('DISCOUNT', 'Discount')}</OText>
|
|
366
|
-
)}
|
|
367
|
-
|
|
368
423
|
<OText mBottom={4}>
|
|
369
|
-
|
|
424
|
+
{t('SERVICE_FEE', 'Service fee')}
|
|
425
|
+
{`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
|
|
370
426
|
</OText>
|
|
427
|
+
<OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0)}</OText>
|
|
371
428
|
</Table>
|
|
372
429
|
)
|
|
373
430
|
}
|
|
374
|
-
|
|
375
431
|
{
|
|
376
|
-
order?.
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
<Table>
|
|
380
|
-
<OText mBottom={4}>
|
|
381
|
-
{t(
|
|
382
|
-
'SUBTOTAL_WITH_DISCOUNT',
|
|
383
|
-
'Subtotal with discount',
|
|
384
|
-
)}
|
|
385
|
-
</OText>
|
|
386
|
-
{order?.tax_type === 1 ? (
|
|
432
|
+
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
433
|
+
<Table key={tax.id}>
|
|
434
|
+
<OSRow>
|
|
387
435
|
<OText mBottom={4}>
|
|
388
|
-
{
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
436
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
437
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
|
|
438
|
+
</OText>
|
|
439
|
+
</OSRow>
|
|
440
|
+
<OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
441
|
+
</Table>
|
|
442
|
+
))
|
|
443
|
+
}
|
|
444
|
+
{
|
|
445
|
+
order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
|
|
446
|
+
<Table key={fee.id}>
|
|
447
|
+
<OSRow>
|
|
448
|
+
<OText mBottom={4}>
|
|
449
|
+
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
450
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
|
|
392
451
|
</OText>
|
|
393
|
-
|
|
452
|
+
</OSRow>
|
|
453
|
+
<OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
|
|
454
|
+
</Table>
|
|
455
|
+
))
|
|
456
|
+
}
|
|
457
|
+
{
|
|
458
|
+
order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
|
|
459
|
+
<Table key={offer.id}>
|
|
460
|
+
<OSRow>
|
|
394
461
|
<OText mBottom={4}>
|
|
395
|
-
{
|
|
396
|
-
|
|
462
|
+
{offer.name}
|
|
463
|
+
{offer.rate_type === 1 && (
|
|
464
|
+
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
397
465
|
)}
|
|
398
466
|
</OText>
|
|
399
|
-
|
|
467
|
+
</OSRow>
|
|
468
|
+
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount)}</OText>
|
|
400
469
|
</Table>
|
|
401
|
-
)
|
|
470
|
+
))
|
|
402
471
|
}
|
|
403
|
-
|
|
404
472
|
{
|
|
405
473
|
order?.summary?.delivery_price > 0 && (
|
|
406
474
|
<Table>
|
|
@@ -414,41 +482,35 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
414
482
|
</Table>
|
|
415
483
|
)
|
|
416
484
|
}
|
|
417
|
-
|
|
418
|
-
<Table>
|
|
419
|
-
<OText mBottom={4}>
|
|
420
|
-
{t('DRIVER_TIP', 'Driver tip')}{' '}
|
|
421
|
-
{order?.summary?.driver_tip > 0 &&
|
|
422
|
-
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
423
|
-
!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
424
|
-
`(${verifyDecimals(
|
|
425
|
-
order?.summary?.driver_tip,
|
|
426
|
-
parseNumber,
|
|
427
|
-
)}%)`}
|
|
428
|
-
</OText>
|
|
429
|
-
|
|
430
|
-
<OText mBottom={4}>
|
|
431
|
-
{parsePrice(order?.summary?.driver_tip ?? 0)}
|
|
432
|
-
</OText>
|
|
433
|
-
</Table>
|
|
434
|
-
|
|
435
485
|
{
|
|
436
|
-
order?.
|
|
437
|
-
<Table>
|
|
438
|
-
<
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
<OText mBottom={4}>
|
|
447
|
-
{parsePrice(order?.summary?.service_fee)}
|
|
448
|
-
</OText>
|
|
486
|
+
order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
|
|
487
|
+
<Table key={offer.id}>
|
|
488
|
+
<OSRow>
|
|
489
|
+
<OText mBottom={4}>
|
|
490
|
+
{offer.name}
|
|
491
|
+
{offer.rate_type === 1 && (
|
|
492
|
+
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
493
|
+
)}
|
|
494
|
+
</OText>
|
|
495
|
+
</OSRow>
|
|
496
|
+
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount)}</OText>
|
|
449
497
|
</Table>
|
|
450
|
-
)
|
|
498
|
+
))
|
|
451
499
|
}
|
|
500
|
+
{order?.summary?.driver_tip > 0 && (
|
|
501
|
+
<Table>
|
|
502
|
+
<OText mBottom={4}>
|
|
503
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
504
|
+
{order?.summary?.driver_tip > 0 &&
|
|
505
|
+
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
506
|
+
!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
507
|
+
(
|
|
508
|
+
`(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
|
|
509
|
+
)}
|
|
510
|
+
</OText>
|
|
511
|
+
<OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip)}</OText>
|
|
512
|
+
</Table>
|
|
513
|
+
)}
|
|
452
514
|
|
|
453
515
|
<Total style={{ paddingBottom: 10 }}>
|
|
454
516
|
<Table>
|
|
@@ -460,7 +522,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
460
522
|
mBottom={4}
|
|
461
523
|
style={styles.textBold}
|
|
462
524
|
color={theme.colors.primary}>
|
|
463
|
-
{parsePrice(order?.summary?.total ??
|
|
525
|
+
{parsePrice(order?.summary?.total ?? order?.total)}
|
|
464
526
|
</OText>
|
|
465
527
|
</Table>
|
|
466
528
|
</Total>
|
|
@@ -30,6 +30,7 @@ interface OrderHeader {
|
|
|
30
30
|
logisticOrderStatus?: Array<number>,
|
|
31
31
|
handleViewSummaryOrder?: any;
|
|
32
32
|
handleCopyClipboard?: any
|
|
33
|
+
isCustomView?: any
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
@@ -105,17 +106,17 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
105
106
|
|
|
106
107
|
return (
|
|
107
108
|
<>
|
|
108
|
-
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
(!order?.isLogistic || (!logisticOrderStatus?.includes(order?.status) && !order?.order_group)) && (
|
|
109
|
+
{!props.isCustomView && (
|
|
110
|
+
<Header>
|
|
111
|
+
<OIconButton
|
|
112
|
+
icon={theme.images.general.arrow_left}
|
|
113
|
+
iconStyle={{ width: 20, height: 20 }}
|
|
114
|
+
borderColor={theme.colors.clear}
|
|
115
|
+
style={{ ...styles.icons, justifyContent: 'flex-end' }}
|
|
116
|
+
onClick={() => handleArrowBack()}
|
|
117
|
+
/>
|
|
118
|
+
|
|
119
|
+
{(!order?.isLogistic || (!logisticOrderStatus?.includes(order?.status) && !order?.order_group)) && (
|
|
119
120
|
<Actions>
|
|
120
121
|
{getOrderStatus(order?.status, t)?.value !==
|
|
121
122
|
t('PENDING', 'Pending') && (
|
|
@@ -170,13 +171,80 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
170
171
|
/>
|
|
171
172
|
</Actions>
|
|
172
173
|
)}
|
|
173
|
-
|
|
174
|
+
</Header>
|
|
175
|
+
)}
|
|
174
176
|
<OrderHeader>
|
|
175
|
-
|
|
176
|
-
{
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
177
|
+
{!props.isCustomView ? (
|
|
178
|
+
<OText size={13} style={{ marginBottom: 5 }}>
|
|
179
|
+
{order?.delivery_datetime_utc
|
|
180
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
181
|
+
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
182
|
+
</OText>
|
|
183
|
+
) : (
|
|
184
|
+
<Header style={{ alignItems: 'center' }}>
|
|
185
|
+
<OText size={13} style={{ marginBottom: 5 }}>
|
|
186
|
+
{order?.delivery_datetime_utc
|
|
187
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
188
|
+
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
189
|
+
</OText>
|
|
190
|
+
|
|
191
|
+
{(!order?.isLogistic || (!logisticOrderStatus?.includes(order?.status) && !order?.order_group)) && (
|
|
192
|
+
<Actions>
|
|
193
|
+
{getOrderStatus(order?.status, t)?.value !==
|
|
194
|
+
t('PENDING', 'Pending') && (
|
|
195
|
+
<>
|
|
196
|
+
<OIconButton
|
|
197
|
+
icon={theme.images.general.copy}
|
|
198
|
+
iconStyle={{
|
|
199
|
+
width: 20,
|
|
200
|
+
height: 25,
|
|
201
|
+
top: 2,
|
|
202
|
+
tintColor: theme.colors.backArrow,
|
|
203
|
+
}}
|
|
204
|
+
borderColor={theme.colors.clear}
|
|
205
|
+
style={styles.icons}
|
|
206
|
+
onClick={() => handleCopyClipboard?.()}
|
|
207
|
+
/>
|
|
208
|
+
<OIconButton
|
|
209
|
+
icon={theme.images.general.print}
|
|
210
|
+
iconStyle={{
|
|
211
|
+
width: 25,
|
|
212
|
+
height: 22,
|
|
213
|
+
tintColor: theme.colors.backArrow,
|
|
214
|
+
}}
|
|
215
|
+
borderColor={theme.colors.clear}
|
|
216
|
+
style={styles.icons}
|
|
217
|
+
onClick={() => handleViewSummaryOrder?.()}
|
|
218
|
+
/>
|
|
219
|
+
</>
|
|
220
|
+
)}
|
|
221
|
+
<OIconButton
|
|
222
|
+
icon={theme.images.general.map}
|
|
223
|
+
iconStyle={{
|
|
224
|
+
width: 20,
|
|
225
|
+
height: 20,
|
|
226
|
+
tintColor: theme.colors.backArrow,
|
|
227
|
+
}}
|
|
228
|
+
borderColor={theme.colors.clear}
|
|
229
|
+
style={styles.icons}
|
|
230
|
+
onClick={() => handleOpenMapView()}
|
|
231
|
+
/>
|
|
232
|
+
|
|
233
|
+
<OIconButton
|
|
234
|
+
icon={theme.images.general.messages}
|
|
235
|
+
iconStyle={{
|
|
236
|
+
width: 20,
|
|
237
|
+
height: 20,
|
|
238
|
+
tintColor: theme.colors.backArrow,
|
|
239
|
+
}}
|
|
240
|
+
borderColor={theme.colors.clear}
|
|
241
|
+
style={styles.icons}
|
|
242
|
+
onClick={() => handleOpenMessagesForBusiness()}
|
|
243
|
+
/>
|
|
244
|
+
</Actions>
|
|
245
|
+
)}
|
|
246
|
+
</Header>
|
|
247
|
+
)}
|
|
180
248
|
|
|
181
249
|
<OText numberOfLines={2} size={20} weight="600">
|
|
182
250
|
<>
|
|
@@ -200,6 +268,12 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
200
268
|
<OText size={13} weight='bold'>{`${t('ORDER_TYPE', 'Order Type')}: `}</OText>
|
|
201
269
|
{orderTypes(order.delivery_type)}
|
|
202
270
|
</OText>
|
|
271
|
+
{order?.delivery_option && (
|
|
272
|
+
<OText size={13}>
|
|
273
|
+
<OText size={13} weight='bold'>{`${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: `}</OText>
|
|
274
|
+
{order?.delivery_option?.name}
|
|
275
|
+
</OText>
|
|
276
|
+
)}
|
|
203
277
|
{order?.payment_events?.length > 0 && (
|
|
204
278
|
<View>
|
|
205
279
|
<OText size={13}>
|