go-skeletor/templates/user/list.tmpl

50 lines
1.6 KiB
Cheetah
Raw Permalink Normal View History

2021-11-02 11:25:21 +01:00
<h1>Utilisateurs</h1>
<a href="{{.conf.AppRoutes.usersubmit}}" class="btn btn-success mb-3">Ajouter</a>
{{$routeupdate:=.conf.AppRoutes.userupdate}}
{{$weburl:=.conf.AppWeburl}}
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
<thead>
<tr>
<th width="70px" class="no-sort text-center">Action</th>
<th width="70px" class="no-sort text-center">Avatar</th>
<th>Login</th>
<th>Prénom</th>
<th>Nom</th>
<th>Email</th>
<th>Rôle</th>
</tr>
</thead>
<tbody>
{{ range $user := .users }}
<tr>
<td class="text-center">
<a href="{{$routeupdate}}{{ $user.Id }}"><i class="fas fa-file fa-2x"></i></a>
</td>
<td class="text-center"><img class="avatar" id="avatarimage" src="{{$weburl}}/uploads/avatar/{{$user.Avatar}}" style="height:40px"></td>
<td>{{ $user.Login }}</td>
<td>{{ $user.Firstname }}</td>
<td>{{ $user.Lastname }}</td>
<td>{{ $user.Email }}</td>
<td>
{{ if eq $user.Role 10}}Administrateur{{end}}
{{ if eq $user.Role 50}}Utilisateur{{end}}
</td>
</tr>
{{ end }}
</tbody>
</table>
<script>
$(document).ready(function() {
$('#dataTables').DataTable({
columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ],
responsive: true,
iDisplayLength: 100,
order: [[ 2, "asc" ]]
});
});
</script>