Spaces:
Sleeping
Sleeping
Update app.py
#2
by PensionPlus - opened
app.py
CHANGED
|
@@ -25,7 +25,8 @@ def buscar_cliente(cedula):
|
|
| 25 |
cedula_limpia = limpiar_cedula(cedula)
|
| 26 |
|
| 27 |
for fila in csv_reader:
|
| 28 |
-
|
|
|
|
| 29 |
if valor and cedula_limpia == limpiar_cedula(valor):
|
| 30 |
# Formato de tablita vertical bonita
|
| 31 |
return f"""
|
|
@@ -38,7 +39,6 @@ def buscar_cliente(cedula):
|
|
| 38 |
'>
|
| 39 |
<h3>✅ CLIENTE ENCONTRADO</h3>
|
| 40 |
</div>
|
| 41 |
-
|
| 42 |
<div style='
|
| 43 |
background: #f8f9fa;
|
| 44 |
border-left: 4px solid #667eea;
|
|
@@ -47,9 +47,8 @@ def buscar_cliente(cedula):
|
|
| 47 |
font-family: Arial, sans-serif;
|
| 48 |
'>
|
| 49 |
<table style="width: 100%; border-collapse: collapse;">
|
| 50 |
-
<tr><td style="padding: 8px; border-bottom: 1px solid #eee; width: 30%;"><strong>👤 Nombre:</strong></td><td style="padding: 8px; border-bottom: 1px solid #eee;">{fila.get('
|
| 51 |
-
<tr><td style="padding: 8px; border-bottom: 1px solid #eee;"><strong>📋 Cédula:</strong></td><td style="padding: 8px; border-bottom: 1px solid #eee;">{
|
| 52 |
-
<tr><td style="padding: 8px; border-bottom: 1px solid #eee;"><strong>📊 Etapa actual:</strong></td><td style="padding: 8px; border-bottom: 1px solid #eee;">{fila.get('Etapa actual', 'N/A')}</td></tr>
|
| 53 |
<tr><td style="padding: 8px; border-bottom: 1px solid #eee;"><strong>🏦 Pagaduría:</strong></td><td style="padding: 8px; border-bottom: 1px solid #eee;">{fila.get('Pagaduría', 'N/A')}</td></tr>
|
| 54 |
<tr><td style="padding: 8px; border-bottom: 1px solid #eee;"><strong>💰 Financiera:</strong></td><td style="padding: 8px; border-bottom: 1px solid #eee;">{fila.get('Financiera', 'N/A')}</td></tr>
|
| 55 |
<tr><td style="padding: 8px; border-bottom: 1px solid #eee;"><strong>💵 Valor:</strong></td><td style="padding: 8px; border-bottom: 1px solid #eee;">{fila.get('Valor', 'N/A')}</td></tr>
|
|
@@ -58,7 +57,6 @@ def buscar_cliente(cedula):
|
|
| 58 |
<tr><td style="padding: 8px;"><strong>🕐 Actualizado:</strong></td><td style="padding: 8px;">{fila.get('FechaActualización', 'N/A')}</td></tr>
|
| 59 |
</table>
|
| 60 |
</div>
|
| 61 |
-
|
| 62 |
<div style='
|
| 63 |
background: #e8f5e8;
|
| 64 |
padding: 10px;
|
|
@@ -81,7 +79,7 @@ def buscar_cliente(cedula):
|
|
| 81 |
text-align: center;
|
| 82 |
'>
|
| 83 |
<h3>❌ CLIENTE NO ENCONTRADO</h3>
|
| 84 |
-
<p><strong>Cédula:</strong> {cedula}</p>
|
| 85 |
<p>Verifique el número o contacte al administrador.</p>
|
| 86 |
</div>
|
| 87 |
"""
|
|
@@ -96,6 +94,7 @@ def buscar_cliente(cedula):
|
|
| 96 |
text-align: center;
|
| 97 |
'>
|
| 98 |
<h3>⚠️ ERROR TEMPORAL</h3>
|
|
|
|
| 99 |
<p>Estamos solucionando el problema técnico.</p>
|
| 100 |
</div>
|
| 101 |
"""
|
|
|
|
| 25 |
cedula_limpia = limpiar_cedula(cedula)
|
| 26 |
|
| 27 |
for fila in csv_reader:
|
| 28 |
+
# Buscar en todas las columnas que puedan contener cédulas
|
| 29 |
+
for columna, valor in fila.items():
|
| 30 |
if valor and cedula_limpia == limpiar_cedula(valor):
|
| 31 |
# Formato de tablita vertical bonita
|
| 32 |
return f"""
|
|
|
|
| 39 |
'>
|
| 40 |
<h3>✅ CLIENTE ENCONTRADO</h3>
|
| 41 |
</div>
|
|
|
|
| 42 |
<div style='
|
| 43 |
background: #f8f9fa;
|
| 44 |
border-left: 4px solid #667eea;
|
|
|
|
| 47 |
font-family: Arial, sans-serif;
|
| 48 |
'>
|
| 49 |
<table style="width: 100%; border-collapse: collapse;">
|
| 50 |
+
<tr><td style="padding: 8px; border-bottom: 1px solid #eee; width: 30%;"><strong>👤 Nombre:</strong></td><td style="padding: 8px; border-bottom: 1px solid #eee;">{fila.get('NOMBRE', 'N/A')}</td></tr>
|
| 51 |
+
<tr><td style="padding: 8px; border-bottom: 1px solid #eee;"><strong>📋 Cédula:</strong></td><td style="padding: 8px; border-bottom: 1px solid #eee;">{valor}</td></tr>
|
|
|
|
| 52 |
<tr><td style="padding: 8px; border-bottom: 1px solid #eee;"><strong>🏦 Pagaduría:</strong></td><td style="padding: 8px; border-bottom: 1px solid #eee;">{fila.get('Pagaduría', 'N/A')}</td></tr>
|
| 53 |
<tr><td style="padding: 8px; border-bottom: 1px solid #eee;"><strong>💰 Financiera:</strong></td><td style="padding: 8px; border-bottom: 1px solid #eee;">{fila.get('Financiera', 'N/A')}</td></tr>
|
| 54 |
<tr><td style="padding: 8px; border-bottom: 1px solid #eee;"><strong>💵 Valor:</strong></td><td style="padding: 8px; border-bottom: 1px solid #eee;">{fila.get('Valor', 'N/A')}</td></tr>
|
|
|
|
| 57 |
<tr><td style="padding: 8px;"><strong>🕐 Actualizado:</strong></td><td style="padding: 8px;">{fila.get('FechaActualización', 'N/A')}</td></tr>
|
| 58 |
</table>
|
| 59 |
</div>
|
|
|
|
| 60 |
<div style='
|
| 61 |
background: #e8f5e8;
|
| 62 |
padding: 10px;
|
|
|
|
| 79 |
text-align: center;
|
| 80 |
'>
|
| 81 |
<h3>❌ CLIENTE NO ENCONTRADO</h3>
|
| 82 |
+
<p><strong>Cédula buscada:</strong> {cedula}</p>
|
| 83 |
<p>Verifique el número o contacte al administrador.</p>
|
| 84 |
</div>
|
| 85 |
"""
|
|
|
|
| 94 |
text-align: center;
|
| 95 |
'>
|
| 96 |
<h3>⚠️ ERROR TEMPORAL</h3>
|
| 97 |
+
<p>Error: {str(e)}</p>
|
| 98 |
<p>Estamos solucionando el problema técnico.</p>
|
| 99 |
</div>
|
| 100 |
"""
|