Hide average price row, if we dont have info about it.

This commit is contained in:
Jan Böhmer 2020-04-08 16:10:35 +02:00
parent 887ac83f83
commit 0b16fd7697

View file

@ -45,24 +45,22 @@
<i class="fas fa-microchip fa-fw" title="{% trans %}footprint.label{% endtrans %}"></i>
<span class="text-muted">{{ helper.structural_entity_link(part.footprint) }}</span>
</h6>
<h6>
<i class="fas fa-money-bill-alt fa-fw"></i>
<span class="text-muted">
{% 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, app.user.currency ?? null) %}
{% if max_order_price is not null %}
{% 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, app.user.currency ?? null) %}
{% if max_order_price is not null %}
<h6>
<i class="fas fa-money-bill-alt fa-fw"></i>
<span class="text-muted">
<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, app.user.currency ?? null ) | moneyFormat(app.user.currency ?? null) }}</span>
{% endif %}
{% endif %}
<span> - </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 %}
</span>
</h6>
</h6>
{% endif %}
{#
{% if part.comment != "" %}
<h6 title="{% trans %}comment.label{% endtrans %}">