ordering-ui-react-native 0.16.78 → 0.16.79-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 +5 -5
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/styles.tsx +8 -14
- package/src/components/BusinessInformation/index.tsx +19 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessProductsList/index.tsx +10 -10
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/LanguageSelector/index.tsx +21 -16
- package/src/components/Messages/index.tsx +2 -2
- package/src/components/OrderCreating/index.tsx +2 -2
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptionsWebView/index.tsx +119 -120
- package/src/components/SingleProductReview/index.tsx +7 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +4 -4
- package/src/utils/index.tsx +2 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
- package/themes/business/src/components/BusinessController/index.tsx +2 -2
- package/themes/business/src/components/Chat/index.tsx +31 -31
- package/themes/business/src/components/DriverMap/index.tsx +7 -5
- package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
- package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/business/src/components/LoginForm/index.tsx +236 -80
- package/themes/business/src/components/LoginForm/styles.tsx +10 -0
- package/themes/business/src/components/MapView/index.tsx +14 -3
- package/themes/business/src/components/MessagesOption/index.tsx +11 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
- package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -47
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrdersOption/index.tsx +63 -73
- package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
- package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
- package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
- package/themes/business/src/components/ProductItemAccordion/index.tsx +30 -5
- package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
- package/themes/business/src/components/shared/ODropDown.tsx +42 -8
- package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
- package/themes/business/src/components/shared/OLink.tsx +33 -13
- package/themes/business/src/components/shared/OText.tsx +8 -2
- package/themes/business/src/types/index.tsx +36 -3
- package/themes/business/src/utils/index.tsx +53 -0
- 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/BusinessesListing/index.tsx +2 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
- package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +476 -153
- package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -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/PhoneInputNumber/index.tsx +1 -0
- package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
- package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
- package/themes/kiosk/src/layouts/Container.tsx +7 -1
- package/themes/kiosk/src/types/index.d.ts +14 -0
- package/themes/kiosk/src/utils/index.tsx +15 -0
- package/themes/original/index.tsx +8 -0
- package/themes/original/src/components/AddressDetails/index.tsx +10 -8
- package/themes/original/src/components/AddressForm/index.tsx +155 -139
- package/themes/original/src/components/AddressList/index.tsx +18 -18
- package/themes/original/src/components/AddressList/styles.tsx +4 -2
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +124 -78
- package/themes/original/src/components/BusinessController/index.tsx +101 -70
- package/themes/original/src/components/BusinessController/styles.tsx +14 -9
- package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
- package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +102 -155
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
- package/themes/original/src/components/BusinessProductsList/index.tsx +11 -8
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +563 -494
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +116 -81
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
- package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
- package/themes/original/src/components/Cart/index.tsx +75 -40
- package/themes/original/src/components/CartContent/index.tsx +80 -18
- package/themes/original/src/components/CartContent/styles.tsx +11 -1
- package/themes/original/src/components/Checkout/index.tsx +101 -106
- package/themes/original/src/components/Checkout/styles.tsx +4 -2
- package/themes/original/src/components/CitiesControl/index.tsx +89 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
- package/themes/original/src/components/DriverTips/index.tsx +52 -37
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/Favorite/index.tsx +7 -4
- package/themes/original/src/components/Favorite/styles.tsx +1 -1
- package/themes/original/src/components/FavoriteList/index.tsx +70 -80
- package/themes/original/src/components/FloatingButton/index.tsx +1 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +20 -19
- package/themes/original/src/components/GPSButton/styles.ts +3 -3
- package/themes/original/src/components/GoogleMap/index.tsx +10 -1
- package/themes/original/src/components/Help/index.tsx +8 -8
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
- package/themes/original/src/components/HelpGuide/index.tsx +13 -12
- package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
- package/themes/original/src/components/HelpOrder/index.tsx +12 -20
- package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
- package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LastOrder/index.tsx +1 -34
- package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +28 -8
- package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
- package/themes/original/src/components/MessageListing/index.tsx +7 -40
- package/themes/original/src/components/Messages/index.tsx +42 -26
- package/themes/original/src/components/MomentOption/index.tsx +23 -14
- package/themes/original/src/components/MultiCart/index.tsx +50 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
- package/themes/original/src/components/MultiCheckout/index.tsx +158 -77
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +66 -17
- package/themes/original/src/components/NavBar/index.tsx +7 -6
- package/themes/original/src/components/NetworkError/index.tsx +5 -3
- package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
- package/themes/original/src/components/Notifications/index.tsx +144 -0
- package/themes/original/src/components/Notifications/styles.tsx +20 -0
- package/themes/original/src/components/OrderDetails/index.tsx +108 -218
- package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
- package/themes/original/src/components/OrderProgress/index.tsx +81 -105
- package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
- package/themes/original/src/components/OrderSummary/index.tsx +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +93 -97
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
- package/themes/original/src/components/OrdersOption/index.tsx +86 -92
- package/themes/original/src/components/PageBanner/index.tsx +146 -0
- package/themes/original/src/components/PageBanner/styles.tsx +11 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +1 -1
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PlaceSpot/index.tsx +16 -6
- package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
- package/themes/original/src/components/ProductForm/index.tsx +240 -254
- package/themes/original/src/components/ProductForm/styles.tsx +5 -8
- package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
- package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
- package/themes/original/src/components/Promotions/index.tsx +234 -220
- package/themes/original/src/components/Promotions/styles.tsx +7 -2
- package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
- package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
- package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
- package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
- package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
- package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
- package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
- package/themes/original/src/components/ServiceForm/index.tsx +377 -270
- package/themes/original/src/components/Sessions/index.tsx +11 -8
- package/themes/original/src/components/Sessions/styles.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +78 -66
- package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
- package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
- package/themes/original/src/components/SingleProductCard/index.tsx +112 -77
- package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
- package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
- package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
- package/themes/original/src/components/UserDetails/index.tsx +5 -3
- package/themes/original/src/components/UserFormDetails/index.tsx +50 -54
- package/themes/original/src/components/UserProfile/index.tsx +58 -35
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
- package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
- package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
- package/themes/original/src/components/Wallets/index.tsx +177 -164
- package/themes/original/src/components/Wallets/styles.tsx +12 -8
- package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
- package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +9 -4
- package/themes/original/src/components/shared/OIcon.tsx +8 -1
- package/themes/original/src/components/shared/OInput.tsx +10 -1
- package/themes/original/src/layouts/Container.tsx +13 -9
- package/themes/original/src/types/index.tsx +42 -7
- package/themes/original/src/utils/index.tsx +322 -58
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -52,7 +52,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
52
52
|
handleClickLogisticOrder,
|
|
53
53
|
forceUpdate,
|
|
54
54
|
getPermissions,
|
|
55
|
-
|
|
55
|
+
orderAssingId,
|
|
56
|
+
isGrantedPermissions,
|
|
56
57
|
} = props;
|
|
57
58
|
const [, { showToast }] = useToast();
|
|
58
59
|
const { order } = props.order
|
|
@@ -154,12 +155,12 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
154
155
|
};
|
|
155
156
|
|
|
156
157
|
const handleRejectLogisticOrder = () => {
|
|
157
|
-
handleClickLogisticOrder?.(2, order?.logistic_order_id)
|
|
158
|
+
handleClickLogisticOrder?.(2, orderAssingId || order?.logistic_order_id)
|
|
158
159
|
handleArrowBack()
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
const handleAcceptLogisticOrder = (order: any) => {
|
|
162
|
-
handleClickLogisticOrder?.(1, order?.logistic_order_id)
|
|
163
|
+
handleClickLogisticOrder?.(1, orderAssingId || order?.logistic_order_id)
|
|
163
164
|
if (order?.order_group) {
|
|
164
165
|
handleArrowBack()
|
|
165
166
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
1
|
+
import React, { useState, useCallback } from 'react'
|
|
2
2
|
|
|
3
|
-
import { Platform, StyleSheet, View } from 'react-native';
|
|
3
|
+
import { Platform, StyleSheet, View, TouchableOpacity } 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,12 +43,20 @@ interface OrderContent {
|
|
|
38
43
|
export const OrderContentComponent = (props: OrderContent) => {
|
|
39
44
|
const [, t] = useLanguage();
|
|
40
45
|
const theme = useTheme()
|
|
41
|
-
|
|
46
|
+
const [{user}] = useSession()
|
|
47
|
+
console.log(user)
|
|
42
48
|
const { order, logisticOrderStatus, isOrderGroup, lastOrder } = props;
|
|
43
49
|
const [{ parsePrice, parseNumber }] = useUtils();
|
|
44
50
|
const [{ configs }] = useConfig();
|
|
51
|
+
const [orientationState] = useDeviceOrientation();
|
|
52
|
+
|
|
53
|
+
const WIDTH_SCREEN = orientationState?.dimensions?.width
|
|
54
|
+
|
|
45
55
|
const [openReviewModal, setOpenReviewModal] = useState(false)
|
|
46
56
|
|
|
57
|
+
const [isReadMore, setIsReadMore] = useState(false)
|
|
58
|
+
const [lengthMore, setLengthMore] = useState(false)
|
|
59
|
+
|
|
47
60
|
const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
|
|
48
61
|
|
|
49
62
|
const walletName: any = {
|
|
@@ -91,10 +104,18 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
91
104
|
return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
92
105
|
}
|
|
93
106
|
|
|
107
|
+
const containsOnlyNumbers = (str: string) => {
|
|
108
|
+
return /^\d+$/.test(str);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const onTextLayout = useCallback((e: any) => {
|
|
112
|
+
setLengthMore((e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2); //to check the text is more than 2 lines or not
|
|
113
|
+
},[]);
|
|
114
|
+
|
|
94
115
|
return (
|
|
95
116
|
<OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
|
|
96
117
|
{isOrderGroup && (
|
|
97
|
-
<OText size={18}>{t('ORDER', 'Order')} #{
|
|
118
|
+
<OText size={18}>{t('ORDER', 'Order')} #{order?.id}</OText>
|
|
98
119
|
)}
|
|
99
120
|
|
|
100
121
|
{order?.metafields?.length > 0 && (
|
|
@@ -148,7 +169,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
148
169
|
<View style={styles.linkWithIcons}>
|
|
149
170
|
<OLink
|
|
150
171
|
PressStyle={styles.linkWithIcons}
|
|
151
|
-
url={`tel:${order?.business?.cellphone}`}
|
|
172
|
+
url={`tel:${containsOnlyNumbers(order?.business?.cellphone) ? order?.business?.cellphone : 'invalid'}`}
|
|
152
173
|
shorcut={`${order?.business?.cellphone}`}
|
|
153
174
|
TextStyle={styles.textLink}
|
|
154
175
|
/>
|
|
@@ -159,7 +180,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
159
180
|
<View style={styles.linkWithIcons}>
|
|
160
181
|
<OLink
|
|
161
182
|
PressStyle={styles.linkWithIcons}
|
|
162
|
-
url={`tel:${order?.business?.phone}`}
|
|
183
|
+
url={`tel:${containsOnlyNumbers(order?.business?.cellphone) ? order?.business?.phone : 'invalid'}`}
|
|
163
184
|
shorcut={order?.business?.phone}
|
|
164
185
|
TextStyle={styles.textLink}
|
|
165
186
|
/>
|
|
@@ -176,12 +197,17 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
176
197
|
ios: `maps:0,0?q=${order?.business?.address}`,
|
|
177
198
|
android: `geo:0,0?q=${order?.business?.address}`,
|
|
178
199
|
})}
|
|
200
|
+
numberOfLines={2}
|
|
179
201
|
shorcut={order?.business?.address}
|
|
180
202
|
TextStyle={styles.textLink}
|
|
181
203
|
/>
|
|
182
204
|
</View>
|
|
183
205
|
)}
|
|
184
|
-
|
|
206
|
+
{!!order?.business?.location && (
|
|
207
|
+
<OText>
|
|
208
|
+
{t('DISTANCE_TO_THE_BUSINESS', 'Distance to the business')}: {transformDistance(calculateDistance(order?.business?.location, user?.location), distanceUnit)} {t(distanceUnit.toUpperCase(), distanceUnit)}
|
|
209
|
+
</OText>
|
|
210
|
+
)}
|
|
185
211
|
{!!order?.business?.address_notes && (
|
|
186
212
|
<View style={styles.linkWithIcons}>
|
|
187
213
|
<OLink
|
|
@@ -274,7 +300,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
274
300
|
<View style={styles.linkWithIcons}>
|
|
275
301
|
<OLink
|
|
276
302
|
PressStyle={styles.linkWithIcons}
|
|
277
|
-
url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
|
|
303
|
+
url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${containsOnlyNumbers(order?.customer?.cellphone) ? order?.customer?.cellphone : 'invalid'}`}
|
|
278
304
|
shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
|
|
279
305
|
TextStyle={styles.textLink}
|
|
280
306
|
/>
|
|
@@ -285,7 +311,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
285
311
|
<View style={styles.linkWithIcons}>
|
|
286
312
|
<OLink
|
|
287
313
|
PressStyle={styles.linkWithIcons}
|
|
288
|
-
url={`tel:${order?.customer?.phone}`}
|
|
314
|
+
url={`tel:${containsOnlyNumbers(order?.customer?.phone) ? order?.customer?.phone : 'invalid'}`}
|
|
289
315
|
shorcut={order?.customer?.phone}
|
|
290
316
|
TextStyle={styles.textLink}
|
|
291
317
|
/>
|
|
@@ -293,17 +319,26 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
293
319
|
)}
|
|
294
320
|
|
|
295
321
|
{!!order?.customer?.address && (
|
|
296
|
-
|
|
297
|
-
<
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
322
|
+
<>
|
|
323
|
+
<View style={styles.linkWithIcons}>
|
|
324
|
+
<OLink
|
|
325
|
+
PressStyle={{ ...styles.linkWithIcons, marginBottom: 0 }}
|
|
326
|
+
url={Platform.select({
|
|
327
|
+
ios: `maps:0,0?q=${order?.customer?.address}`,
|
|
328
|
+
android: `geo:0,0?q=${order?.customer?.address}`,
|
|
329
|
+
})}
|
|
330
|
+
onTextLayout={onTextLayout}
|
|
331
|
+
numberOfLines={isReadMore ? 20 : 2}
|
|
332
|
+
shorcut={order?.customer?.address}
|
|
333
|
+
TextStyle={styles.textLink}
|
|
334
|
+
/>
|
|
335
|
+
</View>
|
|
336
|
+
{lengthMore && (
|
|
337
|
+
<TouchableOpacity onPress={() => setIsReadMore(!isReadMore)}>
|
|
338
|
+
<OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
339
|
+
</TouchableOpacity>
|
|
340
|
+
)}
|
|
341
|
+
</>
|
|
307
342
|
)}
|
|
308
343
|
|
|
309
344
|
{!!order?.customer?.internal_number && (
|
|
@@ -333,13 +368,18 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
333
368
|
<View style={{ marginTop: 10 }}>
|
|
334
369
|
{order?.delivery_option !== undefined && order?.delivery_type === 1 && (
|
|
335
370
|
<OText>
|
|
336
|
-
{order?.delivery_option?.name}
|
|
371
|
+
{t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
|
|
337
372
|
</OText>
|
|
338
373
|
)}
|
|
339
374
|
{!!order?.comment && (
|
|
340
|
-
|
|
341
|
-
{
|
|
342
|
-
|
|
375
|
+
<>
|
|
376
|
+
<OText weight='500' style={{ marginBottom: 5 }}>
|
|
377
|
+
{t('ORDER_COMMENT', 'Order Comment')}
|
|
378
|
+
</OText>
|
|
379
|
+
<OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 20 }}>
|
|
380
|
+
{order?.comment}
|
|
381
|
+
</OText>
|
|
382
|
+
</>
|
|
343
383
|
)}
|
|
344
384
|
</View>
|
|
345
385
|
)}
|
|
@@ -364,6 +404,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
364
404
|
<ProductItemAccordion
|
|
365
405
|
key={product?.id || i}
|
|
366
406
|
product={product}
|
|
407
|
+
currency={order?.currency}
|
|
367
408
|
/>
|
|
368
409
|
))}
|
|
369
410
|
</OrderProducts>
|
|
@@ -372,7 +413,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
372
413
|
<Table>
|
|
373
414
|
<OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
374
415
|
<OText mBottom={4}>
|
|
375
|
-
{parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: order?.currency})}
|
|
416
|
+
{parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: order?.currency })}
|
|
376
417
|
</OText>
|
|
377
418
|
</Table>
|
|
378
419
|
{(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
|
|
@@ -385,7 +426,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
385
426
|
) : (
|
|
386
427
|
<OText mBottom={4}>{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}</OText>
|
|
387
428
|
)}
|
|
388
|
-
<OText>- {parsePrice(order?.summary?.discount ?? order?.discount, { currency: order?.currency})}</OText>
|
|
429
|
+
<OText>- {parsePrice(order?.summary?.discount ?? order?.discount, { currency: order?.currency })}</OText>
|
|
389
430
|
</Table>
|
|
390
431
|
)}
|
|
391
432
|
{
|
|
@@ -393,13 +434,13 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
393
434
|
<Table key={offer.id}>
|
|
394
435
|
<OSRow>
|
|
395
436
|
<OText mBottom={4}>
|
|
396
|
-
{offer.name}
|
|
437
|
+
{t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
|
|
397
438
|
{offer.rate_type === 1 && (
|
|
398
439
|
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
399
440
|
)}
|
|
400
441
|
</OText>
|
|
401
442
|
</OSRow>
|
|
402
|
-
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
|
|
443
|
+
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
|
|
403
444
|
</Table>
|
|
404
445
|
))
|
|
405
446
|
}
|
|
@@ -407,9 +448,9 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
407
448
|
<Table>
|
|
408
449
|
<OText mBottom={4}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
|
|
409
450
|
{order?.tax_type === 1 ? (
|
|
410
|
-
<OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0), { currency: order?.currency})}</OText>
|
|
451
|
+
<OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0), { currency: order?.currency })}</OText>
|
|
411
452
|
) : (
|
|
412
|
-
<OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0, { currency: order?.currency})}</OText>
|
|
453
|
+
<OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0, { currency: order?.currency })}</OText>
|
|
413
454
|
)}
|
|
414
455
|
</Table>
|
|
415
456
|
)}
|
|
@@ -419,7 +460,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
419
460
|
{t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
|
|
420
461
|
</OText>
|
|
421
462
|
<OText mBottom={4}>
|
|
422
|
-
{parsePrice(order?.summary?.tax ?? 0, { currency: order?.currency})}
|
|
463
|
+
{parsePrice(order?.summary?.tax ?? 0, { currency: order?.currency })}
|
|
423
464
|
</OText>
|
|
424
465
|
</Table>
|
|
425
466
|
)}
|
|
@@ -430,7 +471,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
430
471
|
{t('SERVICE_FEE', 'Service fee')}
|
|
431
472
|
{`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
|
|
432
473
|
</OText>
|
|
433
|
-
<OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0, { currency: order?.currency})}</OText>
|
|
474
|
+
<OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0, { currency: order?.currency })}</OText>
|
|
434
475
|
</Table>
|
|
435
476
|
)
|
|
436
477
|
}
|
|
@@ -439,11 +480,11 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
439
480
|
<Table key={tax.id}>
|
|
440
481
|
<OSRow>
|
|
441
482
|
<OText mBottom={4}>
|
|
442
|
-
{tax
|
|
483
|
+
{t(tax?.name?.toUpperCase()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
443
484
|
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
|
|
444
485
|
</OText>
|
|
445
486
|
</OSRow>
|
|
446
|
-
<OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: order?.currency})}</OText>
|
|
487
|
+
<OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: order?.currency })}</OText>
|
|
447
488
|
</Table>
|
|
448
489
|
))
|
|
449
490
|
}
|
|
@@ -452,11 +493,11 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
452
493
|
<Table key={fee.id}>
|
|
453
494
|
<OSRow>
|
|
454
495
|
<OText mBottom={4}>
|
|
455
|
-
{fee
|
|
456
|
-
({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency})} + `}{fee.percentage}%){' '}
|
|
496
|
+
{t(fee?.name?.toUpperCase()?.replace(/ /g, '_'), fee?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
497
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency })} + `}{fee.percentage}%){' '}
|
|
457
498
|
</OText>
|
|
458
499
|
</OSRow>
|
|
459
|
-
<OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0, { currency: order?.currency})}</OText>
|
|
500
|
+
<OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0, { currency: order?.currency })}</OText>
|
|
460
501
|
</Table>
|
|
461
502
|
))
|
|
462
503
|
}
|
|
@@ -465,13 +506,13 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
465
506
|
<Table key={offer.id}>
|
|
466
507
|
<OSRow>
|
|
467
508
|
<OText mBottom={4}>
|
|
468
|
-
{offer.name}
|
|
509
|
+
{t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
|
|
469
510
|
{offer.rate_type === 1 && (
|
|
470
511
|
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
471
512
|
)}
|
|
472
513
|
</OText>
|
|
473
514
|
</OSRow>
|
|
474
|
-
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
|
|
515
|
+
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
|
|
475
516
|
</Table>
|
|
476
517
|
))
|
|
477
518
|
}
|
|
@@ -483,7 +524,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
483
524
|
</OText>
|
|
484
525
|
|
|
485
526
|
<OText mBottom={4}>
|
|
486
|
-
{parsePrice(order?.summary?.delivery_price, { currency: order?.currency})}
|
|
527
|
+
{parsePrice(order?.summary?.delivery_price, { currency: order?.currency })}
|
|
487
528
|
</OText>
|
|
488
529
|
</Table>
|
|
489
530
|
)
|
|
@@ -493,13 +534,13 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
493
534
|
<Table key={offer.id}>
|
|
494
535
|
<OSRow>
|
|
495
536
|
<OText mBottom={4}>
|
|
496
|
-
{offer.name}
|
|
537
|
+
{t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
|
|
497
538
|
{offer.rate_type === 1 && (
|
|
498
539
|
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
499
540
|
)}
|
|
500
541
|
</OText>
|
|
501
542
|
</OSRow>
|
|
502
|
-
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
|
|
543
|
+
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
|
|
503
544
|
</Table>
|
|
504
545
|
))
|
|
505
546
|
}
|
|
@@ -514,7 +555,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
514
555
|
`(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
|
|
515
556
|
)}
|
|
516
557
|
</OText>
|
|
517
|
-
<OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency})}</OText>
|
|
558
|
+
<OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency })}</OText>
|
|
518
559
|
</Table>
|
|
519
560
|
)}
|
|
520
561
|
|
|
@@ -528,7 +569,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
528
569
|
mBottom={4}
|
|
529
570
|
style={styles.textBold}
|
|
530
571
|
color={theme.colors.primary}>
|
|
531
|
-
{parsePrice(order?.summary?.total ?? order?.total, { currency: order?.currency})}
|
|
572
|
+
{parsePrice(order?.summary?.total ?? order?.total, { currency: order?.currency })}
|
|
532
573
|
</OText>
|
|
533
574
|
</Table>
|
|
534
575
|
</Total>
|
|
@@ -562,7 +603,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
562
603
|
<OText>
|
|
563
604
|
{event?.wallet_event
|
|
564
605
|
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
565
|
-
: event?.paymethod?.name}
|
|
606
|
+
: t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
|
|
566
607
|
</OText>
|
|
567
608
|
{event?.data?.charge_id && (
|
|
568
609
|
<OText>
|
|
@@ -571,7 +612,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
571
612
|
)}
|
|
572
613
|
</View>
|
|
573
614
|
<OText>
|
|
574
|
-
-{parsePrice(event.amount, { currency: order?.currency})}
|
|
615
|
+
-{parsePrice(event.amount, { currency: order?.currency })}
|
|
575
616
|
</OText>
|
|
576
617
|
</View>
|
|
577
618
|
))}
|
|
@@ -271,7 +271,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
271
271
|
{order?.delivery_option && (
|
|
272
272
|
<OText size={13}>
|
|
273
273
|
<OText size={13} weight='bold'>{`${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: `}</OText>
|
|
274
|
-
{order?.delivery_option?.name}
|
|
274
|
+
{t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
|
|
275
275
|
</OText>
|
|
276
276
|
)}
|
|
277
277
|
{order?.payment_events?.length > 0 && (
|
|
@@ -286,8 +286,8 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
286
286
|
? `${walletName[event?.wallet_event?.wallet?.type]?.name} - `
|
|
287
287
|
: walletName[event?.wallet_event?.wallet?.type]?.name
|
|
288
288
|
: idx < order?.payment_events?.length - 1
|
|
289
|
-
? `${event?.paymethod?.name} - `
|
|
290
|
-
: event?.paymethod?.name
|
|
289
|
+
? `${t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)} - `
|
|
290
|
+
: t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
|
|
291
291
|
})}
|
|
292
292
|
</OText>
|
|
293
293
|
</View>
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
//React & React Native
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
|
|
5
|
+
// Thirds
|
|
6
|
+
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
7
|
+
|
|
8
|
+
//OrderingComponent
|
|
9
|
+
import {
|
|
10
|
+
useLanguage,
|
|
11
|
+
OrderDetails as OrderDetailsConTableoller,
|
|
12
|
+
useSession,
|
|
13
|
+
} from 'ordering-components/native';
|
|
14
|
+
|
|
15
|
+
//Components
|
|
16
|
+
import Alert from '../../providers/AlertProvider';
|
|
17
|
+
import { FloatingButton } from '../FloatingButton';
|
|
18
|
+
import { OrderDetailsLogisticParams } from '../../types';
|
|
19
|
+
import { useTheme } from 'styled-components/native';
|
|
20
|
+
import { NotFoundSource } from '../NotFoundSource';
|
|
21
|
+
import { getOrderStatus } from '../../utils';
|
|
22
|
+
import { OrderHeaderComponent } from '../OrderDetails/OrderHeaderComponent';
|
|
23
|
+
import { OrderContentComponent } from '../OrderDetails/OrderContentComponent';
|
|
24
|
+
//Styles
|
|
25
|
+
import { OrderDetailsContainer } from './styles';
|
|
26
|
+
|
|
27
|
+
export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
|
|
28
|
+
const {
|
|
29
|
+
navigation,
|
|
30
|
+
handleClickLogisticOrder,
|
|
31
|
+
orderAssingId,
|
|
32
|
+
} = props;
|
|
33
|
+
const { order } = props.order
|
|
34
|
+
const theme = useTheme();
|
|
35
|
+
const [, t] = useLanguage();
|
|
36
|
+
const [session] = useSession();
|
|
37
|
+
const [alertState, setAlertState] = useState<{
|
|
38
|
+
open: boolean;
|
|
39
|
+
content: Array<string>;
|
|
40
|
+
key?: string | null;
|
|
41
|
+
}>({ open: false, content: [], key: null });
|
|
42
|
+
|
|
43
|
+
const logisticOrderStatus = [4, 6, 7]
|
|
44
|
+
|
|
45
|
+
const showFloatButtonsAcceptOrReject: any = {
|
|
46
|
+
0: true,
|
|
47
|
+
4: true,
|
|
48
|
+
7: true,
|
|
49
|
+
14: true
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const handleArrowBack: any = () => {
|
|
53
|
+
navigation?.canGoBack() && navigation.goBack();
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleRejectLogisticOrder = (order: any) => {
|
|
57
|
+
handleClickLogisticOrder?.(2, orderAssingId || order?.logistic_order_id)
|
|
58
|
+
handleArrowBack()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const handleAcceptLogisticOrder = (order: any) => {
|
|
62
|
+
handleClickLogisticOrder?.(1, orderAssingId || order?.logistic_order_id)
|
|
63
|
+
handleArrowBack()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (order?.driver === null && session?.user?.level === 4) {
|
|
68
|
+
setAlertState({
|
|
69
|
+
open: true,
|
|
70
|
+
content: [
|
|
71
|
+
t(
|
|
72
|
+
'YOU_HAVE_BEEN_REMOVED_FROM_THE_ORDER',
|
|
73
|
+
'You have been removed from the order',
|
|
74
|
+
),
|
|
75
|
+
],
|
|
76
|
+
key: null,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}, [order?.driver]);
|
|
80
|
+
|
|
81
|
+
const OrderDetailsInformation = (props: { order: any, isOrderGroup?: boolean, lastOrder?: boolean }) => {
|
|
82
|
+
const {
|
|
83
|
+
order,
|
|
84
|
+
isOrderGroup,
|
|
85
|
+
lastOrder,
|
|
86
|
+
} = props
|
|
87
|
+
return (
|
|
88
|
+
<>
|
|
89
|
+
<OrderContentComponent
|
|
90
|
+
order={order}
|
|
91
|
+
logisticOrderStatus={logisticOrderStatus}
|
|
92
|
+
isOrderGroup={isOrderGroup}
|
|
93
|
+
lastOrder={lastOrder}
|
|
94
|
+
/>
|
|
95
|
+
<View
|
|
96
|
+
style={{
|
|
97
|
+
height:
|
|
98
|
+
order?.status === 8 && order?.delivery_type === 1 ? 50 : 35,
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
|
|
102
|
+
</>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<>
|
|
108
|
+
{(!order || Object.keys(order).length === 0) &&
|
|
109
|
+
(props.order?.error?.length < 1 || !props.order?.error) && (
|
|
110
|
+
<View style={{ flex: 1 }}>
|
|
111
|
+
{[...Array(6)].map((item, i) => (
|
|
112
|
+
<Placeholder key={i} Animation={Fade}>
|
|
113
|
+
<View style={{ flexDirection: 'row', paddingVertical: 20 }}>
|
|
114
|
+
<Placeholder>
|
|
115
|
+
<PlaceholderLine width={100} />
|
|
116
|
+
<PlaceholderLine width={70} />
|
|
117
|
+
<PlaceholderLine width={30} />
|
|
118
|
+
<PlaceholderLine width={20} />
|
|
119
|
+
</Placeholder>
|
|
120
|
+
</View>
|
|
121
|
+
</Placeholder>
|
|
122
|
+
))}
|
|
123
|
+
</View>
|
|
124
|
+
)}
|
|
125
|
+
|
|
126
|
+
{(!!props.order?.error || props.order?.error) && (
|
|
127
|
+
<NotFoundSource
|
|
128
|
+
btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
|
|
129
|
+
content={
|
|
130
|
+
props.order.error[0] ||
|
|
131
|
+
props.order.error ||
|
|
132
|
+
t('NETWORK_ERROR', 'Network Error')
|
|
133
|
+
}
|
|
134
|
+
onClickButton={() => navigation.navigate('Orders')}
|
|
135
|
+
/>
|
|
136
|
+
)}
|
|
137
|
+
{!((!order || Object.keys(order).length === 0) &&
|
|
138
|
+
(props.order?.error?.length < 1 || !props.order?.error)) && (
|
|
139
|
+
<View style={{ flex: 1 }}>
|
|
140
|
+
<OrderHeaderComponent
|
|
141
|
+
order={order}
|
|
142
|
+
getOrderStatus={getOrderStatus}
|
|
143
|
+
handleArrowBack={handleArrowBack}
|
|
144
|
+
logisticOrderStatus={logisticOrderStatus}
|
|
145
|
+
/>
|
|
146
|
+
{order && Object.keys(order).length > 0 && (props.order?.error?.length < 1 || !props.order?.error) && (
|
|
147
|
+
<>
|
|
148
|
+
<OrderDetailsContainer
|
|
149
|
+
keyboardShouldPersistTaps="handled"
|
|
150
|
+
showsVerticalScrollIndicator={false}
|
|
151
|
+
>
|
|
152
|
+
{order?.order_group && order?.order_group_id && order?.isLogistic ? order?.order_group?.orders.map((order: any, i: number, hash: any) => (
|
|
153
|
+
<OrderDetailsInformation key={order?.id} order={order} isOrderGroup lastOrder={hash?.length === i + 1} />
|
|
154
|
+
)) : (
|
|
155
|
+
<OrderDetailsInformation order={order} />
|
|
156
|
+
)}
|
|
157
|
+
</OrderDetailsContainer>
|
|
158
|
+
|
|
159
|
+
{showFloatButtonsAcceptOrReject[order?.status] && (
|
|
160
|
+
<FloatingButton
|
|
161
|
+
btnText={t('REJECT', 'Reject')}
|
|
162
|
+
isSecondaryBtn={false}
|
|
163
|
+
secondButtonClick={() => handleAcceptLogisticOrder(order)}
|
|
164
|
+
firstButtonClick={() => handleRejectLogisticOrder(order)}
|
|
165
|
+
secondBtnText={t('ACCEPT', 'Accept')}
|
|
166
|
+
secondButton={true}
|
|
167
|
+
firstColorCustom={theme.colors.red}
|
|
168
|
+
secondColorCustom={theme.colors.green}
|
|
169
|
+
widthButton={'45%'}
|
|
170
|
+
/>
|
|
171
|
+
)}
|
|
172
|
+
</>
|
|
173
|
+
)}
|
|
174
|
+
</View>
|
|
175
|
+
)}
|
|
176
|
+
{alertState?.open && (
|
|
177
|
+
<Alert
|
|
178
|
+
open={alertState.open}
|
|
179
|
+
onAccept={handleArrowBack}
|
|
180
|
+
onClose={handleArrowBack}
|
|
181
|
+
content={alertState.content}
|
|
182
|
+
title={t('WARNING', 'Warning')}
|
|
183
|
+
/>
|
|
184
|
+
)}
|
|
185
|
+
</>
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const OrderDetailsLogistic = (props: OrderDetailsLogisticParams) => {
|
|
190
|
+
const orderDetailsProps = {
|
|
191
|
+
...props,
|
|
192
|
+
UIComponent: OrderDetailsLogisticUI,
|
|
193
|
+
};
|
|
194
|
+
return <OrderDetailsConTableoller {...orderDetailsProps} />;
|
|
195
|
+
};
|