ordering-ui-react-native 0.22.47 → 0.22.48-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -8
- package/src/DeliveryApp.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +40 -39
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/context/OfflineActions/index.tsx +236 -0
- package/src/providers/AlertProvider.tsx +3 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/BusinessController/index.tsx +8 -3
- package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
- package/themes/business/src/components/Chat/index.tsx +15 -3
- package/themes/business/src/components/DriverMap/index.tsx +44 -33
- package/themes/business/src/components/FloatingButton/index.tsx +3 -2
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -1
- package/themes/business/src/components/LoginForm/index.tsx +123 -98
- package/themes/business/src/components/LogoutButton/index.tsx +13 -4
- package/themes/business/src/components/MapView/index.tsx +42 -22
- package/themes/business/src/components/NewOrderNotification/index.tsx +38 -19
- package/themes/business/src/components/OrderDetails/Business.tsx +88 -20
- package/themes/business/src/components/OrderDetails/Delivery.tsx +134 -53
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +155 -45
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +51 -28
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/OrderSummary/index.tsx +271 -176
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +332 -231
- package/themes/business/src/components/OrdersOption/styles.tsx +14 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +30 -18
- package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
- package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
- package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +143 -75
- package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +1 -1
- package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +48 -10
- package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/config/currency.tsx +1010 -0
- package/themes/business/src/hooks/useLocation.tsx +16 -12
- package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
- package/themes/business/src/types/index.tsx +22 -7
- package/themes/business/src/utils/index.tsx +28 -3
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +9 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +121 -57
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +9 -1
- package/themes/original/src/components/AddressForm/index.tsx +19 -19
- package/themes/original/src/components/AddressList/index.tsx +0 -13
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +1 -1
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +14 -6
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +8 -6
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +46 -28
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
- package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +10 -6
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +49 -15
- package/themes/original/src/components/CartContent/index.tsx +2 -4
- package/themes/original/src/components/Checkout/index.tsx +109 -88
- package/themes/original/src/components/CitiesControl/index.tsx +0 -3
- package/themes/original/src/components/CouponControl/index.tsx +1 -3
- package/themes/original/src/components/DriverTips/index.tsx +1 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -10
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -12
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +0 -5
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -5
- package/themes/original/src/components/HelpGuide/index.tsx +0 -5
- package/themes/original/src/components/HelpOrder/index.tsx +0 -5
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +35 -19
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +12 -14
- package/themes/original/src/components/MessageListing/index.tsx +1 -6
- package/themes/original/src/components/Messages/index.tsx +20 -13
- package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
- package/themes/original/src/components/MomentOption/index.tsx +73 -59
- package/themes/original/src/components/MomentSelector/index.tsx +5 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -4
- package/themes/original/src/components/MultiCheckout/index.tsx +55 -27
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
- package/themes/original/src/components/MyOrders/index.tsx +2 -7
- package/themes/original/src/components/NavBar/index.tsx +7 -6
- package/themes/original/src/components/NetworkError/index.tsx +0 -5
- package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
- package/themes/original/src/components/Notifications/index.tsx +0 -5
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +16 -11
- package/themes/original/src/components/OrderDetails/index.tsx +44 -21
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +4 -3
- package/themes/original/src/components/OrderSummary/index.tsx +32 -11
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -11
- package/themes/original/src/components/OrdersOption/index.tsx +3 -6
- package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +462 -461
- package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -4
- package/themes/original/src/components/ProductForm/ActionButton.tsx +7 -12
- package/themes/original/src/components/ProductItemAccordion/index.tsx +28 -37
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
- package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
- package/themes/original/src/components/Promotions/index.tsx +2 -7
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -7
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -6
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +52 -54
- package/themes/original/src/components/Sessions/index.tsx +3 -8
- package/themes/original/src/components/SignupForm/index.tsx +44 -37
- package/themes/original/src/components/SingleOrderCard/index.tsx +7 -5
- package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +16 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +8 -4
- package/themes/original/src/components/StripeElementsForm/naked.tsx +1 -1
- package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +8 -5
- package/themes/original/src/components/UserDetails/index.tsx +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +113 -73
- package/themes/original/src/components/UserProfile/index.tsx +9 -1
- package/themes/original/src/components/UserProfileForm/index.tsx +0 -5
- package/themes/original/src/components/UserVerification/index.tsx +18 -5
- package/themes/original/src/components/Wallets/index.tsx +1 -3
- package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -4
- package/themes/original/src/components/shared/OInput.tsx +4 -8
- package/themes/original/src/components/shared/OModal.tsx +7 -2
- package/themes/original/src/types/index.tsx +12 -4
- package/themes/original/src/utils/index.tsx +29 -0
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -154,3 +154,17 @@ export const Actions = styled.View`
|
|
|
154
154
|
export const InputContainer = styled.View`
|
|
155
155
|
position: relative;
|
|
156
156
|
`
|
|
157
|
+
|
|
158
|
+
export const FilterAlert = styled.View`
|
|
159
|
+
position: absolute;
|
|
160
|
+
z-index: 1000;
|
|
161
|
+
flex-direction: row;
|
|
162
|
+
top: 50px;
|
|
163
|
+
background-color: #FFF9E2;
|
|
164
|
+
flex-wrap: wrap;
|
|
165
|
+
align-items: flex-start;
|
|
166
|
+
justify-content: flex-start;
|
|
167
|
+
right: 10px;
|
|
168
|
+
padding: 5px;
|
|
169
|
+
border-radius: 10px
|
|
170
|
+
`
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { StyleSheet, TouchableOpacity, FlatList, RefreshControl } from 'react-native';
|
|
3
|
+
import FastImage from 'react-native-fast-image';
|
|
3
4
|
import { useTheme } from 'styled-components/native';
|
|
4
5
|
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
5
6
|
import { Card, Logo, Information, Header, Badge } from './styles';
|
|
@@ -201,6 +202,24 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
|
|
|
201
202
|
value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
202
203
|
slug: 'ORDER_DRIVER_ON_WAY',
|
|
203
204
|
percentage: 45
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
key: 24,
|
|
208
|
+
value: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order'),
|
|
209
|
+
slug: 'ORDER_DRIVER_WAITING_FOR_ORDER',
|
|
210
|
+
percentage: 25
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
key: 25,
|
|
214
|
+
value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company'),
|
|
215
|
+
slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
|
|
216
|
+
percentage: 25
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
key: 26,
|
|
220
|
+
value: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer'),
|
|
221
|
+
slug: 'ORDER_DRIVER_ARRIVED_CUSTOMER',
|
|
222
|
+
percentage: 80
|
|
204
223
|
}
|
|
205
224
|
];
|
|
206
225
|
|
|
@@ -284,10 +303,14 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
|
|
|
284
303
|
activeOpacity={1}>
|
|
285
304
|
<Card key={order?.id}>
|
|
286
305
|
<Logo style={styles.logo}>
|
|
287
|
-
<
|
|
288
|
-
url={optimizeImage(order?.business?.logo, 'h_300,c_limit')}
|
|
289
|
-
src={!order?.business?.logo && theme?.images?.dummies?.businessLogo}
|
|
306
|
+
<FastImage
|
|
290
307
|
style={styles.icon}
|
|
308
|
+
source={order.business?.logo?.includes('https') ? {
|
|
309
|
+
uri: order.business?.logo,
|
|
310
|
+
priority: FastImage.priority.high,
|
|
311
|
+
cache: FastImage.cacheControl.immutable
|
|
312
|
+
} : order.business?.logo ?? theme?.images?.dummies?.businessLogo}
|
|
313
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
291
314
|
/>
|
|
292
315
|
</Logo>
|
|
293
316
|
<Information>
|
|
@@ -58,9 +58,14 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
58
58
|
const styles = StyleSheet.create({
|
|
59
59
|
cardButton: {
|
|
60
60
|
flex: 1,
|
|
61
|
-
paddingVertical: (isIpad || isTablet) ? 20 :
|
|
62
|
-
marginBottom: IS_PORTRAIT ?
|
|
61
|
+
paddingVertical: (isIpad || isTablet) ? 20 : 15,
|
|
62
|
+
marginBottom: IS_PORTRAIT ? 15 : 0,
|
|
63
63
|
marginLeft: 3,
|
|
64
|
+
backgroundColor: order?.time_status === 'delayed'
|
|
65
|
+
? theme.colors.danger100
|
|
66
|
+
: order?.time_status === 'at_risk'
|
|
67
|
+
? theme.colors.warning100
|
|
68
|
+
: '#fff'
|
|
64
69
|
},
|
|
65
70
|
icon: {
|
|
66
71
|
borderRadius: 7.6,
|
|
@@ -77,7 +82,6 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
77
82
|
marginLeft: 3,
|
|
78
83
|
},
|
|
79
84
|
title: {
|
|
80
|
-
marginBottom: showExternalId ? 0 : 6,
|
|
81
85
|
fontFamily: 'Poppins',
|
|
82
86
|
fontStyle: 'normal',
|
|
83
87
|
fontWeight: '600',
|
|
@@ -85,7 +89,6 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
85
89
|
color: theme.colors.textGray,
|
|
86
90
|
},
|
|
87
91
|
date: {
|
|
88
|
-
marginBottom: showExternalId ? 0 : 6,
|
|
89
92
|
fontFamily: 'Poppins',
|
|
90
93
|
fontStyle: 'normal',
|
|
91
94
|
fontWeight: 'normal',
|
|
@@ -150,17 +153,18 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
150
153
|
timeState={order?.time_status}
|
|
151
154
|
/>
|
|
152
155
|
)}
|
|
153
|
-
<Logo style={styles.logo}>
|
|
156
|
+
<Logo style={styles.logo} hasExternalAndGroup={showExternalId && order?.order_group_id}>
|
|
154
157
|
<FastImage
|
|
155
158
|
style={styles.icon}
|
|
156
159
|
source={order.business?.logo?.includes('https') ? {
|
|
157
160
|
uri: order.business?.logo,
|
|
158
|
-
priority: FastImage.priority.
|
|
161
|
+
priority: FastImage.priority.high,
|
|
162
|
+
cache: FastImage.cacheControl.immutable
|
|
159
163
|
} : order.business?.logo ?? theme?.images?.dummies?.businessLogo}
|
|
160
164
|
resizeMode={FastImage.resizeMode.cover}
|
|
161
165
|
/>
|
|
162
166
|
</Logo>
|
|
163
|
-
<Information>
|
|
167
|
+
<Information hasExternalAndGroup={showExternalId && order?.order_group_id}>
|
|
164
168
|
{!!order?.order_group_id && (
|
|
165
169
|
<OText>
|
|
166
170
|
<OText>{(t('INVOICE_GROUP_NO', 'Group No.') + order?.order_group_id)}</OText>
|
|
@@ -180,34 +184,36 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
180
184
|
/>
|
|
181
185
|
</NotificationIcon>
|
|
182
186
|
)}
|
|
183
|
-
<View
|
|
184
|
-
{
|
|
187
|
+
<View>
|
|
188
|
+
{showExternalId && (
|
|
185
189
|
<OText
|
|
186
190
|
style={styles.date}
|
|
187
191
|
color={theme.colors.unselectText}
|
|
188
192
|
numberOfLines={1}
|
|
189
193
|
adjustsFontSizeToFit
|
|
190
194
|
>
|
|
191
|
-
{order?.external_id ?? t('NO_EXTERNAL_ID', 'No external Id ') + t('NO', 'Order No.') + order?.id}
|
|
195
|
+
{`${order?.external_id ?? t('NO_EXTERNAL_ID', 'No external Id ') + t('NO', 'Order No.') + order?.id}` + ' · ' + `${order?.delivery_datetime_utc
|
|
196
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
197
|
+
: parseDate(order?.delivery_datetime, { utc: false })
|
|
198
|
+
}`}
|
|
192
199
|
</OText>
|
|
193
200
|
)}
|
|
194
|
-
<OText
|
|
201
|
+
{!showExternalId && (<OText
|
|
195
202
|
style={styles.date}
|
|
196
203
|
color={theme.colors.unselectText}
|
|
197
204
|
numberOfLines={1}
|
|
198
205
|
adjustsFontSizeToFit
|
|
199
206
|
>
|
|
200
|
-
{
|
|
207
|
+
{((!!order?.order_group_id && order?.order_group && isLogisticOrder
|
|
201
208
|
? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}`
|
|
202
209
|
: (t('NO', 'Order No.') + order?.id)
|
|
203
|
-
) + ' · '
|
|
204
|
-
{order?.delivery_datetime_utc
|
|
210
|
+
) + ' · ' + `${order?.delivery_datetime_utc
|
|
205
211
|
? parseDate(order?.delivery_datetime_utc)
|
|
206
|
-
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
212
|
+
: parseDate(order?.delivery_datetime, { utc: false })}`)}
|
|
207
213
|
</OText>
|
|
208
|
-
|
|
214
|
+
)}
|
|
215
|
+
{((currentTabSelected === 'pending' || currentTabSelected === 'inProgress' || currentTabSelected === 'active') && allowColumns?.timer) && (
|
|
209
216
|
<>
|
|
210
|
-
{!showExternalId && <OText> · </OText>}
|
|
211
217
|
<OText
|
|
212
218
|
style={styles.date}
|
|
213
219
|
color={
|
|
@@ -240,7 +246,13 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
240
246
|
? t('EAT_IN', 'Eat in')
|
|
241
247
|
: order.delivery_type === 4
|
|
242
248
|
? t('CURBSIDE', 'Curbside')
|
|
243
|
-
:
|
|
249
|
+
: order.delivery_type === 5
|
|
250
|
+
? t('DRIVER_THRU', 'Driver thru')
|
|
251
|
+
: order.delivery_type === 7
|
|
252
|
+
? t('CATERING_DELIVERY', 'Catering delivery')
|
|
253
|
+
: order.delivery_type === 8
|
|
254
|
+
? t('CATERING_PICKUP', 'Catering pickup')
|
|
255
|
+
: t('DELIVERY', 'Delivery')}
|
|
244
256
|
{` · ${getOrderStatus(order.status)}`}
|
|
245
257
|
</OText>
|
|
246
258
|
</MyOrderOptions>
|
|
@@ -11,6 +11,7 @@ import { OrdersList } from './OrderList';
|
|
|
11
11
|
import { AcceptOrRejectOrder } from '../AcceptOrRejectOrder';
|
|
12
12
|
import { ReviewCustomer } from '../ReviewCustomer';
|
|
13
13
|
import { GoogleMap } from '../GoogleMap';
|
|
14
|
+
import { useOfflineActions } from '../../../../../src/context/OfflineActions';
|
|
14
15
|
|
|
15
16
|
export const PreviousOrders = (props: any) => {
|
|
16
17
|
const {
|
|
@@ -32,7 +33,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
32
33
|
const [, t] = useLanguage();
|
|
33
34
|
const theme = useTheme();
|
|
34
35
|
const [{ configs }] = useConfig();
|
|
35
|
-
|
|
36
|
+
const [{ isNetConnected, canSaveChangesOffline }] = useOfflineActions()
|
|
36
37
|
|
|
37
38
|
// const [, setCurrentTime] = useState()
|
|
38
39
|
const [openModal, setOpenModal] = useState(false)
|
|
@@ -41,12 +42,14 @@ export const PreviousOrders = (props: any) => {
|
|
|
41
42
|
const [orderUpdateStatus, setOrderUpdateStatus] = useState<any>({ action: '', ids: [], body: {}, order: {} })
|
|
42
43
|
|
|
43
44
|
const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
|
|
44
|
-
const viewMapStatus = [9, 18, 19, 23]
|
|
45
|
+
const viewMapStatus = [9, 18, 19, 23, 26]
|
|
46
|
+
const deliveryTypes = [1, 7]
|
|
45
47
|
const deliveryPickupBtn = props.appTitle?.text?.includes('Delivery') && [3, 8, 18]
|
|
46
|
-
const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23]
|
|
48
|
+
const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23, 26]
|
|
47
49
|
const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1' && !isBusinessApp
|
|
48
50
|
const isEnabledOrderNotReady = configs?.order_not_ready_enabled?.value === '1'
|
|
49
51
|
const isEnabledFailedPickupDriver = configs?.failed_pickup_by_driver_enabled?.value === '1'
|
|
52
|
+
const disabledActionsByInternet = !isNetConnected && canSaveChangesOffline === false
|
|
50
53
|
|
|
51
54
|
const handlePressOrder = (order: any) => {
|
|
52
55
|
if (order?.locked && isLogisticOrder) return
|
|
@@ -172,7 +175,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
172
175
|
}
|
|
173
176
|
)
|
|
174
177
|
}
|
|
175
|
-
{_ordersGrouped[k][0]?.status === 0 && (
|
|
178
|
+
{_ordersGrouped[k][0]?.status === 0 && !disabledActionsByInternet && (
|
|
176
179
|
<AcceptOrRejectOrderStyle>
|
|
177
180
|
{!isHideRejectButtons && (
|
|
178
181
|
<OButton
|
|
@@ -208,7 +211,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
208
211
|
/>
|
|
209
212
|
</AcceptOrRejectOrderStyle>
|
|
210
213
|
)}
|
|
211
|
-
{_ordersGrouped[k][0]?.status === 7 && (
|
|
214
|
+
{_ordersGrouped[k][0]?.status === 7 && !disabledActionsByInternet && (
|
|
212
215
|
<View>
|
|
213
216
|
<OButton
|
|
214
217
|
text={t('READY_FOR_PICKUP', 'Ready for pickup')}
|
|
@@ -226,7 +229,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
226
229
|
</View>
|
|
227
230
|
)}
|
|
228
231
|
{(_ordersGrouped[k][0]?.status === 8 || _ordersGrouped[k][0]?.status === 18) &&
|
|
229
|
-
_ordersGrouped[k][0]?.delivery_type
|
|
232
|
+
deliveryTypes?.includes(_ordersGrouped[k][0]?.delivery_type) && !disabledActionsByInternet &&
|
|
230
233
|
(
|
|
231
234
|
<AcceptOrRejectOrderStyle>
|
|
232
235
|
<OButton
|
|
@@ -244,7 +247,8 @@ export const PreviousOrders = (props: any) => {
|
|
|
244
247
|
/>
|
|
245
248
|
</AcceptOrRejectOrderStyle>
|
|
246
249
|
)}
|
|
247
|
-
{_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type
|
|
250
|
+
{_ordersGrouped[k][0]?.status === 3 && deliveryTypes?.includes(_ordersGrouped[k][0]?.delivery_type) && !isHideRejectButtons && isEnabledOrderNotReady &&
|
|
251
|
+
!disabledActionsByInternet &&
|
|
248
252
|
(
|
|
249
253
|
<AcceptOrRejectOrderStyle>
|
|
250
254
|
<OButton
|
|
@@ -282,6 +286,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
282
286
|
)}
|
|
283
287
|
{_ordersGrouped[k][0]?.status === 4 &&
|
|
284
288
|
![1].includes(_ordersGrouped[k][0]?.delivery_type) &&
|
|
289
|
+
!disabledActionsByInternet &&
|
|
285
290
|
(
|
|
286
291
|
<AcceptOrRejectOrderStyle>
|
|
287
292
|
{!isHideRejectButtons && (
|
|
@@ -316,6 +321,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
316
321
|
)}
|
|
317
322
|
{!_ordersGrouped[k][0]?.user_review &&
|
|
318
323
|
pastOrderStatuses.includes(_ordersGrouped[k][0]?.status) &&
|
|
324
|
+
!disabledActionsByInternet &&
|
|
319
325
|
(
|
|
320
326
|
<OButton
|
|
321
327
|
text={t('REVIEW_CUSTOMER', 'Review customer')}
|
|
@@ -332,74 +338,76 @@ export const PreviousOrders = (props: any) => {
|
|
|
332
338
|
})}
|
|
333
339
|
/>
|
|
334
340
|
)}
|
|
335
|
-
{!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && isEnabledFailedPickupDriver &&
|
|
336
|
-
|
|
337
|
-
|
|
341
|
+
{!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && isEnabledFailedPickupDriver &&
|
|
342
|
+
!disabledActionsByInternet && (
|
|
343
|
+
<AcceptOrRejectOrderStyle>
|
|
344
|
+
{!isHideRejectButtons && isEnabledOrderNotReady && (
|
|
345
|
+
<OButton
|
|
346
|
+
text={t('PICKUP_FAILED', 'Pickup failed')}
|
|
347
|
+
bgColor={theme.colors.danger100}
|
|
348
|
+
borderColor={theme.colors.danger100}
|
|
349
|
+
imgRightSrc={null}
|
|
350
|
+
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
351
|
+
parentStyle={{ width: '45%' }}
|
|
352
|
+
textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
|
|
353
|
+
onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
|
|
354
|
+
action: 'pickupFailed',
|
|
355
|
+
order: _ordersGrouped[k][0],
|
|
356
|
+
ids: _ordersGrouped[k].map((o: any) => o.id),
|
|
357
|
+
handleChangeOrderStatus
|
|
358
|
+
})}
|
|
359
|
+
/>
|
|
360
|
+
)}
|
|
338
361
|
<OButton
|
|
339
|
-
text={t('
|
|
340
|
-
bgColor={theme.colors.
|
|
341
|
-
borderColor={theme.colors.
|
|
362
|
+
text={t('PICKUP_COMPLETE', 'Pickup complete')}
|
|
363
|
+
bgColor={theme.colors.success100}
|
|
364
|
+
borderColor={theme.colors.success100}
|
|
342
365
|
imgRightSrc={null}
|
|
343
366
|
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
344
|
-
parentStyle={{ width: '45%' }}
|
|
345
|
-
textStyle={{ color: theme.colors.
|
|
346
|
-
onClick={() =>
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
handleChangeOrderStatus
|
|
351
|
-
})}
|
|
367
|
+
parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
|
|
368
|
+
textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
|
|
369
|
+
onClick={() => handleChangeOrderStatus(
|
|
370
|
+
9,
|
|
371
|
+
_ordersGrouped[k].map((o: any) => o.id),
|
|
372
|
+
)}
|
|
352
373
|
/>
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
374
|
+
</AcceptOrRejectOrderStyle>
|
|
375
|
+
)}
|
|
376
|
+
{!!deliveryStatusCompleteBtn && deliveryStatusCompleteBtn.includes(_ordersGrouped[k][0]?.status) &&
|
|
377
|
+
!disabledActionsByInternet && (
|
|
378
|
+
<AcceptOrRejectOrderStyle>
|
|
379
|
+
{!isHideRejectButtons && (
|
|
380
|
+
<OButton
|
|
381
|
+
text={t('DELIVERY_FAILED', 'Delivery Failed')}
|
|
382
|
+
bgColor={theme.colors.danger100}
|
|
383
|
+
borderColor={theme.colors.danger100}
|
|
384
|
+
imgRightSrc={null}
|
|
385
|
+
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
386
|
+
parentStyle={{ width: '45%' }}
|
|
387
|
+
textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
|
|
388
|
+
onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
|
|
389
|
+
action: 'deliveryFailed',
|
|
390
|
+
order: _ordersGrouped[k][0],
|
|
391
|
+
ids: _ordersGrouped[k].map((o: any) => o.id),
|
|
392
|
+
handleChangeOrderStatus
|
|
393
|
+
})}
|
|
394
|
+
/>
|
|
365
395
|
)}
|
|
366
|
-
/>
|
|
367
|
-
</AcceptOrRejectOrderStyle>
|
|
368
|
-
)}
|
|
369
|
-
{!!deliveryStatusCompleteBtn && deliveryStatusCompleteBtn.includes(_ordersGrouped[k][0]?.status) && (
|
|
370
|
-
<AcceptOrRejectOrderStyle>
|
|
371
|
-
{!isHideRejectButtons && (
|
|
372
396
|
<OButton
|
|
373
|
-
text={t('
|
|
374
|
-
bgColor={theme.colors.
|
|
375
|
-
borderColor={theme.colors.
|
|
397
|
+
text={t('DELIVERY_COMPLETE', 'Delivery complete')}
|
|
398
|
+
bgColor={theme.colors.success100}
|
|
399
|
+
borderColor={theme.colors.success100}
|
|
376
400
|
imgRightSrc={null}
|
|
377
401
|
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
378
|
-
parentStyle={{ width: '45%' }}
|
|
379
|
-
textStyle={{ color: theme.colors.
|
|
380
|
-
onClick={() =>
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
handleChangeOrderStatus
|
|
385
|
-
})}
|
|
402
|
+
parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
|
|
403
|
+
textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
|
|
404
|
+
onClick={() => handleChangeOrderStatus(
|
|
405
|
+
11,
|
|
406
|
+
_ordersGrouped[k].map((o: any) => o.id),
|
|
407
|
+
)}
|
|
386
408
|
/>
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
text={t('DELIVERY_COMPLETE', 'Delivery complete')}
|
|
390
|
-
bgColor={theme.colors.success100}
|
|
391
|
-
borderColor={theme.colors.success100}
|
|
392
|
-
imgRightSrc={null}
|
|
393
|
-
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
394
|
-
parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
|
|
395
|
-
textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
|
|
396
|
-
onClick={() => handleChangeOrderStatus(
|
|
397
|
-
11,
|
|
398
|
-
_ordersGrouped[k].map((o: any) => o.id),
|
|
399
|
-
)}
|
|
400
|
-
/>
|
|
401
|
-
</AcceptOrRejectOrderStyle>
|
|
402
|
-
)}
|
|
409
|
+
</AcceptOrRejectOrderStyle>
|
|
410
|
+
)}
|
|
403
411
|
</OrdersGroupedItem>
|
|
404
412
|
))}
|
|
405
413
|
</View>
|
|
@@ -10,6 +10,7 @@ export const Card = styled.View`
|
|
|
10
10
|
export const Logo = styled.View`
|
|
11
11
|
height: 65px;
|
|
12
12
|
width: 65px;
|
|
13
|
+
align-self: ${({ hasExternalAndGroup }: any) => hasExternalAndGroup ? 'center' : 'auto'};
|
|
13
14
|
`;
|
|
14
15
|
|
|
15
16
|
export const Information = styled.View`
|
|
@@ -17,7 +18,7 @@ export const Information = styled.View`
|
|
|
17
18
|
justify-content: flex-start;
|
|
18
19
|
margin-horizontal: 5px;
|
|
19
20
|
flex: 1;
|
|
20
|
-
max-height: 60px;
|
|
21
|
+
max-height: ${({ hasExternalAndGroup }: any) => hasExternalAndGroup ? '75px' : '60px'};
|
|
21
22
|
`;
|
|
22
23
|
|
|
23
24
|
export const MyOrderOptions = styled.View`
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { useTheme } from 'styled-components/native'
|
|
3
|
+
import { OText } from '../shared'
|
|
4
|
+
|
|
5
|
+
export const MessageAlert = ({ message, resetMsg }: any) => {
|
|
6
|
+
const theme = useTheme()
|
|
7
|
+
|
|
8
|
+
const [text, setText] = useState(message)
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setText(message)
|
|
12
|
+
}, [message])
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (text) {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
setText(null)
|
|
18
|
+
resetMsg()
|
|
19
|
+
}, 2000);
|
|
20
|
+
}
|
|
21
|
+
}, [text])
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
text ? (
|
|
25
|
+
<OText
|
|
26
|
+
size={14}
|
|
27
|
+
color={theme.colors.danger500}
|
|
28
|
+
>
|
|
29
|
+
{text}
|
|
30
|
+
</OText>
|
|
31
|
+
) : null
|
|
32
|
+
)
|
|
33
|
+
}
|