2024-01-25 02:40:14 +00:00
|
|
|
{{ template "base" . }}
|
|
|
|
{{ define "title" }}Admin - Users{{ end }}
|
|
|
|
{{ define "header" }}<a class="whitespace-pre" href="../admin">Admin - Users</a>{{ end }}
|
|
|
|
{{ define "content" }}
|
2024-03-11 01:48:43 +00:00
|
|
|
<div class="relative h-full overflow-x-auto">
|
|
|
|
<input type="checkbox" id="add-button" class="hidden peer/add" />
|
|
|
|
<div class="absolute top-10 left-10 p-3 transition-all duration-200 bg-gray-200 rounded shadow-lg shadow-gray-500 dark:shadow-gray-900 dark:bg-gray-600 hidden peer-checked/add:block">
|
|
|
|
<form method="POST"
|
|
|
|
action="./users"
|
|
|
|
class="flex flex-col gap-2 text-black dark:text-white text-sm">
|
|
|
|
<input type="text"
|
2024-03-12 05:20:41 +00:00
|
|
|
id="operation"
|
|
|
|
name="operation"
|
|
|
|
value="CREATE"
|
|
|
|
class="hidden" />
|
|
|
|
<input type="text"
|
|
|
|
id="user"
|
|
|
|
name="user"
|
2024-03-11 01:48:43 +00:00
|
|
|
placeholder="User"
|
|
|
|
class="p-2 bg-gray-300 text-black dark:bg-gray-700 dark:text-white" />
|
|
|
|
<input type="password"
|
|
|
|
id="password"
|
|
|
|
name="password"
|
|
|
|
placeholder="Password"
|
|
|
|
class="p-2 bg-gray-300 text-black dark:bg-gray-700 dark:text-white" />
|
|
|
|
<button class="font-medium px-2 py-1 text-white bg-gray-500 dark:text-gray-800 hover:bg-gray-800 dark:hover:bg-gray-100"
|
|
|
|
type="submit">Create</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
2024-05-27 17:32:40 +00:00
|
|
|
<div class="min-w-full overflow-scroll rounded shadow">
|
2024-01-25 02:40:14 +00:00
|
|
|
<table class="min-w-full leading-normal bg-white dark:bg-gray-700 text-sm">
|
|
|
|
<thead class="text-gray-800 dark:text-gray-400">
|
|
|
|
<tr>
|
|
|
|
<th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800 w-12">
|
2024-03-11 01:48:43 +00:00
|
|
|
<label class="cursor-pointer" for="add-button">{{ template "svg/add" }}</label>
|
2024-01-25 02:40:14 +00:00
|
|
|
</th>
|
|
|
|
<th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800">User</th>
|
2024-05-18 20:47:26 +00:00
|
|
|
<th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800">Password</th>
|
2024-01-25 02:40:14 +00:00
|
|
|
<th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800 text-center">
|
|
|
|
Permissions
|
|
|
|
</th>
|
|
|
|
<th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800 w-48">Created</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="text-black dark:text-white">
|
|
|
|
{{ if not .Data }}
|
|
|
|
<tr>
|
|
|
|
<td class="text-center p-3" colspan="2">No Results</td>
|
|
|
|
</tr>
|
|
|
|
{{ end }}
|
|
|
|
{{ range $user := .Data }}
|
|
|
|
<tr>
|
2024-05-27 17:32:40 +00:00
|
|
|
<!-- User Deletion -->
|
|
|
|
<td class="p-3 border-b border-gray-200 text-gray-800 dark:text-gray-400 cursor-pointer relative">
|
|
|
|
<label for="delete-{{ $user.ID }}-button" class="cursor-pointer">{{ template "svg/delete" }}</label>
|
|
|
|
<input type="checkbox"
|
|
|
|
id="delete-{{ $user.ID }}-button"
|
|
|
|
class="hidden css-button" />
|
|
|
|
<div class="absolute z-30 top-1.5 left-10 p-1.5 transition-all duration-200 bg-gray-200 rounded shadow-lg shadow-gray-500 dark:shadow-gray-900 dark:bg-gray-600">
|
|
|
|
<form method="POST"
|
|
|
|
action="./users"
|
|
|
|
class="text-black dark:text-white text-sm w-40">
|
|
|
|
<input type="hidden" id="operation" name="operation" value="DELETE" />
|
|
|
|
<input type="hidden" id="user" name="user" value="{{ $user.ID }}" />
|
|
|
|
{{ template "component/button" (dict "Title" (printf "Delete (%s)" $user.ID )) }}
|
|
|
|
</form>
|
|
|
|
</div>
|
2024-03-11 01:48:43 +00:00
|
|
|
</td>
|
2024-05-27 17:32:40 +00:00
|
|
|
<!-- User ID -->
|
2024-01-25 02:40:14 +00:00
|
|
|
<td class="p-3 border-b border-gray-200">
|
|
|
|
<p>{{ $user.ID }}</p>
|
|
|
|
</td>
|
2024-05-27 17:32:40 +00:00
|
|
|
<!-- User Password Change -->
|
2024-05-18 20:47:26 +00:00
|
|
|
<td class="border-b border-gray-200 relative px-3">
|
|
|
|
<label for="edit-{{ $user.ID }}-button" class="cursor-pointer">
|
|
|
|
<span class="font-medium px-2 py-1 text-white bg-gray-500 dark:text-gray-800 hover:bg-gray-800 dark:hover:bg-gray-100"
|
|
|
|
type="submit">Reset</span>
|
|
|
|
</label>
|
|
|
|
<input type="checkbox"
|
|
|
|
id="edit-{{ $user.ID }}-button"
|
|
|
|
class="hidden css-button" />
|
2024-05-27 17:32:40 +00:00
|
|
|
<div class="absolute z-30 top-1 left-16 ml-2 p-1.5 transition-all duration-200 bg-gray-200 rounded shadow-lg shadow-gray-500 dark:shadow-gray-900 dark:bg-gray-600">
|
2024-05-18 20:47:26 +00:00
|
|
|
<form method="POST"
|
|
|
|
action="./users"
|
|
|
|
class="flex flex gap-2 text-black dark:text-white text-sm">
|
2024-05-26 01:12:07 +00:00
|
|
|
<input type="hidden" id="operation" name="operation" value="UPDATE" />
|
|
|
|
<input type="hidden" id="user" name="user" value="{{ $user.ID }}" />
|
2024-05-18 20:47:26 +00:00
|
|
|
<input type="password"
|
|
|
|
id="password"
|
|
|
|
name="password"
|
2024-05-27 17:32:40 +00:00
|
|
|
placeholder="{{ printf "Password (%s)" $user.ID }}"
|
|
|
|
class="p-1.5 bg-gray-300 text-black dark:bg-gray-700 dark:text-white" />
|
2024-05-18 20:47:26 +00:00
|
|
|
<button class="font-medium px-2 py-1 text-white bg-gray-500 dark:text-gray-800 hover:bg-gray-800 dark:hover:bg-gray-100"
|
|
|
|
type="submit">Change</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</td>
|
2024-05-27 17:32:40 +00:00
|
|
|
<!-- User Role -->
|
2024-05-26 01:12:07 +00:00
|
|
|
<td class="flex gap-2 justify-center p-3 border-b border-gray-200 text-center min-w-40">
|
|
|
|
<!-- Set Admin & User Styles -->
|
|
|
|
{{ $adminStyle := "bg-gray-400 dark:bg-gray-600 cursor-pointer" }}
|
|
|
|
{{ $userStyle := "bg-gray-400 dark:bg-gray-600 cursor-pointer" }}
|
|
|
|
{{ if $user.Admin }}{{ $adminStyle = "bg-gray-800 dark:bg-gray-100 cursor-default" }}{{ end }}
|
|
|
|
{{ if not $user.Admin }}{{ $userStyle = "bg-gray-800 dark:bg-gray-100 cursor-default" }}{{ end }}
|
|
|
|
<form method="POST"
|
|
|
|
action="./users"
|
|
|
|
class="flex flex gap-2 text-black dark:text-white text-sm">
|
|
|
|
<input type="hidden" id="operation" name="operation" value="UPDATE" />
|
|
|
|
<input type="hidden" id="user" name="user" value="{{ $user.ID }}" />
|
|
|
|
<input type="hidden" id="is_admin" name="is_admin" value="true" />
|
|
|
|
<button {{ if $user.Admin }}type="button"{{ else }}type="submit"{{ end }} class="px-2 py-1 rounded-md text-white dark:text-black {{ $adminStyle }}">admin
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
<form method="POST"
|
|
|
|
action="./users"
|
|
|
|
class="flex flex gap-2 text-black dark:text-white text-sm">
|
|
|
|
<input type="hidden" id="operation" name="operation" value="UPDATE" />
|
|
|
|
<input type="hidden" id="user" name="user" value="{{ $user.ID }}" />
|
|
|
|
<input type="hidden" id="is_admin" name="is_admin" value="false" />
|
|
|
|
<button {{ if $user.Admin }}type="submit"{{ else }}type="button"{{ end }} class="px-2 py-1 rounded-md text-white dark:text-black {{ $userStyle }}">user
|
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
<td class="p-3 border-b border-gray-200">
|
|
|
|
<p>{{ $user.CreatedAt }}</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{ end }}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2024-01-25 02:40:14 +00:00
|
|
|
</div>
|
|
|
|
{{ end }}
|