aboutsummaryrefslogtreecommitdiff
path: root/templates/balance.html
blob: b97ea401e4e7e8413ba4872ba90452d7eded25ea (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{% extends "base.html" %}

{% block title %}
  Équilibre
{% endblock title %}

{% block main %}

  <section class="g-Section">
    {% if exceeding_payers %}
      <ul class="g-Balance__ExceedingPayers">
        {% for exceeding_payer in exceeding_payers %}
          <li class="g-Balance__ExceedingPayer">
            {{ exceeding_payer.0 }} : +{{ exceeding_payer.1 | euros() }}
          </li>
        {% endfor %}
      </ul>
    {% else %}
      <p class="g-Paragraph">
        Les paiements sont équilibrés.
      </p>
    {% endif %}

    {% if incomes_from %}
      <h1 class="g-Title">
        Revenus
      </h1>

      <div class="g-Table">
        <div class="g-Table__Row g-Table__Row--Header">
          <span class="g-Table__Cell"></span>
          <span class="g-Table__Cell">Montant</span>
          <span class="g-Table__Cell">Part</span>
        </div>
        {% for user_income in user_incomes %}
          <div class="g-Table__Row">
            <span class="g-Table__Cell">
              {{ user_income.0 }}
            </span>
            <span class="g-Table__Cell g-Table__NumericCell">
              {{ user_income.1 | euros() }}
            </span>
            <span class="g-Table__Cell g-Table__NumericCell">
              {% if total_income > 0 %}
                {{ user_income.1 / total_income * 100 | round() }} %
              {% else %}{% endif %}
            </span>
          </div>
        {% endfor %}
        <div class="g-Table__Row">
          <span class="g-Table__Cell">
            Total
          </span>
          <span class="g-Table__Cell g-Table__NumericCell">
            {{ total_income | euros() }}
          </span>
          <span class="g-Table__Cell g-Table__NumericCell">
            100 %
          </span>
        </div>
      </div>
    {% endif %}

    <h1 class="g-Title">
      Paiements
    </h1>

    <div class="g-Table">
      <div class="g-Table__Row g-Table__Row--Header">
        <span class="g-Table__Cell"></span>
        <span class="g-Table__Cell">Montant</span>
        <span class="g-Table__Cell">Part</span>
      </div>
      {% for user_payment in user_payments %}
        <div class="g-Table__Row">
          <span class="g-Table__Cell">
            {{ user_payment.0 }}
          </span>
          <span class="g-Table__Cell g-Table__NumericCell">
            {{ user_payment.1 | euros() }}
          </span>
          <span class="g-Table__Cell g-Table__NumericCell">
            {% if total_payments > 0 %}
              {{ user_payment.1 / total_payments * 100 | round() }} %
            {% else %}{% endif %}
          </span>
        </div>
      {% endfor %}
      <div class="g-Table__Row">
        <span class="g-Table__Cell">
          Total
        </span>
        <span class="g-Table__Cell g-Table__NumericCell">
          {{ total_payments | euros() }}
        </span>
        <span class="g-Table__Cell g-Table__NumericCell">
          100 %
        </span>
      </div>
    </div>
  </div>

{% endblock main %}