internal/web/templates/tab-edit.html
{{ define "tab-edit" }}
<body>
<div class="container">
<br>
{{ range $key, $value := .Links.Tabs }}
{{ if eq $key $.TabEdit }}
<div class="row">
<div class="col">
<div class="row">
<div class="col">
<h4>Edit tab {{ .Name }}</h4>
</div>
<div class="col"></div>
<div class="col">
<a href="/tab_edit/?tab={{ $key }}&action=deltab">
<button type="submit" class="btn btn-outline-danger">Delete tab</button>
</a>
</div>
</div>
<br>
<form action="/tab_edit/" method="post" class="input-group">
<span class="input-group-text">Needs auth to view</span>
<input name="tab" type="hidden" value="{{ $key }}">
<select name="action" class="form-select">
{{ if .Auth }}
<option selected>yes</option>
{{ else }}
<option selected>no</option>
{{ end }}
<option value="authyes">yes</option>
<option value="authno">no</option>
</select>
<button type="submit" class="btn btn-outline-success"><i class="bi bi-check2"></i></button>
</form>
<br>
<table class="table table-striped">
<thead>
<th style="width: 1em;">Del</th>
<th style="width: 3em;">ID</th>
<th style="width: 1em;">Up</th>
<th>Panels</th>
</thead>
{{ range $id, $panel := .Panels }}
<tr>
<td><a href="/tab_edit/?tab={{ $key }}&pan={{ $id }}&action=delpan">
<button type="submit" class="btn btn-outline-danger"><i class="bi bi-x-lg"></i></button>
</a></td>
<td>{{ $id }}</td>
<td>{{ if eq $id 0 }}
<button type="submit" class="btn btn-outline-warning" disabled><i class="bi bi-arrow-up"></i></button>
{{ else }}
<a href="/tab_edit/?tab={{ $key }}&pan={{ $id }}&action=up">
<button type="submit" class="btn btn-outline-warning"><i class="bi bi-arrow-up"></i></button>
</a>
{{ end }}
</td>
<td><a href="/panel_edit/?edit={{ . }}">{{ . }}</a> </td>
</tr>
{{ end }}
</table>
</div>
<div class="col">
<div class="row">
<h4>Add panels to tab</h4>
</div>
<div class="row">
<form action="/tab_edit/" method="post">
<input name="tab" type="hidden" value="{{ $key }}">
<input name="action" type="hidden" value="addpan">
<select name="panels" class="form-select" multiple size="10em">
{{ range $id, $panel := $.Links.Panels }}
<option value="{{ $id }}">{{ $id }}</option>
{{ end }}
</select>
<button type="submit" class="btn btn-outline-success">Add</button>
</form>
</div>
</div>
</div>
{{ end }}
{{ end }}
</div>
{{ template "footer" }}
{{ end }}