mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-31 15:30:42 +02:00
Allow user to set a currency in which every price is shown for him.
This commit is contained in:
parent
01da705b54
commit
2d34649ae6
6 changed files with 50 additions and 14 deletions
|
@ -53,13 +53,13 @@
|
|||
|
||||
{% set min_order_amount = pricedetail_helper.minOrderAmount(part) %}
|
||||
{% set max_order_amount = pricedetail_helper.maxDiscountAmount(part) %}
|
||||
{% set max_order_price = pricedetail_helper.calculateAvgPrice(part, max_order_amount) %}
|
||||
{% set max_order_price = pricedetail_helper.calculateAvgPrice(part, max_order_amount, app.user.currency ?? null) %}
|
||||
|
||||
{% if max_order_price is not null %}
|
||||
<span title="{% trans %}part.avg_price.label{% endtrans %} {{ max_order_amount | amountFormat(part.partUnit) }}">{{ max_order_price | moneyFormat }}</span>
|
||||
<span title="{% trans %}part.avg_price.label{% endtrans %} {{ max_order_amount | amountFormat(part.partUnit) }}">{{ max_order_price | moneyFormat(app.user.currency ?? null) }}</span>
|
||||
{% if min_order_amount < max_order_amount %}
|
||||
<span> - </span>
|
||||
<span title="{% trans %}part.avg_price.label{% endtrans %} {{ min_order_amount | amountFormat(part.partUnit) }}">{{pricedetail_helper.calculateAvgPrice(part, min_order_amount) | moneyFormat }}</span>
|
||||
<span title="{% trans %}part.avg_price.label{% endtrans %} {{ min_order_amount | amountFormat(part.partUnit) }}">{{pricedetail_helper.calculateAvgPrice(part, min_order_amount, app.user.currency ?? null ) | moneyFormat(app.user.currency ?? null) }}</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -43,14 +43,14 @@
|
|||
</td>
|
||||
<td>
|
||||
{{ detail.price | moneyFormat(detail.currency) }} / {{ detail.PriceRelatedQuantity | amountFormat(part.partUnit) }}
|
||||
{% if detail.currency and pricedetail_helper.convertMoneyToCurrency(detail.price, detail.currency) > 0 %}
|
||||
<span class="text-muted">({{ pricedetail_helper.convertMoneyToCurrency(detail.price, detail.currency) | moneyFormat() }})</span>
|
||||
{% if detail.currency != (app.user.currency ?? null) and pricedetail_helper.convertMoneyToCurrency(detail.price, detail.currency) > 0 %}
|
||||
<span class="text-muted">({{ pricedetail_helper.convertMoneyToCurrency(detail.price, detail.currency, app.user.currency ?? null) | moneyFormat(app.user.currency ?? null) }})</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ detail.PricePerUnit | moneyFormat(detail.currency) }}
|
||||
{% if detail.currency and pricedetail_helper.convertMoneyToCurrency(detail.PricePerUnit, detail.currency) > 0 %}
|
||||
<span class="text-muted">({{ pricedetail_helper.convertMoneyToCurrency(detail.PricePerUnit, detail.currency) | moneyFormat() }})</span>
|
||||
{% if detail.currency != (app.user.currency ?? null) and pricedetail_helper.convertMoneyToCurrency(detail.PricePerUnit, detail.currency) > 0 %}
|
||||
<span class="text-muted">({{ pricedetail_helper.convertMoneyToCurrency(detail.PricePerUnit, detail.currency, app.user.currency ?? null) | moneyFormat(app.user.currency ?? null) }})</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
{{ form_row(settings_form.language) }}
|
||||
{{ form_row(settings_form.timezone) }}
|
||||
{{ form_row(settings_form.theme) }}
|
||||
{{ form_row(settings_form.currency) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue