BadgeCloner/templates/writeBadge.html
2020-08-25 09:49:07 +02:00

53 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html lang="fr">
<head>
<title>Badge Cloner</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="author" content="j4rj4r">
<link rel="stylesheet" href="/res/css/bulma/bulma.min.css">
</head>
<body>
<div class="container is-fluid">
<section class="hero"><div class="hero-body">
<div class="container has-text-centered">
<h1 class="title is-spaced">Vos badges</h1>
<h2 class="subtitle">En attente du badge numéro {{nbBadge}}</h2>
{% if error is defined %}
<p class="has-text-danger"> {{ error }}</p>
{% endif %}
<a href="/" class="button is-link">Annuler</a>
</div>
</div>
</section>
</div>
</body>
</html>
<script>
if ({{nbBadge}} >= 1) {
var xhr = new XMLHttpRequest();
xhr.open('GET', '/copyBadge/{{uid}}', true);
xhr.onload = function() {
var jsonreponse = JSON.parse(xhr.response);
if (jsonreponse.status == "OK") {
//console.log("Badge cloné")
if ({{nbBadge-1}} == 0 ){
window.location.href = "/wait?raison=Tous%20les%20badges%20sont%20copi%C3%A9s%20%21&redirect=/";
}
else{
window.location.href = "/wait?raison=Badge%20clon%C3%A9%20%21%20Appuyer%20sur%20le%20bouton%20pour%20passer%20au%20badge%20suivant.&redirect=/writeBadge/{{nbBadge-1}}/{{uid}}";
}
} else {
window.location.href = "/writeBadge/{{nbBadge}}/{{uid}}" + "?error=" + jsonreponse.message;
}
};
xhr.send(null);
} else {
window.location.href = "/"
}
</script>