Display prices in PLN
All checks were successful
/ deploy-job (push) Successful in 1s

This commit is contained in:
2026-02-27 11:37:23 +01:00
parent 5088f6173f
commit e02fa4fc67
2 changed files with 23 additions and 7 deletions

View File

@@ -104,6 +104,11 @@ class Product extends Model
);
}
public function conversionRate(): ?float
{
return $this->conversionRate;
}
public function isDiscontinued(): bool
{
return $this->lastSeen < now()->format('Y-m-d');

View File

@@ -80,19 +80,30 @@
<td class="align-middle"><a href='https://{{ product.country.locale }}.ryobitools.eu{{ product.url }}'>link</a></td>
<td class="align-middle text-end">
{% if product.isDiscontinued() or product.priceCurrent == product.productStandardPrice %}
{{ product.priceLowest | format_currency(product.country.currency, {}, product.country.locale) }}
{{ product.priceLowest | format_currency(product.country.currency, {}, product.country.locale) }}<br>
{% if product.conversionRate is not empty and product.conversionRate != 1 %}
{{ (product.priceLowest * product.conversionRate) | format_currency('PLN', {}, 'pl') }}
{% endif %}
{% else %}
{% if product.priceLowest != product.priceCurrent %}{{ product.priceLowest | format_currency(product.country.currency, {}, product.country.locale) }}{% else %}
<span class="badge text-bg-info">now lowest</span>{% endif %}</td>
<span class="badge text-bg-info">now lowest</span>
{% endif %}</td>
{% endif %}
<td class="align-middle text-end">{{ product.priceCurrent | format_currency(product.country.currency, {}, product.country.locale) }}</td>
<td class="align-middle text-end">
{{ product.priceCurrent | format_currency(product.country.currency, {}, product.country.locale) }}<br>
{% if product.conversionRate is not empty and product.conversionRate != 1 %}
{{ (product.priceCurrent * product.conversionRate) | format_currency('PLN', {}, 'pl') }}
{% endif %}
</td>
<td class="align-middle">
<div class="d-flex flex-row">
{% if product.priceCurrent != product.productStandardPrice %}<span
class="badge text-bg-warning text-decoration-line-through flex-fill">{{ product.productStandardPrice | format_currency(product.country.currency, {}, product.country.locale) }}</span>
<span
class="badge text-bg-success flex-fill">{{ ((1 - product.priceCurrent / product.productStandardPrice)*100)|number_format(0) }}%</span>
{% if product.priceCurrent != product.productStandardPrice %}
<span class="badge text-bg-warning text-decoration-line-through flex-fill">{{ product.productStandardPrice | format_currency(product.country.currency, {}, product.country.locale) }}</span>
{% if product.conversionRate is not empty and product.conversionRate != 1 %}
<span class="badge text-bg-warning text-decoration-line-through flex-fill">{{ (product.productStandardPrice * product.conversionRate) | format_currency('PLN', {}, 'pl') }}</span>
{% endif %}
<span class="badge text-bg-success flex-fill">{{ ((1 - product.priceCurrent / product.productStandardPrice)*100)|number_format(0) }}%</span>
{% endif %}
</div>
</td>