mirror of
https://github.com/kbenestad/invoice.git
synced 2026-06-18 08:04:32 +00:00
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:
parent
bacce29312
commit
40d4bae612
2 changed files with 4 additions and 2 deletions
|
|
@ -171,6 +171,7 @@ products:
|
|||
fr: Rapport écrit
|
||||
"no": Skriftlig rapport
|
||||
uom: EA
|
||||
qty: 1
|
||||
price: 500.00
|
||||
- code: REVIEW
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue