fix: the Montar's form checks (code, size, quantity, customer, freight) are guidance, not errors (DTF-WEB-1T)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 7m22s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m6s
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 7m22s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m6s
Real failures, the server's refusals and unreadable files, stay red and reach Sentry. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -276,7 +276,7 @@ async function montarChooseFolder(){
|
||||
}
|
||||
function montarFolderError(error){
|
||||
if(error&&['NotAllowedError','SecurityError'].includes(error.name)){
|
||||
say('Para ler as estampas, escolha a pasta dos pedidos em Integrações neste computador.',true);
|
||||
say('Para ler as estampas, escolha a pasta dos pedidos em Integrações neste computador.');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -564,27 +564,27 @@ async function montarCreate(){
|
||||
const kind=MONTAR.kind||'venda';
|
||||
let customer=null,name='';
|
||||
if(kind==='interno'){
|
||||
if(!montarInternalReady())return say('Peça à Gestão para completar o cliente interno.',true);
|
||||
if(!montarInternalReady())return say('Peça à Gestão para completar o cliente interno.');
|
||||
name=montarInternalField('name');
|
||||
}else{
|
||||
customer=montarCustomer();
|
||||
if(!montarCustomerFilled())return say('Preencha os dados do cliente.',true);
|
||||
if(!montarCustomerFilled())return say('Preencha os dados do cliente.');
|
||||
name=customer.name;
|
||||
}
|
||||
let withOrder=null,deliveryFreight=null,destination=null;
|
||||
if(kind==='venda'&&montarDelivery()==='with_order'){
|
||||
withOrder=montarWithOrder();
|
||||
if(!withOrder)return say('Informe o número do pedido de roupa.',true);
|
||||
if(!withOrder)return say('Informe o número do pedido de roupa.');
|
||||
}
|
||||
if(kind==='venda'&&montarDelivery()==='ship'){
|
||||
destination=montarDestination();
|
||||
if(!destination)return say('Preencha o endereço de entrega.',true);
|
||||
if(!MONTAR.freight)return say('Cote o frete e escolha uma opção.',true);
|
||||
if(MONTAR.freight.postal_code!==montarCep())return say('Cote o frete de novo para este CEP.',true);
|
||||
if(!destination)return say('Preencha o endereço de entrega.');
|
||||
if(!MONTAR.freight)return say('Cote o frete e escolha uma opção.');
|
||||
if(MONTAR.freight.postal_code!==montarCep())return say('Cote o frete de novo para este CEP.');
|
||||
deliveryFreight={service:MONTAR.freight.service,postal_code:montarCep()};
|
||||
}
|
||||
if(!MONTAR.lines.length)return say('Monte a folha primeiro.',true);
|
||||
if(!MONTAR.layout||MONTAR.layoutPending)return say('A montagem ainda está sendo calculada.',true);
|
||||
if(!MONTAR.lines.length)return say('Monte a folha primeiro.');
|
||||
if(!MONTAR.layout||MONTAR.layoutPending)return say('A montagem ainda está sendo calculada.');
|
||||
const lines=[...MONTAR.lines];
|
||||
if(!await ask('Criar pedido','Criar o pedido com '+plural(lines.reduce((t,line)=>t+line.qty,0),'estampa','estampas')+
|
||||
', '+metres(MONTAR.layout.altura/100)+', para '+name+'?','Criar pedido'))return;
|
||||
@@ -671,21 +671,21 @@ function montarClear(){
|
||||
|
||||
async function montarAdd(){
|
||||
const code=$('montar-code').value.trim(),size=montarSelected();
|
||||
if(!MONTAR_CODE.test(code))return say('Código inválido: use letras, números, ponto, hífen ou sublinhado, até 40.',true);
|
||||
if(!size)return say('Nenhum tamanho na tabela. Peça à Gestão para cadastrar.',true);
|
||||
if(!MONTAR_CODE.test(code))return say('Código inválido: use letras, números, ponto, hífen ou sublinhado, até 40.');
|
||||
if(!size)return say('Nenhum tamanho na tabela. Peça à Gestão para cadastrar.');
|
||||
const qty=Number($('montar-qty').value);
|
||||
if(!Number.isInteger(qty)||qty<1||qty>9999)return say('A quantidade vai de 1 a 9999.',true);
|
||||
if(!Number.isInteger(qty)||qty<1||qty>9999)return say('A quantidade vai de 1 a 9999.');
|
||||
if(!montarFolderReady())return;
|
||||
let found;
|
||||
try{found=await montarRead(code,size);}
|
||||
catch(e){if(!montarFolderError(e))say(e.message,true);return;}
|
||||
if(!found){montarPaintNotFound();return say('Código não existe em Estampas/.',true);}
|
||||
if(!found){montarPaintNotFound();return say('Código não existe em Estampas/.');}
|
||||
let stamp=null;
|
||||
try{stamp=await montarStampBrand(code);}catch(e){stamp={code,brand:'',public:false};}
|
||||
montarPaintPreview(found,stamp);
|
||||
if(found.widthCm>56)return say('A estampa tem '+cm(found.widthCm)+' cm de largura: o máximo é 56 cm.',true);
|
||||
if(found.widthCm>56)return say('A estampa tem '+cm(found.widthCm)+' cm de largura: o máximo é 56 cm.');
|
||||
const dpi=montarDpi(found);
|
||||
if(dpi<MONTAR_DPI_REFUSE)return say('A estampa tem só '+Math.floor(dpi)+' DPI em '+size.letter+': pequena demais.',true);
|
||||
if(dpi<MONTAR_DPI_REFUSE)return say('A estampa tem só '+Math.floor(dpi)+' DPI em '+size.letter+': pequena demais.');
|
||||
const existing=MONTAR.lines.find(line=>line.code===code&&line.letter===size.letter);
|
||||
if(existing){existing.qty=Math.min(9999,existing.qty+qty);montarChanged();return;}
|
||||
const url=URL.createObjectURL(found.file),picture=montarStampImage(url);
|
||||
@@ -727,12 +727,12 @@ function montarCollectSizes(){
|
||||
for(const row of rows){
|
||||
const letter=row.querySelector('.montar-letter').value.trim().toUpperCase();
|
||||
const width=Number(row.querySelector('.montar-width').value);
|
||||
if(!/^[A-Z]{1,2}$/.test(letter)){say('Cada tamanho precisa de uma letra de A a ZZ.',true);return null;}
|
||||
if(seen.has(letter)){say('A letra '+letter+' aparece mais de uma vez.',true);return null;}
|
||||
if(!(width>0&&width<=56)){say('A largura de '+letter+' vai de 0,01 a 56 cm.',true);return null;}
|
||||
if(!/^[A-Z]{1,2}$/.test(letter)){say('Cada tamanho precisa de uma letra de A a ZZ.');return null;}
|
||||
if(seen.has(letter)){say('A letra '+letter+' aparece mais de uma vez.');return null;}
|
||||
if(!(width>0&&width<=56)){say('A largura de '+letter+' vai de 0,01 a 56 cm.');return null;}
|
||||
seen.add(letter);sizes.push({letter,width_cm:Number(width.toFixed(2))});
|
||||
}
|
||||
if(!sizes.length){say('A tabela precisa de pelo menos um tamanho.',true);return null;}
|
||||
if(!sizes.length){say('A tabela precisa de pelo menos um tamanho.');return null;}
|
||||
return sizes;
|
||||
}
|
||||
async function montarSaveAdjustments(){
|
||||
@@ -743,7 +743,7 @@ async function montarSaveAdjustments(){
|
||||
customer={name:$('montar-interno-name').value.trim(),cnpj:$('montar-interno-doc').value.trim(),
|
||||
zap:$('montar-interno-zap').value.trim(),mail:$('montar-interno-mail').value.trim()};
|
||||
if(!['name','cnpj','zap','mail'].every(key=>customer[key])){
|
||||
say('Preencha todos os campos do cliente interno.',true);
|
||||
say('Preencha todos os campos do cliente interno.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user