aboutsummaryrefslogtreecommitdiff
path: root/ihatemoney/templates
diff options
context:
space:
mode:
authordark0dave <52840419+dark0dave@users.noreply.github.com>2020-04-29 21:57:08 +0100
committerGitHub <noreply@github.com>2020-04-29 22:57:08 +0200
commitf389c562595f74bea86e49c29949f4a7b0e78900 (patch)
treec3c0ac339ad002f47e2be9cd3a46d347012b1d70 /ihatemoney/templates
parent162193c787341118621b36b4c8933bbe8af092df (diff)
downloadihatemoney-mirror-f389c562595f74bea86e49c29949f4a7b0e78900.zip
ihatemoney-mirror-f389c562595f74bea86e49c29949f4a7b0e78900.tar.gz
ihatemoney-mirror-f389c562595f74bea86e49c29949f4a7b0e78900.tar.bz2
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
Diffstat (limited to 'ihatemoney/templates')
-rw-r--r--ihatemoney/templates/forms.html5
-rw-r--r--ihatemoney/templates/history.html4
-rw-r--r--ihatemoney/templates/list_bills.html23
3 files changed, 30 insertions, 2 deletions
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 @@
</div>
</div>
+ {{ input(form.default_currency) }}
<div class="actions">
<button class="btn btn-primary">{{ _("Edit the project") }}</button>
<a id="delete-project" style="color:red; margin-left:10px; cursor:pointer; ">{{ _("delete") }}</a>
@@ -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) }}
<div class="form-group row">
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 @@
<div class="clearfix"></div>
<table id="bill_table" class="col table table-striped table-hover table-responsive-sm">
- <thead><tr><th>{{ _("When?") }}</th><th>{{ _("Who paid?") }}</<th><th>{{ _("For what?") }}</th><th>{{ _("For whom?") }}</th><th>{{ _("How much?") }}</th><th>{{ _("Actions") }}</th></tr></thead>
+ <thead>
+ <tr><th>{{ _("When?") }}
+ </th><th>{{ _("Who paid?") }}
+ </th><th>{{ _("For what?") }}
+ </th><th>{{ _("For whom?") }}
+ </th><th>{{ _("How much?") }}
+ {% if g.project.default_currency != "No Currency" %}
+ </th><th>{{ _("Amount in %(currency)s", currency=g.project.default_currency) }}
+ {%- else -%}
+ </th><th>{{ _("Amount") }}
+ {% endif %}
+ </th><th>{{ _("Actions") }}</th></tr>
+ </thead>
<tbody>
{% for bill in bills.items %}
<tr owers="{{bill.owers|join(',','id')}}" payer="{{bill.payer.id}}">
@@ -130,7 +142,14 @@
{%- else -%}
{{ bill.owers|join(', ', 'name') }}
{%- endif %}</td>
- <td>{{ "%0.2f"|format(bill.amount) }} ({{ "%0.2f"|format(bill.pay_each()) }} {{ _("each") }})</td>
+ <td>
+ {% 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 %}
+ </td>
+ <td>{{ "%0.2f"|format(bill.converted_amount) }}</td>
<td class="bill-actions">
<a class="edit" href="{{ url_for(".edit_bill", bill_id=bill.id) }}" title="{{ _("edit") }}">{{ _('edit') }}</a>
<a class="delete" href="{{ url_for(".delete_bill", bill_id=bill.id) }}" title="{{ _("delete") }}">{{ _('delete') }}</a>