PageSourceSearch

https://portal.cardapioweb.com/assets/IssueOrderInvoiceDialog-NOCy6ODn.js

js cardapioweb.com collected 2026-09-24 11:59:09 UTC 5,675 bytes, 5 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="82ead906-5866-515f-8d91-12ec3a0901fe")}catch(e){}}();
3import{Q as O,W as T,d6 as U,n as V,a3 as Y,kc as g,bJ as j,R as e,jY as J,b5 as M,b6 as R,kd as W,D as z,q as y,I as h,s as _,t as P,db as H,V as L,l as $,b7 as q,aN as B,bO as Q,b0 as G,Y as k,C as K,b9 as X,ba as Z}from"./index-Cs-In7Vx.js";import{v as ee}from"./validateCNPJ-D1dZ3Lbf.js";import{v as ae}from"./validateCPF-BkwZ4IBk.js";import{g as te,a as se}from"./useOrderInvoices-BgFuiwFs.js";async function oe(t,r){return(await O.post(`/api/v2/company/tax/orders/${t}/generate`,r)).data}const ne=X().shape({invoice_document:Z().test("is-cpf-or-cnpj","Informe um CPF ou CNPJ válido",t=>!t||ae(t)||ee(t))}),re={invoice_document:""};function de(){const t=T(),r=U(),v=V(),E=Y(),l=g(s=>s.open),a=g(s=>s.data),{mutate:i}=j(),b=g(s=>s.setClose),[I,x]=e.useState(!1),{data:c}=J(),{handleSubmit:m,reset:C,formState:D,control:S,watch:w}=M({mode:"onSubmit",defaultValues:re,resolver:R(ne)}),d=e.useRef(!1),{errors:N}=D,F=w("invoice_document");e.useEffect(()=>{l&&C({invoice_document:a?.invoice_document||""})},[a,l,C]);const o=e.useCallback(()=>b(),[b]),u=e.useCallback((s=!1)=>async A=>{if(!d.current){d.current=!0,x(!0);try{const p={invoice_document:A.invoice_document?.replace(/\D/g,"")},n=await oe(a?.id,p);s&&n.link_danfe&&r(n.link_danfe,"pdf");const f=[i(W(a.id))];E.pathname.includes("fiscal/notas")&&(f.push(i(te())),f.push(i(se()))),await Promise.all(f),n.status==="Negada"?t.error(n.motivo_status||"Não foi possível emitir a nota"):n.status==="Autorizada"&&t.success("Nota emitida!"),o()}catch(p){t.error(p.response?.data?.message||"Não foi possível emitir a nota")}x(!1),d.current=!1}},[t,a,i,o,E.pathname,r]);return e.createElement(z,{open:l,onClose:o,maxWidth:"xs",PaperProps:{className:"shadow-md rounded-12"},fullWidth:!0},!c?.emissao_liberada&&e.createElement("div",{onSubmit:m(u()),className:"relative flex h-full flex-col overflow-auto"},e.createElement(y,{className:"px-20 py-12"},e.createElement("div",{className:"flex items-center justify-between"},e.createElement("span",null,"Emissão fiscal"),e.createElement(h,{style:{padding:9},onClick:o},e.createElement(_,null)))),e.createElement(P,{dividers:!0,className:"p-20"},e.createElement("div",{className:"rounded-6 bg-orange-lightest p-12 text-16 text-orange-dark"},"Você ainda não pode fazer emissão de notas fiscais pois"," ",e.createElement("strong",null,"algumas configurações fiscais estão pendentes"),". Acesse a tela de"," ",e.createElement("strong",{className:"cursor-pointer",onClick:()=>{o(),v.push("/fiscal/configuracoes")}},"Configurações Fiscais")," ","para mais informações."))),c?.emissao_liberada&&e.createElement("form",{onSubmit:m(u()),className:"relative flex h-full flex-col overflow-auto"},e.createElement(y,{className:"px-20 py-12"},e.createElement("div",{className:"flex items-center justify-between"},e.createElement("span",null,"Emissão fiscal"),e.createElement(h,{style:{padding:9},onClick:o},e.createElement(_,null)))),e.createElement(P,{dividers:!0,className:"overflow-auto p-20"},e.createElement("div",{className:"space-y-24"},c?.ambiente_emissao==="homologacao"&&e.createElement("div",{className:"rounded-6 bg-orange-lightest p-12 text-16 text-orange-dark"},"Você está emitindo no ambiente de ",e.createElement("strong",null,"Homologação"),". Apenas notas de pedidos de teste devem emitidas nesse ambiente, pois as notas não possuem valor fiscal."),a?.status&&a.status!==H.closed.status&&e.createElement("div",{className:"rounded-6 bg-blue-lightest p-12 text-16 text-blue-dark"},"Pedidos com nota fiscal emitida não podem ser alterados ou cancelados. Para cancelá-los, é necessário cancelar a nota primeiro, respeitando o prazo de até 30 minutos após a emissão."),a?.order_type==="delivery"&&(!a?.invoice_document||!F)&&e.createElement("div",{className:"rounded-6 bg-orange-lightest p-12 text-16 text-orange-dark"},"Para notas com entrega a domicílio é necessário o CPF do cliente. Sem essa informação, o indicador de presença na nota será"," ",e.createElement("strong",null,"Operação Presencial"),"."),e.createElement("div",{className:"text-18 font-medium text-gray-600"},"Emissão da ",e.createElement("strong",null,"NFC-e")," do pedido ",e.createElement("strong",null,a?.order_number)," ",e.createElement("br",null),"no valor de ",e.createElement("strong",null,L.formatMonetaryValue(a?.final_value))," ",e.createElement("br",null),"feito no dia"," ",e.createElement("strong",null,$(a?.created_at).format("DD/MM/YYYY [às] HH:mm"))),e.createElement(q,{name:"invoice_document",control:S,render:({field:s})=>e.createElement(B,{...s,id:"invoice_document",label:"CPF/CNPJ na nota",placeholder:"Deixe em branco caso não queira informar",error:!!N.invoice_document,helperText:N?.invoice_document?.message,InputProps:{inputComponent:Q},variant:"outlined",autoFocus:!0,fullWidth:!0})}))),e.createElement(G,{className:"space-x-12 px-20 py-16"},e.createElement(k,{onClick:m(u(!0)),color:"primary",variant:"outlined",disableElevation:!0},"Emitir e Imprimir"),e.createElement(k,{type:"submit",color:"primary",variant:"contained",className:"min-w-88",disableElevation:!0},"Emitir")),I&&e.createElement("div",{className:"absolute inset-0 flex items-center justify-center",style:{zIndex:5e3,backgroundColor:"rgba(255,255,255,0.7)"}},e.createElement(K,{color:"primary"}))))}export{de as default};
4
5//# debugId=82ead906-5866-515f-8d91-12ec3a0901fe

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.