aboutsummaryrefslogtreecommitdiff
path: root/ihatemoney/templates/sidebar_table_layout.html
diff options
context:
space:
mode:
Diffstat (limited to 'ihatemoney/templates/sidebar_table_layout.html')
-rw-r--r--ihatemoney/templates/sidebar_table_layout.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/ihatemoney/templates/sidebar_table_layout.html b/ihatemoney/templates/sidebar_table_layout.html
index 9d588a3..d616e68 100644
--- a/ihatemoney/templates/sidebar_table_layout.html
+++ b/ihatemoney/templates/sidebar_table_layout.html
@@ -1,5 +1,49 @@
{% 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]|currencyformat_nc(g.project.default_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%">