diff --git a/ihatemoney/templates/list_bills_archived.html b/ihatemoney/templates/list_bills_archived.html new file mode 100644 index 00000000..517778cc --- /dev/null +++ b/ihatemoney/templates/list_bills_archived.html @@ -0,0 +1,180 @@ +{% 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); + +{% 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 %} +

Archived Bills

+ + + + + + {% for (weights, bill) in bills.items %} + {% if bill.archive == true %} + + + + + + + + + {% endif %} + {% 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 }} + +
+
+ {{ csrf_form.csrf_token }} + +
+ {% if bill.external_link %} + {{ _('show') }} + {% endif %} +
+ {% else %} +
+
+
+ {{ static_include("images/bill.svg") | safe }} +

{{ _('No bills')}}

+

+ {{ _("Nothing to list yet.")}}
+ {{ _("You probably want to") }} + {%- if g.project.members %} + {{- _("add a bill") -}} + ? + {% else %} + {{- _('add participants') -}} + ? + {%- endif -%} +

+
+
+ {% endif %} + not archived +{% endblock %}