passports added
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Text, StyleSheet, TouchableOpacity, ActivityIndicator, Alert, ScrollView, SafeAreaView } from 'react-native';
|
||||
import { Text, StyleSheet, TouchableOpacity, ActivityIndicator, Alert, ScrollView, SafeAreaView, View } from 'react-native';
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import { COLORS } from '../../constants/colors';
|
||||
@@ -11,6 +11,7 @@ import apiService from '../../services/apiService';
|
||||
import { useAuth } from '../../contexts/AuthContext';
|
||||
import { useBaseEnums } from '../../contexts/BaseEnumsContext';
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import ImageInput from '../../components/ImageInput';
|
||||
|
||||
const CreateLoanOrderScreen = () => {
|
||||
const navigation = useNavigation();
|
||||
@@ -60,6 +61,11 @@ const CreateLoanOrderScreen = () => {
|
||||
const [cardMonth, setCardMonth] = useState('');
|
||||
const [cardYear, setCardYear] = useState('');
|
||||
|
||||
const [passportOne, setPassportOne] = useState(null);
|
||||
const [passportTwo, setPassportTwo] = useState(null);
|
||||
const [passportThree, setPassportThree] = useState(null);
|
||||
const [passportFour, setPassportFour] = useState(null);
|
||||
|
||||
const monthOptions = Array.from({ length: 12 }, (_, i) => {
|
||||
const val = (i + 1).toString().padStart(2, '0');
|
||||
return { value: val, label: val };
|
||||
@@ -122,7 +128,7 @@ const CreateLoanOrderScreen = () => {
|
||||
const branchOptions = region && branchesByRegion[region] ? branchesByRegion[region].map((b) => ({ label: b.name, value: b.id })) : [];
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (!loanType || !loanAmount || !region || !branchId || !customerName || !customerSurname || !passportSerie || !passportId || !bornAt || !phone || !education || !marriageStatus || !passportAddress || !realAddress || !cardNumber || !cardName || !cardMonth || !cardYear) {
|
||||
if (!loanType || !loanAmount || !region || !branchId || !customerName || !customerSurname || !passportSerie || !passportId || !bornAt || !phone || !education || !marriageStatus || !passportAddress || !realAddress || !passportOne || !passportTwo || !passportThree || !passportFour || !cardNumber || !cardName || !cardMonth || !cardYear) {
|
||||
Alert.alert('Error', 'Fill all required fields');
|
||||
return;
|
||||
}
|
||||
@@ -166,6 +172,10 @@ const CreateLoanOrderScreen = () => {
|
||||
card_name: cardName,
|
||||
card_month: cardMonth,
|
||||
card_year: cardYear,
|
||||
passport_one: passportOne,
|
||||
passport_two: passportTwo,
|
||||
passport_three: passportThree,
|
||||
passport_four: passportFour,
|
||||
};
|
||||
|
||||
setLoading(true);
|
||||
@@ -200,6 +210,7 @@ const CreateLoanOrderScreen = () => {
|
||||
|
||||
<SelectInput label="Bilimi" value={education} options={educationOptions} onValueChange={setEducation} placeholder="Saýla" />
|
||||
<SelectInput label="Maşgala ýagdaýy" value={marriageStatus} options={marriageOptions} onValueChange={setMarriageStatus} placeholder="Saýla" />
|
||||
<DateInput label="Doglan senesi" value={bornAt} onChange={setBornAt} />
|
||||
|
||||
<Input label="Ýazgy edilen salgyňyz" placeholder="Kemine 100/190" value={passportAddress} onChangeText={setPassportAddress} />
|
||||
<Input label="Häzirki ýaşaýyş ýeri" placeholder="Kemine 100/200" value={realAddress} onChangeText={setRealAddress} />
|
||||
@@ -211,7 +222,6 @@ const CreateLoanOrderScreen = () => {
|
||||
<Input label="Doglan ýeri (passport)" placeholder="Ashgabat" value={bornPlace} onChangeText={setBornPlace} />
|
||||
<Input label="E-poçta" placeholder="example@mail.com" value={email} onChangeText={setEmail} keyboardType="email-address" />
|
||||
|
||||
<DateInput label="Doglan senesi" value={bornAt} onChange={setBornAt} />
|
||||
<Input label="Telefon (+9936...)" value={phone} onChangeText={setPhone} keyboardType="numeric" />
|
||||
<Input label="Telefon goşmaça" value={phoneAdditional} onChangeText={setPhoneAdditional} keyboardType="numeric" />
|
||||
<Input label="Öý telefony" value={phoneHome} onChangeText={setPhoneHome} />
|
||||
@@ -230,6 +240,13 @@ const CreateLoanOrderScreen = () => {
|
||||
<SelectInput label="Kart Möhleti (aý)" value={cardMonth} options={monthOptions} onValueChange={setCardMonth} placeholder="Saýla" />
|
||||
<SelectInput label="Kart Möhleti (ýyl)" value={cardYear} options={yearOptions} onValueChange={setCardYear} placeholder="Saýla" />
|
||||
|
||||
<View style={styles.passportGrid}>
|
||||
<ImageInput label="Pasport (sahypa 1)" image={passportOne} onChange={setPassportOne} />
|
||||
<ImageInput label="Pasport (2-3-nji sahypa)" image={passportTwo} onChange={setPassportTwo} />
|
||||
<ImageInput label="Pasport (8-9 sahypa)" image={passportThree} onChange={setPassportThree} />
|
||||
<ImageInput label="Pasport (32-nji sahypa)" image={passportFour} onChange={setPassportFour} />
|
||||
</View>
|
||||
|
||||
<TouchableOpacity style={styles.submitBtn} onPress={handleSubmit} disabled={loading}>
|
||||
{loading ? <ActivityIndicator color={COLORS.white} /> : <Text style={styles.submitText}>Ýatda sakla</Text>}
|
||||
</TouchableOpacity>
|
||||
@@ -244,6 +261,11 @@ const styles = StyleSheet.create({
|
||||
title: { fontSize: 24, fontWeight: 'bold', color: COLORS.textPrimary, marginBottom: 24 },
|
||||
submitBtn: { marginTop: 32, backgroundColor: COLORS.primary, paddingVertical: 16, borderRadius: 8, alignItems: 'center' },
|
||||
submitText: { color: COLORS.white, fontSize: 16, fontWeight: '600' },
|
||||
passportGrid: {
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'wrap',
|
||||
justifyContent: 'space-between',
|
||||
},
|
||||
});
|
||||
|
||||
export default CreateLoanOrderScreen;
|
||||
Reference in New Issue
Block a user