5 Commits

Author SHA1 Message Date
6cfee98a6b Country badge.
All checks were successful
/ deploy-job (push) Successful in 0s
2026-02-18 07:49:50 +01:00
bafa889c59 Merge branch 'refs/heads/master' into feature/link-badges 2026-02-17 10:23:08 +01:00
d18c735b63 Add locale badges to promos
All checks were successful
/ deploy-job (push) Successful in 0s
2026-02-16 08:59:46 +01:00
cac4e1f925 Badges as links
All checks were successful
/ deploy-job (push) Successful in 0s
2026-02-15 11:51:00 +01:00
7f7cc72647 Badges as links
All checks were successful
/ deploy-job (push) Successful in 0s
2026-02-13 08:18:51 +01:00
2 changed files with 20 additions and 7 deletions

View File

@@ -20,8 +20,11 @@ final class PromosController extends BaseController
$promos = Product::select($this->database->getConnection()->raw("distinct json_extract(promotions, '$.slug') as slug, json_extract(promotions, '$.tag') as tag")) $promos = Product::select($this->database->getConnection()->raw("distinct json_extract(promotions, '$.slug') as slug, json_extract(promotions, '$.tag') as tag"))
->addSelect('countries.locale')
->whereRaw("json_extract(promotions, '$.tag') is not null") ->whereRaw("json_extract(promotions, '$.tag') is not null")
->get(); ->join('countries', 'products.country_id', '=', 'countries.id')
->get()
->groupBy('locale');
return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'promos' . $promo, 'promos' => $promos->toArray()]); return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'promos' . $promo, 'promos' => $promos->toArray()]);
} }

View File

@@ -6,9 +6,17 @@
{% endif %} {% endif %}
{% if listType starts with 'promos' %} {% if listType starts with 'promos' %}
{% for promo in promos %} <ul class="list-group list-group-flush">
<a href="{{ path('app_promos', {'promo': promo.slug}) }}"><span class="badge bg-info">PROMO: {{ promo.tag }}</span></a> {% for locale, promoByLocale in promos %}
{% endfor %} <li class="list-group-item">
<h5 class="d-inline-block"><span class="badge bg-info">{{ locale | upper }}</span></h5>
{% for promo in promoByLocale %}
<a href="{{ path('app_promos', {'promo': promo.slug}) }}"><span
class="badge bg-info">PROMO: {{ promo.tag }} [{{ promo.locale | upper }}]</span></a>
{% endfor %}
</li>
{% endfor %}
</ul>
{% endif %} {% endif %}
@@ -38,22 +46,24 @@
<td class="align-middle"> <td class="align-middle">
<a href='{{ path('app_product', {'productId': product.id}) }}' <a href='{{ path('app_product', {'productId': product.id}) }}'
class="text-decoration-none">{{ product.name }}</a> class="text-decoration-none">{{ product.name }}</a>
<br>
{% if product.stock > 0 %} {% if product.stock > 0 %}
<span class="badge text-bg-light">stock: {{ product.stock }}</span> <span class="badge text-bg-light">stock: {{ product.stock }}</span>
{% else %} {% else %}
<span class="badge text-bg-warning">out of stock</span> <span class="badge text-bg-warning">out of stock</span>
{% endif %} {% endif %}
{% if product.isDiscontinued() %} {% if product.isDiscontinued() %}
<span class="badge text-bg-secondary" data-bs-toggle="tooltip" <a href="{{ path('app_discontinued') }}"><span class="badge text-bg-secondary" data-bs-toggle="tooltip"
data-bs-title="Last update: {{ product.lastSeen }}">is discontinued</span> data-bs-title="Last update: {{ product.lastSeen }}">is discontinued</span></a>
{% endif %} {% endif %}
{% if product.isNew() %} {% if product.isNew() %}
<span class="badge text-bg-success">is new</span> <a href="{{ path('app_new') }}"><span class="badge text-bg-success">is new</span></a>
{% endif %} {% endif %}
<span class="badge text-bg-light"><a <span class="badge text-bg-light"><a
href="{{ path('app_search', {'search': product.subTitle}) }}" href="{{ path('app_search', {'search': product.subTitle}) }}"
class="link-underline link-underline-opacity-0 link-dark">{{ product.subTitle }}</a></span> class="link-underline link-underline-opacity-0 link-dark">{{ product.subTitle }}</a></span>
{% if product.promotions is not null and product.promotions.hasPromotion %}<a href="{{ path('app_promos', {'promo': product.promotions.slug}) }}"><span class="badge bg-info">PROMO: {{ product.promotions.tag }}</span></a>{% endif %} {% if product.promotions is not null and product.promotions.hasPromotion %}<a href="{{ path('app_promos', {'promo': product.promotions.slug}) }}"><span class="badge bg-info">PROMO: {{ product.promotions.tag }}</span></a>{% endif %}
<span class="badge text-bg-light">{{ product.country.countryName }}</span>
</td> </td>
<td class="align-middle"> <td class="align-middle">
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';"> <nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';">