ordering-ui-react-native 0.18.2 → 0.18.3-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 +9 -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 +0 -20
- 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 +7 -2
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- 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/index.tsx +5 -2
- package/themes/business/src/components/MapView/index.tsx +14 -10
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- 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 +205 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +67 -39
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
- package/themes/business/src/components/OrderMessage/index.tsx +1 -1
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +43 -32
- 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 +21 -29
- 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 +193 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/StoresList/index.tsx +6 -5
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +8 -0
- package/themes/business/src/utils/index.tsx +4 -4
- 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 -5
- 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 +7 -3
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +33 -15
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- 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 +74 -38
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
- 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/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +133 -438
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
- package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
- package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
- 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 +162 -39
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- 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 +37 -404
- 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 -47
- package/themes/original/src/components/CartContent/index.tsx +99 -38
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +324 -43
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DatePicker/index.tsx +17 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/DriverTips/index.tsx +6 -3
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +4 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +7 -5
- 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 +3 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- 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/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +14 -5
- 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/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +9 -10
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
- package/themes/original/src/components/MyOrders/index.tsx +16 -5
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +4 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
- package/themes/original/src/components/OrderDetails/index.tsx +721 -670
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- 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/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +62 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +44 -21
- package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
- 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/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +106 -170
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -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/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +6 -6
- package/themes/original/src/components/Promotions/styles.tsx +3 -3
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/SignupForm/index.tsx +27 -16
- package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
- 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/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
- 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/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +48 -60
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- 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 +15 -17
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +28 -6
- package/themes/original/src/utils/index.tsx +180 -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
|
@@ -1,71 +1,102 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Modal,
|
|
4
|
+
View,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Dimensions,
|
|
7
|
+
TouchableOpacity
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import { useTheme } from 'styled-components/native'
|
|
2
10
|
import moment from 'moment'
|
|
3
|
-
import { View, Modal, StyleSheet, TouchableOpacity, Dimensions } from 'react-native'
|
|
4
|
-
import Sound from 'react-native-sound'
|
|
5
11
|
import Icon from 'react-native-vector-icons/Feather'
|
|
6
|
-
import
|
|
7
|
-
import { useEvent, useLanguage, useSession, useApi, NewOrderNotification as NewOrderNotificationController } from 'ordering-components/native'
|
|
12
|
+
import SoundPlayer from 'react-native-sound-player'
|
|
8
13
|
|
|
9
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
NewOrderNotification as NewOrderNotificationController,
|
|
16
|
+
useApi,
|
|
17
|
+
useEvent,
|
|
18
|
+
useLanguage,
|
|
19
|
+
useSession
|
|
20
|
+
} from 'ordering-components/native'
|
|
21
|
+
|
|
22
|
+
import { OIcon, OText } from '../shared'
|
|
10
23
|
import { NotificationContainer } from './styles'
|
|
11
24
|
import { useLocation } from '../../hooks/useLocation'
|
|
12
25
|
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
const DELAY_SOUND = 2500 // 2 sec
|
|
15
27
|
const windowWidth = Dimensions.get('screen').width
|
|
16
28
|
|
|
17
|
-
const
|
|
29
|
+
const SoundPlayerComponent = (props: any) => {
|
|
30
|
+
const { evtList, currentEvent, handleCloseEvents } = props
|
|
18
31
|
|
|
19
|
-
const NewOrderNotificationUI = (props: any) => {
|
|
20
|
-
const { isBusinessApp } = props
|
|
21
|
-
const [events] = useEvent()
|
|
22
32
|
const theme = useTheme()
|
|
23
|
-
const [,
|
|
24
|
-
const [{ user, token }] = useSession()
|
|
25
|
-
const [ordering] = useApi()
|
|
26
|
-
const { getCurrentLocation } = useLocation();
|
|
27
|
-
const [currentEvent, setCurrentEvent] = useState<any>(null)
|
|
33
|
+
const [count, setCount] = useState(0);
|
|
28
34
|
|
|
29
|
-
const
|
|
30
|
-
1: {
|
|
31
|
-
event: 'messages',
|
|
32
|
-
message: t('NEW_MESSAGES_RECEIVED', 'New messages have been received!'),
|
|
33
|
-
message2: t('ORDER_N_UNREAD_MESSAGES', 'Order #_order_id_ has unread messages.').replace('_order_id_', currentEvent?.orderId),
|
|
34
|
-
},
|
|
35
|
-
2: {
|
|
36
|
-
event: 'order_added',
|
|
37
|
-
message: t('NEW_ORDERS_RECEIVED', 'New orders have been received!'),
|
|
38
|
-
message2: t('ORDER_N_ORDERED', 'Order #_order_id_ has been ordered.').replace('_order_id_', currentEvent?.orderId),
|
|
39
|
-
},
|
|
40
|
-
3: {
|
|
41
|
-
event: 'order_updated',
|
|
42
|
-
message: t('NEW_ORDERS_UPDATED', 'New orders have been updated!'),
|
|
43
|
-
message2: t('ORDER_N_UPDATED', 'Order #_order_id_ has been updated.').replace('_order_id_', currentEvent?.orderId),
|
|
44
|
-
},
|
|
45
|
-
}
|
|
35
|
+
const URL_SOUND = 'https://d33aymufw4jvwf.cloudfront.net/notification.mp3' ?? theme.sounds.notification
|
|
46
36
|
|
|
47
|
-
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const id = setInterval(() => setCount(count + 1), 2500)
|
|
48
39
|
|
|
49
|
-
|
|
40
|
+
const playSound = async () => {
|
|
41
|
+
SoundPlayer.playUrl(URL_SOUND)
|
|
42
|
+
await new Promise(resolve => setTimeout(resolve, DELAY_SOUND))
|
|
43
|
+
SoundPlayer.stop()
|
|
44
|
+
}
|
|
50
45
|
|
|
51
|
-
|
|
52
|
-
notificationSound.stop()
|
|
53
|
-
setCurrentEvent(null)
|
|
54
|
-
clearInterval(_timeout)
|
|
55
|
-
}
|
|
46
|
+
playSound()
|
|
56
47
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (times < SOUND_LOOP) {
|
|
61
|
-
_timeout = setInterval(() => {
|
|
62
|
-
notificationSound.setVolume(1).play(success => success && (times = times + 1))
|
|
63
|
-
if (times === SOUND_LOOP) {
|
|
64
|
-
clearInterval(_timeout)
|
|
65
|
-
}
|
|
66
|
-
}, 2500)
|
|
48
|
+
return () => {
|
|
49
|
+
SoundPlayer.stop()
|
|
50
|
+
clearInterval(id);
|
|
67
51
|
}
|
|
68
|
-
}
|
|
52
|
+
}, [count])
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Modal
|
|
56
|
+
animationType='slide'
|
|
57
|
+
transparent={true}
|
|
58
|
+
visible={!!currentEvent?.orderId}
|
|
59
|
+
>
|
|
60
|
+
<NotificationContainer>
|
|
61
|
+
<View style={styles.modalView}>
|
|
62
|
+
<TouchableOpacity
|
|
63
|
+
style={styles.wrapperIcon}
|
|
64
|
+
onPress={() => handleCloseEvents()}
|
|
65
|
+
>
|
|
66
|
+
<Icon name="x" size={30} />
|
|
67
|
+
</TouchableOpacity>
|
|
68
|
+
<OText
|
|
69
|
+
size={18}
|
|
70
|
+
color={theme.colors.textGray}
|
|
71
|
+
weight={600}
|
|
72
|
+
>
|
|
73
|
+
{evtList(currentEvent)[currentEvent?.evt]?.message}
|
|
74
|
+
</OText>
|
|
75
|
+
<OIcon
|
|
76
|
+
src={theme.images.general.newOrder}
|
|
77
|
+
width={250}
|
|
78
|
+
height={200}
|
|
79
|
+
/>
|
|
80
|
+
<OText
|
|
81
|
+
color={theme.colors.textGray}
|
|
82
|
+
mBottom={15}
|
|
83
|
+
>
|
|
84
|
+
{evtList(currentEvent)[currentEvent?.evt]?.message2}
|
|
85
|
+
</OText>
|
|
86
|
+
</View>
|
|
87
|
+
</NotificationContainer>
|
|
88
|
+
</Modal>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const NewOrderNotificationUI = (props: any) => {
|
|
93
|
+
const { isBusinessApp, evtList } = props
|
|
94
|
+
|
|
95
|
+
const [events] = useEvent()
|
|
96
|
+
const [{ user, token }] = useSession()
|
|
97
|
+
const [ordering] = useApi()
|
|
98
|
+
const { getCurrentLocation } = useLocation()
|
|
99
|
+
const [currentEvent, setCurrentEvent] = useState<any>(null)
|
|
69
100
|
|
|
70
101
|
const handleEventNotification = async (evtType: number, value: any) => {
|
|
71
102
|
if (value?.driver) {
|
|
@@ -74,21 +105,25 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
74
105
|
await fetch(`${ordering.root}/users/${user.id}/locations`, {
|
|
75
106
|
method: 'POST',
|
|
76
107
|
body: JSON.stringify({
|
|
77
|
-
location: JSON.stringify({location: `{lat: ${location.latitude}, lng: ${location.longitude}}`})
|
|
108
|
+
location: JSON.stringify({ location: `{lat: ${location.latitude}, lng: ${location.longitude}}` })
|
|
78
109
|
}),
|
|
79
110
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }
|
|
80
111
|
})
|
|
81
|
-
} catch {}
|
|
112
|
+
} catch { }
|
|
82
113
|
const duration = moment.duration(moment().diff(moment.utc(value?.last_driver_assigned_at)))
|
|
83
114
|
const assignedSecondsDiff = duration.asSeconds()
|
|
84
|
-
if (assignedSecondsDiff < 5 && !isBusinessApp) {
|
|
85
|
-
|
|
115
|
+
if (assignedSecondsDiff < 5 && !isBusinessApp && !value?.logistic_status) {
|
|
116
|
+
setCurrentEvent({ evt: 2, orderId: value?.id })
|
|
86
117
|
}
|
|
87
118
|
}
|
|
88
|
-
if (evtType === 3 || value
|
|
89
|
-
|
|
119
|
+
if (evtType === 3 || value?.author_id === user.id) return
|
|
120
|
+
setCurrentEvent({
|
|
90
121
|
evt: evtType,
|
|
91
|
-
orderId:
|
|
122
|
+
orderId: value?.driver
|
|
123
|
+
? value?.order_id
|
|
124
|
+
: evtList(currentEvent)[evtType].event === 'messages'
|
|
125
|
+
? value?.order?.id
|
|
126
|
+
: value?.order_id ?? value?.id
|
|
92
127
|
})
|
|
93
128
|
}
|
|
94
129
|
|
|
@@ -109,48 +144,21 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
109
144
|
}, [])
|
|
110
145
|
|
|
111
146
|
useEffect(() => {
|
|
112
|
-
return () =>
|
|
147
|
+
return () => setCurrentEvent(null)
|
|
113
148
|
}, [])
|
|
114
149
|
|
|
115
150
|
return (
|
|
116
151
|
<>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<TouchableOpacity
|
|
125
|
-
style={styles.wrapperIcon}
|
|
126
|
-
onPress={() => handleCloseEvents()}
|
|
127
|
-
>
|
|
128
|
-
<Icon name="x" size={30} />
|
|
129
|
-
</TouchableOpacity>
|
|
130
|
-
<OText
|
|
131
|
-
size={18}
|
|
132
|
-
color={theme.colors.textGray}
|
|
133
|
-
weight={600}
|
|
134
|
-
>
|
|
135
|
-
{evtList[currentEvent?.evt]?.message}
|
|
136
|
-
</OText>
|
|
137
|
-
<OIcon
|
|
138
|
-
src={theme.images.general.newOrder}
|
|
139
|
-
width={250}
|
|
140
|
-
height={200}
|
|
141
|
-
/>
|
|
142
|
-
<OText
|
|
143
|
-
color={theme.colors.textGray}
|
|
144
|
-
mBottom={15}
|
|
145
|
-
>
|
|
146
|
-
{evtList[currentEvent?.evt]?.message2}
|
|
147
|
-
</OText>
|
|
148
|
-
</View>
|
|
149
|
-
</NotificationContainer>
|
|
150
|
-
</Modal>
|
|
152
|
+
{!!currentEvent ? (
|
|
153
|
+
<SoundPlayerComponent
|
|
154
|
+
evtList={evtList}
|
|
155
|
+
currentEvent={currentEvent}
|
|
156
|
+
handleCloseEvents={() => setCurrentEvent(null)}
|
|
157
|
+
/>
|
|
158
|
+
) : null}
|
|
151
159
|
</>
|
|
152
160
|
)
|
|
153
|
-
}
|
|
161
|
+
};
|
|
154
162
|
|
|
155
163
|
const styles = StyleSheet.create({
|
|
156
164
|
modalView: {
|
|
@@ -170,9 +178,28 @@ const styles = StyleSheet.create({
|
|
|
170
178
|
})
|
|
171
179
|
|
|
172
180
|
export const NewOrderNotification = (props: any) => {
|
|
181
|
+
const [, t] = useLanguage()
|
|
182
|
+
|
|
173
183
|
const newOrderNotificationProps = {
|
|
174
184
|
...props,
|
|
175
|
-
UIComponent: NewOrderNotificationUI
|
|
185
|
+
UIComponent: NewOrderNotificationUI,
|
|
186
|
+
evtList: (currentEvent: any) => ({
|
|
187
|
+
1: {
|
|
188
|
+
event: 'messages',
|
|
189
|
+
message: t('NEW_MESSAGES_RECEIVED', 'New messages have been received!'),
|
|
190
|
+
message2: t('ORDER_N_UNREAD_MESSAGES', 'Order #_order_id_ has unread messages.').replace('_order_id_', currentEvent?.orderId),
|
|
191
|
+
},
|
|
192
|
+
2: {
|
|
193
|
+
event: 'order_added',
|
|
194
|
+
message: t('NEW_ORDERS_RECEIVED', 'New orders have been received!'),
|
|
195
|
+
message2: t('ORDER_N_ORDERED', 'Order #_order_id_ has been ordered.').replace('_order_id_', currentEvent?.orderId),
|
|
196
|
+
},
|
|
197
|
+
3: {
|
|
198
|
+
event: 'order_updated',
|
|
199
|
+
message: t('NEW_ORDERS_UPDATED', 'New orders have been updated!'),
|
|
200
|
+
message2: t('ORDER_N_UPDATED', 'Order #_order_id_ has been updated.').replace('_order_id_', currentEvent?.orderId),
|
|
201
|
+
},
|
|
202
|
+
})
|
|
176
203
|
};
|
|
177
204
|
|
|
178
205
|
return <NewOrderNotificationController {...newOrderNotificationProps} />;
|
|
@@ -18,7 +18,7 @@ export const NotFoundSource = (props: NotFoundSourceParams) => {
|
|
|
18
18
|
<OIcon src={errorImage} width={260} height={220} />
|
|
19
19
|
</NotFoundImage>
|
|
20
20
|
)}
|
|
21
|
-
{content && conditioned && !errorImage && (
|
|
21
|
+
{!!content && conditioned && !errorImage && (
|
|
22
22
|
<OText
|
|
23
23
|
color={theme.colors.textSecondary}
|
|
24
24
|
size={textSize ?? 18}
|
|
@@ -26,7 +26,7 @@ export const NotFoundSource = (props: NotFoundSourceParams) => {
|
|
|
26
26
|
{content}
|
|
27
27
|
</OText>
|
|
28
28
|
)}
|
|
29
|
-
{content && !conditioned && (
|
|
29
|
+
{!!content && !conditioned && (
|
|
30
30
|
<OText
|
|
31
31
|
color={theme.colors.textSecondary}
|
|
32
32
|
size={textSize ?? 18}
|
|
@@ -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
|
|
@@ -56,7 +59,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
56
59
|
isGrantedPermissions,
|
|
57
60
|
} = props;
|
|
58
61
|
const [, { showToast }] = useToast();
|
|
62
|
+
const [{ parsePrice, parseNumber }] = useUtils();
|
|
63
|
+
const [{ configs }] = useConfig();
|
|
64
|
+
|
|
59
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'
|
|
60
69
|
const theme = useTheme();
|
|
61
70
|
const [, t] = useLanguage();
|
|
62
71
|
const [session] = useSession();
|
|
@@ -76,12 +85,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
76
85
|
|
|
77
86
|
const validStatusComplete = [9, 19, 23]
|
|
78
87
|
|
|
88
|
+
const pendingOrderStatus = [1, 4, 7, 13]
|
|
89
|
+
|
|
79
90
|
const logisticOrderStatus = [4, 6, 7]
|
|
80
91
|
|
|
81
92
|
const showFloatButtonsPickUp: any = {
|
|
82
|
-
8:
|
|
93
|
+
8: !isHideRejectButtons,
|
|
83
94
|
3: true,
|
|
84
|
-
18:
|
|
95
|
+
18: !isHideRejectButtons,
|
|
85
96
|
};
|
|
86
97
|
|
|
87
98
|
const showFloatButtonsAcceptOrReject: any = {
|
|
@@ -104,6 +115,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
104
115
|
readMessages && readMessages();
|
|
105
116
|
};
|
|
106
117
|
|
|
118
|
+
const goToPermissionPage = () => {
|
|
119
|
+
navigation.navigate('RequestPermissions')
|
|
120
|
+
}
|
|
121
|
+
|
|
107
122
|
const handleOpenMapView = async () => {
|
|
108
123
|
if (!isGrantedPermissions) {
|
|
109
124
|
navigation.navigate('RequestPermissions')
|
|
@@ -134,7 +149,174 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
134
149
|
}
|
|
135
150
|
};
|
|
136
151
|
|
|
152
|
+
const getFormattedSubOptionName = ({ quantity, name, position, price }: any) => {
|
|
153
|
+
if (name !== 'No') {
|
|
154
|
+
const pos = position && position !== 'whole' ? `(${t(position.toUpperCase(), position)})` : '';
|
|
155
|
+
return pos
|
|
156
|
+
? `${quantity} x ${name} ${pos} +${parsePrice(price)}\n`
|
|
157
|
+
: `${quantity} x ${name} +${parsePrice(price)}\n`;
|
|
158
|
+
} else {
|
|
159
|
+
return 'No\n';
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const handleCopyClipboard = () => {
|
|
164
|
+
const businessName = !!order?.business?.name
|
|
165
|
+
? `${order?.business?.name} \n`
|
|
166
|
+
: '';
|
|
167
|
+
|
|
168
|
+
const businessEmail = !!order?.business?.email
|
|
169
|
+
? `${order?.business?.email} \n`
|
|
170
|
+
: '';
|
|
171
|
+
|
|
172
|
+
const businessCellphone = !!order?.business?.cellphone
|
|
173
|
+
? `${order?.business?.cellphone} \n`
|
|
174
|
+
: '';
|
|
175
|
+
|
|
176
|
+
const businessPhone = !!order?.business?.phone
|
|
177
|
+
? `${order?.business?.phone} \n`
|
|
178
|
+
: '';
|
|
179
|
+
|
|
180
|
+
const businessAddress = !!order?.business?.address
|
|
181
|
+
? `${order?.business?.address} \n`
|
|
182
|
+
: '';
|
|
183
|
+
|
|
184
|
+
const businessSpecialAddress = !!order?.business?.address_notes
|
|
185
|
+
? `${order?.business?.address_notes} \n \n`
|
|
186
|
+
: '';
|
|
187
|
+
|
|
188
|
+
const customerName = !!order?.customer?.name
|
|
189
|
+
? `${order?.customer?.name} ${order?.customer?.middle_name || ''} ${order?.customer?.lastname || ''
|
|
190
|
+
} ${order?.customer?.second_lastname || ''} \n`
|
|
191
|
+
: '';
|
|
192
|
+
|
|
193
|
+
const customerEmail = !!order?.customer.email
|
|
194
|
+
? `${order?.customer.email} \n`
|
|
195
|
+
: '';
|
|
196
|
+
|
|
197
|
+
const customerCellPhone = !!order?.customer?.cellphone
|
|
198
|
+
? `${order?.customer?.cellphone} \n`
|
|
199
|
+
: '';
|
|
200
|
+
|
|
201
|
+
const customerPhone = !!order?.customer?.phone
|
|
202
|
+
? `${order?.customer?.phone} \n`
|
|
203
|
+
: '';
|
|
204
|
+
|
|
205
|
+
const customerAddress = !!order?.customer?.address
|
|
206
|
+
? `${order?.customer?.address} \n`
|
|
207
|
+
: '';
|
|
208
|
+
|
|
209
|
+
const customerSpecialAddress = !!order?.customer?.address_notes
|
|
210
|
+
? `${order?.customer?.address_notes} \n`
|
|
211
|
+
: '';
|
|
212
|
+
|
|
213
|
+
const payment = order?.paymethod?.name
|
|
214
|
+
? `${order?.paymethod?.name} - ${order.delivery_type === 1
|
|
215
|
+
? t('DELIVERY', 'Delivery')
|
|
216
|
+
: order.delivery_type === 2
|
|
217
|
+
? t('PICKUP', 'Pickup')
|
|
218
|
+
: order.delivery_type === 3
|
|
219
|
+
? t('EAT_IN', 'Eat in')
|
|
220
|
+
: order.delivery_type === 4
|
|
221
|
+
? t('CURBSIDE', 'Curbside')
|
|
222
|
+
: t('DRIVER_THRU', 'Driver thru')
|
|
223
|
+
}\n`
|
|
224
|
+
: '';
|
|
225
|
+
|
|
226
|
+
const getSuboptions = (suboptions: any) => {
|
|
227
|
+
const array: any = []
|
|
228
|
+
suboptions?.length > 0 &&
|
|
229
|
+
suboptions?.map((suboption: any) => {
|
|
230
|
+
const string = `${getFormattedSubOptionName(suboption)}`
|
|
231
|
+
array.push(string)
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
return array.join('')
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const getOptions = (options: any, productComment: string = '') => {
|
|
238
|
+
const array: any = [];
|
|
239
|
+
|
|
240
|
+
options?.length &&
|
|
241
|
+
options?.map((option: any) => {
|
|
242
|
+
const string =
|
|
243
|
+
` ${option.name}\n ${getSuboptions(option.suboptions)}`;
|
|
244
|
+
|
|
245
|
+
array.push(string)
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
if (productComment) {
|
|
249
|
+
array.push(` ${t('COMMENT', 'Comment')}\n ${productComment}\n`)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return array.join('')
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const productsInArray =
|
|
256
|
+
order?.products.length &&
|
|
257
|
+
order?.products.map((product: any, i: number) => {
|
|
258
|
+
const string =
|
|
259
|
+
`${product?.quantity} X ${product?.name} ${parsePrice(product.total ?? getProductPrice(product))}\n${getOptions(product.options, product.comment)}`;
|
|
260
|
+
|
|
261
|
+
return i === 0 ? ` ${string}` : string
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
const productsInString = productsInArray.join(' ');
|
|
265
|
+
const orderDetails = `${t(
|
|
266
|
+
'ORDER_DETAILS',
|
|
267
|
+
'Order Details',
|
|
268
|
+
)}:\n${productsInString}\n`;
|
|
269
|
+
|
|
270
|
+
const subtotal = `${t('SUBTOTAL', 'Subtotal')}: ${parsePrice(
|
|
271
|
+
order?.subtotal,
|
|
272
|
+
)}\n`;
|
|
273
|
+
|
|
274
|
+
const drivertip = `${t('DRIVER_TIP', 'Driver tip')} ${parsePrice(
|
|
275
|
+
order?.summary?.driver_tip || order?.totalDriverTip,
|
|
276
|
+
)}\n`;
|
|
277
|
+
|
|
278
|
+
const deliveryFee = `${t('DELIVERY_FEE', 'Delivery fee')} ${verifyDecimals(
|
|
279
|
+
order?.service_fee,
|
|
280
|
+
parseNumber,
|
|
281
|
+
)}% ${parsePrice(order?.summary?.service_fee || order?.serviceFee || 0)}\n`;
|
|
282
|
+
|
|
283
|
+
const total = `${t('TOTAL', 'Total')} ${parsePrice(
|
|
284
|
+
order?.summary?.total || order?.total,
|
|
285
|
+
)}\n`;
|
|
286
|
+
|
|
287
|
+
const orderStatus = `${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id} ${t(
|
|
288
|
+
'IS',
|
|
289
|
+
'is',
|
|
290
|
+
)} ${getOrderStatus(order?.status, t)?.value}\n`;
|
|
291
|
+
|
|
292
|
+
Clipboard.setString(
|
|
293
|
+
`${orderStatus} ${payment} ${t(
|
|
294
|
+
'BUSINESS_DETAILS',
|
|
295
|
+
'Business Details',
|
|
296
|
+
)}\n ${businessName} ${businessEmail} ${businessCellphone} ${businessPhone} ${businessAddress} ${businessSpecialAddress}${t(
|
|
297
|
+
'CUSTOMER_DETAILS',
|
|
298
|
+
'Customer Details',
|
|
299
|
+
)}\n ${customerName} ${customerEmail} ${customerCellPhone} ${customerPhone} ${customerAddress} ${customerSpecialAddress}\n${orderDetails} ${subtotal} ${drivertip} ${deliveryFee} ${total}`,
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
showToast(
|
|
303
|
+
ToastType.Info,
|
|
304
|
+
t('COPY_TO_CLIPBOARD', 'Copy to clipboard.'),
|
|
305
|
+
1000,
|
|
306
|
+
);
|
|
307
|
+
};
|
|
308
|
+
|
|
137
309
|
const handleViewActionOrder = (action: string) => {
|
|
310
|
+
if (action === 'reject' && !isAllowedDriverRejectOrder) {
|
|
311
|
+
setAlertState({
|
|
312
|
+
open: true,
|
|
313
|
+
content: [
|
|
314
|
+
t('DRIVER_NOT_ALLOWED_TO_REJECT_ORDER', 'The driver is not allowed to reject an order.'),
|
|
315
|
+
],
|
|
316
|
+
key: null,
|
|
317
|
+
})
|
|
318
|
+
return
|
|
319
|
+
}
|
|
138
320
|
if (!isGrantedPermissions) {
|
|
139
321
|
navigation.navigate('RequestPermissions')
|
|
140
322
|
return
|
|
@@ -151,6 +333,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
151
333
|
};
|
|
152
334
|
|
|
153
335
|
const handleArrowBack: any = () => {
|
|
336
|
+
if (alertState?.open && !isAllowedDriverRejectOrder && !pendingOrderStatus.includes(order?.status)) {
|
|
337
|
+
setAlertState({
|
|
338
|
+
...alertState,
|
|
339
|
+
open: false
|
|
340
|
+
})
|
|
341
|
+
return
|
|
342
|
+
}
|
|
154
343
|
navigation?.canGoBack() && navigation.goBack();
|
|
155
344
|
};
|
|
156
345
|
|
|
@@ -204,7 +393,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
204
393
|
}, [props.order?.loading]);
|
|
205
394
|
|
|
206
395
|
useEffect(() => {
|
|
207
|
-
if (order?.
|
|
396
|
+
if (!order?.driver_id && session?.user?.level === 4) {
|
|
208
397
|
setAlertState({
|
|
209
398
|
open: true,
|
|
210
399
|
content: [
|
|
@@ -293,13 +482,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
293
482
|
textStyle={{ color: theme.colors.primary }}
|
|
294
483
|
text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
|
|
295
484
|
onClick={() =>
|
|
296
|
-
handleChangeOrderStatus && handleChangeOrderStatus(3)
|
|
485
|
+
handleChangeOrderStatus && isGrantedPermissions ? handleChangeOrderStatus(3) : goToPermissionPage()
|
|
297
486
|
}
|
|
298
487
|
imgLeftStyle={{ tintColor: theme.colors.backArrow }}
|
|
299
488
|
/>
|
|
300
489
|
</Pickup>
|
|
301
490
|
)}
|
|
302
|
-
{order?.status === 3 && order?.delivery_type === 1 && (
|
|
491
|
+
{order?.status === 3 && order?.delivery_type === 1 && !isHideRejectButtons && (
|
|
303
492
|
<View style={{ paddingVertical: 20, marginBottom: 20 }}>
|
|
304
493
|
<OButton
|
|
305
494
|
style={styles.btnPickUp}
|
|
@@ -344,7 +533,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
344
533
|
</View>
|
|
345
534
|
)}
|
|
346
535
|
|
|
347
|
-
{(!!props.order?.error || props.order?.error) && (
|
|
536
|
+
{(!!props.order?.error || props.order?.error?.length > 0) && (
|
|
348
537
|
<NotFoundSource
|
|
349
538
|
btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
|
|
350
539
|
content={
|
|
@@ -362,6 +551,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
362
551
|
order={order}
|
|
363
552
|
handleOpenMapView={handleOpenMapView}
|
|
364
553
|
handleOpenMessagesForBusiness={handleOpenMessagesForBusiness}
|
|
554
|
+
handleCopyClipboard={handleCopyClipboard}
|
|
365
555
|
getOrderStatus={getOrderStatus}
|
|
366
556
|
handleArrowBack={handleArrowBack}
|
|
367
557
|
logisticOrderStatus={logisticOrderStatus}
|
|
@@ -384,7 +574,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
384
574
|
btnText={t('PICKUP_FAILED', 'Pickup failed')}
|
|
385
575
|
isSecondaryBtn={false}
|
|
386
576
|
secondButtonClick={() =>
|
|
387
|
-
handleChangeOrderStatus && handleChangeOrderStatus(9)
|
|
577
|
+
handleChangeOrderStatus && isGrantedPermissions ? handleChangeOrderStatus(9) : goToPermissionPage()
|
|
388
578
|
}
|
|
389
579
|
firstButtonClick={() =>
|
|
390
580
|
handleViewActionOrder && handleViewActionOrder('pickupFailed')
|
|
@@ -393,7 +583,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
393
583
|
secondButton={true}
|
|
394
584
|
firstColorCustom={theme.colors.red}
|
|
395
585
|
secondColorCustom={theme.colors.green}
|
|
396
|
-
widthButton={'45%'}
|
|
586
|
+
widthButton={isHideRejectButtons ? '100%': '45%'}
|
|
587
|
+
isHideRejectButtons={isHideRejectButtons}
|
|
397
588
|
/>
|
|
398
589
|
)}
|
|
399
590
|
{(validStatusComplete.includes(order?.status)) && (
|
|
@@ -403,7 +594,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
403
594
|
btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
|
|
404
595
|
isSecondaryBtn={false}
|
|
405
596
|
secondButtonClick={() =>
|
|
406
|
-
handleChangeOrderStatus && handleChangeOrderStatus(11)
|
|
597
|
+
handleChangeOrderStatus && isGrantedPermissions ? handleChangeOrderStatus(11) : goToPermissionPage()
|
|
407
598
|
}
|
|
408
599
|
firstButtonClick={() =>
|
|
409
600
|
handleViewActionOrder && handleViewActionOrder('deliveryFailed')
|
|
@@ -412,7 +603,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
412
603
|
secondButton={true}
|
|
413
604
|
firstColorCustom={theme.colors.red}
|
|
414
605
|
secondColorCustom={theme.colors.green}
|
|
415
|
-
widthButton={'45%'}
|
|
606
|
+
widthButton={isHideRejectButtons ? '100%': '45%'}
|
|
607
|
+
isHideRejectButtons={isHideRejectButtons}
|
|
416
608
|
/>
|
|
417
609
|
</>
|
|
418
610
|
)}
|
|
@@ -426,7 +618,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
426
618
|
secondButton={true}
|
|
427
619
|
firstColorCustom={theme.colors.red}
|
|
428
620
|
secondColorCustom={theme.colors.green}
|
|
429
|
-
widthButton={'45%'}
|
|
621
|
+
widthButton={isHideRejectButtons ? '100%': '45%'}
|
|
622
|
+
isHideRejectButtons={isHideRejectButtons}
|
|
430
623
|
/>
|
|
431
624
|
)}
|
|
432
625
|
</>
|