PageSourceSearch

https://app.stoqui.com.br/assets/FiscalSettingsPage-VlsqFW5m.js

js stoqui.com.br collected 2026-09-24 11:58:24 UTC 6,682 bytes, 1 lines download raw bytes

1import{j as r,a7 as f,a6 as L,ad as _,ab as p,ag as b,ae as x,z as c,T as B}from"./mui-CRsYZxVY.js";import{b as g}from"./vendor-Dwao9eNC.js";import{C as $,F as R,T as N,D as d,y as q,bx as j,z as T,by as h}from"./index-TALscxEc.js";import{u as W}from"./useFiscalConfig-CQEKyhOW.js";import{u as z}from"./useUpdateFiscalConfig-Dl-LNota.js";import{L as H}from"./lab-DSem1Osk.js";import"./query-8ViTdhdk.js";import"./datePickers-BIJXYOKG.js";import"./icons-D8aatgQ4.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"2ad85febf9735404429b0670d4acf56a0af5a0a2"}}catch{}})();try{(function(){var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bef1c88c-eed0-4472-8c3b-1929ddaf99d3",e._sentryDebugIdIdentifier="sentry-dbid-bef1c88c-eed0-4472-8c3b-1929ddaf99d3")})()}catch{}const U=e=>q({nfe_habilitado:j().default(!1),nfce_habilitado:j().default(!1),nfce_id_csc:T().nullable().matches(/^\d*$/,"ID do CSC deve conter apenas números").max(6,"ID do CSC deve ter no máximo 6 dígitos").when("nfce_habilitado",{is:!0,then:n=>n.required("ID do CSC é obrigatório para NFC-e")}),nfce_csc:T().nullable().when("nfce_habilitado",{is:!0,then:n=>e?n:n.required("Código CSC é obrigatório para NFC-e")}),serie_nfe:h().transform(n=>isNaN(n)?1:n).min(1,"Série deve ser no mínimo 1").default(1),proximo_numero_nfe:h().transform(n=>isNaN(n)?void 0:n).nullable().min(1,"Deve ser no mínimo 1").default(void 0),serie_nfce:h().transform(n=>isNaN(n)?1:n).min(1,"Série deve ser no mínimo 1").default(1),proximo_numero_nfce:h().transform(n=>isNaN(n)?void 0:n).nullable().min(1,"Deve ser no mínimo 1").default(void 0),enviar_nf_email_cliente:j().default(!0)}),ee=()=>{const{data:e,isLoading:n}=W(),E=z(),[v,C]=g.useState(null),m=!!(e!=null&&e.formData.nfce_id_csc),I=g.useMemo(()=>U(m),[m]),{control:i,handleSubmit:P,watch:y,reset:M,formState:{isSubmitting:t,isDirty:S}}=$({resolver:R(I),defaultValues:{nfe_habilitado:(e==null?void 0:e.formData.nfe_habilitado)??!1,nfce_habilitado:(e==null?void 0:e.formData.nfce_habilitado)??!1,nfce_id_csc:(e==null?void 0:e.formData.nfce_id_csc)??null,nfce_csc:"",serie_nfe:(e==null?void 0:e.formData.serie_nfe)??1,proximo_numero_nfe:(e==null?void 0:e.formData.proximo_numero_nfe)??void 0,serie_nfce:(e==null?void 0:e.formData.serie_nfce)??1,proximo_numero_nfce:(e==null?void 0:e.formData.proximo_numero_nfce)??void 0,enviar_nf_email_cliente:(e==null?void 0:e.formData.enviar_nf_email_cliente)??!0}}),D=y("nfce_habilitado"),w=y("nfe_habilitado"),[F,k]=g.useState(!1),A=async a=>{var o,s;try{const l=a.nfce_id_csc?a.nfce_id_csc.padStart(6,"0"):a.nfce_id_csc,u={...e.formData,...a,nfce_id_csc:l};u.nfce_csc||delete u.nfce_csc,await E.mutateAsync({data:u,isUpdate:!0}),M(a)}catch(l){C(((s=(o=l.response)==null?void 0:o.data)==null?void 0:s.error)||"Erro ao salvar configuração.")}};return n?r.jsx(f,{sx:{height:"70vh",display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(L,{})}):e?r.jsxs(f,{p:2,children:[r.jsx(N,{title:"Configuração NF",navigateBack:!0}),r.jsx("form",{onSubmit:P(A),children:r.jsxs(p,{spacing:3,children:[r.jsx(d,{name:"nfe_habilitado",control:i,render:({field:a})=>r.jsx(b,{control:r.jsx(x,{checked:a.value,onChange:a.onChange,disabled:t}),label:"Habilitar NF-e (Nota fiscal eletrônica)"})}),w&&r.jsxs(p,{direction:"row",spacing:2,children:[r.jsx(d,{name:"serie_nfe",control:i,render:({field:a,fieldState:o})=>{var s;return r.jsx(c,{...a,label:"Série NF-e *",sx:{width:150},error:!!o.error,helperText:((s=o.error)==null?void 0:s.message)||"",disabled:t,inputProps:{inputMode:"numeric"}})}}),r.jsx(d,{name:"proximo_numero_nfe",control:i,render:({field:a,fieldState:o})=>{var s;return r.jsx(c,{...a,value:a.value??"",label:"Proximo numero",sx:{width:150},error:!!o.error,helperText:((s=o.error)==null?void 0:s.message)||"",disabled:t,inputProps:{inputMode:"numeric"}})}})]}),r.jsx(d,{name:"nfce_habilitado",control:i,render:({field:a})=>r.jsx(b,{control:r.jsx(x,{checked:a.value,onChange:a.onChange,disabled:t}),label:"Habilitar NFC-e (Nota fiscal de consumidor)"})}),D&&r.jsxs(p,{spacing:2,sx:{pl:2},children:[r.jsx(_,{severity:"info",children:"O CSC (Código de Segurança do Contribuinte) é obtido junto à SEFAZ do seu estado."}),r.jsx(d,{name:"nfce_id_csc",control:i,render:({field:a,fieldState:o})=>{var s;return r.jsx(c,{...a,value:a.value??"",onChange:l=>{const u=l.target.value.replace(/\D/g,"").slice(0,6);a.onChange(u)},onBlur:()=>{a.value&&a.onChange(a.value.padStart(6,"0")),a.onBlur()},label:"ID do CSC *",placeholder:"Ex: 000001",fullWidth:!0,error:!!o.error,helperText:((s=o.error)==null?void 0:s.message)||"Número sequencial fornecido pela SE
1FAZ (6 dígitos)",disabled:t,inputProps:{inputMode:"numeric",maxLength:6}})}}),r.jsx(d,{name:"nfce_csc",control:i,render:({field:a,fieldState:o})=>{var s;return r.jsx(c,{...a,value:m&&!F?"••••••••":a.value||"",onFocus:()=>{F||(k(!0),a.onChange(""))},label:m?"Código CSC":"Código CSC *",fullWidth:!0,error:!!o.error,helperText:((s=o.error)==null?void 0:s.message)||"",disabled:t})}}),r.jsxs(p,{direction:"row",spacing:2,children:[r.jsx(d,{name:"serie_nfce",control:i,render:({field:a,fieldState:o})=>{var s;return r.jsx(c,{...a,label:"Série NFC-e *",sx:{width:150},error:!!o.error,helperText:((s=o.error)==null?void 0:s.message)||"",disabled:t,inputProps:{inputMode:"numeric"}})}}),r.jsx(d,{name:"proximo_numero_nfce",control:i,render:({field:a,fieldState:o})=>{var s;return r.jsx(c,{...a,value:a.value??"",label:"Proximo numero",sx:{width:150},error:!!o.error,helperText:((s=o.error)==null?void 0:s.message)||"",disabled:t,inputProps:{inputMode:"numeric"}})}})]})]}),(w||D)&&r.jsxs(f,{sx:{pt:1},children:[r.jsx(d,{name:"enviar_nf_email_cliente",control:i,render:({field:a})=>r.jsx(b,{control:r.jsx(x,{checked:a.value,onChange:a.onChange,disabled:t}),label:"Enviar nota fiscal por email ao cliente"})}),r.jsx(B,{variant:"caption",color:"text.secondary",display:"block",sx:{pl:2},children:"Ao emitir uma nota, o PDF e XML serão enviados automaticamente para o email do cliente."})]}),v&&r.jsx(_,{severity:"error",onClose:()=>C(null),children:v}),r.jsx(H,{type:"submit",variant:"contained",loading:t,disabled:!S,fullWidth:!0,sx:{mt:2},children:S?"Salvar configuração":"Salvo"})]})})]}):r.jsxs(f,{p:2,children:[r.jsx(N,{title:"Configuração NF",navigateBack:!0}),r.jsx(_,{severity:"warning",children:"Cadastre os dados da empresa antes de configurar a nota fiscal."})]})};export{ee 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.