<form role="form">
    <fieldset>
        <div id="selected-workspaces" class="form-group">
            {% set nbWorkspaces = workspaces|length %}
            <label for="workspaces-list">
                <b>{{ 'selected_workspaces_for_registration'|trans({}, 'platform') }}</b>
                {% if nbWorkspaces > 1 %}
                    <span id="remove-workspace-from-list" class="pointer-hand">
                        <i class="fa fa-book pointer-hand"></i>
                    </span>
                {% endif %}
            </label>
            <select id="workspaces-list" name="workspaces-list" size="5" class="form-control" disabled="disabled">
                {% for workspace in workspaces %}
                    {% set workspaceId = workspace.getId() %}
                    <option id="option-workspace-{{ workspaceId }}"
                        class="dropdown-submenu workspace-option"
                        workspace-id="{{ workspaceId }}"
                    >
                        {{ workspace.getName() }}
                        <span class="workspace-code">({{ workspace.getCode() }})</span>
                    </option>
                {% endfor %}
            </select>
        </div>

        <div class="form-group">
            <label for="roles-list">
                <b>{{ 'select_roles_to_assign'|trans({}, 'platform') }}</b>
            </label>
            {% if workspaces|length > 1 %}
                <select id="roles-list" name="roles-list" size="5" multiple="multiple" class="form-control">
                    <option class="dropdown-submenu role-option" value="collaborator">
                        {{ 'collaborator'|trans({}, 'platform') }}
                    </option>
                    <option class="dropdown-submenu role-option" value="manager">
                        {{ 'manager'|trans({}, 'platform') }}
                    </option>
                    <option class="dropdown-submenu role-option" value="visitor">
                        {{ 'visitor'|trans({}, 'platform') }}
                    </option>
                </select>
            {% else %}
                <select id="roles-list" name="roles-list" size="5" multiple="multiple" nb-workspaces="1" class="col-md-8 form-control">
                {% for role in workspaces[0].getRoles() %}
                    <option class="dropdown-submenu role-option" value="{{ role.getId() }}">
                        {{ role.getTranslationKey()|trans({}, 'platform') }}
                    </option>
                {% endfor %}
                </select>
            {% endif %}
        </div>
    </fieldset>
</form>

<div id="remove-workspace-modal-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>
                <h3>
                    {{ 'remove_workspace_from_selection'|trans({}, 'platform') }}
                </h3>
            </div>
            <div id="remove-workspace-modal-body" class="modal-body">
                <ul>
                {% for workspace in workspaces %}
                    <li class="workspace-element-for-removal" style="list-style-type: none">
                        <i class="fa fa-trash-o pointer-hand remove-workspace-button"
                            workspace-id="{{ workspace.getId() }}"
                        ></i>
                        {{ workspace.getName() }}
                        <small>({{ workspace.getCode() }})</small>
                    </li>
                {% endfor %}
                </ul>
            </div>
            <div class="modal-footer">
                <input type="button"
                    class="btn btn-default"
                    data-dismiss="modal"
                    value="{{ 'close'|trans({}, 'platform') }}"
                />
            </div>
        </div>
    </div>
</div>
