ordering-ui-react-native 0.16.34 → 0.16.35
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/themes/business/index.tsx +4 -0
- package/themes/business/src/components/DriverSchedule/index.tsx +54 -0
- package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
- package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
- package/themes/business/src/components/UserProfileForm/index.tsx +26 -4
- package/themes/business/src/components/shared/OModal.tsx +40 -37
package/package.json
CHANGED
|
@@ -39,6 +39,8 @@ import { VerifyPhone } from './src/components/VerifyPhone';
|
|
|
39
39
|
import { DriverMap } from './src/components/DriverMap';
|
|
40
40
|
import { MapViewUI as MapView } from './src/components/MapView'
|
|
41
41
|
import { NewOrderNotification } from './src/components/NewOrderNotification';
|
|
42
|
+
import { DriverSchedule } from './src/components/DriverSchedule';
|
|
43
|
+
import { ScheduleBlocked } from './src/components/ScheduleBlocked';
|
|
42
44
|
//OComponents
|
|
43
45
|
import {
|
|
44
46
|
OText,
|
|
@@ -106,6 +108,8 @@ export {
|
|
|
106
108
|
UserFormDetailsUI,
|
|
107
109
|
UserProfileForm,
|
|
108
110
|
VerifyPhone,
|
|
111
|
+
DriverSchedule,
|
|
112
|
+
ScheduleBlocked,
|
|
109
113
|
//OComponents
|
|
110
114
|
OAlert,
|
|
111
115
|
OButton,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View } from 'react-native'
|
|
3
|
+
import { OText } from '../shared'
|
|
4
|
+
import { useLanguage } from 'ordering-components/native'
|
|
5
|
+
import { DayContainer } from './styles'
|
|
6
|
+
import { useTheme } from 'styled-components/native'
|
|
7
|
+
export const DriverSchedule = (props : any) => {
|
|
8
|
+
const { schedule } = props
|
|
9
|
+
const [, t] = useLanguage()
|
|
10
|
+
const theme = useTheme()
|
|
11
|
+
|
|
12
|
+
const daysOfWeek = [
|
|
13
|
+
t('SUNDAY_ABBREVIATION', 'Sun'),
|
|
14
|
+
t('MONDAY_ABBREVIATION', 'Mon'),
|
|
15
|
+
t('TUESDAY_ABBREVIATION', 'Tues'),
|
|
16
|
+
t('WEDNESDAY_ABBREVIATION', 'Wed'),
|
|
17
|
+
t('THURSDAY_ABBREVIATION', 'Thur'),
|
|
18
|
+
t('FRIDAY_ABBREVIATION', 'Fri'),
|
|
19
|
+
t('SATURDAY_ABBREVIATION', 'Sat')
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
const scheduleFormatted = ({ hour, minute }: any) => {
|
|
23
|
+
const checkTime = (val: number) => val < 10 ? `0${val}` : val
|
|
24
|
+
return `${checkTime(hour)}:${checkTime(minute)}`
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<View >
|
|
29
|
+
<OText size={24} style={{paddingLeft: 30}}>
|
|
30
|
+
{t('SCHEDULE', 'Schedule')}
|
|
31
|
+
</OText>
|
|
32
|
+
<View style={{padding: 30}}>
|
|
33
|
+
{schedule.map((item: any, i: number) => (
|
|
34
|
+
<DayContainer key={daysOfWeek[i]}>
|
|
35
|
+
<OText style={{width: '20%'}} size={22} weight={700}>{daysOfWeek[i]}</OText>
|
|
36
|
+
<View style={{width: '80%', alignItems: 'center'}}>
|
|
37
|
+
<>
|
|
38
|
+
{item?.enabled ? (
|
|
39
|
+
<>
|
|
40
|
+
{item?.lapses.map((lapse: any, i: number) => (
|
|
41
|
+
<OText size={18} style={{marginTop: 3, marginBottom: 20}} key={`${daysOfWeek[i]}_${i}`}>{scheduleFormatted(lapse.open)} - {scheduleFormatted(lapse.close)}</OText>
|
|
42
|
+
))}
|
|
43
|
+
</>
|
|
44
|
+
) : (
|
|
45
|
+
<OText size={18} style={{marginTop: 3, marginBottom: 10}} color={theme.colors.red}>{t('NOT_AVAILABLE', 'Not available')}</OText>
|
|
46
|
+
)}
|
|
47
|
+
</>
|
|
48
|
+
</View>
|
|
49
|
+
</DayContainer>
|
|
50
|
+
))}
|
|
51
|
+
</View>
|
|
52
|
+
</View>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Dimensions, View } from 'react-native'
|
|
3
|
+
import { OButton, OIcon, OText } from '../shared'
|
|
4
|
+
import { useLanguage, useSession } from 'ordering-components/native'
|
|
5
|
+
import { useTheme } from 'styled-components/native'
|
|
6
|
+
|
|
7
|
+
export const ScheduleBlocked = (props : any) => {
|
|
8
|
+
const { nextSchedule } = props
|
|
9
|
+
const [, t] = useLanguage()
|
|
10
|
+
const [, {logout}] = useSession()
|
|
11
|
+
const theme = useTheme()
|
|
12
|
+
const deviceWidth = Dimensions.get('screen').width
|
|
13
|
+
|
|
14
|
+
const daysOfWeek = [
|
|
15
|
+
t('MONDAY', 'Monday'),
|
|
16
|
+
t('TUESDAY', 'Tuesday'),
|
|
17
|
+
t('WEDNESDAY', 'Wednesday'),
|
|
18
|
+
t('THURSDAY', 'Thurday'),
|
|
19
|
+
t('FRIDAY', 'Friday'),
|
|
20
|
+
t('SATURDAY', 'Saturday'),
|
|
21
|
+
t('SUNDAY', 'Sunday')
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
const scheduleFormatted = ({ hour, minute }: any) => {
|
|
25
|
+
const checkTime = (val: number) => val < 10 ? `0${val}` : val
|
|
26
|
+
return `${checkTime(hour)}:${checkTime(minute)}`
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const goBack = () => {
|
|
30
|
+
logout()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<View style={{ alignItems: 'center', padding: 40 }}>
|
|
35
|
+
<OText size={20}>{t('YOU_CANT_LOGIN', 'You can\'t login')}</OText>
|
|
36
|
+
<OIcon
|
|
37
|
+
src={theme.images?.general?.deliveryWaiting}
|
|
38
|
+
width={(deviceWidth - 80) * 0.9}
|
|
39
|
+
height={(deviceWidth - 80) * 0.8}
|
|
40
|
+
/>
|
|
41
|
+
<OText>{t('OUTSIDE_ESTABLISHED_SCHEDULE', 'You are outside the established schedule')}</OText>
|
|
42
|
+
<View style={{ flexDirection: 'row', marginBottom: 20 }}>
|
|
43
|
+
<OText color={theme.colors.primary}>{t('NEXT_TIME', 'Next time')}: </OText>
|
|
44
|
+
<OText>{daysOfWeek[nextSchedule?.day - 1]} {scheduleFormatted(nextSchedule?.schedule?.open)}</OText>
|
|
45
|
+
</View>
|
|
46
|
+
<OButton
|
|
47
|
+
text={t('GO_BACK', 'Go back')}
|
|
48
|
+
textStyle={{ color: theme.colors.white }}
|
|
49
|
+
onClick={goBack}
|
|
50
|
+
/>
|
|
51
|
+
</View>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { View, StyleSheet, ScrollView, ActivityIndicator } from 'react-native';
|
|
2
|
+
import { View, StyleSheet, ScrollView, ActivityIndicator, Pressable } from 'react-native';
|
|
3
3
|
import { useForm } from 'react-hook-form';
|
|
4
4
|
import { launchImageLibrary } from 'react-native-image-picker';
|
|
5
5
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import { LogoutButton } from '../LogoutButton';
|
|
23
23
|
import { LanguageSelector } from '../LanguageSelector';
|
|
24
24
|
import { UserFormDetailsUI } from '../UserFormDetails';
|
|
25
|
+
import { DriverSchedule } from '../DriverSchedule'
|
|
25
26
|
import ToggleSwitch from 'toggle-switch-react-native';
|
|
26
27
|
import { UDWrapper } from '../UserFormDetails/styles';
|
|
27
28
|
import {
|
|
@@ -30,11 +31,12 @@ import {
|
|
|
30
31
|
OText,
|
|
31
32
|
OButton,
|
|
32
33
|
OInput,
|
|
34
|
+
OModal,
|
|
33
35
|
} from '../../components/shared';
|
|
34
36
|
import { sortInputFields, getTraduction } from '../../utils';
|
|
35
37
|
import { ProfileParams } from '../../types';
|
|
36
38
|
import { NotFoundSource } from '../NotFoundSource';
|
|
37
|
-
|
|
39
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
38
40
|
const ProfileUI = (props: ProfileParams) => {
|
|
39
41
|
const {
|
|
40
42
|
navigation,
|
|
@@ -66,6 +68,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
66
68
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
67
69
|
const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
|
|
68
70
|
const [phoneToShow, setPhoneToShow] = useState('');
|
|
71
|
+
const [openModal, setOpenModal] = useState(false)
|
|
69
72
|
|
|
70
73
|
useEffect(() => {
|
|
71
74
|
if (phoneInputData.phone.cellphone) {
|
|
@@ -459,7 +462,6 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
459
462
|
/>
|
|
460
463
|
</View>
|
|
461
464
|
)}
|
|
462
|
-
|
|
463
465
|
{!validationFields.loading && !isEdit && (
|
|
464
466
|
<EditButton>
|
|
465
467
|
<OButton
|
|
@@ -474,12 +476,32 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
474
476
|
/>
|
|
475
477
|
</EditButton>
|
|
476
478
|
)}
|
|
477
|
-
|
|
479
|
+
{!!user?.schedule && (
|
|
480
|
+
<Pressable style={{ marginBottom: 10 }} onPress={() => setOpenModal(true)}>
|
|
481
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
482
|
+
<OText size={16}>{t('SCHEDULE', 'Schedule')}</OText>
|
|
483
|
+
<AntDesignIcon size={18} name='right' />
|
|
484
|
+
</View>
|
|
485
|
+
<View style={{
|
|
486
|
+
borderBottomColor: theme.colors.tabBar,
|
|
487
|
+
borderBottomWidth: 1,
|
|
488
|
+
marginTop: 10
|
|
489
|
+
}} />
|
|
490
|
+
</Pressable>
|
|
491
|
+
)}
|
|
478
492
|
<Actions>
|
|
479
493
|
<LanguageSelector />
|
|
480
494
|
|
|
481
495
|
<LogoutButton />
|
|
482
496
|
</Actions>
|
|
497
|
+
<OModal
|
|
498
|
+
open={openModal}
|
|
499
|
+
onClose={() => setOpenModal(false)}
|
|
500
|
+
entireModal
|
|
501
|
+
hideIcons
|
|
502
|
+
>
|
|
503
|
+
<DriverSchedule schedule={user?.schedule} />
|
|
504
|
+
</OModal>
|
|
483
505
|
</ScrollView>
|
|
484
506
|
)}
|
|
485
507
|
</>
|
|
@@ -26,6 +26,7 @@ interface Props {
|
|
|
26
26
|
isNotDecoration?: boolean;
|
|
27
27
|
styleCloseButton?: any;
|
|
28
28
|
order?: any;
|
|
29
|
+
hideIcons?: boolean
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
const OModal = (props: Props): React.ReactElement => {
|
|
@@ -47,6 +48,7 @@ const OModal = (props: Props): React.ReactElement => {
|
|
|
47
48
|
style,
|
|
48
49
|
styleCloseButton,
|
|
49
50
|
order,
|
|
51
|
+
hideIcons
|
|
50
52
|
} = props;
|
|
51
53
|
|
|
52
54
|
const theme = useTheme();
|
|
@@ -70,8 +72,8 @@ const OModal = (props: Props): React.ReactElement => {
|
|
|
70
72
|
alignItems: 'center',
|
|
71
73
|
paddingHorizontal: 30,
|
|
72
74
|
paddingTop: 30,
|
|
73
|
-
paddingBottom: 25,
|
|
74
|
-
borderBottomWidth: 2,
|
|
75
|
+
paddingBottom: !hideIcons ? 25 : 15,
|
|
76
|
+
borderBottomWidth: !hideIcons ? 2 : 0,
|
|
75
77
|
borderBottomColor: '#e6e6e6',
|
|
76
78
|
},
|
|
77
79
|
titleGroups: {
|
|
@@ -218,50 +220,51 @@ const OModal = (props: Props): React.ReactElement => {
|
|
|
218
220
|
{title}
|
|
219
221
|
</OText>
|
|
220
222
|
</View>
|
|
223
|
+
{!hideIcons && (
|
|
224
|
+
<View style={styles.titleGroups}>
|
|
225
|
+
<View style={styles.shadow}>
|
|
226
|
+
{order?.business?.logo ? (
|
|
227
|
+
<OIcon
|
|
228
|
+
url={optimizeImage(
|
|
229
|
+
order?.business?.logo,
|
|
230
|
+
'h_300,c_limit',
|
|
231
|
+
)}
|
|
232
|
+
style={styles.titleIcons}
|
|
233
|
+
/>
|
|
234
|
+
) : (
|
|
235
|
+
<OIcon
|
|
236
|
+
src={theme.images.dummies.businessLogo}
|
|
237
|
+
style={styles.titleIcons}
|
|
238
|
+
/>
|
|
239
|
+
)}
|
|
240
|
+
</View>
|
|
221
241
|
|
|
222
|
-
|
|
223
|
-
<View style={styles.shadow}>
|
|
224
|
-
{order?.business?.logo ? (
|
|
242
|
+
<View style={styles.shadow}>
|
|
225
243
|
<OIcon
|
|
226
244
|
url={optimizeImage(
|
|
227
|
-
order?.
|
|
245
|
+
order?.customer?.photo ||
|
|
246
|
+
theme?.images?.dummies?.customerPhoto,
|
|
228
247
|
'h_300,c_limit',
|
|
229
248
|
)}
|
|
230
249
|
style={styles.titleIcons}
|
|
231
250
|
/>
|
|
232
|
-
|
|
233
|
-
<OIcon
|
|
234
|
-
src={theme.images.dummies.businessLogo}
|
|
235
|
-
style={styles.titleIcons}
|
|
236
|
-
/>
|
|
237
|
-
)}
|
|
238
|
-
</View>
|
|
251
|
+
</View>
|
|
239
252
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
253
|
+
{order?.driver && (
|
|
254
|
+
<View style={styles.shadow}>
|
|
255
|
+
<OIcon
|
|
256
|
+
url={
|
|
257
|
+
optimizeImage(
|
|
258
|
+
order?.driver?.photo,
|
|
259
|
+
'h_300,c_limit',
|
|
260
|
+
) || theme?.images?.dummies?.driverPhoto
|
|
261
|
+
}
|
|
262
|
+
style={styles.titleIcons}
|
|
263
|
+
/>
|
|
264
|
+
</View>
|
|
265
|
+
)}
|
|
249
266
|
</View>
|
|
250
|
-
|
|
251
|
-
{order?.driver && (
|
|
252
|
-
<View style={styles.shadow}>
|
|
253
|
-
<OIcon
|
|
254
|
-
url={
|
|
255
|
-
optimizeImage(
|
|
256
|
-
order?.driver?.photo,
|
|
257
|
-
'h_300,c_limit',
|
|
258
|
-
) || theme?.images?.dummies?.driverPhoto
|
|
259
|
-
}
|
|
260
|
-
style={styles.titleIcons}
|
|
261
|
-
/>
|
|
262
|
-
</View>
|
|
263
|
-
)}
|
|
264
|
-
</View>
|
|
267
|
+
)}
|
|
265
268
|
</View>
|
|
266
269
|
)}
|
|
267
270
|
{children}
|