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
This commit is contained in:
Claude 2026-05-29 15:20:44 +00:00
parent bacce29312
commit 40d4bae612
No known key found for this signature in database
2 changed files with 4 additions and 2 deletions

View file

@ -171,6 +171,7 @@ products:
fr: Rapport écrit
"no": Skriftlig rapport
uom: EA
qty: 1
price: 500.00
- code: REVIEW
description:

View file

@ -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 (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