ordering-ui-react-native 0.21.94 → 0.21.95-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/context/OfflineActions/index.tsx +236 -0
- 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 +15 -3
- package/themes/business/src/components/DriverMap/index.tsx +49 -27
- package/themes/business/src/components/FloatingButton/index.tsx +3 -2
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- 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 +49 -29
- package/themes/business/src/components/OrderDetails/Business.tsx +74 -9
- package/themes/business/src/components/OrderDetails/Delivery.tsx +138 -55
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +125 -43
- 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 +210 -65
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +219 -150
- 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/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +43 -25
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- 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 +15 -5
- 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/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 +73 -70
- package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
- 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 +2 -4
- package/themes/original/src/components/Checkout/index.tsx +104 -58
- 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 +29 -17
- 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 +129 -85
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
- 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 +16 -6
- package/themes/original/src/components/OrderSummary/index.tsx +29 -10
- 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 +6 -4
- 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
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { Platform } from 'react-native'
|
|
2
|
+
import { useConfig, useUtils, useLanguage} from 'ordering-components/native'
|
|
3
|
+
|
|
4
|
+
import { verifyDecimals, getProductPrice } from '../../utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Hook to create commands for star micronics printer using PassPRNT library
|
|
8
|
+
* @returns array of strings
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export const usePrinterCommands = () => {
|
|
12
|
+
const [, t] = useLanguage()
|
|
13
|
+
const [{ configs }] = useConfig();
|
|
14
|
+
const [{ parsePrice, parseNumber, parseDate }] = useUtils();
|
|
15
|
+
|
|
16
|
+
const deliveryStatus: any = {
|
|
17
|
+
1: t('DELIVERY', 'Delivery'),
|
|
18
|
+
2: t('PICK_UP', 'Pick up'),
|
|
19
|
+
3: t('EAT_IN', 'Eat In'),
|
|
20
|
+
4: t('CURBSIDE', 'Curbside'),
|
|
21
|
+
5: t('DRIVER_THRU', 'Driver thru'),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const walletName: any = {
|
|
25
|
+
cash: {
|
|
26
|
+
name: t('CASH_WALLET', 'Cash Wallet')
|
|
27
|
+
},
|
|
28
|
+
credit_point: {
|
|
29
|
+
name: t('POINTS_WALLET', 'Points Wallet')
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const percentTip = (order: any) =>
|
|
34
|
+
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
35
|
+
!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
36
|
+
verifyDecimals(order?.summary?.driver_tip, parseNumber);
|
|
37
|
+
|
|
38
|
+
const handlePaymethodsListString = (order: any) => {
|
|
39
|
+
const paymethodsList = order?.payment_events?.filter((item: any) => item.event === 'payment').map((paymethod: any) => {
|
|
40
|
+
return paymethod?.wallet_event
|
|
41
|
+
? walletName[paymethod?.wallet_event?.wallet?.type]?.name
|
|
42
|
+
: paymethod?.paymethod?.gateway && paymethod?.paymethod?.gateway === 'cash' && order?.cash > 0
|
|
43
|
+
? `${t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
|
|
44
|
+
: paymethod?.paymethod?.gateway
|
|
45
|
+
? t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
|
|
46
|
+
: t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
|
|
47
|
+
})
|
|
48
|
+
return paymethodsList.join(', ')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const paymethodsLength = (order: any) => order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
|
|
52
|
+
|
|
53
|
+
const customerName = (order: any) => `${order?.customer?.name ?? ''} ${order?.customer?.middle_name ?? ''} ${order?.customer?.lastname ?? ''} ${order?.customer?.second_lastname ?? ''}`?.replace(' ', ' ')?.trim() ?? ''
|
|
54
|
+
|
|
55
|
+
const deliveryDate = (order: any) => {
|
|
56
|
+
const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
|
|
57
|
+
const currentDate = new Date();
|
|
58
|
+
const receivedDate: any = new Date(order?.delivery_datetime);
|
|
59
|
+
|
|
60
|
+
const formattedDate = receivedDate <= currentDate
|
|
61
|
+
? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
|
|
62
|
+
: parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
|
|
63
|
+
return formattedDate
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const generateProductsText = (order: any, { endLine }: any) => {
|
|
67
|
+
const list: any = []
|
|
68
|
+
|
|
69
|
+
if (order?.products.length) {
|
|
70
|
+
order?.products.map((product: any) => {
|
|
71
|
+
list.push(`${product?.quantity} ${product?.name} \t ${parsePrice(product.total ?? getProductPrice(product))}${endLine}`)
|
|
72
|
+
|
|
73
|
+
if (product?.ingredients?.length) {
|
|
74
|
+
list.push({ text: `\t ${t('INGREDIENTS', 'Ingredients')}:${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
75
|
+
product?.ingredients?.map((ingredient: any) => {
|
|
76
|
+
list.push({ text: `\t ${t('NO', 'No')} ${ingredient.name}${endLine}` , fontSize: Platform.OS === 'ios' ? 10 : 18 })
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
product.options?.map((option: any) => {
|
|
81
|
+
list.push({ text: `\t ${option.name}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
82
|
+
|
|
83
|
+
option.suboptions?.map((suboption: any) => {
|
|
84
|
+
const { quantity, name, position, price } = suboption
|
|
85
|
+
const pos = position && position !== 'whole' ? `(${t(position.toUpperCase(), position)})` : ''
|
|
86
|
+
const string = name !== 'No'
|
|
87
|
+
? pos
|
|
88
|
+
? `${quantity} x ${name} ${pos} +${parsePrice(price)}`
|
|
89
|
+
: `${quantity} x ${name} +${parsePrice(price)}`
|
|
90
|
+
: 'No'
|
|
91
|
+
|
|
92
|
+
list.push({ text: `\t\t ${string}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
if (product.comment) {
|
|
97
|
+
list.push({ text: `\t ${t('COMMENT', 'Comment')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
98
|
+
list.push({ text: `\t\t ${product.comment}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
list.push('_separator_')
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return list
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const paymethodsList = (order: any, { endLine }: any) => {
|
|
109
|
+
const list: any = []
|
|
110
|
+
|
|
111
|
+
if (order?.payment_events?.length > 0) {
|
|
112
|
+
order?.payment_events.map((event: any) => {
|
|
113
|
+
const payment = event?.wallet_event
|
|
114
|
+
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
115
|
+
: t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
|
|
116
|
+
|
|
117
|
+
const amount = (event?.paymethod?.gateway === 'cash' && order?.cash)
|
|
118
|
+
? parsePrice(order?.cash, { currency: order?.currency })
|
|
119
|
+
: `-${parsePrice(event?.amount, { currency: order?.currency })}`
|
|
120
|
+
|
|
121
|
+
list.push(`${payment} \t ${amount}${endLine}`)
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return list
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const replaceChars = (string: string) => {
|
|
129
|
+
const accents: any = {
|
|
130
|
+
'á': 'a',
|
|
131
|
+
'é': 'e',
|
|
132
|
+
'í': 'i',
|
|
133
|
+
'ó': 'o',
|
|
134
|
+
'ú': 'u',
|
|
135
|
+
'Á': 'A',
|
|
136
|
+
'É': 'E',
|
|
137
|
+
'Í': 'I',
|
|
138
|
+
'Ó': 'O',
|
|
139
|
+
'Ú': 'U',
|
|
140
|
+
'ü': 'u',
|
|
141
|
+
'Ü': 'U',
|
|
142
|
+
'ñ': 'n',
|
|
143
|
+
'Ñ': 'N',
|
|
144
|
+
"'": '',
|
|
145
|
+
"’": '',
|
|
146
|
+
"`": '',
|
|
147
|
+
};
|
|
148
|
+
return string.replace(/[áéíóúÁÉÍÓÚüÜñÑ'’`]/g, (match: any) => accents[match])
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const generateCommands = (order: any, printMode: string = 'append') => {
|
|
152
|
+
let commands: any = [];
|
|
153
|
+
|
|
154
|
+
const isAppendMode = printMode === 'append'
|
|
155
|
+
const jumpLine = isAppendMode ? '\n' : ' '
|
|
156
|
+
const endLine = isAppendMode ? '\n' : ''
|
|
157
|
+
|
|
158
|
+
const textProps = { fontSize: Platform.OS === 'ios' ? 12 : 22 }
|
|
159
|
+
|
|
160
|
+
const appends: any = [
|
|
161
|
+
{ text: `${t('ORDER_NO', 'Order No.')} ${order.id}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 16 : 24 } },
|
|
162
|
+
jumpLine,
|
|
163
|
+
`${order.orderStatus}${endLine}`,
|
|
164
|
+
{ text: `${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 22 } },
|
|
165
|
+
{ text: `${t(`PAYMENT_METHOD${paymethodsLength(order) > 1 ? 'S' : ''}`, `Payment method${paymethodsLength(order) > 1 ? 's' : ''}`)}: ${handlePaymethodsListString(order)}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 22 } },
|
|
166
|
+
`${!!order?.delivery_option ? { text: `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 22 } } : ''}`,
|
|
167
|
+
{ text: `${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 22 } },
|
|
168
|
+
'_separator_',
|
|
169
|
+
{ text: `${t('CUSTOMER_DETAILS', 'Customer details')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 24 } },
|
|
170
|
+
`${t('FULL_NAME', 'Full Name')}: ${customerName(order)}${endLine}`,
|
|
171
|
+
`${t('EMAIL', 'Email')}: ${order?.customer?.email}${endLine}`,
|
|
172
|
+
`${!!order?.customer?.cellphone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone}${endLine}` : ''}`,
|
|
173
|
+
`${!!order?.customer?.phone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone}${endLine}` : ''}`,
|
|
174
|
+
`${t('FULL_ADDRESS', 'Full Addres')}: ${order?.customer?.address}${endLine}`,
|
|
175
|
+
`${!!order?.customer?.internal_number ? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${order?.customer?.internal_number}${endLine}` : ''}`,
|
|
176
|
+
`${!!order?.customer?.zipcode ? `${t('ZIPCODE', 'Zipcode')}: ${order?.customer?.zipcode}${endLine}` : ''}`,
|
|
177
|
+
'_separator_',
|
|
178
|
+
{ text: `${t('BUSINESS_DETAILS', 'Business details')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 24 } },
|
|
179
|
+
`${order?.business?.name}${endLine}`,
|
|
180
|
+
`${order?.business?.email}${endLine}`,
|
|
181
|
+
`${!!order?.business?.cellphone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone}${endLine}` : ''}`,
|
|
182
|
+
`${!!order?.business?.phone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone}${endLine}` : ''}`,
|
|
183
|
+
`${t('ADDRESS', 'Address')}: ${order?.business?.address}${endLine}`,
|
|
184
|
+
`${!!order?.business?.address_notes ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes}${endLine}` : ''}`,
|
|
185
|
+
'_separator_',
|
|
186
|
+
{ text: `${t('ORDER_DETAILS', 'Order Details')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 24 } },
|
|
187
|
+
`${!!order?.comment ? `${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}${endLine}` : ''}`,
|
|
188
|
+
...generateProductsText(order, { endLine }),
|
|
189
|
+
`${t('SUBTOTAL', 'Subtotal')} \t\t ${parsePrice(order.tax_type === 1 ? (order?.summary?.subtotal + order?.summary?.tax) ?? 0 : order?.summary?.subtotal ?? 0)}${endLine}`,
|
|
190
|
+
`${order?.summary?.discount > 0 ? `${order?.offer_type === 1 ? `${t('DISCOUNT', 'Discount')} (${verifyDecimals(order?.offer_rate, parsePrice)}%)${endLine}` : t('DISCOUNT', 'Discount')} \t\t ${parsePrice(order?.summary?.discount)}${endLine}` : ''}`,
|
|
191
|
+
`${order?.tax_type !== 1 ? `${t('TAX', 'Tax')} (${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%) \t\t ${parsePrice(order?.summary?.tax ?? 0)}${endLine}` : ''}`,
|
|
192
|
+
`${order?.summary?.delivery_price > 0 && order.delivery_type !== 2 ? `${t('DELIVERY_FEE', 'Delivery Fee')} \t\t ${parsePrice(order?.summary?.delivery_price ?? 0)}${endLine}` : ''}`,
|
|
193
|
+
`${(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 ? `${t('DRIVER_TIP', 'Driver tip')} ${percentTip(order) ? `(${percentTip(order)}%)` : ''} \t\t ${parsePrice(order?.summary?.driver_tip ?? 0)}${endLine}` : ''}`,
|
|
194
|
+
`${order?.summary?.service_fee > 0 ? `${t('SERVICE_FEE', 'Service Fee')} (${verifyDecimals(order?.summary?.service_fee, parseNumber)}%) \t\t ${parsePrice(order?.summary?.service_fee ?? 0)}${endLine}` : ''}`,
|
|
195
|
+
'_separator_',
|
|
196
|
+
`${t('TOTAL', 'Total')} \t\t ${parsePrice(order?.summary?.total ?? 0)}${endLine}`,
|
|
197
|
+
jumpLine,
|
|
198
|
+
`${order?.payment_events?.length > 0 ? `${t('PAYMENTS', 'Payments')}${endLine}` : ''}`,
|
|
199
|
+
...paymethodsList(order, { endLine }),
|
|
200
|
+
jumpLine,
|
|
201
|
+
jumpLine,
|
|
202
|
+
]
|
|
203
|
+
|
|
204
|
+
commands = [
|
|
205
|
+
...commands,
|
|
206
|
+
...appends.map((append: any) => {
|
|
207
|
+
return append === '_separator_'
|
|
208
|
+
? { [printMode]: `-------------------------------------${endLine}` }
|
|
209
|
+
: {
|
|
210
|
+
[printMode]: replaceChars(append?.text ?? append),
|
|
211
|
+
...textProps,
|
|
212
|
+
...append?.props
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
]
|
|
216
|
+
|
|
217
|
+
return commands
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return { generateCommands }
|
|
221
|
+
}
|
|
@@ -44,6 +44,7 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
|
|
|
44
44
|
}>({ open: false, content: [], key: null });
|
|
45
45
|
|
|
46
46
|
const logisticOrderStatus = [4, 6, 7]
|
|
47
|
+
const deliveryTypes = [1, 7]
|
|
47
48
|
const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1'
|
|
48
49
|
|
|
49
50
|
const showFloatButtonsAcceptOrReject: any = {
|
|
@@ -99,7 +100,7 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
|
|
|
99
100
|
<View
|
|
100
101
|
style={{
|
|
101
102
|
height:
|
|
102
|
-
order?.status === 8 && order?.delivery_type
|
|
103
|
+
order?.status === 8 && deliveryTypes?.includes(order?.delivery_type) ? 50 : 35,
|
|
103
104
|
}}
|
|
104
105
|
/>
|
|
105
106
|
|
|
@@ -170,7 +171,7 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
|
|
|
170
171
|
secondButton={true}
|
|
171
172
|
firstColorCustom={theme.colors.red}
|
|
172
173
|
secondColorCustom={theme.colors.green}
|
|
173
|
-
widthButton={isHideRejectButtons ? '100%': '45%'}
|
|
174
|
+
widthButton={isHideRejectButtons ? '100%' : '45%'}
|
|
174
175
|
isHideRejectButtons={isHideRejectButtons}
|
|
175
176
|
/>
|
|
176
177
|
)}
|
|
@@ -75,6 +75,40 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
75
75
|
return array.join('')
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
const getIngredients = (ingredients: any) => {
|
|
79
|
+
const _ingredients: any = (ingredients.length > 0 && ingredients.filter((i: any) => !i.selected)) || []
|
|
80
|
+
const texts: any = []
|
|
81
|
+
|
|
82
|
+
_ingredients.map((ingredient: any) => {
|
|
83
|
+
texts.push(` ${t('NO', 'No')} ${ingredient.name} <br/>`)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
if (_ingredients.length) {
|
|
87
|
+
return `
|
|
88
|
+
<div style="font-size: 26px;width:100%">
|
|
89
|
+
<div style=width:90%;display:flex;justifyContent:center;margin:auto;">
|
|
90
|
+
<div>
|
|
91
|
+
${t('INGREDIENTS', 'Ingredients')}:
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
${texts.join('')}
|
|
95
|
+
</div>
|
|
96
|
+
`
|
|
97
|
+
}
|
|
98
|
+
return ''
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const deliveryDate = (order: any) => {
|
|
102
|
+
const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
|
|
103
|
+
const currentDate = new Date();
|
|
104
|
+
const receivedDate: any = new Date(order?.delivery_datetime);
|
|
105
|
+
|
|
106
|
+
const formattedDate = receivedDate <= currentDate
|
|
107
|
+
? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
|
|
108
|
+
: parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
|
|
109
|
+
return formattedDate
|
|
110
|
+
}
|
|
111
|
+
|
|
78
112
|
const theme = useTheme();
|
|
79
113
|
const percentTip =
|
|
80
114
|
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
@@ -97,7 +131,11 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
97
131
|
const paymethodsList = order?.payment_events?.filter((item: any) => item.event === 'payment').map((paymethod: any) => {
|
|
98
132
|
return paymethod?.wallet_event
|
|
99
133
|
? walletName[paymethod?.wallet_event?.wallet?.type]?.name
|
|
100
|
-
:
|
|
134
|
+
: paymethod?.paymethod?.gateway && paymethod?.paymethod?.gateway === 'cash' && order?.cash > 0
|
|
135
|
+
? `${t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
|
|
136
|
+
: paymethod?.paymethod?.gateway
|
|
137
|
+
? t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
|
|
138
|
+
: t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
|
|
101
139
|
})
|
|
102
140
|
return paymethodsList.join(', ')
|
|
103
141
|
}
|
|
@@ -110,15 +148,18 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
110
148
|
|
|
111
149
|
${orderStatus} </br>
|
|
112
150
|
|
|
113
|
-
${t('
|
|
114
|
-
}
|
|
151
|
+
${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}
|
|
115
152
|
</br>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
153
|
+
|
|
154
|
+
${!!order?.delivery_option
|
|
155
|
+
? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)
|
|
156
|
+
} </br>`
|
|
157
|
+
: ''
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}
|
|
120
161
|
</br>
|
|
121
|
-
${t(paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD', paymethodsLength > 1 ? 'Payment methods' : 'Payment method')}: ${handlePaymethodsListString()}
|
|
162
|
+
${t(paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD', paymethodsLength > 1 ? 'Payment methods' : 'Payment method')}: ${order?.payment_events?.length > 0 ? handlePaymethodsListString() : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}
|
|
122
163
|
</p>
|
|
123
164
|
|
|
124
165
|
<h1>${t('CUSTOMER_DETAILS', 'Customer details')}</h1>
|
|
@@ -126,8 +167,11 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
126
167
|
</br>
|
|
127
168
|
${t('EMAIL', 'Email')}: ${order?.customer?.email}
|
|
128
169
|
</br>
|
|
129
|
-
|
|
130
|
-
|
|
170
|
+
${!!order?.customer?.cellphone
|
|
171
|
+
? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone
|
|
172
|
+
} </br>`
|
|
173
|
+
: ''}
|
|
174
|
+
|
|
131
175
|
${!!order?.customer?.phone
|
|
132
176
|
? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone
|
|
133
177
|
} </br>`
|
|
@@ -146,20 +190,23 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
146
190
|
</p>
|
|
147
191
|
|
|
148
192
|
<h1>${t('BUSINESS_DETAILS', 'Business details')}</h1>
|
|
149
|
-
<p style="font-size: 27px">
|
|
150
|
-
${order?.business?.name}
|
|
151
|
-
</br>
|
|
193
|
+
<p style="font-size: 27px">
|
|
194
|
+
${order?.business?.name}
|
|
195
|
+
</br>
|
|
152
196
|
${order?.business?.email}
|
|
153
|
-
</br>
|
|
154
|
-
${
|
|
155
|
-
|
|
197
|
+
</br>
|
|
198
|
+
${!!order?.business?.cellphone
|
|
199
|
+
? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone
|
|
200
|
+
} </br>`
|
|
201
|
+
: ''
|
|
202
|
+
}
|
|
156
203
|
${!!order?.business?.phone
|
|
157
204
|
? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone
|
|
158
205
|
} </br>`
|
|
159
206
|
: ''
|
|
160
|
-
}
|
|
207
|
+
}
|
|
161
208
|
|
|
162
|
-
${t('ADDRESS', 'Address')}: ${order?.business?.address}
|
|
209
|
+
${t('ADDRESS', 'Address')}: ${order?.business?.address}
|
|
163
210
|
</br>
|
|
164
211
|
${!!order?.business?.address_notes
|
|
165
212
|
? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes
|
|
@@ -169,6 +216,8 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
169
216
|
</p>
|
|
170
217
|
<h1> ${t('ORDER_DETAILS', 'Order Details')}</h1>
|
|
171
218
|
|
|
219
|
+
${order?.comment ? ('</br>'+ t('ORDER_COMMENT', 'Order Comment') + ':' + order?.comment) : ''}
|
|
220
|
+
|
|
172
221
|
${order?.products.length &&
|
|
173
222
|
order?.products.map(
|
|
174
223
|
(product: any, i: number) =>
|
|
@@ -183,6 +232,8 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
183
232
|
</div>
|
|
184
233
|
</div>
|
|
185
234
|
|
|
235
|
+
${getIngredients(product?.ingredients)}
|
|
236
|
+
|
|
186
237
|
<div style="font-size: 26px;width:100%">
|
|
187
238
|
<div style="width:90%;display:flex;justifyContent:center;margin:auto;">
|
|
188
239
|
${getOptions(product.options, product.comment)}
|
|
@@ -243,9 +294,9 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
243
294
|
: ''
|
|
244
295
|
}
|
|
245
296
|
|
|
246
|
-
${order?.summary?.delivery_price > 0 ?
|
|
297
|
+
${order?.summary?.delivery_price > 0 && order.delivery_type !== 2 ?
|
|
247
298
|
` <div style="display: flex">
|
|
248
|
-
<div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
|
|
299
|
+
<div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
|
|
249
300
|
${t('DELIVERY_FEE', 'Delivery Fee')}
|
|
250
301
|
</div>
|
|
251
302
|
|
|
@@ -257,7 +308,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
257
308
|
</div>
|
|
258
309
|
<div style="display: flex">
|
|
259
310
|
|
|
260
|
-
<div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
|
|
311
|
+
<div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
|
|
261
312
|
${t('DRIVER_TIP', 'Driver tip')}
|
|
262
313
|
${percentTip ? `(${percentTip}%)` : ''}
|
|
263
314
|
</div>
|
|
@@ -268,22 +319,23 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
268
319
|
|
|
269
320
|
</div>
|
|
270
321
|
|
|
271
|
-
|
|
322
|
+
${order?.summary?.service_fee > 0 && `
|
|
323
|
+
<div style="display: flex">
|
|
324
|
+
<div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
|
|
325
|
+
${t('SERVICE_FEE', 'Service Fee')}
|
|
326
|
+
(${verifyDecimals(order?.summary?.service_fee, parseNumber)}%)
|
|
327
|
+
</div>
|
|
272
328
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
</div>
|
|
329
|
+
<div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
|
|
330
|
+
${parsePrice(order?.summary?.service_fee ?? 0)}
|
|
331
|
+
</div>
|
|
277
332
|
|
|
278
|
-
<div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
|
|
279
|
-
${parsePrice(order?.summary?.service_fee ?? 0)}
|
|
280
333
|
</div>
|
|
281
|
-
|
|
282
|
-
</div>
|
|
334
|
+
`}
|
|
283
335
|
|
|
284
336
|
<div style="display: flex">
|
|
285
337
|
|
|
286
|
-
<div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start; font-weight: bold">
|
|
338
|
+
<div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start; font-weight: bold">
|
|
287
339
|
${t('TOTAL', 'Total')}
|
|
288
340
|
</div>
|
|
289
341
|
|
|
@@ -292,7 +344,36 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
292
344
|
</div>
|
|
293
345
|
|
|
294
346
|
</div>
|
|
295
|
-
|
|
347
|
+
|
|
348
|
+
${order?.payment_events.length && `
|
|
349
|
+
<div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start; font-weight: bold">
|
|
350
|
+
${t('PAYMENTS', 'Payments')}
|
|
351
|
+
</div>
|
|
352
|
+
`}
|
|
353
|
+
|
|
354
|
+
${order?.payment_events.length &&
|
|
355
|
+
order?.payment_events.map(
|
|
356
|
+
(event: any, i: number) =>
|
|
357
|
+
`<div style="display: flex;flexDirection:row;flex-wrap:wrap">
|
|
358
|
+
<div style="display:flex;width:100%">
|
|
359
|
+
<div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
|
|
360
|
+
${event?.wallet_event
|
|
361
|
+
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
362
|
+
: event?.paymethod?.gateway && event?.paymethod?.gateway === 'cash' && order?.cash > 0
|
|
363
|
+
? `${t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
|
|
364
|
+
: event?.paymethod?.gateway
|
|
365
|
+
? t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)
|
|
366
|
+
: t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
<div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
|
|
370
|
+
${(event?.paymethod?.gateway === 'cash' && order?.cash)
|
|
371
|
+
? parsePrice(order?.cash, { currency: order?.currency })
|
|
372
|
+
: `-${parsePrice(event?.amount, { currency: order?.currency })}`}
|
|
373
|
+
</div>
|
|
374
|
+
</div>
|
|
375
|
+
</div>`
|
|
376
|
+
)}
|
|
296
377
|
</div>`;
|
|
297
378
|
};
|
|
298
379
|
|
|
@@ -392,18 +473,25 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
392
473
|
</OText>
|
|
393
474
|
|
|
394
475
|
<OText style={{ marginBottom: 5 }}>
|
|
395
|
-
{`${t('
|
|
476
|
+
{`${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]
|
|
396
477
|
}`}
|
|
397
478
|
</OText>
|
|
398
479
|
|
|
480
|
+
{order?.delivery_option && (
|
|
481
|
+
<OText size={13}>
|
|
482
|
+
<OText size={13} weight='bold'>{`${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: `}</OText>
|
|
483
|
+
{t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
|
|
484
|
+
</OText>
|
|
485
|
+
)}
|
|
486
|
+
|
|
487
|
+
<OText style={{ marginBottom: 5 }}>
|
|
488
|
+
{`${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}`}
|
|
489
|
+
</OText>
|
|
490
|
+
|
|
399
491
|
<OText style={{ marginBottom: 5 }}>
|
|
400
|
-
{`${t('
|
|
401
|
-
? parseDate(order?.delivery_datetime_utc)
|
|
402
|
-
: parseDate(order?.delivery_datetime, { utc: false })
|
|
403
|
-
}`}
|
|
492
|
+
{`${t(`${paymethodsLength > 1? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}`, `${paymethodsLength > 1 ? 'Payment methods' : 'Payment method'}`)}: ${order?.payment_events?.length > 0 ? handlePaymethodsListString() : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}`}
|
|
404
493
|
</OText>
|
|
405
494
|
|
|
406
|
-
<OText style={{ marginBottom: 5 }}>{`${t(`${paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}`, `${paymethodsLength > 1 ? 'Payment methods' : 'Payment method'}`)}: ${handlePaymethodsListString()}`}</OText>
|
|
407
495
|
</OrderHeader>
|
|
408
496
|
|
|
409
497
|
<OrderCustomer>
|
|
@@ -435,16 +523,18 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
435
523
|
{`${t('EMAIL', 'Email')}: ${order?.customer?.email}`}
|
|
436
524
|
</OText>
|
|
437
525
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
|
|
526
|
+
{!!order?.customer?.cellphone && (
|
|
527
|
+
<OText
|
|
528
|
+
style={{ marginBottom: 5 }}
|
|
529
|
+
size={14}
|
|
530
|
+
numberOfLines={2}
|
|
531
|
+
adjustsFontSizeToFit
|
|
532
|
+
ellipsizeMode="tail"
|
|
533
|
+
color={theme.colors.textGray}>
|
|
534
|
+
{`${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone
|
|
535
|
+
}`}
|
|
536
|
+
</OText>
|
|
537
|
+
)}
|
|
448
538
|
|
|
449
539
|
{!!order?.customer?.phone && (
|
|
450
540
|
<OText
|
|
@@ -476,7 +566,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
476
566
|
</OText>
|
|
477
567
|
)}
|
|
478
568
|
|
|
479
|
-
{order?.customer?.address_notes && (
|
|
569
|
+
{!!order?.customer?.address_notes && (
|
|
480
570
|
<OText style={{ marginBottom: 5 }}>
|
|
481
571
|
{`${t('NOTES', 'Notes')}: ${order?.customer?.address_notes}`}
|
|
482
572
|
</OText>
|
|
@@ -575,6 +665,12 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
575
665
|
{t('ORDER_DETAILS', 'Order Details')}
|
|
576
666
|
</OText>
|
|
577
667
|
|
|
668
|
+
{!!order?.comment && (
|
|
669
|
+
<OText style={{ marginBottom: 5 }}>
|
|
670
|
+
{`${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}`}
|
|
671
|
+
</OText>
|
|
672
|
+
)}
|
|
673
|
+
|
|
578
674
|
{order?.products.length &&
|
|
579
675
|
order?.products.map((product: any, i: number) => (
|
|
580
676
|
<View key={i}>
|
|
@@ -642,7 +738,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
642
738
|
</Table>
|
|
643
739
|
)}
|
|
644
740
|
|
|
645
|
-
{order?.summary?.delivery_price > 0 && (
|
|
741
|
+
{order?.summary?.delivery_price > 0 && order.delivery_type !== 2 && (
|
|
646
742
|
<Table>
|
|
647
743
|
<OText style={{ marginBottom: 5 }}>
|
|
648
744
|
{t('DELIVERY_FEE', 'Delivery Fee')}
|
|
@@ -652,22 +748,24 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
652
748
|
</Table>
|
|
653
749
|
)}
|
|
654
750
|
|
|
655
|
-
|
|
656
|
-
<
|
|
657
|
-
{
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
751
|
+
{(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 && (
|
|
752
|
+
<Table>
|
|
753
|
+
<OText style={{ marginBottom: 5 }}>
|
|
754
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
755
|
+
{order?.summary?.driver_tip > 0 &&
|
|
756
|
+
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
757
|
+
!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
758
|
+
`(${verifyDecimals(
|
|
759
|
+
order?.summary?.driver_tip,
|
|
760
|
+
parseNumber,
|
|
761
|
+
)}%)`}
|
|
762
|
+
</OText>
|
|
666
763
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
764
|
+
<OText style={{ marginBottom: 5 }}>
|
|
765
|
+
{parsePrice(order?.summary?.driver_tip ?? 0)}
|
|
766
|
+
</OText>
|
|
767
|
+
</Table>
|
|
768
|
+
)}
|
|
671
769
|
|
|
672
770
|
{order?.summary?.service_fee > 0 && (
|
|
673
771
|
<Table>
|
|
@@ -693,6 +791,53 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
693
791
|
</OText>
|
|
694
792
|
</Table>
|
|
695
793
|
</Total>
|
|
794
|
+
|
|
795
|
+
{order?.payment_events?.length > 0 && (
|
|
796
|
+
<View>
|
|
797
|
+
<OText size={14} color={theme.colors.textNormal}>{t('PAYMENTS', 'Payments')}</OText>
|
|
798
|
+
<View
|
|
799
|
+
style={{
|
|
800
|
+
width: '100%',
|
|
801
|
+
marginTop: 5
|
|
802
|
+
}}
|
|
803
|
+
>
|
|
804
|
+
{order?.payment_events?.map((event: any) => (
|
|
805
|
+
<View
|
|
806
|
+
key={event.id}
|
|
807
|
+
style={{
|
|
808
|
+
display: 'flex',
|
|
809
|
+
flexDirection: 'row',
|
|
810
|
+
justifyContent: 'space-between',
|
|
811
|
+
alignItems: 'center',
|
|
812
|
+
marginBottom: 10
|
|
813
|
+
}}
|
|
814
|
+
>
|
|
815
|
+
<View
|
|
816
|
+
style={{
|
|
817
|
+
display: 'flex',
|
|
818
|
+
flexDirection: 'column',
|
|
819
|
+
}}
|
|
820
|
+
>
|
|
821
|
+
<OText>
|
|
822
|
+
{event?.wallet_event
|
|
823
|
+
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
824
|
+
: event?.paymethod?.gateway
|
|
825
|
+
? t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)
|
|
826
|
+
: order?.paymethod?.id === event?.paymethod_id
|
|
827
|
+
? t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
|
|
828
|
+
: ''}
|
|
829
|
+
</OText>
|
|
830
|
+
</View>
|
|
831
|
+
<OText>
|
|
832
|
+
{(event?.paymethod?.gateway === 'cash' && order?.cash)
|
|
833
|
+
? parsePrice(order?.cash, { currency: order?.currency })
|
|
834
|
+
: `-${parsePrice(event?.amount, { currency: order?.currency })}`}
|
|
835
|
+
</OText>
|
|
836
|
+
</View>
|
|
837
|
+
))}
|
|
838
|
+
</View>
|
|
839
|
+
</View>
|
|
840
|
+
)}
|
|
696
841
|
</OrderBill>
|
|
697
842
|
</OrderContent>
|
|
698
843
|
<View style={{ height: 40 }} />
|