From 29854a972b8eee6faf382c6c7e0abb55b533a024 Mon Sep 17 00:00:00 2001
From: Priec
Date: Mon, 22 Jun 2026 13:51:40 +0200
Subject: [PATCH] save discount profile is now working perfectly well
---
.../views/admin/catalog/_price_preview.html | 8 +++
assets/views/admin/catalog/products.html | 10 ++--
assets/views/macros/ui.html | 15 +++++
src/controllers/admin_products.rs | 60 +++++++++++++++++++
src/shared/pricing.rs | 34 +++++++++++
5 files changed, 121 insertions(+), 6 deletions(-)
create mode 100644 assets/views/admin/catalog/_price_preview.html
diff --git a/assets/views/admin/catalog/_price_preview.html b/assets/views/admin/catalog/_price_preview.html
new file mode 100644
index 0000000..766af27
--- /dev/null
+++ b/assets/views/admin/catalog/_price_preview.html
@@ -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-
+ 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 %}
+{{ ui::eff_price(p=product, preview=true) }}
+{% endfor %}
diff --git a/assets/views/admin/catalog/products.html b/assets/views/admin/catalog/products.html
index 63943c1..51cf00e 100644
--- a/assets/views/admin/catalog/products.html
+++ b/assets/views/admin/catalog/products.html
@@ -40,6 +40,9 @@
{% if profiles | length > 0 %}