From f389c562595f74bea86e49c29949f4a7b0e78900 Mon Sep 17 00:00:00 2001 From: dark0dave <52840419+dark0dave@users.noreply.github.com> Date: Wed, 29 Apr 2020 21:57:08 +0100 Subject: Feature/currencies (#541) Now each project can have a currency, default to None. Each bill can use a different currency, and a conversion to project default currency is done on settle. Fix #512 --- ihatemoney/templates/forms.html | 5 +++++ ihatemoney/templates/history.html | 4 ++++ ihatemoney/templates/list_bills.html | 23 +++++++++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) (limited to 'ihatemoney/templates') diff --git a/ihatemoney/templates/forms.html b/ihatemoney/templates/forms.html index 33a283f..0900d2f 100644 --- a/ihatemoney/templates/forms.html +++ b/ihatemoney/templates/forms.html @@ -75,6 +75,7 @@ {{ input(form.name) }} {{ input(form.password) }} {{ input(form.contact_email) }} + {{ input(form.default_currency) }} {% if not home %} {{ submit(form.submit, home=True) }} {% endif %} @@ -96,6 +97,7 @@ + {{ input(form.default_currency) }}
{{ _("delete") }} @@ -122,6 +124,9 @@ {{ input(form.what, inline=True) }} {{ input(form.payer, inline=True, class="form-control custom-select") }} {{ input(form.amount, inline=True) }} + {% if not form.original_currency.render_kw %} + {{ input(form.original_currency, inline=True) }} + {% endif %} {{ input(form.external_link, inline=True) }}
diff --git a/ihatemoney/templates/history.html b/ihatemoney/templates/history.html index 1ac3284..a9a9a4d 100644 --- a/ihatemoney/templates/history.html +++ b/ihatemoney/templates/history.html @@ -225,6 +225,10 @@ {{ simple_property_change(event, _("Amount")) }} {% elif event.prop_changed == "date" %} {{ simple_property_change(event, _("Date")) }} + {% elif event.prop_changed == "original_currency" %} + {{ simple_property_change(event, _("Currency")) }} + {% elif event.prop_changed == "converted_amount" %} + {{ simple_property_change(event, _("Amount in %(currency)s", currency=g.project.default_currency)) }} {% else %} {{ describe_object(event) }} {{ _("modified") }} {% endif %} diff --git a/ihatemoney/templates/list_bills.html b/ihatemoney/templates/list_bills.html index 0f2a68a..95088eb 100644 --- a/ihatemoney/templates/list_bills.html +++ b/ihatemoney/templates/list_bills.html @@ -111,7 +111,19 @@
- + + + {% for bill in bills.items %} @@ -130,7 +142,14 @@ {%- else -%} {{ bill.owers|join(', ', 'name') }} {%- endif %} - + +
{{ _("When?") }}{{ _("Who paid?") }}{{ _("For what?") }}{{ _("For whom?") }}{{ _("How much?") }}{{ _("Actions") }}
{{ _("When?") }} + {{ _("Who paid?") }} + {{ _("For what?") }} + {{ _("For whom?") }} + {{ _("How much?") }} + {% if g.project.default_currency != "No Currency" %} + {{ _("Amount in %(currency)s", currency=g.project.default_currency) }} + {%- else -%} + {{ _("Amount") }} + {% endif %} + {{ _("Actions") }}
{{ "%0.2f"|format(bill.amount) }} ({{ "%0.2f"|format(bill.pay_each()) }} {{ _("each") }}) + {% if bill.original_currency != "No Currency" %} + {{ "%0.2f"|format(bill.amount) }} {{bill.original_currency}} ({{ "%0.2f"|format(bill.pay_each_default(bill.amount)) }} {{bill.original_currency}} {{ _(" each") }}) + {%- else -%} + {{ "%0.2f"|format(bill.amount) }} ({{ "%0.2f"|format(bill.pay_each_default(bill.amount)) }} {{ _(" each") }}) + {% endif %} + {{ "%0.2f"|format(bill.converted_amount) }} {{ _('edit') }} {{ _('delete') }} -- cgit v1.1