{% extends 'ClarolineCoreBundle:Workspace:layout.html.twig' %}

{% block title %}{{ parent() ~ ' - ' ~ "model" | trans({}, "platform") | striptags | raw }}{% endblock %}

{% block breadcrumb %}
    {{
        macros.workspaceBreadcrumbs(
        workspace,
            [
                {
                    'name': 'parameters'|trans({}, 'platform'),
                    'href': path('claro_workspace_open_tool', {'workspaceId': workspace.getId(), 'toolName': 'parameters'})
                },
                {
                    'name': 'models'|trans({}, 'platform'),
                    'href': ''
                }
            ]
        )
    }}
{% endblock %}

{% block section_content %}
    <div class="panel-heading">
        <h3 class="panel-title">{{ 'models'|trans({}, 'platform') }}</h3>
    </div>
    <div class="panel-body">
        <div class="model-list"
            {% if models|length == 0 %} style="display: none" {% endif %}
        >
            <table class="table table-striped table-bordered table-condensed">
                <thead>
                    <th>{{ 'name'|trans({}, 'platform') }}</th>
                    <th>{{ 'rename'|trans({}, 'platform') }}</th>
                    <th>{{ 'configure'|trans({}, 'platform') }}</th>
                    <th>{{ 'delete'|trans({}, 'platform') }}</th>
                </thead>
                <tbody id="table-model-body">
                    {% for model in models %}
                        {% include "ClarolineCoreBundle:Tool\\workspace\\parameters\\model:modelRow.html.twig" with {'model': model} %}
                    {% endfor %}
                </tbody>
            </table>
        </div>
        {% if models|length == 0 %}
            <div id="no-model-div" style="text-align: center;">
                <p>{{ 'no_model'|trans({}, 'platform') }}</p>
            </div>
        {% endif %}
    </div>
    <div class="panel-footer">
        <a class="btn btn-primary create-modal-form"
           href="{{ path('claro_workspace_model_modal_form', {'workspace': workspace.getId()}) }}"
        >
            {{ 'create_model'|trans({}, 'platform') }}
        </a>
    </div>
{% endblock %}

{% block javascripts %}
    {{ parent() }}
    <script src='{{ asset('bundles/clarolinecore/js/tool/workspace/model/index.js') }}' type="text/javascript"></script>
{% endblock %}