pcmt/templates/manage/user-edit.tmpl
2023-08-07 22:01:27 +02:00

101 lines
5.2 KiB
Go HTML Template

{{ template "head.tmpl" . }}
<body class="min-h-screen flex flex-col justify-between bg-white dark:bg-gray-900">
{{ template "navbar.tmpl" . }}
<main class="grow mb-auto md:min-w-[300px]">
<section>
<div class="container mx-auto md:mx-4 px-8 py-0 md:px-12 md:pt-12 lg:pt-30">
<div class="lg:flex">
<div class="lg:w-1/2">
<h1 class="mt-4 text-2xl font-medium text-fuchsia-600 dark:text-fuchsia-400 capitalize lg:text-3xl">
Edit user
</h1>
{{ if and .Data .Data.flash }}
<h2 class="text-xl text-pink-600 dark:text-pink-500 py-2">
{{- .Data.flash -}}
</h2>
{{- end }}
</div>
<div class="mt-8 lg:w-1/2 lg:mt-0">
{{if and .Data .Data.user -}}
<div class="flex justify-end gap-2 lg:gap-0 place-items-center mb-4 mt-2">
<a href="/manage/users/{{.Data.user.ID}}" class="w-auto py-1 text-center text-blue-500 md:mt-0 md:mx-6 lg:mx-4 hover:underline dark:text-blue-400">
Back to detail
</a>
<a href="/manage/users" class="w-auto py-1 text-center text-blue-500 md:mt-0 md:mx-6 lg:mx-4 hover:underline dark:text-blue-400">
⏎ All users
</a>
</div>
{{end}}
<form method="post" action="/manage/users/{{.Data.user.ID}}/update" class="w-full lg:max-w-xl">
<input type="hidden" name="_csrf" value="{{- .CSRF -}}">
<div class="relative flex items-center">
<span class="absolute" role="img" aria-label="person outline icon for username">
{{ template "svg-user.tmpl" }}
</span>
<input name="username" type="text" {{if and .Data.user .Data.user.Username}}value="{{.Data.user.Username}}"{{end}} placeholder="Username" required class="block w-full py-3 valid:border-green-300 required:border-blue-300 text-gray-700 bg-white border rounded-lg px-11 dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 focus:border-blue-400 dark:focus:border-blue-300 focus:ring-blue-300 focus:outline-none focus:ring focus:ring-opacity-40">
</div>
<div class="relative flex items-center mt-4">
<span class="absolute" role="img" aria-label="email icon">
{{ template "svg-email.tmpl" }}
</span>
<input name="email" type="email" {{if and .Data.user .Data.user.Email}}value="{{.Data.user.Email}}"{{end}} placeholder="Email address" required class="peer block w-full px-10 py-3 required:border-blue-300 text-gray-700 bg-white border rounded-lg dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 focus:border-blue-400 dark:focus:border-blue-300 focus:ring-blue-300 focus:outline-none focus:ring focus:ring-opacity-40">
<p class="mt-2 mx-4 hidden peer-[:not(:placeholder-shown):invalid]:block text-pink-600 text-sm">
Please provide a valid email address.
</p>
</div>
<div class="relative flex items-center mt-4">
<span class="absolute" role="img" aria-label="password lock icon">
{{ template "svg-password.tmpl" }}
</span>
<input name="password" type="password" {{if and .Data.user .Data.user.Password}}value="{{.Data.user.Password}}"{{end}} placeholder="Password" required class="block w-full px-10 py-3 required:border-blue-300 text-gray-700 bg-white border rounded-lg dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 focus:border-blue-400 dark:focus:border-blue-300 focus:ring-blue-300 focus:outline-none focus:ring focus:ring-opacity-40">
</div>
<div class="relative flex items-center mt-4">
<span class="absolute" role="img" aria-label="password lock icon">
{{ template "svg-password.tmpl" }}
</span>
<input name="repeatPassword" type="password" {{if and .Data.user .Data.user.Password}}value="{{.Data.user.Password}}"{{end}} placeholder="Repeat Password" required class="block w-full px-10 py-3 required:border-blue-300 text-gray-700 bg-white border rounded-lg dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 focus:border-blue-400 dark:focus:border-blue-300 focus:ring-blue-300 focus:outline-none focus:ring focus:ring-opacity-40">
</div>
<div class="flex pt-2 px-2 items-center justify-center gap-6">
<div class="mb-1 block min-h-3">
<input
type="checkbox"
value="true"
id="isAdmin"
name="isAdmin"
{{- if and .Data.user .Data.user.IsAdmin}}checked{{ end -}}
/>
<label
class="inline-block pl-1 hover:cursor-pointer text-gray-700 dark:text-gray-300"
for="isAdmin">
Is admin?
</label>
</div>
<div class="mb-1 block min-h-3">
<input
type="checkbox"
value="true"
id="isActive"
name="isActive"
{{- if and .Data.user .Data.user.IsActive}}checked{{ end -}}
/>
<label
class="inline-block pl-1 hover:cursor-pointer text-gray-700 dark:text-gray-300"
for="isActive">
Is active?
</label>
</div>
</div>
<div class="mt-8 md:flex md:items-center">
<button class="w-full px-6 py-3 text-sm font-medium tracking-wide text-white capitalize transition-colors duration-300 transform bg-blue-500 rounded-lg md:w-1/2 hover:bg-blue-400 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-50">
Update
</button>
</div>
</form>
</div>
</div>
</div>
</section>
</main>
{{ template "footer.tmpl" . }}