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){