File size: 31,919 Bytes
39a0842
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837480d
 
 
 
39a0842
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88ce971
 
39a0842
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Solicitar Préstamo - FlashLoan</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
        body {
            font-family: 'Inter', sans-serif;
        }
        .form-step {
            display: none;
        }
        .form-step.active {
            display: block;
            animation: fadeIn 0.5s ease-in;
        }
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Header -->
    <header class="bg-white shadow-sm">
        <div class="container mx-auto px-4 py-4 flex justify-between items-center">
            <div class="flex items-center space-x-2">
                <div class="bg-amber-500 p-2 rounded-lg">
                    <i data-feather="zap" class="text-white"></i>
                </div>
                <h1 class="text-2xl font-bold text-gray-800">Flash<span class="text-amber-500">Loan</span></h1>
            </div>
            <div class="flex items-center space-x-4">
                <a href="index.html" class="hidden md:block px-4 py-2 text-gray-600 hover:text-amber-500">
                    <i data-feather="home"></i>
                </a>
                <a href="login.html" class="hidden md:block px-4 py-2 text-gray-600 hover:text-amber-500">
                    <i data-feather="user"></i>
                </a>
</div>
        </div>
    </header>

    <!-- Main Content -->
    <main class="container mx-auto px-4 py-8 md:py-12">
        <div class="max-w-4xl mx-auto bg-white rounded-xl shadow-md overflow-hidden">
            <!-- Progress Steps -->
            <div class="px-6 py-4 border-b border-gray-200">
                <div class="flex justify-between relative">
                    <div class="flex-1 flex flex-col items-center relative z-10">
                        <div class="w-10 h-10 rounded-full bg-amber-500 flex items-center justify-center text-white font-bold mb-2">1</div>
                        <span class="text-sm font-medium text-amber-500">Datos personales</span>
                    </div>
                    <div class="flex-1 flex flex-col items-center relative z-10">
                        <div class="w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center text-gray-500 font-bold mb-2">2</div>
                        <span class="text-sm font-medium text-gray-500">Documentos</span>
                    </div>
                    <div class="flex-1 flex flex-col items-center relative z-10">
                        <div class="w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center text-gray-500 font-bold mb-2">3</div>
                        <span class="text-sm font-medium text-gray-500">Confirmación</span>
                    </div>
                    <div class="absolute top-5 left-0 right-0 h-1 bg-gray-200 z-0">
                        <div class="h-full bg-amber-500 w-1/3"></div>
                    </div>
                </div>
            </div>

            <!-- Form Steps -->
            <form id="loan-form" class="p-6 md:p-8">
                <!-- Step 1: Personal Information -->
                <div class="form-step active" id="step-1">
                    <h2 class="text-2xl font-bold text-gray-800 mb-6">Datos personales</h2>
                    
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div>
                            <label for="rut" class="block text-gray-700 font-medium mb-2">RUT</label>
                            <input type="text" id="rut" name="rut" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500" placeholder="11.111.111-1" required>
                        </div>
                        <div>
                            <label for="nombre" class="block text-gray-700 font-medium mb-2">Nombre completo</label>
                            <input type="text" id="nombre" name="nombre" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500" placeholder="Juan Pérez González" required>
                        </div>
                        <div>
                            <label for="email" class="block text-gray-700 font-medium mb-2">Correo electrónico</label>
                            <input type="email" id="email" name="email" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500" placeholder="juan@example.com" required>
                        </div>
                        <div>
                            <label for="telefono" class="block text-gray-700 font-medium mb-2">Teléfono</label>
                            <input type="tel" id="telefono" name="telefono" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500" placeholder="+56 9 1234 5678" required>
                        </div>
                        <div>
                            <label for="fecha-nacimiento" class="block text-gray-700 font-medium mb-2">Fecha de nacimiento</label>
                            <input type="date" id="fecha-nacimiento" name="fecha-nacimiento" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500" required>
                        </div>
                        <div>
                            <label for="genero" class="block text-gray-700 font-medium mb-2">Género</label>
                            <select id="genero" name="genero" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500" required>
                                <option value="" disabled selected>Seleccione una opción</option>
                                <option value="masculino">Masculino</option>
                                <option value="femenino">Femenino</option>
                                <option value="otro">Otro</option>
                                <option value="prefiero-no-decir">Prefiero no decir</option>
                            </select>
                        </div>
                    </div>

                    <div class="mt-6">
                        <label for="direccion" class="block text-gray-700 font-medium mb-2">Dirección</label>
                        <input type="text" id="direccion" name="direccion" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500" placeholder="Av. Principal 123" required>
                    </div>

                    <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mt-6">
                        <div>
                            <label for="region" class="block text-gray-700 font-medium mb-2">Región</label>
                            <select id="region" name="region" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500" required>
                                <option value="" disabled selected>Seleccione región</option>
                                <option value="arica">Arica y Parinacota</option>
                                <option value="tarapaca">Tarapacá</option>
                                <option value="antofagasta">Antofagasta</option>
                                <option value="atacama">Atacama</option>
                                <option value="coquimbo">Coquimbo</option>
                                <option value="valparaiso">Valparaíso</option>
                                <option value="metropolitana">Metropolitana</option>
                                <option value="ohiggins">O'Higgins</option>
                                <option value="maule">Maule</option>
                                <option value="nuble">Ñuble</option>
                                <option value="biobio">Biobío</option>
                                <option value="araucania">La Araucanía</option>
                                <option value="rios">Los Ríos</option>
                                <option value="lagos">Los Lagos</option>
                                <option value="aysen">Aysén</option>
                                <option value="magallanes">Magallanes</option>
                            </select>
                        </div>
                        <div>
                            <label for="comuna" class="block text-gray-700 font-medium mb-2">Comuna</label>
                            <select id="comuna" name="comuna" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500" required>
                                <option value="" disabled selected>Seleccione comuna</option>
                            </select>
                        </div>
                        <div>
                            <label for="codigo-postal" class="block text-gray-700 font-medium mb-2">Código postal</label>
                            <input type="text" id="codigo-postal" name="codigo-postal" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500" placeholder="1234567">
                        </div>
                    </div>

                    <div class="flex justify-between mt-8">
                        <a href="index.html" class="px-6 py-3 border-2 border-gray-300 text-gray-700 hover:border-amber-500 hover:text-amber-500 rounded-lg font-medium transition duration-300">
                            Cancelar
                        </a>
                        <button type="button" class="px-6 py-3 bg-amber-500 hover:bg-amber-600 text-white rounded-lg font-medium transition duration-300 next-step" data-next="step-2">
                            Siguiente <i data-feather="arrow-right" class="inline ml-2"></i>
                        </button>
                    </div>
                </div>

                <!-- Step 2: Documents -->
                <div class="form-step" id="step-2">
                    <h2 class="text-2xl font-bold text-gray-800 mb-6">Documentación requerida</h2>
                    <p class="text-gray-600 mb-6">Para completar tu solicitud necesitamos que subas los siguientes documentos:</p>

                    <div class="space-y-6">
                        <div class="border-2 border-dashed border-gray-300 rounded-lg p-6 text-center">
                            <div class="flex flex-col items-center">
                                <i data-feather="file-text" class="w-12 h-12 text-gray-400 mb-4"></i>
                                <h3 class="text-lg font-medium text-gray-800 mb-2">Cédula de identidad (frente)</h3>
                                <p class="text-gray-500 mb-4">Formato aceptado: JPG, PNG o PDF (máx. 5MB)</p>
                                <input type="file" id="ci-frente" name="ci-frente" class="hidden" accept="image/*,.pdf">
                                <button type="button" class="px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg font-medium" onclick="document.getElementById('ci-frente').click()">
                                    <i data-feather="upload" class="inline mr-2"></i> Seleccionar archivo
                                </button>
                            </div>
                        </div>

                        <div class="border-2 border-dashed border-gray-300 rounded-lg p-6 text-center">
                            <div class="flex flex-col items-center">
                                <i data-feather="file-text" class="w-12 h-12 text-gray-400 mb-4"></i>
                                <h3 class="text-lg font-medium text-gray-800 mb-2">Cédula de identidad (reverso)</h3>
                                <p class="text-gray-500 mb-4">Formato aceptado: JPG, PNG o PDF (máx. 5MB)</p>
                                <input type="file" id="ci-reverso" name="ci-reverso" class="hidden" accept="image/*,.pdf">
                                <button type="button" class="px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg font-medium" onclick="document.getElementById('ci-reverso').click()">
                                    <i data-feather="upload" class="inline mr-2"></i> Seleccionar archivo
                                </button>
                            </div>
                        </div>

                        <div class="border-2 border-dashed border-gray-300 rounded-lg p-6 text-center">
                            <div class="flex flex-col items-center">
                                <i data-feather="file-text" class="w-12 h-12 text-gray-400 mb-4"></i>
                                <h3 class="text-lg font-medium text-gray-800 mb-2">Comprobante de domicilio</h3>
                                <p class="text-gray-500 mb-4">Ej: Cuenta de luz, agua o teléfono (máx. 5MB)</p>
                                <input type="file" id="comprobante" name="comprobante" class="hidden" accept="image/*,.pdf">
                                <button type="button" class="px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg font-medium" onclick="document.getElementById('comprobante').click()">
                                    <i data-feather="upload" class="inline mr-2"></i> Seleccionar archivo
                                </button>
                            </div>
                        </div>
                    </div>

                    <div class="flex justify-between mt-8">
                        <button type="button" class="px-6 py-3 border-2 border-gray-300 text-gray-700 hover:border-amber-500 hover:text-amber-500 rounded-lg font-medium transition duration-300 prev-step" data-prev="step-1">
                            <i data-feather="arrow-left" class="inline mr-2"></i> Anterior
                        </button>
                        <button type="button" class="px-6 py-3 bg-amber-500 hover:bg-amber-600 text-white rounded-lg font-medium transition duration-300 next-step" data-next="step-3">
                            Siguiente <i data-feather="arrow-right" class="inline ml-2"></i>
                        </button>
                    </div>
                </div>

                <!-- Step 3: Confirmation -->
                <div class="form-step" id="step-3">
                    <h2 class="text-2xl font-bold text-gray-800 mb-6">Confirmación de datos</h2>
                    <p class="text-gray-600 mb-6">Por favor revisa que toda la información sea correcta antes de enviar tu solicitud.</p>

                    <div class="bg-gray-50 rounded-lg p-6">
                        <h3 class="text-lg font-bold text-gray-800 mb-4">Datos personales</h3>
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
                            <div>
                                <p class="text-gray-600">Nombre completo:</p>
                                <p class="font-medium" id="confirm-nombre"></p>
                            </div>
                            <div>
                                <p class="text-gray-600">RUT:</p>
                                <p class="font-medium" id="confirm-rut"></p>
                            </div>
                            <div>
                                <p class="text-gray-600">Correo electrónico:</p>
                                <p class="font-medium" id="confirm-email"></p>
                            </div>
                            <div>
                                <p class="text-gray-600">Teléfono:</p>
                                <p class="font-medium" id="confirm-telefono"></p>
                            </div>
                            <div>
                                <p class="text-gray-600">Fecha de nacimiento:</p>
                                <p class="font-medium" id="confirm-fecha-nacimiento"></p>
                            </div>
                            <div>
                                <p class="text-gray-600">Dirección:</p>
                                <p class="font-medium" id="confirm-direccion"></p>
                            </div>
                        </div>

                        <h3 class="text-lg font-bold text-gray-800 mb-4">Documentos subidos</h3>
                        <div class="space-y-3">
                            <div class="flex items-center">
                                <i data-feather="check-circle" class="text-green-500 mr-2"></i>
                                <span id="confirm-ci-frente" class="text-gray-700">Cédula de identidad (frente)</span>
                            </div>
                            <div class="flex items-center">
                                <i data-feather="check-circle" class="text-green-500 mr-2"></i>
                                <span id="confirm-ci-reverso" class="text-gray-700">Cédula de identidad (reverso)</span>
                            </div>
                            <div class="flex items-center">
                                <i data-feather="check-circle" class="text-green-500 mr-2"></i>
                                <span id="confirm-comprobante" class="text-gray-700">Comprobante de domicilio</span>
                            </div>
                        </div>
                    </div>

                    <div class="mt-6">
                        <div class="flex items-start">
                            <input type="checkbox" id="terminos" name="terminos" class="mt-1 mr-2" required>
                            <label for="terminos" class="text-gray-700">Acepto los <a href="#" class="text-amber-500 hover:underline">términos y condiciones</a> y autorizo el tratamiento de mis datos personales según la <a href="#" class="text-amber-500 hover:underline">política de privacidad</a>.</label>
                        </div>
                    </div>

                    <div class="flex justify-between mt-8">
                        <button type="button" class="px-6 py-3 border-2 border-gray-300 text-gray-700 hover:border-amber-500 hover:text-amber-500 rounded-lg font-medium transition duration-300 prev-step" data-prev="step-2">
                            <i data-feather="arrow-left" class="inline mr-2"></i> Anterior
                        </button>
                        <button type="submit" class="px-6 py-3 bg-green-500 hover:bg-green-600 text-white rounded-lg font-medium transition duration-300">
                            Enviar solicitud <i data-feather="check" class="inline ml-2"></i>
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-8">
        <div class="container mx-auto px-4">
            <div class="text-center">
                <p class="text-gray-400">© 2023 FlashLoan. Todos los derechos reservados.</p>
            </div>
        </div>
    </footer>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            feather.replace();

            // Form step navigation
            document.querySelectorAll('.next-step').forEach(button => {
                button.addEventListener('click', function() {
                    const currentStep = this.closest('.form-step');
                    const nextStepId = this.getAttribute('data-next');
                    const nextStep = document.getElementById(nextStepId);

                    currentStep.classList.remove('active');
                    nextStep.classList.add('active');

                    // Update progress bar
                    const progressBar = document.querySelector('.bg-amber-500');
                    if (nextStepId === 'step-2') {
                        progressBar.style.width = '66%';
                    } else if (nextStepId === 'step-3') {
                        progressBar.style.width = '100%';
                        updateConfirmationData();
                    }

                    // Update step indicators
                    if (nextStepId === 'step-2') {
                        document.querySelectorAll('.flex-1:nth-child(2) div').forEach(el => {
                            el.classList.remove('bg-gray-200', 'text-gray-500');
                            el.classList.add('bg-amber-500', 'text-white');
                        });
                        document.querySelectorAll('.flex-1:nth-child(2) span').forEach(el => {
                            el.classList.remove('text-gray-500');
                            el.classList.add('text-amber-500');
                        });
                    } else if (nextStepId === 'step-3') {
                        document.querySelectorAll('.flex-1:nth-child(3) div').forEach(el => {
                            el.classList.remove('bg-gray-200', 'text-gray-500');
                            el.classList.add('bg-amber-500', 'text-white');
                        });
                        document.querySelectorAll('.flex-1:nth-child(3) span').forEach(el => {
                            el.classList.remove('text-gray-500');
                            el.classList.add('text-amber-500');
                        });
                    }
                });
            });

            document.querySelectorAll('.prev-step').forEach(button => {
                button.addEventListener('click', function() {
                    const currentStep = this.closest('.form-step');
                    const prevStepId = this.getAttribute('data-prev');
                    const prevStep = document.getElementById(prevStepId);

                    currentStep.classList.remove('active');
                    prevStep.classList.add('active');

                    // Update progress bar
                    const progressBar = document.querySelector('.bg-amber-500');
                    if (prevStepId === 'step-1') {
                        progressBar.style.width = '33%';
                    } else if (prevStepId === 'step-2') {
                        progressBar.style.width = '66%';
                    }

                    // Update step indicators
                    if (currentStep.id === 'step-2') {
                        document.querySelectorAll('.flex-1:nth-child(2) div').forEach(el => {
                            el.classList.add('bg-gray-200', 'text-gray-500');
                            el.classList.remove('bg-amber-500', 'text-white');
                        });
                        document.querySelectorAll('.flex-1:nth-child(2) span').forEach(el => {
                            el.classList.add('text-gray-500');
                            el.classList.remove('text-amber-500');
                        });
                    } else if (currentStep.id === 'step-3') {
                        document.querySelectorAll('.flex-1:nth-child(3) div').forEach(el => {
                            el.classList.add('bg-gray-200', 'text-gray-500');
                            el.classList.remove('bg-amber-500', 'text-white');
                        });
                        document.querySelectorAll('.flex-1:nth-child(3) span').forEach(el => {
                            el.classList.add('text-gray-500');
                            el.classList.remove('text-amber-500');
                        });
                    }
                });
            });

            // Region and Comuna selection
            const regionSelect = document.getElementById('region');
            const comunaSelect = document.getElementById('comuna');

            const comunasPorRegion = {
                'arica': ['Arica', 'Camarones', 'Putre', 'General Lagos'],
                'tarapaca': ['Iquique', 'Alto Hospicio', 'Pozo Almonte', 'Camiña', 'Colchane', 'Huara', 'Pica'],
                'antofagasta': ['Antofagasta', 'Mejillones', 'Sierra Gorda', 'Taltal', 'Calama', 'Ollagüe', 'San Pedro de Atacama', 'Tocopilla', 'María Elena'],
                'atacama': ['Copiapó', 'Caldera', 'Tierra Amarilla', 'Chañaral', 'Diego de Almagro', 'Vallenar', 'Alto del Carmen', 'Freirina', 'Huasco'],
                'coquimbo': ['La Serena', 'Coquimbo', 'Andacollo', 'La Higuera', 'Paiguano', 'Vicuña', 'Illapel', 'Canela', 'Los Vilos', 'Salamanca', 'Ovalle', 'Combarbalá', 'Monte Patria', 'Punitaqui', 'Río Hurtado'],
                'valparaiso': ['Valparaíso', 'Casablanca', 'Concón', 'Juan Fernández', 'Puchuncaví', 'Quintero', 'Viña del Mar', 'Isla de Pascua', 'Los Andes', 'Calle Larga', 'Rinconada', 'San Esteban', 'La Ligua', 'Cabildo', 'Papudo', 'Petorca', 'Zapallar', 'Quillota', 'Calera', 'Hijuelas', 'La Cruz', 'Nogales', 'San Antonio', 'Algarrobo', 'Cartagena', 'El Quisco', 'El Tabo', 'Santo Domingo', 'San Felipe', 'Catemu', 'Llaillay', 'Panquehue', 'Putaendo', 'Santa María', 'Quilpué', 'Limache', 'Olmué', 'Villa Alemana'],
                'metropolitana': ['Santiago', 'Cerrillos', 'Cerro Navia', 'Conchalí', 'El Bosque', 'Estación Central', 'Huechuraba', 'Independencia', 'La Cisterna', 'La Florida', 'La Granja', 'La Pintana', 'La Reina', 'Las Condes', 'Lo Barnechea', 'Lo Espejo', 'Lo Prado', 'Macul', 'Maipú', 'Ñuñoa', 'Pedro Aguirre Cerda', 'Peñalolén', 'Providencia', 'Pudahuel', 'Quilicura', 'Quinta Normal', 'Recoleta', 'Renca', 'San Joaquín', 'San Miguel', 'San Ramón', 'Vitacura', 'Puente Alto', 'Pirque', 'San José de Maipo', 'Colina', 'Lampa', 'Tiltil', 'San Bernardo', 'Buin', 'Calera de Tango', 'Paine', 'Melipilla', 'Alhué', 'Curacaví', 'María Pinto', 'San Pedro', 'Talagante', 'El Monte', 'Isla de Maipo', 'Padre Hurtado', 'Peñaflor'],
                'ohiggins': ['Rancagua', 'Codegua', 'Coinco', 'Coltauco', 'Doñihue', 'Graneros', 'Las Cabras', 'Machalí', 'Malloa', 'Mostazal', 'Olivar', 'Peumo', 'Pichidegua', 'Quinta de Tilcoco', 'Rengo', 'Requínoa', 'San Vicente', 'Pichilemu', 'La Estrella', 'Litueche', 'Marchihue', 'Navidad', 'Paredones', 'San Fernando', 'Chépica', 'Chimbarongo', 'Lolol', 'Nancagua', 'Palmilla', 'Peralillo', 'Placilla', 'Pumanque', 'Santa Cruz'],
                'maule': ['Talca', 'Constitución', 'Curepto', 'Empedrado', 'Maule', 'Pelarco', 'Pencahue', 'Río Claro', 'San Clemente', 'San Rafael', 'Cauquenes', 'Chanco', 'Pelluhue', 'Curicó', 'Hualañé', 'Licantén', 'Molina', 'Rauco', 'Romeral', 'Sagrada Familia', 'Teno', 'Vichuquén', 'Linares', 'Colbún', 'Longaví', 'Parral', 'Retiro', 'San Javier', 'Villa Alegre', 'Yerbas Buenas'],
                'nuble': ['Chillán', 'Bulnes', 'Chillán Viejo', 'El Carmen', 'Pemuco', 'Pinto', 'Quillón', 'San Ignacio', 'Yungay', 'Quirihue', 'Cobquecura', 'Coelemu', 'Ninhue', 'Portezuelo', 'Ránquil', 'Treguaco', 'San Carlos', 'Coihueco', 'Ñiquén', 'San Fabián', 'San Nicolás'],
                'biobio': ['Concepción', 'Coronel', 'Chiguayante', 'Florida', 'Hualpén', 'Hualqui', 'Lota', 'Penco', 'San Pedro de la Paz', 'Santa Juana', 'Talcahuano', 'Tomé', 'Los Ángeles', 'Antuco', 'Cabrero', 'Laja', 'Mulchén', 'Nacimiento', 'Negrete', 'Quilaco', 'Quilleco', 'San Rosendo', 'Santa Bárbara', 'Tucapel', 'Yumbel', 'Alto Biobío', 'Lebu', 'Arauco', 'Cañete', 'Contulmo', 'Curanilahue', 'Los Álamos', 'Tirúa'],
                'araucania': ['Temuco', 'Carahue', 'Cunco', 'Curarrehue', 'Freire', 'Galvarino', 'Gorbea', 'Lautaro', 'Loncoche', 'Melipeuco', 'Nueva Imperial', 'Padre las Casas', 'Perquenco', 'Pitrufquén', 'Pucón', 'Saavedra', 'Teodoro Schmidt', 'Toltén', 'Vilcún', 'Villarrica', 'Cholchol', 'Angol', 'Collipulli', 'Curacautín', 'Ercilla', 'Lonquimay', 'Los Sauces', 'Lumaco', 'Purén', 'Renaico', 'Traiguén', 'Victoria'],
                'rios': ['Valdivia', 'Corral', 'Lanco', 'Los Lagos', 'Máfil', 'Mariquina', 'Paillaco', 'Panguipulli', 'La Unión', 'Futrono', 'Lago Ranco', 'Río Bueno'],
                'lagos': ['Puerto Montt', 'Calbuco', 'Cochamó', 'Fresia', 'Frutillar', 'Los Muermos', 'Llanquihue', 'Maullín', 'Puerto Varas', 'Castro', 'Ancud', 'Chonchi', 'Curaco de Vélez', 'Dalcahue', 'Puqueldón', 'Queilén', 'Quellón', 'Quemchi', 'Quinchao', 'Osorno', 'Puerto Octay', 'Purranque', 'Puyehue', 'Río Negro', 'San Juan de la Costa', 'San Pablo', 'Chaitén', 'Futaleufú', 'Hualaihué', 'Palena'],
                'aysen': ['Coihaique', 'Lago Verde', 'Aysén', 'Cisnes', 'Guaitecas', 'Cochrane', 'O\'Higgins', 'Tortel', 'Chile Chico', 'Río Ibáñez'],
                'magallanes': ['Punta Arenas', 'Laguna Blanca', 'Río Verde', 'San Gregorio', 'Cabo de Hornos (Ex Navarino)', 'Antártica', 'Porvenir', 'Primavera', 'Timaukel', 'Natales', 'Torres del Paine']
            };

            regionSelect.addEventListener('change', function() {
                comunaSelect.innerHTML = '<option value="" disabled selected>Seleccione comuna</option>';
                
                if (this.value) {
                    const comunas = comunasPorRegion[this.value];
                    comunas.forEach(comuna => {
                        const option = document.createElement('option');
                        option.value = comuna.toLowerCase().replace(/\s+/g, '-');
                        option.textContent = comuna;
                        comunaSelect.appendChild(option);
                    });
                }
            });

            // File upload preview
            document.getElementById('ci-frente').addEventListener('change', function() {
                if (this.files.length > 0) {
                    document.getElementById('confirm-ci-frente').textContent = this.files[0].name;
                }
            });

            document.getElementById('ci-reverso').addEventListener('change', function() {
                if (this.files.length > 0) {
                    document.getElementById('confirm-ci-reverso').textContent = this.files[0].name;
                }
            });

            document.getElementById('comprobante').addEventListener('change', function() {
                if (this.files.length > 0) {
                    document.getElementById('confirm-comprobante').textContent = this.files[0].name;
                }
            });

            // Form submission
            document.getElementById('loan-form').addEventListener('submit', function(e) {
                e.preventDefault();
                window.location.href = 'prestamo_aprobado.html';
// Here you would typically send the form data to your backend
            });

            // Update confirmation data
            function updateConfirmationData() {
                document.getElementById('confirm-nombre').textContent = document.getElementById('nombre').value;
                document.getElementById('confirm-rut').textContent = document.getElementById('rut').value;
                document.getElementById('confirm-email').textContent = document.getElementById('email').value;
                document.getElementById('confirm-telefono').textContent = document.getElementById('telefono').value;
                document.getElementById('confirm-fecha-nacimiento').textContent = document.getElementById('fecha-nacimiento').value;
                document.getElementById('confirm-direccion').textContent = document.getElementById('direccion').value + ', ' + 
                    document.querySelector('#region option:checked').textContent + ', ' + 
                    document.querySelector('#comuna option:checked').textContent;
            }
        });
    </script>
</body>
</html>