{% extends "MapbenderManagerBundle::manager.html.twig" %}

{% block js %}
  {{parent()}}
  <script type="text/javascript" src="{{ asset('bundles/mapbendermanager/js/service-list.js') }}"></script>
{% endblock %}

{% block manager_content %}
{# @todo: fold design logic shared / sharable with Repository/index.html.twig into common base template #}
    {% if items and items | length %}
      <label for="inputFilter0" class="labelInput">{{ "mb.actions.filter" | trans }}</label><input id="inputFilter0" type="text" class="input listFilterInput">

      <ul id="listFilter0" class="listFilterContainer listFilterBoxes listFilterServiceBoxes -fn-instance-list">
        {% for item in items -%}
        <li class="filterItem">
          <div class="col1">
            <div class="smallerText">{{ item.id }}</div>
            <div class="smallerText">{{ item.source.type }}</div>
          </div>
          <div class="col2 box">
          <div class="contentTitle">
            <div class="buttonGroup button-toolbar pull-right">
              <a class="hover-highlight-effect" href="{{ path('mapbender_manager_repository_unowned_instance', {'instanceId': item.id}) }}"
                ><i class="fa fa-cog"></i></a>
              <a class="hover-highlight-effect" href="{{ path("mapbender_manager_repository_view",{"sourceId":item.source.id}) }}" title="{{ 'mb.manager.admin.source.show_metadata' | trans }}"
                ><i class="fa fa-desktop"></i></a>
            {% if is_granted('DELETE', oid) %}
              <a class="-fn-delete hover-highlight-effect" href="#"
                  data-url="{{ path('mapbender_manager_sourceinstance_delete', {'instance': item}) }}"
                  title="{{"mb.actions.delete"|trans}}"
                  ><i class="fa fa-times"></i></a>
            {% endif %}
            </div>
            {# @todo: link to instance editing #}
              <span class="h2">{{ item.title | default(item.source.title) }}</span>
              <div class="clear"></div>
            {# <a href="{{ path("mapbender_manager_repository_view",{"sourceId":source.id}) }}" class="title">{{ source.title }}<span class="smallerText"> {{ source.alias }}</span></a> #}
          </div>
          <div>{{ item.source.description }}</div>
          </div>
        </li>
      {% endfor %}
      </ul>
    {% else %}
        <span class="description">{{ 'mb.manager.admin.source.no_source' | trans }}</span>
    {% endif %}
{% endblock %}
