Spaces:
Running
Running
Update src/modules/kyc_form.py
Browse files- src/modules/kyc_form.py +11 -4
src/modules/kyc_form.py
CHANGED
|
@@ -79,6 +79,8 @@ def show_kyc_form(client, sheet_name, generate_id_func):
|
|
| 79 |
with c1:
|
| 80 |
lbl("Nom Complet", True)
|
| 81 |
nom = st.text_input("Nom", label_visibility="collapsed")
|
|
|
|
|
|
|
| 82 |
lbl("Date de Naissance", True)
|
| 83 |
date_naiss = st.date_input("Date Naiss", value=date.today()-timedelta(days=365*18), min_value=date.today()-timedelta(days=365*100), max_value=date.today()-timedelta(days=365*18), label_visibility="collapsed")
|
| 84 |
with c2:
|
|
@@ -110,7 +112,8 @@ def show_kyc_form(client, sheet_name, generate_id_func):
|
|
| 110 |
c7, c8, c9 = st.columns(3)
|
| 111 |
with c7:
|
| 112 |
lbl("Statut Pro", True)
|
| 113 |
-
|
|
|
|
| 114 |
lbl("Profession", True)
|
| 115 |
prof_select = st.selectbox("Choix Profession", LISTE_PROFESSIONS, label_visibility="collapsed")
|
| 116 |
prof_autre = st.text_input("Si Autre, préciser", key="prof_autre", placeholder="Profession personnalisée...")
|
|
@@ -219,13 +222,15 @@ def show_kyc_form(client, sheet_name, generate_id_func):
|
|
| 219 |
if not re.match(r"^(\+|00)?221(7[0678]|33)[0-9]{7}$", clean_phone) and not re.match(r"^\+?[0-9]{9,15}$", clean_phone): errors.append("❌ Téléphone invalide.")
|
| 220 |
if not re.match(r"[^@]+@[^@]+\.[^@]+", email): errors.append("❌ Email invalide.")
|
| 221 |
if " " in id_officiel or len(id_officiel) < 5: errors.append("❌ ID Officiel invalide.")
|
| 222 |
-
if
|
| 223 |
|
| 224 |
# --- LOGIQUE DE RANGEMENT ---
|
| 225 |
if errors:
|
| 226 |
for e in errors: st.error(e)
|
| 227 |
else:
|
| 228 |
try:
|
|
|
|
|
|
|
| 229 |
# Calcul des valeurs "Autre" avant préparation de la ligne
|
| 230 |
prof_val = prof_autre.strip().upper() if prof_select == "Autre" and prof_autre.strip() else prof_select.upper()
|
| 231 |
quartier_val = quartier_autre.strip().upper() if quartier_select == "Autre" and quartier_autre.strip() else quartier_select.upper()
|
|
@@ -243,6 +248,7 @@ def show_kyc_form(client, sheet_name, generate_id_func):
|
|
| 243 |
row_to_add = [
|
| 244 |
new_id, # ID_Client ou ID_Garant
|
| 245 |
nom.upper(), # Nom_Complet
|
|
|
|
| 246 |
date_naiss.strftime("%d-%m-%Y"), # Date_Naissance
|
| 247 |
adresse, # Adresse
|
| 248 |
telephone, # Telephone
|
|
@@ -253,7 +259,7 @@ def show_kyc_form(client, sheet_name, generate_id_func):
|
|
| 253 |
etat_civil, # Etat_Civil
|
| 254 |
pers_charge, # Pers_Charge
|
| 255 |
prof_val, # Profession
|
| 256 |
-
|
| 257 |
employeur.upper(), # Employeur
|
| 258 |
secteur, # Secteur_Activite
|
| 259 |
anciennete_emploi, # Anciennete_Emploi
|
|
@@ -274,7 +280,8 @@ def show_kyc_form(client, sheet_name, generate_id_func):
|
|
| 274 |
aml, # Verification_AML
|
| 275 |
origine, # Origine_Fonds
|
| 276 |
reseaux_sociaux, # Reseau_sociaux
|
| 277 |
-
notes
|
|
|
|
| 278 |
]
|
| 279 |
|
| 280 |
# ÉCRITURE VIA LA CONNEXION PASSÉE EN ARGUMENT
|
|
|
|
| 79 |
with c1:
|
| 80 |
lbl("Nom Complet", True)
|
| 81 |
nom = st.text_input("Nom", label_visibility="collapsed")
|
| 82 |
+
lbl("Genre", True) # ← NOUVEAU
|
| 83 |
+
genre = st.selectbox("Genre", ["Homme", "Femme"], label_visibility="collapsed") # ← NOUVEAU
|
| 84 |
lbl("Date de Naissance", True)
|
| 85 |
date_naiss = st.date_input("Date Naiss", value=date.today()-timedelta(days=365*18), min_value=date.today()-timedelta(days=365*100), max_value=date.today()-timedelta(days=365*18), label_visibility="collapsed")
|
| 86 |
with c2:
|
|
|
|
| 112 |
c7, c8, c9 = st.columns(3)
|
| 113 |
with c7:
|
| 114 |
lbl("Statut Pro", True)
|
| 115 |
+
statut_pro_select = st.selectbox("Statut", ["Salarié", "Indépendant", "Entrepreneur", "Fonctionnaire", "Etudiant", "Sans_Emploi", "Retraité", "Autre"], label_visibility="collapsed") # ← MODIFIÉ
|
| 116 |
+
statut_pro_autre = st.text_input("Si Autre, préciser", key="statut_pro_autre", placeholder="Statut personnalisé...") # ← NOUVEAU
|
| 117 |
lbl("Profession", True)
|
| 118 |
prof_select = st.selectbox("Choix Profession", LISTE_PROFESSIONS, label_visibility="collapsed")
|
| 119 |
prof_autre = st.text_input("Si Autre, préciser", key="prof_autre", placeholder="Profession personnalisée...")
|
|
|
|
| 222 |
if not re.match(r"^(\+|00)?221(7[0678]|33)[0-9]{7}$", clean_phone) and not re.match(r"^\+?[0-9]{9,15}$", clean_phone): errors.append("❌ Téléphone invalide.")
|
| 223 |
if not re.match(r"[^@]+@[^@]+\.[^@]+", email): errors.append("❌ Email invalide.")
|
| 224 |
if " " in id_officiel or len(id_officiel) < 5: errors.append("❌ ID Officiel invalide.")
|
| 225 |
+
if statut_pro_select in ["Salarié", "Fonctionnaire"] and len(employeur) < 2: errors.append("❌ Employeur obligatoire.")
|
| 226 |
|
| 227 |
# --- LOGIQUE DE RANGEMENT ---
|
| 228 |
if errors:
|
| 229 |
for e in errors: st.error(e)
|
| 230 |
else:
|
| 231 |
try:
|
| 232 |
+
# Calcul statut_pro avec gestion "Autre"
|
| 233 |
+
statut_pro_val = statut_pro_autre.strip().upper() if statut_pro_select == "Autre" and statut_pro_autre.strip() else statut_pro_select.upper()
|
| 234 |
# Calcul des valeurs "Autre" avant préparation de la ligne
|
| 235 |
prof_val = prof_autre.strip().upper() if prof_select == "Autre" and prof_autre.strip() else prof_select.upper()
|
| 236 |
quartier_val = quartier_autre.strip().upper() if quartier_select == "Autre" and quartier_autre.strip() else quartier_select.upper()
|
|
|
|
| 248 |
row_to_add = [
|
| 249 |
new_id, # ID_Client ou ID_Garant
|
| 250 |
nom.upper(), # Nom_Complet
|
| 251 |
+
genre, # Genre ← NOUVEAU
|
| 252 |
date_naiss.strftime("%d-%m-%Y"), # Date_Naissance
|
| 253 |
adresse, # Adresse
|
| 254 |
telephone, # Telephone
|
|
|
|
| 259 |
etat_civil, # Etat_Civil
|
| 260 |
pers_charge, # Pers_Charge
|
| 261 |
prof_val, # Profession
|
| 262 |
+
statut_pro_val, # Statut_Pro ← MODIFIÉ
|
| 263 |
employeur.upper(), # Employeur
|
| 264 |
secteur, # Secteur_Activite
|
| 265 |
anciennete_emploi, # Anciennete_Emploi
|
|
|
|
| 280 |
aml, # Verification_AML
|
| 281 |
origine, # Origine_Fonds
|
| 282 |
reseaux_sociaux, # Reseau_sociaux
|
| 283 |
+
notes, # Commentaires_Notes
|
| 284 |
+
date.today().strftime("%d-%m-%Y") # Date_Creation ← NOUVEAU
|
| 285 |
]
|
| 286 |
|
| 287 |
# ÉCRITURE VIA LA CONNEXION PASSÉE EN ARGUMENT
|