-
Notifications
You must be signed in to change notification settings - Fork 0
/
Index.php
153 lines (150 loc) · 8.03 KB
/
Index.php
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
<?php include("includes/header.php"); ?>
<div class="container p-4">
<?php
if (isset($_SESSION['message'])) {
?>
<div class="alert alert-<?= $_SESSION['message_type'] ?> alert-dismissible">
<button type="button" class="close" data-dismiss="alert">×</button>
<?= $_SESSION['message'] ?>
</div>
<?php session_unset();
} ?>
<h1 class="text-info text-center">Formulario para enviar información</h1>
<form name="formCuotas" method="POST" action="data.php" class="needs-validation" novalidate onKeypress="if(event.keyCode == 13) event.returnValue = false;">
<?php
#region Realizar selects
include("includes/personalData.php");
$tipoDni = array_reverse(array("", "Cédula", "Pasaporte", "Cédula extranjería", "Tarjeta de Identidad"));
$estadoCivil = array_reverse(array("", "Soltero", "Casado", "Separado"));
$cantidadCuotas = [0, 6, 12, 18, 24, 36, 48, 60];
$personalData = new DatosPersonales();
#endregion
?>
<div class="form-group">
<div class="form-group">
<label for="valorPrestar">Ingresar la cantidad que deseas prestar:</label>
<input type="text" class="form-control" name="cantidadPrestamo" placeholder="Ingresa la cabtidad a prestar" onkeypress="pulsar()" required id="ensayo">
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group">
<label for="valorPrestar">Selecciona la cantidad de cuotas/meses:</label>
<?php
echo $personalData->crear_listado_cantidad_cuotas(array_reverse($cantidadCuotas), "cuotas");
?>
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group">
<label for="dni">Documento de identidad:</label>
<input type="text" class="form-control" id="dni" placeholder="Ingresa tu documento" name="numeroDni" required maxlength="10" minlength="7">
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group">
<label for="sel1">Seleccionar tipo de documento:</label>
<?php
echo $personalData->crearSelectListaDni($tipoDni, "selectTipoDni");
?>
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group">
<label for="dni">Ingresa tu Nombre(es):</label>
<input type="text" class="form-control" id="dni" placeholder="Ingresa tu nombre" name="nombresCliente" required>
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group">
<label for="dni">Ingresa tus apellidos:</label>
<input type="text" class="form-control" id="dni" placeholder="Ingresa tu nombre" name="apellidosCliente" required>
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group">
<label for="fechaNacimiento">Fecha de nacimiento:</label>
<input type="date" id="fechaNacimiento" name="fechaNacimiento">
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group">
<label for="numCel">Ingresa Número celular:</label>
<input type="tel" class="form-control" id="numCel" placeholder="Número celular" name="numeroCelular" required minlength="7">
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group">
<label for="direccion">Dirección de residencia:</label>
<input type="text" class="form-control" id="direccion" placeholder="Ingresa tu dirección de residencia" name="direccionCasa" required>
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group">
<label for="depto">Departamento de residencia:</label>
<input type="text" class="form-control" id="depto" placeholder="Ingresa tu departamento de residencia" name="deptoResidencia" required>
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group">
<label for="ciudad">Ciudad de residencia:</label>
<input type="text" class="form-control" id="ciudad" placeholder="Ingresa tu ciudad de residencia" name="ciudadResidencia" required>
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group">
<label for="sel2">Seleccionar Estado Civil:</label>
<?php
echo $personalData->crear_listado_estado_civil($estadoCivil, "selectEstadoCivil");
?>
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group">
<label for="correo">Correo Electrónico:</label>
<input type="email" class="form-control" placeholder="Ingresa tu Email" id="correo" name="emailCliente" required>
<div class="valid-feedback">Valid.</div>
<div class="invalid-feedback">Por favor llena este campo.</div>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" name="remember" required> Aceptar el envío de datos.
<div class="valid-feedback">Campo completado</div>
<div class="invalid-feedback">Check this checkbox to continue.</div>
</label>
</div>
<button type="submit" class="btn btn-primary" name="save_client">Enviar datos</button>
<button type="reset" class="btn btn-danger" onclick="limpiaCampos()">Limpiar campos</button>
</form>
</div>
<script>
function limpiaCampos() {
Swal.fire({
position: 'center',
icon: 'success',
title: 'Se han limpiado los campos',
showConfirmButton: true,
timer: 3800
})
}
</script>
<?php include("includes/footer.php"); ?>
</body>
<script>
// Disable form submissions if there are invalid fields
(function() {
'use strict';
window.addEventListener('load', function() {
// Get the forms we want to add validation styles to
var forms = document.getElementsByClassName('needs-validation');
// Loop over them and prevent submission
var validation = Array.prototype.filter.call(forms, function(form) {
form.addEventListener('submit', function(event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();