From eef899e838c962757718e1b7f04158f04aad8f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Thu, 12 Nov 2026 15:48:42 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20Site=20tab,=20an=20empty=20Novo=20pre?= =?UTF-8?q?=C3=A7o=20keeps=20the=20current=20price?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The grey 9,90 in Novo preço is only a hint; saving a band with the field empty refused with "Informe o preço em reais". Empty now keeps the current price, and Salvar sits below the bands it saves with the price. Co-Authored-By: Claude Opus 5.5 (1M context) --- web/kanban-site.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/kanban-site.js b/web/kanban-site.js index 3052eca..f271f36 100644 --- a/web/kanban-site.js +++ b/web/kanban-site.js @@ -101,7 +101,8 @@ function sitePriceBlock(product){ return {from_metres:String(from),unit_cents:unit}; }); const save=button('Salvar',async()=>{ - const cents=moneyInputCents(price.value); + // Empty keeps the current price (the grey hint), so a band alone can be added. + const cents=price.value.trim()?moneyInputCents(price.value):product.unit_cents>0?product.unit_cents:null; if(cents===null)throw new Error('Informe o preço em reais, como 19,90.'); const whenDate=starts.value?new Date(starts.value):null; if(whenDate&&Number.isNaN(whenDate.getTime()))throw new Error('Data inválida.'); @@ -111,7 +112,8 @@ function sitePriceBlock(product){ say(whenDate?'Preço salvo para '+when(whenDate)+'.':'Preço salvo. Vale a partir de agora.'); await loadSiteAdmin(); },'btn pri'); - form.append(priceLabel,startsLabel,save,...(permiteFaixas?[bands]:[])); + // Salvar after the bands: it saves the price and its bands together. + form.append(priceLabel,startsLabel,...(permiteFaixas?[bands]:[]),save); const scheduled=node('div',undefined,'siteScheduled'); if(product.scheduled.length){