Compare commits

...

2 Commits

Author SHA1 Message Date
Cauê Faleiros
b8ee3fb35a Merge approve fix for reviewed quotes (DTF-WEB-8)
All checks were successful
Build and deploy / Validate source (push) Successful in 7s
Build and deploy / Integration suite on a real stack (push) Successful in 6m51s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m15s
2026-11-12 15:20:12 -03:00
Cauê Faleiros
057643e167 fix: approving a reviewed quote no longer sends the acceptance stamps back
A quote held for review whose customer accepted the residue or the
stroke warning failed with "Confira os campos (422)" (DTF-WEB-8): the
server stamps residue_accepted_at and stroke_choice_at on the draft's
items, the Kanban sent the items back whole, and the item model forbids
extra fields. The metres field also showed the float noise of the draft
(212,32800000000012); it now shows up to three decimals.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-12 15:20:12 -03:00

View File

@@ -185,7 +185,10 @@ function review(quote){
} }
const form=node('form',undefined,'rform'); const form=node('form',undefined,'rform');
const edits=quote.draft.items.map((item,index)=>{const fields={};body.append(quoteItem(item,fields,null,index,count)); const edits=quote.draft.items.map((item,index)=>{const fields={};body.append(quoteItem(item,fields,null,index,count));
return ()=>({...item,metres:fields.metres.value,grade:Number(fields.grade.value)});}); // The times the customer accepted a warning are stamped by the server
// (app/api/quotes.py) and not part of an item sent back (DTF-WEB-8).
const {residue_accepted_at,stroke_choice_at,...sent}=item;
return ()=>({...sent,metres:fields.metres.value,grade:Number(fields.grade.value)});});
const check=node('input');check.required=true; const check=node('input');check.required=true;
const submit=node('button','Aprovar cotação','btn pri lg'); const submit=node('button','Aprovar cotação','btn pri lg');
foot.append(checkbox('Arquivos, metragem e nota conferidos',check),discardButton(quote),submit); foot.append(checkbox('Arquivos, metragem e nota conferidos',check),discardButton(quote),submit);
@@ -258,7 +261,7 @@ function quoteItem(item,fields,priced,index=0,count=1){
info.append(notes); info.append(notes);
if(fields){ if(fields){
const grid=node('div',undefined,'inputs'); const grid=node('div',undefined,'inputs');
fields.metres=node('input');Object.assign(fields.metres,{type:'number',min:'0.001',max:'12000',step:'any',value:item.metres,required:true}); fields.metres=node('input');Object.assign(fields.metres,{type:'number',min:'0.001',max:'12000',step:'any',value:String(Number(Number(item.metres).toFixed(3))),required:true});
fields.grade=node('input');Object.assign(fields.grade,{type:'number',min:'0',max:'100',step:'1',value:item.grade,required:true}); fields.grade=node('input');Object.assign(fields.grade,{type:'number',min:'0',max:'100',step:'1',value:item.grade,required:true});
const m=field('Metros conferidos',fields.metres,'O cliente pediu '+metres(item.metres)); const m=field('Metros conferidos',fields.metres,'O cliente pediu '+metres(item.metres));
const low=Number(item.grade)<60; const low=Number(item.grade)<60;