forked from danielsanchez68/nt2-21d-ejercicio2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
200 lines (190 loc) · 7.12 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>NT2 Ivan Ramis - YA21D</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"></script>
</head>
<div class="container-fluid mt-3" id="app">
<input type="text" class="form-control col-12 m-1" v-model="criterioDeBusqueda" placeholder="Ingresar un criterio de busqueda...">
<div class="input-group">
<input type="text" class="form-control col-6 m-1" v-model="busquedaPorNombre" placeholder="Ingrese nombre a buscar">
<input type="number" class="form-control col-6 m-1" v-model="busquedaPorDNI" placeholder="Ingrese DNI a buscar">
</div>
<br>
<div class="row" v-if="alertaCaracteres">
<div class="col-12">
<div class="alert alert-danger">Debe ingresar al menos 3 caracteres</div>
</div>
</div>
<div class="card-deck m-0">
<div class="row">
<div class="col" v-for="persona in personasFiltradas">
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">{{getNombreCompleto(persona)}}</h5>
<p class="card-text">dni {{persona.dni}}</p>
<a href="#" class="card-link">{{persona.correo}}</a>
</div>
</div>
</div>
</div>
</div>
</div>
</html>
<script>
new Vue({
el: '#app',
data: {
criterioDeBusqueda: '',
busquedaPorNombre: '',
busquedaPorDNI: '',
//Aquí, en este array es donde tienen que agregar su información
personas: [
{
nombre: "Pablo Lucas",
apellido: "Slaj",
correo: "pablo.slaj@gmail.com",
dni: "36696704"
},
{
nombre: "LUCAS EZEQUIEL",
apellido: "MAZZONI",
correo: "hellolucasm@gmail.com",
dni: "42253191"
},
{
nombre: "Miguel Hernan",
apellido: "Pinella",
correo: "mhpinella@gmail.com",
dni: "37932974"
},
{
nombre: "Fernando",
apellido: "Bernasconi",
correo: "fernandobernasconi@gmail.com",
dni: "36191270"
},
{
nombre: "Cristian",
apellido: "Cometti",
correo: "cometticristian@gmail.com",
dni: "35716158"
},
{
nombre: "Martin",
apellido: "Gruber",
correo: "martogruber@hotmail.com",
dni: "40537273"
},
{
nombre: "Juan Ignacio",
apellido: "Lotito",
correo: "juanilotito@gmail.com",
dni: "40971614"
},
{
nombre: "Miguel Angel",
apellido: "Traversaro",
correo: "migueltraversaro@gmail.com",
dni: "39067992"
},
{
nombre: "Lautaro",
apellido: "Valenzuela",
correo: "lautarovalenzuela94@gmail.com",
dni: "43815634"
},
{
nombre: "MELANY CRISTINA",
apellido: "RUIZ",
correo: "melanyruiz12@gmail.com",
dni: "40007529"
},
{
nombre: "Gabriela",
apellido: "Alba",
correo: "gabriela.alba24@gmail.com",
dni: "18905522"
},
{
nombre: "GISELLA MARIA",
apellido: "ARAMAYO",
correo: "gisella.aramayo@gmail.com",
dni: "38511609"
},
{
nombre: "FEDERICO MARTIN",
apellido: "CRISCUOLO",
correo: "fc@criscuolo.com.ar",
dni: "30664318"
},
{
nombre: "SALMA ROCIO",
apellido: "DERMISACHE",
correo: "salma.dermisache@gmail.com",
dni: "42252693"
},
{
nombre: "BELEN ELIZABETH",
apellido: "ROMERO",
correo: "beellromero@gmail.com",
dni: "38983628"
},
{
nombre: "FEDERICO ARIEL",
apellido: "VAZQUEZ",
correo: "federicoarielvazquez@gmail.com",
dni: "29752258"
},
{
nombre: "Ivan",
apellido: "Ramis",
correo: "ivanra48@gmail.com",
dni: "36397441"
},
{
nombre: "LUCAS",
apellido: "AUPI",
correo: "lucas-aupi@hotmail.com",
dni: "39077076"
},
{
nombre: "Andres",
apellido: "Distefano",
correo: "ahdistefano@gmail.com",
dni: "36806982"
},
{
nombre: "ALEJO MANUEL",
apellido: "GARCIA",
correo: "ale.garciaa210@gmail.com",
dni: "37859210"
}
]
},
computed: {
personasFiltradas() {
return this.personas.filter((persona) => {
let registroCompleto = `${persona.nombre} ${persona.apellido} ${persona.dni} ${persona.correo}`
let nombre = `${persona.nombre}`
let dni = `${persona.dni}`
return registroCompleto.toLowerCase().includes(this.criterioDeBusqueda.toLowerCase()) &&
nombre.toLowerCase().includes(this.busquedaPorNombre.toLowerCase()) && dni.includes(this.busquedaPorDNI)
});
},
alertaCaracteres(){
return this.busquedaPorNombre.length < 3 && this.busquedaPorDNI.length < 3 && (this.busquedaPorNombre.length > 0 || this.busquedaPorDNI.length > 0)
}
},
methods: {
getNombreCompleto(persona) {
return `${persona.nombre} ${persona.apellido}`
}
}
});
</script>