aboutsummaryrefslogtreecommitdiff
path: root/templates/balancing/create.html
blob: c9bfdba32450fd6adf9e870e3004bf43bba65aa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{% extends "base.html" %}

{% block title %}
  Nouvel équilibrage
{% endblock title %}

{% block main %}

  <section class="g-Section">
    <p class="g-Paragraph">
      <a
        class="g-Link g-Media__Large"
        href="/balancings?page={{ query.page or 1 }}"
      >
        Retour aux équilibrages
      </a>
    </p>

    <form
      class="g-Form"
      action="/balancing/create?page={{ query.page or 1 }}"
      method="POST"
    >
      <h1 class="g-H1">
        Nouvel équilibrage
      </h1>

      {% if error %}
        <div class="g-Form__Error">{{ error }}</div>
      {% endif %}

      <label class="g-Form__Label">
        Montant
        <input
          name="amount"
          type="number"
          class="g-Form__Input"
          value="{{ form.amount or "" }}"
          min=1
          required
          {% if not form %} autofocus {% endif %}
        />
      </label>

      {% set user_id = form.user_id or connected_user.id %}

      <label class="g-Form__Label">
        De
        <select name="source" class="g-Form__Select" required>
          {% for user in users %}
            <option
              value="{{ user.id }}"
              {% if "" ~ user.id == "" ~ user_id %} selected {% endif %}
            >
              {{ user.name }}
            </option>
          {% endfor %}
        </select>
      </label>

      <label class="g-Form__Label">
        Vers
        <select name="destination" class="g-Form__Select" required>
          <option value="" disabled selected></option>
          {% for user in users %}
            <option value="{{ user.id }}">
              {{ user.name }}
            </option>
          {% endfor %}
        </select>
      </label>

      <div>
        <input class="g-Button__Validate" type="submit" value="Créer" />
      </div>
    </form>
  </section>

{% endblock main %}