This commit is contained in:
2025-07-04 19:38:14 +05:00
parent 9425dde7b9
commit 6c15093ebc
2 changed files with 106 additions and 100 deletions

View File

@@ -11,6 +11,8 @@ import {
ScrollView,
TouchableWithoutFeedback,
Keyboard,
KeyboardAvoidingView,
Platform,
} from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import Input from './Input';
@@ -199,113 +201,118 @@ const EditProfileModal = ({
onRequestClose={handleClose}
>
<SafeAreaView style={styles.container}>
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<View style={styles.content}>
{/* Header */}
<View style={styles.header}>
<TouchableOpacity onPress={handleClose} style={styles.closeButton}>
<Ionicons name="close" size={24} color={COLORS.text} />
</TouchableOpacity>
<Text style={styles.title}>Şahsy maglumatlar</Text>
<View style={styles.placeholder} />
</View>
{/* Form */}
<ScrollView style={styles.form} showsVerticalScrollIndicator={false}>
<View style={styles.formSection}>
<Text style={styles.sectionTitle}>Esasy maglumatlar</Text>
<Input
label="Ady *"
value={formData.name}
onChangeText={(value) => updateFormData('name', value)}
error={errors.name}
maxLength={255}
returnKeyType="next"
onSubmitEditing={() => phoneInputRef.current?.focus()}
/>
<Input
ref={phoneInputRef}
label="Telefon belgisi *"
value={formData.phone}
onChangeText={(value) => updateFormData('phone', value)}
error={errors.phone}
keyboardType="numeric"
maxLength={8}
returnKeyType="next"
onSubmitEditing={() => passwordInputRef.current?.focus()}
/>
<Input
ref={passwordInputRef}
label="Täze parol"
value={formData.password}
onChangeText={(value) => updateFormData('password', value)}
error={errors.password}
secureTextEntry
placeholder="Parol üýtgetmezlik üçin boş goýuň"
returnKeyType="next"
onSubmitEditing={() => passportIdInputRef.current?.focus()}
/>
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
style={{ flex: 1 }}
>
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<View style={styles.content}>
{/* Header */}
<View style={styles.header}>
<TouchableOpacity onPress={handleClose} style={styles.closeButton}>
<Ionicons name="close" size={24} color={COLORS.text} />
</TouchableOpacity>
<Text style={styles.title}>Şahsy maglumatlar</Text>
<View style={styles.placeholder} />
</View>
<View style={styles.formSection}>
<Text style={styles.sectionTitle}>Passport maglumatlary</Text>
<View style={styles.inputContainer}>
<Text style={styles.label}>Passport seriýasy</Text>
<TouchableOpacity
style={[styles.pickerButton, errors.passport_serie && styles.inputError]}
onPress={() => setShowPassportPicker(true)}
>
<Text style={[styles.pickerButtonText, !formData.passport_serie && styles.placeholderText]}>
{formData.passport_serie || 'Saýlaň'}
</Text>
<Ionicons name="chevron-down" size={20} color={COLORS.textSecondary} />
</TouchableOpacity>
{errors.passport_serie && (
<Text style={styles.errorText}>{errors.passport_serie}</Text>
)}
{/* Form */}
<ScrollView style={styles.form} showsVerticalScrollIndicator={false}>
<View style={styles.formSection}>
<Text style={styles.sectionTitle}>Esasy maglumatlar</Text>
<Input
label="Ady *"
value={formData.name}
onChangeText={(value) => updateFormData('name', value)}
error={errors.name}
maxLength={255}
returnKeyType="next"
onSubmitEditing={() => phoneInputRef.current?.focus()}
/>
<Input
ref={phoneInputRef}
label="Telefon belgisi *"
value={formData.phone}
onChangeText={(value) => updateFormData('phone', value)}
error={errors.phone}
keyboardType="numeric"
maxLength={8}
returnKeyType="next"
onSubmitEditing={() => passwordInputRef.current?.focus()}
/>
<Input
ref={passwordInputRef}
label="Täze parol"
value={formData.password}
onChangeText={(value) => updateFormData('password', value)}
error={errors.password}
secureTextEntry
placeholder="Parol üýtgetmezlik üçin boş goýuň"
returnKeyType="next"
onSubmitEditing={() => passportIdInputRef.current?.focus()}
/>
</View>
<Input
ref={passportIdInputRef}
label="Passport ID"
value={formData.passport_id}
onChangeText={(value) => updateFormData('passport_id', value)}
error={errors.passport_id}
keyboardType="numeric"
returnKeyType="done"
/>
</View>
<View style={styles.formSection}>
<Text style={styles.sectionTitle}>Passport maglumatlary</Text>
<View style={styles.inputContainer}>
<Text style={styles.label}>Passport seriýasy</Text>
<TouchableOpacity
style={[styles.pickerButton, errors.passport_serie && styles.inputError]}
onPress={() => setShowPassportPicker(true)}
>
<Text style={[styles.pickerButtonText, !formData.passport_serie && styles.placeholderText]}>
{formData.passport_serie || 'Saýlaň'}
</Text>
<Ionicons name="chevron-down" size={20} color={COLORS.textSecondary} />
</TouchableOpacity>
{errors.passport_serie && (
<Text style={styles.errorText}>{errors.passport_serie}</Text>
)}
</View>
<View style={styles.note}>
<Ionicons name="information-circle" size={16} color={COLORS.textSecondary} />
<Text style={styles.noteText}>
* belgisi bolan meýdanlar hökmany doldurulmaly
</Text>
</View>
</ScrollView>
<Input
ref={passportIdInputRef}
label="Passport ID"
value={formData.passport_id}
onChangeText={(value) => updateFormData('passport_id', value)}
error={errors.passport_id}
keyboardType="numeric"
returnKeyType="done"
/>
</View>
{/* Save Button */}
<View style={styles.footer}>
<Button
title="Ýatda sakla"
onPress={handleSave}
disabled={isLoading}
style={styles.saveButton}
/>
{isLoading && (
<ActivityIndicator
size="small"
color={COLORS.primary}
style={styles.loader}
<View style={styles.note}>
<Ionicons name="information-circle" size={16} color={COLORS.textSecondary} />
<Text style={styles.noteText}>
* belgisi bolan meýdanlar hökmany doldurulmaly
</Text>
</View>
</ScrollView>
{/* Save Button */}
<View style={styles.footer}>
<Button
title="Ýatda sakla"
onPress={handleSave}
disabled={isLoading}
style={styles.saveButton}
/>
)}
{isLoading && (
<ActivityIndicator
size="small"
color={COLORS.primary}
style={styles.loader}
/>
)}
</View>
</View>
</View>
</TouchableWithoutFeedback>
</TouchableWithoutFeedback>
</KeyboardAvoidingView>
{renderPassportSeriesPicker()}
</SafeAreaView>