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

{% block title %}{{ form.vars.value.type }} {{ 'mb.wmts.wmtsloader.repo.instance.title.instance' | trans }} - {{ form.vars.value.title }}{% endblock %}

{% block css %}
  {{parent()}}
  <link rel="stylesheet" href="{{ asset('bundles/mapbenderwmts/backend/instance.css') }}" />
{% endblock %}

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

{% block manager_content %}
<div class="instanceContainer">
  <form action="{{path('mapbender_wmts_repository_instance',{"slug": slug,"instanceId": instance.id})}}" method="post" novalidate="novalidate" class="clear">

    <div class="right">
      <input class="button" type="submit" name="save" value="{{"mb.wmts.wmtsloader.repo.instance.btn.save"|trans}}" />
      <a href="{{ path('mapbender_manager_application_edit', {'slug': app.request.attributes.get('slug')}) }}" class="button critical">{{"mb.wmts.wmtsloader.repo.instance.btn.cancel"|trans}}</a>
    </div>

    <span class="labelInput">{{ 'mb.wmts.wmtsloader.repo.instance.label.originurl' | trans }}</span>
    <a class="linkButton origin-url" href="{{ instance.source.originUrl }}" target="_BLANK">{{ instance.source.originUrl }}</a>
    <div class="clear"></div>

    <div class="row">
      <div class="leftContainer col-md-6 col-xs-12">
        {{ form_row(form.title) }}
        {{ form_row(form.opacity) }}
      </div>
      <div class="col-md-6 col-xs-12">
        <div class="checkboxGroup">
          <div>
          {{ form_widget(form.visible) }}<label for="{{form.visible.vars.id}}" class="labelCheck">{{"mb.wmts.wmtsloader.repo.instance.label.visible"|trans}}</label>
          </div>
          <div>
          {{ form_widget(form.basesource) }}<label for="{{form.basesource.vars.id}}" class="labelCheck">{{"mb.wmts.wmtsloader.repo.instance.label.basesource"|trans}}</label>
          </div>
          <div>
          {{ form_widget(form.proxy) }}<label for="{{form.proxy.vars.id}}" class="labelCheck">{{"mb.wmts.wmtsloader.repo.instance.label.proxy"|trans}}</label>
          </div>
        </div>
        <div class="clear"></div>
      </div>
    </div>

    <table id="instanceTable" class="table instanceTable">
      <thead>
        <tr>
          <th></th>
          <th>{{"mb.wmts.wmtsloader.repo.instance.label.title"|trans}}</th>
          <th class="matrixSet">{{"mb.wmts.wmtsloader.repo.instance.label.tilemartixset"|trans}}</th>
          <th>{{"mb.wmts.wmtsloader.repo.instance.label.style"|trans}}</th>
          <th class="checkboxColumn">{{"mb.wmts.wmtsloader.repo.instance.label.active"|trans}}</th>
          <th class="checkboxColumn odd" colspan="2">{{"mb.wmts.wmtsloader.repo.instance.label.select"|trans}}</th>
          <th class="checkboxColumn" colspan="2">{{"mb.wmts.wmtsloader.repo.instance.label.info"|trans}}</th>
          <th class="checkboxColumn odd" colspan="2">{{"mb.wmts.wmtsloader.repo.instance.label.toggle"|trans}}</th>
          <th></th>
        </tr>
        <tr>
          <th colspan="5"></th>
          <th class="checkboxColumn smallText odd">{{"mb.wmts.wmtsloader.repo.instance.label.allow"|trans}}</th>
          <th class="checkboxColumn smallText odd">{{"mb.wmts.wmtsloader.repo.instance.label.on"|trans}}</th>
          <th class="checkboxColumn smallText">{{"mb.wmts.wmtsloader.repo.instance.label.allow"|trans}}</th>
          <th class="checkboxColumn smallText">{{"mb.wmts.wmtsloader.repo.instance.label.on"|trans}}</th>
          <th class="checkboxColumn smallText odd">{{"mb.wmts.wmtsloader.repo.instance.label.allow"|trans}}</th>
          <th class="checkboxColumn smallText odd">{{"mb.wmts.wmtsloader.repo.instance.label.on"|trans}}</th>
          <th></th>
        </tr>
        <tr id="instanceTableCheckHead">
          <th colspan="4"></th>
          <th class="checkboxColumn"><span id="checkActive" class="iconCheckbox"></span></th>
          <th class="checkboxColumn odd"><span id="checkSelectAllow" class="iconCheckbox"></span></th>
          <th class="checkboxColumn odd"><span id="checkSelectOn" class="iconCheckbox"></span></th>
          <th class="checkboxColumn"><span id="checkInfoAllow" class="iconCheckbox"></span></th>
          <th class="checkboxColumn"><span id="checkInfoOn" class="iconCheckbox"></span></th>
          <th class="checkboxColumn odd"><span id="checkToggleAllow" class="iconCheckbox"></span></th>
          <th class="checkboxColumn odd"><span id="checkToggleOn" class="iconCheckbox"></span></th>
          <th></th>
        </tr>
      </thead>
      <tbody id="instanceTableCheckBody">
        <tr class="item level0">
            <td class="level0 itemType iconFolderActive hover-highlight-effect"></td>
            <td class="titleColumn" title="{{ "mb.wmts.wmtsloader.repo.instancelayerform.label.layer_title"|trans }}">{{ form_widget(form.roottitle) }}</td>
            <td colspan="2"></td>
            <td class="checkboxColumn" data-check-identifier="checkActive" title="{{ "mb.wmts.wmtsloader.repo.instancelayerform.label.active"|trans }}">{{ form_widget(form.active) }}</td>
            <td class="checkboxColumn odd" data-check-identifier="checkSelectAllow" title="{{ "mb.wmts.wmtsloader.repo.instancelayerform.label.allowselecttoc"|trans }}">{{ form_widget(form.allowselected) }}</td>
            <td class="checkboxColumn odd" data-check-identifier="checkSelectOn" title="{{ "mb.wmts.wmtsloader.repo.instancelayerform.label.selectedtoc"|trans }}">{{ form_widget(form.selected) }}</td>
            <td class="checkboxColumn" data-check-identifier="checkInfoAllow" title="{{ "mb.wmts.wmtsloader.repo.instancelayerform.label.allowinfotoc"|trans }}">{{ form_widget(form.allowinfo) }}</td>
            <td class="checkboxColumn" data-check-identifier="checkInfoOn" title="{{ "mb.wmts.wmtsloader.repo.instancelayerform.label.infotoc"|trans }}">{{ form_widget(form.info) }}</td>
            <td class="checkboxColumn odd" data-check-identifier="checkToggleAllow" title="{{ "mb.wmts.wmtsloader.repo.instancelayerform.label.allowtoggletoc"|trans }}">{{ form_widget(form.allowtoggle) }}</td>
            <td class="checkboxColumn odd" data-check-identifier="checkToggleOn" title="{{ "mb.wmts.wmtsloader.repo.instancelayerform.label.toggletoc"|trans }}">{{ form_widget(form.toggle) }}</td>
            <td class="moreColumn"></td>
        </tr>
        {% for form in form.layers %}
        {% include "MapbenderWmtsBundle:Repository:instance-layer-form.html.twig"  with {'form': form }%}
        {% endfor %}
        <tr class="dummy">
          <td colspan="20"></td>
        </tr>
      </tbody>
    </table>

    <div class="clearContainer"></div>

    <div class="right">
      <input class="button" type="submit" name="save" value="{{"mb.wmts.wmtsloader.repo.instance.label.save"|trans}}" />
      <a href="{{ path('mapbender_manager_application_edit', {'slug': app.request.attributes.get('slug')}) }}" class="button critical">{{"mb.wmts.wmtsloader.repo.instance.label.cancel"|trans}}</a>
    </div>
    <div class="clearContainer"></div>
    {{ form_row(form._token) }}
  </form>
</div>
{% endblock %}
