save discount profile is now working perfectly well
This commit is contained in:
8
assets/views/admin/catalog/_price_preview.html
Normal file
8
assets/views/admin/catalog/_price_preview.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{# OOB fragment: effective-price cells recomputed from the unsaved profile
|
||||
selection on the products page. Each span replaces the matching #eff-<id>
|
||||
span in the table via htmx out-of-band swap. Rendered by
|
||||
admin_products::profiles_preview. #}
|
||||
{% import "macros/ui.html" as ui %}
|
||||
{% for product in products %}
|
||||
<span id="eff-{{ product.id }}" hx-swap-oob="true">{{ ui::eff_price(p=product, preview=true) }}</span>
|
||||
{% endfor %}
|
||||
@@ -40,6 +40,9 @@
|
||||
</p>
|
||||
{% if profiles | length > 0 %}
|
||||
<form method="post" action="/admin/catalog/products/profiles?audience={{ audience }}" class="mt-3 space-y-3"
|
||||
hx-post="/admin/catalog/products/profiles/preview?audience={{ audience }}&category={{ selected_category }}"
|
||||
hx-trigger="change"
|
||||
hx-swap="none"
|
||||
x-data="{
|
||||
orig: { {% for p in profiles %}'{{ p.id }}': {% if p.assigned %}true{% else %}false{% endif %}{% if not loop.last %}, {% endif %}{% endfor %} },
|
||||
sel: { {% for p in profiles %}'{{ p.id }}': {% if p.assigned %}true{% else %}false{% endif %}{% if not loop.last %}, {% endif %}{% endfor %} },
|
||||
@@ -113,12 +116,7 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="px-4 py-3 tabular-nums">
|
||||
{% if product.effective_reduced %}
|
||||
<span class="font-medium text-primary dark:text-primary-dark">{{ product.effective_price }} {{ product.currency }}</span>
|
||||
<span class="ml-1 text-xs text-on-surface/60 dark:text-on-surface-dark/60">(−{{ product.effective_percent_off }}%)</span>
|
||||
{% else %}
|
||||
{{ product.effective_price }} {{ product.currency }}
|
||||
{% endif %}
|
||||
<span id="eff-{{ product.id }}">{{ ui::eff_price(p=product) }}</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 tabular-nums">{{ product.stock }}</td>
|
||||
<td class="px-4 py-3">
|
||||
|
||||
Reference in New Issue
Block a user