ordering-ui-react-native 0.21.64 → 0.21.65-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/PaymentOptionsWebView/index.tsx +1 -0
- 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 +4 -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/Chat/index.tsx +3 -1
- package/themes/business/src/components/DriverMap/index.tsx +36 -23
- 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 +1 -2
- 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 +30 -15
- package/themes/business/src/components/NewOrderNotification/index.tsx +76 -26
- package/themes/business/src/components/OrderDetails/Business.tsx +63 -7
- package/themes/business/src/components/OrderDetails/Delivery.tsx +36 -21
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +122 -56
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -35
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderSummary/index.tsx +240 -76
- package/themes/business/src/components/OrdersListManager/index.tsx +9 -1
- package/themes/business/src/components/OrdersOption/index.tsx +249 -126
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +29 -19
- package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
- package/themes/business/src/components/PrinterEdition/index.tsx +363 -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/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- 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 +106 -54
- 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/types/index.tsx +23 -5
- package/themes/business/src/utils/index.tsx +19 -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 +13 -1
- 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 +6 -9
- package/themes/original/src/components/BusinessController/index.tsx +12 -7
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -7
- 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 +3 -3
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +28 -13
- 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 +17 -8
- package/themes/original/src/components/CartContent/index.tsx +60 -45
- package/themes/original/src/components/Checkout/index.tsx +94 -62
- 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/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- 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 +9 -11
- package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- 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 +1 -0
- package/themes/original/src/components/Messages/index.tsx +8 -7
- 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 +123 -62
- package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -14
- package/themes/original/src/components/MyOrders/index.tsx +21 -26
- package/themes/original/src/components/NavBar/index.tsx +4 -2
- 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/OrderHistory.tsx +5 -7
- package/themes/original/src/components/OrderDetails/index.tsx +5 -7
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +22 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +2 -4
- package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
- 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 +47 -6
- 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 +16 -19
- package/themes/original/src/components/ProductForm/index.tsx +120 -109
- 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 +112 -91
- 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 +65 -67
- package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +5 -6
- 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 +12 -36
- package/themes/original/src/components/StripeElementsForm/index.tsx +78 -59
- 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/UpsellingProducts/UpsellingContent.tsx +10 -7
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserFormDetails/index.tsx +83 -84
- package/themes/original/src/components/UserProfile/index.tsx +11 -2
- package/themes/original/src/components/Wallets/index.tsx +7 -4
- package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +8 -7
- package/themes/original/src/components/shared/OInput.tsx +1 -4
- package/themes/original/src/types/index.tsx +5 -1
- package/themes/original/src/utils/index.tsx +12 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react'
|
|
2
2
|
|
|
3
3
|
import { Platform, StyleSheet, View, TouchableOpacity, ScrollView } from 'react-native';
|
|
4
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
4
5
|
|
|
5
6
|
import { OButton, OText, OLink, OModal } from '../shared'
|
|
6
7
|
import {
|
|
@@ -12,6 +13,8 @@ import {
|
|
|
12
13
|
OrderBill,
|
|
13
14
|
Total,
|
|
14
15
|
OSRow,
|
|
16
|
+
OrderVehicle,
|
|
17
|
+
OrderSpot,
|
|
15
18
|
} from './styles';
|
|
16
19
|
|
|
17
20
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
@@ -53,6 +56,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
53
56
|
const WIDTH_SCREEN = orientationState?.dimensions?.width
|
|
54
57
|
|
|
55
58
|
const [openReviewModal, setOpenReviewModal] = useState(false)
|
|
59
|
+
const [showCustomFields, setShowCustomFields] = useState<boolean>(false);
|
|
56
60
|
|
|
57
61
|
const [isReadMore, setIsReadMore] = useState({
|
|
58
62
|
customerAddress: false,
|
|
@@ -134,27 +138,36 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
134
138
|
|
|
135
139
|
{order?.metafields?.length > 0 && (
|
|
136
140
|
<OrderBusiness>
|
|
137
|
-
<
|
|
138
|
-
{
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
141
|
+
<TouchableOpacity onPress={() => setShowCustomFields((prev: boolean) => !prev)} style={{ flexDirection: 'row', width: '100%', justifyContent: 'space-between', alignItems: 'flex-start' }}>
|
|
142
|
+
<OText style={{ marginBottom: 5 }} size={16} weight="600">
|
|
143
|
+
{t('CUSTOM_FIELDS', 'Custom fields')}
|
|
144
|
+
</OText>
|
|
145
|
+
<AntDesignIcon
|
|
146
|
+
name={showCustomFields ? 'up' : 'down'}
|
|
147
|
+
size={14}
|
|
148
|
+
/>
|
|
149
|
+
</TouchableOpacity>
|
|
150
|
+
{showCustomFields && (
|
|
151
|
+
<>
|
|
152
|
+
{order.metafields.map((field: any) => (
|
|
153
|
+
<View
|
|
154
|
+
key={field.id}
|
|
155
|
+
style={{
|
|
156
|
+
width: '100%',
|
|
157
|
+
flexDirection: 'row',
|
|
158
|
+
marginBottom: 5
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
<OText style={{ width: '50%' }}>
|
|
162
|
+
{field.key}
|
|
163
|
+
</OText>
|
|
164
|
+
<OText style={{ width: '45%', textAlign: 'right' }}>
|
|
165
|
+
{field.value}
|
|
166
|
+
</OText>
|
|
167
|
+
</View>
|
|
168
|
+
))}
|
|
169
|
+
</>
|
|
170
|
+
)}
|
|
158
171
|
</OrderBusiness>
|
|
159
172
|
)}
|
|
160
173
|
|
|
@@ -208,8 +221,8 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
208
221
|
<OLink
|
|
209
222
|
PressStyle={styles.linkWithIcons}
|
|
210
223
|
url={Platform.select({
|
|
211
|
-
ios: `maps:0,0?q=${order?.business?.address}`,
|
|
212
|
-
android: `geo:0,0?q=${order?.business?.address}`,
|
|
224
|
+
ios: `maps:0,0?q=${order?.business?.address}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
|
|
225
|
+
android: `geo:0,0?q=${order?.business?.address}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
|
|
213
226
|
})}
|
|
214
227
|
numberOfLines={2}
|
|
215
228
|
shorcut={order?.business?.address}
|
|
@@ -219,7 +232,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
219
232
|
)}
|
|
220
233
|
{!!order?.business?.location && order?.customer?.location && (
|
|
221
234
|
<OText>
|
|
222
|
-
{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
|
|
235
|
+
{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)}
|
|
223
236
|
</OText>
|
|
224
237
|
)}
|
|
225
238
|
{!!order?.business?.address_notes && (
|
|
@@ -228,8 +241,8 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
228
241
|
<OLink
|
|
229
242
|
PressStyle={styles.linkWithIcons}
|
|
230
243
|
url={Platform.select({
|
|
231
|
-
ios: `maps:0,0?q=${order?.business?.address_notes}`,
|
|
232
|
-
android: `geo:0,0?q=${order?.business?.address_notes}`,
|
|
244
|
+
ios: `maps:0,0?q=${order?.business?.address_notes}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
|
|
245
|
+
android: `geo:0,0?q=${order?.business?.address_notes}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
|
|
233
246
|
})}
|
|
234
247
|
shorcut={order?.business?.address_notes}
|
|
235
248
|
TextStyle={styles.textLink}
|
|
@@ -349,8 +362,8 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
349
362
|
<OLink
|
|
350
363
|
PressStyle={{ ...styles.linkWithIcons, marginBottom: 0 }}
|
|
351
364
|
url={Platform.select({
|
|
352
|
-
ios: `maps:0,0?q=${order?.customer?.address}`,
|
|
353
|
-
android: `geo:0,0?q=${order?.customer?.address}`,
|
|
365
|
+
ios: `maps:0,0?q=${order?.customer?.address}@${order?.customer?.location?.lat},${order?.customer?.location?.lng}`,
|
|
366
|
+
android: `geo:0,0?q=${order?.customer?.address}@${order?.customer?.location?.lat},${order?.customer?.location?.lng}`,
|
|
354
367
|
})}
|
|
355
368
|
onTextLayout={e => onTextLayout(e, 'customerAddress')}
|
|
356
369
|
numberOfLines={isReadMore.customerAddress ? 20 : 2}
|
|
@@ -397,26 +410,16 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
397
410
|
{t('ON_BEHALF_OF', 'On behalf of')}{': '} {order?.on_behalf_of}
|
|
398
411
|
</OText>
|
|
399
412
|
)}
|
|
400
|
-
{(
|
|
413
|
+
{(order?.delivery_option !== undefined && order?.delivery_type === 1) && (
|
|
401
414
|
<View style={{ marginTop: 10 }}>
|
|
402
415
|
{order?.delivery_option !== undefined && order?.delivery_type === 1 && (
|
|
403
416
|
<OText>
|
|
404
|
-
{t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
|
|
417
|
+
{t(order?.delivery_option?.name?.toUpperCase?.()?.replace(/ /g, '_'), order?.delivery_option?.name)}
|
|
405
418
|
</OText>
|
|
406
419
|
)}
|
|
407
|
-
{!!order?.comment && (
|
|
408
|
-
<>
|
|
409
|
-
<OText weight='500' style={{ marginBottom: 5 }}>
|
|
410
|
-
{t('ORDER_COMMENT', 'Order Comment')}
|
|
411
|
-
</OText>
|
|
412
|
-
<OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 20 }}>
|
|
413
|
-
{order?.comment}
|
|
414
|
-
</OText>
|
|
415
|
-
</>
|
|
416
|
-
)}
|
|
417
420
|
</View>
|
|
418
421
|
)}
|
|
419
|
-
{!order?.user_review && pastOrderStatuses.includes(order?.status) && (
|
|
422
|
+
{!order?.user_review && pastOrderStatuses.includes(order?.status) && order?.customer_id && (
|
|
420
423
|
<OButton
|
|
421
424
|
style={styles.btnReview}
|
|
422
425
|
textStyle={{ color: theme.colors.white }}
|
|
@@ -428,10 +431,16 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
428
431
|
</OrderCustomer>
|
|
429
432
|
|
|
430
433
|
<OrderProducts>
|
|
431
|
-
<OText style={{ marginBottom:
|
|
434
|
+
<OText style={{ marginBottom: 10 }} size={16} weight="600">
|
|
432
435
|
{t('ORDER_DETAILS', 'Order Details')}
|
|
433
436
|
</OText>
|
|
434
437
|
|
|
438
|
+
{!!order?.comment && (
|
|
439
|
+
<OText>
|
|
440
|
+
{`${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}`}
|
|
441
|
+
</OText>
|
|
442
|
+
)}
|
|
443
|
+
|
|
435
444
|
{order?.products?.length > 0 &&
|
|
436
445
|
order?.products.map((product: any, i: number) => (
|
|
437
446
|
<ProductItemAccordion
|
|
@@ -442,7 +451,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
442
451
|
))}
|
|
443
452
|
</OrderProducts>
|
|
444
453
|
|
|
445
|
-
<OrderBill>
|
|
454
|
+
<OrderBill vehicleExists={!!order?.vehicle}>
|
|
446
455
|
<Table>
|
|
447
456
|
<OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
448
457
|
<OText mBottom={4}>
|
|
@@ -467,7 +476,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
467
476
|
<Table key={offer.id}>
|
|
468
477
|
<OSRow>
|
|
469
478
|
<OText mBottom={4}>
|
|
470
|
-
{t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
|
|
479
|
+
{t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
|
|
471
480
|
{offer.rate_type === 1 && (
|
|
472
481
|
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
473
482
|
)}
|
|
@@ -513,7 +522,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
513
522
|
<Table key={tax.id}>
|
|
514
523
|
<OSRow>
|
|
515
524
|
<OText mBottom={4}>
|
|
516
|
-
{t(tax?.name?.toUpperCase()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
525
|
+
{t(tax?.name?.toUpperCase?.()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
517
526
|
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
|
|
518
527
|
</OText>
|
|
519
528
|
</OSRow>
|
|
@@ -526,7 +535,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
526
535
|
<Table key={fee.id}>
|
|
527
536
|
<OSRow>
|
|
528
537
|
<OText mBottom={4}>
|
|
529
|
-
{t(fee?.name?.toUpperCase()?.replace(/ /g, '_'), fee?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
538
|
+
{t(fee?.name?.toUpperCase?.()?.replace(/ /g, '_'), fee?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
530
539
|
({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency })} + `}{fee.percentage}%){' '}
|
|
531
540
|
</OText>
|
|
532
541
|
</OSRow>
|
|
@@ -539,7 +548,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
539
548
|
<Table key={offer.id}>
|
|
540
549
|
<OSRow>
|
|
541
550
|
<OText mBottom={4}>
|
|
542
|
-
{t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
|
|
551
|
+
{t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
|
|
543
552
|
{offer.rate_type === 1 && (
|
|
544
553
|
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
545
554
|
)}
|
|
@@ -550,7 +559,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
550
559
|
))
|
|
551
560
|
}
|
|
552
561
|
{
|
|
553
|
-
typeof order?.summary?.delivery_price === 'number' && (
|
|
562
|
+
typeof order?.summary?.delivery_price === 'number' && order.delivery_type !== 2 && (
|
|
554
563
|
<Table>
|
|
555
564
|
<OText mBottom={4}>
|
|
556
565
|
{t('DELIVERY_FEE', 'Delivery Fee')}
|
|
@@ -567,7 +576,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
567
576
|
<Table key={offer.id}>
|
|
568
577
|
<OSRow>
|
|
569
578
|
<OText mBottom={4}>
|
|
570
|
-
{t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
|
|
579
|
+
{t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
|
|
571
580
|
{offer.rate_type === 1 && (
|
|
572
581
|
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
573
582
|
)}
|
|
@@ -577,7 +586,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
577
586
|
</Table>
|
|
578
587
|
))
|
|
579
588
|
}
|
|
580
|
-
{(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && (
|
|
589
|
+
{(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 && (
|
|
581
590
|
<Table>
|
|
582
591
|
<OText mBottom={4}>
|
|
583
592
|
{t('DRIVER_TIP', 'Driver tip')}
|
|
@@ -635,13 +644,12 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
635
644
|
<OText>
|
|
636
645
|
{event?.wallet_event
|
|
637
646
|
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
638
|
-
:
|
|
647
|
+
: event?.paymethod?.gateway
|
|
648
|
+
? t(event?.paymethod?.gateway?.toUpperCase?.(), event?.paymethod?.name)
|
|
649
|
+
: order?.paymethod?.id === event?.paymethod_id
|
|
650
|
+
? t(order?.paymethod?.gateway?.toUpperCase?.(), order?.paymethod?.name)
|
|
651
|
+
: ''}
|
|
639
652
|
</OText>
|
|
640
|
-
{/* {event?.data?.charge_id && (
|
|
641
|
-
<OText>
|
|
642
|
-
{`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
|
|
643
|
-
</OText>
|
|
644
|
-
)} */}
|
|
645
653
|
</View>
|
|
646
654
|
<OText>
|
|
647
655
|
{(event?.paymethod?.gateway === 'cash' && order?.cash)
|
|
@@ -653,7 +661,65 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
653
661
|
</View>
|
|
654
662
|
</View>
|
|
655
663
|
)}
|
|
664
|
+
|
|
656
665
|
</OrderBill >
|
|
666
|
+
|
|
667
|
+
{!!order?.spot_number && (
|
|
668
|
+
<OrderSpot vehicleExists={!!order?.vehicle}>
|
|
669
|
+
<Table>
|
|
670
|
+
<OText style={{ marginBottom: 5 }}>
|
|
671
|
+
{t('SPOT_NUMBER', 'Spot number')}
|
|
672
|
+
</OText>
|
|
673
|
+
<OText style={{ marginBottom: 5 }}>
|
|
674
|
+
{order?.spot_number}
|
|
675
|
+
</OText>
|
|
676
|
+
</Table>
|
|
677
|
+
</OrderSpot>
|
|
678
|
+
)}
|
|
679
|
+
|
|
680
|
+
{!!order?.vehicle && (
|
|
681
|
+
<OrderVehicle>
|
|
682
|
+
<OText
|
|
683
|
+
style={{ marginBottom: 5 }}
|
|
684
|
+
size={16}
|
|
685
|
+
weight="600"
|
|
686
|
+
color={theme.colors.textGray}>
|
|
687
|
+
{t('VEHICLE', 'Vehicle')}
|
|
688
|
+
</OText>
|
|
689
|
+
<Table>
|
|
690
|
+
<OText style={{ marginBottom: 5 }}>
|
|
691
|
+
{t('CAR_REGISTRATION', 'Car registration')}
|
|
692
|
+
</OText>
|
|
693
|
+
<OText style={{ marginBottom: 5 }}>
|
|
694
|
+
{order?.vehicle?.car_registration}
|
|
695
|
+
</OText>
|
|
696
|
+
</Table>
|
|
697
|
+
<Table>
|
|
698
|
+
<OText style={{ marginBottom: 5 }}>
|
|
699
|
+
{t('COLOR', 'Color')}
|
|
700
|
+
</OText>
|
|
701
|
+
<OText style={{ marginBottom: 5 }}>
|
|
702
|
+
{order?.vehicle?.color}
|
|
703
|
+
</OText>
|
|
704
|
+
</Table>
|
|
705
|
+
<Table>
|
|
706
|
+
<OText style={{ marginBottom: 5 }}>
|
|
707
|
+
{t('MODEL', 'Model')}
|
|
708
|
+
</OText>
|
|
709
|
+
<OText style={{ marginBottom: 5 }}>
|
|
710
|
+
{order?.vehicle?.model}
|
|
711
|
+
</OText>
|
|
712
|
+
</Table>
|
|
713
|
+
<Table>
|
|
714
|
+
<OText style={{ marginBottom: 5 }}>
|
|
715
|
+
{t('TYPE', 'Type')}
|
|
716
|
+
</OText>
|
|
717
|
+
<OText style={{ marginBottom: 5 }}>
|
|
718
|
+
{order?.vehicle?.type}
|
|
719
|
+
</OText>
|
|
720
|
+
</Table>
|
|
721
|
+
</OrderVehicle>
|
|
722
|
+
)}
|
|
657
723
|
<OModal
|
|
658
724
|
open={openReviewModal}
|
|
659
725
|
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,11 +51,20 @@ 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();
|
|
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
|
|
53
68
|
|
|
54
69
|
const styles = StyleSheet.create({
|
|
55
70
|
icons: {
|
|
@@ -120,6 +135,30 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
120
135
|
? t('CURBSIDE', 'Curbside')
|
|
121
136
|
: t('DRIVER_THRU', 'Driver thru')
|
|
122
137
|
|
|
138
|
+
const handlePaymethodsListString = () => {
|
|
139
|
+
const paymethodsList = order?.payment_events?.filter((item: any) => item.event === 'payment').map((paymethod: any) => {
|
|
140
|
+
return paymethod?.wallet_event
|
|
141
|
+
? walletName[paymethod?.wallet_event?.wallet?.type]?.name
|
|
142
|
+
: paymethod?.paymethod?.gateway && paymethod?.paymethod?.gateway === 'cash' && order?.cash > 0
|
|
143
|
+
? `${t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
|
|
144
|
+
: paymethod?.paymethod?.gateway
|
|
145
|
+
? t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
|
|
146
|
+
: t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
|
|
147
|
+
})
|
|
148
|
+
return paymethodsList.join(', ')
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const deliveryDate = () => {
|
|
152
|
+
const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
|
|
153
|
+
const currentDate = new Date();
|
|
154
|
+
const receivedDate: any = new Date(order?.delivery_datetime);
|
|
155
|
+
|
|
156
|
+
const formattedDate = receivedDate <= currentDate
|
|
157
|
+
? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
|
|
158
|
+
: parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
|
|
159
|
+
return formattedDate
|
|
160
|
+
}
|
|
161
|
+
|
|
123
162
|
return (
|
|
124
163
|
<>
|
|
125
164
|
{!props.isCustomView && (
|
|
@@ -163,18 +202,20 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
163
202
|
style={styles.icons}
|
|
164
203
|
onClick={() => handleOpenMapView()}
|
|
165
204
|
/>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
205
|
+
<Messages>
|
|
206
|
+
{filteredMessages?.filter((message: any) => message?.author_id !== user?.id && !message?.read)?.length > 0 && <Dot />}
|
|
207
|
+
<OIconButton
|
|
208
|
+
icon={theme.images.general.messages}
|
|
209
|
+
iconStyle={{
|
|
210
|
+
width: 20,
|
|
211
|
+
height: 20,
|
|
212
|
+
tintColor: theme.colors.textGray,
|
|
213
|
+
}}
|
|
214
|
+
borderColor={theme.colors.clear}
|
|
215
|
+
style={styles.icons}
|
|
216
|
+
onClick={() => handleOpenMessagesForBusiness()}
|
|
217
|
+
/>
|
|
218
|
+
</Messages>
|
|
178
219
|
</Actions>
|
|
179
220
|
)}
|
|
180
221
|
</Header>
|
|
@@ -182,16 +223,12 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
182
223
|
<OrderHeader>
|
|
183
224
|
{!props.isCustomView ? (
|
|
184
225
|
<OText size={13} style={{ marginBottom: 5 }}>
|
|
185
|
-
{
|
|
186
|
-
? parseDate(order?.delivery_datetime_utc)
|
|
187
|
-
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
226
|
+
{deliveryDate()}
|
|
188
227
|
</OText>
|
|
189
228
|
) : (
|
|
190
229
|
<Header style={{ alignItems: 'center' }}>
|
|
191
230
|
<OText size={13} style={{ marginBottom: 5 }}>
|
|
192
|
-
{
|
|
193
|
-
? parseDate(order?.delivery_datetime_utc)
|
|
194
|
-
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
231
|
+
{deliveryDate()}
|
|
195
232
|
</OText>
|
|
196
233
|
|
|
197
234
|
{(!order?.isLogistic || (!logisticOrderStatus?.includes(order?.status) && !order?.order_group)) && (
|
|
@@ -230,7 +267,6 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
230
267
|
style={styles.icons}
|
|
231
268
|
onClick={() => handleOpenMapView()}
|
|
232
269
|
/>
|
|
233
|
-
|
|
234
270
|
<OIconButton
|
|
235
271
|
icon={theme.images.general.messages}
|
|
236
272
|
iconStyle={{
|
|
@@ -249,7 +285,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
249
285
|
|
|
250
286
|
<OText numberOfLines={2} size={20} weight="600">
|
|
251
287
|
<>
|
|
252
|
-
{`${t('INVOICE_ORDER_NO', 'Order No.')} ${order?.id} `}
|
|
288
|
+
{`${t('INVOICE_ORDER_NO', 'Order No.')} ${showExternalId ? order?.external_id || order?.id : order?.id} `}
|
|
253
289
|
{!order?.isLogistic && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
|
|
254
290
|
<>
|
|
255
291
|
{t('IS', 'is')}{' '}
|
|
@@ -263,7 +299,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
263
299
|
)}
|
|
264
300
|
</>
|
|
265
301
|
</OText>
|
|
266
|
-
{order?.external_id && (
|
|
302
|
+
{order?.external_id && !showExternalId && (
|
|
267
303
|
<OText size={13}>
|
|
268
304
|
<OText size={13} weight='bold'>{`${t('EXTERNAL_ID', 'External ID :')} `}</OText>
|
|
269
305
|
{order?.external_id}
|
|
@@ -283,20 +319,10 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
283
319
|
)}
|
|
284
320
|
<OText>
|
|
285
321
|
<OText size={13} weight='bold'>
|
|
286
|
-
{`${t('PAYMENT_METHODS', 'Payment methods')}: `}
|
|
322
|
+
{`${t(paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD', paymethodsLength > 1 ? 'Payment methods' : 'Payment method')}: `}
|
|
287
323
|
</OText>
|
|
288
324
|
{order?.payment_events?.length > 0 ? (
|
|
289
|
-
<OText size={13}>
|
|
290
|
-
{order?.payment_events?.map((event: any, idx: number) => {
|
|
291
|
-
return event?.wallet_event
|
|
292
|
-
? idx < order?.payment_events?.length - 1
|
|
293
|
-
? `${walletName[event?.wallet_event?.wallet?.type]?.name} - `
|
|
294
|
-
: walletName[event?.wallet_event?.wallet?.type]?.name
|
|
295
|
-
: idx < order?.payment_events?.length - 1
|
|
296
|
-
? `${t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)} - `
|
|
297
|
-
: t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
|
|
298
|
-
})}
|
|
299
|
-
</OText>
|
|
325
|
+
<OText size={13}>{`${handlePaymethodsListString()}`}</OText>
|
|
300
326
|
) : (
|
|
301
327
|
<OText size={13}>{t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}</OText>
|
|
302
328
|
)}
|
|
@@ -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: 10;
|
|
134
|
+
right: 10;
|
|
135
|
+
z-index: 99;
|
|
136
|
+
`;
|