Implémenter page web de scan de présence

Voir diff pour détails
This commit is contained in:
Victor Lacasse-Beaudoin 2023-09-17 16:32:40 -04:00
parent c6f3a52f91
commit c218860e33
10 changed files with 139 additions and 10 deletions

View file

@ -1,7 +1,25 @@
{{ define "index-html" }}
<h2>agecem/bottin-ag</h2>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AGECEM | Assemblée Générale</title>
<script src="/public/js/htmx.min.js"></script>
<script src="/public/js/membreid-selected-and-cleared.js"></script>
</head>
<body>
<h2>Présences en Assemblée Générale</h2>
<h3>StatusCode: {{ .StatusCode }}</h3>
<h3>Message: {{ .Message }}</h3>
<h3>Error: {{ .Error }}</h3>
{{ if .Error }}<h3>Error: {{ .Error }}</h3>{{ end }}
<form action="" hx-post="/scan" hx-target="#app-content">
<label for="membre_id">Numéro étudiant:</label>
<input id="membre_id" name="membre_id" value="" required />
<button type="submit">enregistrer</button>
</form>
<div id="app-content">
</div>
</body>
</html>
{{ end }}

View file

@ -0,0 +1,3 @@
{{ define "scan-html" }}
<h3>{{ .Message }}</h3>
{{ end }}

1
webcontent/js/htmx.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,14 @@
function clearInput(inputId) {
document.getElementById(inputId).value = '';
};
function focusInput(inputId) {
document.getElementById(inputId).focus();
};
window.onload = function() {
inputId = "membre_id";
clearInput(inputId);
focusInput(inputId);
};

View file

@ -12,13 +12,20 @@ import (
"github.com/labstack/echo/v4"
)
//go:embed html/*html
//go:embed html/*.html
var htmlFS embed.FS
//go:embed js/*.js
var publicFS embed.FS
func HTMLFS() embed.FS {
return htmlFS
}
func PublicFS() embed.FS {
return publicFS
}
type Template struct {
templates *template.Template
}