
{% include "PublisherAdmin/_include.html" %}


<div class="page-category">
    <div class="pull-right">
        <div class="btn btn-info"
                data-toggle="modal"
                data-target="#modal-cat-type"
                data-id=""
                data-name=""
                data-slug=""
                >New Type</div>
    </div>
    <div class="clearfix"></div>
    <br>

{% call widget.panel("Tags", type="table") %}
    <table class="table table-bordered">
        <thead>
            <th>Name</th>
            <th>Slug</th>
            <th>Posts</th>
        </thead>

        <tbody>
            {% for type in types %}
            <tr><td>
                <a href="javascript:"
                data-toggle="modal"
                data-target="#modal-cat-type"
                data-id="{{ type.id }}"
                data-name="{{ type.name }}"
                data-slug="{{ type.slug}}">
                     {{ type.name }}</a>
                </td>
                <td>{{ type.slug }}</td>
                <td><a href="{{ url_for('PublisherAdmin:index', type_id=type.id) }}">{{ type.total_posts }}</a></td>
            </tr>
            {% endfor %}
        </tbody>

    </table>
{% endcall %}
</div>


<!-- MODAL -->
{% call widget.modal('Edit Type', id="modal-cat-type") %}
    <footer>
        <button type="submit" class="btn btn-success pull-left"><i class="fa fa-check"></i> SAVE</button>
        <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-danger delete-btn" data-dismiss="modal"><i class="fa fa-trash"></i> Delete</button>
    </footer>

    {% call forms.post('PublisherAdmin:types') %}
        {{ forms.hidden(name="id", value="") }}
        {{ forms.hidden(name="action", value="") }}
        {{ forms.input(label="Name", name="name", value="", data={"validation": "required"}) }}
        {{ forms.input(label="Slug", name="slug", value="") }}
    {% endcall %}

{% endcall %}
