{% extends "layouts/admin.twig" %}

{% block title %}{{ ta.new_page|default('Nieuwe pagina') }} - {{ ta.admin_title|default('CodePress Admin') }}{% endblock %}

{% block content %}
<h2 class="mb-4"><i class="bi bi-plus-lg"></i> {{ ta.new_page|default('Nieuwe pagina') }}</h2>

<div class="card shadow-sm">
    <div class="card-body">
        <form method="POST" action="/admin/content-new?dir={{ dir|url_encode }}" id="editor-form" data-new-page>
            <input type="hidden" name="csrf_token" value="{{ csrf_token }}">
            <div class="mb-3">
                <label for="filename" class="form-label">{{ ta.filename|default('Bestandsnaam') }}</label>
                <input type="text" class="form-control" id="filename" name="filename" required autofocus>
                <small class="form-text text-muted">{{ ta.name_help|default('Alleen letters, cijfers, punten, underscores en streepjes.') }}</small>
            </div>
            <div class="mb-3">
                <label for="extension" class="form-label">{{ ta.file_type|default('Bestandstype') }}</label>
                <select class="form-select" id="extension" name="extension">
                    {% for ext, label in availableExtensions %}
                    <option value="{{ ext }}">{{ label }}</option>
                    {% endfor %}
                </select>
            </div>
            <div class="mb-3">
                <label for="layout" class="form-label">{{ ta.template_layout|default('Sjabloon / Layout') }} <small class="text-muted">({{ activeThemeName|default('default') }} theme)</small></label>
                <select class="form-select" id="layout" name="layout">
                    {% for key, layoutFile in themeLayouts %}
                    <option value="{{ key }}" {{ key == themeDefaultLayout ? 'selected' : '' }}>{{ key|replace({'_': ' '})|capitalize }}{% if key == themeDefaultLayout %} (standaard){% endif %}</option>
                    {% endfor %}
                </select>
            </div>
            <div class="d-flex gap-2">
                <button type="submit" class="btn btn-primary">
                    <i class="bi bi-check-lg"></i> {{ ta.create|default('Aanmaken') }}
                </button>
                <a href="/admin/content?dir={{ dir|url_encode }}" class="btn btn-outline-secondary">{{ ta.cancel|default('Annuleren') }}</a>
            </div>
        </form>
    </div>
</div>
{% endblock %}