reffreal input

This commit is contained in:
Samandar Turgunboyev
2026-02-26 15:44:21 +05:00
parent 7aa130bdd6
commit ad0d0d796c
2 changed files with 34 additions and 30 deletions

View File

@@ -2,7 +2,7 @@
"expo": { "expo": {
"name": "Info target", "name": "Info target",
"slug": "infotarget", "slug": "infotarget",
"version": "1.0.1", "version": "1.0.2",
"orientation": "portrait", "orientation": "portrait",
"icon": "./assets/images/logo.png", "icon": "./assets/images/logo.png",
"scheme": "infotarget", "scheme": "infotarget",
@@ -11,9 +11,7 @@
"ios": { "ios": {
"supportsTablet": true, "supportsTablet": true,
"infoPlist": { "infoPlist": {
"UIBackgroundModes": [ "UIBackgroundModes": ["remote-notification"]
"remote-notification"
]
}, },
"bundleIdentifier": "com.felix.infotarget" "bundleIdentifier": "com.felix.infotarget"
}, },

View File

@@ -11,7 +11,16 @@ import { AxiosError } from 'axios';
import { Image } from 'expo-image'; import { Image } from 'expo-image';
import { LinearGradient } from 'expo-linear-gradient'; import { LinearGradient } from 'expo-linear-gradient';
import { useRouter } from 'expo-router'; import { useRouter } from 'expo-router';
import { Building2, CheckIcon, Globe, Hash, Search, ShieldCheck, User, UserPlus } from 'lucide-react-native'; import {
Building2,
CheckIcon,
Globe,
Hash,
Search,
ShieldCheck,
User,
UserPlus,
} from 'lucide-react-native';
import React, { useCallback, useMemo, useRef, useState } from 'react'; import React, { useCallback, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { import {
@@ -125,15 +134,16 @@ export default function RegisterFormScreen() {
const selectedCountryName = useMemo(() => { const selectedCountryName = useMemo(() => {
if (!selectedCountry) return t('Tanlang'); if (!selectedCountry) return t('Tanlang');
return countryResponse?.find((c: any) => c.flag?.toUpperCase() === selectedCountry)?.name || t('Tanlang'); return (
countryResponse?.find((c: any) => c.flag?.toUpperCase() === selectedCountry)?.name ||
t('Tanlang')
);
}, [selectedCountry, countryResponse, t]); }, [selectedCountry, countryResponse, t]);
const filteredCountries = useMemo(() => { const filteredCountries = useMemo(() => {
if (!countrySearch.trim()) return countryResponse || []; if (!countrySearch.trim()) return countryResponse || [];
const q = countrySearch.toLowerCase().trim(); const q = countrySearch.toLowerCase().trim();
return (countryResponse || []).filter((c: any) => return (countryResponse || []).filter((c: any) => c.name?.toLowerCase().includes(q));
c.name?.toLowerCase().includes(q)
);
}, [countryResponse, countrySearch]); }, [countryResponse, countrySearch]);
const headerInfo = getHeaderInfo(personType); const headerInfo = getHeaderInfo(personType);
@@ -176,17 +186,14 @@ export default function RegisterFormScreen() {
// data.entity.name.rows = [{ inn: "123456789", ... }, ...] // data.entity.name.rows = [{ inn: "123456789", ... }, ...]
// Shu rows ichida joriy inn bor-yo'qligini tekshiramiz // Shu rows ichida joriy inn bor-yo'qligini tekshiramiz
// ------------------------------------------------------- // -------------------------------------------------------
const rows: Array<{ inn: string }> = const rows: Array<{ inn: string }> = directorData?.data?.entity?.name?.rows ?? [];
directorData?.data?.entity?.name?.rows ?? [];
const innMatch = rows.some((row) => row.inn === inn); const innMatch = rows.some((row) => row.inn === inn);
if (!innMatch) { if (!innMatch) {
// Director bu tashkilotga tegishli emas // Director bu tashkilotga tegishli emas
setDirectorInfo(null); setDirectorInfo(null);
setErrorDirectorInfo( setErrorDirectorInfo(t("Bu direktor ko'rsatilgan tashkilotga tegishli emas"));
t("Bu direktor ko'rsatilgan tashkilotga tegishli emas")
);
setDirectorLoading(false); setDirectorLoading(false);
return; return;
} }
@@ -241,7 +248,10 @@ export default function RegisterFormScreen() {
const handlePassportSeriesChange = useCallback( const handlePassportSeriesChange = useCallback(
(text: string) => { (text: string) => {
const v = text.toUpperCase().replace(/[^A-Z]/g, '').slice(0, 2); const v = text
.toUpperCase()
.replace(/[^A-Z]/g, '')
.slice(0, 2);
setPassportSeries(v); setPassportSeries(v);
if (personType && passportNumber.length === 7 && jshshr.length === 14) { if (personType && passportNumber.length === 7 && jshshr.length === 14) {
setLoading(true); setLoading(true);
@@ -510,8 +520,9 @@ export default function RegisterFormScreen() {
)} )}
{/* ---- LEGAL ENTITY: Kompaniya ma'lumoti ---- */} {/* ---- LEGAL ENTITY: Kompaniya ma'lumoti ---- */}
{isLegal && info && ( {isLegal &&
hasValidName ? ( info &&
(hasValidName ? (
<View style={styles.infoBox}> <View style={styles.infoBox}>
<Text style={styles.infoLabel}>{t('Tashkilot')}</Text> <Text style={styles.infoLabel}>{t('Tashkilot')}</Text>
<Text style={styles.infoText}>{info.fullName || info.name}</Text> <Text style={styles.infoText}>{info.fullName || info.name}</Text>
@@ -527,8 +538,7 @@ export default function RegisterFormScreen() {
<View style={styles.errorBox}> <View style={styles.errorBox}>
<Text style={styles.errorText}>{t('Tashkilot topilmadi')}</Text> <Text style={styles.errorText}>{t('Tashkilot topilmadi')}</Text>
</View> </View>
) ))}
)}
{/* ---- LEGAL ENTITY: Direktor JSHSHR — faqat info kelganda ko'rinadi ---- */} {/* ---- LEGAL ENTITY: Direktor JSHSHR — faqat info kelganda ko'rinadi ---- */}
{isLegal && info && ( {isLegal && info && (
@@ -577,7 +587,6 @@ export default function RegisterFormScreen() {
<Hash size={18} color="#94a3b8" /> <Hash size={18} color="#94a3b8" />
<TextInput <TextInput
value={referal} value={referal}
keyboardType="numeric"
placeholder={t('Referal kodi')} placeholder={t('Referal kodi')}
placeholderTextColor="#94a3b8" placeholderTextColor="#94a3b8"
style={styles.textInput} style={styles.textInput}
@@ -605,8 +614,9 @@ export default function RegisterFormScreen() {
</View> </View>
{/* ---- YATT/BAND info ---- */} {/* ---- YATT/BAND info ---- */}
{!isLegal && info && ( {!isLegal &&
hasValidName ? ( info &&
(hasValidName ? (
<View style={styles.infoBox}> <View style={styles.infoBox}>
<Text style={styles.infoText}>{info.fullName || info.name}</Text> <Text style={styles.infoText}>{info.fullName || info.name}</Text>
</View> </View>
@@ -620,8 +630,7 @@ export default function RegisterFormScreen() {
<View style={styles.errorBox}> <View style={styles.errorBox}>
<Text style={styles.errorText}>{t('Foydalanuvchi topilmadi')}</Text> <Text style={styles.errorText}>{t('Foydalanuvchi topilmadi')}</Text>
</View> </View>
) ))}
)}
{/* ---- Davom etish tugmasi ---- */} {/* ---- Davom etish tugmasi ---- */}
<TouchableOpacity <TouchableOpacity
@@ -687,10 +696,7 @@ export default function RegisterFormScreen() {
const flagCode = item.flag ? item.flag.toLowerCase() : ''; const flagCode = item.flag ? item.flag.toLowerCase() : '';
return ( return (
<TouchableOpacity <TouchableOpacity
style={[ style={[styles.listItem, isSelected && styles.selectedListItem]}
styles.listItem,
isSelected && styles.selectedListItem,
]}
onPress={() => { onPress={() => {
setSelectedCountry(item.flag?.toUpperCase()); setSelectedCountry(item.flag?.toUpperCase());
closeCountrySheet(); closeCountrySheet();