{% extends "admin/base_site.html" %}
{% load i18n admin_modify adminmedia %}

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />{% endblock %}

{% block title %}{% trans "Edit bookings" %}{% endblock %}

{% block breadcrumbs %}
  {% if not is_popup %}
    <div class="breadcrumbs">
      Test
    </div>
  {% endif %}
{% endblock %}

{% block bodyclass %}change-list{% endblock %}

{% block content %}
<div id="content-main">
  <h1>{% trans "Edit bookings" %}</h1>
  <p>
    {%  trans "Every provided input information will commited to the selected entries. If you don't provide a certain field, this value will be kept and no change comitted." %}
  </p>
  <form id="changelist-form" action="" method="post">
  {% csrf_token %}
  <div>
      {% if form.errors %}
          <p class="errornote">
          {% blocktrans count form.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
          </p>
          {{ form.non_field_errors }}
      {% endif %}
    <!--<fieldset class="module aligned collapse collapsed">-->
    <fieldset class="module aligned collapse">
    <h2>{% trans "Selected bookings" %} (<a id="fieldsetcollapser0" class="collapse-toggle" href="#">Einblenden</a>)</h2>
    <div class="module filtered" id="changelist">
      
      <!--<form id="changelist-form" action="" method="post">-->
          <div style="display:none"></div>
          <div id="results">
            <table cellspacing="0" id="result_list">
              <thead>
                <tr>
                  <th>{% trans "Id" %}</th>
                  <th>{% trans "Project" %}</th>
                  <th>{% trans "Step" %}</th>
                  <th>{% trans "Date" %}</th>
                  <th>{% trans "User" %}</th>
                  <th>{% trans "Duration" %}</th>
                  <th>{% trans "Activity" %}</th>
                </tr>
              </thead>
              <tbody>
                {% for booking in bookings %}
                  <tr class="{% cycle 'row1' 'row2' %}">
                    <td><strong><a href="">{{ booking.id }}</a></strong></td>
                    <td>{{ booking.project }}</td>
                    <td>{{ booking.step }}</td>
                    <td>{{ booking.day.date }}</td>
                    <td>{{ booking.day.user }}</td>
                    <td>{{ booking.duration|format_minutes_to_time }}</td>
                    <td><a href="">{{ booking.get_title|truncatewords:10 }}</a></td>
                  </tr>
                {% endfor %}
              </tbody>
            </table>
          </div>
          <!--<p class="paginator">Test</p>-->
      <!--</form>-->
    </div>
    </fieldset>
  </div>


  <div>
  <fieldset class="module aligned ">
    <h2>{% trans "Contract" %}</h2>
    <div class="form-row">
      {{ form.project.errors }}
      <label for="id_project">{{ form.project.label }}:</label>
      {{ form.project }}
    </div>
    <div class="form-row">
      {{ form.step.errors }}
      <label for="id_step">{{ form.step.label }}:</label>
      {{ form.step }}
    </div>
  </fieldset>
  </div>

  <div>
  <fieldset class="module aligned ">
    <h2>{% trans "Working time" %}</h2>
    <div class="form-row">
      {{ form.user.errors }}
      <label for="id_user">{% trans 'User' %}:</label>
      {{ form.user }}
    </div>
    <div class="form-row">
      {{ form.date.errors }}
      <label for="id_date">{% trans 'Date' %}:</label>
      {{ form.date }}
    </div>
    <div class="form-row">
      <label for="id_duration">{% trans 'Duration' %}:</label>
      {{ form.hours.errors }}
      {{ form.minutes.errors }}
      {{ form.hours }} {{ form.minutes }}
    </div>
  </fieldset>
  </div>

  <div>
  <fieldset class="module aligned ">
    <h2>{% trans "Details" %}</h2>
    <div class="form-row">
      {{ form.title.errors }}
      <label for="id_title">{{ form.title.label }}:</label>
      {{ form.title }}
    </div>
    <div class="form-row">
      {{ form.description.errors }}
      <label for="id_description">{{ form.description.label }}:</label>
      {{ form.description }}
    </div>
  </fieldset>
  </div>


  <div>
  <fieldset class="module aligned ">
    <h2>{% trans "Issue" %}</h2>
    <div class="form-row">
      {{ form.tracker.errors }}
      <label for="id_tracker">{{ form.tracker.label }}:</label>
      {{ form.tracker }}
    </div>
    <div class="form-row">
      {{ form.issue_no.errors }}
      <label for="id_issue_no">{{ form.issue_no.label }}:</label>
      {{ form.issue_no }}
    </div>
    <div class="form-row">
      {{ form.clear_issue.errors }}
      <label for="id_clear_issue">{{ form.clear_issue.label }}:</label>
      {{ form.clear_issue }}<p class="help">{% trans "This will remove any issue references." %}</span>
    </div>
  </fieldset>
  </div>


  <div class="submit-row">
    <!--<p class="deletelink-box"><a href="delete/" class="deletelink">{% trans "Delete" %}</a></p>-->
    <input type="submit" value="{% trans "Save" %}" class="default" name="save" />
    <input type="submit" value="{% trans "Cancel" %}" name="cancel" />
  </div>
  </form>
</div>
{% endblock %}
