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

{% block title %}{{ 'mb.manager.admin.sources' | trans }}{% endblock %}

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

{% block manager_content %}
{% if create_permission %}
<a class="iconAdd iconBig right" href="{{ path("mapbender_manager_repository_new") }}" title="{{ 'mb.manager.admin.source.add' | trans }}"></a>
{% endif %}
{% if sources|length > 0 %}
  <label for="inputFilterServices" class="labelInput">{{ "mb.actions.filter" | trans }}</label><input id="inputFilterServices" type="text" class="input listFilterInput">

  <ul id="listFilterServices" class="listFilterContainer listFilterBoxes listFilterServiceBoxes">
    {% for source in sources %}
      <li class="filterItem">
        <div class="col1">
          <span class="smallerText">{{ source.id }}</span><br>
          <span class="smallerText">{{ source.type }}</span><br>
        </div>
        <div class="col2 box">
            <div class="buttonGroup">
              <a class="iconView hover-highlight-effect" href="{{ path("mapbender_manager_repository_view",{"sourceId":source.id}) }}" title="{{ 'mb.manager.admin.source.show_metadata' | trans }}"></a>
              {% if source.id in reloadableIds %}
              <a class="iconReset hover-highlight-effect" href="{{ path("mapbender_manager_repository_updateform",{"sourceId":source.id}) }}" title="{{ 'mb.manager.admin.source.update' | trans }} {{ source.title }}"></a>
              {% endif %}
              {% if is_granted('DELETE', oid) %}
                 <a href="#" class="-fn-delete hover-highlight-effect"
                  title="{{"mb.manager.admin.source.delete"|trans}} {{ source.title }}"
                  data-url="{{ path("mapbender_manager_repository_delete",{"sourceId":source.id}) }}"
                  data-id="{{ source.id }}"><i class="fa fas fa-times"></i></a>
              {% endif %}
            </div>
          <a href="{{ path("mapbender_manager_repository_view",{"sourceId":source.id}) }}" class="title">{{ source.title }}<span class="smallerText"> {{ source.alias }}</span></a>
          <div class="description">{{ source.description }}</div>
        </div>
      </li>
    {% endfor %}
  </ul>
{% else %}
    <span class="description">{{ 'mb.manager.admin.source.no_source' | trans }}</span>
{% endif %}

<div class="clearContainer"></div>
{% endblock %}
