Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
369 changes: 56 additions & 313 deletions README.md

Large diffs are not rendered by default.

Binary file added src/imágenes/check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imágenes/logo.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imágenes/mantenimiento.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imágenes/protopapel.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imágenes/prototipo.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imágenes/prototipo1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imágenes/prototipo2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imágenes/test.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imágenes/visa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imágenes/x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 41 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,49 @@
<meta charset="utf-8">
<title>Tarjeta de crédito válida</title>
<link rel="stylesheet" href="style.css" />
<link rel="icon" type="image/png" href="imágenes/logo.PNG">
<meta name="viewport" content="with=device-with, initial-scale=1.0">
</head>
<body>
<header></header>
<main></main>
<footer></footer>
<header>
<hr>
<div id= "logo">
<img src="imágenes/logo.PNG">
</div>
</header>
<main>
<div id="inicio">
<h1>Finalizar compra</h1>
<p id = "ingresaremail">Ingrese su email para continuar</p>
<input type="text" name="email" id="email" placeholder="[email protected]"> <br>
<button type="button" id="btn1">Continuar</button>
</div>
<div id="segundo">
<h2>Validación de tarjeta</h2>
<p id= "esimportantevalidar">Es importante validar su tarjeta para continuar la compra</p>
<form action="" class="formulario">
<label for="creditCardNumber" class="form--label1">Número de tarjeta</label> <br>
<input type="text" id="creditCardNumber" maxlength = "16" class="form--input1"> <br>
<label for="nameCliente" class="form--label2">Nombre y apellido que figura en la tarjeta</label> <br>
<input type="text" id="nameCliente" class="form--input2"> <br>
</form>
<div id="logovisa">
<img src="imágenes/visa.png">
</div>
<button type="button" id="btn2">Validar</button>
<div id = "status1"></div>
</div>
<div id = "status2">
<img src="imágenes/check.png">
<p id= "tarjetaválida"><p>
<p id="continuarcompra">Continuar con la compra <a href="http://127.0.0.1:5500/src/p%C3%A1gina%20en%20construcci%C3%B3n.html">aquí</a>
</p>
</div>
<div id = "status3">
<img src="imágenes/x.png">
<p id= "tarjetainválida"></p>
</div>
</main>
<script src="index.js" type="module"></script>
</body>
</html>
50 changes: 49 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
import validator from './validator.js';

console.log(validator);
const btn1 = document.getElementById('btn1'); // BOTÓN FORMULARIO 'inicio'
btn1.addEventListener('click', () => {
const email = document.getElementById('email').value;
if (email === '') {
document.getElementById('email').focus();
} else {
document.getElementById('email').focus();
document.getElementById('inicio').style.display='none';
document.getElementById('segundo').style.display='block';
}
});

const btn2 = document.getElementById('btn2'); // BOTÓN FORMULARIO 'segundo'
btn2.addEventListener('click', () => {

const creditCardNumber = document.getElementById('creditCardNumber').value;
const nameCliente = document.getElementById('nameCliente').value;

if (creditCardNumber === '' && nameCliente === '') {
document.getElementById('status1').innerHTML= 'Ingresar datos requeridos';
} else {
const numeroTarjeta = document.getElementById('creditCardNumber');
const isValidCardNumber = validator.isValid(numeroTarjeta.value);

const numeroTarjetaEncriptado = validator.maskify(numeroTarjeta.value);
numeroTarjeta.value = numeroTarjetaEncriptado;

if (isValidCardNumber === true) {
document.getElementById('tarjetaválida').innerHTML= 'Tarjeta ingresada válida';
document.getElementById('status1').style.display='none';
document.getElementById('status2').style.display='block';
// setTimeout('document.location.reload()',20000);
} else {
document.getElementById('tarjetainválida').innerHTML= 'Tarjeta ingresada inválida';
document.getElementById('status1').style.display='none';
document.getElementById('status3').style.display='block';
// setTimeout('document.location.reload()',10000);
}

}


});






23 changes: 23 additions & 0 deletions src/página en construcción.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Página en construcción</title>
<link rel="stylesheet" href="style.css" />
<link rel="icon" type="image/png" href="imágenes/logo.PNG">
</head>
<body>
<header>
<hr>
<div id= "logo">
<img src="imágenes/logo.PNG">
</div>
</header>
<main>
<div id= "fondo">
<img src="imágenes/mantenimiento.png">
</div>
</main>
<script src="index.js" type="module"></script>
</body>
</html>
Loading