1import{j as e}from"./mui-CRsYZxVY.js";import{Font as Z,StyleSheet as ee,Page as U,Text as o,View as i,Image as w,Document as te}from"./react-pdf.browser-1EhQzxMi.js";import{d2 as oe,d3 as C,bo as S,d4 as ne,f as ie,d5 as le,aP as re,aR as se,aS as Q,aQ as de}from"./index-TALscxEc.js";import{s as G}from"./stoqui_logo-C1JOQLy2.js";import"./vendor-Dwao9eNC.js";import"./index-BNv7yOC_.js";import"./query-8ViTdhdk.js";import"./datePickers-BIJXYOKG.js";import"./icons-D8aatgQ4.js";import"./lab-DSem1Osk.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};n.SENTRY_RELEASE={id:"2ad85febf9735404429b0670d4acf56a0af5a0a2"}}catch{}})();try{(function(){var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},h=new n.Error().stack;h&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[h]="32aa596d-3fde-4e14-ad62-a4d3a17e953d",n._sentryDebugIdIdentifier="sentry-dbid-32aa596d-3fde-4e14-ad62-a4d3a17e953d")})()}catch{}Z.registerEmojiSource({format:"png",url:"https://cdn.jsdelivr.net/gh/twitter/[email protected]/assets/72x72/"});const B=n=>n?[".png",".jpg",".jpeg"].some(s=>n.toLowerCase().includes(s)):!1,t=ee.create({page:{flexDirection:"column",backgroundColor:"#ffffff",padding:"8mm",fontFamily:"Helvetica",fontSize:10,color:"#000000"},headerContainer:{marginBottom:6},headerRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"flex-start",marginBottom:3},headerLeft:{flexDirection:"row",alignItems:"center",gap:12,flex:1},logo:{height:26,maxWidth:100,objectFit:"contain"},storeInfo:{flexDirection:"column"},storeName:{fontSize:14,fontWeight:"bold",color:"#333333",lineHeight:1.1,marginBottom:1},storeUrl:{fontSize:10,fontWeight:"bold",color:"#000000",marginBottom:1},storeAddress:{fontSize:10,color:"#666666",lineHeight:1.1},orderNumber:{fontSize:14,fontWeight:"bold",color:"#333333",textAlign:"right"},divider:{borderBottomWidth:1,borderBottomColor:"#333333",marginBottom:6},orderInfoContainer:{marginBottom:6},orderInfoRow:{flexDirection:"row",gap:12,flexWrap:"wrap"},orderInfoColumn:{minWidth:160,flex:1},sectionTitle:{fontSize:10,fontWeight:"bold",color:"#333333",marginBottom:2},infoText:{fontSize:10,marginBottom:1},statusChip:{paddingHorizontal:3,paddingVertical:1,borderRadius:2,fontSize:9,fontWeight:"bold"},productSection:{marginTop:12,marginBottom:10},productTable:{marginBottom:10},tableHeader:{backgroundColor:"#f5f5f5",paddingVertical:4,paddingHorizontal:8,border:"1px solid #dddddd",borderBottom:"1px solid #dddddd",flexDirection:"row"},tableHeaderText:{fontSize:10,fontWeight:"bold"},tableRow:{paddingVertical:4,paddingHorizontal:8,borderLeft:"1px solid #dddddd",borderRight:"1px solid #dddddd",borderBottom:"1px solid #eeeeee",flexDirection:"row",alignItems:"center",wrap:!1},tableCell:{fontSize:10,overflow:"hidden"},productPhoto:{width:24,height:24,objectFit:"contain"},productPhotoPlaceholder:{width:24,height:24,backgroundColor:"#f5f5f5",borderRadius:2},totalsContainer:{alignSelf:"flex-end",minWidth:240,maxWidth:340},totalRow:{flexDirection:"row",justifyContent:"space-between",marginBottom:4},totalText:{fontSize:10},paymentMethodText:{fontSize:10,flexShrink:1,maxWidth:"45%"},grandTotalRow:{flexDirection:"row",justifyContent:"space-between",marginTop:6,paddingTop:3,borderTop:"1px solid #dddddd"},grandTotalText:{fontSize:12,fontWeight:"bold",color:"#333333"},paymentSection:{marginTop:10,borderTop:"1px solid #dddddd",paddingTop:10},observationsSection:{marginTop:10,borderTop:"1px solid #dddddd",paddingTop:10},observationBox:{paddingLeft:6,borderLeft:"3px solid #e0e0e0",backgroundColor:"#fafafa",padding:6,borderRadius:4,marginTop:3},footer:{marginTop:24,paddingTop:12,borderTop:"1px solid #dddddd",alignItems:"center"},footerRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%"},footerText:{fontSize:9,color:"#666666"},footerLeft:{flex:1,alignItems:"flex-start"},footerRight:{flex:1,alignItems:"flex-end"},demoWarning:{color:"#d32f2f",fontSize:10,fontWeight:"bold",textAlign:"center",marginTop:6},watermarkLogo:{height:70,marginBottom:12},watermarkText:{fontSize:20,fontWeight:"bold",color:"#000000",textAlign:"center",maxWidth:260},watermarkContainer:{position:"absolute",display:"flex",flexDirection:"column",top:"50%",left:"15%",alignItems:"center",justifyContent:"center",opacity:.4,transform:"translate(-50%, -50%) rotate(-45deg)"},watermarkContent:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:12}}),ae=({order:n,storeAddress:h,webCatalog:s,paymentData:y,customerAddresses:R,storeUrl:Y,isPro:W,includePhotos:v=!1,productImagesMap:z})=>{var N,L,H,q,V,F;if(!n||!s)return e.jsx(U,{size:"A4",style:t.page,children:e.jsx(o,{children:"Página em branco"})});const J=new Date(n.data_pedido),D=n.subtotal,P=((N=n.frete_pedido)==null?void 0:N.valor_frete)||0,A=n.valor_desconto||0,E=n.taxa_de_venda||0,k=D+P+E-A,K=n.itens_pedido.reduce((l,m)=>l+m.quantidade,0),M=oe(n.status_pedido),c=l=>
1l.toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),$=()=>{const l=n.itens_pedido.reduce((j,r)=>{var p,x;const d=((p=r.produto_variacao)==null?void 0:p.codigo_produto)||((x=r.produto)==null?void 0:x.sku)||"";return Math.max(j,d.length)},0);return`${Math.min(Math.max(8+l*.5,8),20)}%`},I=v?7:0,X=()=>{const l=Math.max(...n.itens_pedido.map(g=>g.preco_snapshot)),m=Math.max(...n.itens_pedido.map(g=>g.quantidade*g.preco_snapshot)),j=Math.max(...n.itens_pedido.map(g=>g.quantidade)),r=c(l),d=c(m),p=j.toString(),x=1.2,_=Math.max(12.5,Math.min(2,r.length*x)),T=Math.max(12.5,Math.min(26,d.length*x)),b=Math.max(10,Math.min(14,p.length*x+3)),f=100-parseFloat($())-I-_-T-b;return{unitPrice:`${_}%`,total:`${T}%`,quantity:`${b}%`,description:`${Math.max(f,25)}%`}},O=$(),u=X();return e.jsxs(U,{size:"A4",style:t.page,children:[e.jsx(i,{style:t.headerContainer,children:e.jsxs(i,{style:t.headerRow,children:[e.jsxs(i,{style:t.headerLeft,children:[s!=null&&s.processed_logo_url?e.jsx(w,{src:s.processed_logo_url,style:t.logo}):s!=null&&s.logo_url&&B(s.logo_url)?e.jsx(w,{src:s.logo_url,style:t.logo}):e.jsx(o,{style:t.storeName,children:(s==null?void 0:s.nome_loja)||"Loja"}),e.jsxs(i,{style:t.storeInfo,children:[((s==null?void 0:s.processed_logo_url)||(s==null?void 0:s.logo_url)&&B(s.logo_url))&&e.jsx(o,{style:t.storeName,children:(s==null?void 0:s.nome_loja)||"Loja"}),e.jsx(o,{style:t.storeUrl,children:W?Y:"https://www.stoqui.com.br"}),h&&e.jsxs(o,{style:t.storeAddress,children:[h.logradouro,", ",h.numero,h.complemento&&` - ${h.complemento}`,", ",h.bairro," - ",h.localidade," -"," ",h.uf," - CEP: ",C(h.cep)]})]})]}),e.jsxs(o,{style:t.orderNumber,children:["Pedido #",n.numero_pedido||n.pedido_id]})]})}),e.jsx(i,{style:t.divider}),e.jsx(i,{style:t.orderInfoContainer,children:e.jsxs(i,{style:t.orderInfoRow,children:[e.jsxs(i,{style:t.orderInfoColumn,children:[e.jsx(o,{style:t.sectionTitle,children:"INFORMAÃÃES DO PEDIDO"}),e.jsxs(o,{style:t.infoText,children:[e.jsx(o,{style:{fontWeight:"bold"},children:"Data:"})," ",S(J,"dd/MM/yy - HH:mm")]}),e.jsxs(i,{style:{flexDirection:"row",alignItems:"center",gap:4},children:[e.jsx(o,{style:[t.infoText,{fontWeight:"bold"}],children:"Status:"}),e.jsx(o,{style:[t.statusChip,{backgroundColor:M.backgroundColor,color:M.color}],children:ne(n.status_pedido)})]}),e.jsxs(o,{style:t.infoText,children:[e.jsx(o,{style:{fontWeight:"bold"},children:"Cliente:"})," ",((L=n.cliente)==null?void 0:L.nome)||"Cliente não registrado"]})]}),e.jsxs(i,{style:t.orderInfoColumn,children:[e.jsx(o,{style:t.sectionTitle,children:"CONTATO & ENTREGA"}),((H=n.cliente)==null?void 0:H.telefone)&&e.jsxs(o,{style:t.infoText,children:[e.jsx(o,{style:{fontWeight:"bold"},children:"Tel:"})," ",ie(n.cliente.telefone)]}),n.frete_pedido&&e.jsxs(o,{style:t.infoText,children:[e.jsx(o,{style:{fontWeight:"bold"},children:"Tipo:"})," ",{frete_gratis:"Frete grátis",frete_distancia:"Frete/Distância",frete_personalizado:"Frete custom",correios:"Correios",melhor_envio:"Melhor Envio",superfrete:"Superfrete",uber:"Uber",a_combinar:"A Combinar",retirada:"Retirada local"}[n.frete_pedido.tipo_frete]||n.frete_pedido.tipo_frete]}),((q=n.frete_pedido)==null?void 0:q.rastreio_codigo)&&e.jsxs(o,{style:t.infoText,children:[e.jsx(o,{style:{fontWeight:"bold"},children:"Cod. Rastr.:"})," ",n.frete_pedido.rastreio_codigo]})]}),e.jsxs(i,{style:t.orderInfoColumn,children:[n.endereco_entrega&&((V=n.frete_pedido)==null?void 0:V.tipo_frete)!=="retirada"&&e.jsxs(i,{children:[e.jsx(o,{style:t.sectionTitle,children:"ENDEREÃO DE ENTREGA"}),e.jsxs(o,{style:t.infoText,children:[n.endereco_entrega.nome_destinatario&&e.jsxs(o,{style:{fontWeight:"bold"},children:[n.endereco_entrega.nome_destinatario,` 2`]}),n.endereco_entrega.logradouro,","," ",n.endereco_entrega.numero,n.endereco_entrega.complemento&&` - ${n.endereco_entrega.complemento}`,` 3`,n.endereco_entrega.bairro," -"," ",n.endereco_entrega.localidade," -"," ",n.endereco_entrega.uf,` 4`,"CEP: ",C(n.endereco_entrega.cep)]})]}),((F=n.frete_pedido)==null?void 0:F.tipo_frete)==="retirada"&&R&&R.length>0&&e.jsxs(i,{children:[e.jsx(o,{style:t.sectionTitle,children:"ENDEREÃO DO CLIENTE"}),e.jsx(o,{style:t.infoText,children:(()=>{const l=R[0];return e.jsxs(e.Fragment,{children:[l.nome_destinatario,` 5`,l.logradouro,", ",l.numero,l.complemento&&` - ${l.complemento}`,` 6`,l.bairro," -"," ",l.localidade," - ",l.uf,` 7`,"CEP: ",C(l.cep)]})})()})]})]})]})}),e.jsx(i,{style:{borderBottomWidth:1,borderBottomColor:"#dddddd",marginBottom:8}}),e.jsxs(i,{style:t.productSection,children:[e.jsx(o,{style:[t.sectionTitle,{fontSize:14,marginBottom:8}],children:"Produtos"}),e.jsxs(i,{style:t.productTable,children:[e.jsxs(i,{style:t.tableHeader,children:[e.jsx(i,{style:{width:O},children:e.jsx(o,{style:t.tableHeaderText,children:"COD"})}),v&&e.jsx(i,{style:{width:`${I}%`},children:e.jsx(o,{style:t.tableHeaderText,children:"FOTO"})}),e.jsx(i,{style:{width:u.description},children:e.jsx(o,{style:t.tableHeaderText,children:"DESCRIÃÃO"})}),e.jsx(i,{style:{width:u.quantity},children:e.jsx(o,{style:[t.tableHeaderText,{textAlign:"center"}],children:"QTD"})}),e.jsx(i,{style:{width:u.unitPrice},children:e.jsx(o,{style:[t.tableHeaderText,{textAlign:"right"}],children:"PREÃO UN."})}),e.jsx(i,{style:{width:u.total},children:e.jsx(o,{style:[t.tableHeaderText,{textAlign:"right"}],children:"TOTAL"})})]}),n.itens_pedido.map((l,m)=>{var T,b;const j=l.produto.nome||"",r=((T=l.produto_variacao)==null?void 0:T.codigo_produto)||((b=l.produto)==null?void 0:b.sku)||"";let d="";if(l.produto_variacao){const a=l.produto_variacao.produto_variacao_valor.map(f=>`${f.atributo_valor.atributo.nome}: ${f.atributo_valor.valor}`).join(", ");a&&(d=` (${a})`)}const p=l.quantidade*l.preco_snapshot,x=v?le(l):null,_=x&&z?z[x]:null;return e.jsxs(i,{style:[t.tableRow,{borderBottom:m===n.itens_pedido.length-1?"1px solid #dddddd":"1px solid #eeeeee"}],wrap:!1,children:[e.jsx(i,{style:{width:O},children:e.jsx(o,{style:t.tableCell,children:r})}),v&&e.jsx(i,{style:{width:`${I}%`},children:_?e.jsx(w,{src:_,style:t.productPhoto}):e.jsx(i,{style:t.productPhotoPlaceholder})}),e.jsxs(i,{style:{width:u.description},children:[e.jsxs(o,{style:t.tableCell,children:[j,d]}),Array.isArray(l.combo_componentes)&&l.combo_componentes.length>0&&e.jsx(i,{style:{marginTop:2,marginLeft:6},children:l.combo_componentes.map(a=>{var f,g;return e.jsxs(o,{style:[t.tableCell,{fontSize:8,color:"#444444"}],children:[`${a.quantidade}x ${((f=a.produto)==null?void 0:f.nome)??""}`,(g=a.produto_variacao)!=null&&g.nome?` (${a.produto_variacao.nome})`:""]},a.id??`${a.produto_id}-${a.produto_variacao_id??"p"}`)})}),Array.isArray(l.item_pedido_personalizacao)&&l.item_pedido_personalizacao.length>0&&e.jsx(i,{style:{marginTop:2,marginLeft:6},children:[...l.item_pedido_personalizacao].sort((a,f)=>(a.ordem_snapshot??0)-(f.ordem_snapshot??0)).map(a=>{const f=a.tipo_snapshot==="image"?a.arquivo_nome||a.arquivo_url||"imagem enviada":a.valor||"-";return e.jsxs(o,{style:[t.tableCell,{fontSize:8,color:"#444444"}],children:[e.jsxs(o,{style:{fontWeight:"bold"},children:[a.label_snapshot,":"]}),` ${f}`]},a.id)})})]}),e.jsx(i,{style:{width:u.quantity},children:e.jsx(o,{style:[t.tableCell,{textAlign:"center"}],children:l.quantidade})}),e.jsx(i,{style:{width:u.unitPrice},children:e.jsx(o,{style:[t.tableCell,{textAlign:"right"}],children:c(l.preco_snapshot)})}),e.jsx(i,{style:{width:u.total},children:e.jsx(o,{style:[t.tableCell,{textAlign:"right",fontWeight:"bold"}],children:c(p)})})]},l.id?`i-${l.id}`:`${l.produto_id}-${l.produto_variacao_id||"main"}`)})]})]}),e.jsxs(i,{style:t.totalsContainer,children:[e.jsxs(i,{style:t.totalRow,children:[e.jsx(o,{style:[t.totalText,{flexShrink:0}],children:"Subtotal:"}),e.jsx(o,{style:[t.totalText,{textAlign:"right",flexShrink:1}],children:c(D)})]}),P>0&&e.jsxs(i,{style:t.totalRow,children:[e.jsx(o,{style:[t.totalText,{flexShrink:0}],children:"Frete:"}),e.jsx(o,{style:[t.totalText,{textAlign:"right",flexShrink:1}],children:c(P)})]}),E>0&&e.jsxs(i,{style:t.totalRow,children:[e.jsx(o,{style:[t.totalText,{flexShrink:0}],children:"Taxa de venda:"}),e.jsx(o,{style:[t.totalText,{textAlign:"right",flexShrink:1}],children:c(E)})]}),A>0&&e.jsxs(i,{style:t.totalRow,children:[e.jsx(o,{style:[t.totalText,{flexShrink:0}],children:"Desconto:"}),e.jsxs(o,{style:[t.totalText,{color:"#333333",textAlign:"right",flexShrink:1}],children:["-",c(A)]})]}),e.jsxs(i,{style:t.totalRow,children:[e.jsx(o,{style:[t.totalText,{flexShrink:0}],children:"Qtd. Total:"}),e.jsx(o,{style:[t.totalText,{textAlign:"right",flexShrink:1}],children:K})]}),e.jsxs(i,{style:t.grandTotalRow,children:[e.jsx(o,{style:[t.grandTotalText,{flexShrink:0}],children:"TOTAL:"}),e.jsx(o,{style:[t.grandTotalText,{textAlign:"right",flexShrink:1}],children:c(k)})]})]}),y&&(()=>{const l=[];let m=0;return y.parcelas.forEach(r=>{r.pagamentos&&r.pagamentos.length>0&&r.pagamentos.forEach(d=>{var x;(d.status==="pago"||!d.status&&r.status_parcela==="paga")&&(l.push({method:((x=d.forma_pagamento)==null?void 0:x.nome)||"Sem método",amount:d.valor,date:S(new Date(d.data_pagamento),"dd/MM/yyyy"),installmentNumber:r.numero_parcela}),m+=d.valor)})}),y.parcelas&&y.parcelas.length>0?e.jsxs(i,{style:t.paymentSection,children:[e.jsx(o,{style:[t.sectionTitle,{fontSize:16,marginBottom:12}],children:"Informações de pagamento"}),e.jsxs(i,{style:t.totalsContainer,children:[l.length>0&&e.jsxs(i,{children:[l.map((r,d)=>e.jsxs(i,{style:t.totalRow,children:[e.jsxs(o,{style:[t.paymentMethodText],children:[r.method," (",r.date,")",r.installmentNumber&&n.condicao_pagamento==="parcelado"&&` - Parc. ${r.installmentNumber}`,":"]}),e.jsx(o,{style:[t.totalText,{flexShrink:0,textAlign:"right"}],children:c(r.amount)})]},d)),e.jsx(i,{style:{borderBottomWidth:1,borderBottomColor:"#dddddd",marginVertical:4}})]}),e.jsxs(i,{style:t.totalRow,children:[e.jsx(o,{style:[t.totalText,{fontWeight:"bold",flexShrink:0}],children:"Total pago:"}),e.jsx(o,{style:[t.totalText,{fontWeight:"bold",textAlign:"right",flexShrink:1}],children:c(m)})]}),k-m>0&&e.jsxs(i,{style:t.totalRow,children:[e.jsx(o,{style:[t.totalText,{flexShrink:0}],children:"Pendente:"}),e.jsx(o,{style:[t.totalText,{textAlign:"right",flexShrink:1}],children:c(k-m)})]}),y.parcelas&&y.parcelas.length>0&&(n.condicao_pagamento==="parcelado"||n.condicao_pagamento==="fiado")&&e.jsxs(i,{style:{marginTop:8},children:[e.jsx(i,{style:{borderBottomWidth:1,borderBottomColor:"#dddddd",marginVertical:4}}),e.jsx(o,{style:[t.totalText,{fontWeight:"bold",color:"#666666",marginBottom:4}],children:n.condicao_pagamento==="parcelado"?`Parcelas (${y.parcelas.length}x):`:n.condicao_pagamento==="fiado"?"Pagamento a prazo:":"Condição de pagamento:"}),y.parcelas.map(r=>{const d=re((r.pagamentos??[]).map(x=>x.valor)),p=se(r.valor_original,d);return e.jsxs(i,{style:t.totalRow,children:[e.jsxs(o,{style:[t.totalText,{flexShrink:0}],children:[n.condicao_pagamento==="fiado"?`${S(new Date(r.data_vencimento),"dd/MM/yy")}`:`${r.numero_parcela}ª - ${S(new Date(r.data_vencimento),"dd/MM/yy")}`,":"]}),e.jsx(o,{style:[t.totalText,{textAlign:"right",flexShrink:1}],children:Q(d)>0&&Q(p)>0?`${c(d)} / ${c(r.valor_original)} (parcial)`:de(d,r.valor_original)?`${c(r.valor_original)} (pago)`:`${c(r.valor_original)} (pendente)`})]},r.id)})]})]})]}):null})(),(n.observacoes_cliente||n.observacoes)&&e.jsxs(i,{style:t.observationsSection,children:[e.jsx(o,{style:[t.sectionTitle,{fontSize:16,marginBottom:12}],children:"Observações"}),n.observacoes_cliente&&e.jsxs(i,{style:{marginBottom:12},children:[e.jsx(o,{style:[t.sectionTitle,{fontSize:11,color:"#333333",marginBottom:4}],children:"Obs. Cliente:"}),e.jsx(i,{style:t.observationBox,children:e.jsx(o,{style:[t.totalText,{color:"#666666"}],children:n.observacoes_cliente})})]}),n.observacoes&&e.jsxs(i,{children:[e.jsx(o,{style:[t.sectionTitle,{fontSize:11,color:"#333333",marginBottom:4}],children:"Obs. Vendedor:"}),e.jsx(i,{style:t.observationBox,children:e.jsx(o,{style:[t.totalText,{color:"#666666"}],children:n.observacoes})})]})]}),e.jsxs(i,{style:t.footer,children:[e.jsxs(i,{style:t.footerRow,children:[e.jsx(i,{style:t.footerLeft,children:e.jsxs(o,{style:t.footerText,children:["https://app.stoqui.com.br","/orders/",n.pedido_id]})}),e.jsx(i,{style:t.footerRight,children:e.jsxs(o,{style:t.footerText,children:["Documento gerado em ",S(new Date,"dd/MM/yyyy 'à s' HH:mm")]})})]}),!W&&e.jsx(o,{style:t.demoWarning,children:"COMPROVANTE APENAS PARA DEMONSTRAÃÃO - A versão sem marca d'água está disponÃvel apenas no Stoqui PRO"})]}),!W&&e.jsx(i,{style:t.watermarkContainer,children:e.jsxs(i,{style:t.watermarkContent,children:[B(G)&&e.jsx(w,{src:G,style:t.watermarkLogo}),e.jsx(o,{style:t.watermarkText,children:"COMPROVANTE APENAS PARA DEMONSTRAÃÃO"})]})})]})},_e=n=>e.jsx(te,{children:e.jsx(ae,{...n})});export{ae as VectorizedPrintOrderPage,_e as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.