<!DOCTYPE html>
<html lang="en">

{{ template "head.tpl.html" . }}

<body class="bg-gray-850 text-gray-700 p-4 pt-10 flex flex-col min-h-screen max-w-screen-lg mx-auto justify-center">

{{ template "header.tpl.html" . }}

<div class="w-full flex justify-center">
    <div class="flex items-center justify-between max-w-lg flex-grow">
        <div><a onclick="window.history.back()" class="text-gray-500 text-sm cursor-pointer">&larr; Go back</a></div>
        <div><h1 class="font-semibold text-2xl text-white m-0 border-b-4 border-green-700">Sign Up</h1></div>
        <div></div>
    </div>
</div>

{{ template "alerts.tpl.html" . }}

<main class="mt-10 flex-grow flex justify-center w-full">
    <div class="flex-grow max-w-lg mt-8">
        <div>
            <p class="text-sm text-gray-300">
                💡 In order to use Wakapi, you need to create an account.
                After successful signup, you still need to set up the <a href="https://wakatime.com" target="_blank"
                                                                         rel="noopener noreferrer"
                                                                         class="border-b border-green-700">WakaTime</a>
                client tools.
                Please refer to <a href="https://github.com/muety/wakapi#-client-setup" target="_blank"
                                   rel="noopener noreferrer"
                                   class="border-b border-green-700">this readme section</a> for instructions.
                You will be able to view you <strong>API Key</strong> once you log in.
            </p>
        </div>

        <form class="mt-10" action="signup" method="post">
            <div class="mb-8">
                <label class="inline-block text-sm mb-1 text-gray-500" for="username">Username</label>
                <input class="shadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded w-full py-1 px-3"
                       type="text" id="username"
                       name="username" placeholder="Choose a username" minlength="1" required autofocus>
            </div>
            <div class="mb-8">
                <label class="inline-block text-sm mb-1 text-gray-500" for="email">E-Mail</label>
                <input class="shadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded w-full py-1 px-3"
                       type="email" id="email"
                       name="email" placeholder="Optionally add your e-mail address">
                <div class="text-xs text-gray-500 mt-2 italic">E-Mail address is optional, but required for some features that you cannot use else. Also, if you do not add an e-mail address, you will not be able to reset your password in case you forget it.</div>
            </div>
            <div class="mb-8">
                <label class="inline-block text-sm mb-1 text-gray-500" for="password">Password</label>
                <input class="shadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded w-full py-1 px-3"
                       type="password" id="password"
                       name="password" placeholder="Choose a password" minlength="6" required>
            </div>
            <div class="mb-8">
                <label class="inline-block text-sm mb-1 text-gray-500" for="password_repeat">And again ...</label>
                <input class="shadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded w-full py-1 px-3"
                       type="password" id="password_repeat"
                       name="password_repeat" placeholder="Repeat your password" minlength="6" required>
            </div>

            {{ if eq .TotalUsers 0 }}
            <p class="text-sm text-gray-300 mt-4 mb-8">
                ⚠️ <strong>Please note: </strong> Since there are no users registered in the system, yet, the first user will have administrative privileges, while additional users won't.
            </p>
            {{ end }}

            <div class="flex justify-between float-right">
                <button type="submit" class="py-1 px-3 rounded bg-green-700 hover:bg-green-800 text-white text-sm">
                    Create Account
                </button>
            </div>
        </form>
    </div>
</main>

{{ template "footer.tpl.html" . }}

{{ template "foot.tpl.html" . }}
</body>

</html>