ordering-ui-react-native 0.15.21 → 0.15.22-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 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessTypeFilter/index.tsx +12 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/LanguageSelector/index.tsx +1 -0
- package/src/components/OrderDetails/index.tsx +26 -5
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/Checkout.tsx +1 -1
- package/src/pages/Sessions.tsx +22 -0
- package/src/types/index.tsx +3 -9
- package/src/utils/index.tsx +68 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +56 -8
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +5 -0
- package/themes/business/src/components/Chat/index.tsx +38 -86
- package/themes/business/src/components/Home/index.tsx +128 -55
- package/themes/business/src/components/Home/styles.tsx +8 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +22 -13
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +53 -49
- package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
- package/themes/business/src/types/index.tsx +2 -1
- 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/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
- package/themes/kiosk/src/components/Cart/index.tsx +98 -24
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- 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/OrderDetails/index.tsx +136 -41
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +178 -1
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +56 -18
- package/themes/original/src/components/AppleLogin/index.tsx +117 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +52 -22
- package/themes/original/src/components/BusinessController/styles.tsx +22 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +127 -20
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +48 -57
- package/themes/original/src/components/Cart/index.tsx +18 -14
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +42 -27
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GoogleMap/index.tsx +1 -0
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/index.tsx +73 -2
- package/themes/original/src/components/LoginForm/styles.tsx +6 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +34 -25
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +34 -27
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderProgress/index.tsx +4 -4
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/index.tsx +25 -33
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -4
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +40 -33
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
- package/themes/original/src/components/Promotions/index.tsx +250 -0
- package/themes/original/src/components/Promotions/styles.tsx +60 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/TaxInformation/index.tsx +10 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
- package/themes/original/src/components/UserProfile/index.tsx +62 -14
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +75 -8
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +46 -4
- package/themes/original/src/utils/index.tsx +12 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -168
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components/native';
|
|
2
|
+
|
|
3
|
+
export const FiltersTab = styled.View`
|
|
4
|
+
margin-bottom: 20px;
|
|
5
|
+
min-height: 30px;
|
|
6
|
+
max-height: 35px;
|
|
7
|
+
flex: 1;
|
|
8
|
+
width: 100%;
|
|
9
|
+
`
|
|
10
|
+
|
|
11
|
+
export const TabsContainer = styled.View`
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
border-bottom-width: 1px;
|
|
16
|
+
flex: 1;
|
|
17
|
+
width: 100%;
|
|
18
|
+
border-bottom-color: ${(props: any) => props.theme.colors.tabBar};
|
|
19
|
+
`
|
|
20
|
+
|
|
21
|
+
export const Tag = styled.Pressable`
|
|
22
|
+
background-color: ${({ isSelected }: { isSelected: string }) => isSelected};
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
25
|
+
min-height: 34px;
|
|
26
|
+
padding: 4px 10px;
|
|
27
|
+
border-radius: 50px;
|
|
28
|
+
margin-right: 15px;
|
|
29
|
+
`
|
|
30
|
+
|
|
31
|
+
export const IconWrapper = styled.View`
|
|
32
|
+
flex-direction: row;
|
|
33
|
+
align-items: center;
|
|
34
|
+
background: #fff;
|
|
35
|
+
`
|
|
36
|
+
|
|
37
|
+
export const ModalContainer = styled.ScrollView`
|
|
38
|
+
padding: 0px 30px;
|
|
39
|
+
`
|
|
40
|
+
|
|
41
|
+
export const ModalTitle = styled.Text`
|
|
42
|
+
font-family: Poppins;
|
|
43
|
+
font-style: normal;
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
font-size: 20px;
|
|
46
|
+
color: ${(props: any) => props.theme.colors.textGray};
|
|
47
|
+
margin-bottom: 24px;
|
|
48
|
+
`
|
|
49
|
+
|
|
50
|
+
export const FilterBtnWrapper = styled.TouchableOpacity`
|
|
51
|
+
background-color: ${(props: any) => props.theme.colors.inputDisabled};
|
|
52
|
+
border-radius: 7.6px;
|
|
53
|
+
margin-vertical: 5px;
|
|
54
|
+
padding: 15px 20px;
|
|
55
|
+
flex-direction: row;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: space-between;
|
|
58
|
+
margin-bottom: 24px;
|
|
59
|
+
`
|
|
60
|
+
|
|
61
|
+
export const TabPressable = styled.Pressable`
|
|
62
|
+
align-items: center;
|
|
63
|
+
border-color: ${(props: any) => props.theme.colors.textGray};
|
|
64
|
+
border-bottom-width: ${(props: any) => props.isSelected ? '1px' : '0px'};
|
|
65
|
+
padding-horizontal: 10px;
|
|
66
|
+
`
|
|
67
|
+
export const OrderStatus = styled.View`
|
|
68
|
+
margin-right: 5px;
|
|
69
|
+
width: 3px;
|
|
70
|
+
height: 90%;
|
|
71
|
+
border-radius: 6px;
|
|
72
|
+
|
|
73
|
+
${(props: any) => props.timeState === 'in_time' && css`
|
|
74
|
+
background-color: #00D27A;
|
|
75
|
+
`}
|
|
76
|
+
|
|
77
|
+
${(props: any) => props.timeState === 'at_risk' && css`
|
|
78
|
+
background-color: #FFC700;
|
|
79
|
+
`}
|
|
80
|
+
|
|
81
|
+
${(props: any) => props.timeState === 'delayed' && css`
|
|
82
|
+
background-color: #E63757;
|
|
83
|
+
`}
|
|
84
|
+
`
|
|
85
|
+
|
|
86
|
+
export const SlaOption = styled.View`
|
|
87
|
+
flex-direction: row;
|
|
88
|
+
align-items: center;
|
|
89
|
+
`
|
|
90
|
+
|
|
91
|
+
export const SearchModalContent = styled.View``
|
|
92
|
+
|
|
93
|
+
export const SlaSettingModalContent = styled.View``
|
|
94
|
+
|
|
95
|
+
export const DeliveryStatusWrapper = styled.View`
|
|
96
|
+
position: relative;
|
|
97
|
+
`
|
|
98
|
+
export const VerticalLine = styled.View`
|
|
99
|
+
position: absolute;
|
|
100
|
+
background: #E9ECEF;
|
|
101
|
+
position: absolute;
|
|
102
|
+
width: 1px;
|
|
103
|
+
height: 100%;
|
|
104
|
+
top: 7px;
|
|
105
|
+
left: 7px;
|
|
106
|
+
`
|
|
107
|
+
|
|
108
|
+
export const Actions = styled.View``
|
|
109
|
+
|
|
110
|
+
export const Sides = styled.View`
|
|
111
|
+
flex-direction: row;
|
|
112
|
+
height: 100%;
|
|
113
|
+
`
|
|
114
|
+
|
|
115
|
+
export const LeftSide = styled.View`
|
|
116
|
+
width: 30%;
|
|
117
|
+
`
|
|
118
|
+
|
|
119
|
+
export const RightSide = styled.View`
|
|
120
|
+
width: 70%;
|
|
121
|
+
border-width: 2px;
|
|
122
|
+
border-color: ${(props: any) => props.theme.colors.gray100};
|
|
123
|
+
`
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { StyleSheet, Pressable } from 'react-native'
|
|
3
|
+
import { useLanguage, useUtils, useConfig } from 'ordering-components/native'
|
|
4
|
+
import styled, { useTheme } from 'styled-components/native'
|
|
5
|
+
|
|
6
|
+
import { OText, OIcon } from '../shared';
|
|
7
|
+
|
|
8
|
+
export const useOrderUtils = () => {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const [, t] = useLanguage();
|
|
11
|
+
const [{ parseDate }] = useUtils()
|
|
12
|
+
|
|
13
|
+
const calculateDate = (type: any, from: any, to: any) => {
|
|
14
|
+
switch (type) {
|
|
15
|
+
case 'today':
|
|
16
|
+
const date = parseDate(new Date(), { outputFormat: 'MM/DD/YYYY' })
|
|
17
|
+
return { from: `${date} 00:00:00`, to: `${date} 23:59:59` }
|
|
18
|
+
case 'yesterday':
|
|
19
|
+
const yesterday = new Date()
|
|
20
|
+
yesterday.setDate(yesterday.getDate() - 1)
|
|
21
|
+
const start1 = parseDate(yesterday, { outputFormat: 'MM/DD/YYYY' })
|
|
22
|
+
const end1 = parseDate(new Date(), { outputFormat: 'MM/DD/YYYY' })
|
|
23
|
+
return { from: `${start1} 00:00:00`, to: `${end1} 23:59:59` }
|
|
24
|
+
case 'last_7days':
|
|
25
|
+
const last_7days = new Date()
|
|
26
|
+
last_7days.setDate(last_7days.getDate() - 6)
|
|
27
|
+
const start7 = parseDate(last_7days, { outputFormat: 'MM/DD/YYYY' })
|
|
28
|
+
const end7 = parseDate(new Date(), { outputFormat: 'MM/DD/YYYY' })
|
|
29
|
+
return { from: `${start7} 00:00:00`, to: `${end7} 23:59:59` }
|
|
30
|
+
case 'last_30days':
|
|
31
|
+
const last_30days = new Date()
|
|
32
|
+
last_30days.setDate(last_30days.getDate() - 29)
|
|
33
|
+
const start30 = parseDate(last_30days, { outputFormat: 'MM/DD/YYYY' })
|
|
34
|
+
const end30 = parseDate(new Date(), { outputFormat: 'MM/DD/YYYY' })
|
|
35
|
+
return { from: `${start30} 00:00:00`, to: `${end30} 23:59:59` }
|
|
36
|
+
default:
|
|
37
|
+
const start = from ? `${parseDate(from, { outputFormat: 'MM/DD/YYYY' })} 00:00:00` : ''
|
|
38
|
+
const end = to ? `${parseDate(to, { outputFormat: 'MM/DD/YYYY' })} 23:59:59` : ''
|
|
39
|
+
return { from: start, to: end }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const preorderTypeList = [
|
|
44
|
+
{ key: null, name: t('SLA', 'SLA\'s') },
|
|
45
|
+
{ key: 'in_time', name: t('OK', 'Ok') },
|
|
46
|
+
{ key: 'at_risk', name: t('AT_RISK', 'At Risk') },
|
|
47
|
+
{ key: 'delayed', name: t('DELAYED', 'Delayed') }
|
|
48
|
+
]
|
|
49
|
+
const defaultOrderTypes = [
|
|
50
|
+
{ key: 1, name: t('DELIVERY', 'Delivery') },
|
|
51
|
+
{ key: 2, name: t('PICKUP', 'Pickup') },
|
|
52
|
+
{ key: 3, name: t('EAT_IN', 'Eat in') },
|
|
53
|
+
{ key: 4, name: t('CURBSIDE', 'Curbside') },
|
|
54
|
+
{ key: 5, name: t('DRIVE_THRU', 'Drive thru') }
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
const deliveryStatus = [
|
|
58
|
+
{
|
|
59
|
+
key: t('OK', 'Ok'),
|
|
60
|
+
des: t('DELIVERY_OK_STATUS_DESC', 'Get delivery time from the businesses.'),
|
|
61
|
+
timmer: false,
|
|
62
|
+
icon: theme.images.general?.clock1,
|
|
63
|
+
backColor: '#00D27A'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: t('AT_RISK', 'At risk'),
|
|
67
|
+
des: t('DELIVERY_ATRISK_STATUS_DESC', 'Is the time between delivery time of busines and the delayed time.'),
|
|
68
|
+
timmer: false,
|
|
69
|
+
icon: theme.images.general?.clockRisk,
|
|
70
|
+
backColor: '#FFC700'
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
key: t('DELAYED', 'Delayed'),
|
|
74
|
+
des: t('DELIVERY_DELAYED_STATUS_DESC', 'If this time is exceeded, the order will be delayed.'),
|
|
75
|
+
timmer: true,
|
|
76
|
+
icon: theme.images.general?.clockDelayed,
|
|
77
|
+
backColor: '#E63757'
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
const defaultSearchList = {
|
|
82
|
+
id: '',
|
|
83
|
+
state: '',
|
|
84
|
+
city: '',
|
|
85
|
+
business: '',
|
|
86
|
+
delivery_type: '',
|
|
87
|
+
paymethod: '',
|
|
88
|
+
driver: '',
|
|
89
|
+
timeStatus: '',
|
|
90
|
+
date: {
|
|
91
|
+
from: '',
|
|
92
|
+
to: '',
|
|
93
|
+
type: ''
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const constants = {
|
|
98
|
+
preorderTypeList,
|
|
99
|
+
defaultOrderTypes,
|
|
100
|
+
deliveryStatus,
|
|
101
|
+
defaultSearchList,
|
|
102
|
+
calculateDate
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return [constants];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const StatusBlock = (props: any) => {
|
|
109
|
+
const { item, last } = props
|
|
110
|
+
const [showTime, setShowTime] = useState(false)
|
|
111
|
+
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
if (last) {
|
|
114
|
+
setShowTime(true)
|
|
115
|
+
}
|
|
116
|
+
}, [last])
|
|
117
|
+
|
|
118
|
+
const StatusItems = styled.View`
|
|
119
|
+
position: relative;
|
|
120
|
+
margin-bottom: 20px;
|
|
121
|
+
z-index: 2;
|
|
122
|
+
`
|
|
123
|
+
const ItemHeader = styled.View`
|
|
124
|
+
flex-direction: row;
|
|
125
|
+
margin-bottom: 5px;
|
|
126
|
+
`
|
|
127
|
+
|
|
128
|
+
const IconWrapper = styled.View`
|
|
129
|
+
flex-direction: row;
|
|
130
|
+
align-items: center;
|
|
131
|
+
background: #fff;
|
|
132
|
+
`
|
|
133
|
+
|
|
134
|
+
const ItemStatus = styled.View`
|
|
135
|
+
width: 4px;
|
|
136
|
+
height: 22px;
|
|
137
|
+
margin: 0 15px;
|
|
138
|
+
border-radius: 4px;
|
|
139
|
+
background: ${(props: any) => props.backColor};
|
|
140
|
+
`
|
|
141
|
+
|
|
142
|
+
const ItemContent = styled.View`
|
|
143
|
+
display: flex;
|
|
144
|
+
padding: 0 30px;
|
|
145
|
+
`
|
|
146
|
+
|
|
147
|
+
const OverLine = styled.View`
|
|
148
|
+
position: absolute;
|
|
149
|
+
height: 100%;
|
|
150
|
+
width: 15px;
|
|
151
|
+
top: 20px;
|
|
152
|
+
left: 0;
|
|
153
|
+
background-color: #fff;
|
|
154
|
+
z-index: 2;
|
|
155
|
+
`
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<StatusItems>
|
|
159
|
+
<Pressable style={{ marginBottom: 10 }}>
|
|
160
|
+
<ItemHeader>
|
|
161
|
+
<IconWrapper>
|
|
162
|
+
<OIcon
|
|
163
|
+
src={item?.icon}
|
|
164
|
+
width={16}
|
|
165
|
+
height={16}
|
|
166
|
+
color={item?.backColor}
|
|
167
|
+
/>
|
|
168
|
+
</IconWrapper>
|
|
169
|
+
<ItemStatus backColor={item?.backColor} />
|
|
170
|
+
<OText>{item?.key}</OText>
|
|
171
|
+
</ItemHeader>
|
|
172
|
+
</Pressable>
|
|
173
|
+
<ItemContent>
|
|
174
|
+
<OText>{item?.des}</OText>
|
|
175
|
+
</ItemContent>
|
|
176
|
+
{showTime && ( <Timer /> )}
|
|
177
|
+
{last && ( <OverLine /> )}
|
|
178
|
+
</StatusItems>
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export const Timer = () => {
|
|
183
|
+
const [, t] = useLanguage()
|
|
184
|
+
const theme = useTheme()
|
|
185
|
+
const [{ configs }] = useConfig();
|
|
186
|
+
|
|
187
|
+
const styles = StyleSheet.create({
|
|
188
|
+
settingTime: {
|
|
189
|
+
fontSize: 14,
|
|
190
|
+
borderWidth: 1,
|
|
191
|
+
borderRadius: 7.6,
|
|
192
|
+
margin: 0,
|
|
193
|
+
marginRight: 10,
|
|
194
|
+
paddingHorizontal: 10,
|
|
195
|
+
paddingTop: 5,
|
|
196
|
+
borderColor: theme.colors.disabled
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
const TimerInputWrapper = styled.View`
|
|
201
|
+
color: ${(props: any) => props.theme.colors.disabled};
|
|
202
|
+
margin-top: 15px;
|
|
203
|
+
margin-left: 30px;
|
|
204
|
+
margin-right: 30px;
|
|
205
|
+
flex-direction: row;
|
|
206
|
+
align-items: flex-end;
|
|
207
|
+
`
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
<TimerInputWrapper>
|
|
211
|
+
<OText style={styles.settingTime} color={theme.colors.disabled}>{configs?.order_deadlines_delayed_time?.value}</OText>
|
|
212
|
+
<OText>{t('MIN', 'min')}</OText>
|
|
213
|
+
</TimerInputWrapper>
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
|
|
@@ -110,6 +110,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
110
110
|
const theme = useTheme();
|
|
111
111
|
const [, t] = useLanguage();
|
|
112
112
|
const [{ parseDate }] = useUtils()
|
|
113
|
+
const [configState] = useConfig()
|
|
113
114
|
const [orientationState] = useDeviceOrientation();
|
|
114
115
|
const [, { showToast }] = useToast();
|
|
115
116
|
const [openSearchModal, setOpenSearchModal] = useState(false)
|
|
@@ -439,55 +440,57 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
439
440
|
/>
|
|
440
441
|
</IconWrapper>
|
|
441
442
|
</View>
|
|
442
|
-
|
|
443
|
-
<View style={
|
|
444
|
-
<
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
<
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
443
|
+
{configState?.configs?.order_deadlines_enabled?.value === '1' && (
|
|
444
|
+
<View style={styles.SLAwrapper}>
|
|
445
|
+
<View style={{ flex: 0.5 }}>
|
|
446
|
+
<OButton
|
|
447
|
+
text={t('SLA_SETTING', 'SLA’s Settings')}
|
|
448
|
+
textStyle={{ color: theme.colors.backArrow }}
|
|
449
|
+
imgRightSrc={null}
|
|
450
|
+
style={{
|
|
451
|
+
backgroundColor: theme.colors.inputChat,
|
|
452
|
+
borderRadius: 7.6,
|
|
453
|
+
zIndex: 10,
|
|
454
|
+
borderWidth: 0,
|
|
455
|
+
minHeight: 40
|
|
456
|
+
}}
|
|
457
|
+
onClick={onClickSetting}
|
|
458
|
+
/>
|
|
459
|
+
</View>
|
|
460
|
+
<View style={{ width: 10, height: '100%' }} />
|
|
461
|
+
<View style={{ flex: 0.5, justifyContent: 'center' }}>
|
|
462
|
+
<SelectDropdown
|
|
463
|
+
defaultButtonText={t('SLA', 'SLA\'s')}
|
|
464
|
+
data={preorderTypeList}
|
|
465
|
+
onSelect={(selectedItem, index) => {
|
|
466
|
+
onFiltered && onFiltered({ ...search, timeStatus: selectedItem?.key })
|
|
467
|
+
}}
|
|
468
|
+
buttonTextAfterSelection={(selectedItem, index) => {
|
|
469
|
+
return selectedItem.name
|
|
470
|
+
}}
|
|
471
|
+
rowTextForSelection={(item, index) => {
|
|
472
|
+
return item.key
|
|
473
|
+
}}
|
|
474
|
+
buttonStyle={styles.selectOption}
|
|
475
|
+
buttonTextStyle={styles.buttonTextStyle}
|
|
476
|
+
renderDropdownIcon={isOpened => {
|
|
477
|
+
return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
|
|
478
|
+
}}
|
|
479
|
+
dropdownStyle={styles.dropdownStyle}
|
|
480
|
+
dropdownOverlayColor='transparent'
|
|
481
|
+
rowStyle={styles.rowStyle}
|
|
482
|
+
renderCustomizedRowChild={(item, index) => {
|
|
483
|
+
return (
|
|
484
|
+
<SlaOption>
|
|
485
|
+
{index !== 0 && <OrderStatus timeState={item?.key} />}
|
|
486
|
+
<View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
|
|
487
|
+
</SlaOption>
|
|
488
|
+
);
|
|
489
|
+
}}
|
|
490
|
+
/>
|
|
491
|
+
</View>
|
|
489
492
|
</View>
|
|
490
|
-
|
|
493
|
+
)}
|
|
491
494
|
<FiltersTab>
|
|
492
495
|
<ScrollView
|
|
493
496
|
ref={scrollRefTab}
|
|
@@ -541,7 +544,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
541
544
|
</TabsContainer>
|
|
542
545
|
</ScrollView>
|
|
543
546
|
</FiltersTab>
|
|
544
|
-
<View style={{ flex: 1, minHeight: HEIGHT_SCREEN -
|
|
547
|
+
<View style={{ flex: 1, minHeight: HEIGHT_SCREEN - 450 }}>
|
|
545
548
|
{currentTabSelected !== 'logisticOrders' && (
|
|
546
549
|
<View
|
|
547
550
|
style={{
|
|
@@ -926,6 +929,7 @@ export const Timer = () => {
|
|
|
926
929
|
|
|
927
930
|
export const OrdersOption = (props: OrdersOptionParams) => {
|
|
928
931
|
const [, t] = useLanguage();
|
|
932
|
+
const [configState] = useConfig()
|
|
929
933
|
const theme = useTheme()
|
|
930
934
|
const ordersProps = {
|
|
931
935
|
...props,
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
2
|
+
import { StyleSheet, TouchableOpacity, View, Platform, PlatformIOSStatic } from 'react-native';
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import moment from 'moment'
|
|
5
|
-
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
5
|
+
import { useLanguage, useUtils, useConfig } from 'ordering-components/native';
|
|
6
6
|
import { OButton, OIcon, OText } from '../shared';
|
|
7
7
|
import {
|
|
8
8
|
Card, Logo, Information, MyOrderOptions, NotificationIcon, AcceptOrRejectOrder, Timestatus
|
|
9
9
|
} from './styles';
|
|
10
10
|
import EntypoIcon from 'react-native-vector-icons/Entypo'
|
|
11
|
+
import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
|
|
12
|
+
import DeviceInfo from 'react-native-device-info';
|
|
13
|
+
|
|
14
|
+
const { useDeviceOrientation, PORTRAIT } = DeviceOrientationMethods
|
|
11
15
|
|
|
12
16
|
export const PreviousOrders = (props: any) => {
|
|
13
17
|
const {
|
|
@@ -18,25 +22,43 @@ export const PreviousOrders = (props: any) => {
|
|
|
18
22
|
isLogisticOrder,
|
|
19
23
|
handleClickLogisticOrder,
|
|
20
24
|
slaSettingTime,
|
|
21
|
-
currentTabSelected
|
|
25
|
+
currentTabSelected,
|
|
26
|
+
currentOrdenSelected
|
|
22
27
|
} = props;
|
|
23
28
|
const [, t] = useLanguage();
|
|
24
29
|
const [{ parseDate, optimizeImage }] = useUtils();
|
|
30
|
+
const [configState] = useConfig()
|
|
25
31
|
const theme = useTheme();
|
|
26
|
-
const [
|
|
32
|
+
const [, setCurrentTime] = useState()
|
|
33
|
+
const [allowColumns, setAllowColumns] = useState({
|
|
34
|
+
timer: true,
|
|
35
|
+
slaBar: true,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const [orientationState] = useDeviceOrientation();
|
|
39
|
+
|
|
40
|
+
const IS_PORTRAIT = orientationState.orientation === PORTRAIT
|
|
41
|
+
|
|
42
|
+
const platformIOS = Platform as PlatformIOSStatic
|
|
43
|
+
const isIpad = platformIOS.isPad
|
|
44
|
+
const isTablet = DeviceInfo.isTablet();
|
|
27
45
|
|
|
28
46
|
const handlePressOrder = (order: any) => {
|
|
29
47
|
if (order?.locked && isLogisticOrder) return
|
|
30
48
|
handleClickOrder && handleClickOrder(order)
|
|
31
|
-
|
|
32
|
-
|
|
49
|
+
if (props.handleClickEvent) {
|
|
50
|
+
props.handleClickEvent({ ...order, isLogistic: isLogisticOrder })
|
|
51
|
+
} else {
|
|
52
|
+
onNavigationRedirect &&
|
|
53
|
+
onNavigationRedirect('OrderDetails', { order: { ...order, isLogistic: isLogisticOrder }, handleClickLogisticOrder });
|
|
54
|
+
}
|
|
33
55
|
};
|
|
34
56
|
|
|
35
57
|
const styles = StyleSheet.create({
|
|
36
58
|
cardButton: {
|
|
37
59
|
flex: 1,
|
|
38
|
-
|
|
39
|
-
marginBottom:
|
|
60
|
+
paddingVertical: (isIpad || isTablet) ? 20 : 0,
|
|
61
|
+
marginBottom: IS_PORTRAIT ? 25 : 0,
|
|
40
62
|
marginLeft: 3,
|
|
41
63
|
},
|
|
42
64
|
icon: {
|
|
@@ -77,23 +99,42 @@ export const PreviousOrders = (props: any) => {
|
|
|
77
99
|
},
|
|
78
100
|
});
|
|
79
101
|
|
|
80
|
-
const
|
|
102
|
+
const getDelayMinutes = (order: any) => {
|
|
81
103
|
// targetMin = delivery_datetime + eta_time - now()
|
|
104
|
+
const offset = 300
|
|
105
|
+
const cdtToutc = moment(order?.delivery_datetime).add(offset, 'minutes').format('YYYY-MM-DD HH:mm:ss')
|
|
82
106
|
const _delivery = order?.delivery_datetime_utc
|
|
107
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
108
|
+
: parseDate(cdtToutc)
|
|
83
109
|
const _eta = order?.eta_time
|
|
84
|
-
const
|
|
85
|
-
|
|
110
|
+
const diffTimeAsSeconds = moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'seconds')
|
|
111
|
+
return Math.ceil(diffTimeAsSeconds / 60)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const displayDelayedTime = (order: any) => {
|
|
115
|
+
let tagetedMin = getDelayMinutes(order)
|
|
116
|
+
// get day, hour and minutes
|
|
117
|
+
const sign = tagetedMin >= 0 ? '' : '- '
|
|
118
|
+
tagetedMin = Math.abs(tagetedMin)
|
|
119
|
+
let day: string | number = Math.floor(tagetedMin / 1440)
|
|
86
120
|
const restMinOfTargetedMin = tagetedMin - 1440 * day
|
|
87
|
-
let restHours:
|
|
88
|
-
let restMins:
|
|
121
|
+
let restHours: string | number = Math.floor(restMinOfTargetedMin / 60)
|
|
122
|
+
let restMins: string | number = restMinOfTargetedMin - 60 * restHours
|
|
123
|
+
// make standard time format
|
|
124
|
+
day = day === 0 ? '' : day + 'day '
|
|
125
|
+
restHours = restHours < 10 ? '0' + restHours : restHours
|
|
126
|
+
restMins = restMins < 10 ? '0' + restMins : restMins
|
|
89
127
|
|
|
90
|
-
|
|
91
|
-
if (restHours < 10) restHours = ('0' + restHours)
|
|
92
|
-
if (restMins < 10) restMins = ('0' + restMins)
|
|
93
|
-
const finalTaget = day + 'day ' + restHours + ':' + restMins
|
|
128
|
+
const finalTaget = sign + day + restHours + ':' + restMins
|
|
94
129
|
return finalTaget
|
|
95
130
|
}
|
|
96
131
|
|
|
132
|
+
const getStatusClassName = (minutes: number) => {
|
|
133
|
+
if (isNaN(Number(minutes))) return 'in_time'
|
|
134
|
+
const delayTime = configState?.configs?.order_deadlines_delayed_time?.value
|
|
135
|
+
return minutes > 0 ? 'in_time' : Math.abs(minutes) <= delayTime ? 'at_risk' : 'delayed'
|
|
136
|
+
}
|
|
137
|
+
|
|
97
138
|
useEffect(() => {
|
|
98
139
|
const interval = setInterval(() => {
|
|
99
140
|
const date: any = Date.now()
|
|
@@ -103,6 +144,15 @@ export const PreviousOrders = (props: any) => {
|
|
|
103
144
|
return () => clearInterval(interval)
|
|
104
145
|
}, [])
|
|
105
146
|
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
const slaSettings = configState?.configs?.order_deadlines_enabled?.value === '1'
|
|
149
|
+
setAllowColumns({
|
|
150
|
+
...allowColumns,
|
|
151
|
+
timer: slaSettings,
|
|
152
|
+
slaBar: slaSettings
|
|
153
|
+
})
|
|
154
|
+
}, [configState.loading])
|
|
155
|
+
|
|
106
156
|
let hash: any = {};
|
|
107
157
|
|
|
108
158
|
return (
|
|
@@ -115,8 +165,9 @@ export const PreviousOrders = (props: any) => {
|
|
|
115
165
|
return (
|
|
116
166
|
<View
|
|
117
167
|
style={{
|
|
118
|
-
backgroundColor: order?.locked && isLogisticOrder ? '#ccc' : '#fff',
|
|
119
|
-
marginBottom: isLogisticOrder ? 10 : 0
|
|
168
|
+
backgroundColor: currentOrdenSelected === order?.id ? theme.colors.gray100 : order?.locked && isLogisticOrder ? '#ccc' : '#fff',
|
|
169
|
+
marginBottom: isLogisticOrder ? 10 : 0,
|
|
170
|
+
// justifyContent: 'center'
|
|
120
171
|
}}
|
|
121
172
|
key={order.id}
|
|
122
173
|
>
|
|
@@ -127,7 +178,9 @@ export const PreviousOrders = (props: any) => {
|
|
|
127
178
|
activeOpacity={1}
|
|
128
179
|
>
|
|
129
180
|
<Card key={order.id}>
|
|
130
|
-
|
|
181
|
+
{allowColumns?.slaBar && (
|
|
182
|
+
<Timestatus style={{ backgroundColor: getStatusClassName(getDelayMinutes(order)) === 'in_time' ? '#00D27A' : getStatusClassName(getDelayMinutes(order)) === 'at_risk' ? '#FFC700' : getStatusClassName(getDelayMinutes(order)) === 'delayed' ? '#E63757' : '' }} />
|
|
183
|
+
)}
|
|
131
184
|
{
|
|
132
185
|
order.business?.logo && (
|
|
133
186
|
<Logo style={styles.logo}>
|
|
@@ -172,10 +225,10 @@ export const PreviousOrders = (props: any) => {
|
|
|
172
225
|
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
|
|
173
226
|
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
174
227
|
</OText>
|
|
175
|
-
{(currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && (
|
|
228
|
+
{((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
|
|
176
229
|
<>
|
|
177
230
|
<OText> · </OText>
|
|
178
|
-
<OText style={styles.date} color={order
|
|
231
|
+
<OText style={styles.date} color={getStatusClassName(getDelayMinutes(order)) === 'in_time' ? '#00D27A' : getStatusClassName(getDelayMinutes(order)) === 'at_risk' ? '#FFC700' : getStatusClassName(getDelayMinutes(order)) === 'delayed' ? '#E63757' : ''} >{displayDelayedTime(order)}</OText>
|
|
179
232
|
</>
|
|
180
233
|
)}
|
|
181
234
|
</View>
|
|
@@ -373,6 +373,7 @@ export interface OrderDetailsParams {
|
|
|
373
373
|
handleClickLogisticOrder?: (status: number, orderId: number) => void;
|
|
374
374
|
orderTitle?: any;
|
|
375
375
|
forceUpdate?: number;
|
|
376
|
+
getPermissions?: any
|
|
376
377
|
}
|
|
377
378
|
export interface ProductItemAccordionParams {
|
|
378
379
|
isCartPending?: boolean;
|
|
@@ -578,4 +579,4 @@ export interface ReviewCustomerParams {
|
|
|
578
579
|
|
|
579
580
|
export interface NoNetworkParams {
|
|
580
581
|
image?: any;
|
|
581
|
-
}
|
|
582
|
+
}
|
|
@@ -197,7 +197,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
197
197
|
{isFarAway && (
|
|
198
198
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
199
199
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
200
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', '
|
|
200
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
|
|
201
201
|
</FarAwayMessage>
|
|
202
202
|
)}
|
|
203
203
|
{!auth && (
|
|
@@ -410,8 +410,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
410
410
|
textInputProps={{
|
|
411
411
|
returnKeyType: 'next',
|
|
412
412
|
onSubmitEditing: () => inputRef?.current?.focus?.(),
|
|
413
|
-
style: { borderWidth: 0, fontSize: 12 }
|
|
414
|
-
maxLength: 10
|
|
413
|
+
style: { borderWidth: 0, fontSize: 12 }
|
|
415
414
|
}}
|
|
416
415
|
textWrapStyle={{ borderColor: theme.colors.clear, borderWidth: 0, height: 40, paddingStart: 0 }}
|
|
417
416
|
/>
|