46 lines
1.4 KiB
HTML
46 lines
1.4 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">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>
|
|
fetch('/detectBadge')
|
|
.then(response => response.json())
|
|
.then(jsonresponse => {
|
|
if (jsonresponse.status == "OK") {
|
|
document.getElementById("info").textContent = "Tentative de copie du badge ...";
|
|
return fetch('/readBadge');
|
|
} else {
|
|
throw new Error(jsonresponse.message);
|
|
}
|
|
})
|
|
.then(response => response.json())
|
|
.then(jsonresponse => {
|
|
if (jsonresponse.status == "OK") {
|
|
window.location.href = `/wait?raison=Appuyer%20sur%20le%20bouton%20pour%20commencer%20la%20copie%20des%20badges.&redirect=/writeBadge/{{nbBadge}}/${jsonresponse.UID}`;
|
|
} else {
|
|
throw new Error(jsonresponse.message);
|
|
}
|
|
})
|
|
.catch(error => {
|
|
window.location.href = `/?error=${error.message}`;
|
|
});
|
|
</script>
|