{% extends "sidebar_table_layout.html" %} {%- macro weighted_bill_amount(bill, weights, currency=bill.original_currency, amount=bill.amount) %} {{ amount|currency(currency) }} {%- if weights != 1.0 %} ({{ _("%(amount)s each", amount=(amount / weights)|currency(currency)) }}) {%- endif -%} {% endmacro -%} {% block title %} - {{ g.project.name }}{% endblock %} {% block js %} {% if add_bill %} $('#new-bill > a').click(); {% endif %} // ask for confirmation before removing an user $('.action.delete').each(function(){ var link = $(this).find('button'); link.click(function(){ if ($(this).hasClass("confirm")){ return true; } $(this).html("{{_("you sure?")}}"); $(this).addClass("confirm"); return false; }); }); var highlight_owers = function(){ var ower_ids = $(this).attr("owers").split(','); var payer_id = $(this).attr("payer"); $.each(ower_ids, function(i, val){ $('#bal-member-'+val).addClass("ower_line"); }); $("#bal-member-"+payer_id).addClass("payer_line"); }; var unhighlight_owers = function(){ $('[id^="bal-member-"]').removeClass("ower_line payer_line"); }; $('#bill_table tbody tr').hover(highlight_owers, unhighlight_owers); {% include "helpers.js" %} confirm_action(".delete-bill", { exclude_classes: "action delete", add_classes: "btn btn-sm" }); {% endblock %} {% block head %} {% endblock %} {% block sidebar %}
{% if g.lang == 'fr' %} {{ static_include("images/read.svg") | safe }} Voir la BD explicative {% endif %} {{ static_include("images/paper-plane.svg") | safe }} {{ _("Invite people") }}
{% endblock %} {% block content %}
{% if bills.pages > 1 %} {% endif %} {{ static_include("images/plus.svg") | safe }} {{ _("Add a new bill") }}
{% if bills.total > 0 %} {% for (weights, bill) in bills.items %} {% endfor %}
{{ _("When?") }} {{ _("Who paid?") }} {{ _("For what?") }} {{ _("For whom?") }} {{ _("How much?") }} {{ _("Actions") }}
{{ bill.date }} {{ bill.payer }} {{ bill.what }} {% if bill.owers|length == g.project.members|length -%} {{ _("Everyone") }} {%- elif bill.owers|length > g.project.members|length / 2 + 1 -%} {{ _("Everyone but %(excluded)s", excluded=g.project.members|reject('in', bill.owers)|join(', ', 'name')) }} {%- else -%} {{ bill.owers|join(', ', 'name') }} {%- endif %} {{ weighted_bill_amount(bill, weights) }} {{ _('edit') }}
{{ csrf_form.csrf_token }}
{% if bill.external_link %} {{ _('show') }} {% endif %}
{% else %}
{{ static_include("images/bill.svg") | safe }}

{{ _('No bills')}}

{{ _("Nothing to list yet.")}}
{%- if g.project.members %} {{- _("Add your first bill") -}} {% else %} {{- _("Add the first participant") -}} {%- endif -%}

{% endif %} {% endblock %}