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

{% block title %}{{ parent() ~ ' - ' ~ "general" | 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': 'general'|trans({}, 'platform'),
                    'href': ''
                }
            ]
        )
    }}
{% endblock %}
{% block section_content %}

    <div class="panel-heading">
        <h3 class="panel-title">{{ 'general'|trans({}, 'platform') }}</h3>
    </div>
    <form role="form" class="form-horizontal" action="{{ path('claro_workspace_edit', {'workspace': workspace.getId()}) }}" method="post" {{ form_enctype(form) }}>
        <div class="panel-body">
            {{ form_widget(form) }}
            <hr />
            <h3 class="panel-title">{{ 'generate_url'|trans({}, 'platform') }}</h3> <br />
            {% if url is empty %}
                <div class="alert alert-danger">  {{ 'generate_url_subscription_fail'|trans({}, 'platform') }} </div>
            {% else %}
            <div class="alert alert-info">
                {{ url }}
            </div>
            {% endif %}
        </div>
        <div class="panel-footer text-right">
            <a href="{{ path('claro_workspace_partial_import_form', {'workspace': workspace.getId()}) }}" class="workspace-import-form btn btn-default">
                {{ 'import'|trans({}, 'platform') }}
            </a>
            {% if is_granted('DELETE', workspace) and workspace != user.personalWorkspace %}
                <a href="#" class="workspace-delete-confirmation btn btn-default">
                    <i class="fa fa-trash-o"></i> {{ 'workspace_delete'|trans({}, 'platform') }}
                </a>
            {% endif %}
            {# comment until fix functionality
            <a href="{{ path('claro_workspace_export_form', {'workspace': workspace.getId() }) }}" class='btn btn-default' role="button">
                <i class="fa fa-floppy-o"></i> {{ 'save_as_template'|trans({}, 'platform') }}
            </a>
            #}
            <a class="btn btn-default" href="{{ path('claro_workspace_open_tool', {'workspaceId': workspace.getId(), 'toolName': 'parameters'}) }}">
                 {{ 'cancel'|trans({}, 'platform') }}
            </a>
            <button type="submit" class="btn btn-primary">{{ 'ok'|trans({}, 'platform') }}</button>
        </div>
    </form>
    <div id="delete-ws-validation-box" class="modal fade" role="dialog" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4>{{ 'workspace_delete_confirm_title'|trans({}, 'platform') }}</h4>
                </div>
                <div class="modal-body">
                    <p>{{ 'workspace_delete_confirm_message'|trans({}, 'platform') }}</p>
                </div>
                <div class="modal-footer">
                    <input type="button" id="delete-confirm-ok" class="btn btn-primary" value="{{ 'ok'|trans({}, 'platform') }}"/>
                    <input type="button" class="btn btn-default" data-dismiss="modal" value="{{ 'cancel'|trans({}, 'platform') }}"/>
                </div>
            </div>
        </div>
    </div>
    <div id="twig-workspace-id" data-workspaceId="{{workspace.getId()}}">
    </div>

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