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

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

{% block css %}
  {{parent()}}
{% 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.manager.admin.filter.source"|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>
            {% if source.valid == true %}
                <span class="iconStarO icon" title="{{"mb.manager.admin.source.valid"|trans}}"></span><br>
            {% elseif source.valid is not null %}
                <span class="iconWarningSmpl icon" title="{{"mb.manager.admin.source.notvalid"|trans}}"></span><br>
            {% endif %}
        </div>
        <div class="col2 box">
          <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 class="buttonGroup">
            <a class="iconView iconBig" href="{{ path("mapbender_manager_repository_view",{"sourceId":source.id}) }}" title="{{ 'mb.manager.admin.source.show_metadata' | trans }}"></a>
            {% if is_granted('EDIT', oid) or is_granted('EDIT', source) %}
            <a class="iconReset iconBig" 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) or is_granted('DELETE', source) %}
               <span class="iconRemove iconBig"
                title="{{"mb.manager.admin.source.delete"|trans}} {{ source.title }}"
                data-url="{{ path("mapbender_manager_repository_confirmdelete",{"sourceId":source.id}) }}"
                data-id="{{ source.id }}"></span>
            {% endif %}
          </div>
        </div>
      </li>
    {% endfor %}
  </ul>
{% else %}
    <span class="description">{{ 'mb.manager.admin.source.no_source' | trans }}</span>
{% endif %}

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