ordering-ui-react-native 0.22.45 → 0.22.46-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 -8
- package/src/DeliveryApp.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +40 -39
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/context/OfflineActions/index.tsx +236 -0
- package/src/providers/AlertProvider.tsx +3 -1
- 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 +3 -2
- package/themes/business/src/components/Chat/index.tsx +15 -3
- package/themes/business/src/components/DriverMap/index.tsx +44 -33
- package/themes/business/src/components/FloatingButton/index.tsx +3 -2
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -1
- package/themes/business/src/components/LoginForm/index.tsx +123 -98
- package/themes/business/src/components/LogoutButton/index.tsx +13 -4
- package/themes/business/src/components/MapView/index.tsx +42 -22
- package/themes/business/src/components/NewOrderNotification/index.tsx +38 -19
- package/themes/business/src/components/OrderDetails/Business.tsx +88 -20
- package/themes/business/src/components/OrderDetails/Delivery.tsx +134 -53
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +155 -45
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +51 -28
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/OrderSummary/index.tsx +63 -42
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +332 -231
- package/themes/business/src/components/OrdersOption/styles.tsx +14 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +30 -18
- package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
- package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
- package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +143 -75
- package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +1 -1
- package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
- 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/UserProfileForm/index.tsx +48 -10
- package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/config/currency.tsx +1010 -0
- package/themes/business/src/hooks/useLocation.tsx +16 -12
- package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
- package/themes/business/src/types/index.tsx +22 -7
- package/themes/business/src/utils/index.tsx +28 -3
- 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 +9 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
- 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/PaymentOptions/index.tsx +121 -57
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +9 -1
- package/themes/original/src/components/AddressForm/index.tsx +19 -19
- package/themes/original/src/components/AddressList/index.tsx +0 -13
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +1 -1
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +14 -6
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +8 -6
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +46 -28
- 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 +10 -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/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +49 -15
- package/themes/original/src/components/CartContent/index.tsx +2 -4
- package/themes/original/src/components/Checkout/index.tsx +109 -88
- 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 -10
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -12
- 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 +0 -5
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -5
- package/themes/original/src/components/HelpGuide/index.tsx +0 -5
- package/themes/original/src/components/HelpOrder/index.tsx +0 -5
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +35 -19
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +12 -14
- package/themes/original/src/components/MessageListing/index.tsx +1 -6
- package/themes/original/src/components/Messages/index.tsx +20 -13
- package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
- package/themes/original/src/components/MomentOption/index.tsx +80 -57
- package/themes/original/src/components/MomentSelector/index.tsx +5 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -4
- package/themes/original/src/components/MultiCheckout/index.tsx +55 -27
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
- package/themes/original/src/components/MyOrders/index.tsx +2 -7
- package/themes/original/src/components/NavBar/index.tsx +7 -6
- 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/Notifications/index.tsx +0 -5
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +16 -11
- package/themes/original/src/components/OrderDetails/index.tsx +44 -21
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +4 -3
- package/themes/original/src/components/OrderSummary/index.tsx +32 -11
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -11
- 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 +462 -461
- package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -4
- package/themes/original/src/components/ProductForm/ActionButton.tsx +7 -12
- package/themes/original/src/components/ProductForm/index.tsx +107 -102
- package/themes/original/src/components/ProductItemAccordion/index.tsx +30 -38
- 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 +2 -7
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -7
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -6
- 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 -8
- package/themes/original/src/components/SignupForm/index.tsx +44 -37
- package/themes/original/src/components/SingleOrderCard/index.tsx +6 -4
- package/themes/original/src/components/SingleProductCard/index.tsx +5 -5
- 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 +16 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +8 -4
- package/themes/original/src/components/StripeElementsForm/naked.tsx +1 -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 +8 -5
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserDetails/index.tsx +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +113 -73
- package/themes/original/src/components/UserProfile/index.tsx +9 -1
- package/themes/original/src/components/UserProfileForm/index.tsx +0 -5
- package/themes/original/src/components/UserVerification/index.tsx +18 -5
- package/themes/original/src/components/Wallets/index.tsx +1 -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 +12 -4
- package/themes/original/src/utils/index.tsx +29 -0
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Platform } from 'react-native'
|
|
1
2
|
import { useConfig, useUtils, useLanguage} from 'ordering-components/native'
|
|
2
3
|
|
|
3
4
|
import { verifyDecimals, getProductPrice } from '../../utils';
|
|
@@ -70,14 +71,14 @@ export const usePrinterCommands = () => {
|
|
|
70
71
|
list.push(`${product?.quantity} ${product?.name} \t ${parsePrice(product.total ?? getProductPrice(product))}${endLine}`)
|
|
71
72
|
|
|
72
73
|
if (product?.ingredients?.length) {
|
|
73
|
-
list.push({ text: `\t ${t('INGREDIENTS', 'Ingredients')}:${endLine}`, props: { fontSize: 10 } })
|
|
74
|
+
list.push({ text: `\t ${t('INGREDIENTS', 'Ingredients')}:${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
74
75
|
product?.ingredients?.map((ingredient: any) => {
|
|
75
|
-
list.push({ text: `\t ${t('NO', 'No')} ${ingredient.name}${endLine}` , fontSize: 10 })
|
|
76
|
+
list.push({ text: `\t ${t('NO', 'No')} ${ingredient.name}${endLine}` , fontSize: Platform.OS === 'ios' ? 10 : 18 })
|
|
76
77
|
})
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
product.options?.map((option: any) => {
|
|
80
|
-
list.push({ text: `\t ${option.name}${endLine}`, props: { fontSize: 10 } })
|
|
81
|
+
list.push({ text: `\t ${option.name}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
81
82
|
|
|
82
83
|
option.suboptions?.map((suboption: any) => {
|
|
83
84
|
const { quantity, name, position, price } = suboption
|
|
@@ -88,13 +89,13 @@ export const usePrinterCommands = () => {
|
|
|
88
89
|
: `${quantity} x ${name} +${parsePrice(price)}`
|
|
89
90
|
: 'No'
|
|
90
91
|
|
|
91
|
-
list.push({ text: `\t\t ${string}${endLine}`, props: { fontSize: 10 } })
|
|
92
|
+
list.push({ text: `\t\t ${string}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
92
93
|
})
|
|
93
94
|
})
|
|
94
95
|
|
|
95
96
|
if (product.comment) {
|
|
96
|
-
list.push({ text: `\t ${t('COMMENT', 'Comment')}${endLine}`, props: { fontSize: 10 } })
|
|
97
|
-
list.push({ text: `\t\t ${product.comment}${endLine}`, props: { fontSize: 10 } })
|
|
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 } })
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
list.push('_separator_')
|
|
@@ -154,18 +155,18 @@ export const usePrinterCommands = () => {
|
|
|
154
155
|
const jumpLine = isAppendMode ? '\n' : ' '
|
|
155
156
|
const endLine = isAppendMode ? '\n' : ''
|
|
156
157
|
|
|
157
|
-
const textProps = { fontSize: 12 }
|
|
158
|
+
const textProps = { fontSize: Platform.OS === 'ios' ? 12 : 22 }
|
|
158
159
|
|
|
159
160
|
const appends: any = [
|
|
160
|
-
{ text: `${t('ORDER_NO', 'Order No.')} ${order.id}${endLine}`, props: { fontSize: 16 } },
|
|
161
|
+
{ text: `${t('ORDER_NO', 'Order No.')} ${order.id}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 16 : 24 } },
|
|
161
162
|
jumpLine,
|
|
162
163
|
`${order.orderStatus}${endLine}`,
|
|
163
|
-
{ text: `${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}${endLine}`, props: { fontSize: 14 } },
|
|
164
|
-
{ text: `${t(`PAYMENT_METHOD${paymethodsLength(order) > 1 ? 'S' : ''}`, `Payment method${paymethodsLength(order) > 1 ? 's' : ''}`)}: ${handlePaymethodsListString(order)}${endLine}`, props: { fontSize: 14 } },
|
|
165
|
-
`${!!order?.delivery_option ? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}${endLine}
|
|
166
|
-
`${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}${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 } },
|
|
167
168
|
'_separator_',
|
|
168
|
-
{ text: `${t('CUSTOMER_DETAILS', 'Customer details')}${endLine}`, props: { fontSize: 14 } },
|
|
169
|
+
{ text: `${t('CUSTOMER_DETAILS', 'Customer details')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 24 } },
|
|
169
170
|
`${t('FULL_NAME', 'Full Name')}: ${customerName(order)}${endLine}`,
|
|
170
171
|
`${t('EMAIL', 'Email')}: ${order?.customer?.email}${endLine}`,
|
|
171
172
|
`${!!order?.customer?.cellphone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone}${endLine}` : ''}`,
|
|
@@ -174,7 +175,7 @@ export const usePrinterCommands = () => {
|
|
|
174
175
|
`${!!order?.customer?.internal_number ? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${order?.customer?.internal_number}${endLine}` : ''}`,
|
|
175
176
|
`${!!order?.customer?.zipcode ? `${t('ZIPCODE', 'Zipcode')}: ${order?.customer?.zipcode}${endLine}` : ''}`,
|
|
176
177
|
'_separator_',
|
|
177
|
-
{ text: `${t('BUSINESS_DETAILS', 'Business details')}${endLine}`, props: { fontSize: 14 } },
|
|
178
|
+
{ text: `${t('BUSINESS_DETAILS', 'Business details')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 24 } },
|
|
178
179
|
`${order?.business?.name}${endLine}`,
|
|
179
180
|
`${order?.business?.email}${endLine}`,
|
|
180
181
|
`${!!order?.business?.cellphone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone}${endLine}` : ''}`,
|
|
@@ -182,7 +183,7 @@ export const usePrinterCommands = () => {
|
|
|
182
183
|
`${t('ADDRESS', 'Address')}: ${order?.business?.address}${endLine}`,
|
|
183
184
|
`${!!order?.business?.address_notes ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes}${endLine}` : ''}`,
|
|
184
185
|
'_separator_',
|
|
185
|
-
{ text: `${t('ORDER_DETAILS', 'Order Details')}${endLine}`, props: { fontSize: 14 } },
|
|
186
|
+
{ text: `${t('ORDER_DETAILS', 'Order Details')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 24 } },
|
|
186
187
|
`${!!order?.comment ? `${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}${endLine}` : ''}`,
|
|
187
188
|
...generateProductsText(order, { endLine }),
|
|
188
189
|
`${t('SUBTOTAL', 'Subtotal')} \t\t ${parsePrice(order.tax_type === 1 ? (order?.summary?.subtotal + order?.summary?.tax) ?? 0 : order?.summary?.subtotal ?? 0)}${endLine}`,
|
|
@@ -204,7 +205,7 @@ export const usePrinterCommands = () => {
|
|
|
204
205
|
...commands,
|
|
205
206
|
...appends.map((append: any) => {
|
|
206
207
|
return append === '_separator_'
|
|
207
|
-
? { [printMode]:
|
|
208
|
+
? { [printMode]: `-------------------------------------${endLine}` }
|
|
208
209
|
: {
|
|
209
210
|
[printMode]: replaceChars(append?.text ?? append),
|
|
210
211
|
...textProps,
|
|
@@ -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
|
)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { OText,
|
|
3
|
-
import { StyleSheet, View, Platform, Alert } from 'react-native';
|
|
2
|
+
import { OText, OIcon } from '../shared';
|
|
3
|
+
import { StyleSheet, View, Platform, Alert, TouchableOpacity } from 'react-native';
|
|
4
4
|
import {
|
|
5
5
|
Content,
|
|
6
6
|
OrderCustomer,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
ContentInfo,
|
|
16
16
|
} from './styles';
|
|
17
17
|
import { useUtils, useLanguage, useConfig } from 'ordering-components/native';
|
|
18
|
-
import { verifyDecimals, getProductPrice } from '../../utils';
|
|
18
|
+
import { verifyDecimals, getProductPrice, getCurrenySymbol } from '../../utils';
|
|
19
19
|
import { FloatingButton } from '../FloatingButton';
|
|
20
20
|
import RNHTMLtoPDF from 'react-native-html-to-pdf';
|
|
21
21
|
import RNPrint from 'react-native-print';
|
|
@@ -152,14 +152,14 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
152
152
|
</br>
|
|
153
153
|
|
|
154
154
|
${!!order?.delivery_option
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)
|
|
156
|
+
} </br>`
|
|
157
|
+
: ''
|
|
158
|
+
}
|
|
159
159
|
|
|
160
160
|
${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}
|
|
161
161
|
</br>
|
|
162
|
-
${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)}
|
|
163
163
|
</p>
|
|
164
164
|
|
|
165
165
|
<h1>${t('CUSTOMER_DETAILS', 'Customer details')}</h1>
|
|
@@ -168,9 +168,9 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
168
168
|
${t('EMAIL', 'Email')}: ${order?.customer?.email}
|
|
169
169
|
</br>
|
|
170
170
|
${!!order?.customer?.cellphone
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone
|
|
172
|
+
} </br>`
|
|
173
|
+
: ''}
|
|
174
174
|
|
|
175
175
|
${!!order?.customer?.phone
|
|
176
176
|
? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone
|
|
@@ -196,10 +196,10 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
196
196
|
${order?.business?.email}
|
|
197
197
|
</br>
|
|
198
198
|
${!!order?.business?.cellphone
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone
|
|
200
|
+
} </br>`
|
|
201
|
+
: ''
|
|
202
|
+
}
|
|
203
203
|
${!!order?.business?.phone
|
|
204
204
|
? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone
|
|
205
205
|
} </br>`
|
|
@@ -216,7 +216,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
216
216
|
</p>
|
|
217
217
|
<h1> ${t('ORDER_DETAILS', 'Order Details')}</h1>
|
|
218
218
|
|
|
219
|
-
${order?.comment ? ('</br>'+ t('ORDER_COMMENT', 'Order Comment') + ':' + order?.comment) : ''}
|
|
219
|
+
${order?.comment ? ('</br>' + t('ORDER_COMMENT', 'Order Comment') + ':' + order?.comment) : ''}
|
|
220
220
|
|
|
221
221
|
${order?.products.length &&
|
|
222
222
|
order?.products.map(
|
|
@@ -301,7 +301,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
301
301
|
</div>
|
|
302
302
|
|
|
303
303
|
<div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
|
|
304
|
-
${parsePrice(order?.summary?.delivery_price
|
|
304
|
+
${parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true), { currency: getCurrenySymbol(order?.currency) })}
|
|
305
305
|
</div>` :
|
|
306
306
|
''}
|
|
307
307
|
|
|
@@ -352,28 +352,28 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
352
352
|
`}
|
|
353
353
|
|
|
354
354
|
${order?.payment_events.length &&
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
355
|
+
order?.payment_events.map(
|
|
356
|
+
(event: any, i: number) =>
|
|
357
|
+
`<div style="display: flex;flexDirection:row;flex-wrap:wrap">
|
|
358
358
|
<div style="display:flex;width:100%">
|
|
359
359
|
<div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
|
|
360
360
|
${event?.wallet_event
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
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
367
|
</div>
|
|
368
368
|
|
|
369
369
|
<div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
|
|
370
370
|
${(event?.paymethod?.gateway === 'cash' && order?.cash)
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
? parsePrice(order?.cash, { currency: order?.currency })
|
|
372
|
+
: `-${parsePrice(event?.amount, { currency: order?.currency })}`}
|
|
373
373
|
</div>
|
|
374
374
|
</div>
|
|
375
375
|
</div>`
|
|
376
|
-
|
|
376
|
+
)}
|
|
377
377
|
</div>`;
|
|
378
378
|
};
|
|
379
379
|
|
|
@@ -418,8 +418,16 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
418
418
|
|
|
419
419
|
const styles = StyleSheet.create({
|
|
420
420
|
btnBackArrow: {
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
borderWidth: 0,
|
|
422
|
+
width: 32,
|
|
423
|
+
height: 32,
|
|
424
|
+
tintColor: theme.colors.textGray,
|
|
425
|
+
backgroundColor: theme.colors.clear,
|
|
426
|
+
borderColor: theme.colors.clear,
|
|
427
|
+
shadowColor: theme.colors.clear,
|
|
428
|
+
paddingLeft: 0,
|
|
429
|
+
paddingRight: 0,
|
|
430
|
+
marginTop: 10
|
|
423
431
|
},
|
|
424
432
|
textBold: {
|
|
425
433
|
fontWeight: '600',
|
|
@@ -445,18 +453,27 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
445
453
|
}
|
|
446
454
|
};
|
|
447
455
|
|
|
456
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
457
|
+
if (!order?.taxes) return 0
|
|
458
|
+
if (order?.taxes?.length === 0) {
|
|
459
|
+
return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
|
|
460
|
+
} else {
|
|
461
|
+
return order?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
462
|
+
return taxIncluded +
|
|
463
|
+
(((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
|
|
464
|
+
(isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
465
|
+
}, 0)
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
448
469
|
return (
|
|
449
470
|
<>
|
|
450
471
|
<Content>
|
|
451
472
|
<OrderContent>
|
|
452
473
|
<OrderHeader>
|
|
453
|
-
<
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
borderColor={theme.colors.clear}
|
|
457
|
-
style={{ maxWidth: 40, justifyContent: 'flex-end' }}
|
|
458
|
-
onClick={() => handleArrowBack()}
|
|
459
|
-
/>
|
|
474
|
+
<TouchableOpacity onPress={() => handleArrowBack()} style={styles.btnBackArrow}>
|
|
475
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
|
|
476
|
+
</TouchableOpacity>
|
|
460
477
|
<OText
|
|
461
478
|
style={{ marginBottom: 5 }}
|
|
462
479
|
size={15}
|
|
@@ -488,7 +505,9 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
488
505
|
{`${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}`}
|
|
489
506
|
</OText>
|
|
490
507
|
|
|
491
|
-
<OText style={{ marginBottom: 5 }}>
|
|
508
|
+
<OText style={{ marginBottom: 5 }}>
|
|
509
|
+
{`${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)}`}
|
|
510
|
+
</OText>
|
|
492
511
|
|
|
493
512
|
</OrderHeader>
|
|
494
513
|
|
|
@@ -564,7 +583,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
564
583
|
</OText>
|
|
565
584
|
)}
|
|
566
585
|
|
|
567
|
-
{order?.customer?.address_notes && (
|
|
586
|
+
{!!order?.customer?.address_notes && (
|
|
568
587
|
<OText style={{ marginBottom: 5 }}>
|
|
569
588
|
{`${t('NOTES', 'Notes')}: ${order?.customer?.address_notes}`}
|
|
570
589
|
</OText>
|
|
@@ -663,7 +682,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
663
682
|
{t('ORDER_DETAILS', 'Order Details')}
|
|
664
683
|
</OText>
|
|
665
684
|
|
|
666
|
-
{order?.comment && (
|
|
685
|
+
{!!order?.comment && (
|
|
667
686
|
<OText style={{ marginBottom: 5 }}>
|
|
668
687
|
{`${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}`}
|
|
669
688
|
</OText>
|
|
@@ -742,7 +761,9 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
742
761
|
{t('DELIVERY_FEE', 'Delivery Fee')}
|
|
743
762
|
</OText>
|
|
744
763
|
|
|
745
|
-
<OText>
|
|
764
|
+
<OText>
|
|
765
|
+
{parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true), { currency: getCurrenySymbol(order?.currency) })}
|
|
766
|
+
</OText>
|
|
746
767
|
</Table>
|
|
747
768
|
)}
|
|
748
769
|
|
|
@@ -846,6 +846,18 @@ export const OrdersListManager = (props: OrdersOptionParams) => {
|
|
|
846
846
|
{
|
|
847
847
|
key: 23,
|
|
848
848
|
text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
key: 24,
|
|
852
|
+
text: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order')
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
key: 25,
|
|
856
|
+
text: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
key: 26,
|
|
860
|
+
text: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer')
|
|
849
861
|
}
|
|
850
862
|
],
|
|
851
863
|
tabs: [
|
|
@@ -858,7 +870,7 @@ export const OrdersListManager = (props: OrdersOptionParams) => {
|
|
|
858
870
|
{
|
|
859
871
|
key: 1,
|
|
860
872
|
text: t('IN_PROGRESS', 'In Progress'),
|
|
861
|
-
tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
|
|
873
|
+
tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
|
|
862
874
|
title: 'inProgress',
|
|
863
875
|
},
|
|
864
876
|
{
|