From 40d4bae612f210d0fe51c5554b201448b8e891ab Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 29 May 2026 15:20:44 +0000 Subject: [PATCH] Support optional preset qty on predefined products Products in config.yml can now include a qty field. When a predefined line is selected the quantity input is pre-filled with that value (still editable). Demonstrated on the REPORT product (qty: 1). https://claude.ai/code/session_0127ywsQA7qWcX3tGX4itqN5 --- app/config.yml | 1 + app/index.html | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/config.yml b/app/config.yml index 7ea2649..19ebdff 100644 --- a/app/config.yml +++ b/app/config.yml @@ -171,6 +171,7 @@ products: fr: Rapport écrit "no": Skriftlig rapport uom: EA + qty: 1 price: 500.00 - code: REVIEW description: diff --git a/app/index.html b/app/index.html index e2fa748..a76cb6d 100644 --- a/app/index.html +++ b/app/index.html @@ -832,11 +832,12 @@ function pickProduct(i) { if (uomEl) uomEl.disabled = false; if (!fxOn && priceEl) priceEl.disabled = false; } else { - // Predefined — fill UOM + price from config; lock UOM, unlock qty + price + // Predefined — fill UOM + price (+ optional qty) from config; lock UOM, unlock qty + price const p = (cfg.products || [])[+v]; if (p) { - if (uomEl && p.uom) uomEl.value = p.uom; + if (uomEl && p.uom) uomEl.value = p.uom; if (priceEl && p.price != null) priceEl.value = p.price; + if (qtyEl && p.qty != null) qtyEl.value = p.qty; } if (qtyEl) qtyEl.disabled = false; if (uomEl) uomEl.disabled = true; // UOM locked for predefined items