55 lines
2.9 KiB
HTML
55 lines
2.9 KiB
HTML
|
|
{{define "content"}}
|
||
|
|
<div class="md:flex md:items-center md:justify-between mb-8">
|
||
|
|
<div class="min-w-0 flex-1">
|
||
|
|
<h2 class="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">
|
||
|
|
{{if .IsNew}}New User{{else}}Edit User{{end}}
|
||
|
|
</h2>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="overflow-hidden bg-white shadow sm:rounded-lg p-6 max-w-lg">
|
||
|
|
<form method="POST" action="/users{{if not .IsNew}}/{{.User.ID}}{{end}}">
|
||
|
|
{{if .Error}}
|
||
|
|
<div class="rounded-md bg-red-50 p-4 mb-6">
|
||
|
|
<div class="flex">
|
||
|
|
<div class="ml-3">
|
||
|
|
<h3 class="text-sm font-medium text-red-800">{{.Error}}</h3>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
{{end}}
|
||
|
|
|
||
|
|
<div class="space-y-6">
|
||
|
|
<div>
|
||
|
|
<label for="username" class="block text-sm font-medium leading-6 text-gray-900">Username</label>
|
||
|
|
<div class="mt-2">
|
||
|
|
<input type="text" name="username" id="username" value="{{.User.Username}}" required class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label for="password" class="block text-sm font-medium leading-6 text-gray-900">Password</label>
|
||
|
|
<div class="mt-2">
|
||
|
|
<input type="password" name="password" id="password" required class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label for="role" class="block text-sm font-medium leading-6 text-gray-900">Role</label>
|
||
|
|
<div class="mt-2">
|
||
|
|
<select id="role" name="role" class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6">
|
||
|
|
<option value="user" {{if eq .User.Role "user"}}selected{{end}}>User</option>
|
||
|
|
<option value="admin" {{if eq .User.Role "admin"}}selected{{end}}>Admin</option>
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="mt-6 flex items-center justify-end gap-x-6">
|
||
|
|
<a href="/users" class="text-sm font-semibold leading-6 text-gray-900">Cancel</a>
|
||
|
|
<button type="submit" class="rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">Save</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
{{end}}
|