28 lines
990 B
HTML
28 lines
990 B
HTML
{{ template "header.html" . }}
|
|
<header>{{ if eq .Data.lock.Name "" }}Lock #{{ .Data.lock.ID }}{{ else }}{{ .Data.lock.Name }}{{ end }} Slot #{{ .Data.code.Slot }}</header>
|
|
<br />
|
|
<form method="post">
|
|
Code: <input type="text" name="code" value="{{ .Data.code.Code }}" id="code" /> <a href="#" onclick="generateCode()">🔄</a><br />
|
|
Name: <input type="text" name="name" value="{{ .Data.code.Name }}" /><br />
|
|
Enabled: <input type="checkbox" name="enabled" {{ if .Data.code.Enabled }}checked{{ end }} /><br />
|
|
<br />
|
|
<input type="submit" value="save" />
|
|
</form>
|
|
<br /><br />
|
|
|
|
<ul>
|
|
{{ range $_, $entry := .Data.log }}
|
|
<li>{{ $entry.State }} (<i>{{ $entry.Timestamp | time_since }} ago</i>)</li>
|
|
{{ end }}
|
|
</ul>
|
|
|
|
<script type="text/javascript">
|
|
function generateCode() {
|
|
let code = "";
|
|
while(code.length < 4) {
|
|
code += Math.round(Math.random()*10);
|
|
}
|
|
document.querySelector('#code').value = code;
|
|
}
|
|
</script>
|
|
{{ template "footer.html" }}
|