{% extends "ClarolineCoreBundle:Desktop:layout.html.twig" %}

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

{% block breadcrumb %}
    {{
        macros.desktopBreadcrumbs([
            {
                'name': 'parameters'|trans({}, 'platform'),
                'href': ''
            }
        ])
    }}
{% endblock %}
{% block section_content %}

    <div class="panel-heading">
        <h3 class="panel-title">{{ 'tool_parameters'|trans({}, 'platform') }}</h3>
    </div>
    <div class="panel-body">
        <form id="desktop-tool-form" action="{{ path('claro_desktop_tools_roles_edit') }}">
            <div class="table-responsive">
                <table id="tool-table"  class="table table-striped table-bordered table-condensed">
                    <thead>
                        <tr>
                            <th>{{ 'name'|trans({}, 'platform') }}</th>
                            <th>{{ 'visible'|trans({}, 'platform') }}</th>
                        </tr>
                    </thead>
                    <tbody id="tools-table-body">
                        {% for orderedTool in orderedTools %}
                            {% set tool = orderedTool.getTool() %}
                            <tr class='row-tool-config'
                                data-tool-id={{ tool.getId () }}
                                data-ordered-tool-id={{ orderedTool.getId () }}
                            >
                                <td>{{ tool.getName()|lower|trans({}, 'tools') }} </td>
                                <td>
                                    <input
                                        type="checkbox"
                                        class="chk-tool-visible"
                                        value="1"
                                        name="chk-tool-{{ tool.getId() }}"
                                        {% if tool.isDesktopRequired() or tool.getName() == 'parameters' %} disabled {% endif %}
                                        {% if tool.isVisible() %} checked {% endif %}
                                    />
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
            <button id="edit-tools-btn" href="{{ path('claro_desktop_open') }}" class="btn btn-primary">
                {{ 'edit'|trans({}, 'platform') }}
            </button>
            <a class="btn btn-default" href="{{ path('claro_desktop_open') }}">
                {{ 'cancel'|trans({}, 'platform') }}
            </a>
        </form>
    </div>
{% endblock %}
{% block javascripts %}
    {{ parent() }}
    <script src="{{ asset('bundles/clarolinecore/js/tool/desktop/tool_properties.js') }}" type="text/javascript"></script>
{% endblock %}
