{% filter spaceless %}

{% set menu = code_to_menu('MENU') %}

{% set startNumber = start_page_number() %}

{% for key, data in menus %}
    <tr>
        <td class="text-right">{{ (key + startNumber)  }}</td>
        <td>{% if data.parent is not null %}{{ data.parent.name }}{% else %}-{% endif %}</td>
        <td>{{ data.code }}</td>
        <td>{{ data.name }}</td>
        <td>{{ data.menuOrder }}</td>
        <td>{{ data.iconClass }}</td>
        <td>{{ data.routeName }}</td>
        <td>{% if data.showable %}{{ 'YA' }}{% else %}{{ 'TIDAK' }}{% endif %}</td>
        <td class="text-center">
            {% if is_granted('edit', menu) and false == data.deleted %}
                <button data-primary="{{ data.id }}" class="btn btn-xs btn-instagram edit margin-r-5"><i class="fa fa-edit"></i> {{ 'label.crud.edit' | trans }}</button>
            {% endif %}
            {% if is_granted('delete', menu) and false == data.deleted %}
                <button data-primary="{{ data.id }}" class="btn btn-xs btn-warning delete"><i class="fa fa-remove"></i> {{ 'label.crud.delete' | trans }}</button>
            {% endif %}
        </td>
    </tr>
{% endfor %}
{% endfilter %}
