jcalbornoz commited on
Commit
d02c912
verified
1 Parent(s): 1cccf6d

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +29 -88
index.html CHANGED
@@ -4,91 +4,28 @@
4
  <title>Analizador de Documentos Inmobiliarios y JAC</title>
5
  <style>
6
  body { font-family: Arial, sans-serif; text-align: center; margin-top: 20px; background-color: #f4f4f9; color: #333; }
7
- .container {
8
- width: 90%;
9
- max-width: 1000px;
10
- margin: 0 auto;
11
- padding: 20px;
12
- border: 1px solid #ccc;
13
- border-radius: 10px;
14
- background-color: #fff;
15
- box-shadow: 0 4px 12px rgba(0,0,0,0.1);
16
- }
17
  h1 { color: #007bff; }
18
  p { color: #666; margin-bottom: 20px;}
19
  #upload-section { margin: 20px 0; border-bottom: 1px solid #eee; padding-bottom: 20px; }
20
- button {
21
- padding: 10px 20px;
22
- background-color: #28a745;
23
- color: white;
24
- border: none;
25
- border-radius: 5px;
26
- cursor: pointer;
27
- transition: background-color 0.3s;
28
- margin-left: 10px;
29
- }
30
  button:hover { background-color: #218838; }
31
-
32
- #loading {
33
- color: #007bff;
34
- font-size: 1.2em;
35
- margin-top: 15px;
36
- display: none;
37
- }
38
-
39
- .results-container {
40
- display: flex;
41
- justify-content: space-between;
42
- margin-top: 30px;
43
- text-align: left;
44
- }
45
-
46
- .result-panel {
47
- width: 48%; /* Divide el espacio casi a la mitad */
48
- padding: 15px;
49
- border-radius: 8px;
50
- box-shadow: 0 2px 4px rgba(0,0,0,0.05);
51
- min-height: 250px; /* Para que se vean ambos paneles antes del resultado */
52
- }
53
-
54
- #summary-display {
55
- background-color: #e6f7ff; /* Azul claro para el resumen */
56
- border: 1px solid #b3e0ff;
57
- }
58
-
59
- #json-display {
60
- background-color: #fff0e6; /* Naranja claro para el JSON */
61
- border: 1px solid #ffccb3;
62
- }
63
-
64
- h2 {
65
- border-bottom: 2px solid #ccc;
66
- padding-bottom: 5px;
67
- margin-top: 0;
68
- color: #007bff;
69
- }
70
-
71
  ul { list-style-type: none; padding-left: 0; }
72
  li { margin-bottom: 12px; line-height: 1.4; border-bottom: 1px dotted #ccc; padding-bottom: 5px;}
73
  li strong { color: #333; }
74
-
75
- pre {
76
- background-color: #f8f8f8;
77
- padding: 10px;
78
- border-radius: 5px;
79
- overflow-x: auto;
80
- white-space: pre-wrap;
81
- word-wrap: break-word;
82
- font-size: 0.9em;
83
- border: 1px solid #ddd;
84
- }
85
-
86
  </style>
87
  </head>
88
  <body>
89
  <div class="container">
90
  <h1>An谩lisis Experto de Documentos</h1>
91
- <p>Sube un Certificado de Tradici贸n y Libertad (CTL) o un documento de Junta de Acci贸n Comunal (JAC). El sistema revisar谩 todas las p谩ginas.</p>
92
 
93
  <div id="upload-section">
94
  <input type="file" id="file-upload" accept=".txt,.pdf">
@@ -111,10 +48,9 @@
111
  </div>
112
 
113
  <script>
114
- // Funci贸n para limpiar el contenido anterior
115
  function resetResults() {
116
  document.getElementById('loading').style.display = 'none';
117
- document.getElementById('summary-result').innerHTML = '';
118
  document.getElementById('json-result').textContent = 'El JSON completo se mostrar谩 aqu铆.';
119
  document.getElementById('summary-display').style.display = 'none';
120
  document.getElementById('json-display').style.display = 'none';
@@ -148,29 +84,34 @@
148
  const summaryDiv = document.getElementById('summary-result');
149
  const jsonPre = document.getElementById('json-result');
150
 
151
- // 1. Mostrar el Resumen/Lista (usa la lista formateada del backend)
152
  const ul = document.createElement('ul');
153
- data.summary.forEach(point => {
154
- const li = document.createElement('li');
155
- li.innerHTML = point;
156
- ul.appendChild(li);
157
- });
158
- summaryDiv.innerHTML = '';
 
 
159
  summaryDiv.appendChild(ul);
160
 
161
- // 2. Mostrar el JSON completo (usa el objeto 'structured_data' del backend)
162
- jsonPre.textContent = JSON.stringify(data.structured_data, null, 4);
 
 
163
 
164
  document.getElementById('summary-display').style.display = 'block';
165
  document.getElementById('json-display').style.display = 'block';
166
 
167
  } else {
168
- // Mostrar error del servidor
169
- document.getElementById('summary-result').innerHTML = `<strong>Error en el an谩lisis:</strong> ${data.error}`;
170
- document.getElementById('json-result').textContent = 'Error al procesar. Revisa el mensaje de la izquierda.';
171
  }
172
  } catch (error) {
173
- document.getElementById('summary-result').innerHTML = `Ocurri贸 un error de conexi贸n con el servidor. Por favor, int茅ntalo de nuevo.`;
 
174
  } finally {
175
  document.getElementById('loading').style.display = 'none';
176
  }
 
4
  <title>Analizador de Documentos Inmobiliarios y JAC</title>
5
  <style>
6
  body { font-family: Arial, sans-serif; text-align: center; margin-top: 20px; background-color: #f4f4f9; color: #333; }
7
+ .container { width: 90%; max-width: 1000px; margin: 0 auto; padding: 20px; border: 1px solid #ccc; border-radius: 10px; background-color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
 
 
 
 
 
 
 
 
 
8
  h1 { color: #007bff; }
9
  p { color: #666; margin-bottom: 20px;}
10
  #upload-section { margin: 20px 0; border-bottom: 1px solid #eee; padding-bottom: 20px; }
11
+ button { padding: 10px 20px; background-color: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s; margin-left: 10px; }
 
 
 
 
 
 
 
 
 
12
  button:hover { background-color: #218838; }
13
+ #loading { color: #007bff; font-size: 1.2em; margin-top: 15px; display: none; }
14
+ .results-container { display: flex; justify-content: space-between; margin-top: 30px; text-align: left; }
15
+ .result-panel { width: 48%; padding: 15px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); min-height: 250px; }
16
+ #summary-display { background-color: #e6f7ff; border: 1px solid #b3e0ff; }
17
+ #json-display { background-color: #fff0e6; border: 1px solid #ffccb3; }
18
+ h2 { border-bottom: 2px solid #ccc; padding-bottom: 5px; margin-top: 0; color: #007bff; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  ul { list-style-type: none; padding-left: 0; }
20
  li { margin-bottom: 12px; line-height: 1.4; border-bottom: 1px dotted #ccc; padding-bottom: 5px;}
21
  li strong { color: #333; }
22
+ pre { background-color: #f8f8f8; padding: 10px; border-radius: 5px; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word; font-size: 0.9em; border: 1px solid #ddd; }
 
 
 
 
 
 
 
 
 
 
 
23
  </style>
24
  </head>
25
  <body>
26
  <div class="container">
27
  <h1>An谩lisis Experto de Documentos</h1>
28
+ <p>Sube un Certificado de Tradici贸n y Libertad (CTL) o un documento de Junta de Acci贸n Comunal (JAC).</p>
29
 
30
  <div id="upload-section">
31
  <input type="file" id="file-upload" accept=".txt,.pdf">
 
48
  </div>
49
 
50
  <script>
 
51
  function resetResults() {
52
  document.getElementById('loading').style.display = 'none';
53
+ document.getElementById('summary-result').innerHTML = 'Aqu铆 se mostrar谩 el an谩lisis de los 7 campos clave.';
54
  document.getElementById('json-result').textContent = 'El JSON completo se mostrar谩 aqu铆.';
55
  document.getElementById('summary-display').style.display = 'none';
56
  document.getElementById('json-display').style.display = 'none';
 
84
  const summaryDiv = document.getElementById('summary-result');
85
  const jsonPre = document.getElementById('json-result');
86
 
87
+ // 1. Mostrar el Resumen/Lista
88
  const ul = document.createElement('ul');
89
+ if (data.summary && Array.isArray(data.summary)) {
90
+ data.summary.forEach(point => {
91
+ const li = document.createElement('li');
92
+ li.innerHTML = point;
93
+ ul.appendChild(li);
94
+ });
95
+ }
96
+ summaryDiv.innerHTML = '';
97
  summaryDiv.appendChild(ul);
98
 
99
+ // 2. Mostrar el JSON completo
100
+ if (data.structured_data) {
101
+ jsonPre.textContent = JSON.stringify(data.structured_data, null, 4);
102
+ }
103
 
104
  document.getElementById('summary-display').style.display = 'block';
105
  document.getElementById('json-display').style.display = 'block';
106
 
107
  } else {
108
+ // Muestra el mensaje de error del servidor (incluyendo el diagn贸stico)
109
+ document.getElementById('summary-result').innerHTML = `<strong>Error en el an谩lisis:</strong> ${data.error || 'Mensaje de error desconocido.'}`;
110
+ document.getElementById('json-result').textContent = 'Error al procesar el documento. Revisa el mensaje de la izquierda para ver el detalle.';
111
  }
112
  } catch (error) {
113
+ console.error("Fetch/Parse Error:", error);
114
+ document.getElementById('summary-result').innerHTML = `Ocurri贸 un error de conexi贸n o parseo de respuesta. Consulta la consola del navegador.`;
115
  } finally {
116
  document.getElementById('loading').style.display = 'none';
117
  }