{% extends "request_base.html" %}
{% load i18n %}
{% load sekizai_tags %}
{% load url from future %}
{% load editor %}
{% load crispy_forms_tags %}

{% block extra_scripts %}
{{ block.super }}
{{ form.media.css }}
{{ form.media.js}}
{% endblock %}

{% block message %}
{% endblock %}

{% block content %}
{% if messages %}
	{% for message in messages %}
	<p{% if message.tags %} class="alert alert-{{ message.tags }}"{% endif %}>{{ message }}</p>
	{% endfor %}
{% endif %}
<div class="row-fluid">
	<div class="span12">


<form method="post" enctype="multipart/form-data" class="well bootstrap form-horizontal">

	<h1>Demande de reprographie</h1>
	<h2>Étape {{ wizard.steps.step1 }} sur {{ wizard.steps.count }}&nbsp;: {{ wizard.form.display_name }}</h2>
<br />

<p style="text-align: right">Les champs marqués d'un <span class="asteriskField">*</span> sont obligatoires.</p>
{% block form %}
{% editablecontent wizard.steps.current "form-header" %}
{% endeditablecontent %}
{{ wizard.management_form }}
{% crispy wizard.form %}
{% editablecontent wizard.steps.current "form-footer" %}
{% endeditablecontent %}
{% endblock %}


<div class="form-actions">
	{% if "correction" in request.GET %}
		<button name="submit" type="submit" class="btn pull-right">Valider <i class="icon-forward"></i></button>
		<a href="../validation/" class="btn pull-left">Annuler</a>
	{% else %}
		<button name="submit" type="submit" class="btn pull-right">Suite <i class="icon-forward"></i></button>
		{% if wizard.steps.prev %}
		<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="btn pull-left"><i class="icon-backward"></i> Retour</button>
		{% endif %}
	{% endif %}
</div>

</form>

</div>
</div>

{% endblock %}

{% block sidebar %}

<ul class="nav nav-list">
  <li class="nav-header"> Demande n&deg; {{object.request_number}}&nbsp;(&nbsp;{{object.status}}&nbsp;)</li>
	{% for step, form, pprint_data in all_forms %}
	<li{% if step == wizard.steps.current %} class="active"{% endif %}>
	<a href="../{{ step }}">Étape {{ forloop.counter }}. {{ form.display_name }}</a>
		<ul class="nav nav-list">
		{% for d,v in pprint_data %}
		{% if v %}
    <li>{% if d %}{{ d }}: {% endif %}<span class="{{ d|slugify }}">{{ v }}</span></li>
			{% endif %}
			{% endfor %}
		</ul>
	</li>
	{% endfor %}

</ul>

{% addtoblock "endscripts" %}
<script src="{{STATIC_URL}}frequent_values.js"></script>
<script src="{{STATIC_URL}}request/js/jquery-mousewheel.min-3.0.6.js"></script>
<script>
  // Copied from http://css-tricks.com/mousewheel-inputs/
$(function() {

    $(".wheelable-input").after('<img src="{{STATIC_URL}}request/images/mousewheelupdown.png" alt="{% trans "Faites rouler votre molette pour changer la valeur." %}" />')

    $(".wheelable-input").bind("mousewheel", function(event, delta) {
        if (delta > 0) {
            this.value = parseInt(this.value) + 1;
            $(this).trigger('change');
        } else {
            if (parseInt(this.value) > 1) {
                this.value = parseInt(this.value) - 1;
                $(this).trigger('change');
            }
        }
        return false;
     });

});
</script>
{% endaddtoblock %}

{% endblock %}

