ordering-ui-react-native 0.17.64 → 0.17.65-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +1 -21
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +2 -1
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +5 -0
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +270 -245
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +123 -111
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/DriverSchedule/index.tsx +42 -5
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
- package/themes/business/src/components/LoginForm/index.tsx +15 -22
- package/themes/business/src/components/MapView/index.tsx +10 -10
- package/themes/business/src/components/NewOrderNotification/index.tsx +35 -21
- 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 +191 -6
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +133 -65
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +64 -63
- 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/OrderMessage/index.tsx +19 -18
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersOption/index.tsx +32 -75
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +249 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +444 -242
- package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
- package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
- package/themes/business/src/components/ReviewCustomer/index.tsx +30 -15
- package/themes/business/src/components/StoresList/index.tsx +3 -4
- package/themes/business/src/components/UserProfileForm/index.tsx +11 -13
- package/themes/business/src/components/shared/OLink.tsx +33 -13
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/components/shared/OText.tsx +8 -2
- package/themes/business/src/types/index.tsx +28 -12
- package/themes/business/src/utils/index.tsx +29 -2
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +4 -0
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +61 -39
- package/themes/original/src/components/AddressList/index.tsx +27 -22
- package/themes/original/src/components/AddressList/styles.tsx +4 -2
- 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 +153 -96
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
- package/themes/original/src/components/BusinessController/index.tsx +94 -66
- package/themes/original/src/components/BusinessController/styles.tsx +22 -3
- 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 +142 -109
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
- package/themes/original/src/components/BusinessListingSearch/index.tsx +349 -339
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
- package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -555
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +83 -48
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +77 -50
- package/themes/original/src/components/CartContent/index.tsx +117 -20
- package/themes/original/src/components/CartContent/styles.tsx +17 -7
- package/themes/original/src/components/Checkout/index.tsx +356 -124
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DriverTips/index.tsx +52 -34
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +8 -9
- package/themes/original/src/components/Favorite/styles.tsx +1 -1
- package/themes/original/src/components/FavoriteList/index.tsx +1 -35
- 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 +6 -4
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +60 -5
- package/themes/original/src/components/Help/index.tsx +8 -8
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
- package/themes/original/src/components/HelpGuide/index.tsx +6 -6
- package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
- package/themes/original/src/components/HelpOrder/index.tsx +6 -15
- package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
- package/themes/original/src/components/Home/index.tsx +13 -4
- package/themes/original/src/components/LastOrder/index.tsx +1 -34
- package/themes/original/src/components/LoginForm/Otp/index.tsx +54 -15
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +59 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
- package/themes/original/src/components/MessageListing/index.tsx +16 -42
- package/themes/original/src/components/Messages/index.tsx +29 -7
- package/themes/original/src/components/MomentOption/index.tsx +195 -90
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +50 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -51
- package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +68 -21
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +40 -29
- package/themes/original/src/components/NavBar/index.tsx +20 -17
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +46 -50
- package/themes/original/src/components/Notifications/styles.tsx +6 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
- package/themes/original/src/components/OrderDetails/index.tsx +190 -363
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +33 -56
- package/themes/original/src/components/OrderSummary/index.tsx +88 -59
- package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
- package/themes/original/src/components/OrdersOption/index.tsx +78 -67
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +106 -31
- package/themes/original/src/components/PageBanner/styles.tsx +4 -4
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -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 +78 -35
- package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
- package/themes/original/src/components/ProductForm/index.tsx +105 -30
- package/themes/original/src/components/ProductForm/styles.tsx +5 -5
- package/themes/original/src/components/ProductItemAccordion/index.tsx +14 -11
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
- package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
- package/themes/original/src/components/Promotions/index.tsx +5 -4
- package/themes/original/src/components/Promotions/styles.tsx +3 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
- package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- 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 +66 -17
- 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 +43 -27
- package/themes/original/src/components/SingleOrderCard/index.tsx +130 -56
- package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
- package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
- package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +88 -79
- package/themes/original/src/components/UserProfileForm/index.tsx +27 -29
- package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/original/src/components/UserVerification/index.tsx +52 -49
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/Wallets/index.tsx +66 -30
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/OButton.tsx +6 -2
- package/themes/original/src/components/shared/OInput.tsx +6 -1
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/types/index.tsx +36 -10
- package/themes/original/src/utils/index.tsx +273 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Platform, PlatformIOSStatic, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import DeviceInfo from 'react-native-device-info';
|
|
4
|
+
import { useTheme } from 'styled-components/native';
|
|
5
|
+
import { useLanguage, useUtils, useConfig } from 'ordering-components/native';
|
|
6
|
+
import EntypoIcon from 'react-native-vector-icons/Entypo'
|
|
7
|
+
import FastImage from 'react-native-fast-image'
|
|
8
|
+
import moment from 'moment'
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
Card,
|
|
12
|
+
Logo,
|
|
13
|
+
Information,
|
|
14
|
+
MyOrderOptions,
|
|
15
|
+
NotificationIcon,
|
|
16
|
+
Timestatus
|
|
17
|
+
} from './styles'
|
|
18
|
+
|
|
19
|
+
import { OText } from '../shared';
|
|
20
|
+
import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
|
|
21
|
+
|
|
22
|
+
const { useDeviceOrientation, PORTRAIT } = DeviceOrientationMethods
|
|
23
|
+
|
|
24
|
+
export const OrderItem = (props: any) => {
|
|
25
|
+
const {
|
|
26
|
+
order,
|
|
27
|
+
_order,
|
|
28
|
+
isLogisticOrder,
|
|
29
|
+
currentTabSelected,
|
|
30
|
+
getOrderStatus,
|
|
31
|
+
handlePressOrder
|
|
32
|
+
} = props
|
|
33
|
+
|
|
34
|
+
const theme = useTheme()
|
|
35
|
+
const [, t] = useLanguage()
|
|
36
|
+
const [configState] = useConfig()
|
|
37
|
+
const [{ parseDate, optimizeImage }] = useUtils();
|
|
38
|
+
const [orientationState] = useDeviceOrientation();
|
|
39
|
+
|
|
40
|
+
const [allowColumns, setAllowColumns] = useState({
|
|
41
|
+
timer: configState?.configs?.order_deadlines_enabled?.value === '1',
|
|
42
|
+
slaBar: configState?.configs?.order_deadlines_enabled?.value === '1',
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const IS_PORTRAIT = orientationState.orientation === PORTRAIT
|
|
46
|
+
const platformIOS = Platform as PlatformIOSStatic
|
|
47
|
+
|
|
48
|
+
const isIpad = platformIOS.isPad
|
|
49
|
+
const isTablet = DeviceInfo.isTablet();
|
|
50
|
+
|
|
51
|
+
const styles = StyleSheet.create({
|
|
52
|
+
cardButton: {
|
|
53
|
+
flex: 1,
|
|
54
|
+
paddingVertical: (isIpad || isTablet) ? 20 : 0,
|
|
55
|
+
marginBottom: IS_PORTRAIT ? 25 : 0,
|
|
56
|
+
marginLeft: 3,
|
|
57
|
+
},
|
|
58
|
+
icon: {
|
|
59
|
+
borderRadius: 7.6,
|
|
60
|
+
width: 60,
|
|
61
|
+
height: 60
|
|
62
|
+
},
|
|
63
|
+
logo: {
|
|
64
|
+
borderRadius: 10,
|
|
65
|
+
shadowColor: "#0000006e",
|
|
66
|
+
shadowRadius: 10,
|
|
67
|
+
elevation: 15,
|
|
68
|
+
justifyContent: 'center',
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
marginLeft: 3,
|
|
71
|
+
},
|
|
72
|
+
title: {
|
|
73
|
+
marginBottom: 6,
|
|
74
|
+
fontFamily: 'Poppins',
|
|
75
|
+
fontStyle: 'normal',
|
|
76
|
+
fontWeight: '600',
|
|
77
|
+
fontSize: 16,
|
|
78
|
+
color: theme.colors.textGray,
|
|
79
|
+
},
|
|
80
|
+
date: {
|
|
81
|
+
marginBottom: 6,
|
|
82
|
+
fontFamily: 'Poppins',
|
|
83
|
+
fontStyle: 'normal',
|
|
84
|
+
fontWeight: 'normal',
|
|
85
|
+
fontSize: 12,
|
|
86
|
+
},
|
|
87
|
+
orderType: {
|
|
88
|
+
fontSize: 12,
|
|
89
|
+
fontFamily: 'Poppins',
|
|
90
|
+
fontStyle: 'normal',
|
|
91
|
+
fontWeight: 'normal',
|
|
92
|
+
color: theme.colors.orderTypeColor,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const getDelayMinutes = (order: any) => {
|
|
97
|
+
const cdtToutc = moment(order?.delivery_datetime).utc().format('YYYY-MM-DD HH:mm:ss')
|
|
98
|
+
const _delivery = order?.delivery_datetime_utc
|
|
99
|
+
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
|
|
100
|
+
: parseDate(cdtToutc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
|
|
101
|
+
const _eta = order?.eta_time
|
|
102
|
+
const diffTimeAsSeconds = moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'seconds')
|
|
103
|
+
return Math.ceil(diffTimeAsSeconds / 60)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const displayDelayedTime = (order: any) => {
|
|
107
|
+
let tagetedMin = getDelayMinutes(order)
|
|
108
|
+
// get day, hour and minutes
|
|
109
|
+
const sign = tagetedMin >= 0 ? '' : '- '
|
|
110
|
+
tagetedMin = Math.abs(tagetedMin)
|
|
111
|
+
let day: string | number = Math.floor(tagetedMin / 1440)
|
|
112
|
+
const restMinOfTargetedMin = tagetedMin - 1440 * day
|
|
113
|
+
let restHours: string | number = Math.floor(restMinOfTargetedMin / 60)
|
|
114
|
+
let restMins: string | number = restMinOfTargetedMin - 60 * restHours
|
|
115
|
+
// make standard time format
|
|
116
|
+
day = day === 0 ? '' : day + 'day '
|
|
117
|
+
restHours = restHours < 10 ? '0' + restHours : restHours
|
|
118
|
+
restMins = restMins < 10 ? '0' + restMins : restMins
|
|
119
|
+
|
|
120
|
+
const finalTaget = sign + day + restHours + ':' + restMins
|
|
121
|
+
return finalTaget
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const getStatusClassName = (minutes: number) => {
|
|
125
|
+
if (isNaN(Number(minutes))) return 'in_time'
|
|
126
|
+
const delayTime = configState?.configs?.order_deadlines_delayed_time?.value
|
|
127
|
+
return minutes > 0 ? 'in_time' : Math.abs(minutes) <= delayTime ? 'at_risk' : 'delayed'
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
const slaSettings = configState?.configs?.order_deadlines_enabled?.value === '1'
|
|
132
|
+
setAllowColumns({
|
|
133
|
+
...allowColumns,
|
|
134
|
+
timer: slaSettings,
|
|
135
|
+
slaBar: slaSettings
|
|
136
|
+
})
|
|
137
|
+
}, [configState.loading])
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<TouchableOpacity
|
|
141
|
+
activeOpacity={1}
|
|
142
|
+
disabled={order?.locked && isLogisticOrder}
|
|
143
|
+
style={styles.cardButton}
|
|
144
|
+
onPress={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
|
|
145
|
+
>
|
|
146
|
+
<Card key={order.id}>
|
|
147
|
+
{!!allowColumns?.slaBar && (
|
|
148
|
+
<Timestatus
|
|
149
|
+
style={{
|
|
150
|
+
backgroundColor: getStatusClassName(getDelayMinutes(order)) === 'in_time'
|
|
151
|
+
? '#00D27A'
|
|
152
|
+
: getStatusClassName(getDelayMinutes(order)) === 'at_risk'
|
|
153
|
+
? '#FFC700'
|
|
154
|
+
: getStatusClassName(getDelayMinutes(order)) === 'delayed'
|
|
155
|
+
? '#E63757'
|
|
156
|
+
: ''
|
|
157
|
+
}}
|
|
158
|
+
/>
|
|
159
|
+
)}
|
|
160
|
+
<Logo style={styles.logo}>
|
|
161
|
+
<FastImage
|
|
162
|
+
style={styles.icon}
|
|
163
|
+
source={order.business?.logo ? {
|
|
164
|
+
uri: optimizeImage(order.business?.logo, 'h_100,c_limit'),
|
|
165
|
+
priority: FastImage.priority.normal,
|
|
166
|
+
} : theme?.images?.dummies?.businessLogo}
|
|
167
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
168
|
+
/>
|
|
169
|
+
</Logo>
|
|
170
|
+
<Information>
|
|
171
|
+
{!!order?.order_group_id && (
|
|
172
|
+
<OText>
|
|
173
|
+
<OText>{(t('INVOICE_GROUP_NO', 'Group No.') + order?.order_group_id)}</OText>
|
|
174
|
+
</OText>
|
|
175
|
+
)}
|
|
176
|
+
{!!order.business?.name && (
|
|
177
|
+
<OText numberOfLines={1} style={styles.title}>
|
|
178
|
+
{order.business?.name}
|
|
179
|
+
</OText>
|
|
180
|
+
)}
|
|
181
|
+
{!!order?.showNotification && (
|
|
182
|
+
<NotificationIcon>
|
|
183
|
+
<EntypoIcon
|
|
184
|
+
name="dot-single"
|
|
185
|
+
size={32}
|
|
186
|
+
color={theme.colors.primary}
|
|
187
|
+
/>
|
|
188
|
+
</NotificationIcon>
|
|
189
|
+
)}
|
|
190
|
+
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
|
191
|
+
<OText
|
|
192
|
+
style={styles.date}
|
|
193
|
+
color={theme.colors.unselectText}
|
|
194
|
+
numberOfLines={1}
|
|
195
|
+
adjustsFontSizeToFit
|
|
196
|
+
>
|
|
197
|
+
{(!!order?.order_group_id && order?.order_group && isLogisticOrder
|
|
198
|
+
? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}`
|
|
199
|
+
: (t('NO', 'Order No.') + order.id)
|
|
200
|
+
) + ' · '}
|
|
201
|
+
{order?.delivery_datetime_utc
|
|
202
|
+
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
|
|
203
|
+
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
204
|
+
</OText>
|
|
205
|
+
{((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
|
|
206
|
+
<>
|
|
207
|
+
<OText> · </OText>
|
|
208
|
+
<OText
|
|
209
|
+
style={styles.date}
|
|
210
|
+
color={
|
|
211
|
+
getStatusClassName(getDelayMinutes(order)) === 'in_time'
|
|
212
|
+
? '#00D27A'
|
|
213
|
+
: getStatusClassName(getDelayMinutes(order)) === 'at_risk'
|
|
214
|
+
? '#FFC700'
|
|
215
|
+
: getStatusClassName(getDelayMinutes(order)) === 'delayed'
|
|
216
|
+
? '#E63757'
|
|
217
|
+
: ''}
|
|
218
|
+
>
|
|
219
|
+
{displayDelayedTime(order)}
|
|
220
|
+
</OText>
|
|
221
|
+
</>
|
|
222
|
+
)}
|
|
223
|
+
</View>
|
|
224
|
+
{!isLogisticOrder && (
|
|
225
|
+
<MyOrderOptions>
|
|
226
|
+
<OText
|
|
227
|
+
style={styles.orderType}
|
|
228
|
+
mRight={5}
|
|
229
|
+
numberOfLines={1}
|
|
230
|
+
adjustsFontSizeToFit
|
|
231
|
+
>
|
|
232
|
+
{order.delivery_type === 1
|
|
233
|
+
? t('DELIVERY', 'Delivery')
|
|
234
|
+
: order.delivery_type === 2
|
|
235
|
+
? t('PICKUP', 'Pickup')
|
|
236
|
+
: order.delivery_type === 3
|
|
237
|
+
? t('EAT_IN', 'Eat in')
|
|
238
|
+
: order.delivery_type === 4
|
|
239
|
+
? t('CURBSIDE', 'Curbside')
|
|
240
|
+
: t('DRIVER_THRU', 'Driver thru')}
|
|
241
|
+
{` · ${getOrderStatus(order.status)}`}
|
|
242
|
+
</OText>
|
|
243
|
+
</MyOrderOptions>
|
|
244
|
+
)}
|
|
245
|
+
</Information>
|
|
246
|
+
</Card>
|
|
247
|
+
</TouchableOpacity>
|
|
248
|
+
)
|
|
249
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Animated, StyleSheet, View } from 'react-native'
|
|
3
|
+
import { useTheme } from 'styled-components/native';
|
|
4
|
+
import { useLanguage, useUtils } from 'ordering-components/native'
|
|
5
|
+
import FastImage from 'react-native-fast-image'
|
|
6
|
+
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
AccordionSection,
|
|
10
|
+
Accordion,
|
|
11
|
+
ContentInfo,
|
|
12
|
+
AccordionContent,
|
|
13
|
+
ProductOptionsList
|
|
14
|
+
} from './styles'
|
|
15
|
+
|
|
16
|
+
import { OText } from '../shared';
|
|
17
|
+
|
|
18
|
+
export const OrdersGroupedItem = (props: any) => {
|
|
19
|
+
const { groupId, orders } = props
|
|
20
|
+
|
|
21
|
+
const theme = useTheme()
|
|
22
|
+
const [, t] = useLanguage()
|
|
23
|
+
const [{ parseDate }] = useUtils();
|
|
24
|
+
const [isActive, setActiveState] = useState(false)
|
|
25
|
+
|
|
26
|
+
const styles = StyleSheet.create({
|
|
27
|
+
productImage: {
|
|
28
|
+
borderRadius: 7.6,
|
|
29
|
+
width: 60,
|
|
30
|
+
height: 60
|
|
31
|
+
},
|
|
32
|
+
logo: {
|
|
33
|
+
borderRadius: 10,
|
|
34
|
+
shadowColor: "#0000006e",
|
|
35
|
+
shadowRadius: 10,
|
|
36
|
+
elevation: 15,
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
marginLeft: 3,
|
|
40
|
+
height: 65,
|
|
41
|
+
width: 65
|
|
42
|
+
},
|
|
43
|
+
title: {
|
|
44
|
+
marginBottom: 2,
|
|
45
|
+
fontWeight: '600',
|
|
46
|
+
fontSize: 16,
|
|
47
|
+
color: theme.colors.textGray,
|
|
48
|
+
},
|
|
49
|
+
orderlength: {
|
|
50
|
+
marginBottom: 2,
|
|
51
|
+
fontSize: 12,
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<AccordionSection>
|
|
57
|
+
<Accordion
|
|
58
|
+
activeOpacity={1}
|
|
59
|
+
onPress={() => setActiveState(!isActive)}
|
|
60
|
+
>
|
|
61
|
+
<View style={{ flexDirection: 'row', alignItems: 'flex-start' }}>
|
|
62
|
+
<ContentInfo>
|
|
63
|
+
<View style={styles.logo}>
|
|
64
|
+
<FastImage
|
|
65
|
+
style={styles.productImage}
|
|
66
|
+
source={theme.images.general.ordersGroup}
|
|
67
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
68
|
+
/>
|
|
69
|
+
</View>
|
|
70
|
+
<View style={{ flex: 1, marginLeft: 5, flexDirection: 'column' }}>
|
|
71
|
+
<View>
|
|
72
|
+
<OText numberOfLines={1} style={styles.title}>
|
|
73
|
+
{t('GROUP_NRO', 'Group No.')}{groupId}
|
|
74
|
+
</OText>
|
|
75
|
+
</View>
|
|
76
|
+
<OText
|
|
77
|
+
style={styles.orderlength}
|
|
78
|
+
color={theme.colors.unselectText}
|
|
79
|
+
numberOfLines={1}
|
|
80
|
+
adjustsFontSizeToFit
|
|
81
|
+
>
|
|
82
|
+
{orders.length}{' '}{t('ORDERS', 'Orders')}
|
|
83
|
+
</OText>
|
|
84
|
+
<OText
|
|
85
|
+
style={styles.orderlength}
|
|
86
|
+
color={theme.colors.unselectText}
|
|
87
|
+
numberOfLines={1}
|
|
88
|
+
adjustsFontSizeToFit
|
|
89
|
+
>
|
|
90
|
+
{orders[0]?.delivery_datetime_utc
|
|
91
|
+
? parseDate(orders[0]?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
|
|
92
|
+
: parseDate(orders[0]?.delivery_datetime, { utc: false })}
|
|
93
|
+
</OText>
|
|
94
|
+
</View>
|
|
95
|
+
<View style={{ display: 'flex', flexDirection: 'column', flex: 1, alignItems: 'flex-end', maxWidth: 100 }}>
|
|
96
|
+
<View style={{ flexDirection: 'row' }}>
|
|
97
|
+
<MaterialCommunityIcon name={isActive ? 'chevron-up' : 'chevron-down'} size={18} />
|
|
98
|
+
</View>
|
|
99
|
+
</View>
|
|
100
|
+
</ContentInfo>
|
|
101
|
+
</View>
|
|
102
|
+
</Accordion>
|
|
103
|
+
|
|
104
|
+
<View style={{ display: isActive ? 'flex' : 'none' }}>
|
|
105
|
+
<Animated.View>
|
|
106
|
+
<AccordionContent>
|
|
107
|
+
<ProductOptionsList>
|
|
108
|
+
{props.children}
|
|
109
|
+
</ProductOptionsList>
|
|
110
|
+
</AccordionContent>
|
|
111
|
+
</Animated.View>
|
|
112
|
+
</View>
|
|
113
|
+
</AccordionSection>
|
|
114
|
+
)
|
|
115
|
+
}
|