aboutsummaryrefslogtreecommitdiff
path: root/ihatemoney/templates/sidebar_table_layout.html
blob: b25a3d683022179cc8c54bea6b244dda5a7a3814 (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
{% extends "layout.html" %}

{% macro balance_table(show_weight = True, show_header = False, member_edit = False) %}
  <table class="balance table">
    {%- set balance = g.project.balance %}
    {%- if show_header %}
      <thead>
        <tr class="d-none d-md-table-row">
          <th>{{ _("Who?") }}</th>
          <th class="balance-value">{{ _("Balance") }}</th>
        </tr>
      </thead>
    {%- endif %}
    {%- for member in g.project.members | sort(attribute='name') if member.activated or balance[member.id]|round(2) != 0 %}
      <tr id="bal-member-{{ member.id }}" action="{% if member.activated %}delete{% else %}reactivate{% endif %}">
        <td class="balance-name">{{ member.name }}
          {%- if show_weight -%}
            <span class="light{% if not g.project.uses_weights %} extra-info{% endif %}">(x{{ member.weight|minimal_round(1) }})</span>
          {%- endif -%}
        </td>
        {%- if member_edit %}
          {%- if member.activated %}
            <td>
              <form class="action delete" action="{{ url_for(".remove_member", member_id=member.id) }}" method="POST">
                <button type="submit">{{ _("deactivate") }}</button>
              </form>
              <form class="action edit" action="{{ url_for(".edit_member", member_id=member.id) }}" method="GET">
                <button type="submit">{{ _("edit") }}</button>
              </form>
            </td>
          {%- else %}
            <td>
              <form class="action reactivate" action="{{ url_for(".reactivate", member_id=member.id) }}" method="POST">
                <button type="submit">{{ _("reactivate") }}</button>
              </form>
            </td>
          {%- endif %}
        {%- endif %}
        <td class="balance-value {% if balance[member.id]|round(2) > 0 %}positive{% elif balance[member.id]|round(2) < 0 %}negative{% endif %}">
          {% if balance[member.id] | round(2) > 0 %}+{% endif %}{{ balance[member.id]|currency }}
        </td>
      </tr>
    {%- endfor %}
  </table>
{% endmacro %}

{% block body %}
<div class="row">
<aside id="sidebar" class="sidebar col-xs-12 col-md-3 " style="height: 100%">
  {% block sidebar %}{% endblock %}
</aside>

<main class="offset-md-3 col-xs-12 col-md-9">
  {% block content %}{% endblock %}
</main>

</div>
{% endblock %}