ordering-ui-react-native 0.12.14 → 0.12.18
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 +1 -1
- package/src/components/AddressList/index.tsx +3 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +168 -156
- package/themes/business/src/components/NewOrderNotification/index.tsx +14 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -1
- package/themes/business/src/components/OrdersOption/index.tsx +19 -15
- package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +389 -0
- package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +36 -0
- package/themes/business/src/components 2/BusinessController/index.tsx +155 -0
- package/themes/business/src/components 2/BusinessController/styles.tsx +19 -0
- package/themes/business/src/components 2/Chat/index.tsx +1152 -0
- package/themes/business/src/components 2/Chat/styles.tsx +12 -0
- package/themes/business/src/components 2/Contacts/index.tsx +299 -0
- package/themes/business/src/components 2/Contacts/styles.tsx +42 -0
- package/themes/business/src/components 2/DriverMap/index.tsx +525 -0
- package/themes/business/src/components 2/FloatingButton/index.tsx +141 -0
- package/themes/business/src/components 2/FloatingButton/styles.tsx +35 -0
- package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +204 -0
- package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +11 -0
- package/themes/business/src/components 2/GoogleMap/index.tsx +347 -0
- package/themes/business/src/components 2/Home/index.tsx +111 -0
- package/themes/business/src/components 2/Home/styles.tsx +27 -0
- package/themes/business/src/components 2/LanguageSelector/index.tsx +124 -0
- package/themes/business/src/components 2/LanguageSelector/lang_country.json +152 -0
- package/themes/business/src/components 2/LanguageSelector/styles.tsx +17 -0
- package/themes/business/src/components 2/LoginForm/index.tsx +663 -0
- package/themes/business/src/components 2/LoginForm/styles.tsx +48 -0
- package/themes/business/src/components 2/LogoutButton/index.tsx +63 -0
- package/themes/business/src/components 2/MapView/index.tsx +317 -0
- package/themes/business/src/components 2/MessagesOption/index.tsx +337 -0
- package/themes/business/src/components 2/MessagesOption/styles.tsx +27 -0
- package/themes/business/src/components 2/NewOrderNotification/index.tsx +167 -0
- package/themes/business/src/components 2/NewOrderNotification/styles.tsx +8 -0
- package/themes/business/src/components 2/NotFoundSource/index.tsx +52 -0
- package/themes/business/src/components 2/NotFoundSource/styles.tsx +17 -0
- package/themes/business/src/components 2/OrderDetails/Business.tsx +683 -0
- package/themes/business/src/components 2/OrderDetails/Delivery.tsx +454 -0
- package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +391 -0
- package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +148 -0
- package/themes/business/src/components 2/OrderDetails/styles.tsx +84 -0
- package/themes/business/src/components 2/OrderMessage/index.tsx +344 -0
- package/themes/business/src/components 2/OrderMessage/styles.tsx +5 -0
- package/themes/business/src/components 2/OrderSummary/index.tsx +700 -0
- package/themes/business/src/components 2/OrderSummary/styles.tsx +61 -0
- package/themes/business/src/components 2/OrdersOption/index.tsx +755 -0
- package/themes/business/src/components 2/OrdersOption/styles.tsx +54 -0
- package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +51 -0
- package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionCity/index.tsx +52 -0
- package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDate/index.tsx +52 -0
- package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +35 -0
- package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +50 -0
- package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +49 -0
- package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +46 -0
- package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +8 -0
- package/themes/business/src/components 2/PhoneInputNumber/index.tsx +160 -0
- package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +3 -0
- package/themes/business/src/components 2/PreviousMessages/index.tsx +304 -0
- package/themes/business/src/components 2/PreviousMessages/styles.tsx +32 -0
- package/themes/business/src/components 2/PreviousOrders/index.tsx +180 -0
- package/themes/business/src/components 2/PreviousOrders/styles.tsx +38 -0
- package/themes/business/src/components 2/ProductItemAccordion/index.tsx +301 -0
- package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +61 -0
- package/themes/business/src/components 2/SearchBar/index.tsx +112 -0
- package/themes/business/src/components 2/SignupForm/index.tsx +530 -0
- package/themes/business/src/components 2/SignupForm/styles.tsx +16 -0
- package/themes/business/src/components 2/StoresList/index.tsx +208 -0
- package/themes/business/src/components 2/StoresList/styles.tsx +26 -0
- package/themes/business/src/components 2/UserFormDetails/index.tsx +513 -0
- package/themes/business/src/components 2/UserFormDetails/styles.tsx +40 -0
- package/themes/business/src/components 2/UserProfileForm/index.tsx +496 -0
- package/themes/business/src/components 2/UserProfileForm/styles.tsx +36 -0
- package/themes/business/src/components 2/VerifyPhone/index.tsx +201 -0
- package/themes/business/src/components 2/VerifyPhone/styles.tsx +43 -0
- package/themes/business/src/components 2/shared/OAlert.tsx +52 -0
- package/themes/business/src/components 2/shared/OButton.tsx +149 -0
- package/themes/business/src/components 2/shared/OChatBubble.tsx +100 -0
- package/themes/business/src/components 2/shared/ODropDown.tsx +195 -0
- package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +328 -0
- package/themes/business/src/components 2/shared/OFab.tsx +54 -0
- package/themes/business/src/components 2/shared/OIcon.tsx +67 -0
- package/themes/business/src/components 2/shared/OIconButton.tsx +127 -0
- package/themes/business/src/components 2/shared/OInput.tsx +144 -0
- package/themes/business/src/components 2/shared/OLink.tsx +76 -0
- package/themes/business/src/components 2/shared/OModal.tsx +275 -0
- package/themes/business/src/components 2/shared/OSegment.tsx +86 -0
- package/themes/business/src/components 2/shared/OText.tsx +55 -0
- package/themes/business/src/components 2/shared/OTextarea.tsx +46 -0
- package/themes/business/src/components 2/shared/OToast.tsx +92 -0
- package/themes/business/src/components 2/shared/index.tsx +27 -0
- package/themes/business/src/types/index.tsx +4 -1
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +128 -83
- package/themes/kiosk/src/components/DrawerView/index.tsx +57 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +30 -0
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +78 -58
- package/themes/kiosk/src/components/OrderDetails/index.tsx +3 -1
- package/themes/kiosk/src/components/ProductForm/index.tsx +129 -127
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +9 -6
- package/themes/original/src/components/OrderProgress/index.tsx +32 -18
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import styled from 'styled-components/native';
|
|
2
|
+
|
|
3
|
+
export const FiltersTab = styled.View`
|
|
4
|
+
margin-bottom: 20px;
|
|
5
|
+
`;
|
|
6
|
+
|
|
7
|
+
export const TabsContainer = styled.View`
|
|
8
|
+
width: ${({ width }: { width: number }) => `${width-42}px`};
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
border-bottom-width: 1px;
|
|
13
|
+
border-bottom-color: ${(props: any) => props.theme.colors.tabBar};
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
export const Tag = styled.Pressable`
|
|
17
|
+
background-color: ${({ isSelected }: { isSelected: string }) => isSelected};
|
|
18
|
+
justify-content: center;
|
|
19
|
+
align-items: center;
|
|
20
|
+
min-height: 34px;
|
|
21
|
+
padding: 4px 10px;
|
|
22
|
+
border-radius: 50px;
|
|
23
|
+
margin-right: 15px;
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
export const IconWrapper = styled.View`
|
|
27
|
+
flex-direction: row;
|
|
28
|
+
align-items: center;
|
|
29
|
+
`
|
|
30
|
+
|
|
31
|
+
export const ModalContainer = styled.ScrollView`
|
|
32
|
+
padding: 20px 40px 10px 40px;
|
|
33
|
+
`
|
|
34
|
+
|
|
35
|
+
export const ModalTitle = styled.Text`
|
|
36
|
+
font-family: Poppins;
|
|
37
|
+
font-style: normal;
|
|
38
|
+
font-weight: 600;
|
|
39
|
+
font-size: 20px;
|
|
40
|
+
color: ${(props: any) => props.theme.colors.textGray};
|
|
41
|
+
text-transform: capitalize;
|
|
42
|
+
margin-bottom: 24px;
|
|
43
|
+
`
|
|
44
|
+
|
|
45
|
+
export const FilterBtnWrapper = styled.TouchableOpacity`
|
|
46
|
+
background-color: ${(props: any) => props.theme.colors.inputDisabled};
|
|
47
|
+
border-radius: 7.6px;
|
|
48
|
+
margin-vertical: 5px;
|
|
49
|
+
padding: 15px 20px;
|
|
50
|
+
flex-direction: row;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
margin-bottom: 24px;
|
|
54
|
+
`
|
|
@@ -0,0 +1,51 @@
|
|
|
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 { BusinessList as BusinessListController } from 'ordering-components/native'
|
|
7
|
+
import { Platform } from 'react-native'
|
|
8
|
+
|
|
9
|
+
export const OrdersOptionBusinessUI = (props: any) => {
|
|
10
|
+
const {
|
|
11
|
+
search,
|
|
12
|
+
onSearch,
|
|
13
|
+
businessesList
|
|
14
|
+
} = props
|
|
15
|
+
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
const [, t] = useLanguage();
|
|
18
|
+
const [optionsList, setOptionsList] = useState([])
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const businesses: any = []
|
|
22
|
+
for (const business of businessesList?.businesses) {
|
|
23
|
+
businesses.push({value: business.id, content: business.name})
|
|
24
|
+
}
|
|
25
|
+
setOptionsList(businesses)
|
|
26
|
+
}, [businessesList?.businesses])
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Container isIos={Platform.OS === 'ios'}>
|
|
30
|
+
<ODropDown
|
|
31
|
+
options={optionsList}
|
|
32
|
+
defaultValue={search.business}
|
|
33
|
+
onSelect={(option: any) => onSearch({ ...search, business: option })}
|
|
34
|
+
isModal
|
|
35
|
+
bgcolor={theme.colors.inputDisabled}
|
|
36
|
+
textcolor={theme.colors.unselectText}
|
|
37
|
+
placeholder={t('SELECT_BUSINESS', 'Select Business')}
|
|
38
|
+
dropViewMaxHeight={200}
|
|
39
|
+
/>
|
|
40
|
+
</Container>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const OrdersOptionBusiness = (props: any) => {
|
|
45
|
+
const ordersOptionBusinessProps = {
|
|
46
|
+
...props,
|
|
47
|
+
propsToFetch: ['id', 'name'],
|
|
48
|
+
UIComponent: OrdersOptionBusinessUI
|
|
49
|
+
};
|
|
50
|
+
return <BusinessListController {...ordersOptionBusinessProps} />
|
|
51
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { MainSearch as MainSearchController } from 'ordering-components/native'
|
|
7
|
+
import { Platform } from 'react-native';
|
|
8
|
+
|
|
9
|
+
export const OrdersOptionCityUI = (props: any) => {
|
|
10
|
+
const {
|
|
11
|
+
search,
|
|
12
|
+
onSearch,
|
|
13
|
+
allListValues
|
|
14
|
+
} = props
|
|
15
|
+
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
const [, t] = useLanguage();
|
|
18
|
+
const [optionsList, setOptionsList] = useState([])
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const cities: any = []
|
|
22
|
+
for (const country of allListValues?.countries) {
|
|
23
|
+
for (const city of country.cities) {
|
|
24
|
+
cities.push({value: city.id, content: city.name})
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
setOptionsList(cities)
|
|
28
|
+
}, [allListValues?.countries])
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Container isIos={Platform.OS === 'ios'}>
|
|
32
|
+
<ODropDown
|
|
33
|
+
options={optionsList}
|
|
34
|
+
defaultValue={search.city}
|
|
35
|
+
onSelect={(option: any) => onSearch({ ...search, city: option })}
|
|
36
|
+
isModal
|
|
37
|
+
bgcolor={theme.colors.inputDisabled}
|
|
38
|
+
textcolor={theme.colors.unselectText}
|
|
39
|
+
placeholder={t('SELECT_CITY', 'Select City')}
|
|
40
|
+
dropViewMaxHeight={200}
|
|
41
|
+
/>
|
|
42
|
+
</Container>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const OrdersOptionCity = (props: any) => {
|
|
47
|
+
const ordersOptionCityProps = {
|
|
48
|
+
...props,
|
|
49
|
+
UIComponent: OrdersOptionCityUI
|
|
50
|
+
};
|
|
51
|
+
return <MainSearchController {...ordersOptionCityProps} />;
|
|
52
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useLanguage } from 'ordering-components/native';
|
|
3
|
+
import { useTheme } from 'styled-components/native';
|
|
4
|
+
import { Container } from './styles';
|
|
5
|
+
import ODropDownCalendar from '../shared/ODropDownCalendar';
|
|
6
|
+
import { Platform } from 'react-native'
|
|
7
|
+
|
|
8
|
+
export const OrdersOptionDate = (props: any) => {
|
|
9
|
+
const {
|
|
10
|
+
search,
|
|
11
|
+
onSearch
|
|
12
|
+
} = props
|
|
13
|
+
|
|
14
|
+
const theme = useTheme();
|
|
15
|
+
const [, t] = useLanguage();
|
|
16
|
+
const optionsList: any = [
|
|
17
|
+
{ value: 'today', content: t('TODAY', 'Today') },
|
|
18
|
+
{ value: 'yesterday', content: t('YESTERDAY', 'Yesterday') },
|
|
19
|
+
{ value: 'last_7days', content: t('LAST_7_DAYS', 'Last 7 days') },
|
|
20
|
+
{ value: 'last_30days', content: t('LAST_30_DAYS', 'Last 30 days') }
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
const handleChangeOption = (option: any) => {
|
|
24
|
+
if (option === 'calendar') {
|
|
25
|
+
onSearch({...search, date: {...search.date, type: option}})
|
|
26
|
+
} else {
|
|
27
|
+
onSearch({...search, date: {from: '', to: '', type: option}})
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const handleChangeDate = (from: any, to: any) => {
|
|
32
|
+
onSearch({...search, date: {...search.date, from: from, to: to}})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Container isIos={Platform.OS === 'ios'}>
|
|
37
|
+
<ODropDownCalendar
|
|
38
|
+
options={optionsList}
|
|
39
|
+
defaultValue={search.date.type}
|
|
40
|
+
onSelect={(option: any) => handleChangeOption(option)}
|
|
41
|
+
isModal
|
|
42
|
+
bgcolor={theme.colors.inputDisabled}
|
|
43
|
+
textcolor={theme.colors.unselectText}
|
|
44
|
+
placeholder={t('SELECT_DATE', 'Select Date')}
|
|
45
|
+
dropViewMaxHeight={500}
|
|
46
|
+
isCalendar
|
|
47
|
+
rangeDate={search.date}
|
|
48
|
+
handleChangeDate={handleChangeDate}
|
|
49
|
+
/>
|
|
50
|
+
</Container>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React 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 OrdersOptionDelivery = (props: any) => {
|
|
9
|
+
const {
|
|
10
|
+
search,
|
|
11
|
+
onSearch
|
|
12
|
+
} = props
|
|
13
|
+
|
|
14
|
+
const theme = useTheme();
|
|
15
|
+
const [, t] = useLanguage();
|
|
16
|
+
const optionsList: any = [
|
|
17
|
+
{ value: '1', content: t('DELIVERY', 'Delivery') },
|
|
18
|
+
{ value: '2', content: t('PICKUP', 'Pickup') }
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Container isIos={Platform.OS === 'ios'}>
|
|
23
|
+
<ODropDown
|
|
24
|
+
options={optionsList}
|
|
25
|
+
defaultValue={search.delivery_type}
|
|
26
|
+
onSelect={(option: any) => onSearch({ ...search, delivery_type: option })}
|
|
27
|
+
isModal
|
|
28
|
+
bgcolor={theme.colors.inputDisabled}
|
|
29
|
+
textcolor={theme.colors.unselectText}
|
|
30
|
+
placeholder={t('SELECT_DELIVERY_TYPE', 'Select Delivery type')}
|
|
31
|
+
dropViewMaxHeight={200}
|
|
32
|
+
/>
|
|
33
|
+
</Container>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { useLanguage, DriverList as DriverListControllder } 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 OrdersOptionDriverUI = (props: any) => {
|
|
9
|
+
const {
|
|
10
|
+
search,
|
|
11
|
+
onSearch,
|
|
12
|
+
driverList
|
|
13
|
+
} = props
|
|
14
|
+
|
|
15
|
+
const theme = useTheme();
|
|
16
|
+
const [, t] = useLanguage();
|
|
17
|
+
const [optionsList, setOptionsList] = useState([])
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const drivers: any = []
|
|
21
|
+
for (const driver of driverList?.drivers) {
|
|
22
|
+
drivers.push({value: driver.id, content: driver.name})
|
|
23
|
+
}
|
|
24
|
+
setOptionsList(drivers)
|
|
25
|
+
}, [driverList?.drivers])
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Container isIos={Platform.OS === 'ios'}>
|
|
29
|
+
<ODropDown
|
|
30
|
+
options={optionsList}
|
|
31
|
+
defaultValue={search.driver}
|
|
32
|
+
onSelect={(option: any) => onSearch({ ...search, driver: option })}
|
|
33
|
+
isModal
|
|
34
|
+
bgcolor={theme.colors.inputDisabled}
|
|
35
|
+
textcolor={theme.colors.unselectText}
|
|
36
|
+
placeholder={t('SELECT_DRIVER', 'Select Driver')}
|
|
37
|
+
dropViewMaxHeight={165}
|
|
38
|
+
/>
|
|
39
|
+
</Container>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const OrdersOptionDriver = (props: any) => {
|
|
44
|
+
const ordersOptionDriverProps = {
|
|
45
|
+
...props,
|
|
46
|
+
propsToFetch: ['id', 'name', 'lastname'],
|
|
47
|
+
UIComponent: OrdersOptionDriverUI
|
|
48
|
+
};
|
|
49
|
+
return <DriverListControllder {...ordersOptionDriverProps} />;
|
|
50
|
+
};
|
|
@@ -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,160 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import PhoneInput from 'react-native-phone-number-input';
|
|
4
|
+
import { useLanguage, useConfig } from 'ordering-components/native';
|
|
5
|
+
import { useTheme } from 'styled-components/native';
|
|
6
|
+
import { Wrapper } from './styles';
|
|
7
|
+
import { OText, OIcon } from '../shared';
|
|
8
|
+
import { PhoneInputParams } from '../../types';
|
|
9
|
+
import { transformCountryCode } from '../../utils';
|
|
10
|
+
|
|
11
|
+
export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
12
|
+
const {
|
|
13
|
+
data,
|
|
14
|
+
handleData,
|
|
15
|
+
defaultValue,
|
|
16
|
+
defaultCode,
|
|
17
|
+
forwardRef,
|
|
18
|
+
textInputProps,
|
|
19
|
+
flagProps,
|
|
20
|
+
onSubmitEditing,
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
const [, t] = useLanguage();
|
|
25
|
+
const [{ configs }] = useConfig();
|
|
26
|
+
const phoneInput = useRef<PhoneInput>(null);
|
|
27
|
+
const [userphoneNumber, setUserphoneNumber] = useState('');
|
|
28
|
+
|
|
29
|
+
const handleChangeNumber = (number: any) => {
|
|
30
|
+
setUserphoneNumber(number);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if ((defaultValue && userphoneNumber) || !defaultValue) {
|
|
35
|
+
if (userphoneNumber === '') return;
|
|
36
|
+
if (userphoneNumber) {
|
|
37
|
+
const checkValid = phoneInput.current?.isValidNumber(userphoneNumber);
|
|
38
|
+
const callingCode = phoneInput.current?.getCallingCode();
|
|
39
|
+
const formattedNumber =
|
|
40
|
+
phoneInput.current?.getNumberAfterPossiblyEliminatingZero();
|
|
41
|
+
const regex = /^[0-9]*$/;
|
|
42
|
+
const cellphone =
|
|
43
|
+
userphoneNumber.slice(0, 0) +
|
|
44
|
+
userphoneNumber.slice(1, userphoneNumber.length);
|
|
45
|
+
const validNumber = regex.test(cellphone);
|
|
46
|
+
if ((!checkValid && formattedNumber?.number) || !validNumber) {
|
|
47
|
+
handleData &&
|
|
48
|
+
handleData({
|
|
49
|
+
...data,
|
|
50
|
+
error: t(
|
|
51
|
+
'INVALID_ERROR_PHONE_NUMBER',
|
|
52
|
+
'The Phone Number field is invalid',
|
|
53
|
+
),
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
handleData &&
|
|
58
|
+
handleData({
|
|
59
|
+
...data,
|
|
60
|
+
error: '',
|
|
61
|
+
phone: {
|
|
62
|
+
country_phone_code: callingCode,
|
|
63
|
+
cellphone: formattedNumber?.number,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
handleData &&
|
|
68
|
+
handleData({
|
|
69
|
+
...data,
|
|
70
|
+
error: '',
|
|
71
|
+
phone: {
|
|
72
|
+
country_phone_code: null,
|
|
73
|
+
cellphone: null,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, [userphoneNumber]);
|
|
79
|
+
|
|
80
|
+
const style = StyleSheet.create({
|
|
81
|
+
input: {
|
|
82
|
+
backgroundColor: theme.colors.white,
|
|
83
|
+
borderRadius: 7.6,
|
|
84
|
+
borderWidth: 1,
|
|
85
|
+
borderColor: theme.colors.inputSignup,
|
|
86
|
+
paddingVertical: 0,
|
|
87
|
+
paddingLeft: 35,
|
|
88
|
+
flexGrow: 2,
|
|
89
|
+
flex: 1,
|
|
90
|
+
height: 50,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Wrapper>
|
|
96
|
+
<PhoneInput
|
|
97
|
+
containerStyle={{ width: '100%' }}
|
|
98
|
+
ref={phoneInput}
|
|
99
|
+
defaultValue={userphoneNumber || defaultValue}
|
|
100
|
+
defaultCode={
|
|
101
|
+
defaultCode
|
|
102
|
+
? transformCountryCode(defaultCode)
|
|
103
|
+
: configs?.default_country_code?.value
|
|
104
|
+
}
|
|
105
|
+
onChangeFormattedText={(text: string) => handleChangeNumber(text)}
|
|
106
|
+
countryPickerProps={{
|
|
107
|
+
withAlphaFilter: false,
|
|
108
|
+
withFilter: false,
|
|
109
|
+
closeButtonImageStyle: { width: 15, height: 15 },
|
|
110
|
+
closeButtonImage: theme.images.general.close,
|
|
111
|
+
}}
|
|
112
|
+
textContainerStyle={style.input}
|
|
113
|
+
codeTextStyle={{ display: 'none' }}
|
|
114
|
+
placeholder={t('PHONE_NUMBER', 'Phone number')}
|
|
115
|
+
textInputProps={{
|
|
116
|
+
selectionColor: theme.colors.primary,
|
|
117
|
+
placeholderTextColor: theme.colors.arrowColor,
|
|
118
|
+
blurOnSubmit: true,
|
|
119
|
+
onSubmitEditing,
|
|
120
|
+
autoCompleteType: 'tel',
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
ref: forwardRef,
|
|
123
|
+
color: theme.colors.textGray,
|
|
124
|
+
...textInputProps,
|
|
125
|
+
}}
|
|
126
|
+
renderDropdownImage={
|
|
127
|
+
<OIcon
|
|
128
|
+
src={theme.images.general.chevronDown}
|
|
129
|
+
width={16}
|
|
130
|
+
height={16}
|
|
131
|
+
color={theme.colors.arrowColor}
|
|
132
|
+
/>
|
|
133
|
+
}
|
|
134
|
+
flagButtonStyle={flagProps}
|
|
135
|
+
/>
|
|
136
|
+
|
|
137
|
+
{!!data?.error && (
|
|
138
|
+
<OText
|
|
139
|
+
size={16}
|
|
140
|
+
color={theme.colors.error}
|
|
141
|
+
style={{ textAlign: 'center', marginTop: 5 }}>
|
|
142
|
+
{data.error}
|
|
143
|
+
</OText>
|
|
144
|
+
)}
|
|
145
|
+
|
|
146
|
+
<View
|
|
147
|
+
style={{
|
|
148
|
+
position: 'absolute',
|
|
149
|
+
top: 15,
|
|
150
|
+
left: 99,
|
|
151
|
+
}}>
|
|
152
|
+
<OIcon
|
|
153
|
+
src={theme?.images?.general?.inputPhone}
|
|
154
|
+
width={20}
|
|
155
|
+
height={20}
|
|
156
|
+
/>
|
|
157
|
+
</View>
|
|
158
|
+
</Wrapper>
|
|
159
|
+
);
|
|
160
|
+
};
|