Commit e8bb82bf authored by Rodrigo Diez's avatar Rodrigo Diez

Boton y contadores añadidos

parent 2dace895
......@@ -18,22 +18,29 @@
<div class="container mt-5">
<div class="row">
<div class="col-md-4 order-md-2 mb-4">
<h4 class="d-flex justify-content-between align-items-center mb-3">
<span class="text-muted">Sorteos Realizados</span>
<span class="badge badge-secondary badge-pill" id="sTotales">0</span>
</h4>
<h4 class="d-flex justify-content-between align-items-center mb-3">
<span class="text-muted">Premios Totales</span>
<span class="badge badge-secondary badge-pill">3</span>
<span class="badge badge-secondary badge-pill" id="totales">0</span>
</h4>
<ul class="list-group mb-3">
<li class="list-group-item d-flex justify-content-between lh-condensed">
<div>
<h6 class="my-0">Primer Premio</h6>
<small class="text-muted">Numero exacto</small>
<span class="badge badge-secondary" id="primerosT">0</span>
</div>
<span class="text-muted" id="primeros">0€</span>
</li>
<li class="list-group-item d-flex justify-content-between lh-condensed">
<div>
<h6 class="my-0">Segundo Premio</h6>
<small class="text-muted">Mismas cifras en orden diferente</small>
<span class="badge badge-secondary" id="segundosT">0</span>
</div>
<span class="text-muted" id="segundos">0€</span>
</li>
......@@ -41,20 +48,21 @@
<div>
<h6 class="my-0">Tercer Premio</h6>
<small class="text-muted">Dos ultimas o primeras cifras</small>
<span class="badge badge-secondary" id="tercerosT">0</span>
</div>
<span class="text-muted" id="terceros"></span>
<span class="text-muted" id="terceros">0</span>
</li>
<li class="list-group-item d-flex justify-content-between lh-condensed">
<div>
<h6 class="my-0">Reintegro</h6>
<small class="text-muted">Empiece o final</small>
<span class="badge badge-secondary" id="reintegrosT">0</span>
</div>
<span class="text-muted" id="reintegros">0€</span>
</li>
<li class="list-group-item d-flex justify-content-between bg-light">
<div class="text-success">
<h6 class="my-0">Total Premiado</h6>
<small>EXAMPLECODE</small>
</div>
<span class="text-success" id="total">0 €</span>
</li>
......@@ -64,41 +72,44 @@
<div class="col-md-8 order-md-1 text-center">
<h4 class="mb-3 text-center">Numero Sorteado</h4>
<div class="row">
<h4 class="mb-3 text-center">Numero Sorteado</h4>
<div class="row">
<div class="offset-md-1 col-md-3 mb-3">
<input type="text" class="form-control text-center" id="sorteado0" placeholder="" value="" disabled>
</div>
<div class="offset-md-1 col-md-3 mb-3">
<input type="text" class="form-control text-center" id="sorteado0" placeholder="" value="" disabled>
</div>
<div class="col-md-3 mb-3 text-center">
<input type="text" class="form-control text-center" id="sorteado1" placeholder="" value="" disabled>
</div>
<div class="col-md-3 mb-3 text-center">
<input type="text" class="form-control text-center" id="sorteado1" placeholder="" value="" disabled>
</div>
<div class="col-md-3 mb-3 text-center">
<input type="text" class="form-control text-center" id="sorteado2" placeholder="" value="" disabled>
</div>
<div class="col-md-3 mb-3 text-center">
<input type="text" class="form-control text-center" id="sorteado2" placeholder="" value="" disabled>
</div>
</div>
<h4 class="mb-3 text-center mt-5">Numero Jugado</h4>
<div class="row">
<div class="offset-md-1 col-md-3 mb-3">
<input type="text" class="form-control text-center" id="firstName" placeholder="" value="" required>
</div>
<div class="col-md-3 mb-3">
<input type="text" class="form-control text-center" id="lastName" placeholder="" value="" required>
</div>
<div class="col-md-3 mb-3">
<input type="text" class="form-control text-center" id="lastName" placeholder="" value="" required>
</div>
</div>
</div>
<h4 class="mb-3 text-center mt-5">Numero Jugado</h4>
<div class="row">
<div class="offset-md-1 col-md-3 mb-3">
<input type="text" class="form-control text-center" id="propio0" placeholder="" value="" required>
</div>
<div class="col-md-3 mb-3">
<input type="text" class="form-control text-center" id="propio1" placeholder="" value="" required>
</div>
<div class="col-md-3 mb-3">
<input type="text" class="form-control text-center" id="propio2" placeholder="" value="" required>
</div>
</div>
<div class="row">
<div class="col-md-5 mx-auto">
<button class="btn btn-primary btn-lg btn-block" id="iniciar">Iniciar</button>
</div>
</div>
</div>
</div>
</div>
......
......@@ -2,6 +2,7 @@ let primeros = 0;
let segundos = 0;
let terceros = 0;
let reintegros = 0;
let totales = 0;
/**
......@@ -55,36 +56,45 @@ function comprobarTriplex(numeroSorteado,numeroPropio){
premios += 150;
repartoPremios[0]++;
primeros+=150;
totales++;
document.getElementById("primeros").textContent = `${primeros} €`;
document.getElementById("primerosT").textContent++;
}else if(comprobarMezcla(stringSorteado, numeroPropio)){
premios += 10;
repartoPremios[1]++;
segundos+=10;
totales++;
document.getElementById("segundos").textContent = `${segundos} €`;
document.getElementById("segundosT").textContent++;
}else if((numeroSorteado[0] == numeroPropio[0] && numeroSorteado[1] == numeroPropio[1]) || (numeroSorteado[1] == numeroPropio[1] && numeroSorteado[2] == numeroPropio[2])){
premios += 2;
repartoPremios[2]++;
terceros+=2;
totales++;
document.getElementById("terceros").textContent = `${terceros} €`;
document.getElementById("tercerosT").textContent++;
}else if(numeroSorteado[0] == numeroPropio[0] || numeroSorteado[2] == numeroPropio[2]){
premios += 0.5;
repartoPremios[3]++;
reintegros+=0.5;
totales++;
document.getElementById("reintegros").textContent = `${reintegros} €`;
document.getElementById("reintegrosT").textContent++;
}
document.getElementById("total").textContent = `${premios} €`;
document.getElementById("totales").textContent = `${totales}`;
}
function sorteo(cifras, veces){
contador++;
gastos += 0.5;
let numeroPropio = [4,6,8];
let numeroPropio = conseguirPropio();
let numeroSorteado = numeroAleatorio(cifras);
mostrarSortado(numeroSorteado);
console.log(numeroSorteado);
comprobarTriplex(numeroSorteado, numeroPropio);
console.log(`Dinero Gastado ${gastos} Dinero Ganado ${premios} Reparto de premios ${repartoPremios}`);
document.getElementById("sTotales").textContent++;
if (contador >= veces){
window.clearInterval(temp);
}
......@@ -113,6 +123,17 @@ function mostrarPropio(numero){
document.getElementById("propio1").value = numero[1];
document.getElementById("propio2").value = numero[2];
}
function conseguirPropio(){
let numero = [];
numero[0] = document.getElementById("propio0").value;
numero[1] = document.getElementById("propio1").value;
numero[2] = document.getElementById("propio2").value;
return numero;
}
iniciar = document.getElementById("iniciar");
iniciar.addEventListener("click", (e)=>{
iniciar.preventDefault;
iniciarTemporizador(20, 1000, 3);
})
iniciarTemporizador(20, 1000, 3);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment