ordering-ui-react-native 0.21.87 → 0.21.88-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 +6 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +6 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/types/index.tsx +3 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/BusinessController/index.tsx +8 -3
- package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
- package/themes/business/src/components/Chat/index.tsx +5 -2
- package/themes/business/src/components/DriverMap/index.tsx +49 -27
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +36 -17
- package/themes/business/src/components/NewOrderNotification/index.tsx +69 -33
- package/themes/business/src/components/OrderDetails/Business.tsx +74 -9
- package/themes/business/src/components/OrderDetails/Delivery.tsx +131 -51
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +112 -41
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +62 -24
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +221 -0
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/OrderSummary/index.tsx +223 -73
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +251 -159
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +42 -20
- package/themes/business/src/components/PreviousOrders/index.tsx +76 -66
- package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +431 -0
- package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/Sessions/index.tsx +1 -1
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +47 -29
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
- package/themes/business/src/types/index.tsx +14 -4
- package/themes/business/src/utils/index.tsx +25 -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/Checkout/index.tsx +6 -0
- 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/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +11 -0
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +32 -17
- package/themes/original/src/components/AddressList/index.tsx +8 -7
- package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +5 -8
- package/themes/original/src/components/BusinessController/index.tsx +12 -7
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +2 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +20 -15
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +18 -6
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +43 -15
- package/themes/original/src/components/CartContent/index.tsx +21 -8
- package/themes/original/src/components/Checkout/index.tsx +105 -59
- package/themes/original/src/components/CitiesControl/index.tsx +0 -3
- package/themes/original/src/components/CouponControl/index.tsx +1 -3
- package/themes/original/src/components/DriverTips/index.tsx +1 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +2 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +2 -10
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +4 -7
- package/themes/original/src/components/MessageListing/index.tsx +2 -1
- package/themes/original/src/components/Messages/index.tsx +13 -9
- package/themes/original/src/components/MomentOption/index.tsx +13 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +130 -86
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -1
- package/themes/original/src/components/MyOrders/index.tsx +10 -23
- package/themes/original/src/components/NavBar/index.tsx +7 -4
- package/themes/original/src/components/NetworkError/index.tsx +0 -5
- package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +13 -10
- package/themes/original/src/components/OrderDetails/index.tsx +42 -19
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +26 -6
- package/themes/original/src/components/OrderSummary/index.tsx +28 -9
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +3 -6
- package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +17 -9
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
- package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
- package/themes/original/src/components/ProductForm/index.tsx +107 -102
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
- package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
- package/themes/original/src/components/Promotions/index.tsx +6 -9
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +52 -54
- package/themes/original/src/components/Sessions/index.tsx +3 -3
- package/themes/original/src/components/SignupForm/index.tsx +86 -78
- package/themes/original/src/components/SingleOrderCard/index.tsx +7 -5
- package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +10 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +77 -60
- package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
- package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserDetails/index.tsx +3 -2
- package/themes/original/src/components/UserFormDetails/index.tsx +154 -130
- package/themes/original/src/components/UserProfile/index.tsx +9 -1
- package/themes/original/src/components/Wallets/index.tsx +6 -3
- package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -4
- package/themes/original/src/components/shared/OInput.tsx +4 -8
- package/themes/original/src/components/shared/OModal.tsx +7 -2
- package/themes/original/src/types/index.tsx +5 -1
- package/themes/original/src/utils/index.tsx +30 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
OrderBill,
|
|
14
14
|
Total,
|
|
15
15
|
OSRow,
|
|
16
|
+
OrderVehicle,
|
|
17
|
+
OrderSpot,
|
|
16
18
|
} from './styles';
|
|
17
19
|
|
|
18
20
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
@@ -66,6 +68,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
66
68
|
})
|
|
67
69
|
|
|
68
70
|
const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
|
|
71
|
+
const deliveryTypes = [1, 7]
|
|
69
72
|
|
|
70
73
|
const walletName: any = {
|
|
71
74
|
cash: {
|
|
@@ -97,19 +100,21 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
97
100
|
}
|
|
98
101
|
})
|
|
99
102
|
|
|
100
|
-
const getIncludedTaxes = () => {
|
|
103
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
101
104
|
if (!order?.taxes) return 0
|
|
102
105
|
if (order?.taxes?.length === 0) {
|
|
103
106
|
return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
|
|
104
107
|
} else {
|
|
105
108
|
return order?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
106
|
-
return taxIncluded +
|
|
109
|
+
return taxIncluded +
|
|
110
|
+
(((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
|
|
111
|
+
(isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
107
112
|
}, 0)
|
|
108
113
|
}
|
|
109
114
|
}
|
|
110
115
|
|
|
111
116
|
const getIncludedTaxesDiscounts = () => {
|
|
112
|
-
return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
117
|
+
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)
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
const containsOnlyNumbers = (str: string) => {
|
|
@@ -219,8 +224,8 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
219
224
|
<OLink
|
|
220
225
|
PressStyle={styles.linkWithIcons}
|
|
221
226
|
url={Platform.select({
|
|
222
|
-
ios: `maps:0,0?q=${order?.business?.address}`,
|
|
223
|
-
android: `geo:0,0?q=${order?.business?.address}`,
|
|
227
|
+
ios: `maps:0,0?q=${order?.business?.address}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
|
|
228
|
+
android: `geo:0,0?q=${order?.business?.address}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
|
|
224
229
|
})}
|
|
225
230
|
numberOfLines={2}
|
|
226
231
|
shorcut={order?.business?.address}
|
|
@@ -230,7 +235,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
230
235
|
)}
|
|
231
236
|
{!!order?.business?.location && order?.customer?.location && (
|
|
232
237
|
<OText>
|
|
233
|
-
{t('DISTANCE_TO_THE_BUSINESS', 'Distance to the business')}: {transformDistance(calculateDistance(order?.business?.location, { latitude: order?.customer?.location?.lat, longitude: order?.customer?.location?.lng }), distanceUnit)} {t(distanceUnit
|
|
238
|
+
{t('DISTANCE_TO_THE_BUSINESS', 'Distance to the business')}: {transformDistance(calculateDistance(order?.business?.location, { latitude: order?.customer?.location?.lat, longitude: order?.customer?.location?.lng }), distanceUnit)} {t(distanceUnit?.toUpperCase?.(), distanceUnit)}
|
|
234
239
|
</OText>
|
|
235
240
|
)}
|
|
236
241
|
{!!order?.business?.address_notes && (
|
|
@@ -239,8 +244,8 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
239
244
|
<OLink
|
|
240
245
|
PressStyle={styles.linkWithIcons}
|
|
241
246
|
url={Platform.select({
|
|
242
|
-
ios: `maps:0,0?q=${order?.business?.address_notes}`,
|
|
243
|
-
android: `geo:0,0?q=${order?.business?.address_notes}`,
|
|
247
|
+
ios: `maps:0,0?q=${order?.business?.address_notes}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
|
|
248
|
+
android: `geo:0,0?q=${order?.business?.address_notes}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
|
|
244
249
|
})}
|
|
245
250
|
shorcut={order?.business?.address_notes}
|
|
246
251
|
TextStyle={styles.textLink}
|
|
@@ -360,8 +365,8 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
360
365
|
<OLink
|
|
361
366
|
PressStyle={{ ...styles.linkWithIcons, marginBottom: 0 }}
|
|
362
367
|
url={Platform.select({
|
|
363
|
-
ios: `maps:0,0?q=${order?.customer?.address}`,
|
|
364
|
-
android: `geo:0,0?q=${order?.customer?.address}`,
|
|
368
|
+
ios: `maps:0,0?q=${order?.customer?.address}@${order?.customer?.location?.lat},${order?.customer?.location?.lng}`,
|
|
369
|
+
android: `geo:0,0?q=${order?.customer?.address}@${order?.customer?.location?.lat},${order?.customer?.location?.lng}`,
|
|
365
370
|
})}
|
|
366
371
|
onTextLayout={e => onTextLayout(e, 'customerAddress')}
|
|
367
372
|
numberOfLines={isReadMore.customerAddress ? 20 : 2}
|
|
@@ -408,26 +413,16 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
408
413
|
{t('ON_BEHALF_OF', 'On behalf of')}{': '} {order?.on_behalf_of}
|
|
409
414
|
</OText>
|
|
410
415
|
)}
|
|
411
|
-
{(
|
|
416
|
+
{(order?.delivery_option !== undefined && deliveryTypes.includes(order?.delivery_type)) && (
|
|
412
417
|
<View style={{ marginTop: 10 }}>
|
|
413
|
-
{order?.delivery_option !== undefined && order?.delivery_type
|
|
418
|
+
{order?.delivery_option !== undefined && deliveryTypes.includes(order?.delivery_type) && (
|
|
414
419
|
<OText>
|
|
415
|
-
{t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
|
|
420
|
+
{t(order?.delivery_option?.name?.toUpperCase?.()?.replace(/ /g, '_'), order?.delivery_option?.name)}
|
|
416
421
|
</OText>
|
|
417
422
|
)}
|
|
418
|
-
{!!order?.comment && (
|
|
419
|
-
<>
|
|
420
|
-
<OText weight='500' style={{ marginBottom: 5 }}>
|
|
421
|
-
{t('ORDER_COMMENT', 'Order Comment')}
|
|
422
|
-
</OText>
|
|
423
|
-
<OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 20 }}>
|
|
424
|
-
{order?.comment}
|
|
425
|
-
</OText>
|
|
426
|
-
</>
|
|
427
|
-
)}
|
|
428
423
|
</View>
|
|
429
424
|
)}
|
|
430
|
-
{!order?.user_review && pastOrderStatuses.includes(order?.status) && (
|
|
425
|
+
{!order?.user_review && pastOrderStatuses.includes(order?.status) && order?.customer_id && (
|
|
431
426
|
<OButton
|
|
432
427
|
style={styles.btnReview}
|
|
433
428
|
textStyle={{ color: theme.colors.white }}
|
|
@@ -439,10 +434,16 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
439
434
|
</OrderCustomer>
|
|
440
435
|
|
|
441
436
|
<OrderProducts>
|
|
442
|
-
<OText style={{ marginBottom:
|
|
437
|
+
<OText style={{ marginBottom: 10 }} size={16} weight="600">
|
|
443
438
|
{t('ORDER_DETAILS', 'Order Details')}
|
|
444
439
|
</OText>
|
|
445
440
|
|
|
441
|
+
{!!order?.comment && (
|
|
442
|
+
<OText>
|
|
443
|
+
{`${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}`}
|
|
444
|
+
</OText>
|
|
445
|
+
)}
|
|
446
|
+
|
|
446
447
|
{order?.products?.length > 0 &&
|
|
447
448
|
order?.products.map((product: any, i: number) => (
|
|
448
449
|
<ProductItemAccordion
|
|
@@ -453,7 +454,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
453
454
|
))}
|
|
454
455
|
</OrderProducts>
|
|
455
456
|
|
|
456
|
-
<OrderBill>
|
|
457
|
+
<OrderBill vehicleExists={!!order?.vehicle}>
|
|
457
458
|
<Table>
|
|
458
459
|
<OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
459
460
|
<OText mBottom={4}>
|
|
@@ -478,7 +479,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
478
479
|
<Table key={offer.id}>
|
|
479
480
|
<OSRow>
|
|
480
481
|
<OText mBottom={4}>
|
|
481
|
-
{t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
|
|
482
|
+
{t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
|
|
482
483
|
{offer.rate_type === 1 && (
|
|
483
484
|
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
484
485
|
)}
|
|
@@ -520,11 +521,11 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
520
521
|
)
|
|
521
522
|
}
|
|
522
523
|
{
|
|
523
|
-
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
524
|
+
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any) => (
|
|
524
525
|
<Table key={tax.id}>
|
|
525
526
|
<OSRow>
|
|
526
527
|
<OText mBottom={4}>
|
|
527
|
-
{t(tax?.name?.toUpperCase()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
528
|
+
{t(tax?.name?.toUpperCase?.()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
528
529
|
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
|
|
529
530
|
</OText>
|
|
530
531
|
</OSRow>
|
|
@@ -537,7 +538,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
537
538
|
<Table key={fee.id}>
|
|
538
539
|
<OSRow>
|
|
539
540
|
<OText mBottom={4}>
|
|
540
|
-
{t(fee?.name?.toUpperCase()?.replace(/ /g, '_'), fee?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
541
|
+
{t(fee?.name?.toUpperCase?.()?.replace(/ /g, '_'), fee?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
541
542
|
({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency })} + `}{fee.percentage}%){' '}
|
|
542
543
|
</OText>
|
|
543
544
|
</OSRow>
|
|
@@ -550,7 +551,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
550
551
|
<Table key={offer.id}>
|
|
551
552
|
<OSRow>
|
|
552
553
|
<OText mBottom={4}>
|
|
553
|
-
{t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
|
|
554
|
+
{t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
|
|
554
555
|
{offer.rate_type === 1 && (
|
|
555
556
|
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
556
557
|
)}
|
|
@@ -561,24 +562,37 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
561
562
|
))
|
|
562
563
|
}
|
|
563
564
|
{
|
|
564
|
-
typeof order?.summary?.delivery_price === 'number' && (
|
|
565
|
+
typeof order?.summary?.delivery_price === 'number' && order.delivery_type !== 2 && (
|
|
565
566
|
<Table>
|
|
566
567
|
<OText mBottom={4}>
|
|
567
568
|
{t('DELIVERY_FEE', 'Delivery Fee')}
|
|
568
569
|
</OText>
|
|
569
570
|
|
|
570
571
|
<OText mBottom={4}>
|
|
571
|
-
{parsePrice(order?.summary?.delivery_price, { currency: order?.currency })}
|
|
572
|
+
{parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true), { currency: order?.currency })}
|
|
572
573
|
</OText>
|
|
573
574
|
</Table>
|
|
574
575
|
)
|
|
575
576
|
}
|
|
577
|
+
{
|
|
578
|
+
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
|
|
579
|
+
<Table key={`${tax.description}_${i}`}>
|
|
580
|
+
<OSRow>
|
|
581
|
+
<OText mBottom={4}>
|
|
582
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
583
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
|
|
584
|
+
</OText>
|
|
585
|
+
</OSRow>
|
|
586
|
+
<OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
587
|
+
</Table>
|
|
588
|
+
))
|
|
589
|
+
}
|
|
576
590
|
{
|
|
577
591
|
order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
|
|
578
592
|
<Table key={offer.id}>
|
|
579
593
|
<OSRow>
|
|
580
594
|
<OText mBottom={4}>
|
|
581
|
-
{t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
|
|
595
|
+
{t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
|
|
582
596
|
{offer.rate_type === 1 && (
|
|
583
597
|
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
584
598
|
)}
|
|
@@ -588,7 +602,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
588
602
|
</Table>
|
|
589
603
|
))
|
|
590
604
|
}
|
|
591
|
-
{(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && (
|
|
605
|
+
{(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 && (
|
|
592
606
|
<Table>
|
|
593
607
|
<OText mBottom={4}>
|
|
594
608
|
{t('DRIVER_TIP', 'Driver tip')}
|
|
@@ -646,13 +660,12 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
646
660
|
<OText>
|
|
647
661
|
{event?.wallet_event
|
|
648
662
|
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
649
|
-
:
|
|
663
|
+
: event?.paymethod?.gateway
|
|
664
|
+
? t(event?.paymethod?.gateway?.toUpperCase?.(), event?.paymethod?.name)
|
|
665
|
+
: order?.paymethod?.id === event?.paymethod_id
|
|
666
|
+
? t(order?.paymethod?.gateway?.toUpperCase?.(), order?.paymethod?.name)
|
|
667
|
+
: ''}
|
|
650
668
|
</OText>
|
|
651
|
-
{/* {event?.data?.charge_id && (
|
|
652
|
-
<OText>
|
|
653
|
-
{`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
|
|
654
|
-
</OText>
|
|
655
|
-
)} */}
|
|
656
669
|
</View>
|
|
657
670
|
<OText>
|
|
658
671
|
{(event?.paymethod?.gateway === 'cash' && order?.cash)
|
|
@@ -664,7 +677,65 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
664
677
|
</View>
|
|
665
678
|
</View>
|
|
666
679
|
)}
|
|
680
|
+
|
|
667
681
|
</OrderBill >
|
|
682
|
+
|
|
683
|
+
{!!order?.spot_number && (
|
|
684
|
+
<OrderSpot vehicleExists={!!order?.vehicle}>
|
|
685
|
+
<Table>
|
|
686
|
+
<OText style={{ marginBottom: 5 }}>
|
|
687
|
+
{t('SPOT_NUMBER', 'Spot number')}
|
|
688
|
+
</OText>
|
|
689
|
+
<OText style={{ marginBottom: 5 }}>
|
|
690
|
+
{order?.spot_number}
|
|
691
|
+
</OText>
|
|
692
|
+
</Table>
|
|
693
|
+
</OrderSpot>
|
|
694
|
+
)}
|
|
695
|
+
|
|
696
|
+
{!!order?.vehicle && (
|
|
697
|
+
<OrderVehicle>
|
|
698
|
+
<OText
|
|
699
|
+
style={{ marginBottom: 5 }}
|
|
700
|
+
size={16}
|
|
701
|
+
weight="600"
|
|
702
|
+
color={theme.colors.textGray}>
|
|
703
|
+
{t('VEHICLE', 'Vehicle')}
|
|
704
|
+
</OText>
|
|
705
|
+
<Table>
|
|
706
|
+
<OText style={{ marginBottom: 5 }}>
|
|
707
|
+
{t('CAR_REGISTRATION', 'Car registration')}
|
|
708
|
+
</OText>
|
|
709
|
+
<OText style={{ marginBottom: 5 }}>
|
|
710
|
+
{order?.vehicle?.car_registration}
|
|
711
|
+
</OText>
|
|
712
|
+
</Table>
|
|
713
|
+
<Table>
|
|
714
|
+
<OText style={{ marginBottom: 5 }}>
|
|
715
|
+
{t('COLOR', 'Color')}
|
|
716
|
+
</OText>
|
|
717
|
+
<OText style={{ marginBottom: 5 }}>
|
|
718
|
+
{order?.vehicle?.color}
|
|
719
|
+
</OText>
|
|
720
|
+
</Table>
|
|
721
|
+
<Table>
|
|
722
|
+
<OText style={{ marginBottom: 5 }}>
|
|
723
|
+
{t('MODEL', 'Model')}
|
|
724
|
+
</OText>
|
|
725
|
+
<OText style={{ marginBottom: 5 }}>
|
|
726
|
+
{order?.vehicle?.model}
|
|
727
|
+
</OText>
|
|
728
|
+
</Table>
|
|
729
|
+
<Table>
|
|
730
|
+
<OText style={{ marginBottom: 5 }}>
|
|
731
|
+
{t('TYPE', 'Type')}
|
|
732
|
+
</OText>
|
|
733
|
+
<OText style={{ marginBottom: 5 }}>
|
|
734
|
+
{order?.vehicle?.type}
|
|
735
|
+
</OText>
|
|
736
|
+
</Table>
|
|
737
|
+
</OrderVehicle>
|
|
738
|
+
)}
|
|
668
739
|
<OModal
|
|
669
740
|
open={openReviewModal}
|
|
670
741
|
onClose={() => setOpenReviewModal(false)}
|
|
@@ -3,7 +3,9 @@ import React from 'react';
|
|
|
3
3
|
//Styles
|
|
4
4
|
import {
|
|
5
5
|
Actions,
|
|
6
|
+
Dot,
|
|
6
7
|
Header,
|
|
8
|
+
Messages,
|
|
7
9
|
OrderHeader,
|
|
8
10
|
} from './styles';
|
|
9
11
|
|
|
@@ -22,6 +24,8 @@ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityI
|
|
|
22
24
|
import {
|
|
23
25
|
useLanguage,
|
|
24
26
|
useUtils,
|
|
27
|
+
useConfig,
|
|
28
|
+
useSession
|
|
25
29
|
} from 'ordering-components/native';
|
|
26
30
|
|
|
27
31
|
interface OrderHeader {
|
|
@@ -34,6 +38,8 @@ interface OrderHeader {
|
|
|
34
38
|
handleViewSummaryOrder?: any;
|
|
35
39
|
handleCopyClipboard?: any
|
|
36
40
|
isCustomView?: any
|
|
41
|
+
messages?: any
|
|
42
|
+
messagesReadList?: any
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
@@ -45,12 +51,21 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
45
51
|
getOrderStatus,
|
|
46
52
|
logisticOrderStatus,
|
|
47
53
|
handleViewSummaryOrder,
|
|
48
|
-
handleCopyClipboard
|
|
54
|
+
handleCopyClipboard,
|
|
55
|
+
messages,
|
|
56
|
+
messagesReadList
|
|
49
57
|
} = props
|
|
50
58
|
const theme = useTheme();
|
|
51
59
|
const [, t] = useLanguage();
|
|
52
|
-
const [
|
|
60
|
+
const [configState] = useConfig()
|
|
61
|
+
const [{ user }] = useSession()
|
|
62
|
+
const [{ parseDate, parsePrice }] = useUtils();
|
|
53
63
|
const paymethodsLength = order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
|
|
64
|
+
const showExternalId = configState?.configs?.change_order_id?.value === '1'
|
|
65
|
+
const messagesReadIds = messagesReadList?.map((message: any) => message?.order_message_id)
|
|
66
|
+
|
|
67
|
+
const filteredMessages = messagesReadList?.length > 0 ? messages?.messages?.filter((message: any) => !messagesReadIds?.includes(message?.id)) : messages?.messages
|
|
68
|
+
const cateringTypes = [7, 8]
|
|
54
69
|
|
|
55
70
|
const styles = StyleSheet.create({
|
|
56
71
|
icons: {
|
|
@@ -88,6 +103,11 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
88
103
|
19: theme.colors.statusOrderBlue,
|
|
89
104
|
20: theme.colors.statusOrderBlue,
|
|
90
105
|
21: theme.colors.statusOrderBlue,
|
|
106
|
+
22: theme.colors.statusOrderBlue,
|
|
107
|
+
23: theme.colors.statusOrderBlue,
|
|
108
|
+
24: theme.colors.statusOrderBlue,
|
|
109
|
+
25: theme.colors.statusOrderBlue,
|
|
110
|
+
26: theme.colors.statusOrderBlue,
|
|
91
111
|
//GREEN
|
|
92
112
|
1: theme.colors.statusOrderGreen,
|
|
93
113
|
11: theme.colors.statusOrderGreen,
|
|
@@ -125,11 +145,26 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
125
145
|
const paymethodsList = order?.payment_events?.filter((item: any) => item.event === 'payment').map((paymethod: any) => {
|
|
126
146
|
return paymethod?.wallet_event
|
|
127
147
|
? walletName[paymethod?.wallet_event?.wallet?.type]?.name
|
|
128
|
-
:
|
|
148
|
+
: paymethod?.paymethod?.gateway && paymethod?.paymethod?.gateway === 'cash' && order?.cash > 0
|
|
149
|
+
? `${t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
|
|
150
|
+
: paymethod?.paymethod?.gateway
|
|
151
|
+
? t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
|
|
152
|
+
: t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
|
|
129
153
|
})
|
|
130
154
|
return paymethodsList.join(', ')
|
|
131
155
|
}
|
|
132
156
|
|
|
157
|
+
const deliveryDate = () => {
|
|
158
|
+
const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
|
|
159
|
+
const currentDate = new Date();
|
|
160
|
+
const receivedDate: any = new Date(order?.delivery_datetime);
|
|
161
|
+
|
|
162
|
+
const formattedDate = receivedDate <= currentDate
|
|
163
|
+
? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
|
|
164
|
+
: parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
|
|
165
|
+
return formattedDate
|
|
166
|
+
}
|
|
167
|
+
|
|
133
168
|
return (
|
|
134
169
|
<>
|
|
135
170
|
{!props.isCustomView && (
|
|
@@ -173,18 +208,20 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
173
208
|
style={styles.icons}
|
|
174
209
|
onClick={() => handleOpenMapView()}
|
|
175
210
|
/>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
211
|
+
<Messages>
|
|
212
|
+
{filteredMessages?.filter((message: any) => message?.author_id !== user?.id && !message?.read)?.length > 0 && <Dot />}
|
|
213
|
+
<OIconButton
|
|
214
|
+
icon={theme.images.general.messages}
|
|
215
|
+
iconStyle={{
|
|
216
|
+
width: 20,
|
|
217
|
+
height: 20,
|
|
218
|
+
tintColor: theme.colors.textGray,
|
|
219
|
+
}}
|
|
220
|
+
borderColor={theme.colors.clear}
|
|
221
|
+
style={styles.icons}
|
|
222
|
+
onClick={() => handleOpenMessagesForBusiness()}
|
|
223
|
+
/>
|
|
224
|
+
</Messages>
|
|
188
225
|
</Actions>
|
|
189
226
|
)}
|
|
190
227
|
</Header>
|
|
@@ -192,16 +229,18 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
192
229
|
<OrderHeader>
|
|
193
230
|
{!props.isCustomView ? (
|
|
194
231
|
<OText size={13} style={{ marginBottom: 5 }}>
|
|
195
|
-
|
|
196
|
-
? parseDate(order?.
|
|
197
|
-
|
|
232
|
+
<>
|
|
233
|
+
{cateringTypes.includes(order?.delivery_type) ? `${t('CREATED_AT', 'Created at')}: ${parseDate(order?.created_at)}\n` : ''}
|
|
234
|
+
{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}: ` : ''}{deliveryDate()}
|
|
235
|
+
</>
|
|
198
236
|
</OText>
|
|
199
237
|
) : (
|
|
200
238
|
<Header style={{ alignItems: 'center' }}>
|
|
201
239
|
<OText size={13} style={{ marginBottom: 5 }}>
|
|
202
|
-
|
|
203
|
-
? parseDate(order?.
|
|
204
|
-
|
|
240
|
+
<>
|
|
241
|
+
{cateringTypes.includes(order?.delivery_type) ? `${t('CREATED_AT', 'Created at')}: ${parseDate(order?.created_at)}\n` : ''}
|
|
242
|
+
{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}: ` : ''}{deliveryDate()}
|
|
243
|
+
</>
|
|
205
244
|
</OText>
|
|
206
245
|
|
|
207
246
|
{(!order?.isLogistic || (!logisticOrderStatus?.includes(order?.status) && !order?.order_group)) && (
|
|
@@ -240,7 +279,6 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
240
279
|
style={styles.icons}
|
|
241
280
|
onClick={() => handleOpenMapView()}
|
|
242
281
|
/>
|
|
243
|
-
|
|
244
282
|
<OIconButton
|
|
245
283
|
icon={theme.images.general.messages}
|
|
246
284
|
iconStyle={{
|
|
@@ -259,7 +297,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
259
297
|
|
|
260
298
|
<OText numberOfLines={2} size={20} weight="600">
|
|
261
299
|
<>
|
|
262
|
-
{`${t('INVOICE_ORDER_NO', 'Order No.')} ${order?.id} `}
|
|
300
|
+
{`${t('INVOICE_ORDER_NO', 'Order No.')} ${showExternalId ? order?.external_id || order?.id : order?.id} `}
|
|
263
301
|
{!order?.isLogistic && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
|
|
264
302
|
<>
|
|
265
303
|
{t('IS', 'is')}{' '}
|
|
@@ -273,7 +311,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
273
311
|
)}
|
|
274
312
|
</>
|
|
275
313
|
</OText>
|
|
276
|
-
{order?.external_id && (
|
|
314
|
+
{order?.external_id && !showExternalId && (
|
|
277
315
|
<OText size={13}>
|
|
278
316
|
<OText size={13} weight='bold'>{`${t('EXTERNAL_ID', 'External ID :')} `}</OText>
|
|
279
317
|
{order?.external_id}
|
|
@@ -25,13 +25,13 @@ export const Logo = styled.View`
|
|
|
25
25
|
|
|
26
26
|
export const OrderContent = styled.View`
|
|
27
27
|
flex: 1;
|
|
28
|
-
${(props
|
|
28
|
+
${(props: any) => props.isOrderGroup && css`
|
|
29
29
|
border-color: rgba(0, 0, 0, 0.2);
|
|
30
30
|
border-width: 1px;
|
|
31
31
|
padding: 10px;
|
|
32
32
|
`
|
|
33
33
|
}
|
|
34
|
-
${(props
|
|
34
|
+
${(props: any) => props.lastOrder && css`
|
|
35
35
|
margin-bottom: 50px;
|
|
36
36
|
`}
|
|
37
37
|
`;
|
|
@@ -68,7 +68,28 @@ export const Table = styled.View`
|
|
|
68
68
|
|
|
69
69
|
export const OrderBill = styled.View`
|
|
70
70
|
padding-vertical: 20px;
|
|
71
|
-
|
|
71
|
+
${(props: any) => !props.vehicleExists && css`
|
|
72
|
+
padding-bottom: 50px;
|
|
73
|
+
`
|
|
74
|
+
}
|
|
75
|
+
flex: 1;
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
export const OrderVehicle = styled.View`
|
|
79
|
+
border-top-width: 1px;
|
|
80
|
+
border-top-color: ${(props: any) => props.theme.colors.borderTops};
|
|
81
|
+
padding-vertical: 20px;
|
|
82
|
+
padding-bottom: 50px;
|
|
83
|
+
flex: 1;
|
|
84
|
+
`;
|
|
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
|
+
`}
|
|
72
93
|
flex: 1;
|
|
73
94
|
`;
|
|
74
95
|
|
|
@@ -98,3 +119,18 @@ export const OSRow = styled.View`
|
|
|
98
119
|
width: 70%;
|
|
99
120
|
flex-wrap: wrap;
|
|
100
121
|
`
|
|
122
|
+
|
|
123
|
+
export const Messages = styled.View`
|
|
124
|
+
position: relative;
|
|
125
|
+
`;
|
|
126
|
+
|
|
127
|
+
export const Dot = styled.View`
|
|
128
|
+
position: absolute;
|
|
129
|
+
width: 8px;
|
|
130
|
+
height: 8px;
|
|
131
|
+
border-radius: 4px;
|
|
132
|
+
background-color: ${(props: any) => props.theme.colors.red};
|
|
133
|
+
top: 10px;
|
|
134
|
+
right: 10px;
|
|
135
|
+
z-index: 99;
|
|
136
|
+
`;
|