fix crash when basket contains not existing product

This commit is contained in:
thomas girod
2024-08-07 20:15:46 +02:00
parent 417f328206
commit 0a2ed6dd94
2 changed files with 25 additions and 37 deletions

View File

@ -102,8 +102,12 @@
</div>
<div class="product-group">
{% for p in items %}
<button id="{{ p.id }}" class="product-button"
@click='add_from_catalog({{ p.id }}, {{ p.name|tojson }}, {{ p.selling_price }})'>
<button
id="{{ p.id }}"
class="product-button"
:class="{selected: items.some((i) => i.id === {{ p.id }})}"
@click='add_from_catalog({{ p.id }}, {{ p.name|tojson }}, {{ p.selling_price }})'
>
{% if p.icon %}
<img class="product-image" src="{{ p.icon.url }}"
alt="image de {{ p.name }}">