{% extends 'manage/news/master.twig' %}
{% from 'macros.twig' import container_title %}
{% from '_layout/input.twig' import input_hidden, input_csrf, input_text, input_checkbox %}

{% block manage_content %}
    <form method="post" action="{{ url('manage-news-category', {'category': category_info.id|default(0)}) }}" class="container">
        {{ container_title(category_new ? 'New Category' : 'Editing ' ~ category_info.name) }}
        {{ input_csrf() }}

        <table style="color:inherit">
            <tr>
                <td>Name</td>
                <td>{{ input_text('nc_name', '', category_info.name|default(), 'text', '', true) }}</td>
            </tr>

            <tr>
                <td>Description</td>
                <td><textarea name="nc_desc" required class="input__textarea">{{ category_info.description|default() }}</textarea></td>
            </tr>

            <tr>
                <td>Is Hidden</td>
                <td>{{ input_checkbox('nc_hidden', '', category_info.isHidden|default(false)) }}</td>
            </tr>
        </table>

        <div>
            <button class="input__button">Save</button>
            {% if not category_new %}
                <a href="{{ url('manage-news-category-delete', { category: category_info.id, csrf: csrf_token() }) }}" class="input__button input__button--destroy" onclick="return confirm('Are you sure?');">Delete</a>
            {%  endif %}
        </div>
    </form>
{% endblock %}
