ordering-ui-react-native 0.12.18 → 0.12.19
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/config.json +2 -2
- package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +0 -389
- package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +0 -36
- package/themes/business/src/components 2/BusinessController/index.tsx +0 -155
- package/themes/business/src/components 2/BusinessController/styles.tsx +0 -19
- package/themes/business/src/components 2/Chat/index.tsx +0 -1152
- package/themes/business/src/components 2/Chat/styles.tsx +0 -12
- package/themes/business/src/components 2/Contacts/index.tsx +0 -299
- package/themes/business/src/components 2/Contacts/styles.tsx +0 -42
- package/themes/business/src/components 2/DriverMap/index.tsx +0 -525
- package/themes/business/src/components 2/FloatingButton/index.tsx +0 -141
- package/themes/business/src/components 2/FloatingButton/styles.tsx +0 -35
- package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +0 -204
- package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +0 -11
- package/themes/business/src/components 2/GoogleMap/index.tsx +0 -347
- package/themes/business/src/components 2/Home/index.tsx +0 -111
- package/themes/business/src/components 2/Home/styles.tsx +0 -27
- package/themes/business/src/components 2/LanguageSelector/index.tsx +0 -124
- package/themes/business/src/components 2/LanguageSelector/lang_country.json +0 -152
- package/themes/business/src/components 2/LanguageSelector/styles.tsx +0 -17
- package/themes/business/src/components 2/LoginForm/index.tsx +0 -663
- package/themes/business/src/components 2/LoginForm/styles.tsx +0 -48
- package/themes/business/src/components 2/LogoutButton/index.tsx +0 -63
- package/themes/business/src/components 2/MapView/index.tsx +0 -317
- package/themes/business/src/components 2/MessagesOption/index.tsx +0 -337
- package/themes/business/src/components 2/MessagesOption/styles.tsx +0 -27
- package/themes/business/src/components 2/NewOrderNotification/index.tsx +0 -167
- package/themes/business/src/components 2/NewOrderNotification/styles.tsx +0 -8
- package/themes/business/src/components 2/NotFoundSource/index.tsx +0 -52
- package/themes/business/src/components 2/NotFoundSource/styles.tsx +0 -17
- package/themes/business/src/components 2/OrderDetails/Business.tsx +0 -683
- package/themes/business/src/components 2/OrderDetails/Delivery.tsx +0 -454
- package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +0 -391
- package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +0 -148
- package/themes/business/src/components 2/OrderDetails/styles.tsx +0 -84
- package/themes/business/src/components 2/OrderMessage/index.tsx +0 -344
- package/themes/business/src/components 2/OrderMessage/styles.tsx +0 -5
- package/themes/business/src/components 2/OrderSummary/index.tsx +0 -700
- package/themes/business/src/components 2/OrderSummary/styles.tsx +0 -61
- package/themes/business/src/components 2/OrdersOption/index.tsx +0 -755
- package/themes/business/src/components 2/OrdersOption/styles.tsx +0 -54
- package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +0 -51
- package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionCity/index.tsx +0 -52
- package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDate/index.tsx +0 -52
- package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +0 -35
- package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +0 -50
- package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +0 -49
- package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +0 -46
- package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +0 -8
- package/themes/business/src/components 2/PhoneInputNumber/index.tsx +0 -160
- package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +0 -3
- package/themes/business/src/components 2/PreviousMessages/index.tsx +0 -304
- package/themes/business/src/components 2/PreviousMessages/styles.tsx +0 -32
- package/themes/business/src/components 2/PreviousOrders/index.tsx +0 -180
- package/themes/business/src/components 2/PreviousOrders/styles.tsx +0 -38
- package/themes/business/src/components 2/ProductItemAccordion/index.tsx +0 -301
- package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +0 -61
- package/themes/business/src/components 2/SearchBar/index.tsx +0 -112
- package/themes/business/src/components 2/SignupForm/index.tsx +0 -530
- package/themes/business/src/components 2/SignupForm/styles.tsx +0 -16
- package/themes/business/src/components 2/StoresList/index.tsx +0 -208
- package/themes/business/src/components 2/StoresList/styles.tsx +0 -26
- package/themes/business/src/components 2/UserFormDetails/index.tsx +0 -513
- package/themes/business/src/components 2/UserFormDetails/styles.tsx +0 -40
- package/themes/business/src/components 2/UserProfileForm/index.tsx +0 -496
- package/themes/business/src/components 2/UserProfileForm/styles.tsx +0 -36
- package/themes/business/src/components 2/VerifyPhone/index.tsx +0 -201
- package/themes/business/src/components 2/VerifyPhone/styles.tsx +0 -43
- package/themes/business/src/components 2/shared/OAlert.tsx +0 -52
- package/themes/business/src/components 2/shared/OButton.tsx +0 -149
- package/themes/business/src/components 2/shared/OChatBubble.tsx +0 -100
- package/themes/business/src/components 2/shared/ODropDown.tsx +0 -195
- package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +0 -328
- package/themes/business/src/components 2/shared/OFab.tsx +0 -54
- package/themes/business/src/components 2/shared/OIcon.tsx +0 -67
- package/themes/business/src/components 2/shared/OIconButton.tsx +0 -127
- package/themes/business/src/components 2/shared/OInput.tsx +0 -144
- package/themes/business/src/components 2/shared/OLink.tsx +0 -76
- package/themes/business/src/components 2/shared/OModal.tsx +0 -275
- package/themes/business/src/components 2/shared/OSegment.tsx +0 -86
- package/themes/business/src/components 2/shared/OText.tsx +0 -55
- package/themes/business/src/components 2/shared/OTextarea.tsx +0 -46
- package/themes/business/src/components 2/shared/OToast.tsx +0 -92
- package/themes/business/src/components 2/shared/index.tsx +0 -27
|
@@ -1,496 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { View, StyleSheet, ScrollView, ActivityIndicator } from 'react-native';
|
|
3
|
-
import { useForm } from 'react-hook-form';
|
|
4
|
-
import { launchImageLibrary } from 'react-native-image-picker';
|
|
5
|
-
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
6
|
-
import { useTheme } from 'styled-components/native';
|
|
7
|
-
import {
|
|
8
|
-
UserFormDetails as UserProfileController,
|
|
9
|
-
useSession,
|
|
10
|
-
ToastType,
|
|
11
|
-
useToast,
|
|
12
|
-
useLanguage,
|
|
13
|
-
useUtils,
|
|
14
|
-
} from 'ordering-components/native';
|
|
15
|
-
import {
|
|
16
|
-
CenterView,
|
|
17
|
-
Actions,
|
|
18
|
-
UserData,
|
|
19
|
-
EditButton,
|
|
20
|
-
EnabledStatusDriver,
|
|
21
|
-
} from './styles';
|
|
22
|
-
import { LogoutButton } from '../LogoutButton';
|
|
23
|
-
import { LanguageSelector } from '../LanguageSelector';
|
|
24
|
-
import { UserFormDetailsUI } from '../UserFormDetails';
|
|
25
|
-
import ToggleSwitch from 'toggle-switch-react-native';
|
|
26
|
-
import { UDWrapper } from '../UserFormDetails/styles';
|
|
27
|
-
import {
|
|
28
|
-
OIcon,
|
|
29
|
-
OIconButton,
|
|
30
|
-
OText,
|
|
31
|
-
OButton,
|
|
32
|
-
OInput,
|
|
33
|
-
} from '../../components/shared';
|
|
34
|
-
import { sortInputFields, getTraduction } from '../../utils';
|
|
35
|
-
import { ProfileParams } from '../../types';
|
|
36
|
-
import { NotFoundSource } from '../NotFoundSource';
|
|
37
|
-
|
|
38
|
-
const ProfileUI = (props: ProfileParams) => {
|
|
39
|
-
const {
|
|
40
|
-
navigation,
|
|
41
|
-
formState,
|
|
42
|
-
isEdit,
|
|
43
|
-
validationFields,
|
|
44
|
-
handleButtonUpdateClick,
|
|
45
|
-
toggleIsEdit,
|
|
46
|
-
cleanFormState,
|
|
47
|
-
handleToggleAvalaibleStatusDriver,
|
|
48
|
-
userState,
|
|
49
|
-
isAvailableLoading,
|
|
50
|
-
} = props;
|
|
51
|
-
|
|
52
|
-
const [{ user }] = useSession();
|
|
53
|
-
const [state, t] = useLanguage();
|
|
54
|
-
const [, { showToast }] = useToast();
|
|
55
|
-
const [{ optimizeImage }] = useUtils();
|
|
56
|
-
const { errors } = useForm();
|
|
57
|
-
const theme = useTheme();
|
|
58
|
-
|
|
59
|
-
const [phoneInputData, setPhoneInputData] = useState({
|
|
60
|
-
error: '',
|
|
61
|
-
phone: {
|
|
62
|
-
country_phone_code: null,
|
|
63
|
-
cellphone: null,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
67
|
-
const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
|
|
68
|
-
const [phoneToShow, setPhoneToShow] = useState('');
|
|
69
|
-
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
if (phoneInputData.phone.cellphone) {
|
|
72
|
-
const codeNumberPhone = phoneInputData.phone.cellphone.slice(0, 3);
|
|
73
|
-
const numberPhone = phoneInputData.phone.cellphone.slice(
|
|
74
|
-
3,
|
|
75
|
-
phoneInputData.phone.cellphone?.length,
|
|
76
|
-
);
|
|
77
|
-
setPhoneToShow(`(${codeNumberPhone}) ${numberPhone}`);
|
|
78
|
-
}
|
|
79
|
-
}, [phoneInputData.phone.cellphone]);
|
|
80
|
-
|
|
81
|
-
const setUserCellPhone = (isEdit = false) => {
|
|
82
|
-
if (userPhoneNumber && !userPhoneNumber.includes('null') && !isEdit) {
|
|
83
|
-
setUserPhoneNumber(userPhoneNumber);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (user?.cellphone) {
|
|
87
|
-
let phone = null;
|
|
88
|
-
if (user?.country_phone_code) {
|
|
89
|
-
phone = `+${user?.country_phone_code} ${user?.cellphone}`;
|
|
90
|
-
} else {
|
|
91
|
-
phone = user?.cellphone;
|
|
92
|
-
}
|
|
93
|
-
setUserPhoneNumber(phone);
|
|
94
|
-
setPhoneInputData({
|
|
95
|
-
...phoneInputData,
|
|
96
|
-
phone: {
|
|
97
|
-
country_phone_code: user?.country_phone_code || null,
|
|
98
|
-
cellphone: user?.cellphone || null,
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
setUserPhoneNumber(user?.cellphone || '');
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const handleImagePicker = () => {
|
|
107
|
-
launchImageLibrary(
|
|
108
|
-
{
|
|
109
|
-
mediaType: 'photo',
|
|
110
|
-
maxHeight: 200,
|
|
111
|
-
maxWidth: 200,
|
|
112
|
-
includeBase64: true,
|
|
113
|
-
},
|
|
114
|
-
(response: any) => {
|
|
115
|
-
if (response.didCancel) {
|
|
116
|
-
console.log('User cancelled image picker');
|
|
117
|
-
} else if (response.errorMessage) {
|
|
118
|
-
console.log('ImagePicker Error: ', response.errorMessage);
|
|
119
|
-
showToast(ToastType.Error, response.errorMessage);
|
|
120
|
-
} else {
|
|
121
|
-
if (response.uri) {
|
|
122
|
-
const url = `data:${response.type};base64,${response.base64}`;
|
|
123
|
-
handleButtonUpdateClick(null, true, url);
|
|
124
|
-
} else {
|
|
125
|
-
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
);
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const handleCancelEdit = () => {
|
|
133
|
-
cleanFormState({ changes: {} });
|
|
134
|
-
toggleIsEdit();
|
|
135
|
-
setPhoneInputData({
|
|
136
|
-
error: '',
|
|
137
|
-
phone: {
|
|
138
|
-
country_phone_code: null,
|
|
139
|
-
cellphone: null,
|
|
140
|
-
},
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
useEffect(() => {
|
|
145
|
-
const isLoadingDriver = userState?.loadingDriver ?? true;
|
|
146
|
-
|
|
147
|
-
if (userState?.result?.result && !isLoadingDriver) {
|
|
148
|
-
if (userState?.result?.error) {
|
|
149
|
-
const messageError =
|
|
150
|
-
userState.result.error || userState.result.error[0];
|
|
151
|
-
showToast(ToastType.Error, getTraduction(messageError, t));
|
|
152
|
-
} else {
|
|
153
|
-
showToast(
|
|
154
|
-
ToastType.Success,
|
|
155
|
-
t('AVAILABLE_STATE_IS_UPDATED', 'Available state is updated'),
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}, [userState?.loadingDriver]);
|
|
160
|
-
|
|
161
|
-
useEffect(() => {
|
|
162
|
-
if ((user || !isEdit) && !formState?.loading) {
|
|
163
|
-
setUserCellPhone();
|
|
164
|
-
if (!isEdit && !formState?.loading) {
|
|
165
|
-
cleanFormState && cleanFormState({ changes: {} });
|
|
166
|
-
setUserCellPhone(true);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}, [user, isEdit]);
|
|
170
|
-
|
|
171
|
-
useEffect(() => {
|
|
172
|
-
if (formState.result.result && !formState.loading) {
|
|
173
|
-
if (formState.result?.error) {
|
|
174
|
-
showToast(ToastType.Error, formState.result.result);
|
|
175
|
-
} else {
|
|
176
|
-
showToast(
|
|
177
|
-
ToastType.Success,
|
|
178
|
-
t('UPDATE_SUCCESSFULLY', 'Update successfully'),
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}, [formState.result]);
|
|
183
|
-
|
|
184
|
-
useEffect(() => {
|
|
185
|
-
if (Object.keys(errors).length > 0) {
|
|
186
|
-
// Convert all errors in one string to show in toast provider
|
|
187
|
-
const list = Object.values(errors);
|
|
188
|
-
let stringError = '';
|
|
189
|
-
list.map((item: any, i: number) => {
|
|
190
|
-
stringError +=
|
|
191
|
-
i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
|
|
192
|
-
});
|
|
193
|
-
showToast(ToastType.Error, stringError);
|
|
194
|
-
}
|
|
195
|
-
}, [errors]);
|
|
196
|
-
|
|
197
|
-
useEffect(() => {
|
|
198
|
-
if (user?.cellphone && !user?.country_phone_code) {
|
|
199
|
-
setPhoneUpdate(true);
|
|
200
|
-
} else {
|
|
201
|
-
setPhoneUpdate(false);
|
|
202
|
-
}
|
|
203
|
-
}, [user?.country_phone_code]);
|
|
204
|
-
|
|
205
|
-
const styles = StyleSheet.create({
|
|
206
|
-
label: {
|
|
207
|
-
color: theme.colors.textGray,
|
|
208
|
-
fontFamily: 'Poppins',
|
|
209
|
-
fontStyle: 'normal',
|
|
210
|
-
fontWeight: '600',
|
|
211
|
-
},
|
|
212
|
-
inputStyle: {
|
|
213
|
-
marginBottom: 25,
|
|
214
|
-
borderWidth: 1,
|
|
215
|
-
borderColor: theme.colors.tabBar,
|
|
216
|
-
borderTopWidth: 0,
|
|
217
|
-
borderRightWidth: 0,
|
|
218
|
-
borderLeftWidth: 0,
|
|
219
|
-
paddingHorizontal: 0,
|
|
220
|
-
borderRadius: 0,
|
|
221
|
-
},
|
|
222
|
-
editButton: {
|
|
223
|
-
height: 44,
|
|
224
|
-
borderRadius: 7.6,
|
|
225
|
-
borderWidth: 1,
|
|
226
|
-
borderColor: theme.colors.primary,
|
|
227
|
-
backgroundColor: theme.colors.white,
|
|
228
|
-
marginBottom: 25,
|
|
229
|
-
},
|
|
230
|
-
btnText: {
|
|
231
|
-
color: theme.colors.textGray,
|
|
232
|
-
fontFamily: 'Poppins',
|
|
233
|
-
fontStyle: 'normal',
|
|
234
|
-
fontWeight: 'normal',
|
|
235
|
-
fontSize: 18,
|
|
236
|
-
},
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
return (
|
|
240
|
-
<>
|
|
241
|
-
{validationFields?.error && (
|
|
242
|
-
<NotFoundSource
|
|
243
|
-
content={
|
|
244
|
-
validationFields?.error[0] ||
|
|
245
|
-
validationFields?.error[0]?.message ||
|
|
246
|
-
t('NETWORK_ERROR', 'Network Error')
|
|
247
|
-
}
|
|
248
|
-
image={theme.images.general.notFound}
|
|
249
|
-
conditioned={false}
|
|
250
|
-
/>
|
|
251
|
-
)}
|
|
252
|
-
|
|
253
|
-
{(formState?.loading || state?.loading) && !validationFields.error && (
|
|
254
|
-
<View
|
|
255
|
-
style={{
|
|
256
|
-
backgroundColor: theme.colors.backgroundLight,
|
|
257
|
-
}}>
|
|
258
|
-
<Placeholder Animation={Fade}>
|
|
259
|
-
<PlaceholderLine
|
|
260
|
-
width={20}
|
|
261
|
-
style={{
|
|
262
|
-
alignSelf: 'center',
|
|
263
|
-
borderRadius: 20,
|
|
264
|
-
width: 120,
|
|
265
|
-
height: 120,
|
|
266
|
-
}}
|
|
267
|
-
/>
|
|
268
|
-
|
|
269
|
-
<PlaceholderLine
|
|
270
|
-
width={20}
|
|
271
|
-
style={{
|
|
272
|
-
alignSelf: 'center',
|
|
273
|
-
borderRadius: 20,
|
|
274
|
-
width: 20,
|
|
275
|
-
height: 20,
|
|
276
|
-
}}
|
|
277
|
-
/>
|
|
278
|
-
</Placeholder>
|
|
279
|
-
|
|
280
|
-
{[...Array(8)].map((item, i) => (
|
|
281
|
-
<Placeholder key={i} Animation={Fade}>
|
|
282
|
-
<View style={{ flexDirection: 'row' }}>
|
|
283
|
-
<Placeholder>
|
|
284
|
-
<PlaceholderLine width={40} style={{ marginTop: 30 }} />
|
|
285
|
-
|
|
286
|
-
<PlaceholderLine width={100} />
|
|
287
|
-
</Placeholder>
|
|
288
|
-
</View>
|
|
289
|
-
</Placeholder>
|
|
290
|
-
))}
|
|
291
|
-
|
|
292
|
-
<Placeholder Animation={Fade}>
|
|
293
|
-
<PlaceholderLine
|
|
294
|
-
width={30}
|
|
295
|
-
style={{
|
|
296
|
-
marginTop: 20,
|
|
297
|
-
alignSelf: 'center',
|
|
298
|
-
height: 44,
|
|
299
|
-
borderRadius: 7.6,
|
|
300
|
-
}}
|
|
301
|
-
/>
|
|
302
|
-
|
|
303
|
-
<PlaceholderLine
|
|
304
|
-
width={100}
|
|
305
|
-
style={{
|
|
306
|
-
marginTop: 20,
|
|
307
|
-
height: 33,
|
|
308
|
-
borderRadius: 7.6,
|
|
309
|
-
}}
|
|
310
|
-
/>
|
|
311
|
-
|
|
312
|
-
<PlaceholderLine
|
|
313
|
-
width={40}
|
|
314
|
-
style={{
|
|
315
|
-
marginTop: 5,
|
|
316
|
-
height: 15,
|
|
317
|
-
borderRadius: 7.6,
|
|
318
|
-
}}
|
|
319
|
-
/>
|
|
320
|
-
</Placeholder>
|
|
321
|
-
</View>
|
|
322
|
-
)}
|
|
323
|
-
|
|
324
|
-
{!formState?.loading && !state?.loading && !validationFields.error && (
|
|
325
|
-
<ScrollView showsVerticalScrollIndicator={false} style={{ flex: 1 }}>
|
|
326
|
-
<CenterView>
|
|
327
|
-
<OIcon
|
|
328
|
-
url={optimizeImage(user?.photo, 'h_300,c_limit')}
|
|
329
|
-
src={!user?.photo && theme.images.general.user}
|
|
330
|
-
width={150}
|
|
331
|
-
height={150}
|
|
332
|
-
style={{ borderRadius: 7.2 }}
|
|
333
|
-
/>
|
|
334
|
-
|
|
335
|
-
<OIconButton
|
|
336
|
-
icon={theme.images.general.camera}
|
|
337
|
-
borderColor={theme.colors.clear}
|
|
338
|
-
iconStyle={{ width: 21, height: 21 }}
|
|
339
|
-
style={{ maxWidth: 40 }}
|
|
340
|
-
onClick={() => handleImagePicker()}
|
|
341
|
-
/>
|
|
342
|
-
</CenterView>
|
|
343
|
-
|
|
344
|
-
{user?.level === 4 && (
|
|
345
|
-
<EnabledStatusDriver>
|
|
346
|
-
<View style={{ flex: 1 }}>
|
|
347
|
-
<OText
|
|
348
|
-
numberOfLines={2}
|
|
349
|
-
adjustsFontSizeToFit
|
|
350
|
-
style={{ ...styles.label, paddingHorizontal: 0 }}>
|
|
351
|
-
{t(
|
|
352
|
-
'AVAILABLE_TO_RECEIVE_ORDERS',
|
|
353
|
-
'Available to receive orders',
|
|
354
|
-
)}
|
|
355
|
-
</OText>
|
|
356
|
-
</View>
|
|
357
|
-
|
|
358
|
-
{userState.loadingDriver ? (
|
|
359
|
-
<ActivityIndicator size="small" color={theme.colors.primary} />
|
|
360
|
-
) : (
|
|
361
|
-
<ToggleSwitch
|
|
362
|
-
isOn={userState?.result?.result?.available}
|
|
363
|
-
onColor={theme.colors.primary}
|
|
364
|
-
offColor={theme.colors.offColor}
|
|
365
|
-
size="small"
|
|
366
|
-
onToggle={() =>
|
|
367
|
-
handleToggleAvalaibleStatusDriver &&
|
|
368
|
-
handleToggleAvalaibleStatusDriver(
|
|
369
|
-
!userState?.result?.result?.available,
|
|
370
|
-
)
|
|
371
|
-
}
|
|
372
|
-
disabled={userState?.loading}
|
|
373
|
-
animationSpeed={200}
|
|
374
|
-
/>
|
|
375
|
-
)}
|
|
376
|
-
</EnabledStatusDriver>
|
|
377
|
-
)}
|
|
378
|
-
|
|
379
|
-
{!isEdit && !validationFields.error ? (
|
|
380
|
-
<UserData>
|
|
381
|
-
{!validationFields?.loading &&
|
|
382
|
-
sortInputFields({ values: validationFields?.fields?.checkout })
|
|
383
|
-
.length > 0 && (
|
|
384
|
-
<UDWrapper>
|
|
385
|
-
{sortInputFields({
|
|
386
|
-
values: validationFields.fields?.checkout,
|
|
387
|
-
}).map((field: any) => (
|
|
388
|
-
<React.Fragment key={field.id}>
|
|
389
|
-
<OText style={styles.label}>
|
|
390
|
-
{t(field?.code.toUpperCase(), field?.name)}
|
|
391
|
-
</OText>
|
|
392
|
-
|
|
393
|
-
<OInput
|
|
394
|
-
name={field.code}
|
|
395
|
-
placeholder={t(field.code.toUpperCase(), field?.name)}
|
|
396
|
-
placeholderTextColor={theme.colors.arrowColor}
|
|
397
|
-
style={styles.inputStyle}
|
|
398
|
-
icon={
|
|
399
|
-
field.code === 'email'
|
|
400
|
-
? theme.images.general.email
|
|
401
|
-
: theme.images.general.user
|
|
402
|
-
}
|
|
403
|
-
autoCapitalize={
|
|
404
|
-
field.code === 'email' ? 'none' : 'sentences'
|
|
405
|
-
}
|
|
406
|
-
isDisabled={!isEdit}
|
|
407
|
-
value={
|
|
408
|
-
formState?.changes[field.code] ??
|
|
409
|
-
(user && user[field.code]) ??
|
|
410
|
-
''
|
|
411
|
-
}
|
|
412
|
-
type={
|
|
413
|
-
field.code === 'email' ? 'email-address' : 'default'
|
|
414
|
-
}
|
|
415
|
-
returnKeyType="done"
|
|
416
|
-
selectionColor={theme.colors.primary}
|
|
417
|
-
color={theme.colors.textGray}
|
|
418
|
-
/>
|
|
419
|
-
</React.Fragment>
|
|
420
|
-
))}
|
|
421
|
-
|
|
422
|
-
<OText style={styles.label}>
|
|
423
|
-
{t('PASSWORD', 'Password')}
|
|
424
|
-
</OText>
|
|
425
|
-
|
|
426
|
-
<OInput
|
|
427
|
-
isSecured={true}
|
|
428
|
-
placeholder={'·············'}
|
|
429
|
-
placeholderTextColor={theme.colors.textGray}
|
|
430
|
-
style={styles.inputStyle}
|
|
431
|
-
isDisabled={true}
|
|
432
|
-
selectionColor={theme.colors.primary}
|
|
433
|
-
color={theme.colors.textGray}
|
|
434
|
-
/>
|
|
435
|
-
|
|
436
|
-
<OText style={styles.label}>{t('PHONE', 'Phone')}</OText>
|
|
437
|
-
|
|
438
|
-
<OInput
|
|
439
|
-
isSecured={true}
|
|
440
|
-
placeholder={
|
|
441
|
-
phoneToShow || `${t('NOT_PHONE', 'Not Phone')}`
|
|
442
|
-
}
|
|
443
|
-
placeholderTextColor={theme.colors.textGray}
|
|
444
|
-
style={styles.inputStyle}
|
|
445
|
-
isDisabled={true}
|
|
446
|
-
selectionColor={theme.colors.primary}
|
|
447
|
-
color={theme.colors.textGray}
|
|
448
|
-
/>
|
|
449
|
-
</UDWrapper>
|
|
450
|
-
)}
|
|
451
|
-
</UserData>
|
|
452
|
-
) : (
|
|
453
|
-
<View style={{ justifyContent: 'center', alignItems: 'center' }}>
|
|
454
|
-
<UserFormDetailsUI
|
|
455
|
-
{...props}
|
|
456
|
-
hideUpdateButton
|
|
457
|
-
handleCancelEdit={handleCancelEdit}
|
|
458
|
-
toggleIsEdit={toggleIsEdit}
|
|
459
|
-
/>
|
|
460
|
-
</View>
|
|
461
|
-
)}
|
|
462
|
-
|
|
463
|
-
{!validationFields.loading && !isEdit && (
|
|
464
|
-
<EditButton>
|
|
465
|
-
<OButton
|
|
466
|
-
text={t('EDIT', 'Edit')}
|
|
467
|
-
bgColor={theme.colors.white}
|
|
468
|
-
borderColor={theme.colors.primary}
|
|
469
|
-
isDisabled={formState.loading}
|
|
470
|
-
imgRightSrc={null}
|
|
471
|
-
textStyle={styles.btnText}
|
|
472
|
-
style={styles.editButton}
|
|
473
|
-
onClick={toggleIsEdit}
|
|
474
|
-
/>
|
|
475
|
-
</EditButton>
|
|
476
|
-
)}
|
|
477
|
-
|
|
478
|
-
<Actions>
|
|
479
|
-
<LanguageSelector />
|
|
480
|
-
|
|
481
|
-
<LogoutButton />
|
|
482
|
-
</Actions>
|
|
483
|
-
</ScrollView>
|
|
484
|
-
)}
|
|
485
|
-
</>
|
|
486
|
-
);
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
export const UserProfileForm = (props: any) => {
|
|
490
|
-
const profileProps = {
|
|
491
|
-
...props,
|
|
492
|
-
UIComponent: ProfileUI,
|
|
493
|
-
};
|
|
494
|
-
|
|
495
|
-
return <UserProfileController {...profileProps} />;
|
|
496
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const CenterView = styled.View`
|
|
4
|
-
align-items: center;
|
|
5
|
-
`;
|
|
6
|
-
|
|
7
|
-
export const UserData = styled.View`
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
width: 100%;
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
export const EditButton = styled.View`
|
|
15
|
-
align-items: center;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
flex-direction: row;
|
|
18
|
-
flex: 1;
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
export const EnabledStatusDriver = styled.View`
|
|
22
|
-
flex-direction: row;
|
|
23
|
-
justify-content: space-between;
|
|
24
|
-
align-items: center;
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
export const Actions = styled.View`
|
|
28
|
-
flex: 1;
|
|
29
|
-
border-top-width: 5px;
|
|
30
|
-
border-top-color: ${(props: any) => props.theme.colors.inputChat};
|
|
31
|
-
padding-vertical: 10px;
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
justify-content: space-between;
|
|
35
|
-
align-items: flex-start;
|
|
36
|
-
`;
|