ordering-ui-react-native 0.11.37 → 0.11.41
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 +2 -1
- package/src/theme.json +0 -1
- package/themes/business/index.tsx +18 -0
- package/themes/business/src/components/OrdersOption/index.tsx +186 -13
- package/themes/business/src/components/OrdersOption/styles.tsx +31 -1
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +51 -0
- package/themes/business/src/components/OrdersOptionBusiness/styles.tsx +8 -0
- package/themes/business/src/components/OrdersOptionCity/index.tsx +52 -0
- package/themes/business/src/components/OrdersOptionCity/styles.tsx +8 -0
- package/themes/business/src/components/OrdersOptionDate/index.tsx +52 -0
- package/themes/business/src/components/OrdersOptionDate/styles.tsx +8 -0
- package/themes/business/src/components/OrdersOptionDelivery/index.tsx +35 -0
- package/themes/business/src/components/OrdersOptionDelivery/styles.tsx +8 -0
- package/themes/business/src/components/OrdersOptionDriver/index.tsx +50 -0
- package/themes/business/src/components/OrdersOptionDriver/styles.tsx +8 -0
- package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +49 -0
- package/themes/business/src/components/OrdersOptionPaymethod/styles.tsx +8 -0
- package/themes/business/src/components/OrdersOptionStatus/index.tsx +46 -0
- package/themes/business/src/components/OrdersOptionStatus/styles.tsx +8 -0
- package/themes/business/src/components/shared/ODropDown.tsx +195 -0
- package/themes/business/src/components/shared/ODropDownCalendar.tsx +328 -0
- package/themes/business/src/components/shared/index.tsx +4 -0
- package/themes/business/src/types/index.tsx +2 -0
- package/themes/doordash/src/components/Messages/index.tsx +45 -26
- package/themes/original/src/components/DriverTips/styles.tsx +4 -3
- package/themes/original/src/components/LoginForm/index.tsx +14 -3
- package/themes/original/src/components/Messages/index.tsx +48 -30
- package/themes/original/src/components/ProductForm/index.tsx +24 -24
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { useLanguage, PaymethodList as PyamethodListControllder } from 'ordering-components/native';
|
|
3
|
+
import { useTheme } from 'styled-components/native';
|
|
4
|
+
import { Container } from './styles';
|
|
5
|
+
import ODropDown from '../shared/ODropDown';
|
|
6
|
+
import { Platform } from 'react-native'
|
|
7
|
+
|
|
8
|
+
export const OrdersOptionPaymethodUI = (props: any) => {
|
|
9
|
+
const {
|
|
10
|
+
search,
|
|
11
|
+
onSearch,
|
|
12
|
+
paymethodList
|
|
13
|
+
} = props
|
|
14
|
+
|
|
15
|
+
const theme = useTheme();
|
|
16
|
+
const [, t] = useLanguage();
|
|
17
|
+
const [optionsList, setOptionsList] = useState([])
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const paymethods: any = []
|
|
21
|
+
for (const paymethod of paymethodList?.paymethods) {
|
|
22
|
+
paymethods.push({value: paymethod.id, content: paymethod.name})
|
|
23
|
+
}
|
|
24
|
+
setOptionsList(paymethods)
|
|
25
|
+
}, [paymethodList?.paymethods])
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Container isIos={Platform.OS === 'ios'}>
|
|
29
|
+
<ODropDown
|
|
30
|
+
options={optionsList}
|
|
31
|
+
defaultValue={search.paymethod}
|
|
32
|
+
onSelect={(option: any) => onSearch({ ...search, paymethod: option })}
|
|
33
|
+
isModal
|
|
34
|
+
bgcolor={theme.colors.inputDisabled}
|
|
35
|
+
textcolor={theme.colors.unselectText}
|
|
36
|
+
placeholder={t('SELECT_PAYMETHOD', 'Select Paymethod')}
|
|
37
|
+
dropViewMaxHeight={200}
|
|
38
|
+
/>
|
|
39
|
+
</Container>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const OrdersOptionPaymethod = (props: any) => {
|
|
44
|
+
const ordersOptionPaymethodProps = {
|
|
45
|
+
...props,
|
|
46
|
+
UIComponent: OrdersOptionPaymethodUI
|
|
47
|
+
};
|
|
48
|
+
return <PyamethodListControllder {...ordersOptionPaymethodProps} />;
|
|
49
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { useLanguage } from 'ordering-components/native';
|
|
3
|
+
import { useTheme } from 'styled-components/native';
|
|
4
|
+
import { Container } from './styles';
|
|
5
|
+
import ODropDown from '../shared/ODropDown';
|
|
6
|
+
import { Platform } from 'react-native'
|
|
7
|
+
|
|
8
|
+
export const OrdersOptionStatus = (props: any) => {
|
|
9
|
+
const {
|
|
10
|
+
currentTabSelected,
|
|
11
|
+
tabs,
|
|
12
|
+
orderStatus,
|
|
13
|
+
search,
|
|
14
|
+
onSearch
|
|
15
|
+
} = props
|
|
16
|
+
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const [, t] = useLanguage();
|
|
19
|
+
const [optionsList, setOptionsList] = useState([])
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (!currentTabSelected || tabs?.length === 0 || orderStatus?.length === 0) return
|
|
23
|
+
const currentTab = tabs?.find((tab: any) => tab.title === currentTabSelected)
|
|
24
|
+
const _optionList: any = []
|
|
25
|
+
for (const tag of currentTab?.tags) {
|
|
26
|
+
const status = orderStatus.find((status: any) => status.key === tag)
|
|
27
|
+
_optionList.push({value: tag, content: status.text})
|
|
28
|
+
}
|
|
29
|
+
setOptionsList(_optionList)
|
|
30
|
+
}, [currentTabSelected, tabs, orderStatus])
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Container isIos={Platform.OS === 'ios'}>
|
|
34
|
+
<ODropDown
|
|
35
|
+
options={optionsList}
|
|
36
|
+
defaultValue={search.state}
|
|
37
|
+
onSelect={(option: any) => onSearch({ ...search, state: option })}
|
|
38
|
+
isModal
|
|
39
|
+
bgcolor={theme.colors.inputDisabled}
|
|
40
|
+
textcolor={theme.colors.unselectText}
|
|
41
|
+
placeholder={t('SELECT_STATUS', 'Select Status')}
|
|
42
|
+
dropViewMaxHeight={200}
|
|
43
|
+
/>
|
|
44
|
+
</Container>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import styled, { css, useTheme } from 'styled-components/native'
|
|
3
|
+
import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler'
|
|
4
|
+
import { ScrollView as CustomScrollView, TouchableOpacity as CustomTouchableOpacity, View } from 'react-native'
|
|
5
|
+
import FeatherIcon from 'react-native-vector-icons/Feather';
|
|
6
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
7
|
+
import { Text } from 'react-native-paper';
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
secondary?: boolean,
|
|
11
|
+
options?: any;
|
|
12
|
+
defaultValue?: any,
|
|
13
|
+
placeholder?: string,
|
|
14
|
+
onSelect?: any,
|
|
15
|
+
style?: any,
|
|
16
|
+
dropViewMaxHeight?: any,
|
|
17
|
+
isModal?: any,
|
|
18
|
+
bgcolor?: string,
|
|
19
|
+
textcolor?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const Wrapper = styled.View`
|
|
23
|
+
position: relative;
|
|
24
|
+
`
|
|
25
|
+
const Selected = styled.TouchableOpacity`
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
position: relative;
|
|
30
|
+
padding: 15px;
|
|
31
|
+
border-radius: 10px;
|
|
32
|
+
border-width: 1px;
|
|
33
|
+
border-color: ${(props: any) => props.bgcolor || (props.secondary ? props.theme.colors.lightGray : props.theme.colors.primary)};
|
|
34
|
+
background-color: ${(props: any) => props.bgcolor || (props.secondary ? props.theme.colors.white : props.theme.colors.primary)};
|
|
35
|
+
`
|
|
36
|
+
const SelectedLabel = styled.Text`
|
|
37
|
+
font-size: 16px;
|
|
38
|
+
color: ${(props: any) => props.textcolor || (props.secondary ? props.theme.colors.black : props.theme.colors.white)};
|
|
39
|
+
`
|
|
40
|
+
|
|
41
|
+
const DropView = styled.View`
|
|
42
|
+
position: absolute;
|
|
43
|
+
z-index: 9999;
|
|
44
|
+
top: 65px;
|
|
45
|
+
border-width: 1px;
|
|
46
|
+
border-color: ${(props: any) => props.theme.colors.inputChat};
|
|
47
|
+
shadow-color: 'rgba(0.0, 0.0, 0.0, 0.5)';
|
|
48
|
+
shadow-opacity: 0.21;
|
|
49
|
+
elevation: 7;
|
|
50
|
+
background-color: ${(props: any) => props.theme.colors.white};
|
|
51
|
+
border-radius: 7.6px;
|
|
52
|
+
padding-left: 10px;
|
|
53
|
+
padding-right: 10px;
|
|
54
|
+
width: 100%;
|
|
55
|
+
`
|
|
56
|
+
const DropOption = styled.View`
|
|
57
|
+
padding: 15px;
|
|
58
|
+
font-size: 16px;
|
|
59
|
+
border-bottom-width: 1px;
|
|
60
|
+
border-bottom-color: ${(props: any) => props.theme.colors.lightGray};
|
|
61
|
+
flex-direction: row;
|
|
62
|
+
align-items: center;
|
|
63
|
+
`
|
|
64
|
+
|
|
65
|
+
const ODropDown = (props: Props) => {
|
|
66
|
+
const {
|
|
67
|
+
secondary,
|
|
68
|
+
options,
|
|
69
|
+
defaultValue,
|
|
70
|
+
placeholder,
|
|
71
|
+
onSelect,
|
|
72
|
+
dropViewMaxHeight,
|
|
73
|
+
isModal
|
|
74
|
+
} = props
|
|
75
|
+
|
|
76
|
+
const theme = useTheme();
|
|
77
|
+
|
|
78
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
79
|
+
const defaultOption = options?.find((option: any) => option.value === defaultValue)
|
|
80
|
+
const [selectedOption, setSelectedOption] = useState<any>(defaultOption)
|
|
81
|
+
const [value, setValue] = useState(defaultValue)
|
|
82
|
+
|
|
83
|
+
const onToggle = () => {
|
|
84
|
+
setIsOpen(!isOpen)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const onSelectOption = (option: any) => {
|
|
88
|
+
setSelectedOption(option)
|
|
89
|
+
setValue(option.value)
|
|
90
|
+
onSelect(option.name || option.value)
|
|
91
|
+
setIsOpen(false)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
const _defaultOption = options?.find((option: any) => option.value === defaultValue)
|
|
96
|
+
setSelectedOption(_defaultOption)
|
|
97
|
+
setValue(defaultValue)
|
|
98
|
+
}, [defaultValue, options])
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<Wrapper style={props.style}>
|
|
102
|
+
<Selected
|
|
103
|
+
secondary={secondary}
|
|
104
|
+
bgcolor={props.bgcolor}
|
|
105
|
+
onPress={() => onToggle()}
|
|
106
|
+
>
|
|
107
|
+
<SelectedLabel
|
|
108
|
+
secondary={secondary}
|
|
109
|
+
textcolor={props.textcolor}
|
|
110
|
+
>
|
|
111
|
+
{selectedOption?.content || selectedOption?.name || placeholder}
|
|
112
|
+
</SelectedLabel>
|
|
113
|
+
<FeatherIcon
|
|
114
|
+
name='chevron-down'
|
|
115
|
+
color={props.textcolor}
|
|
116
|
+
size={24}
|
|
117
|
+
/>
|
|
118
|
+
</Selected>
|
|
119
|
+
{isOpen && options && (
|
|
120
|
+
<DropView
|
|
121
|
+
secondary={secondary}
|
|
122
|
+
>
|
|
123
|
+
{!isModal ? (
|
|
124
|
+
<ScrollView style={{
|
|
125
|
+
maxHeight: dropViewMaxHeight || null
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
{options.map((option: any, index: number) => (
|
|
129
|
+
<TouchableOpacity
|
|
130
|
+
key={index}
|
|
131
|
+
onPress={() => onSelectOption(option)}
|
|
132
|
+
>
|
|
133
|
+
<View style={{ marginRight: 10 }}>
|
|
134
|
+
{value === option.value ? (
|
|
135
|
+
<MaterialCommunityIcons
|
|
136
|
+
name='radiobox-marked'
|
|
137
|
+
size={24}
|
|
138
|
+
color={theme.colors.primary}
|
|
139
|
+
/>
|
|
140
|
+
) : (
|
|
141
|
+
<MaterialCommunityIcons
|
|
142
|
+
name='radiobox-blank'
|
|
143
|
+
size={24}
|
|
144
|
+
color={theme.colors.primary}
|
|
145
|
+
/>
|
|
146
|
+
)}
|
|
147
|
+
</View>
|
|
148
|
+
<Text>{option.content || option.name}</Text>
|
|
149
|
+
</TouchableOpacity>
|
|
150
|
+
))}
|
|
151
|
+
</ScrollView>
|
|
152
|
+
) : (
|
|
153
|
+
<CustomScrollView style={{
|
|
154
|
+
maxHeight: dropViewMaxHeight || null,
|
|
155
|
+
paddingBottom: 15
|
|
156
|
+
}}
|
|
157
|
+
nestedScrollEnabled={true}
|
|
158
|
+
>
|
|
159
|
+
{options.map((option: any, index: number) => (
|
|
160
|
+
<CustomTouchableOpacity
|
|
161
|
+
key={index}
|
|
162
|
+
onPress={() => onSelectOption(option)}
|
|
163
|
+
>
|
|
164
|
+
<DropOption
|
|
165
|
+
numberOfLines={1}
|
|
166
|
+
selected={value === option.value}
|
|
167
|
+
>
|
|
168
|
+
<View style={{ marginRight: 10 }}>
|
|
169
|
+
{value === option.value ? (
|
|
170
|
+
<MaterialCommunityIcons
|
|
171
|
+
name='radiobox-marked'
|
|
172
|
+
size={24}
|
|
173
|
+
color={theme.colors.primary}
|
|
174
|
+
/>
|
|
175
|
+
) : (
|
|
176
|
+
<MaterialCommunityIcons
|
|
177
|
+
name='radiobox-blank'
|
|
178
|
+
size={24}
|
|
179
|
+
color={theme.colors.arrowColor}
|
|
180
|
+
/>
|
|
181
|
+
)}
|
|
182
|
+
</View>
|
|
183
|
+
<Text>{option.content || option.name}</Text>
|
|
184
|
+
</DropOption>
|
|
185
|
+
</CustomTouchableOpacity>
|
|
186
|
+
))}
|
|
187
|
+
</CustomScrollView>
|
|
188
|
+
)}
|
|
189
|
+
</DropView>
|
|
190
|
+
)}
|
|
191
|
+
</Wrapper>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export default ODropDown
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import styled, { css, useTheme } from 'styled-components/native'
|
|
3
|
+
import { useLanguage } from 'ordering-components/native';
|
|
4
|
+
import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler'
|
|
5
|
+
import { ScrollView as CustomScrollView, TouchableOpacity as CustomTouchableOpacity, View, useWindowDimensions } from 'react-native'
|
|
6
|
+
import FeatherIcon from 'react-native-vector-icons/Feather';
|
|
7
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
8
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
9
|
+
import { Text } from 'react-native-paper';
|
|
10
|
+
import CalendarPicker from 'react-native-calendar-picker';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
secondary?: boolean,
|
|
14
|
+
options?: any;
|
|
15
|
+
defaultValue?: any,
|
|
16
|
+
placeholder?: string,
|
|
17
|
+
onSelect?: any,
|
|
18
|
+
style?: any,
|
|
19
|
+
dropViewMaxHeight?: any,
|
|
20
|
+
isModal?: any,
|
|
21
|
+
bgcolor?: string,
|
|
22
|
+
textcolor?: string,
|
|
23
|
+
isCalendar?: boolean,
|
|
24
|
+
handleChangeDate?: any,
|
|
25
|
+
rangeDate?: any
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const Wrapper = styled.View`
|
|
29
|
+
position: relative;
|
|
30
|
+
`
|
|
31
|
+
const Selected = styled.TouchableOpacity`
|
|
32
|
+
flex-direction: row;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
position: relative;
|
|
36
|
+
padding: 15px;
|
|
37
|
+
border-radius: 10px;
|
|
38
|
+
border-width: 1px;
|
|
39
|
+
border-color: ${(props: any) => props.bgcolor || (props.secondary ? props.theme.colors.lightGray : props.theme.colors.primary)};
|
|
40
|
+
background-color: ${(props: any) => props.bgcolor || (props.secondary ? props.theme.colors.white : props.theme.colors.primary)};
|
|
41
|
+
`
|
|
42
|
+
const SelectedLabel = styled.Text`
|
|
43
|
+
font-size: 16px;
|
|
44
|
+
color: ${(props: any) => props.textcolor || (props.secondary ? props.theme.colors.black : props.theme.colors.white)};
|
|
45
|
+
`
|
|
46
|
+
|
|
47
|
+
const DropView = styled.View`
|
|
48
|
+
position: absolute;
|
|
49
|
+
z-index: 9999;
|
|
50
|
+
top: 65px;
|
|
51
|
+
border-width: 1px;
|
|
52
|
+
border-color: ${(props: any) => props.theme.colors.inputChat};
|
|
53
|
+
shadow-color: 'rgba(0.0, 0.0, 0.0, 0.5)';
|
|
54
|
+
shadow-opacity: 0.21;
|
|
55
|
+
elevation: 7;
|
|
56
|
+
background-color: ${(props: any) => props.theme.colors.white};
|
|
57
|
+
border-radius: 7.6px;
|
|
58
|
+
padding-left: 10px;
|
|
59
|
+
padding-right: 10px;
|
|
60
|
+
width: 100%;
|
|
61
|
+
`
|
|
62
|
+
const DropOption = styled.View`
|
|
63
|
+
padding: 15px;
|
|
64
|
+
font-size: 16px;
|
|
65
|
+
border-bottom-width: 1px;
|
|
66
|
+
border-bottom-color: ${(props: any) => props.theme.colors.lightGray};
|
|
67
|
+
flex-direction: row;
|
|
68
|
+
align-items: center;
|
|
69
|
+
`
|
|
70
|
+
|
|
71
|
+
const DateInput = styled.TextInput`
|
|
72
|
+
flex-grow: 1;
|
|
73
|
+
flex: 1;
|
|
74
|
+
min-height: 36px;
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
font-family: 'Poppins-Regular';
|
|
77
|
+
border-width: 1px;
|
|
78
|
+
border-color: ${(props: any) => props.theme.colors.tabBar};
|
|
79
|
+
padding: 7px 14px;
|
|
80
|
+
color: ${(props: any) => props.theme.colors.backArrow};
|
|
81
|
+
${({ active }: { active: boolean }) => active && css`
|
|
82
|
+
border-color: ${(props: any) => props.theme.colors.primary};
|
|
83
|
+
`}
|
|
84
|
+
`;
|
|
85
|
+
|
|
86
|
+
const ODropDownCalendar = (props: Props) => {
|
|
87
|
+
const {
|
|
88
|
+
secondary,
|
|
89
|
+
options,
|
|
90
|
+
defaultValue,
|
|
91
|
+
placeholder,
|
|
92
|
+
onSelect,
|
|
93
|
+
dropViewMaxHeight,
|
|
94
|
+
isModal,
|
|
95
|
+
isCalendar,
|
|
96
|
+
handleChangeDate,
|
|
97
|
+
rangeDate
|
|
98
|
+
} = props
|
|
99
|
+
|
|
100
|
+
const theme = useTheme();
|
|
101
|
+
const { width } = useWindowDimensions();
|
|
102
|
+
const [, t] = useLanguage();
|
|
103
|
+
|
|
104
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
105
|
+
const defaultOption = options?.find((option: any) => option.value === defaultValue)
|
|
106
|
+
const [selectedOption, setSelectedOption] = useState<any>(defaultOption)
|
|
107
|
+
const [value, setValue] = useState(defaultValue)
|
|
108
|
+
|
|
109
|
+
const onToggle = () => {
|
|
110
|
+
setIsOpen(!isOpen)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const onSelectOption = (option: any) => {
|
|
114
|
+
setSelectedOption(option)
|
|
115
|
+
setValue(option.value)
|
|
116
|
+
onSelect(option.name || option.value)
|
|
117
|
+
setIsOpen(false)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const onDateChange = (date: any, type: any) => {
|
|
121
|
+
if (!date) return
|
|
122
|
+
if (type === 'END_DATE') {
|
|
123
|
+
handleChangeDate(rangeDate.from, date.format('MM/DD/YY'))
|
|
124
|
+
} else {
|
|
125
|
+
handleChangeDate(date.format('MM/DD/YY'), '')
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const customDayHeaderStylesCallback = () => {
|
|
130
|
+
return {
|
|
131
|
+
textStyle: {
|
|
132
|
+
color: theme.colors.unselectText,
|
|
133
|
+
fontSize: 12,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const calendarText = (from: any, to: any, placeholder: any) => {
|
|
139
|
+
const end = ` ~ ${to}`
|
|
140
|
+
return (from || to) ? (from + (to ? end : '')) : placeholder
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
const _defaultOption = options?.find((option: any) => option.value === defaultValue)
|
|
145
|
+
setSelectedOption(_defaultOption)
|
|
146
|
+
setValue(defaultValue)
|
|
147
|
+
}, [defaultValue, options])
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Wrapper style={props.style}>
|
|
151
|
+
<Selected
|
|
152
|
+
secondary={secondary}
|
|
153
|
+
bgcolor={props.bgcolor}
|
|
154
|
+
onPress={() => onToggle()}
|
|
155
|
+
>
|
|
156
|
+
<SelectedLabel
|
|
157
|
+
secondary={secondary}
|
|
158
|
+
textcolor={props.textcolor}
|
|
159
|
+
>
|
|
160
|
+
{
|
|
161
|
+
defaultValue === 'calendar'
|
|
162
|
+
? `${calendarText(rangeDate.from, rangeDate.to, placeholder)}`
|
|
163
|
+
: `${selectedOption?.content || selectedOption?.name || placeholder}`
|
|
164
|
+
}
|
|
165
|
+
</SelectedLabel>
|
|
166
|
+
<FeatherIcon
|
|
167
|
+
name='calendar'
|
|
168
|
+
color={theme.colors.backArrow}
|
|
169
|
+
size={24}
|
|
170
|
+
/>
|
|
171
|
+
</Selected>
|
|
172
|
+
{isOpen && options && (
|
|
173
|
+
<DropView
|
|
174
|
+
secondary={secondary}
|
|
175
|
+
>
|
|
176
|
+
{!isModal ? (
|
|
177
|
+
<ScrollView style={{
|
|
178
|
+
maxHeight: dropViewMaxHeight || null
|
|
179
|
+
}}
|
|
180
|
+
>
|
|
181
|
+
{options.map((option: any, index: number) => (
|
|
182
|
+
<TouchableOpacity
|
|
183
|
+
key={index}
|
|
184
|
+
onPress={() => onSelectOption(option)}
|
|
185
|
+
>
|
|
186
|
+
<View style={{ marginRight: 10 }}>
|
|
187
|
+
{value === option.value ? (
|
|
188
|
+
<MaterialCommunityIcons
|
|
189
|
+
name='radiobox-marked'
|
|
190
|
+
size={24}
|
|
191
|
+
color={theme.colors.primary}
|
|
192
|
+
/>
|
|
193
|
+
) : (
|
|
194
|
+
<MaterialCommunityIcons
|
|
195
|
+
name='radiobox-blank'
|
|
196
|
+
size={24}
|
|
197
|
+
color={theme.colors.primary}
|
|
198
|
+
/>
|
|
199
|
+
)}
|
|
200
|
+
</View>
|
|
201
|
+
<Text>{option.content || option.name}</Text>
|
|
202
|
+
</TouchableOpacity>
|
|
203
|
+
))}
|
|
204
|
+
</ScrollView>
|
|
205
|
+
) : (
|
|
206
|
+
<CustomScrollView style={{
|
|
207
|
+
maxHeight: dropViewMaxHeight || null
|
|
208
|
+
}}
|
|
209
|
+
nestedScrollEnabled={true}
|
|
210
|
+
>
|
|
211
|
+
{options.map((option: any, index: number) => (
|
|
212
|
+
<CustomTouchableOpacity
|
|
213
|
+
key={index}
|
|
214
|
+
onPress={() => onSelectOption(option)}
|
|
215
|
+
>
|
|
216
|
+
<DropOption
|
|
217
|
+
numberOfLines={1}
|
|
218
|
+
selected={value === option.value}
|
|
219
|
+
>
|
|
220
|
+
<View style={{ marginRight: 10 }}>
|
|
221
|
+
{value === option.value ? (
|
|
222
|
+
<MaterialCommunityIcons
|
|
223
|
+
name='radiobox-marked'
|
|
224
|
+
size={24}
|
|
225
|
+
color={theme.colors.primary}
|
|
226
|
+
/>
|
|
227
|
+
) : (
|
|
228
|
+
<MaterialCommunityIcons
|
|
229
|
+
name='radiobox-blank'
|
|
230
|
+
size={24}
|
|
231
|
+
color={theme.colors.arrowColor}
|
|
232
|
+
/>
|
|
233
|
+
)}
|
|
234
|
+
</View>
|
|
235
|
+
<Text>{option.content || option.name}</Text>
|
|
236
|
+
</DropOption>
|
|
237
|
+
</CustomTouchableOpacity>
|
|
238
|
+
))}
|
|
239
|
+
{isCalendar && (
|
|
240
|
+
<>
|
|
241
|
+
<View style={{
|
|
242
|
+
flexDirection: 'row',
|
|
243
|
+
alignItems: 'center',
|
|
244
|
+
marginTop: 10
|
|
245
|
+
}}>
|
|
246
|
+
<View style={{marginRight: 10, flex: 1, marginBottom: 15}}>
|
|
247
|
+
<Text style={{marginBottom: 5}}>{t('FROM', 'From')}</Text>
|
|
248
|
+
<DateInput
|
|
249
|
+
value={rangeDate.from}
|
|
250
|
+
placeholder={t('FROM', 'From')}
|
|
251
|
+
autoCorrect={false}
|
|
252
|
+
style={{
|
|
253
|
+
borderRadius: 7.6
|
|
254
|
+
}}
|
|
255
|
+
active={defaultValue === 'calendar'}
|
|
256
|
+
onFocus={() => onSelect('calendar')}
|
|
257
|
+
/>
|
|
258
|
+
<AntDesign
|
|
259
|
+
name='close'
|
|
260
|
+
color={theme.colors.disabled}
|
|
261
|
+
size={20}
|
|
262
|
+
style={{position: 'absolute', bottom: 13, right: 10}}
|
|
263
|
+
onPress={() => handleChangeDate('', rangeDate.to)}
|
|
264
|
+
/>
|
|
265
|
+
</View>
|
|
266
|
+
<View style={{marginLeft: 10, flex: 1, marginBottom: 15}}>
|
|
267
|
+
<Text style={{marginBottom: 5}}>{t('TO', 'To')}</Text>
|
|
268
|
+
<DateInput
|
|
269
|
+
value={rangeDate.to}
|
|
270
|
+
placeholder={t('TO', 'To')}
|
|
271
|
+
autoCorrect={false}
|
|
272
|
+
style={{
|
|
273
|
+
borderRadius: 7.6
|
|
274
|
+
}}
|
|
275
|
+
active={defaultValue === 'calendar'}
|
|
276
|
+
onFocus={() => onSelect('calendar')}
|
|
277
|
+
/>
|
|
278
|
+
<AntDesign
|
|
279
|
+
name='close'
|
|
280
|
+
color={theme.colors.disabled}
|
|
281
|
+
size={20}
|
|
282
|
+
style={{position: 'absolute', bottom: 13, right: 10}}
|
|
283
|
+
onPress={() => handleChangeDate(rangeDate.from, '')}
|
|
284
|
+
/>
|
|
285
|
+
</View>
|
|
286
|
+
</View>
|
|
287
|
+
{
|
|
288
|
+
defaultValue === 'calendar' && (
|
|
289
|
+
<CalendarPicker
|
|
290
|
+
previousComponent={
|
|
291
|
+
<FeatherIcon
|
|
292
|
+
name='chevron-left'
|
|
293
|
+
color={theme.colors.disabled}
|
|
294
|
+
size={24}
|
|
295
|
+
style={{ marginHorizontal: 4 }}
|
|
296
|
+
/>
|
|
297
|
+
}
|
|
298
|
+
nextComponent={
|
|
299
|
+
<FeatherIcon
|
|
300
|
+
name='chevron-right'
|
|
301
|
+
color={theme.colors.disabled}
|
|
302
|
+
size={24}
|
|
303
|
+
style={{ marginHorizontal: 4 }}
|
|
304
|
+
/>
|
|
305
|
+
}
|
|
306
|
+
width={width - 80}
|
|
307
|
+
startFromMonday={true}
|
|
308
|
+
allowRangeSelection={true}
|
|
309
|
+
selectedDayTextColor={theme.colors.textGray}
|
|
310
|
+
selectedDayColor={theme.colors.forgotText}
|
|
311
|
+
todayBackgroundColor={theme.colors.border}
|
|
312
|
+
dayLabelsWrapper={{ borderColor: theme.colors.clear }}
|
|
313
|
+
onDateChange={onDateChange}
|
|
314
|
+
customDayHeaderStyles={customDayHeaderStylesCallback}
|
|
315
|
+
/>
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
</>
|
|
319
|
+
)}
|
|
320
|
+
</CustomScrollView>
|
|
321
|
+
)}
|
|
322
|
+
</DropView>
|
|
323
|
+
)}
|
|
324
|
+
</Wrapper>
|
|
325
|
+
)
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export default ODropDownCalendar
|
|
@@ -8,6 +8,8 @@ import OModal from './OModal';
|
|
|
8
8
|
import OAlert from './OAlert';
|
|
9
9
|
import OFab from './OFab';
|
|
10
10
|
import OLink from './OLink';
|
|
11
|
+
import ODropDown from './ODropDown';
|
|
12
|
+
import ODropDownCalendar from './ODropDownCalendar';
|
|
11
13
|
|
|
12
14
|
export {
|
|
13
15
|
OText,
|
|
@@ -20,4 +22,6 @@ export {
|
|
|
20
22
|
OModal,
|
|
21
23
|
OFab,
|
|
22
24
|
OLink,
|
|
25
|
+
ODropDown,
|
|
26
|
+
ODropDownCalendar
|
|
23
27
|
};
|
|
@@ -275,6 +275,8 @@ export interface OrdersOptionParams {
|
|
|
275
275
|
ordersGroup?: any;
|
|
276
276
|
setOrdersGroup?: any;
|
|
277
277
|
setCurrentFilters?: any;
|
|
278
|
+
onFiltered?: ({}: any) => {};
|
|
279
|
+
filtered?: any;
|
|
278
280
|
handleClickOrder?: any;
|
|
279
281
|
orderGroupStatusCustom?: {
|
|
280
282
|
pending?: Array<number>;
|