ordering-ui-react-native 0.17.90 → 0.17.91-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 +8 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +1 -21
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +5 -0
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +37 -27
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +163 -123
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
- package/themes/business/src/components/LoginForm/index.tsx +15 -22
- package/themes/business/src/components/MapView/index.tsx +14 -10
- package/themes/business/src/components/MessagesOption/index.tsx +20 -93
- package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +202 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +81 -66
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +19 -18
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersOption/index.tsx +22 -22
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
- package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
- package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
- package/themes/business/src/components/StoresList/index.tsx +3 -4
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +25 -10
- package/themes/business/src/utils/index.tsx +29 -2
- 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/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
- 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/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +1 -1
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +35 -17
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +73 -37
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
- package/themes/original/src/components/BusinessController/index.tsx +35 -44
- package/themes/original/src/components/BusinessController/styles.tsx +12 -5
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
- package/themes/original/src/components/BusinessListingSearch/index.tsx +347 -341
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
- package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +664 -556
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +38 -405
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +57 -49
- package/themes/original/src/components/CartContent/index.tsx +102 -58
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/Checkout/index.tsx +277 -33
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DriverTips/index.tsx +14 -6
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/GPSButton/index.tsx +6 -4
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +86 -10
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +63 -7
- package/themes/original/src/components/Home/index.tsx +13 -4
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
- package/themes/original/src/components/LoginForm/index.tsx +64 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
- package/themes/original/src/components/MessageListing/index.tsx +9 -2
- package/themes/original/src/components/Messages/index.tsx +15 -4
- package/themes/original/src/components/MomentOption/index.tsx +193 -92
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
- package/themes/original/src/components/MultiCheckout/index.tsx +385 -46
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +23 -19
- package/themes/original/src/components/MyOrders/index.tsx +15 -4
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
- package/themes/original/src/components/OrderDetails/index.tsx +50 -38
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderSummary/index.tsx +83 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/index.tsx +43 -20
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +65 -29
- package/themes/original/src/components/PageBanner/styles.tsx +0 -3
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/index.tsx +87 -31
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
- package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
- package/themes/original/src/components/Promotions/index.tsx +2 -2
- package/themes/original/src/components/Promotions/styles.tsx +3 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +63 -20
- package/themes/original/src/components/SignupForm/index.tsx +43 -27
- package/themes/original/src/components/SingleOrderCard/index.tsx +42 -19
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +14 -11
- package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +5 -10
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +8 -26
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/Wallets/index.tsx +52 -62
- package/themes/original/src/components/Wallets/styles.tsx +2 -4
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +4 -5
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/types/index.tsx +37 -10
- package/themes/original/src/utils/index.tsx +185 -13
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -4,6 +4,7 @@ import { StyleSheet, View } from 'react-native';
|
|
|
4
4
|
|
|
5
5
|
// Thirds
|
|
6
6
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
7
|
+
import Clipboard from '@react-native-clipboard/clipboard';
|
|
7
8
|
|
|
8
9
|
//OrderingComponent
|
|
9
10
|
import {
|
|
@@ -12,6 +13,8 @@ import {
|
|
|
12
13
|
useToast,
|
|
13
14
|
useSession,
|
|
14
15
|
ToastType,
|
|
16
|
+
useUtils,
|
|
17
|
+
useConfig
|
|
15
18
|
} from 'ordering-components/native';
|
|
16
19
|
|
|
17
20
|
//Components
|
|
@@ -26,7 +29,7 @@ import { OrderDetailsParams } from '../../types';
|
|
|
26
29
|
import { USER_TYPE } from '../../config/constants';
|
|
27
30
|
import { useTheme } from 'styled-components/native';
|
|
28
31
|
import { NotFoundSource } from '../NotFoundSource';
|
|
29
|
-
import { getOrderStatus } from '../../utils';
|
|
32
|
+
import { verifyDecimals, getProductPrice, getOrderStatus } from '../../utils';
|
|
30
33
|
import { OrderHeaderComponent } from './OrderHeaderComponent';
|
|
31
34
|
import { OrderContentComponent } from './OrderContentComponent';
|
|
32
35
|
//Styles
|
|
@@ -52,10 +55,17 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
52
55
|
handleClickLogisticOrder,
|
|
53
56
|
forceUpdate,
|
|
54
57
|
getPermissions,
|
|
55
|
-
|
|
58
|
+
orderAssingId,
|
|
59
|
+
isGrantedPermissions,
|
|
56
60
|
} = props;
|
|
57
61
|
const [, { showToast }] = useToast();
|
|
62
|
+
const [{ parsePrice, parseNumber }] = useUtils();
|
|
63
|
+
const [{ configs }] = useConfig();
|
|
64
|
+
|
|
58
65
|
const { order } = props.order
|
|
66
|
+
|
|
67
|
+
const isAllowedDriverRejectOrder = configs?.allow_driver_reject_order?.value === '1'
|
|
68
|
+
const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1'
|
|
59
69
|
const theme = useTheme();
|
|
60
70
|
const [, t] = useLanguage();
|
|
61
71
|
const [session] = useSession();
|
|
@@ -75,12 +85,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
75
85
|
|
|
76
86
|
const validStatusComplete = [9, 19, 23]
|
|
77
87
|
|
|
88
|
+
const pendingOrderStatus = [1, 4, 7, 13]
|
|
89
|
+
|
|
78
90
|
const logisticOrderStatus = [4, 6, 7]
|
|
79
91
|
|
|
80
92
|
const showFloatButtonsPickUp: any = {
|
|
81
|
-
8:
|
|
93
|
+
8: !isHideRejectButtons,
|
|
82
94
|
3: true,
|
|
83
|
-
18:
|
|
95
|
+
18: !isHideRejectButtons,
|
|
84
96
|
};
|
|
85
97
|
|
|
86
98
|
const showFloatButtonsAcceptOrReject: any = {
|
|
@@ -133,7 +145,174 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
133
145
|
}
|
|
134
146
|
};
|
|
135
147
|
|
|
148
|
+
const getFormattedSubOptionName = ({ quantity, name, position, price }: any) => {
|
|
149
|
+
if (name !== 'No') {
|
|
150
|
+
const pos = position && position !== 'whole' ? `(${t(position.toUpperCase(), position)})` : '';
|
|
151
|
+
return pos
|
|
152
|
+
? `${quantity} x ${name} ${pos} +${parsePrice(price)}\n`
|
|
153
|
+
: `${quantity} x ${name} +${parsePrice(price)}\n`;
|
|
154
|
+
} else {
|
|
155
|
+
return 'No\n';
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const handleCopyClipboard = () => {
|
|
160
|
+
const businessName = !!order?.business?.name
|
|
161
|
+
? `${order?.business?.name} \n`
|
|
162
|
+
: '';
|
|
163
|
+
|
|
164
|
+
const businessEmail = !!order?.business?.email
|
|
165
|
+
? `${order?.business?.email} \n`
|
|
166
|
+
: '';
|
|
167
|
+
|
|
168
|
+
const businessCellphone = !!order?.business?.cellphone
|
|
169
|
+
? `${order?.business?.cellphone} \n`
|
|
170
|
+
: '';
|
|
171
|
+
|
|
172
|
+
const businessPhone = !!order?.business?.phone
|
|
173
|
+
? `${order?.business?.phone} \n`
|
|
174
|
+
: '';
|
|
175
|
+
|
|
176
|
+
const businessAddress = !!order?.business?.address
|
|
177
|
+
? `${order?.business?.address} \n`
|
|
178
|
+
: '';
|
|
179
|
+
|
|
180
|
+
const businessSpecialAddress = !!order?.business?.address_notes
|
|
181
|
+
? `${order?.business?.address_notes} \n \n`
|
|
182
|
+
: '';
|
|
183
|
+
|
|
184
|
+
const customerName = !!order?.customer?.name
|
|
185
|
+
? `${order?.customer?.name} ${order?.customer?.middle_name || ''} ${order?.customer?.lastname || ''
|
|
186
|
+
} ${order?.customer?.second_lastname || ''} \n`
|
|
187
|
+
: '';
|
|
188
|
+
|
|
189
|
+
const customerEmail = !!order?.customer.email
|
|
190
|
+
? `${order?.customer.email} \n`
|
|
191
|
+
: '';
|
|
192
|
+
|
|
193
|
+
const customerCellPhone = !!order?.customer?.cellphone
|
|
194
|
+
? `${order?.customer?.cellphone} \n`
|
|
195
|
+
: '';
|
|
196
|
+
|
|
197
|
+
const customerPhone = !!order?.customer?.phone
|
|
198
|
+
? `${order?.customer?.phone} \n`
|
|
199
|
+
: '';
|
|
200
|
+
|
|
201
|
+
const customerAddress = !!order?.customer?.address
|
|
202
|
+
? `${order?.customer?.address} \n`
|
|
203
|
+
: '';
|
|
204
|
+
|
|
205
|
+
const customerSpecialAddress = !!order?.customer?.address_notes
|
|
206
|
+
? `${order?.customer?.address_notes} \n`
|
|
207
|
+
: '';
|
|
208
|
+
|
|
209
|
+
const payment = order?.paymethod?.name
|
|
210
|
+
? `${order?.paymethod?.name} - ${order.delivery_type === 1
|
|
211
|
+
? t('DELIVERY', 'Delivery')
|
|
212
|
+
: order.delivery_type === 2
|
|
213
|
+
? t('PICKUP', 'Pickup')
|
|
214
|
+
: order.delivery_type === 3
|
|
215
|
+
? t('EAT_IN', 'Eat in')
|
|
216
|
+
: order.delivery_type === 4
|
|
217
|
+
? t('CURBSIDE', 'Curbside')
|
|
218
|
+
: t('DRIVER_THRU', 'Driver thru')
|
|
219
|
+
}\n`
|
|
220
|
+
: '';
|
|
221
|
+
|
|
222
|
+
const getSuboptions = (suboptions: any) => {
|
|
223
|
+
const array: any = []
|
|
224
|
+
suboptions?.length > 0 &&
|
|
225
|
+
suboptions?.map((suboption: any) => {
|
|
226
|
+
const string = `${getFormattedSubOptionName(suboption)}`
|
|
227
|
+
array.push(string)
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
return array.join('')
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const getOptions = (options: any, productComment: string = '') => {
|
|
234
|
+
const array: any = [];
|
|
235
|
+
|
|
236
|
+
options?.length &&
|
|
237
|
+
options?.map((option: any) => {
|
|
238
|
+
const string =
|
|
239
|
+
` ${option.name}\n ${getSuboptions(option.suboptions)}`;
|
|
240
|
+
|
|
241
|
+
array.push(string)
|
|
242
|
+
})
|
|
243
|
+
|
|
244
|
+
if (productComment) {
|
|
245
|
+
array.push(` ${t('COMMENT', 'Comment')}\n ${productComment}\n`)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return array.join('')
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const productsInArray =
|
|
252
|
+
order?.products.length &&
|
|
253
|
+
order?.products.map((product: any, i: number) => {
|
|
254
|
+
const string =
|
|
255
|
+
`${product?.quantity} X ${product?.name} ${parsePrice(product.total ?? getProductPrice(product))}\n${getOptions(product.options, product.comment)}`;
|
|
256
|
+
|
|
257
|
+
return i === 0 ? ` ${string}` : string
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
const productsInString = productsInArray.join(' ');
|
|
261
|
+
const orderDetails = `${t(
|
|
262
|
+
'ORDER_DETAILS',
|
|
263
|
+
'Order Details',
|
|
264
|
+
)}:\n${productsInString}\n`;
|
|
265
|
+
|
|
266
|
+
const subtotal = `${t('SUBTOTAL', 'Subtotal')}: ${parsePrice(
|
|
267
|
+
order?.subtotal,
|
|
268
|
+
)}\n`;
|
|
269
|
+
|
|
270
|
+
const drivertip = `${t('DRIVER_TIP', 'Driver tip')} ${parsePrice(
|
|
271
|
+
order?.summary?.driver_tip || order?.totalDriverTip,
|
|
272
|
+
)}\n`;
|
|
273
|
+
|
|
274
|
+
const deliveryFee = `${t('DELIVERY_FEE', 'Delivery fee')} ${verifyDecimals(
|
|
275
|
+
order?.service_fee,
|
|
276
|
+
parseNumber,
|
|
277
|
+
)}% ${parsePrice(order?.summary?.service_fee || order?.serviceFee || 0)}\n`;
|
|
278
|
+
|
|
279
|
+
const total = `${t('TOTAL', 'Total')} ${parsePrice(
|
|
280
|
+
order?.summary?.total || order?.total,
|
|
281
|
+
)}\n`;
|
|
282
|
+
|
|
283
|
+
const orderStatus = `${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id} ${t(
|
|
284
|
+
'IS',
|
|
285
|
+
'is',
|
|
286
|
+
)} ${getOrderStatus(order?.status, t)?.value}\n`;
|
|
287
|
+
|
|
288
|
+
Clipboard.setString(
|
|
289
|
+
`${orderStatus} ${payment} ${t(
|
|
290
|
+
'BUSINESS_DETAILS',
|
|
291
|
+
'Business Details',
|
|
292
|
+
)}\n ${businessName} ${businessEmail} ${businessCellphone} ${businessPhone} ${businessAddress} ${businessSpecialAddress}${t(
|
|
293
|
+
'CUSTOMER_DETAILS',
|
|
294
|
+
'Customer Details',
|
|
295
|
+
)}\n ${customerName} ${customerEmail} ${customerCellPhone} ${customerPhone} ${customerAddress} ${customerSpecialAddress}\n${orderDetails} ${subtotal} ${drivertip} ${deliveryFee} ${total}`,
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
showToast(
|
|
299
|
+
ToastType.Info,
|
|
300
|
+
t('COPY_TO_CLIPBOARD', 'Copy to clipboard.'),
|
|
301
|
+
1000,
|
|
302
|
+
);
|
|
303
|
+
};
|
|
304
|
+
|
|
136
305
|
const handleViewActionOrder = (action: string) => {
|
|
306
|
+
if (action === 'reject' && !isAllowedDriverRejectOrder) {
|
|
307
|
+
setAlertState({
|
|
308
|
+
open: true,
|
|
309
|
+
content: [
|
|
310
|
+
t('DRIVER_NOT_ALLOWED_TO_REJECT_ORDER', 'The driver is not allowed to reject an order.'),
|
|
311
|
+
],
|
|
312
|
+
key: null,
|
|
313
|
+
})
|
|
314
|
+
return
|
|
315
|
+
}
|
|
137
316
|
if (!isGrantedPermissions) {
|
|
138
317
|
navigation.navigate('RequestPermissions')
|
|
139
318
|
return
|
|
@@ -150,16 +329,23 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
150
329
|
};
|
|
151
330
|
|
|
152
331
|
const handleArrowBack: any = () => {
|
|
332
|
+
if (alertState?.open && !isAllowedDriverRejectOrder && !pendingOrderStatus.includes(order?.status)) {
|
|
333
|
+
setAlertState({
|
|
334
|
+
...alertState,
|
|
335
|
+
open: false
|
|
336
|
+
})
|
|
337
|
+
return
|
|
338
|
+
}
|
|
153
339
|
navigation?.canGoBack() && navigation.goBack();
|
|
154
340
|
};
|
|
155
341
|
|
|
156
342
|
const handleRejectLogisticOrder = () => {
|
|
157
|
-
handleClickLogisticOrder?.(2, order?.logistic_order_id)
|
|
343
|
+
handleClickLogisticOrder?.(2, orderAssingId || order?.logistic_order_id)
|
|
158
344
|
handleArrowBack()
|
|
159
345
|
}
|
|
160
346
|
|
|
161
347
|
const handleAcceptLogisticOrder = (order: any) => {
|
|
162
|
-
handleClickLogisticOrder?.(1, order?.logistic_order_id)
|
|
348
|
+
handleClickLogisticOrder?.(1, orderAssingId || order?.logistic_order_id)
|
|
163
349
|
if (order?.order_group) {
|
|
164
350
|
handleArrowBack()
|
|
165
351
|
}
|
|
@@ -203,7 +389,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
203
389
|
}, [props.order?.loading]);
|
|
204
390
|
|
|
205
391
|
useEffect(() => {
|
|
206
|
-
if (order?.
|
|
392
|
+
if (!order?.driver_id && session?.user?.level === 4) {
|
|
207
393
|
setAlertState({
|
|
208
394
|
open: true,
|
|
209
395
|
content: [
|
|
@@ -298,7 +484,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
298
484
|
/>
|
|
299
485
|
</Pickup>
|
|
300
486
|
)}
|
|
301
|
-
{order?.status === 3 && order?.delivery_type === 1 && (
|
|
487
|
+
{order?.status === 3 && order?.delivery_type === 1 && !isHideRejectButtons && (
|
|
302
488
|
<View style={{ paddingVertical: 20, marginBottom: 20 }}>
|
|
303
489
|
<OButton
|
|
304
490
|
style={styles.btnPickUp}
|
|
@@ -343,7 +529,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
343
529
|
</View>
|
|
344
530
|
)}
|
|
345
531
|
|
|
346
|
-
{(!!props.order?.error || props.order?.error) && (
|
|
532
|
+
{(!!props.order?.error || props.order?.error?.length > 0) && (
|
|
347
533
|
<NotFoundSource
|
|
348
534
|
btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
|
|
349
535
|
content={
|
|
@@ -361,6 +547,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
361
547
|
order={order}
|
|
362
548
|
handleOpenMapView={handleOpenMapView}
|
|
363
549
|
handleOpenMessagesForBusiness={handleOpenMessagesForBusiness}
|
|
550
|
+
handleCopyClipboard={handleCopyClipboard}
|
|
364
551
|
getOrderStatus={getOrderStatus}
|
|
365
552
|
handleArrowBack={handleArrowBack}
|
|
366
553
|
logisticOrderStatus={logisticOrderStatus}
|
|
@@ -392,7 +579,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
392
579
|
secondButton={true}
|
|
393
580
|
firstColorCustom={theme.colors.red}
|
|
394
581
|
secondColorCustom={theme.colors.green}
|
|
395
|
-
widthButton={'45%'}
|
|
582
|
+
widthButton={isHideRejectButtons ? '100%': '45%'}
|
|
583
|
+
isHideRejectButtons={isHideRejectButtons}
|
|
396
584
|
/>
|
|
397
585
|
)}
|
|
398
586
|
{(validStatusComplete.includes(order?.status)) && (
|
|
@@ -411,7 +599,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
411
599
|
secondButton={true}
|
|
412
600
|
firstColorCustom={theme.colors.red}
|
|
413
601
|
secondColorCustom={theme.colors.green}
|
|
414
|
-
widthButton={'45%'}
|
|
602
|
+
widthButton={isHideRejectButtons ? '100%': '45%'}
|
|
603
|
+
isHideRejectButtons={isHideRejectButtons}
|
|
415
604
|
/>
|
|
416
605
|
</>
|
|
417
606
|
)}
|
|
@@ -425,7 +614,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
425
614
|
secondButton={true}
|
|
426
615
|
firstColorCustom={theme.colors.red}
|
|
427
616
|
secondColorCustom={theme.colors.green}
|
|
428
|
-
widthButton={'45%'}
|
|
617
|
+
widthButton={isHideRejectButtons ? '100%': '45%'}
|
|
618
|
+
isHideRejectButtons={isHideRejectButtons}
|
|
429
619
|
/>
|
|
430
620
|
)}
|
|
431
621
|
</>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react'
|
|
2
2
|
|
|
3
|
-
import { Platform, StyleSheet, View, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { Platform, StyleSheet, View, TouchableOpacity, ScrollView } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import { OButton, OText, OLink, OModal } from '../shared'
|
|
6
6
|
import {
|
|
@@ -16,18 +16,23 @@ import {
|
|
|
16
16
|
|
|
17
17
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
18
18
|
|
|
19
|
-
import { verifyDecimals } from '../../utils';
|
|
19
|
+
import { verifyDecimals, calculateDistance, transformDistance } from '../../utils';
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
22
|
useLanguage,
|
|
23
23
|
useUtils,
|
|
24
24
|
useConfig,
|
|
25
|
+
useSession
|
|
25
26
|
} from 'ordering-components/native';
|
|
26
27
|
import { useTheme } from 'styled-components/native';
|
|
27
28
|
import { ReviewCustomer } from '../ReviewCustomer'
|
|
28
29
|
|
|
29
30
|
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
30
31
|
|
|
32
|
+
import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
|
|
33
|
+
|
|
34
|
+
const { useDeviceOrientation } = DeviceOrientationMethods
|
|
35
|
+
|
|
31
36
|
interface OrderContent {
|
|
32
37
|
order: any,
|
|
33
38
|
logisticOrderStatus?: Array<number>,
|
|
@@ -38,14 +43,25 @@ interface OrderContent {
|
|
|
38
43
|
export const OrderContentComponent = (props: OrderContent) => {
|
|
39
44
|
const [, t] = useLanguage();
|
|
40
45
|
const theme = useTheme()
|
|
41
|
-
|
|
46
|
+
const [{ user }] = useSession()
|
|
42
47
|
const { order, logisticOrderStatus, isOrderGroup, lastOrder } = props;
|
|
43
48
|
const [{ parsePrice, parseNumber }] = useUtils();
|
|
44
49
|
const [{ configs }] = useConfig();
|
|
50
|
+
const [orientationState] = useDeviceOrientation();
|
|
51
|
+
const distanceUnit = configs?.distance_unit?.value
|
|
52
|
+
|
|
53
|
+
const WIDTH_SCREEN = orientationState?.dimensions?.width
|
|
54
|
+
|
|
45
55
|
const [openReviewModal, setOpenReviewModal] = useState(false)
|
|
46
56
|
|
|
47
|
-
const [isReadMore, setIsReadMore] = useState(
|
|
48
|
-
|
|
57
|
+
const [isReadMore, setIsReadMore] = useState({
|
|
58
|
+
customerAddress: false,
|
|
59
|
+
businessAddressNotes: false
|
|
60
|
+
})
|
|
61
|
+
const [lengthMore, setLengthMore] = useState({
|
|
62
|
+
customerAddress: false,
|
|
63
|
+
businessAddressNotes: false
|
|
64
|
+
})
|
|
49
65
|
|
|
50
66
|
const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
|
|
51
67
|
|
|
@@ -98,14 +114,21 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
98
114
|
return /^\d+$/.test(str);
|
|
99
115
|
}
|
|
100
116
|
|
|
101
|
-
const onTextLayout = useCallback((e: any) => {
|
|
102
|
-
|
|
103
|
-
|
|
117
|
+
const onTextLayout = useCallback((e: any, item: string) => {
|
|
118
|
+
if (item === 'customerAddress') {
|
|
119
|
+
const customerAddressMore = (e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2
|
|
120
|
+
setLengthMore(prev => ({ ...prev, customerAddress: customerAddressMore }))
|
|
121
|
+
}
|
|
122
|
+
if (item === 'businessAddressNotes') {
|
|
123
|
+
const businessAddressNotesMore = (e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3
|
|
124
|
+
setLengthMore(prev => ({ ...prev, businessAddressNotes: businessAddressNotesMore }))
|
|
125
|
+
}
|
|
126
|
+
}, []);
|
|
104
127
|
|
|
105
128
|
return (
|
|
106
129
|
<OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
|
|
107
130
|
{isOrderGroup && (
|
|
108
|
-
<OText size={18}>{t('ORDER', 'Order')} #{
|
|
131
|
+
<OText size={18}>{t('ORDER', 'Order')} #{order?.id}</OText>
|
|
109
132
|
)}
|
|
110
133
|
|
|
111
134
|
{order?.metafields?.length > 0 && (
|
|
@@ -193,19 +216,34 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
193
216
|
/>
|
|
194
217
|
</View>
|
|
195
218
|
)}
|
|
196
|
-
|
|
219
|
+
{!!order?.business?.location && order?.customer?.location && (
|
|
220
|
+
<OText>
|
|
221
|
+
{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)}
|
|
222
|
+
</OText>
|
|
223
|
+
)}
|
|
197
224
|
{!!order?.business?.address_notes && (
|
|
198
|
-
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
225
|
+
<>
|
|
226
|
+
<View style={styles.linkWithIcons}>
|
|
227
|
+
<OLink
|
|
228
|
+
PressStyle={styles.linkWithIcons}
|
|
229
|
+
url={Platform.select({
|
|
230
|
+
ios: `maps:0,0?q=${order?.business?.address_notes}`,
|
|
231
|
+
android: `geo:0,0?q=${order?.business?.address_notes}`,
|
|
232
|
+
})}
|
|
233
|
+
shorcut={order?.business?.address_notes}
|
|
234
|
+
TextStyle={styles.textLink}
|
|
235
|
+
onTextLayout={e => onTextLayout(e, 'businessAddressNotes')}
|
|
236
|
+
numberOfLines={isReadMore.businessAddressNotes ? 20 : 3}
|
|
237
|
+
/>
|
|
238
|
+
</View>
|
|
239
|
+
{lengthMore.businessAddressNotes && (
|
|
240
|
+
<TouchableOpacity
|
|
241
|
+
onPress={() => setIsReadMore({ ...isReadMore, businessAddressNotes: !isReadMore.businessAddressNotes })}
|
|
242
|
+
>
|
|
243
|
+
<OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore.businessAddressNotes ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
244
|
+
</TouchableOpacity>
|
|
245
|
+
)}
|
|
246
|
+
</>
|
|
209
247
|
)}
|
|
210
248
|
</OrderBusiness>
|
|
211
249
|
|
|
@@ -313,15 +351,17 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
313
351
|
ios: `maps:0,0?q=${order?.customer?.address}`,
|
|
314
352
|
android: `geo:0,0?q=${order?.customer?.address}`,
|
|
315
353
|
})}
|
|
316
|
-
onTextLayout={onTextLayout}
|
|
317
|
-
numberOfLines={isReadMore ? 20 : 2}
|
|
354
|
+
onTextLayout={e => onTextLayout(e, 'customerAddress')}
|
|
355
|
+
numberOfLines={isReadMore.customerAddress ? 20 : 2}
|
|
318
356
|
shorcut={order?.customer?.address}
|
|
319
357
|
TextStyle={styles.textLink}
|
|
320
358
|
/>
|
|
321
359
|
</View>
|
|
322
|
-
{lengthMore && (
|
|
323
|
-
<TouchableOpacity
|
|
324
|
-
|
|
360
|
+
{lengthMore.customerAddress && (
|
|
361
|
+
<TouchableOpacity
|
|
362
|
+
onPress={() => setIsReadMore({ ...isReadMore, customerAddress: !isReadMore.customerAddress })}
|
|
363
|
+
>
|
|
364
|
+
<OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore.customerAddress ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
325
365
|
</TouchableOpacity>
|
|
326
366
|
)}
|
|
327
367
|
</>
|
|
@@ -334,9 +374,15 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
334
374
|
)}
|
|
335
375
|
|
|
336
376
|
{!!order?.customer?.address_notes && (
|
|
337
|
-
<
|
|
338
|
-
{
|
|
339
|
-
|
|
377
|
+
<ScrollView
|
|
378
|
+
showsVerticalScrollIndicator={false}
|
|
379
|
+
showsHorizontalScrollIndicator={false}
|
|
380
|
+
horizontal
|
|
381
|
+
>
|
|
382
|
+
<OText numberOfLines={1} mBottom={4} ellipsizeMode="tail">
|
|
383
|
+
{order?.customer?.address_notes}
|
|
384
|
+
</OText>
|
|
385
|
+
</ScrollView>
|
|
340
386
|
)}
|
|
341
387
|
|
|
342
388
|
{!!order?.customer?.zipcode && (
|
|
@@ -503,7 +549,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
503
549
|
))
|
|
504
550
|
}
|
|
505
551
|
{
|
|
506
|
-
order?.summary?.delivery_price
|
|
552
|
+
typeof order?.summary?.delivery_price === 'number' && (
|
|
507
553
|
<Table>
|
|
508
554
|
<OText mBottom={4}>
|
|
509
555
|
{t('DELIVERY_FEE', 'Delivery Fee')}
|
|
@@ -530,15 +576,14 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
530
576
|
</Table>
|
|
531
577
|
))
|
|
532
578
|
}
|
|
533
|
-
{order?.summary?.driver_tip > 0 && (
|
|
579
|
+
{(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && (
|
|
534
580
|
<Table>
|
|
535
581
|
<OText mBottom={4}>
|
|
536
582
|
{t('DRIVER_TIP', 'Driver tip')}
|
|
537
|
-
{order?.
|
|
538
|
-
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
583
|
+
{order?.driver_tip > 0 && parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
539
584
|
!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
540
585
|
(
|
|
541
|
-
`(${verifyDecimals(order?.
|
|
586
|
+
`(${verifyDecimals(order?.driver_tip, parseNumber)}%)`
|
|
542
587
|
)}
|
|
543
588
|
</OText>
|
|
544
589
|
<OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency })}</OText>
|
|
@@ -591,14 +636,16 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
591
636
|
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
592
637
|
: t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
|
|
593
638
|
</OText>
|
|
594
|
-
{event?.data?.charge_id && (
|
|
639
|
+
{/* {event?.data?.charge_id && (
|
|
595
640
|
<OText>
|
|
596
641
|
{`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
|
|
597
642
|
</OText>
|
|
598
|
-
)}
|
|
643
|
+
)} */}
|
|
599
644
|
</View>
|
|
600
645
|
<OText>
|
|
601
|
-
|
|
646
|
+
{(event?.paymethod?.gateway === 'cash' && order?.cash)
|
|
647
|
+
? parsePrice(order?.cash, { currency: order?.currency })
|
|
648
|
+
: `-${parsePrice(event?.amount, { currency: order?.currency })}`}
|
|
602
649
|
</OText>
|
|
603
650
|
</View>
|
|
604
651
|
))}
|