PageSourceSearch

https://www.app.tributei.net/164.b0edb40a4f16503f4b0f.chunk.js

js tributei.net collected 2026-10-01 16:05:04 UTC 50,232 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunktributei=self.webpackChunktributei||[]).push([[164],{15399:(e,a,o)=>{o.d(a,{A:()=>s});var t=o(85104);const s=async function(e){if(!e)throw new Error("CPF ou CNPJ n\xe3o informados");try{return(await t.A.get(`/pagamentos-api/empresas/${e}`)).data.empresa}catch(s){var a,o;return console.error("Erro ao obter ID da empresa:",(null===(a=s.response)||void 0===a||null===(o=a.data)||void 0===o?void 0:o.message)||s.message),null}}},21296:(e,a,o)=>{o.d(a,{A:()=>q});var t=o(8713),s=o(4993),i=o(90864),n=o.n(i),r=o(71350),d=o(82445),l=o(86178),c=o.n(l),u=o(65043),m=o(9628),g=o(30064),h=o.n(g),p=o(41981),x=o.n(p),f=o(6840),j=o(94505),v=o(55390),C=o(81518);const D=[{id:"1",name:"Escolha uma op\xe7\xe3o"},{id:"4",name:"4 - EXTRATO FRONTEIRAS"},{id:"7",name:"7 - REGISTRO DE NOTAS FRONTEIRAS"}],N=[{id:"1",name:"Escolha uma op\xe7\xe3o"},{id:"041",name:"041 - BANRISUL"},{id:"001",name:"001 - Banco do Brasil"},{id:"748",name:"748 - SICREDI"},{id:"033",name:"033 - SANTANDER"},{id:"237",name:"237 - BRADESCO"},{id:"341",name:"341 - ITA\xda"},{id:"756",name:"756 - BANCOOB"}],b=[{id:24007,name:"\xc1gua Mineral (NCM 22.01)"},{id:25003,name:"\xc1guas Gas., Refrigerantes, Refrescos e Cerveja Sem \xc1lcool (NCM 22.02)"},{id:26e3,name:"Artefatos de Joalheria e de Ourivesaria (NCM 71.13 e 71.14)"},{id:27006,name:"Produtos de Tabacaria (NCM 24.01 A 24.99)"},{id:28002,name:"Perfumes e Cosm\xe9ticos, exceto Xampus e Desodorantes"},{id:29009,name:"Cervejas, Chopes e Beb.Alco\xf3licas (NCM 22.03,22.04, 22.05,22.06 e 22.08)"},{id:30007,name:"Fumo e Suced\xe2neos, Manufaturados (NCM 24.02 e 24.03)"},{id:31003,name:"Gasolina, exceto para Avia\xe7\xe3o"},{id:32e3,name:"Ve\xedculos automotores novos - regime de substitui\xe7\xe3o tribut\xe1ria"},{id:33006,name:"Ve\xedculos classificados na NBM/SH at\xe9 dez/1996 conf. Decreto 8.242/2021"},{id:34002,name:"Presta\xe7\xe3o de servi\xe7o de comunica\xe7\xe3o"},{id:35009,name:"Energia el\xe9trica, exceto a destinada \xe0 eletrifica\xe7\xe3o rural"}];var y=o(39546),P=o(63782),S=o(51989),R=o(70579);const A=x()(h());var Y=o(52082),k=o(75055),E=o(63405),M=o(27965);const O="A data de vencimento do ICMS-ST \xe9 definida pelo calend\xe1rio fiscal da SEFAZ do estado de destino da mercadoria. Geralmente, a SEFAZ publica um calend\xe1rio anual com todas as datas de vencimento.",I="\xc9 a data em que o contribuinte paga o ICMS-ST. Deve ser feito at\xe9 o vencimento para evitar penalidades, geralmente atrav\xe9s de uma GNRE ou guia espec\xedfica do estado.",$=e=>{let{label:a="Data de vencimento",tooltipText:o=O,labelInfo:t=!0,value:s,onChange:i,markTouched:n,touchedField:d="dataVencimento",flatpickrId:l="default-picker",wrapper:c=r.fI,wrapperProps:u={},tooltipTarget:m="data-vencimento",disabled:g=!1,placeholder:h="Escolha o periodo"}=e;return(0,R.jsxs)(c,{...u,children:[(0,R.jsx)(r.hh,{placement:"top",target:m,children:o}),(0,R.jsxs)(r.JU,{children:[a,t&&(0,R.jsx)(k.A,{size:16,id:m,style:{marginLeft:"0.33rem"}})]}),(0,R.jsxs)(r.MG,{className:"input-group-merge",children:[(0,R.jsx)(r.zB,{className:"border-end-0",children:(0,R.jsx)(r.JU,{for:"range-picker",children:(0,R.jsx)(E.A,{size:18})})}),(0,R.jsx)(M.A,{value:s,id:l,className:"form-control",onChange:e=>{i(e),null===n||void 0===n||n(d)},options:{dateFormat:"d/m/Y",disable:[(0,y.kV)(s)]},placeholder:h,disabled:g})]})]})},F=e=>{let{label:a="Data de pagamento",tooltipText:o=I,labelInfo:t=!0,value:s,onChange:i,markTouched:n,touchedField:d="dataPagamento",flatpickrId:l="default-picker",wrapper:c=r.fI,wrapperProps:u={},tooltipTarget:m="data-pagamento",disabled:g=!1,placeholder:h="Escolha o periodo",maxDate:p=(0,y.Az)(),maxDataPagamento:x,estado:f,modo:j}=e;return(0,R.jsxs)(c,{...u,children:[(0,R.jsx)(r.hh,{placement:"top",target:m,children:o}),(0,R.jsxs)(r.JU,{children:[a,t&&(0,R.jsx)(k.A,{size:16,id:m,style:{marginLeft:"0.33rem"}})]}),(0,R.jsxs)(r.MG,{className:"input-group-merge",children:[(0,R.jsx)(r.zB,{className:"border-end-0",children:(0,R.jsx)(r.JU,{for:"range-picker",children:(0,R.jsx)(E.A,{size:18})})}),(0,R.jsx)(M.A,{value:s,id:l,className:"form-control",onChange:e=>{i(e),null===n||void 0===n||n(d)},options:{dateFormat:"d/m/Y",disable:[(0,y.kV)(s)],maxDate:void 0!==x?x:"sp"!==f&&p},placeholder:h,disabled:g})]})]})},G=["se","sp"],T=["to","mt","se"],w=["df"],W=["to","mt","es"];function J(e){var a;let{estado:o,dataVencimento:i,setDataVencimento:d,dataPagamento:l,setDataPagamento:c,periodoRef:u,setPeriodoRef:m,markTouched:g,modo:h,loading:p,jurosCheck:x,handleJuroseMulta:f,dias:j,juros:v,multas:C,receitas:D,currentSubCodigo:N,setCurrentSubCodigo:b,maxDataPagamento:P}=e;const S=!G.includes(o)&&"single"===h,A=!w.includes(o)&&"batch"===h,Y=S||A||"batch-simple"===h,k=!T.includes(o)&&"single"===h,O=!w.includes(o)&&"batch"===h,I="batch-simple"===h&&!W.includes(o),J="df"===o?"Data de entrada da mercadoria":"sp"===o?"Data de vencimento":"Data de pagamento";return(0,R.jsxs)(r.fv,{className:"d-flex gap-1 flex-column",children:[Y&&(0,R.jsx)($,{label:"Data de vencimento",value:i,onChange:d,markTouched:g,modo:h}
1),k&&(0,R.jsx)(F,{label:J,value:l,onChange:c,markTouched:g,estado:o,modo:h,maxDataPagamento:P}),(O||I)&&(0,R.jsx)(F,{label:"Data de pagamento",value:l,onChange:c,markTouched:g,modo:h,maxDataPagamento:P}),"batch"===h&&(null===D||void 0===D?void 0:D.length)>0&&(0,R.jsx)(r.fI,{children:(0,R.jsxs)(r.fI,{children:[(0,R.jsx)(r.JU,{className:"mt-1",children:"Detalhe de receita"}),(0,R.jsx)(r.fv,{className:"select-container codigos_guias d-flex flex-column",children:(0,R.jsxs)(t.W,{value:N,onChange:b,children:[(0,R.jsxs)(t.W.Button,{className:"select-button ",children:["rj"!==o&&(0,R.jsxs)("span",{children:[(null===(a=N.codigo)||void 0===a?void 0:a.length)&&`0000${N.codigo}`," -"," "]}),(0,R.jsx)("span",{children:N.descricao})," ",(0,R.jsx)(s.A,{size:18})]}),(0,R.jsx)(t.W.Options,{className:"select-container-options",children:(0,R.jsx)(n(),{className:"scroll position-right-3 width-scroll-45",children:D.map((e=>{var a;return(0,R.jsxs)(t.W.Option,{className:"d-flex align-items-center",value:e,children:[(null===(a=e.codigo)||void 0===a?void 0:a.length)&&`0000${e.codigo}`," - ",e.descricao]},e.id)}))})})]})})]})}),"single"===h&&(0,R.jsxs)(r.fI,{children:[(0,R.jsxs)(r.fI,{children:[(0,R.jsx)(r.JU,{children:"Per\xedodo refer\xeancia | Emiss\xe3o NFe"}),(0,R.jsxs)(r.MG,{className:"input-group-merge",children:[(0,R.jsx)(r.zB,{className:"border-end-0",children:(0,R.jsx)(r.JU,{for:"range-picker",children:(0,R.jsx)(E.A,{size:18})})}),(0,R.jsx)(M.A,{disabled:"mt"!==o&&"rj"===o,value:u,id:"default-picker",className:"form-control",onChange:e=>{m(e),null===g||void 0===g||g("periodoRef")},options:{dateFormat:"d/m/Y",disable:[(0,y.kV)(u)]},placeholder:"Escolha o periodo"})]})]}),"mt"===o&&p&&(0,R.jsxs)("div",{className:"d-flex flex-column gap-1",children:[(0,R.jsx)(r.fI,{style:{marginTop:"1rem"},children:(0,R.jsxs)(r.fv,{className:"d-flex gap-1 ",children:[(0,R.jsx)(r.pd,{checked:1===x,onClick:e=>{f(e),null===g||void 0===g||g("jurosCheck")},type:"checkbox"}),(0,R.jsx)(r.JU,{children:"Desejar aplicar Juros e Multa"})]})}),(0,R.jsx)(r.fI,{children:(0,R.jsxs)(r.fv,{children:[(0,R.jsx)(r.JU,{children:"Dias de atraso"}),(0,R.jsx)(r.pd,{type:"text",value:j,disabled:!0})]})}),(0,R.jsx)(r.fI,{children:(0,R.jsxs)(r.fv,{children:[(0,R.jsx)(r.JU,{children:"Valor Juros"}),(0,R.jsx)(r.pd,{type:"text",value:v,disabled:!0})]})}),(0,R.jsx)(r.fI,{children:(0,R.jsxs)(r.fv,{children:[(0,R.jsx)(r.JU,{children:"Valor Multa"}),(0,R.jsx)(r.pd,{type:"text",value:C,disabled:!0})]})})]})]})]})}function V(e){let{estado:a,codigos:o,currentCodigo:i,setCurrentCodigo:d,ProdutosReceitasData:l,CurrentProdutoReceita:c,setCurrentProdutoReceita:u,CamposReceitas:m,CurrentCampoReceita:g,setCurrentCampoReceita:h,isFilterd:p}=e;return(0,R.jsx)(r.fv,{children:(0,R.jsx)(r.fI,{children:p?(0,R.jsxs)(r.fv,{children:[(0,R.jsx)(r.hh,{placement:"bottom",target:"receita",children:"Para habilitar o campo, \xe9 necess\xe1rio filtrar as guias por estado e tipo de guia."}),(0,R.jsxs)(r.fI,{className:"tooltipCustom",id:"receita",children:[(0,R.jsx)(r.JU,{children:"Receita"}),(0,R.jsx)(r.pd,{disabled:!0})]})]}):(0,R.jsxs)(R.Fragment,{children:[(null===o||void 0===o?void 0:o.length)>0?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(r.JU,{children:"Receita"}),(0,R.jsx)(r.fv,{className:"select-container codigos_guias d-flex flex-column",children:(0,R.jsxs)(t.W,{value:i,onChange:d,children:[(0,R.jsxs)(t.W.Button,{className:"select-button ",children:[null!==i&&void 0!==i&&i.CodigoGuia||null!==i&&void 0!==i&&i.descricao?(0,R.jsxs)(R.Fragment,{children:["rj"!==a&&(0,R.jsxs)("span",{children:[i.CodigoGuia," - "]}),(0,R.jsx)("span",{children:i.descricao})]}):(0,R.jsx)("span",{className:"text-muted",children:"Selecione uma receita"})," ",(0,R.jsx)(s.A,{size:18})]}),(0,R.jsx)(t.W.Options,{className:"select-container-options",children:(0,R.jsx)(n(),{className:"scroll position-right-3 width-scroll-45",children:o.map((e=>(0,R.jsxs)(t.W.Option,{className:"d-flex align-items-center",value:e,children:[e.CodigoGuia," - ",e.descricao]},e.id)))})})]})})]}):null,(0,R.jsx)(r.fI,{children:(null===l||void 0===l?void 0:l.length)>0?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(r.JU,{className:"mt-1",children:"Produto"}),(0,R.jsx)(r.fv,{className:"select-container codigos_guias d-flex flex-column",children:(0,R.jsxs)(t.W,{value:c,onChange:u,children:[(0,R.jsxs)(t.W.Button,{className:"select-button ",children:[null===c||void 0===c?void 0:c.codigo," - ",null===c||void 0===c?void 0:c.descricao]}),(0,R.jsx)(t.W.Options,{className:"select-container-options",children:(0,R.jsx)(n(),{className:"scroll position-right-3 width-scroll-45",children:l.map((e=>(0,R.jsxs)(t.W.Option,{className:"d-flex align-items-center",value:e,children:[e.codigo.length&&`${e.codigo}`," - ",e.descricao]},e.id)))})})]})})]}):null}),(0,R.jsx)(r.fI,{children:(null===m||void 0===m?void 0:m.length)>0?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(r.JU,{className:"mt-1",children:"Campos extras receita"}),(0,R.jsx)(r.fv,{className:"select-container codigos_guias d-flex flex-column",children:(0,R.jsxs)(t.W,{value:g,onChange:h,children:[(0,R.jsxs)(t.W.Button,{className:"select-button ",children:[null===g||void 0===g?void 0:g.codigo," - ",null===g||void 0===g?void 0:g.titulo]}),(0,R.jsx)(t.W.Options,{className:"select-container-options",children:(0,R.jsx)(n(),{className:"scroll position-right-3 width-scroll-45",children:m.map((e=>(0,R.jsx)(t.W.Option,{className:"d-flex align-items-center",value:e,children:e.codigo.length&&`${e.codigo} - ${e.titulo}`},e.id)))})})]})})]}):null})]})})})}var U=o(60207);function B(e){var a,o;let{estado:i,loading:d,data:l,saldo:c,setSaldo:u,fcp:m,setFcp:g,CodigoProduto:
1h,setCodigoProduto:p,codigos:x,currentCodigo:f,setCurrentCodigo:j,produtosReceitasData:v,CurrentProdutoReceita:C,setCurrentProdutoReceita:D,camposReceitas:N,CurrentCampoReceita:b,setCurrentCampoReceita:P,documentosOrigem:S,documentoOrigemSelected:A,setDocumentoOrigemSelected:Y,receitas:k,currentSubCodigo:O,setCurrentSubCodigo:I,dataVencimento:G,setDataVencimento:T,dataPagamento:w,setDataPagamento:W,periodoRef:J,setPeriodoRef:V,exigeConvenio:B,convenio:_,setConvenio:z,exigeIEapuracao:L,ie:q,setIe:Z,extras:H,extrasInput:K,setInput:Q,handleInscricao:X,considerarDataParaPeriodo:ee,markTouched:ae,handleMask:oe,maxDataPagamento:te}=e;return d?(0,R.jsx)("div",{className:"d-flex justify-content-center align-items-center",children:(0,R.jsx)(r.y$,{color:"primary"})}):(0,R.jsx)("div",{className:"container-fluid",children:(0,R.jsxs)(r.fI,{className:"g-1",children:[(0,R.jsxs)(r.fv,{md:6,children:[(0,R.jsx)(r.JU,{children:"Valor a recolher"}),(0,R.jsx)(r.pd,{disabled:!0,value:c,onKeyPress:oe,onChange:e=>{u(e.target.value),ae("saldo")}
1})]}),"rj"===i&&(0,R.jsxs)(r.fv,{md:6,children:[(0,R.jsx)(r.JU,{children:"FCP a recolher"}),(0,R.jsx)(r.pd,{value:m,onKeyPress:oe,onChange:e=>{g(e.target.value),ae("fcp")}})]}),"rj"===i&&(0,R.jsx)(r.fv,{md:12,children:(0,R.jsxs)("div",{children:[(0,R.jsx)(r.JU,{children:"Desejar considerar data pagamento para data vencimento?"}),(0,R.jsx)(r.pd,{type:"checkbox",onClick:e=>{ee(e),ae("considerarDataParaPeriodo")}})]})}),["pr"].some((e=>e===i))&&(0,R.jsxs)(r.fv,{md:6,children:[(0,R.jsx)(r.JU,{children:"Codigo do produto"}),(0,R.jsx)(r.pd,{value:h,onChange:e=>{p(e.target.value),ae("CodigoProduto")}})]}),"df"===i&&(0,R.jsxs)(r.fv,{md:6,children:[(0,R.jsx)(r.JU,{children:"Data Vencimento"}),(0,R.jsx)(r.pd,{value:h,disabled:!0,onChange:e=>{p(e.target.value),ae("CodigoProduto")}})]}),S.length>0&&(0,R.jsx)(r.fv,{md:6,children:(0,R.jsx)(U.A,{title:"Documentos de Origem",Array:S,w:"width-scroll-45",setArray:Y,selectedArray:A})}),x.length>0&&(0,R.jsxs)(r.fv,{md:6,children:[(0,R.jsx)(r.JU,{children:"Receita"}),(0,R.jsx)("div",{className:"select-container codigos_guias d-flex flex-column",children:(0,R.jsxs)(t.W,{value:f,onChange:e=>{j(e),ae("currentCodigo")},children:[(0,R.jsxs)(t.W.Button,{className:"select-button ",children:["rj"!==i&&(0,R.jsxs)("span",{children:[f.CodigoGuia," - "]}),(0,R.jsx)("span",{children:f.descricao})," ",(0,R.jsx)(s.A,{size:18})]}),(0,R.jsx)(t.W.Options,{className:"select-container-options",children:(0,R.jsx)(n(),{className:"scroll position-right-3 width-scroll-45",children:x.map((e=>(0,R.jsxs)(t.W.Option,{className:"d-flex align-items-center",value:e,children:["rj"!==i&&e.CodigoGuia," - ",e.descricao]},e.id)))})})]})})]}),v.length>0&&(0,R.jsxs)(r.fv,{md:6,children:[(0,R.jsxs)(r.JU,{children:["Produto ",(0,R.jsx)("span",{className:"text-muted",children:"(opcional)"})]}),(0,R.jsx)("div",{className:"select-container codigos_guias d-flex flex-column",children:(0,R.jsxs)(t.W,{value:C,onChange:e=>{D(e),ae("CurrentProdutoReceita")},children:[(0,R.jsx)(t.W.Button,{className:"select-button ",children:C&&Object.keys(C).length>0?`${C.codigo} - ${C.descricao}`:(0,R.jsx)("div",{className:"text-muted text-start",children:"Selecione um produto"})}),(0,R.jsx)(t.W.Options,{className:"select-container-options",children:(0,R.jsx)(n(),{className:"scroll position-right-3 width-scroll-45",children:v.map((e=>(0,R.jsxs)(t.W.Option,{className:"d-flex align-items-center",value:e,children:[e.codigo.length&&`${e.codigo} - `,e.descricao]},e.id)))})})]})})]}),N.length>0&&(0,R.jsxs)(r.fv,{md:6,children:[(0,R.jsx)(r.JU,{children:"Campos extras receita"}),(0,R.jsx)("div",{className:"select-container codigos_guias",children:(0,R.jsxs)(t.W,{value:b,onChange:e=>{P(e),ae("CurrentCampoReceita")},children:[(0,R.jsxs)(t.W.Button,{className:"select-button ",children:[null===b||void 0===b?void 0:b.codigo," - ",null===b||void 0===b?void 0:b.titulo]}),(0,R.jsx)(t.W.Options,{className:"select-container-options",children:(0,R.jsx)(n(),{className:"scroll position-right-3 width-scroll-45",children:N.map((e=>(0,R.jsxs)(t.W.Option,{className:"d-flex align-items-center",value:e,children:[e.codigo.length&&`${e.codigo} - `,e.titulo]},e.id)))})})]})})]}),"df"!==i&&(0,R.jsx)($,{label:"Data de vencimento",value:G,onChange:T,markTouched:ae,wrapper:r.fv,wrapperProps:{md:6}}),"df"!==i&&(0,R.jsx)(F,{label:"Data de pagamento",value:w,onChange:W,markTouched:ae,wrapper:r.fv,wrapperProps:{md:6},estado:i,modo:"saida",maxDataPagamento:te}),"PR"===i&&"S"===L||"PR"===i&&null!==l&&void 0!==l&&null!==(a=l.TipoGuia)&&void 0!==a&&a.startsWith("CTE")?(0,R.jsxs)(r.fv,{md:6,children:[(0,R.jsx)(r.JU,{style:{paddingTop:"0.5rem"},children:"Inscri\xe7\xe3o Estadual do Emitente no Paran\xe1"}),(0,R.jsx)(r.pd,{value:q,onChange:e=>Z(e.target.value)})]}):null,H&&H.camposExtrasObs&&(0,R.jsxs)(r.fv,{md:6,children:[(0,R.jsx)(r.JU,{children:H.titulo}),H.titulo.startsWith("Data")?(0,R.jsxs)(r.MG,{className:"input-group-merge",children:[(0,R.jsx)(r.zB,{className:"border-end-0",children:(0,R.jsx)(r.JU,{for:"range-picker",children:(0,R.jsx)(E.A,{size:18})})}),(0,R.jsx)(M.A,{value:K,id:"default-picker",className:"form-control",onChange:e=>{Q(e),ae("extrasInput")},options:{dateFormat:"d/m/Y",disable:[(0,y.kV)(K)]},placeholder:"Escolha o periodo"})]}):(0,R.jsx)(r.pd,{onChange:e=>{Q(e.target.value),ae("extrasInput")}})]}),k.length>0&&(0,R.jsxs)(r.fv,{md:6,children:[(0,R.jsx)(r.JU,{children:"Detalhe de receita"}),(0,R.jsx)("div",{className:"select-container codigos_guias d-flex flex-column",children:(0,R.jsxs)(t.W,{value:O,onChange:I,children:[(0,R.jsxs)(t.W.Button,{className:"select-button ",children:["rj"!==i&&(0,R.jsxs)("span",{children:[(null===O||void 0===O||null===(o=O.codigo)||void 0===o?void 0:o.length)&&`0000${O.codigo}`," -"," "]}
1),(0,R.jsx)("span",{children:null===O||void 0===O?void 0:O.descricao})," ",(0,R.jsx)(s.A,{size:18})]}),(0,R.jsx)(t.W.Options,{className:"select-container-options",children:(0,R.jsx)(n(),{className:"scroll position-right-3 width-scroll-45",children:k.map((e=>(0,R.jsxs)(t.W.Option,{className:"d-flex align-items-center",value:e,children:[e.codigo.length&&`0000${e.codigo}`," - ",e.descricao]},e.id)))})})]})})]}),"S"===B&&(0,R.jsxs)(r.fv,{md:6,children:[(0,R.jsx)(r.JU,{children:"Conv\xeanio"}),(0,R.jsx)(r.pd,{value:_,onChange:e=>z(e.target.value)})]})]})})}var _=o(96286),z=o(57483);function L(e){let{estado:a,data:o,saldo:i,setSaldo:d,fcp:l,setFcp:c,ie:u,setIe:m,CodigoProduto:g,setCodigoProduto:h,codigoPR:p,setCodigoPR:x,bancos:f,setBanco:j,tipoDoc:v,setTipoDoc:C,setNumeroDoc:y,simplesNacional:P,loading:S,codigos:A,currentCodigo:Y,setCurrentCodigo:k,subCodigos:E,currentSubCodigo:M,setCurrentSubCodigo:O,handleAntencipacaoBA:I,considerarDataParaPeriodo:$,markTouched:F,handleMask:G}=e;return(0,R.jsxs)(r.fv,{children:[(0,R.jsx)(r.JU,{children:"Valor a recolher"}),(0,R.jsx)(_.A,{thousandSeparator:"",decimalSeparator:".",precision:2,className:"form-control",value:i,onChange:e=>{d(e),F("saldo")},placeholder:"499.90"}),"ba"===a&&(0,R.jsxs)("div",{className:"d-flex mt-2 gap-1",children:[(0,R.jsx)(r.pd,{type:"checkbox",style:{width:"2.5rem"},checked:1===P,onChange:e=>{I(e),F("simplesNacional")}}),(0,R.jsx)(r.JU,{children:"Aplicar desconto na guia mediante antecipa\xe7\xe3o, conforme art. 274\xba do RICMS/BA"})]}),"rj"===a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(r.JU,{className:"mt-2",children:"FCP a recolher"}),(0,R.jsx)(r.pd,{value:l,onKeyPress:G,onChange:e=>{c(e.target.value),F("fcp")}}),(0,R.jsxs)("div",{className:"",children:[(0,R.jsx)(r.JU,{className:"mt-2",children:"Desejar considerar data pagamento para data vencimento?"}),(0,R.jsx)(r.pd,{type:"checkbox",onClick:e=>{$(e),F("considerarDataParaPeriodo")}})]})]}),z.pv.includes(a)&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(r.JU,{className:"mt-2",children:"Inscri\xe7\xe3o estadual"}),(0,R.jsx)(r.pd,{value:u,onChange:e=>{m(e.target.value),F("ie")}})]}),["pr"].some((e=>e===a))&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(r.JU,{className:"mt-2",children:"Codigo do produto"}),"ST-FCP"===(null===o||void 0===o?void 0:o.TipoGuia)||"DIFAL-FCP"===(null===o||void 0===o?void 0:o.TipoGuia)?(0,R.jsx)(U.A,{Array:b,setArray:x,selectedArray:p}):(0,R.jsx)(r.pd,{value:g,onChange:e=>{h(e.target.value),F("CodigoProduto")}})]}),"df"===a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(r.JU,{className:"mt-2",children:"Data Vencimento"}),(0,R.jsx)(r.pd,{value:g,disabled:!0,onChange:e=>{h(e.target.value),F("CodigoProduto")}})]}),"rs"===a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(r.JU,{className:"mt-2",children:"Banco"}),(0,R.jsx)(U.A,{Array:N,setArray:e=>{j(e),F("banco")},selectedArray:f})]}),"pe"===a&&(0,R.jsxs)("div",{className:"mt-1",children:[(0,R.jsx)(U.A,{title:"Tipo de Documento de Origem",Array:D,w:"width-scroll-45",setArray:e=>{C(e),F("tipoDoc")},selectedArray:v}),(0,R.jsxs)("div",{className:"mt-1",children:[(0,R.jsx)(r.JU,{children:"N\xfamero do Documento de Origem"}),(0,R.jsx)(r.pd,{onChange:e=>{y(e.target.value),F("NumeroDoc")}})]})]}),(0,R.jsx)(r.fI,{children:S&&"sc"!==a&&A.length>0?(0,R.jsx)(r.fv,{children:(0,R.jsxs)("div",{className:"select-container d-flex flex-column",children:[(0,R.jsx)(r.JU,{className:""+(E.length>0?"mt-2":"mt-1"),children:"rj"===a?"C\xf3digo do produto":"C\xf3digo da guia"}),(0,R.jsxs)(t.W,{value:Y,onChange:e=>{k(e),F("currentCodigo")},children:[(0,R.jsxs)(t.W.Button,{className:"select-button d-flex align-items-center justify-content-between",children:["0209-4"===Y?(0,R.jsx)("span",{children:"Selecione c\xf3digo guia"}):"rj"!==a&&(0,R.jsxs)("span",{children:[Y.CodigoGuia," - "]}),(0,R.jsx)("span",{children:Y.descricao})," ",(0,R.jsx)(s.A,{size:18})]}),(0,R.jsx)(t.W.Options,{className:"select-container-options scroll",style:{maxHeight:"300px"},children:A.map((e=>(0,R.jsxs)(t.W.Option,{className:"d-flex align-items-center",value:e,children:["rj"!==a&&e.CodigoGuia," - ",e.descricao]},e.id)))})]})]})}):null}),(0,R.jsx)(r.fI,{children:S&&Y&&E.length>0?(0,R.jsx)(r.fv,{children:(0,R.jsxs)("div",{className:"select-container d-flex flex-column",children:[(0,R.jsx)(r.JU,{className:"mt-1",children:"sc"===a?"Classe de vencimento":"Sub C\xf3digo"}),(0,R.jsxs)(t.W,{value:M,onChange:e=>{O(e),F("currentSubCodigo")},children:[(0,R.jsxs)(t.W.Button,{className:"select-button ",children:["rj"!==a&&(0,R.jsxs)("span",{children:[M.CodigoGuia," - "]}),(0,R.jsx)("span",{children:M.descricao})," ",(0,R.jsx)(s.A,{size:18})]}),(0,R.jsx)(n(),{className:"scroll position-right-3 width-scroll-45",children:(0,R.jsx)(t.W.Options,{className:"select-container-options scroll",style:{maxHeight:"300px"},children:E.filter((e=>e.sub_codigo===Y.id)).map((e=>(0,R.jsxs)(t.W.Option,{className:"d-flex align-items-center",value:e,children:["rj"!==a&&e.CodigoGuia," - ",e.descricao]},e.id)))})})]})]})}):null})]})}function q(e){const{open:a,click:o,mode:i="single"}=e,{modo:l,estado:g,loading:h,saldo:p,setSaldo:x,dataVencimento:k,setDataVencimento:E,peri
1odoRef:M,setPeriodoRef:O,dataPagamento:I,setDataPagamento:$,CodigoProduto:F,setCodigoProduto:G,data:T,codigos:w,currentCodigo:W,setCurrentCodigo:U,currentSubCodigo:_,setCurrentSubCodigo:z,fcp:q,setFcp:Z,tipoDoc:H,setTipoDoc:K,setNumeroDoc:Q,bancos:X,setBanco:ee,simplesNacional:ae,setSimplesNacional:oe,ie:te,setIe:se,codigoPR:ie,setCodigoPR:ne,subCodigos:re,receitas:de,ProdutosReceitasData:le,CurrentProdutoReceita:ce,setCurrentProdutoReceita:ue,CamposReceitas:me,CurrentCampoReceita:ge,setCurrentCampoReceita:he,saving:pe,loadingDependencies:xe,jurosCheck:fe,dias:je,juros:ve,multas:Ce,markTouched:De,hasChanges:Ne,handleEdit:be,handleMask:ye,handleJuroseMulta:Pe,handleAntencipacaoBA:Se,considerarDataParaPeriodo:Re,getLastDayUseful:Ae,lastDay:Ye,lastDayFullDate:ke,maxDataPagamentoDate:Ee,maxDataPagamentoDisplay:Me,documentosOrigem:Oe,documentoOrigemSelected:Ie,setDocumentoOrigemSelected:$e,extras:Fe,extrasInput:Ge,setInput:Te,exigeConvenio:we,convenio:We,setConvenio:Je,temInscricao:Ve,handleInscricao:Ue,exigeIEapuracao:Be}=function(e,a){const{cnpjWithoutMask:o,estado:t}=(0,d.m)(),[s,i]=(0,u.useState)(""),n="batch"===e?a.estado:"single-saida"===e?s:t,{guiasId:r,setGuiasId:l,guiasSaidaId:g,setGuiasSaidaId:h,handleWithGuiasState:p}=(0,S.D)(),{markTouched:x,resetTouched:Y,hasChanges:k}=(0,P.I)(),[E,M]=(0,u.useState)(""),[O,I]=(0,u.useState)(""),[$,F]=(0,u.useState)(""),[G,T]=(0,u.useState)(""),[w,W]=(0,u.useState)(),[J,V]=(0,u.useState)(),[U,B]=(0,u.useState)("batch"===e||"batch-simple"===e||"single-saida"===e),[_,z]=(0,u.useState)([]),[L,q]=(0,u.useState)([]),[Z,H]=(0,u.useState)([]),[K,Q]=(0,u.useState)([]),[X,ee]=(0,u.useState)(0),[ae,oe]=(0,u.useState)(0),[te,se]=(0,u.useState)(0),[ie,ne]=(0,u.useState)(0),[re,de]=(0,u.useState)(0),[le,ce]=(0,u.useState)(0),[ue,me]=(0,u.useState)([]),[ge,he]=(0,u.useState)(D[0]),[pe,xe]=(0,u.useState)(""),[fe,je]=(0,u.useState)(0),[ve,Ce]=(0,u.useState)(1),[De,Ne]=(0,u.useState)(""),[be,ye]=(0,u.useState)(N[0]),[Pe,Se]=(0,u.useState)(0),[Re,Ae]=(0,u.useState)(""),[Ye,ke]=(0,u.useState)(b[0]),[Ee,Me]=(0,u.useState)([]),[Oe,Ie]=(0,u.useState)([]),[$e,Fe]=(0,u.useState)([]),[Ge,Te]=(0,u.useState)(""),[we,We]=(0,u.useState)([]),[Je,Ve]=(0,u.useState)(""),[Ue,Be]=(0,u.useState)(!1),[_e,ze]=(0,u.useState)(!1),[Le,qe]=(0,u.useState)([]),[Ze,He]=(0,u.useState)([]),[Ke,Qe]=(0,u.useState)(""),[Xe,ea]=(0,u.useState)([]),[aa,oa]=(0,u.useState)("N"),[ta,sa]=(0,u.useState)(""),[ia,na]=(0,u.useState)(0),[ra,da]=(0,u.useState)("");function la(a,o){const t=o.split("/");return 0===a?t[0]=t[0]-("single"===e?3:2):6===a&&(t[0]=t[0]-1),t.join("/")}(0,u.useEffect)((()=>{"single-saida"===e&&a.open&&g&&f.A.get(`${o}/guia/${g}/edit`).then((e=>{const{data:a,codigos:o,detalhereceita:t,camposextrasreceita:s,exigeConvenio:n,produtoreceita:r,exigeIEapuracao:d,documentosorigem:l}=e.data,u=(o.filter((e=>e.sub_codigo>0)),o.filter((e=>e.id===a.codigo_id||e.CodigoGuia===a.CodigoGuia))[0]||o.find((e=>`${e.CodigoGuia}`===`${a.CodigoGuia}`))||o[0]||{}),m=s.filter((e=>e.codigo===a.CamposExtrasReceita)),g=r.filter((e=>e.codigo===a.ProdutoReceita)),h=l.find((e=>e.codigo===a.GNREDocumentosOrigem));He(h?{id:h.codigo,name:`${h.codigo} - ${h.descricao}`}:[]),qe(l.map((e=>({id:e.codigo,name:`${e.codigo} - ${e.descricao}`})))),Ve(m[0]),Ie(t),H(null===t||void 0===t?void 0:t[0]),oe(a.dias_atraso),V(a),i(a.UFDestinatario),M(a.SaldoaRecolher),I(a.DataVencimento),T(a.DataPagamento),F(c()(a.data_emissao).format("DD/MM/YYYY")),me(a.DataVencimento),W(a.CodigoProduto),z(o),Te(g.length>0?g[0]:{}),q(u),de(a.ValorJuros),ne(a.ValorMulta),se(a.ValorAcrecimoFinanceiro),ce(null===a.SaldoaRecolherFCP?0:a.SaldoaRecolherFCP),je(a.apuracao),oa(n),sa(a.Convenio),na(Number.isNaN(parseInt(a.GNREinscricaoEstadualEmitente))?0:parseInt(a.GNREinscricaoEstadualEmitente)),da(d),Ae(a.GNREIEapuracao||a.GNREIEEmitente||""),na("1"===a.GNREinscricaoEstadualEmitente?1:0)})).catch((()=>{})).finally((()=>{B(!1)}))}),[e,g,a.open]),(0,u.useEffect)((async()=>{if("single"===e){if(!(0,y.zu)("editar e arquivar guia"))return B(!0);B(!1),a.open&&r.length>0&&await j.A.get(`${o}/guia/${r}/edit`).then((e=>{const{data:o,codigos:t,sub_codigos:s}=e.data,i=s.filter((e=>e.id===o.sub_codigo_id)),r=t.filter((e=>(null===e||void 0===e?void 0:e.CodigoGuia)===(null===o||void 0===o?void 0:o.Co
1digoGuia))),d=b.filter((e=>e.id===parseInt(o.CodigoProduto)));if("rs"===n){const e=N.filter((e=>e.id===o.CodigoProduto));ye(e.length>0?e[0]:N[0])}Me(s),H(i[0]),oe(o.dias_atraso),V(o),Se(o.simples),M(o.SaldoaRecolher),Ne(o.SaldoaRecolher),I(o.DataVencimento),T(o.DataPagamento),ee(o.multa_juros),F(c()(o.data_emissao).format("DD/MM/YYYY")),me(o.DataVencimento),z(t),W(o.CodigoProduto),"pr"!==n||"ST-FCP"!==o.TipoGuia&&"DIFAL-FCP"!==o.TipoGuia||ke(0===d.length?b[0]:d[0]),q(0===r.length?t[0]:r[0]),de(o.ValorJuros),ne(o.ValorMulta),se(o.ValorAcrecimoFinanceiro),ce(null===o.SaldoaRecolherFECP?0:o.SaldoaRecolherFECP),je(o.apuracao),Ae(o.NFe_infNFe_dest_IE),B(!0),"mt"===n&&Q(a.correcaoMonetaria)}))}}),[e,r,a.open]),(0,u.useEffect)((()=>{"batch"===e&&a.open&&n&&(B(!0),f.A.get(`/${o}/guia/${n.toLowerCase()}/${a.tipoGuia}/receita`).then((e=>{const{data:a}=e.data;z(a)})).catch((()=>{})).finally((()=>{B(!1)})))}),[e,o,n,a.open,a.tipoGuia]),(0,u.useEffect)((()=>{"batch-simple"===e&&a.open&&Array.isArray(a.tiposGuias)&&j.A.post("/guias/codigos/search",{estado:n}).then((e=>{const o=e.data;z(o.filter((e=>e.TipoGuia===a.tiposGuias[0])))})).catch((()=>{}))}),[e,a.open,n,a.tiposGuias]),(0,u.useEffect)((()=>{if("batch"!==e&&"single-saida"!==e)return;if(!a.open||U)return;if(null===L||void 0===L||!L.CodigoGuia)return Ie([]),We([]),Fe([]),void ze(!1);ze(!0);const t="single-saida"===e?n:n.toLowerCase();Promise.all([f.A.get(`${o}/guia/${n}/${L.CodigoGuia}/detalhereceita`),f.A.get(`${o}/guia/${t}/${L.CodigoGuia}/camposextrasreceita`),f.A.get(`${o}/guia/${t}/${L.CodigoGuia}/produtoreceita`)]).then((a=>{var o,t,s;let[i,n,r]=a;if(Ie((null===(o=i.data)||void 0===o?void 0:o.data)||[]),We((null===(t=n.data)||void 0===t?void 0:t.data)||[]),"single-saida"===e){var d;const e=(null===(d=n.data)||void 0===d?void 0:d.data)||[];Qe(e[0]),Ve(e[0])}const l=(null===(s=r.data)||void 0===s?void 0:s.data)||[];if(Ge){const e=l.filter((e=>e.codigo===Ge));Te(e[0]||{})}Fe(l)})).catch((()=>{})).finally((()=>{ze(!1)}))}),[e,o,L,n,a.open,U]),(0,u.useEffect)((()=>{if("single"===e&&U&&"df"===n){const e="string"===typeof G?G:c()(G[0]).format("DD/MM/YYYY");if(e.split("/")[0]>15){const a=2===`${parseInt(e.split("/")[1])+1}`.length?parseInt(e.split("/")[1])+1:`0${parseInt(e.split("/")[1])+1}`;W(`05/${a}/${e.split("/")[2]}`),Ce(2)}else Ce(1),W(`20/${e.split("/")[1]}/${e.split("/")[2]}`)}}),[e,O,n,$,U,G]),(0,u.useEffect)((()=>{a.open||(M(""),I(""),F(""),T(""),W(),V(),B("batch"===e||"batch-simple"===e||"single-saida"===e),z([]),q([]),H([]),Q([]),ee(0),oe(0),se(0),ne(0),de(0),ce(0),me([]),he(D[0]),xe(""),je(0),Ce(1),Ne(""),ye(N[0]),Se(0),Ae(""),ke(b[0]),Me([]),Ie([]),Fe([]),Te(""),We([]),Ve(""),Be(!1),ze(!1),"single"===e&&(l(""),Y()),"single-saida"===e&&(h(""),i(""),qe([]),He([]),Qe(""),ea([]),oa("N"),sa(""),na(0),da(""),Y()))}),[a.open]);const ca=c()().endOf("month"),ua=c()().endOf("month").format("DD/MM/YYYY"),ma=function(){if("sp"===n)return null;if(!O)return(0,y.Az)();const e="string"===typeof O?O:O.length>0?c()(O[0]).format("DD/MM/YYYY"):null;if(!e)return(0,y.Az)();const a=c()(e,"DD/MM/YYYY");if(!a.isValid())return(0,y.Az)();const o=c()();if(a.isAfter(o,"month"))return a.toDate();const t=c()().endOf("month"),s=t.day();return 0===s?t.subtract(2,"days"):6===s&&t.subtract(1,"day"),t.toDate()}(),ga=function(){if("sp"===n)return null;if(!O)return`Data m\xe1xima de pagamento \xe9 o \xfaltimo dia \xfatil do m\xeas: ${la(ca.day(),ua)}`;const e="string"===typeof O?O:O.length>0?c()(O[0]).format("DD/MM/YYYY"):null;if(!e)return`Data m\xe1xima de pagamento \xe9 o \xfaltimo dia \xfatil do m\xeas: ${la(ca.day(),ua)}`;const a=c()(e,"DD/MM/YYYY"),o=c()();return a.isAfter(o,"month")?`Data m\xe1xima de pagamento \xe9 a data de vencimento informada: ${e}`:`Data m\xe1xima de pagamento \xe9 o \xfaltimo dia \xfatil do m\xeas: ${la(ca.day(),ua)}`}();return{modo:e,estado:n,loading:U,saldo:E,setSaldo:M,dataVencimento:O,setDataVencimento:I,periodoRef:$,setPeriodoRef:F,dataPagamento:G,setDataPagamento:T,CodigoProduto:w,setCodigoProduto:W,data:J,codigos:_,currentCodigo:L,setCurrentCodigo:q,currentSubCodigo:Z,setCurrentSubCodigo:H,correcao:K,jurosCheck:X,setCheck:ee,dias:ae,correcaoValor:te,multas:ie,juros:re,fcp:le,setFcp:ce,tipoDoc:ge,setTipoDoc:he,numeroDoc:
1pe,setNumeroDoc:xe,apuracao:fe,tipo:ve,setTipo:Ce,valorOriginal:De,bancos:be,setBanco:ye,simplesNacional:Pe,setSimplesNacional:Se,ie:Re,setIe:Ae,codigoPR:Ye,setCodigoPR:ke,subCodigos:Ee,receitas:Oe,ProdutosReceitasData:$e,CurrentProdutoReceita:Ge,setCurrentProdutoReceita:Te,CamposReceitas:we,CurrentCampoReceita:Je,setCurrentCampoReceita:Ve,saving:Ue,loadingDependencies:_e,markTouched:x,hasChanges:k,handleEdit:async function(t){if("single"===e){if(1===fe&&"pe"===n&&0===pe.length)return(0,m.oR)((0,R.jsx)(v.A,{error:"Preencha o campo N\xfamero do Documento de Origem"}));const e="pe"===n?{TipoDocOrigem:ge.id,NumberoDocOrigem:pe}:null;if("rs"===n&&"1"===be.id)return(0,m.oR)((0,R.jsx)(v.A,{error:"Por favor escolha um banco"}));const a="string"===typeof G?G:c()(G[0]).format("DD/MM/YYYY");j.A.put(`${o}/guia/${r}`,{SaldoaRecolher:E.toString().replace(",","."),DataPagamento:a,DataEmissao:"string"===typeof $?$:c()($[0]).format("DD/MM/YYYY"),PlacaVeiculo:"AAA-0000",CodigoProduto:"df"===n?ve:"rs"===n?be.id:Ye.id,DataVencimento:"string"===typeof O?O:c()(O[0]).format("DD/MM/YYYY"),codigoGuia:0===_.length?null:L.id,ValorJuros:re,ValorMulta:ie,ValorAcrescimoFinanceiro:te,Dias:ae,simples:Pe,NFe_infNFe_dest_IE:Re,SaldoaRecolherFECP:le.toString().replace(",","."),sub_codigo:null!==Z&&void 0!==Z&&Z.id?Z.id:null,...e}).then((()=>{t(),p(),(0,m.oR)((0,R.jsx)(C.A,{message:"Guia editada com sucesso"}))}))}else if("single-saida"===e){var s,i;const e=await A.fire({title:"Salvar configura\xe7\xf5es?",text:`Voc\xea gostaria de salvar as configura\xe7\xf5es para a proximas guias do estado: ${n}?`,icon:"success",showCancelButton:!0,confirmButtonText:"Sim, salvar",cancelButtonText:"N\xe3o, somente editar",customClass:{actions:"gap-1",confirmButton:"btn btn-primary",cancelButton:"btn btn-outline-secondary ml-1"},buttonsStyling:!1});if(Ke&&Ke.camposExtrasObs&&!Xe)return(0,m.oR)((0,R.jsx)(v.A,{error:`Preencha o campo ${Ke.titulo}`}));if(0===L.length)return(0,m.oR)((0,R.jsx)(v.A,{error:"Escolha uma receita"}));if((null===we||void 0===we?void 0:we.length)>0&&!Je)return(0,m.oR)((0,R.jsx)(v.A,{error:"Escolha um campo extra de receita"}));if("S"===ra&&0===Re.length)return(0,m.oR)((0,R.jsx)(v.A,{error:"Preencha a Inscri\xe7\xe3o Estadual do Emitente no Paran\xe1"}));const a="string"===typeof G?G:c()(G[0]).format("DD/MM/YYYY"),r={};e.isConfirmed&&(r.memoria=!0),f.A.put(`${o}/guia/${g}`,{SaldoaRecolher:E.toString().replace(",","."),DataPagamento:a,DataEmissao:"string"===typeof $?$:c()($[0]).format("DD/MM/YYYY"),PlacaVeiculo:"AAA-0000",CodigoProduto:"df"===n?null:w,DataVencimento:"string"===typeof O?O:c()(O[0]).format("DD/MM/YYYY"),codigoGuia:"pr"===n||0===_.length?null:null===L||void 0===L?void 0:L.id,GNREDetalhamentoReceita:null===Z||void 0===Z?void 0:Z.codigo,ValorJuros:re,ValorMulta:ie,ValorAcrescimoFinanceiro:te,Dias:ae,ProdutoReceita:null===Ge||void 0===Ge?void 0:Ge.codigo,CamposExtrasReceita:null===Je||void 0===Je?void 0:Je.codigo,SaldoaRecolherFECP:le.toString().replace(",","."),CamposExtrasReceitaObs:Array.isArray(Xe)?c()(Xe[0]).format("YYYY-MM-DD"):Xe,Convenio:ta,inscricaoEstadualEmitente:["ES","SP"].includes(n)?"0":Number.isNaN(ia)?0:"pr"===n?"1":ia.toString(),GNREIEapuracao:null!==J&&void 0!==J&&null!==(s=J.TipoGuia)&&void 0!==s&&s.startsWith("CTE")?null:Re,GNREIEEmitente:null!==J&&void 0!==J&&null!==(i=J.TipoGuia)&&void 0!==i&&i.startsWith("CTE")?Re:null,DocumentosOrigem:null===Ze||void 0===Ze?void 0:Ze.id},{params:r}).then((()=>{t(),p(),(0,m.oR)((0,R.jsx)(C.A,{message:"Guia editada com sucesso"}))})).catch((()=>{}))}else if("batch-simple"===e){const e=["to","mt","es"];j.A.post(`/${o}/guia/sendLoteGuia`,{ids:a.ids,DataPagamento:!e.includes(n)&&G.length>0?c()(G[0]).format("DD/MM/YYYY"):O.length>0?c()(O[0]).format("DD/MM/YYYY"):"",DataVencimento:O.length>0?c()(O[0]).format("DD/MM/YYYY"):"",codigo_id:L.id,codigoGuia:L.CodigoGuia}).then((()=>{p(),(0,m.oR)((0,R.jsx)(C.A,{message:"As guias foram editadas com sucesso"})),t()}))}else{Be(!0);const e={DataVencimento:"string"===typeof O?O:c()(O[0]).format("DD/MM/YYYY"),GNREDetalhamentoReceita:null===Z||void 0===Z?void 0:Z.codigo,ProdutoReceita:null===Ge||void 0===Ge?void 0:Ge.codigo,CamposExtrasReceita:null===Je||void 0===Je?void 0:Je.codigo,ids:a.ids};if(!a.isFilterd){if(0===L.length)return(0,m.oR)((0,R.jsx)(v.A,{error:"Escolha uma receita"}));if(we.length>0&&0===Je.length)return(0,m.oR)((0,R.jsx)(v.A,{error:"Escolha um campo extra de receita"}));e.codigoGuia="pr"===n||0===_.length?null:null===L||void 0===L?void 0:L.id}const s="string"===typeof G?G:c()(G[0]).format("DD/MM/YYYY");e.DataPagamento=s,f.A.put(`${o}/guia/editLoteGuia`,e).then((()=>{t(),p(),(0,m.oR)((0,R.jsx)(C.A,{message:"Guia editada com sucesso"}))})).catch((()=>{})).finally((()=>{Be(!1)}))}},handleMask:function(e){let a=e.target.value;return a=a.replace(/\D/g,""),a=a.replace(/(\d)(\d{1})$/,"$1.$2"),e.target.value=a,e},handleJuroseMulta:function(e){if(!0===e.target.checked){ee(1);const e="string"===typeof $?$:c()($[0]).format("DD/MM/YYYY"),a="string"===typeof O?O:c()(O[0]).format("DD/MM/YYYY");let o=(0,y.Du)(e,a);o=Math.min(Math.max(o,0),60);const t=c()(e,"DD/MM/YYYY"),s=c()(a,"DD/MM/YYYY"),i=Math.max(0,12*(s.year()-t.year())+(s.month()-t.month())),n=Object.keys(K).length>0?Math.min(Math.max(i+1,1),Object.keys(K).length):-1,r=n>=0&&parseFloat(K[n])||0,d=parseFloat(E)||0,l=Math.round(d*(r/100)*100)/100,u=(Math.round(d*(.333*o/100)
1*100)/100).toFixed(2);oe(o),de(l),ne(u)}else ee(0),oe(0),se(0),ne(0),de(0)},handleAntencipacaoBA:function(e){if(e.target.checked){const e=.2*parseFloat(E),a=E-e;return Se(1),M(a.toFixed(2))}return Se(0),M(De)},considerarDataParaPeriodo:function(e){return e.target.checked?I(G):I(ue)},getLastDayUseful:la,lastDay:ca,lastDayFullDate:ua,maxDataPagamentoDate:ma,maxDataPagamentoDisplay:ga,documentosOrigem:Le,documentoOrigemSelected:Ze,setDocumentoOrigemSelected:He,extras:Ke,extrasInput:Xe,setInput:ea,exigeConvenio:aa,convenio:ta,setConvenio:sa,temInscricao:ia,handleInscricao:function(e){na(e.target.checked?1:0)},exigeIEapuracao:ra}}(i,e),_e=(0,y.zu)("editar e arquivar guia"),ze="single"===l,Le="single-saida"===l,qe="batch"===l,Ze="batch-simple"===l,He=ze?h&&_e:!h,Ke=e.tiposGuias;return(0,R.jsx)("div",{children:(0,R.jsxs)(r.aF,{isOpen:a,className:"d-flex modal-guia",toggle:o,children:[(0,R.jsx)("h1",{className:"d-flex mt-2 mb-1 justify-content-center titulo-card",children:ze?He?"es"!==g?`${null===T||void 0===T?void 0:T.TipoGuia} Nota: ${null===T||void 0===T?void 0:T.NFe_infNFe_ide_nNF}`:`${null===T||void 0===T?void 0:T.TipoGuia}`:null:"Editar guias em lote"}),(0,R.jsx)("p",{className:"text-center",children:(0,R.jsx)(r.Ex,{style:{fontSize:"1rem"},color:"light-danger",children:Me})}),(0,R.jsxs)(r.cw,{className:ze&&!_e?"d-flex justify-content-center":"",children:[ze&&!_e&&(0,R.jsx)(r.Ex,{className:"text-center",color:"light-danger",children:"Sem permiss\xe3o para edi\xe7\xe3o"}),qe&&(h||!e.isFilterd&&xe)?(0,R.jsx)("div",{className:"d-flex justify-content-center",children:(0,R.jsx)(r.y$,{color:"primary"})}):qe&&!h?(0,R.jsxs)("div",{className:"d-flex gap-2",children:[(0,R.jsx)(V,{estado:g,codigos:w,currentCodigo:W,setCurrentCodigo:U,ProdutosReceitasData:le,CurrentProdutoReceita:ce,setCurrentProdutoReceita:ue,CamposReceitas:me,CurrentCampoReceita:ge,setCurrentCampoReceita:he,isFilterd:e.isFilterd}),(0,R.jsx)(J,{estado:g,dataVencimento:k,setDataVencimento:E,dataPagamento:I,setDataPagamento:$,periodoRef:M,setPeriodoRef:O,markTouched:De,modo:l,receitas:de,currentSubCodigo:_,setCurrentSubCodigo:z,maxDataPagamento:Ee})]}):null,Ze&&(0,R.jsxs)("div",{style:{margin:"0 2rem"},children:[(0,R.jsx)(J,{estado:g,dataVencimento:k,setDataVencimento:E,dataPagamento:I,setDataPagamento:$,periodoRef:M,setPeriodoRef:O,markTouched:De,modo:"batch-simple",receitas:de,currentSubCodigo:_,setCurrentSubCodigo:z,maxDataPagamento:Ee}),Array.isArray(Ke)&&Ke.length<=1?(0,R.jsxs)(r.fI,{className:"mt-2",children:[(0,R.jsx)(r.JU,{children:"Selecione o c\xf3digo para as guias"}),(0,R.jsx)(r.fv,{className:"select-container codigos_guias d-flex flex-column",children:(0,R.jsxs)(t.W,{value:W,onChange:U,children:[(0,R.jsxs)(t.W.Button,{className:"select-button ",children:["rj"!==g&&(0,R.jsxs)("span",{children:[null===W||void 0===W?void 0:W.CodigoGuia," - "]}),(0,R.jsx)("span",{children:W.descricao})," ",(0,R.jsx)(s.A,{size:18})]}),(0,R.jsx)(t.W.Options,{className:"select-container-options",children:(0,R.jsx)(n(),{className:"scroll position width-scroll-45",children:w.map((e=>(0,R.jsxs)(t.W.Option,{className:"d-flex align-items-center",value:e,children:["rj"!==g&&e.CodigoGuia," - ",e.descricao]},e.id)))})})]})})]}):(0,R.jsx)(r.fI,{className:"mt-2",children:(0,R.jsx)(r.Fc,{className:"text-center",color:"warning",children:(0,R.jsx)("span",{children:"A altera\xe7\xe3o do c\xf3digo \xe9 permitida apenas quando os tipos das guias forem iguais."})})})]}),Le&&!h&&(0,R.jsx)(B,{estado:g,loading:h,data:T,saldo:p,setSaldo:x,fcp:q,setFcp:Z,CodigoProduto:F,setCodigoProduto:G,codigos:w,currentCodigo:W,setCurrentCodigo:U,produtosReceitasData:le,CurrentProdutoReceita:ce,setCurrentProdutoReceita:ue,camposReceitas:me,CurrentCampoReceita:ge,setCurrentCampoReceita:he,documentosOrigem:Oe,documentoOrigemSelected:Ie,setDocumentoOrigemSelected:$e,receitas:de,currentSubCodigo:_,setCurrentSubCodigo:z,dataVencimento:k,setDataVencimento:E,dataPagamento:I,setDataPagamento:$,periodoRef:M,setPeriodoRef:O,exigeConvenio:we,convenio:We,setConvenio:Je,exigeIEapuracao:Be,ie:te,setIe:se,extras:Fe,extrasInput:Ge,setInput:Te,handleInscricao:Ue,considerarDataParaPeriodo:Re,markTouched:De,handleMask:ye,maxDataPagamento:Ee}),Le&&h&&(0,R.jsx)("div",{className:"d-flex justify-content-center align-items-center",children:(0,R.jsx)(r.y$,{color:"primary"})}),ze&&He&&_e?(0,R.jsxs)("div",{className:"d-flex gap-2",children:[(0,R.jsx)(L,{estado:g,data:T,saldo:p,setSaldo:x,fcp:q,setFcp:Z,ie:te,setIe:se,CodigoProduto:F,setCodigoProduto:G,codigoPR:ie,setCodigoPR:ne,bancos:X,setBanco:ee,t
1ipoDoc:H,setTipoDoc:K,setNumeroDoc:Q,simplesNacional:ae,loading:h,codigos:w,currentCodigo:W,setCurrentCodigo:U,subCodigos:re,currentSubCodigo:_,setCurrentSubCodigo:z,handleAntencipacaoBA:Se,considerarDataParaPeriodo:Re,markTouched:De,handleMask:ye}),(0,R.jsx)(J,{estado:g,dataVencimento:k,setDataVencimento:E,dataPagamento:I,setDataPagamento:$,periodoRef:M,setPeriodoRef:O,markTouched:De,modo:l,loading:h,jurosCheck:fe,handleJuroseMulta:Pe,dias:je,juros:ve,multas:Ce,maxDataPagamento:Ee})]}):null,ze&&_e&&!He&&(0,R.jsx)("div",{className:"d-flex justify-content-center align-items-center",children:(0,R.jsx)(r.y$,{color:"primary"})})]}),(0,R.jsxs)("div",{className:"d-flex card-titulo-margin justify-content-center gap-1",children:[ze||Le?(0,R.jsx)(Y.A,{hideTooltip:Ne,children:(0,R.jsx)(r.$n,{id:"guias-botao-editar-nota-editar",type:"submit",onClick:()=>be(o),color:"primary",disabled:!Ne,style:{pointerEvents:Ne?"auto":"none"},children:"Editar"})}):(0,R.jsx)(r.$n,{type:"submit",onClick:()=>be(o),color:"primary",disabled:pe,children:pe?(0,R.jsx)(r.y$,{size:"sm"}):"Editar"}),(0,R.jsx)(r.$n,{outline:!0,onClick:o,color:"secondary",disabled:pe,children:"Cancelar"})]})]})})}},25083:(e,a,o)=>{o.d(a,{h:()=>s});var t=o(14745);const s=(0,o(43519).h)(t.Z,"useUtils","UtilsProvider")},43786:(e,a,o)=>{o.d(a,{A:()=>l});var t=o(65043),s=o(63e3),i=o.n(s);function n(){return n=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var o=arguments[a];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},n.apply(this,arguments)}function r(e,a){if(null==e)return{};var o,t,s=function(e,a){if(null==e)return{};var o,t,s={},i=Object.keys(e);for(t=0;t<i.length;t++)o=i[t],a.indexOf(o)>=0||(s[o]=e[o]);return s}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t<i.length;t++)o=i[t],a.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o])}return s}var d=(0,t.forwardRef)((function(e,a){var o=e.color,s=void 0===o?"currentColor":o,i=e.size,d=void 0===i?24:i,l=r(e,["color","size"]);return t.createElement("svg",n({ref:a,xmlns:"http://www.w3.org/2000/svg",width:d,height:d,viewBox:"0 0 24 24",fill:"none",stroke:s,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),t.createElement("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.createElement("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"}))}));d.propTypes={color:i().string,size:i().oneOfType([i().string,i().number])},d.displayName="Copy";const l=d},49968:(e,a,o)=>{o.d(a,{A:()=>l});var t=o(65043),s=o(63e3),i=o.n(s);function n(){return n=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var o=arguments[a];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},n.apply(this,arguments)}function r(e,a){if(null==e)return{};var o,t,s=function(e,a){if(null==e)return{};var o,t,s={},i=Object.keys(e);for(t=0;t<i.length;t++)o=i[t],a.indexOf(o)>=0||(s[o]=e[o]);return s}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t<i.length;t++)o=i[t],a.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o])}return s}var d=(0,t.forwardRef)((function(e,a){var o=e.color,s=void 0===o?"currentColor":o,i=e.size,d=void 0===i?24:i,l=r(e,["color","size"]);return t.createElement("svg",n({ref:a,xmlns:"http://www.w3.org/2000/svg",width:d,height:d,viewBox:"0 0 24 24",fill:"none",stroke:s,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),t.createElement("circle",{cx:"12",cy:"12",r:"10"}),t.createElement("polyline",{points:"8 12 12 16 16 12"}),t.createElement("line",{x1:"12",y1:"8",x2:"12",y2:"16"}))}));d.propTypes={color:i().string,size:i().oneOfType([i().string,i().number])},d.displayName="ArrowDownCircle";const l=d},51989:(e,a,o)=>{o.d(a,{D:()=>s});var t=o(10683);const s=(0,o(43519).h)(t.Z,"useGuias","GuiasContextProvider")},63782:(e,a,o)=>{o.d(a,{I:()=>s});var t=o(65043);function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[a,o]=(0,t.useState)(e),s=(0,t.useCallback)((e=>{e&&"string"===typeof e&&o((a=>a[e]?a:{...a,[e]:!0}))}),[]),i=(0,t.useCallback)((()=>o({})),[]),n=(0,t.useMemo)((()=>Object.keys(a).length>0),[a]);return{touched:a,setTouched:o,markTouched:s,resetTouched:i,hasChanges:n}}},71076:(e,a,o)=>{o.d(a,{A:()=>x});
1var t=o(65043),s=o(63405),i=o(71350),n=o(27965),r=(o(75733),o(94505)),d=o(82445),l=o(51989),c=o(86178),u=o.n(c),m=o(9628),g=o(81518),h=o(6840),p=o(70579);function x(e){const[a,o]=(0,t.useState)([]),{cnpjWithoutMask:c}=(0,d.m)(),{guiasId:x,handleWithGuiasState:f,guiasSaidaId:j}=(0,l.D)();return(0,p.jsxs)(i.aF,{isOpen:e.open,toggle:e.click,children:[(0,p.jsx)(i.rQ,{className:"bg-white",toggle:e.click}),(0,p.jsx)("h1",{className:"text-center",children:"Pagamento"}),(0,p.jsx)(i.cw,{style:{margin:"0 2rem"},children:(0,p.jsx)(i.fI,{children:(0,p.jsxs)(i.fv,{children:[(0,p.jsx)(i.JU,{children:"Selecione a data que foi realizado o pagamento"}),(0,p.jsxs)(i.MG,{className:"input-group-merge",children:[(0,p.jsx)(i.zB,{className:"border-end-0",children:(0,p.jsx)(s.A,{})}),(0,p.jsx)(n.A,{value:a,id:"range-picker",className:"form-control",onChange:e=>o(e),options:{dateFormat:"d/m/Y "},placeholder:"Escolha o periodo"})]})]})})}),(0,p.jsxs)("div",{className:"d-flex justify-content-center mb-2 mt-2 gap-1",children:[(0,p.jsx)(i.$n,{onClick:()=>async function(o){"entrada"===e.guia&&await r.A.put(`/${c}/guia/${x}/pagamento`,{paid_at:u()(a[0]).format("DD/MM/YYYY")}),"saida"===e.guia&&Array.isArray(j)&&await h.A.post(`/${c}/guia/lote/pagamento`,{ids:j,paid_at:u()(a[0]).format("DD/MM/YYYY")}),"saida"!==e.guia||Array.isArray(j)||await h.A.put(`/${c}/guia/${j}/pagamento`,{paid_at:u()(a[0]).format("DD/MM/YYYY")}),f(),(0,m.oR)((0,p.jsx)(g.A,{message:"A guia foi marcada com sucesso"})),o()}(e.click),color:"primary",children:"Confirmar"}),(0,p.jsx)(i.$n,{outline:!0,onClick:e.click,color:"secondary",children:"cancelar"})]})]})}},73828:(e,a,o)=>{o.d(a,{A:()=>C});var t=o(54176),s=o(65043),i=o(9628),n=o(71350),r=o(30064),d=o.n(r),l=o(41981),c=o.n(l),u=o(25083),m=o(80431),g=o(85104),h=o(55390),p=o(94768),x=o(81518),f=o(57483),j=o(70579);const v=c()(d());function C(e){const{id_empresa:a,contas:o,cnpjWithoutMask:r,guias:d,operacao:l}=e,{handleType:c}=(0,u.h)(),[C,D]=(0,s.useState)(null),[N,b]=(0,s.useState)(f.Jf[0]),[y,P]=(0,s.useState)("radio-button-active"),[S,R]=(0,s.useState)("radio-button"),[A,Y]=(0,s.useState)(!1);function k(){e.click(),D(null)}async function E(e){try{if(d.length<=0)return Y(!1),(0,i.oR)((0,j.jsx)(h.A,{error:"Selecione pelo menos uma guia!"}));i.oR.dismiss(),(0,i.oR)((0,j.jsx)(p.A,{message:"Enviando para o modulo de pagamentos!"})),Y(!0);await m.A.post(`/charge/${r}/register`,{guias:d,status:e},{params:{operacao:l}});Y(!1),window.location=`/pagamentos/${l}`}catch(o){var a;return i.oR.dismiss(),Y(!1),400===(null===o||void 0===o||null===(a=o.response)||void 0===a?void 0:a.status)?(0,i.oR)((0,j.jsx)(h.A,{error:null===o||void 0===o?void 0:o.response.data.message})):(0,i.oR)((0,j.jsx)(h.A,{error:"Ops! Algo deu errado: 2"}))}}return(0,j.jsxs)(n.aF,{size:"lg",style:{maxWidth:C?"800px":"580px"},centered:!0,isOpen:e.open,toggle:k,children:[(0,j.jsx)(n.rQ,{className:"bg-transparent",style:{position:"absolute",right:0,top:-5},toggle:k}),(0,j.jsx)(j.Fragment,{children:(0,j.jsxs)("div",{className:"w-100 h-100",children:[(0,j.jsx)("h1",{className:"d-flex justify-content-center titulo-card my-4",children:"Pagamento"}),(0,j.jsxs)(n.cw,{className:"w-100 h-100",children:[(0,j.jsx)(n.fv,{className:"d-flex flex-column justify-content-center mb-5",children:(0,j.jsx)(t.z,{by:"name",className:"d-flex justify-content-center gap-1 mb-1",value:N,onChange:b,children:f.Jf.map((e=>(0,j.jsx)(t.z.Option,{className:e=>{let{active:a,checked:o}=e;return`${a?y:S}Z ${o?y:S} cursor-pointer justify-content-center d-flex align-items-center`},id:e.name,value:e,onChange:()=>{c(e.name)},children:(0,j.jsx)("div",{className:"d-flex flex-column text-center",children:(0,j.jsx)("span",{children:e.name})})},e.name)))})},"payment-options"),(0,j.jsx)("div",{className:"d-flex justify-content-center gap-1 card-titulo-margin ",children:(0,j.jsx)(n.$n,{color:"primary",disabled:A,onClick:()=>0===N.id?async function(){(0,i.oR)((0,j.jsx)(p.A,{message:"Criando pagamento(s)"}),{autoClose:!1,toastId:"loading"});try{if(Y(!0),d.length<=0)return(0,i.oR)((0,j.jsx)(h.A,{error:"Selecione pelo menos uma guia!"}));await g.A.post("/pagamentos-api/pagamentos/create",{guias:d,info_empresa:{id_empresa:a,id_conta_bancaria:o.id,cnpj:r},operacao:l}),(0,i.oR)((0,j.jsx)(x.A,{message:"Remessa criada com sucesso!"}));try{E("Remessa criada")}catch(c){}finally{i.oR.dismiss("loading"),Y(!1)}}catch(u){if(i.oR.dismiss(),Y(!1),400===(null===u||void 0===u?void 0:u.response.status)){var e,t,s,n;if(null!==u&&void 0!==u&&null!==(e=u.response)&&void 0!==e&&null!==(t=e.data)&&void 0!==t&&t.skipped&&(null===u||void 0===u||null===(s=u.response)||void 0===s||null===(n=s.data)||void 0===n?void 0:n.skipped.length)>0){const e=(0,j.jsx)("div",{children:u.response.data.skipped.map(((e,a)=>(0,j.jsx)("div",{style:{marginBottom:"0.5rem"},children:e},`item${a}`)))}),a=1===u.response.data.skipped.length?"Uma guia n\xe3o p\xf4de ser processada.":`${u.response.data.skipped.length} guias n\xe3o puderam ser processadas.`;v.fire({titleText:a,html:e,icon:"error",confirmButtonText:"OK",customClass:{actions:"gap-1",confirmButton:"btn btn-outline-secondary"},buttonsStyling:!1}).isConfirmed}return i.oR.error(null===u||void 0===u?void 0:u.response.data.message,{autoClose:5e3,hideProgressBar:!1})}return i.oR.error("Ops! Algo deu errado: 3",{autoClose:5e3,hideProgressBar:!1})}}():E("Pendente"),children:"Avan\xe7ar"})})]})]})})]})}},85104:(e,a,o)=>{o.d(a,{A:()=>n});var t=o(23474),s=o(42353),i=o(39546);const n=(0,o(31779).u)({baseURL:t.c.pagamentos,getToken:()=>{var e,a;return null===(e=(0,i.gL)())||void 0===e||null===(a=e.autenticacao)||void 0===a?void 0:a.api_token},subscribe:e=>s.M.subscribe(e)})}}]);
2//# sourceMappingURL=164.b0edb40a4f16503f4b0f.chunk.js.map

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.