<%- include('layout', { title: 'Neuen Benutzer anlegen' }) %>

<% override body %>
    <h2>Neuen Benutzer anlegen</h2>
    
    <form action="/users" method="POST">
        <div class="form-group">
            <label for="username">Benutzername:</label>
            <input type="text" id="username" name="username" required autofocus
                   value="<%= locals.username || '' %>">
        </div>
        <div class="form-group">
            <label for="password">Passwort:</label>
            <input type="password" id="password" name="password" required>
        </div>
        <div class="form-group">
            <label for="role">Rolle:</label>
            <select id="role" name="role" required>
                <option value="employee" <%= locals.role === 'employee' ? 'selected' : '' %>>Mitarbeiter</option>
                <option value="admin" <%= locals.role === 'admin' ? 'selected' : '' %>>Administrator</option>
            </select>
        </div>
        <button type="submit" class="btn">Benutzer anlegen</button>
        <a href="/users" class="btn secondary">Abbrechen</a>
    </form>
    
    <% if (error) { %>
        <div class="error"><%= error %></div>
    <% } %>
<% end %>
