{% extends "sidebar_table_layout.html" %} {% 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; }); }); // remove duplicate tags var usedTags = {}; $("select[name='tag-search-select'] > option").each(function() { if (usedTags[this.text]) { $(this).remove(); } else { usedTags[this.text] = this.value; } }); // add default values to payer select $('#payer-search-select').prepend(new Option('', '', true, true)); // add default values to date select $('#date-search-select').prepend(new Option('', '', true, true)); $('#btn-bill-filter').click(function() { var dateValue = $('#date-search-select').val(); var payerValue = $('#payer-search-select option:selected').val(); var amountValue = $('#amount-search-select').val(); if (amountValue.substr(amountValue.length - 3) === '.00') { amountValue = amountValue.substr(0, amountValue.length - 3) } var amountWithZero = amountValue + ".0" var tagValue = $('#tag-search-select').val(); var matching = $('#bill_table tbody tr').filter(function(){ return (payerValue != "" && $(this).attr('payer') !== payerValue) || $(this).attr('date') !== dateValue || (amountValue != "" && $(this).attr('amount') !== amountValue && $(this).attr('amount') !== amountWithZero) || (tagValue != "" && $(this).attr('tag') !== tagValue); }); matching.hide(); $('#bill_table tbody tr').not(matching).show(200); }); $('#btn-bill-showall').click(function() { $('#bill_table tbody tr').show(200); }); 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); {% endblock %} {% block sidebar %}
{% endblock %} {% block content %} {{ static_include("images/plus.svg") | safe }} {{ _("Add a new bill") }}{{ _("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 %} | {{ "%0.2f"|format(bill.amount) }} ({{ "%0.2f"|format(bill.pay_each()) }} {{ _("each") }}) | {{ _('edit') }} {{ _('delete') }} {% if bill.external_link %} {{ _('see') }} {% endif %} |
{{ _("Nothing to list yet.")}}
{{ _("You probably want to") }}
{%- if g.project.members %}
{{- _("add a bill") -}}
?
{% else %}
{{- _('add participants') -}}
?
{%- endif -%}