mirror of
				https://github.com/Theodor-Springmann-Stiftung/musenalm.git
				synced 2025-10-31 18:25:33 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			111 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			111 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| {{ $model := . }}
 | |
| 
 | |
| 
 | |
| <div class="flex container-normal bg-slate-100 mx-auto !pt-36 px-8">
 | |
| 	<div class="flex-col w-full">
 | |
| 		{{ if $model.redirect_url }}
 | |
| 			<a href="{{ $model.redirect_url }}" class="text-gray-700 hover:text-slate-950">
 | |
| 				<i class="ri-arrow-left-s-line"></i> Zurück
 | |
| 			</a>
 | |
| 		{{ else }}
 | |
| 			<a href="/" class="text-gray-700 hover:text-slate-950">
 | |
| 				<i class="ri-arrow-left-s-line"></i> Startseite
 | |
| 			</a>
 | |
| 		{{ end }}
 | |
| 		<h1
 | |
| 			class="text-2xl self-baseline w-full my-6 font-bold
 | |
| 		text-slate-900">
 | |
| 			Benutzerverwaltung
 | |
| 		</h1>
 | |
| 	</div>
 | |
| </div>
 | |
| <div class="flex container-normal mx-auto px-8 mt-4">
 | |
| 	<div class="flex-col w-full">
 | |
| 		<div id="user-message">
 | |
| 			{{ if $model.success }}
 | |
| 				<div
 | |
| 					class="text-green-800 text-sm mt-2 rounded bg-green-200 p-2 font-bold border-green-700
 | |
| 				border-2 mb-3">
 | |
| 					{{ $model.success }}
 | |
| 				</div>
 | |
| 			{{ end }}
 | |
| 			{{ if $model.error }}
 | |
| 				<div
 | |
| 					class="text-red-800 text-sm mt-2 rounded bg-red-200 p-2 font-bold border-red-700
 | |
| 				border-2 mb-3">
 | |
| 					{{ $model.error }}
 | |
| 				</div>
 | |
| 			{{ end }}
 | |
| 		</div>
 | |
| 		<table class="user-mgmt w-full text-lg">
 | |
| 			<thead>
 | |
| 				<tr>
 | |
| 					<th>Name</th>
 | |
| 					<th>E-Mail</th>
 | |
| 					<th>Rolle</th>
 | |
| 					<th>Aktive Logins</th>
 | |
| 					<th></th>
 | |
| 				</tr>
 | |
| 			</thead>
 | |
| 			<tbody>
 | |
| 				{{ range $u := $model.users }}
 | |
| 					<tr class="{{ if $u.Deactivated }}deactivated{{ end }}">
 | |
| 						<td>{{ $u.Name }}</td>
 | |
| 						<td>{{ $u.Email }}</td>
 | |
| 						<td>{{ $u.Role }}</td>
 | |
| 						<td>{{ index $model.session_counts $u.Id }}</td>
 | |
| 						<td>
 | |
| 							<form class="flex flex-row gap-x-4 justify-end">
 | |
| 								<input type="hidden" name="uid" id="uid" required value="{{ $u.Id }}" />
 | |
| 								<input
 | |
| 									type="hidden"
 | |
| 									name="csrf_nonce"
 | |
| 									id="csrf_nonce"
 | |
| 									required
 | |
| 									value="{{ $model.csrf_nonce }}" />
 | |
| 								<input
 | |
| 									type="hidden"
 | |
| 									name="csrf_token"
 | |
| 									id="csrf_token"
 | |
| 									required
 | |
| 									value="{{ $model.csrf_token }}" />
 | |
| 								<!-- INFO: we dont use request.fullpath here, since this can be /logout /activate
 | |
| 									or /deactivate, which would not work with the redirectTo query param -->
 | |
| 								<button
 | |
| 									formmethod="GET"
 | |
| 									formaction="/user/{{ $u.Id }}/edit?redirectTo=/user/management">
 | |
| 									<i class="ri-pencil-line"></i>
 | |
| 								</button>
 | |
| 								<button
 | |
| 									hx-push-url="false"
 | |
| 									formmethod="POST"
 | |
| 									formaction="/user/management/logout/"
 | |
| 									class="text-orange-800 bg-orange-200 hover:bg-orange-300">
 | |
| 									<i class="ri-logout-box-r-line"></i>
 | |
| 								</button>
 | |
| 								{{- if $u.Deactivated }}
 | |
| 									<button
 | |
| 										hx-push-url="false"
 | |
| 										formmethod="POST"
 | |
| 										formaction="/user/management/activate/"
 | |
| 										class="text-blue-800 bg-blue-200 hover:bg-blue-300">
 | |
| 										<i class="ri-check-line"></i>
 | |
| 									</button>
 | |
| 								{{- else -}}
 | |
| 									<button
 | |
| 										hx-push-url="false"
 | |
| 										formmethod="POST"
 | |
| 										formaction="/user/management/deactivate/"
 | |
| 										class="text-red-800 bg-red-200 hover:bg-red-300">
 | |
| 										<i class="ri-prohibited-2-line"></i>
 | |
| 									</button>
 | |
| 								{{- end -}}
 | |
| 							</form>
 | |
| 						</td>
 | |
| 					</tr>
 | |
| 				{{ end }}
 | |
| 			</tbody>
 | |
| 		</table>
 | |
| 	</div>
 | |
| </div>
 | 
