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]="263559ef-a9bb-5c31-a8a1-4dd7e423cb2c")}catch(e){}}(); 3import{bN as O,aJ as k,bM as q,V as L,Q as h,R as e,W as N,bJ as M,b5 as w,b6 as H,ao as S,b7 as f,aN as p,b9 as T,bV as E,bb as V,ba as $,aU as j,bp as D,cf as z,bY as A,l as P,bk as I,bi as _,cj as W}from"./index-Cs-In7Vx.js";import{A as U}from"./index-Dpr9l0yn.js";import{G as X}from"./GetAppRounded-DDuWLHeg.js";import{n as B}from"./index-C1BRRgK3.js";import"./SearchTextInput-Gprlx1Wp.js";import"./constants-2ySKHZ7n.js";import"./useOrderInvoices-BgFuiwFs.js";import"./MoreHorizRounded-CDFUhCK1.js";import"./ReplayRounded-CtlS3Yz1.js";const g=O(t=>({filters:{page:1,per_page:10,q:{}},updateFilter:(a,r)=>t(n=>({...n,filters:a==="page"?{...n.filters,[a]:r}:{...n.filters,[a]:r,page:1}}))})),J="/api/v2/company/tax/nfce_inactivations";function Y(t){return Object.keys(t).filter(r=>t[r]).reduce((r,n)=>(r[n]=t[n],r),{})}let x;function F(t=x){x=t;const a=L.queryParamsObjectToString({page:t.page,per_page:t.per_page,q:Y({...t.q})});return`${J}?${a}`}function Q(t){const{data:a,error:r,mutate:n,isValidating:o,isLoading:c}=k(F(t)||null,q,{dedupingInterval:15e3,revalidateOnFocus:!1,revalidateOnReconnect:!1});return{data:a?.data,totalRecords:a?.total||0,isLoading:c,isValidating:o,isError:r,mutate:n}}async function G(t){return(await h.post("/api/v2/company/tax/nfce_inactivations",t)).data}async function K(t,a){try{const r=await h.get(`/api/v2/company/tax/nfce_inactivations/${t}/export_xml`,{responseType:"blob"}),n=window.URL.createObjectURL(new Blob([r.data])),o=document.createElement("a");o.href=n,o.setAttribute("download",`${a}.xml`),document.body.appendChild(o),o.click(),document.body.removeChild(o)}catch(r){console.error("Erro ao baixar XML:",r)}}const Z=T().shape({justificativa:$().trim().required("Você deve informar a justificativa").min(20,"Deve ter pelo menos 20 caracteres"),serie:E().required("Você deve informar a série").min(0,"Deve ser um número entre 0 e 999").max(999,"Deve ser um número entre 0 e 999").typeError("Deve ser um número"),numero_inicial:E().required("Você deve informar a numeração inicial").positive("Deve ser maior que 0").integer("Deve ser um inteiro").typeError("Deve ser um número"),numero_final:E().required("Você deve informar a numeração final").positive("Deve ser maior que 0").integer("Deve ser um inteiro").typeError("Deve ser um número").min(V("numero_inicial"),"Deve ser maior ou igual ao número inicial")});function ee({open:t,onClose:a}){const[r,n]=e.useState(!1),o=N(),{mutate:c}=M(),m=g(l=>l.filters),{handleSubmit:v,formState:{errors:s},reset:d,control:u}=w({resolver:H(Z),mode:"onSubmit"});e.useEffect(()=>{t&&d()},[t,d]);async function b(l){n(!0);try{await G(l),o.success("Inutilização emitida com sucesso!"),c(F(m)),a()}catch(y){o.error(y.response?.data?.message||"Não foi possÃvel emitir uma nova inutilização")}n(!1)}return e.createElement(S,{open:t,title:"Nova inutilização",onClose:a,loading:r,onSubmit:v(b),confirmText:"Solicitar inutilização",cancelText:"Voltar"},e.createElement("div",{className:"flex flex-col gap-16"},e.createElement(f,{name:"serie",control:u,render:({field:l})=>e.createElement(p,{...l,id:"serie",label:"Série",error:!!s.serie,helperText:s?.serie?.message,variant:"outlined",autoFocus:!0,fullWidth:!0,required:!0})}),e.createElement("div",{className:"flex gap-16"},e.createElement(f,{name:"numero_inicial",control:u,render:({field:l})=>e.createElement(p,{...l,id:"numero_inicial",label:"Número Inicial",error:!!s.numero_inicial,helperText:s?.numero_inicial?.message,variant:"outlined",type:"number",fullWidth:!0,required:!0})}),e.createElement(f,{name:"numero_final",control:u,render:({field:l})=>e.createElement(p,{...l,id:"numero_final",label:"Número Final",error:!!s.numero_final,type:"number",helperText:s?.numero_final?.message,variant:"outlined",fullWidth:!0,required:!0})})),e.createElement(f,{name:"justificativa",control:u,render:({field:l})=>e.createElement(p,{...l,id:"justificativa",label:"Justificativa",error:!!s.justificativa,helperText:s?.justificativa?.message,variant:"outlined",fullWidth:!0,required:!0,placeholder:"Exemplo: Quebra na sequência da numeração",multiline:!0,rows:3})})))}const ae=[{key:"Autorizada",label:"Autorizada"},{key:"Negada",label:"Negada"}],te=[{key:"homologacao",label:"Homologação"},{key:"producao",label:"Produção"}],re=[{field:"created_at",label:"Data de criação",value:"today",type:"date"},{field:"serie",label:"Série",type:"string"},{field:"numero_inicial",label:"Numeração inicial",type:"number"},{field:"numero_final",label:"Numeração final",type:"number"},{field:"justificativa",label:"Justificativa",type:"string"},{field:"ambiente_emissao",label:"Ambiente de emissão",type:"list_eq_required",valueOptions:te,valueOptionKey:"key",valueOptionLabel:"label"},{field:"status",label:"Status",type:"list_eq_required",valueOptions:ae,valueOptionKey:"key",valueOptionLabel:"label"}];function ie({onClick:t,children:a}){return e.createElement("button",{className:"my-6 mr-12 inline-flex cursor-pointer items-center space-x-12 whitespace-nowrap rounded-6 border border-solid border-gray-200 bg-gray-50 py-8 pl-12 pr-16 text-16 font-bold text-gray-600 hover:bg-gray-100",onClick:t},a)}function ne(){const t=g(o=>o.updateFilter),[a,r]=e.useState(!1);function n(o){t("q",o)}return e.createElement(e.Fragment,null,e.createElement(U,{fields:re,onFilterChange:n,actions:e.createElement(ie,{onClick:()=>r(!0)},e.createElement(j,null)," ",e.createElement("span",null,"Nova inutilização"))}),e.createElement(ee,{open:a,onClose:()=>r(!1)}))}function oe(){const[t,a]=e.useState(!1),[r,n]=e.useState(null);function o(m){a(!0),n(m)}function c(){a(!1)}return{open:t,openDialog:o,closeDialog:c,selectedValue:r}}const le=[{key:"Autorizada",label:"Autorizada",color:"green"},{key:"Negada",label:"Negada",color:"red"}],se=z(le,"key");function ce({open:t,inactivation:a,onClose:r}){if(!a)return null;const n=D(a.numero_inicial,a.numero_final);return e.createElement(S,{open:t,title:"Motivos do status da inutilização",onClose:r,keepMounted:!1,maxWidth:"sm"},e.createElement("div",{className:"space-y-12"},e.createElement("div",{className:"space-y-4"},e.createElement("div",{className:"text-18 font-bold text-gray-600"},"Serie: ",a?.serie),e.createElement("div",{className:"text-18 font-bold text-gray-600"},"Numeração:",n?` ${a.numero_inicial}`:` ${a.numero_inicial} - ${a.numero_final}`),e.createElement("div",{className:"text-18 font-bold text-gray-600"},"Status:"," ",a?.status?se[a.status].label:"Desconhecido")),e.createElement("div",{className:"whitespace-pre-wrap text-16 font-medium text-gray-600"},a?.motivo_status||"Motivo do status não informado")))}function ue({row:t,onClick:a}){return e.createElement("div",{className:"flex items-center space-x-6"},B?.[t?.status]||e.createElement(_,{color:"grey"},"Indefinido"),t?.ambiente_emissao==="homologacao"&&e.createElement(_,{color:"orange"},"Homologação"),t?.motivo_status&&e.createElement(I,{tooltip:"Ver motivo do status",onClick:a,color:"text-gray-400"},e.createElement(W,null)))}function me(){const t=N(),a=g(i=>i.filters),r=g(i=>i.updateFilter),{data:n,totalRecords:o,isLoading:c,isValidating:m,isError:v}=Q(a),{open:s,openDialog:d,closeDialog:u,selectedValue:b}=oe(),l=i=>{r("page",i+1)},y=i=>{r("per_page",i)};async function C(i,R){try{t.info("O XML da inutilização está sendo baixado",{timeout:3e3}),await K(i,R)}catch{t.error("Não foi possÃvel baixar o XML da inutilização")}}return e.createElement(e.Fragment,null,e.createElement(A,{data:n,totalRows:o,onChangePage:l,onCh
3angeRowsPerPage:y,resetCurrentPage:a.page===1,loading:c||m,loadingRowsQuantity:10,showError:v,stickyHeader:!0,columns:[{Header:"Data de criação",accessor:"created_at",sortable:!1,Cell:({row:i})=>e.createElement("span",null,P(i.created_at).format("DD/MM/YYYY HH:mm"))},{Header:"Série",accessor:"serie",sortable:!1},{Header:"Numeração",accessor:"numero_inicial",sortable:!1,Cell:({row:i})=>e.createElement("span",null,D(i.numero_inicial,i.numero_final)?i.numero_inicial:i.numero_inicial+" - "+i.numero_final)},{Header:"Justificativa",accessor:"justificativa",sortable:!1},{Header:"Usuário",accessor:"user_name",sortable:!1},{Header:"Status",accessor:"ambiente_emissao",sortable:!1,Cell:({row:i})=>e.createElement(ue,{row:i,onClick:()=>d(i)})},{Header:"Baixar XML",accessor:"id",sortable:!1,align:"center",Cell:({row:i})=>e.createElement(I,{tooltip:"Baixar XML",onClick:()=>C(i.id,`inut-${i.serie}-${i.numero_inicial}-${i.numero_final}`)},e.createElement(X,null))}]}),e.createElement(ce,{open:s,onClose:u,inactivation:b}))}function xe(){return e.createElement("div",{className:"flex w-full flex-1 flex-col space-y-16 overflow-auto px-12 pb-20 pt-16 sm:px-28"},e.createElement(ne,null),e.createElement("div",{className:"sm:flex-1 sm:overflow-auto"},e.createElement(me,null)))}export{xe as default}; 4 5//# debugId=263559ef-a9bb-5c31-a8a1-4dd7e423cb2c
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.