Ajout du projet

This commit is contained in:
j4rj4R
2020-08-25 09:49:07 +02:00
parent a9291727f5
commit 1a13ed504d
6 changed files with 306 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
<!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">Badge Cloner</h1>
{% if error is defined %}
<p class="has-text-danger"> {{ error }}</p>
{% endif %}
<h2 class="subtitle">Choisir le nombre de badges à cloner :</h2>
<div class=" is-centered">
<form action="/waitingBadge" method="get">
<input name="nbBadge" class="input" min="1" value="1" required type="number"/>
<hr>
<button class="control button is-primary is-large">Clonage</button>
</form>
</div>
</div>
</div>
</section>
</div>
</body>
</html>
+22
View File
@@ -0,0 +1,22 @@
<!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">Page d'attente</h1>
<h2 id="info" class="subtitle">{{raison}}</h2>
<a href="{{redirect}}" class="button is-link">Suivant</a>
</div>
</div>
</section>
</div>
</body>
</html>
+48
View File
@@ -0,0 +1,48 @@
<!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">Badge du client</h1>
<h2 id="info" class="subtitle">En attente du badge à copier ...</h2>
<a href="/" class="button is-link">Annuler</a>
</div>
</div>
</section>
</div>
</body>
</html>
<script>
var xhr = new XMLHttpRequest();
xhr.open('GET', '/detectBadge', true);
xhr.onload = function() {
var jsonreponse = JSON.parse(xhr.response);
if (jsonreponse.status == "OK") {
document.getElementById("info").textContent = "Tentative de copie du badge ...";
var xhr2 = new XMLHttpRequest();
xhr2.open('GET', '/readBadge', true);
xhr2.onload = function() {
var jsonreponse = JSON.parse(xhr2.response);
if (jsonreponse.status == "OK") {
window.location.href = "/wait?raison=Appuyer%20sur%20le%20bouton%20pour%20commencer%20la%20copie%20des%20badges.&redirect=/writeBadge/{{nbBadge}}/" + jsonreponse.UID;
} else {
window.location.href = "/?error=" + jsonreponse.message;
}
};
xhr2.send(null);
} else {
window.location.href = "/?error=" + jsonreponse.message;
}
};
xhr.send(null);
</script>
+52
View File
@@ -0,0 +1,52 @@
<!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>