PageSourceSearch

https://app.declarando.es/assets/Impuestos-U8m-3yPt.js

js declarando.es collected 2026-09-24 08:43:54 UTC 101,058 bytes, 1 lines download raw bytes

1import{da as c,bO as Ae,ag as ue,bN as Ue,d0 as e,m as u,bp as ge,b6 as Y,aI as os,dC as it,au as Ve,D as G,Y as N,w as we,C as pe,aY as H,c as he,z as B,W as w,bx as rt,E as _,t as ns,c9 as L,cb as j,x as b,bs as S,S as _e,bS as k,ah as $,an as A,ar as K,dm as Q,q as Re,h as ee,dN as lt,bq as y,ci as V,bg as Pe,bI as Dt,a3 as is,ac as wt,ae as Ne,u as Lt,Z as ct,ao as Ke,dE as Nt,cn as Se,aH as me,g as ke,bY as Qe,bX as J,by as rs,af as kt,F as ls,b9 as cs,k as Ye,aN as re,dn as ds,a as Me,az as us,b2 as dt,bU as ps,bm as ut,di as pt,dk as ht,dj as mt,df as xt,dg as ft,dh as gt,aM as Ft,a0 as hs,dT as Ct,b3 as jt,a1 as Xe,a2 as ye,bb as Be,d8 as ms,b5 as xs,i as Vt,b8 as fs,dr as At,B as gs,bn as Cs,aT as js,cd as Le,dU as bs,aA as vs}from"./index-SW_ThLYf.js";import{M as Ce}from"./ModelsRepository-BaoPwgRV.js";import{S as bt}from"./spinner-DT_AlmYt.js";import{I as _t}from"./InformeRentaService-qUae8-Sd.js";import{S as Ms}from"./SectionSwitcher-GtCUh2k9.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"bec1de57eae065682d34a4d342eab128bf62b115"}}catch{}})();try{(function(){var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="57cfa7b9-d0dc-4823-9cea-484276ef1b74",t._sentryDebugIdIdentifier="sentry-dbid-57cfa7b9-d0dc-4823-9cea-484276ef1b74")})()}catch{}const ys="Ahora No",Ps="Cancelar",Ss="Sí, guardar cuota a compensar",As="Guardar cuota",Rs="Cuota a compensar de ";class Bt extends c.Component{static contextType=Ae;constructor(s){super(s),this.modelsRepository=new Ce,this.ahora_no=0,this.state={errorMessage:null,cuota:0,isValidForm:!0,confirm:!1}}componentDidMount(){this.getCuotaCompensar()}getCuotaCompensar=()=>{this.modelsRepository.getCuotaCompensar(ue.getFiscalYear()-1).then(s=>{this.setState({cuota:s.data.importe})})};checkValidForm(){let s=this.isValidForm();this.setState({isValidForm:s})}isValidForm(){return!isNaN(this.state.cuota)}handleCuotaChange=s=>{this.setState({cuota:s},this.checkValidForm)};handleSubmit=()=>{if(!this.state.confirm&&this.ahora_no!==1)return this.setState({confirm:!0});this.state.isValidForm&&this.updateCompensation()};updateCompensation=()=>{this.context.tasksList.removeCouta(),this.props.repository.updateCompensation(this.props.year,this.state.cuota,this.ahora_no).then(()=>{sessionStorage.setItem("askedCompensation",1),this.props.handleSaved(),new Ue().getCuotaRepository().checkCuotaCompensar(this.props.year).then(({data:o})=>{this.context.tasksList.addCuota(o,this.props.stickyCuotaAction)})}),this.ahora_no=0};notNowHandler=()=>{this.props.hasCuotaCompensar?this.props.handleSaved():(this.setState({cuota:0},this.checkValidForm),this.ahora_no=1,this.props.handleSaved(),this.handleSubmit())};render(){let s=ys;this.props.hasCuotaCompensar&&(s=Ps);let a=this.state.errorMessage?e.jsx(u,{px:"15px",children:e.jsx(ge,{tone:"error",full:!0,tag:this.state.errorMessage})}):"";return e.jsxs(Y,{id:"ModalCompensacion",isOpen:this.props.isOpen,title:e.jsx(e.Fragment,{children:"¿Tienes cuota de IVA a compensar del ejercicio anterior?"}),labelAction:this.state.confirm?Ss:As,labelCancel:s,disabledAction:this.state.cuota>=0?!this.state.isValidForm:!0,handleAction:this.handleSubmit,handleCancel:this.notNowHandler,children:[a,e.jsx(u,{pl:"15px",pr:"15px",mb:"10px",children:e.jsx(os,{label:Rs+this.props.year,id:"inputModalCuotaCompensar",value:this.state.cuota,onChange:this.handleCuotaChange,inform:this.state.confirm})})]})}}Bt.defaultProps={hasCuotaCompensar:!1};const Es=()=>{const{data:t,status:s}=it({queryKey:["getResumenAnualImpuestos"],fetchFn:()=>new Ve().getYearlyModelResume(),config:{refetchOnWindowFocus:!1,select:({data:a})=>a}});return{modelos:t??[],isLoading:s==="pending"}},Ts={100:"Retenciones",111:"Retenciones",115:"Alquileres",130:"PagosFraccionadosIRPF",180:"AlquileresAnual",190:"RetencionesAnual",303:"IVA","303C":"IVA",309:"IVAopEuropeas",347:"OpConTercerasPersonas",349:"OpIntracomunitarias",390:"IVAAnual"};class Is{constructor(s){this._modelos=this.mapModelos(s),this._totales=this.sumarModelos()}mapModelos(s){return s.map(a=>({...a,categoria:Ts[a.model],totalAnual:this.calcularTotalAnual(a
1)}))}get totales(){return this._totales}get modelos(){return this._modelos??[]}parseResult(s){return Number(s??0)}calcularTotalAnual(s){const a=this.parseResult(s.result1T),o=this.parseResult(s.result2T),n=this.parseResult(s.result3T),i=this.parseResult(s.result4T);return a+o+n+i}actualizarTotales(s,a){const o=this.parseResult(a.result1T),n=this.parseResult(a.result2T),i=this.parseResult(a.result3T),r=this.parseResult(a.result4T),d=o+n+i+r;s.result1T+=o,s.result2T+=n,s.result3T+=i,s.result4T+=r,s.totalAnual+=d}sumarModelos(){const s={result1T:0,result2T:0,result3T:0,result4T:0,totalAnual:0};return this.modelos.forEach(a=>{this.actualizarTotales(s,a)}),s}}const Os=t=>{const[s,a]=c.useState(t.modelos),[o,n]=c.useState("model"),[i,r]=c.useState("");return{tipoOrdenacion:i,columnaOrdenada:o,ordenarPorColumna:l=>{n(l),r(i==="asc"?"desc":"asc"),a(t.modelos.sort((p,h)=>{if(l==="categoria"){const x=p[l]||"",C=h[l]||"";return i==="asc"?x.localeCompare(C):C.localeCompare(x)}const v=parseInt(String(p[l]??0)),m=parseInt(String(h[l]??0));return v<m?i==="asc"?-1:1:v>m?i==="asc"?1:-1:0}))},modelos:s,resumenAnual:t}},qt=c.createContext({}),Ds=({modelos:t,children:s})=>e.jsx(qt.Provider,{value:{...Os(new Is(t))},children:s}),Ze=()=>{const t=c.useContext(qt);if(!t)throw Error("useResumenAnualContext must be inside an ResumenAnualContextProvider");return t},Fe=({estado:t,fechas:s})=>{if(t==="BLOQUEADO")return e.jsx(G,{label:"Bloqueado",value:"neutral",type:"status"});if((t==="COMPLETADO"||!t)&&s.presentado)return s.presentado>s.limite?e.jsx(G,{label:"Fuera de plazo",value:"danger",type:"status"}):e.jsx(G,{label:"En plazo",value:"success",type:"status"});let a;switch(t){case"PREVIO_DECLARANDO":a=e.jsx(G,{label:"Previo a Declarando",value:"neutral",type:"status"});break;case"PENDIENTE":a=e.jsx(G,{label:"Para presentar",value:"info",type:"status"});break;case"FUERA_DE_PLAZO":a=e.jsx(G,{label:"Fuera de plazo",value:"danger",type:"status"});break;case"PRESENTADO":a=e.jsx(G,{label:"Falta justificante",value:"warning",type:"status"});break;default:a=e.jsx(G,{label:"Para presentar",value:"info",type:"status"})}return a},xe=({modelo:t,fechas:s})=>{const{estado:a}=t;if(s.presentado){const l="Presentado el "+N.formatDateToString(s.presentado,"D MMM YYYY").replace(".","");return e.jsx(we,{label:l,type:s.presentado&&s.presentado>s.limite?"presentado_caducado":"presentado"})}let o="Hasta el "+N.formatDateToString(s.limite,"D MMM YYYY").replace(".","");if(a==="FUERA_DE_PLAZO"||a==="BLOQUEADO"&&s.limite<=s.now)return e.jsx(we,{label:o,type:"caducado",info:e.jsx(ws,{})});if(!a&&s.inicio>s.now&&!s.presentado)return o="Desde el "+N.formatDateToString(s.inicio,"D MMM YYYY").replace(".",""),t.isProximoPeriodo?e.jsx(we,{label:o,type:"proximo_periodo"}):e.jsx(we,{label:o,type:"proximo"});const n=N.diffDays(s.now,s.inicio),i=N.diffDays(s.limite,s.inicio),r=n/i*100,d=r<5?5:r>95?95:r;return e.jsx(we,{label:o,type:r>75?"in_progress":"para_presentar",progressValue:d,info:null})},ws=()=>e.jsxs(e.Fragment,{children:["Presentar un modelo fuera de plazo supone una serie de consecuencias a tener en cuenta.",e.jsx(pe,{children:e.jsx(H,{underline:!0,href:"https://ayuda.declarando.es/es/articles/1130450-consecuencias-de-presentar-un-impuesto-fuera-de-plazo",children:"Saber más"})})]}),Ee=({modelo:t,informar:s})=>{const{resultado:a,isInformativo:o}=t;return t.nombre==="303"&&t.tieneCuotaACompensarMayorQueResultado&&t.presentacion.trimestre==="4T"&&s?e.jsx(he,{size:"S",label:"Ver resultado...",onClick:s}):o?e.jsx(B,{result:"",info:"Modelo informativo"}):e.jsx(B,{success:a<0,result:a||a===0?w(a,{},2).replace("-",""):"",info:"".concat(a<0?" a favor":"").concat(a>0?" a pagar":"")})},fe=({presentacion:t,periocidad:s,isBlocked:a,color:o})=>{const{trimestre:n,year:i}=t;return s===rt.ANUAL?e.jsx(_,{color:o||(a?"body2":"body1"),text:"Anual "+i}):e.jsx(_,{color:o||(a?"body2":"body1"),text:n[0]+"T "+i})},Ls={Retenciones:"Retenciones",Alquileres:"Alquileres",PagosFraccionadosIRPF:"Pagos fraccionados IRPF",IVA:"IVA",IVAopEuropeas:"IVA op. Europeas",OpIntracomunitarias:"Op. Intracomunitarias",OpConTercerasPersonas:"Op. con terceras personas",AlquileresAnual:"Alquileres anual",RetencionesAnual:"Retenciones anual",IVAAnual:"IVA anual"},le=({categoria:t,isDisabled:s})=>{const a=Ls[t]??t;return s?e.jsx(ns,{text:!0,bg:"disabled",children:a}):e.jsx(G,{label:a})},Ns=()=>{const{modelos:t}=Ze(),s=a=>w(+(a??0));return e.jsx(L.Body,{children:t.map(a=>e.jsxs(L.Row,{boxShadow:!0,children:[e.jsx(j,{children:e.jsx(_,{boldText:!0,text:`Modelo ${a.model}`})}),e.jsx(j,{children:e.jsx(le,{categoria:a.categoria})}),e.jsx(j,{align:"right",children:e.jsx(B,{result:s(a.result1T),info:""})}),e.jsx(j,{align:"right",children:e.jsx(B,{result:s(a.result2T),info:""})}),e.jsx(j,{align:"right",children:e.jsx(B,{result:s(a.result3T),info:""})}),e.jsx(j,{align:"right",children:e.jsx(B,{result:s(a.result4T),info:""})}),e.jsx(j,{align:"right",children:e.jsx(B,{result:s(a.totalAnual),info:""})})]},`mra_${a.model}`))})},ks=()=>{const{resumenAnual:t}=Ze();return e.jsx(L.Footer,{children:e.jsxs(L.Row,{boxShadow:!0,children:[e.jsx(j,{}),e.jsx(j,{}),e.jsx(j,{align:"right",children:e.jsx(B,{result:w(t.totales.result1T),info:""})}),e.jsx(j,{align:"right",children:e.jsx(B,{result:w(t.totales.result2T),info:""})}),e.jsx(j,{align:"right",children:e.jsx(B,{result:w(t.totales.result3T),info:""})}),e.jsx(j,{align:"right",children:e.jsx(B,{result:w(t.totales.result4T),info:""})}),e.jsx(j,{align:"right",children:e.jsx(B,{result:w(t.totales.totalAnual),info:""})})]})})},Fs=()=>{const{ordenarPorColumna:t,columnaOrdenada:s,tipoOrdenacion:a}=Ze();return e.jsxs(L.Head,{children:[e.jsx(b,{active:!!a&&s==="model",icon:a==="asc"?"angle-up":"angle-down",onClick:()=>t("model"),children:"Modelo"}),e.jsx(b,{active:!!a&&s==="categoria",icon:a==="asc"?"angle-up":"angle-down",onClick:()=>t("categoria"),children:"Tipo de impuesto"}),e.jsx(b,{align:"right",active:!!a&&s==="result1T",icon:a==="asc"?"angle-up":"angle-down",onClick:()=>t("result1T"),children:"1º Trimestre"}),e.jsx(b,{align:"right",active:!!a&&s==="result2T",icon:a==="asc"?"angle-up":"angle-down",onClick:()=>t("result2T"),children:"2º Trimestre"}),e.jsx(b,{align:"right",active:!!a&&s==="result3T",icon:a==="asc"?"angle-up":"angle-down",onClick:()=>t("result3T"),children:"3º Trimestre"}),e.jsx(b,{align:"right",active:!!a&&s==="result4T",icon:a==="asc"?"angle-up":"angle-down",onClick:()=>t("result4T"),children:"4º Trimestre"}),e.jsx(b,{align:"right",active:!!a&&s==="totalAnual",icon:a==="asc"?"angle-up":"angle-down",onClick:()=>t("totalAnual"),children:"Total anual"})]})},Vs=({modalController:t})=>{const{show:s,closeModal:a}=t;return e.jsxs(Y,{title:"Resumen anual de impuestos",isOpen:s,handleCloseButton:a,handleAction:a,variant:"large",labelAction:"Entendido",showCancel:!1,showCloseButton:!0,children:[e.jsx(S,{children:"Se tienen en cuenta todos los impuestos presentados con o sin justificante subido."}),s?e.jsx(_s,{}):null]})},_s=()=>{const{modelos:t,isLoading:s}=Es();return s?e.jsx(_e,{text:"Cargando..."}):e.jsxs(Ds,{modelos:t,children:[e.jsx(u,{display:{_:"none",tablet:"block"},children:e.jsxs(L,{type:"simple-table",children:[e.jsx(Fs,{}),e.jsx(Ns,{}),e.jsx(ks,{})]})}),e.jsx(u,{display:{_:"block",tablet:"none"},children:e.jsx(Bs,{})})]})},Bs=()=>{const{resumenAnual:t}=Ze(),{modelos:s}=t;return e.jsx(e.Fragment,{children:s.map(a=>e.jsxs(k,{p:"sm",style:{borderBottom:"1px solid #DDDDE0"},children:[e.jsxs($,{justifyContent:"space-between",children:[e.jsxs(A,{gridTemplateColumns:"max-content max-content",gridGap:"xxs",children:[e.jsx(_,{boldText:!0,text:"Modelo "+a.model}),e.jsx(le,{categoria:a.categoria})]}),e.jsx(B,{result:w(a.totalAnual),info:""})]}),e.jsxs(u,{children:[e.jsxs(A,{justifyContent:"end",justifyItems:"end",gridTemplateColumns:"repeat(4, 1fr)",gridGap:"sm",children:[e.jsx(S,{small:!0,color:"semantic.text.general.text3",children:"1T"}),e.jsx(S,{small:!0,color:"semantic.text.general.text3",children:"2T"}),e.jsx(S,{small:!0,color:"semantic.text.general.text3",children:"3T"}),e.jsx(S,{small:!0,color:"semantic.text.general.text3",children:"4T"})]}),e.jsxs(A,{justifyContent:"end",justifyItems:"end",gridTemplateColumns:"repeat(4, 1fr)",gridGap:"sm",children:[e.jsx(_,{subtext:w(+(a.result1T??0))}),e.jsx(_,{subtext:w(+(a.result2T??0))}),e.jsx(_,{subtext:w(+(a.result3T??0))}),e.jsx(_,{subtext:w(+(a.result4T??0))})]})]})]},"mbmrs"+a.model))})},qs=()=>e.jsx(u,{alignCenter:!0,maxWidth:579,m:"auto",children:e.jsxs(k,{children:[e.jsx(K,{name:"wind",fontSize:"64px",color:Q.colors.semantic.text.status.emptyDisabled}),e.jsxs(S,{color:"semantic.text.general.text2",children:["Todavía no has completado la presentación de ningún modelo. ",e.jsx("br",{}
1),"Ve al listado de pendientes para ver si tienes modelos a presentar y vuelve para consultar los completados."]}),e.jsx(u,{children:e.jsx(Re,{variant:"secondary",label:"Ver modelos pendientes",size:"L",onClick:()=>ee.goToImpuestos()})})]})}),Hs=()=>{const[t,s]=c.useState({}),[a,o]=c.useState(""),[n,i]=c.useState(!1),r=lt();return{modelo:t,setModelo:s,iniciarPresentacionModelo:(l,p)=>{r.setLoadingData(!0),p.checkModelo(l,()=>{s(l),r.showModal()})},modal:r,metodoPagoSeleccionado:a,setMetodoPagoSeleccionado:o,setIsButtonIniciarPresentacionBlock:i,isButtonIniciarPresentacionBlock:n}},se=c.createContext({}),qe=()=>{const t=c.useContext(se);if(!t)throw Error("useModeloPendienteContext must be inside an ModeloPendienteContextProvider");return t},Ht=({children:t,onSuccess:s})=>e.jsx(se.Provider,{value:{...Hs(),onSuccess:s},children:t}),Us=t=>{const[s,a]=c.useState(null),[o,n]=c.useState(!1),i=()=>{const l=new FormData;return l.append("modelPresentation",s??""),new Pe().presentarModelo(t,l)};return{submit:async()=>{if(!s&&!o)return!1;if(s){const{error:l,message:p,body:h}=await i();if(l)return p===ze.JUSTIFICANTE_NO_VALIDO||h?.error===ze.JUSTIFICANTE_NO_VALIDO?(vt(),a(null)):y.error({title:"No ha sido posible presentar el modelo",message:"Por favor, vuelve a intentarlo."}),!1}return V.clickNextStep({event_label:"Marca el modelo como Presentado"}),await new Ce().presentarModelo(t.nombre,t.presentacion.year,t.presentacion.trimestre),s?y.success({title:`El modelo ${t.nombre} se ha presentado correctamente`,message:"Has completado la presentación del modelo.",link:{href:"https://app.declarando.es/impuestos/modelos-presentados",label:"Ir a completados"}}):y.warning({title:`El modelo  ${t.nombre} se ha presentado correctamente`,message:"Recuerda que debes subir el justificante para completar la presentación."}),!0},params:{fileUpload:i,onChangeFile:l=>{l&&V.fileUpload({event_label:"Adjunta el justificante"}),a(l),n(!1)},selectedFile:s,setSelectedFile:a,uploadLater:o,setUploadLater:n}}},ze={JUSTIFICANTE_NO_VALIDO:"JUSTIFICANTE_NO_VALIDO"},vt=()=>{y.error({title:"No ha sido posible subir el justificante",message:"Comprueba que sea el justificante correcto",link:{label:"¿Qué documento adjuntar?",href:"https://ayuda.declarando.es/es/articles/9734474-como-saber-si-he-presentado-un-impuesto-correctamente",shouldOpenInNewTab:!0},options:{autoDismiss:1e4}})},Ut=({modelo:t})=>{const[s,a]=c.useState(new FormData),o=Dt.useRef(),n=lt(),i=()=>{const l=new Ne().getModelPresentationUrl(t.nombre,t.presentacion.trimestre,t.presentacion.year);new Ne().downloadFile(l).then(()=>{y.success({title:"El justificante se ha descargado correctamente"})}).catch(()=>{y.error({title:"No ha sido posible descargar el justificante",message:"Por favor, vuelve a intentarlo."})})},r=()=>{o&&o.current?.click()},d=()=>{n.setBusy(!0),new Ne().postModelPresentation(t.nombre,t.presentacion.trimestre,t.presentacion.year,s).then(()=>{y.notifySuccess(" ","El justificante del modelo "+t.nombre+" se ha reemplazado correctamente"),a(new FormData),n.closeModal()}).catch(()=>{y.error({title:"No ha sido posible subir el justificante",message:"Comprueba que sea el justificante correcto.",link:{href:"https://ayuda.declarando.es/es/articles/9734474-como-saber-si-he-presentado-un-impuesto-correctamente",label:"¿Qué documento adjuntar?"}}),vt()}).finally(()=>{n.setBusy(!1)})};return e.jsxs(e.Fragment,{children:[e.jsx(is,{triggerType:"action-link",triggerProps:{variant:"main",isIconOnly:!0,icon:"ellipsis-h",size:"M"},position:"right",forceContentToBottomOnMobile:!0,options:[{children:"Descargar justificante",value:"descargar",icon:"file-download",onClick:()=>{i()}},{children:"Reemplazar justificante",value:"reemplazar",icon:"sync",onClick:()=>{r()}}]}),e.jsx(wt,{style:{display:"none"},ref:o,variant:"secondary",filename:"modelPresentation",size:"M",maxsize:5,accept:".pdf",onError:l=>{y.notifyError("",l)},uploadFile:l=>{a(l),n.showModal()},children:"Subir justificante"}),e.jsx(Y,{busy:n.busy,variant:"small",title:"Reemplazar justificante modelo "+t.nombre,isOpen:n.show,handleAction:d,handleCancel:()=>{n.closeModal(),a(new FormData)},labelAction:"Reemplazar justificante",showCloseButton:!0,handleCloseButton:()=>n.closeModal(),children:e.jsxs(k,{children:[e.jsx(S,{small:!0,children:"¿Estás seguro de que quieres reemplazar el justificante?"}),e.jsx(ge,{full:!0,title:"El justificante anterior desaparecerá y no podrás recuperarlo",message:"Antes de subir el nuevo justificante, te recomendamos descargar el anterior para tener una copia del mismo en caso de que lo necesites"})]})})]})}
1,zt={DIRECT:"Domiciliación",CASH:"Efectivo",NRC:"Código NRC",COMPENSAR:"Compensar",DEVOLVER:"Devolver",APLAZAMIENTO:"Aplazamiento"},He=t=>({now:N.getNow(),inicio:N.formatStringToDate(t.presentacion.inicio),limite:N.formatStringToDate(t.presentacion.limite),presentado:t.fechaPresentado?N.formatStringToDate(t.fechaPresentado):null}),zs=({modelo:t})=>{const s=He(t);return e.jsxs(L.Row,{boxShadow:!0,status:"success",children:[e.jsxs(j,{children:[e.jsx(_,{className:"cell",boldText:!0,text:e.jsx(A,{as:"span",gridTemplateColumns:"max-content max-content",alignItems:"center",pl:"sm",ml:-5,children:e.jsxs("span",{children:["Modelo ",t.nombre," "]})})})," "]}),e.jsx(j,{children:e.jsx(le,{categoria:t.categoria})}),e.jsx(j,{children:e.jsx(fe,{periocidad:t.periodicidad,presentacion:t.presentacion})}),e.jsx(j,{children:t.estado!=="PREVIO_DECLARANDO"?e.jsx(xe,{modelo:t,fechas:s}):null}),e.jsx(j,{children:e.jsx(Fe,{estado:t.estado,fechas:s})}),e.jsx(j,{align:"right",children:e.jsx(Ee,{modelo:t})}),e.jsx(j,{children:e.jsx(Lt,{children:zt[t.tipoDeclaracionCodigo]})}),e.jsx(j,{children:t.estado!=="PREVIO_DECLARANDO"?e.jsx(Ut,{modelo:t}):null})]})},Gs=({modelo:t})=>{const s=He(t);return e.jsxs(k,{px:"sm",py:"xs",style:{borderBottom:"1px solid #DDDDE0"},children:[e.jsxs($,{justifyContent:"space-between",children:[e.jsx(_,{boldText:!0,text:"Modelo "+t.nombre}),e.jsx(Fe,{estado:t.estado,fechas:s})]}),e.jsxs(A,{alignItems:"center",gridGap:"sm",gridTemplateColumns:"max-content max-content max-content",children:[e.jsx(G,{label:"Retenciones"}),e.jsx(fe,{periocidad:t.periodicidad,presentacion:t.presentacion,shortText:!0}),t.estado!=="PREVIO_DECLARANDO"?e.jsx(xe,{modelo:t,fechas:s}):null]}),e.jsxs($,{justifyContent:"space-between",children:[e.jsx(Ee,{modelo:t}),e.jsx(Lt,{children:zt[t.tipoDeclaracionCodigo]}),t.estado!=="PREVIO_DECLARANDO"?e.jsx(Ut,{modelo:t}):null]})]})};class Js extends ct{constructor(s=new Ve){super(),this.repository=s}getModelosCompletados(){return this.execute(()=>this.repository.getModelosCompletados(),{shouldThrowError:!0})}}const Qs=()=>{const{data:t,status:s}=it({queryKey:["getModelosCompletados"],fetchFn:()=>new Js().getModelosCompletados(),config:{refetchOnWindowFocus:!1,select:a=>a?.data?.resources}});return{modelos:t??[],isLoading:s==="pending"}},Ys=()=>{const{isLoading:t,modelos:s}=Qs();return{isLoading:t,modelos:s}},Zs=()=>{const{isLoading:t,modelos:s}=Ys(),a=lt(),{showModal:o}=a;return t?e.jsx(bt,{}):e.jsx(e.Fragment,{children:e.jsxs(Ht,{onSuccess:()=>Promise.resolve(),children:[e.jsx(Vs,{modalController:a}),e.jsxs(u,{borderRadius:"md",bg:"white",px:0,minHeight:{_:"calc(100vh - 170px - 16px - 16px)",tablet:"calc(100vh - 178px - 16px - 16px)",desktop:"600px"},children:[e.jsxs(A,{pt:"lg",px:{_:"sm",desktop:"md"},gridTemplateColumns:"1fr max-content",alignItems:"center",className:"list-completados",children:[e.jsx(Ke,{as:"h3",children:"Modelos completados"}),e.jsx(he,{size:"S",icon:"chart-line",onClick:()=>o(),label:"Resumen anual"})]}),s.length>0?e.jsxs(e.Fragment,{children:[e.jsx(u,{display:{_:"none",desktop:"block"},children:e.jsxs(L,{type:"simple-table",paddingBottom:"90px",children:[e.jsxs(L.Head,{children:[e.jsx(b,{children:e.jsx(u,{pl:"sm",ml:-5,children:"Modelo"})}),e.jsx(b,{children:"Tipo de impuesto"}),e.jsx(b,{children:"Periodo"}),e.jsx(b,{children:"Fecha de presentación"}),e.jsx(b,{children:"Presentación"}),e.jsx(b,{align:"right",children:"Resultado"}),e.jsx(b,{children:"Tipo de declaración"}),e.jsx(b,{children:null})]}),e.jsx(L.Body,{children:s.map(n=>e.jsx(zs,{modelo:n},"desc_m"+n.nombre))})]})}),e.jsx(u,{display:{_:"block",desktop:"none"},id:"listado",children:s.map(n=>e.jsx(Gs,{modelo:n},"mbl_m"+n.nombre))})]}):e.jsx(qs,{})]})]})})},Ws=()=>e.jsx(u,{alignCenter:!0,maxWidth:579,m:"auto",mt:"sm",mb:"xl",children:e.jsxs(k,{children:[e.jsx(K,{name:"smile",fontSize:"64px",color:"semantic.text.status.emptyDisabled"}),e.jsxs(u,{children:[e.jsx(S,{color:"semantic.text.general.text2",size5:!0,bold:!0,mb:"xxs",children:"¡Todo controlado! No tienes modelos pendientes."}),e.jsx(S,{small:!0,color:"semantic.text.general.text2",children:"Vuelve a este listado cuando haya nuevos modelos pendientes de presentar."})]}),e.jsx(u,{children:e.jsx(Re,{variant:"secondary",label:"Ver modelos completados",size:"L",onClick:()=>ee.goToModelosPresentados()})})]})}),$s=()=>{const{modelos:t,isLoading:s,refetch:a}=Nt();return{isLoading:s,modelos:t,getListaModelosPorPresentar:async()=>{a()}}},Gt=t=>{const s=()=>t.isInformativo,a=()=>i()||n(),o=()=>t.resultado===0,n=()=>t.resultado&&t.resultado>0,i=()=>t.resultado<0;return{isAPagar:n,isAFavor:i,isInformativo:s,isConResultado:a,isResultado0:o,isTieneCuotaACompensarMayorQueResultado:()=>t.nombre==="303"&&t.tieneCuotaACompensarMayorQueResultado&&t.presentacion.trimestre==="4T",isModelo303ConResultadoNegativoTrimestreEn1T2T3T:()=>t.nombre==="303"&&t.presentacion.trimestre!=="4T"&&i()&&t.resultado!==0}},Jt=t=>{const s=Gt(t);return s.isTieneCuotaACompensarMayorQueResultado()?"CuotaMayorQueResultado":s.isInformativo()?"Informativo":s.isResultado0()?"ModeloResultado0":s.isModelo303ConResultadoNegativoTrimestreEn1T2T3T()?"Modelo303ResultadoNegativoTrimestreEn1T2T3T":(s.isConResultado(),"ConResultado")};var X=(t=>(t.DEVOLVER="DEVOLVER",t.COMPENSAR="COMPENSAR",t))(X||{});const Ks=()=>{const{modelo:t,modal:s,metodoPagoSeleccionado:a,setMetodoPagoSeleccionado:o}=c.useContext(se),n=async()=>t.resultado<0?a===X.COMPENSAR:!!a,i=async()=>
1{d(),s.setLoadingData(!1)},r=async()=>await n(),d=()=>{o(X.COMPENSAR)};return{metodoPagoSeleccionado:a,submit:r,init:i,setCompensar:d,setDevolver:()=>{o(X.DEVOLVER)}}},R={CASH:"CASH",NRC:"NRC",DIRECT:"DIRECT",APLAZAMIENTO:"APLAZAMIENTO",COMPENSAR:"COMPENSAR",DEVOLVER:"DEVOLVER"},Xs=()=>{const{modelo:t,modal:s,metodoPagoSeleccionado:a,setMetodoPagoSeleccionado:o}=c.useContext(se),{userIdentity:n,storeUserIdentity:i,updateAsyncUserIdentity:r}=c.useContext(Ae),[d,l]=c.useState(n.iban??""),[p,h]=c.useState(!0),[v,m]=c.useState(!1),{isAPagar:x}=Gt(t),[C,f]=c.useState(null),[g,P]=c.useState(),[E,Z]=c.useState(),[I,ae]=c.useState(),[Te]=c.useState(),[Ie]=c.useState(),[Oe,De]=c.useState(),[F,te]=c.useState(!1),[oe,D]=c.useState(!1),We=O=>{const q=N.formatStringToDate(O.fechaLimite),ce=N.getNow();return N.diffDays(q,ce)<0},ts=async()=>{ss(n.iban);const{data:O,error:q,message:ce}=await new Pe().getTiposDeclaracion(t);if(q)return y.notifyError(ce);if(!O)return y.notifyError();const{tiposDeclaracion:W}=O,je=W.find(z=>z.codigo===R.CASH),be=W.find(z=>z.codigo===R.NRC),ne=W.find(z=>z.codigo===R.DIRECT),$e=W.find(z=>z.codigo===R.APLAZAMIENTO),Pt=W.find(z=>z.codigo===R.COMPENSAR),St=W.find(z=>z.codigo===R.DEVOLVER);ae($e),De(ne),P(je),Z(be),ne&&We(ne)?(te(!0),O.tipoDeclaracionSeleccionada!==ne.codigo&&(o(O.tipoDeclaracionSeleccionada??""),yt(O.tipoDeclaracionSeleccionada,{nrc:be,cash:je,aplazamiento:$e,compensar:Pt,devolver:St}))):yt(O.tipoDeclaracionSeleccionada,{direct:ne,nrc:be,cash:je,aplazamiento:$e,compensar:Pt,devolver:St}
1),f(O),s.setLoadingData(!1)},yt=(O,{direct:q,nrc:ce,aplazamiento:W,cash:je,compensar:be,devolver:ne})=>{if(O)return o(O);if(q)return o(q.codigo);if(ce)return o(ce.codigo);if(W)return o(W.codigo);if(be)return o(be.codigo);if(ne)return o(ne.codigo);if(je)return o(je.codigo)},ss=O=>{const q=!!Se.isValidIban(O);if(h(q),m(!q),a===R.DIRECT)return q?s.enableAction():s.disableAction();s.enableAction()},as=async()=>{const O=Se.isValidIban(d);if(h(O),!O)return m(!0),!1;await r("iban",d);try{return await i(),!0}catch{return h(!1),y.notifyError("No se ha podido guardar el IBAN"),!1}};return{iban:d,isValidIban:p,hasErrorIban:v,setIban:l,setHasErrorIban:m,submit:async()=>{if(!a)return D(!0),!1;if(D(!1),a===R.DIRECT&&!p&&!await as())return!1;const{error:O,message:q}=await new Pe().updateMetodoPago({year:t.presentacion.year,period:t.presentacion.trimestre,modelNumber:t.nombre,paymentType:a});return O?(y.notifyError(q),!1):!0},cash:g,nrc:E,aplazamiento:I,direct:Oe,compensar:Te,devolver:Ie,isAPagar:x,tipoDeclaracion:C,init:ts,isDisabledDirect:F,errorMetodoPagoVacio:oe,setErrorMetodoPagoVacio:D}},Rt=()=>{const{modal:t}=c.useContext(se);return{init:()=>t.setLoadingData(!1),submit:()=>Promise.resolve(!0)}};class ea extends ct{constructor(s=new Ce){super(),this.repository=s}getCuotasPendientes(s){return this.execute(()=>this.repository.getCuotasPendientesModelo(s))}}const ta=()=>{const{modelo:t,modal:s,metodoPagoSeleccionado:a,setMetodoPagoSeleccionado:o}=c.useContext(se),[n]=c.useState(0),[i,r]=c.useState(null),[d,l]=c.useState(!1),p=async()=>(l(!a),!!a),h=async()=>{m();const{data:C,error:f}=await new ea().getCuotasPendientes(t);if(f)return y.notifyError();C&&(C.tipoDeclaracion&&o(C.tipoDeclaracion),r(C)),s.setLoadingData(!1)},v=async()=>await p(),m=()=>{l(!1),o(X.COMPENSAR)};return{cuotaACompensar:n,cuotaPendite:i,modelo:t,metodoPagoSeleccionado:a,submit:v,init:h,setCompensar:m,setDevolver:()=>{l(!1),o(X.DEVOLVER)},errorMetodoPagoVacio:d}},sa=(t,s,a)=>{const[o,n]=c.useState({}),[i,r]=c.useState(""),[d,l]=c.useState(!1),{userStatus:p}=c.useContext(Ae),h=()=>{r("");const{CERT:x,PIN:C,PER:f}=s;t.periodicidad===rt.ANUAL||!f?n({CERT:x,PIN:C}):t.resultado!==null&&t.resultado<=0?p.digitalSign?n({CERT:x,PIN:C}):(r("PER"),n({PER:f})):a===R.CASH?(r("PER"),n({PER:f})):n({CERT:x,PIN:C})},v=async()=>{const x=m();return V.clickNextStep({event_label:"Conecta con Hacienda"}),x?(window.open(x,"_blank"),!0):!1},m=()=>i?s[i]??"":(l(!0),"");return{submit:v,setSelectedLink:r,setErrorSelectLink:l,params:{selectedLink:i,linkOptions:o,checkLinks:h,errorSelectLink:d}}},ie={GENERAR_TXT:"GENERAR_TXT",PRESENTAR_MODELO:"PRESENTAR_MODELO",SUBIR_JUSTIFICANTE:"SUBIR_JUSTIFICANTE"},aa=()=>{const{modelo:t,modal:s,onSuccess:a,metodoPagoSeleccionado:o,setMetodoPagoSeleccionado:n}=c.useContext(se),[i,r]=c.useState(!1),[d,l]=c.useState(ie.GENERAR_TXT),[p,h]=c.useState({CERT:"",PER:"",PIN:""}),v=Xs(),m=ta(),x=Rt(),C=Ks(),f=Rt(),g=Us(t),P=sa(t,p,o),[E,Z]=c.useState({title:"",description:""});c.useEffect(()=>{l(ie.GENERAR_TXT),n("")},[s.show]);const I=()=>{const F=Jt(t);return{ConResultado:v,ModeloResultado0:f,CuotaMayorQueResultado:m,Modelo303ResultadoNegativoTrimestreEn1T2T3T:C,Informativo:x}[F]},ae=async()=>{s.setBusy(!0);const te=await I().submit();if(V.clickElement({event_label:"Genera fichero txt"}),!te){s.setBusy(!1);return}r(!0)},Te=async()=>{const[{error:F,message:te,body:oe},D]=await Promise.all([new Pe().downloadTxtModelo(t,o),new Pe().getLinksModelo(t)]);if(F){if(t.nombre==="390"){if(oe?.error?.title&&oe?.error?.description){Z({title:oe?.error?.title,description:oe?.error?.description.replaceAll("</b>","").replaceAll("<b>","")}),l("ERROR"),s.setBusy(!1);return}}else y.notifyError(te);s.closeModal()}D.data?h(D.data):y.notifyError(),l(ie.PRESENTAR_MODELO),s.setBusy(!1),r(!1)},Ie=async()=>{if(!await P.submit())return!1;l(ie.SUBIR_JUSTIFICANTE)},Oe=async()=>{if(s.setBusy(!0),!await g.submit())return s.setBusy(!1),!1;a(),s.closeModal()};return{subirJustificanteController:g,presentarEnHaciendaController:P,getCurrentModalAction:()=>{({GENERAR_TXT:ae,PRESENTAR_MODELO:Ie,SUBIR_JUSTIFICANTE:Oe,ERROR:()=>s.closeModal()})[d]()},procesando:i,setProcesando:r,step:d,setStep:l,finalizarProcesando:Te,links:p,error:E,txtModeloConResultadoController:v,txtModeloCuotaMayorQueResultadoController:m,txtModeloInformativoController:x,txtModelo303ResultadoNegativoController:C,txtModeloResultado0Controller:f}}
1,Qt=c.createContext({}),U=()=>{const t=c.useContext(Qt);if(!t)throw Error("useModalPresentarModeloContext must be inside an ModalPresentarModeloContextProvider");return t},oa=({children:t})=>e.jsx(Qt.Provider,{value:aa(),children:t}),na=()=>{const{txtModeloInformativoController:t}=U(),{init:s}=t;return c.useEffect(()=>{s()},[]),e.jsxs(k,{children:[e.jsx(ge,{full:!0,tone:"info",title:"Este modelo es una declaración informativa",message:"No es necesario pagar ningún importe, solo informar a Hacienda."}),e.jsx(me,{label:"Resultado",readOnly:!0,value:"Modelo informativo",infoValue:"No hay que pagar"})]})},ia=()=>{const{modelo:t,modal:s}=qe(),{txtModelo303ResultadoNegativoController:a}=U(),{init:o,setCompensar:n,metodoPagoSeleccionado:i}=a;if(c.useEffect(()=>{o()},[]),s.loadingData)return e.jsx(_e,{text:"Cargando"});const r=t.resultado;return e.jsxs(k,{children:[e.jsx(ke,{label:"Resultado del modelo",tag:{children:r<0?"A favor":"A pagar",variant:r<0?"success":"notification",size:"small"},handleChange:()=>null,readOnly:!0,value:Math.abs(r)}),e.jsxs(Qe,{required:!0,label:"Selecciona tu preferencia",orientation:"vertical",selectors:[],onChange:()=>null,children:[e.jsx(J,{id:"recomendado",selectorId:"optionRecomendado",label:`Añadir ${w(Math.abs(t.resultado))} a mi cuota a compensar`,onChange:()=>{n()},checked:i===X.COMPENSAR,tagOptions:{size:"small",text:"Obligatorio",variant:"info"},helperText:e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,{children:["Añadir el importe del 303 a tu cuota a compensar y guardar para el próximo ejercicio."," ",e.jsx(Ge,{})]})}),variant:"radio"}),e.jsx(J,{disabled:!0,helperText:e.jsxs(e.Fragment,{children:["Recibe en tu cuenta bancaria el importe de tu cuota a compensar más el importe del 303."," ",e.jsx(Ge,{})]}),id:"devolver",selectorId:"optionDevolver",tagOptions:{size:"small",text:"Solo en el 4ºT con resultado a favor",variant:"disabled"},label:"Cobrar en mi cuenta",checked:i===X.DEVOLVER,onChange:()=>null,variant:"radio"})]})]})},Ge=()=>e.jsx(H,{href:"https://ayuda.declarando.es/es/articles/9453526-que-es-la-cuota-de-iva-a-compensar",children:"Saber más"}),ra=()=>{const{metodoPagoSeleccionado:t,setMetodoPagoSeleccionado:s,modal:a,modelo:o}=c.useContext(se),{txtModeloConResultadoController:n}=U(),{userStatus:i}=c.useContext(Ae),{isValidIban:r,cash:d,nrc:l,aplazamiento:p,direct:h,compensar:v,devolver:m,tipoDeclaracion:x,isAPagar:C,iban:f,setIban:g,hasErrorIban:P,setHasErrorIban:E,isDisabledDirect:Z,init:I,errorMetodoPagoVacio:ae,setErrorMetodoPagoVacio:Te}=n;if(c.useEffect(()=>{I()},[]),c.useEffect(()=>{t!==R.DIRECT&&a.enableAction()},[t]),a.loadingData||!x)return e.jsx(_e,{text:"Cargando",height:300});const Ie=f?"El IBAN no es correcto":"Tienes que añadir un IBAN",Oe=D=>{const We=N.formatStringToDate(D);return"Hasta el "+N.formatDateToString(We,"D [de] MMMM").toLowerCase()},De=()=>{const D=Se.isValidIban(f);E(!D),D?a.enableAction():a.disableAction()},F=D=>{s(D),Te(!1)},te=!h?.isActiva||Z,oe=[d,l,h,p,v,m].filter(D=>D&&D.isActiva).length>1;return e.jsxs(k,{children:[i.digitalSign?null:e.jsx(ge,{title:"Necesitas certificado digital para presentar impuestos online",message:e.jsxs(e.Fragment,{children:["Si lo tienes, debes indicarlo en tu perfil. De no hacerlo, te aparecerá el error de identificación 403 que se produce al acceder a un trámite que requiere certificado y el navegador de internet no lo detecta. ",e.jsx("br",{}),e.jsx(S,{small:!0,mt:"xxs",children:e.jsx(H,{underline:!0,href:ee.routes.getProfileAltaAutonomoUri(),children:"Tengo certificado digital"})})]}),full:!0}),e.jsx(ke,{label:"Resultado del modelo",tag:{children:C()?"A pagar":"A favor",variant:C()?"notification":"success",size:"small"},handleChange:()=>null,readOnly:!0,value:Math.abs(o.resultado??0)}),e.jsxs(Qe,{required:!0,label:oe?"Selecciona tu preferencia":"",error:ae,helperText:ae?"Debes seleccionar una opción":"",selectors:[],onChange:()=>null,orientation:"vertical",children:[h?e.jsxs(J,{checked:t===R.DIRECT,disabled:te,id:"direct",selectorId:"optionDirect",label:"Domiciliación bancaria",tagOptions:{text:"Recomendada",variant:Z?"disabled":"info",size:"small"},helperText:e.jsxs(e.Fragment,{children:["Autoriza los pagos en tu cuenta y paga el último día."," ",e.jsx(H,{href:"https://ayuda.declarando.es/es/articles/9113906-metodos-de-pago-de-impuestos#h_f9839da1d8",underline:!0,children:"Saber más"})]}),onChange:()=>{De(),F(R.DIRECT),V.option({option_label:"Domiciliación bancaria"})},variant:"radio",children:[e.jsx(u,{mt:"xs",ml:"lg",children:e.jsx(rs,{type:"icon",iconName:"
1calendar-alt",label:Oe(h.fechaLimite),color:te?"disabled":"default"})}),e.jsx(u,{mt:"xs",ml:"lg",children:t===R.DIRECT?e.jsx(me,{placeholder:"IBAN",infoValue:"IBAN de tu perfil",value:f,readOnly:r,onBlur:()=>De(),error:P,message:P?Ie:"",onChange:D=>{E(!1),g(D.currentTarget.value)},disabled:!l?.isActiva}):null})]}):null,l?e.jsx(J,{id:"nrc",selectorId:"optionNrc","data-testid":"nrc",label:"Código NRC pagando online o en el banco",variant:"radio",helperText:e.jsxs(e.Fragment,{children:["Paga cuando presentes y formaliza el pago en la web de Hacienda identificando tu impuesto con un código NRC."," ",e.jsx(H,{href:"https://ayuda.declarando.es/es/articles/9113906-metodos-de-pago-de-impuestos#h_09bee0d1aa",underline:!0,children:"Saber más"})]}),checked:t===R.NRC,onChange:()=>{a.enableAction(),F(R.NRC),V.option({option_label:"Código NRC"})}}):null,p?e.jsx(J,{variant:"radio",id:"aplazamiento",selectorId:"optionAplazamiento",label:"Aplazamiento del pago",helperText:e.jsxs(e.Fragment,{children:["Amplia el plazo de pago más allá del tiempo establecido."," ",e.jsx(H,{href:"https://ayuda.declarando.es/es/articles/9113906-metodos-de-pago-de-impuestos#h_10c73cd071",underline:!0,children:"Saber más"})]}),checked:t===R.APLAZAMIENTO,onChange:()=>{a.enableAction(),F(R.APLAZAMIENTO),V.option({option_label:"Aplazamiento"})}}):null,v?e.jsx(J,{variant:"radio",helperText:e.jsxs(e.Fragment,{children:["Añadir el importe del 303C a tu cuota a compensar y guardar para el próximo ejercicio."," ",e.jsx(Ge,{})]}),id:"compensar",selectorId:"optionCompensar",label:"Añadir a mi cuota a compensar",checked:t===R.COMPENSAR,onChange:()=>{a.enableAction(),F(R.COMPENSAR),V.option({option_label:"Compensar"})}}):null,m?e.jsx(J,{id:"devolver",selectorId:"optionDevolver",variant:"radio",helperText:e.jsxs(e.Fragment,{children:["Recibe en tu cuenta bancaria el importe de tu cuota a compensar más el importe del 303C."," ",e.jsx(Ge,{})]}),label:"Cobrar en mi cuenta",checked:t===R.DEVOLVER,onChange:()=>{a.enableAction(),F(R.DEVOLVER),V.option({option_label:"Devolver"})}}):null,d?e.jsx(J,{id:"cash",selectorId:"optionCash",label:"A ingresar en efectivo",checked:t===R.CASH,variant:"radio",helperText:e.jsxs(e.Fragment,{children:["Genera un documento para ir a pagar al banco en ventanilla, a través del cajero o desde la banca online."," ",e.jsx(H,{href:"https://ayuda.declarando.es/es/articles/9113906-metodos-de-pago-de-impuestos#h_e2c06d79ec",underline:!0,children:"Saber más"})]}),onChange:()=>{a.enableAction(),F(R.CASH),V.option({option_label:"Efectivo"})}}):null]})]})},la="data:image/svg+xml,%3csvg%20width='80'%20height='80'%20viewBox='0%200%2080%2080'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Icon/File%20&%2338;%20Folder/file-declarando'%3e%3cpath%20id='path'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M40%2040.0004C41.5341%2040.0004%2042.7778%2041.2441%2042.7778%2042.7782C42.7778%2044.3123%2041.5341%2045.556%2040%2045.556H28.8889C27.3548%2045.556%2026.1111%2044.3123%2026.1111%2042.7782C26.1111%2041.2441%2027.3548%2040.0004%2028.8889%2040.0004H40ZM23.3333%2062.2227H40C41.5341%2062.2227%2042.7778%2063.4663%2042.7778%2065.0004C42.7778%2066.5346%2041.5341%2067.7782%2040%2067.7782H23.3333C18.731%2067.7782%2015%2064.0472%2015%2059.4449V20.556C15%2015.9536%2018.731%2012.2227%2023.3333%2012.2227H40.1667C40.4803%2012.2646%2040.7824%2012.3685%2041.0556%2012.5282H41.3056C41.5912%2012.6618%2041.8537%2012.8399%2042.0833%2013.056L58.75%2029.7227C58.9725%2029.9471%2059.1515%2030.2108%2059.2778%2030.5004V30.7504C59.3625%2030.993%2059.4185%2031.2448%2059.4444%2031.5004V31.6671V37.2227C59.4444%2038.7568%2058.2008%2040.0004%2056.6667%2040.0004C55.1325%2040.0004%2053.8889%2038.7568%2053.8889%2037.2227V34.4449H45.5556C40.9532%2034.4449%2037.2222%2030.7139%2037.2222%2026.1115V17.7782H23.3333C21.7992%2017.7782%2020.5556%2019.0219%2020.5556%2020.556V59.4449C20.5556%2060.979%2021.7992%2062.2227%2023.3333%2062.2227ZM49.9722%2028.8893L42.7778%2021.6949V26.1115C42.7778%2027.6457%2044.0214%2028.8893%2045.5556%2028.8893H49.9722ZM31.6667%2034.4449H28.8889C27.3548%2034.4449%2026.1111%2033.2012%2026.1111%2031.6671C26.1111%2030.133%2027.3548%2028.8893%2028.8889%2028.8893H31.6667C33.2008%2028.8893%2034.4444%2030.133%2034.4444%2031.6671C34.4444%2033.2012%2033.2008%2034.4449%2031.6667%2034.4449ZM26.1111%2053.8893C26.1111%2052.3552%2027.3548%2051.1115%2028.8889%2051.1115H40C41.5341%2051.1115%2042.7778%2052.3552%2042.7778%2053.8893C42.7778%2055.4234%2041.5341%2056.6671%2040%2056.6671H28.8889C27.3548%2056.6671%2026.1111%2055.4234%2026.1111%2053.8893ZM65.0525%2067.6612L47.8507%2052.1886L47.85%2045.521L65.0814%2060.7835L65.0525%2067.6612ZM51.534%2067.7
1785C53.5687%2067.7785%2055.2181%2066.1291%2055.2181%2064.0944C55.2181%2062.0597%2053.5687%2060.4103%2051.534%2060.4103C49.4994%2060.4103%2047.8499%2062.0597%2047.8499%2064.0944C47.8499%2066.1291%2049.4994%2067.7785%2051.534%2067.7785ZM65.1555%2049.2241C65.1555%2051.2587%2063.5061%2052.9081%2061.4715%2052.9081C59.4368%2052.9081%2057.7874%2051.2587%2057.7874%2049.2241C57.7874%2047.1894%2059.4368%2045.54%2061.4715%2045.54C63.5061%2045.54%2065.1555%2047.1894%2065.1555%2049.2241Z'%20fill='%23007AFF'/%3e%3c/g%3e%3c/svg%3e",ca=()=>{const{finalizarProcesando:t}=U();return e.jsxs(u,{bg:Q.colors.semanticBackground.Info,borderRadius:"md",py:"lg",px:"sm",children:[e.jsx(u,{alignCenter:!0,children:e.jsx("img",{src:la,alt:"icono"})}),e.jsxs(u,{children:[e.jsxs(A,{opacity:0,style:{animation:"fadeEffect 2s 1 forwards",animationDelay:"0s"},width:"max-content",m:"auto",gridTemplateColumns:"max-content 300px",alignItems:"center",children:[e.jsx(K,{name:"check",color:Q.colors.semanticContent.Info}),e.jsx(pe,{textColor:"body1",children:"Lectura de la contabilidad registrada por el usuario"})]}),e.jsxs(A,{opacity:0,style:{animation:"fadeEffect 2s 1 forwards",animationDelay:"0.9s"},width:"max-content",m:"auto",gridTemplateColumns:"max-content 300px",alignItems:"center",children:[e.jsx(K,{name:"check",color:Q.colors.semanticContent.Info}),e.jsx(pe,{textColor:"body1",children:"Comprobación y validación de los registros"})]}),e.jsxs(A,{opacity:0,style:{animation:"fadeEffect 2s 1 forwards",animationDelay:"1.8s"},width:"max-content",m:"auto",gridTemplateColumns:"max-content 300px",alignItems:"center",children:[e.jsx(K,{name:"check",color:Q.colors.semanticContent.Info}),e.jsx(pe,{textColor:"body1",children:"Compilación de datos para la generación del .txt"})]}),e.jsxs(A,{onAnimationEnd:t,opacity:0,style:{animation:"fadeEffect 2s 1 forwards",animationDelay:"2.7s"},width:"max-content",m:"auto",gridTemplateColumns:"max-content 300px",alignItems:"center",children:[e.jsx(K,{name:"check",color:Q.colors.semanticContent.Info}),e.jsx(pe,{textColor:"body1",children:"Guardado y descarga del archivo final"})]})]})]})},da=()=>{const{txtModeloCuotaMayorQueResultadoController:t}=U(),{init:s,setCompensar:a,setDevolver:o,metodoPagoSeleccionado:n,cuotaPendite:i,errorMetodoPagoVacio:r}=t;if(c.useEffect(()=>{s()},[]),!i)return e.jsx(_e,{text:"Cargando"});const{resultadoModelo:d,tipoResultado:l,cuotaACompensar:p,opcionCompensar:h,opcionDevolver:v}=ua(i),m=()=>{a(),V.option({option_label:h[l].event})};return e.jsxs(k,{children:[e.jsxs(A,{gridTemplateColumns:{_:"1fr",tablet:"1fr 1fr"},gridGap:"sm",children:[e.jsx(ke,{label:"Resultado del modelo",tag:l==="negativo"?{children:"A favor",variant:"success",size:"small"}:l==="positivo"?{children:"A pagar",variant:"notification",size:"small"}:void 0,handleChange:()=>null,readOnly:!0,value:d}),e.jsx(ke,{readOnly:!0,label:"Tu cuota a compensar",handleChange:()=>null,value:p,tag:{children:"Acumulados",variant:"info",size:"small"}})]}),e.jsxs(Qe,{required:!0,orientation:"vertical",label:"Selecciona tu preferencia",error:r,message:r?"Debes seleccionar una opción":"",selectors:[],onChange:()=>null,children:[e.jsx(J,{id:"compensar",selectorId:"optionCompensar",label:h[l].title,checked:n===X.COMPENSAR,tagOptions:{size:"small",text:"Recomendada",variant:"info"},helperText:e.jsxs(e.Fragment,{children:[h[l].description," ",e.jsx(Et,{})]}),onChange:m,variant:"radio"}),e.jsx(J,{id:"recomendado",selectorId:"optionRecomendado",label:v[l].title,checked:n===X.DEVOLVER,helperText:e.jsxs(e.Fragment,{children:[v[l].description," ",e.jsx(Et,{})]}),onChange:o,variant:"radio"})]})]})},Et=()=>e.jsx(H,{href:"https://ayuda.declarando.es/es/articles/3921016-que-hacer-si-tu-modelo-303-del-4t-es-negativo",children:"Saber más"}),ua=t=>{const{compensar:s,devolver:a}=t,o=(s.resultadoParcial??0)>0?"positivo":(s.resultadoParcial??0)<0?"negativo":"neutro",n={negativo:{title:`Añadir ${w(Math.abs(s.resultadoParcial))} a mi cuota a compensar`,description:"Añade el importe a tu cuota a compensar y guárdala para el próximo ejercicio.",event:"Restar cuota a compensar"},positivo:{title:`Restar ${w(Math.abs(s.resultadoParcial))}
1 a mi cuota a compensar`,description:"Resta el importe a tu cuota a compensar y guárdala para el próximo ejercicio.",event:"Añadir cuota a compensar"},neutro:{title:"Mantener mi cuota a compensar",description:"Guarda tu cuota a compensar para el próximo ejercicio.",event:"Mantener cuota a compensar"}},i={negativo:{title:`Cobrar ${w(a.resultado)} en mi cuenta bancaria`,description:"Retirar el importe total de tu cuota a compensar más el resultado del 303."},positivo:{title:`Cobrar ${w(a.resultado)} en mi cuenta bancaria`,description:"Retirar el importe total de tu cuota a compensar más el resultado del 303."},neutro:{title:`Cobrar ${w(a.resultado)} en mi cuenta bancaria`,description:"Retira el importe total de tu cuota a compensar."}},r=Math.abs(s.resultadoParcial),d=s.cuotaAnterioresTrimestres??0;return{tipoResultado:o,opcionCompensar:n,opcionDevolver:i,resultadoModelo:r,cuotaACompensar:d}},pa=()=>{const{txtModeloResultado0Controller:t}=U(),{init:s}=t;return c.useEffect(()=>{s()},[]),e.jsxs(k,{children:[e.jsx(ge,{full:!0,tone:"info",title:"El resultado del modelo es 0,00€",message:"No es necesario pagar ningún importe, solo informar a Hacienda."}),e.jsx(ke,{readOnly:!0,label:"Resultado",handleChange:()=>null,value:"0,00",tag:{children:"No hay que pagar",size:"small",variant:"info"}})]})},ha=()=>{const{modelo:t}=qe(),{procesando:s}=U();if(s)return e.jsx(ca,{});const a=Jt(t);return{ConResultado:e.jsx(ra,{}),ModeloResultado0:e.jsx(pa,{}),CuotaMayorQueResultado:e.jsx(da,{}),Modelo303ResultadoNegativoTrimestreEn1T2T3T:e.jsx(ia,{}),Informativo:e.jsx(na,{})}[a]},ma="data:image/svg+xml,%3csvg%20width='80'%20height='80'%20viewBox='0%200%2080%2080'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M62.2218%2031.5004C62.1929%2031.2453%2062.137%2030.9939%2062.0551%2030.7504V30.5004C61.9216%2030.2148%2061.7434%2029.9523%2061.5273%2029.7227L44.8607%2013.056C44.6311%2012.8399%2044.3685%2012.6618%2044.0829%2012.5282C44%2012.5164%2043.9158%2012.5164%2043.8329%2012.5282C43.5507%2012.3664%2043.2391%2012.2625%2042.9162%2012.2227H26.1107C21.5083%2012.2227%2017.7773%2015.9536%2017.7773%2020.556V59.4449C17.7773%2064.0473%2021.5083%2067.7782%2026.1107%2067.7782H53.8885C58.4908%2067.7782%2062.2218%2064.0473%2062.2218%2059.4449V31.6671C62.2218%2031.6671%2062.2218%2031.6671%2062.2218%2031.5004ZM45.5551%2021.6949L52.7496%2028.8893H48.3329C46.7988%2028.8893%2045.5551%2027.6457%2045.5551%2026.1115V21.6949ZM56.6662%2059.4449C56.6662%2060.979%2055.4226%2062.2227%2053.8885%2062.2227H26.1107C24.5766%2062.2227%2023.3329%2060.979%2023.3329%2059.4449V20.556C23.3329%2019.0219%2024.5766%2017.7782%2026.1107%2017.7782H39.9996V26.1115C39.9996%2030.7139%2043.7305%2034.4449%2048.3329%2034.4449H56.6662V59.4449ZM46.3607%2040.806L37.2218%2049.9727L33.6385%2046.3615C32.5492%2045.2723%2030.7832%2045.2723%2029.694%2046.3615C28.6048%2047.4508%2028.6048%2049.2168%2029.694%2050.306L35.2496%2055.8615C35.7711%2056.3874%2036.4811%2056.6832%2037.2218%2056.6832C37.9624%2056.6832%2038.6724%2056.3874%2039.194%2055.8615L50.3051%2044.7504C51.3943%2043.6612%2051.3943%2041.8952%2050.3051%2040.806C49.2159%2039.7168%2047.4499%2039.7168%2046.3607%2040.806Z'%20fill='%2330C79A'/%3e%3c/svg%3e",xa=()=>{const{presentarEnHaciendaController:t}=U(),{setSelectedLink:s,setErrorSelectLink:a,params:{linkOptions:o,selectedLink:n,errorSelectLink:i}}=t;c.useEffect(()=>{t.params.checkLinks()},[]);const r={PIN:"Con Cl@ve PIN",CERT:"Con certificado digital",PER:""};return e.jsxs(k,{children:[e.jsxs(u,{bg:Q.colors.semanticBackground.Success,alignCenter:!0,borderRadius:"lg",py:"lg",px:"sm",children:[e.jsx("img",{src:ma,alt:"icono"}),e.jsx(S,{bold:!0,textColor:"body1",children:"El archivo txt se ha descargado correctamente"}),e.jsx(u,{maxWidth:424,m:"auto",children:e.jsx(pe,{textColor:"body1",children:"Localiza el archivo .txt en tu carpeta de descargas y preséntalo en la página web de la Agencia Tributaria"})})]}),Object.keys(o).length>1?e.jsx(e.Fragment,{children:e.jsx(Qe,{error:i,message:i?"Debes seleccionar una opcion":"",label:"¿Cómo quieres conectarte con Hacienda?",required:!0,selectors:[],onChange:()=>null,children:Object.keys(o).map(d=>{const l=d;return e.jsx(J,{fullWidth:!0,variant:"radio",id:l,selectorId:`option-${l}`,label:r[l],checked:l===n,onChange:()=>{if(a(!1),s(l),r[l]){const p=l==="CERT"?"Conecta con certificado digital":"Conecta con CL@ve PIN";V.option({option_label:p})}}},l)})})}):null]})},fa=()=>{const{modal:t}=qe(),{subirJustificanteController:{params:{selectedFile:s,uploadLater:a,setUploadLater:o,onChangeFile:n,setSelectedFile:i}}}=U();return c.useEffect(()=>{i(null),o(!1)},[]),e.jsxs(k,{children:[e.jsx(kt,{disabled:a,uploading:!!t.busy,actionLabel:"Arrastra o selecciona el justificante",dropLabel:"Borrar justificante",filecopy:"PDF con un tamaño máximo de 5MB",loaderLabel:"Subiendo PDF...",onChangeFile:n,previewLabel:"Ver justificante",formats:["pdf"],maxMb:5}),e.jsx(ls,{disabled:!!s,checked:a,label:"Subiré el justificante más tarde",onChange:()=>{const r=!a;r&&V.fillField({event_label:"Marca subir justificante más tarde"}),o(r)}})]})},ga=()=>{const{error:t}=U();return e.jsx(k,{children:e.jsx(ge,{full:!0,tone:"error",title:t.title,message:t.description})})}
1,Ca={[ie.GENERAR_TXT]:{pcStatus:25,label:"Generar archivo txt",icon:"",view:e.jsx(ha,{})},[ie.PRESENTAR_MODELO]:{pcStatus:50,label:"Presentar en la Agencia Tributaria",icon:"external-link-alt",view:e.jsx(xa,{})},[ie.SUBIR_JUSTIFICANTE]:{pcStatus:100,label:"Marcar como presentado",icon:"check",view:e.jsx(fa,{})},ERROR:{pcStatus:25,label:"Salir",icon:"",view:e.jsx(ga,{})}},ja=()=>{const{modelo:t}=qe(),{getCurrentModalAction:s,step:a,procesando:o}=U(),i="Presentar modelo "+t?.nombre;return{modalCurrentStep:Ca[a],title:i,getCurrentModalAction:s,procesando:o,modelo:t}},ba=()=>{const{modal:t,modelo:s}=qe(),{setStep:a,setProcesando:o}=U(),{modalCurrentStep:n,title:i,getCurrentModalAction:r}=ja();return e.jsx(cs,{variant:"small",id:"ModalPresentarModelo",title:i,isOpen:t.show,disabledAction:t.isDisabled,handleCancel:()=>{a(ie.GENERAR_TXT),o(!1),t.closeModal()},handleAction:()=>{r()},busy:t.busy,labelAction:n.label,iconActionLabel:n.icon,stepper:{error:!1,pcStatus:n.pcStatus,stepList:[{pc:25,name:"Generar archivo txt"},{pc:50,name:"Presentar modelo"},{pc:100,name:"Subir justificante"}]},children:t.show?e.jsx(e.Fragment,{children:s?n.view:e.jsx(_e,{text:"Cargando",height:300})}):null})},Yt=({children:t})=>e.jsx(j,{width:140,children:e.jsx(u,{width:130,children:t})}),Zt=({children:t})=>e.jsx(j,{width:190,children:e.jsx(u,{width:140,children:t})}),Wt=({children:t})=>e.jsx(j,{width:120,children:e.jsx(u,{children:t})}),$t=({children:t})=>e.jsx(j,{width:220,children:e.jsx(u,{width:115,children:t})}),et=({children:t})=>e.jsx(j,{width:150,children:e.jsx(u,{children:t})}),tt=({children:t})=>e.jsx(j,{width:200,children:e.jsxs(A,{justifyItems:"end",className:"ctlink",gridTemplateColumns:"1fr 120px",children:[e.jsx("p",{}),t]})}),st=({children:t})=>e.jsx(j,{width:324,children:e.jsx($,{justifyContent:"end",alignItems:"center",pr:"12px",children:e.jsx(u,{display:"inline-grid",width:220,children:t})})}),va=({modelo:t})=>{const s=He(t),a=Ye[t.nombre];return e.jsxs(L.Row,{status:t.isProximoPeriodo?"blocked":"disabled","data-tippy-content":"El modelo se podrá presentar a partir de la fecha de inicio",children:[e.jsx(Yt,{children:e.jsx(_,{color:t.isProximoPeriodo?"body1":"body3",className:"cell",boldText:!0,text:e.jsxs(A,{as:"span",gridTemplateColumns:"max-content max-content",alignItems:"center",pl:"sm",ml:-5,children:[e.jsxs("span",{children:["Modelo ",t.nombre," "]}),a?e.jsx(he,{size:"S",isIconOnly:!0,variant:"main",icon:"question-circle",onClick:()=>{re.showArticle(a.id)}}):null]})})}),e.jsx(Zt,{children:e.jsx(le,{categoria:t.categoria,isDisabled:!t.isProximoPeriodo})}),e.jsx(Wt,{children:e.jsx(fe,{color:t.isProximoPeriodo?"body1":"body3",periocidad:t.periodicidad,presentacion:t.presentacion})}),e.jsx($t,{children:e.jsx(xe,{modelo:t,fechas:s})}),t.isProximoPeriodo?e.jsxs(e.Fragment,{children:[e.jsx(et,{children:e.jsx(G,{label:"Próximo periodo",value:"neutral",type:"status"})}),e.jsx(tt,{children:e.jsx(Ee,{modelo:t})}),e.jsx(st,{children:e.jsx(u,{width:170})})]}):e.jsxs(e.Fragment,{children:[e.jsx(et,{children:null}),e.jsx(tt,{children:null}),e.jsx(st,{children:null})]})]})},Ma=({modelo:t})=>{const s=He(t),a=Ye[t.nombre],o=Q.colors.semantic.background.secondaryStatusLight;return e.jsx(e.Fragment,{children:e.jsxs(k,{px:"sm",py:"xs",style:{borderBottom:"1px solid #DDDDE0",background:t.isProximoPeriodo?o.disabled:o.hover},children:[e.jsx($,{justifyContent:"space-between",children:e.jsx(_,{color:t.isProximoPeriodo?"body1":"body3",boldText:!0,text:e.jsxs(A,{as:"span",gridTemplateColumns:"max-content max-content",alignItems:"center",children:[e.jsxs("span",{children:["Modelo ",t.nombre]}),a?e.jsx(he,{size:"M",isIconOnly:!0,variant:"main",icon:"question-circle",onClick:()=>{re.showArticle(a.id)}}):null]})})}),e.jsxs(A,{alignItems:"center",gridGap:"sm",gridTemplateColumns:"max-content max-content max-content",children:[e.jsx(le,{categoria:t.categoria,isDisabled:!t.isProximoPeriodo}),e.jsx(fe,{isBlocked:!0,periocidad:t.periodicidad,presentacion:t.presentacion,shortText:!0}),e.jsx(xe,{modelo:t,fechas:s,estado:t.estado})]}),t.isProximoPeriodo?e.jsx($,{justifyContent:"space-between",children:e.jsx(Ee,{modelo:t})}):null]})})},ya=()=>e.jsx(u,{alignCenter:!0,maxWidth:579,m:"auto",mt:"sm",mb:"xl",children:e.jsxs(k,{children:[e.jsx(K,{name:"sunset",fontSize:"64px",color:Q.colors.semantic.text.status.emptyDisabled}),e.jsxs(u,{children:[e.jsx(S,{color:"semantic.text.general.text2",size5:!0,bold:!0,mb:"xxs",children:"¡Todo despejado! No hay nada en tu horizonte fiscal."}),e.jsx(S,{small:!0,color:"semantic.text.general.text2",children:"Disfruta de la tranquilidad, no hay modelos programados para un futuro cercano."})]})]})}),Pa=()=>{const{data:t,refetch:s,isLoading:a,isFetching:o}=it({queryKey:["getModelosProximos"],fetchFn:()=>new Pe().getModelosProximos(),config:{staleTime:3e4,refetchOnWindowFocus:!1,select:n=>n?.data?.resources}});return{modelos:t??[],totalModelosProximos:(t??[]).filter(n=>n.estado!=="BLOQUEADO").length,isLoading:a||o,refetch:s}},Sa=()=>{const{modelos:t,isLoading:s,refetch:a}=Pa();return{isLoading:s,modelos:t,getListaModelosPorPresentar:async()=>{a()}}},Aa=()=>{const t=Sa();return c.useEffect(()=>{setTimeout(()=>{ds("[data-tippy-content]",{trigger:"mouseenter",arrow:!1,theme:"primary",followCursor:"initial"})},5e3)},[]),t.isLoading?e.jsx(bt,{}):e.jsx(u,{borderBottomLeftRadius:"md",borderBottomRightRadius:"md",bg:"white",px:0,pb:"xxl",pt:"xs",children:e.jsxs(Me,{isExpandedDefault:!0,children:[e.jsx(Me.Button,{className:"list-proximos","data-intercom-target":"list-proximos",children:"Próximos modelos"}),e.jsx(Me.Panel,{maxHeight:"none",children:e.jsx(u,{my:{_:"0",desktop:"-24px"},ml:-32,mr:{_:-7,desktop:-7},overflow:"scroll",children:t.modelos.length>0?e.jsxs(e.Fragment,{children:[e.jsx(u,{display:{_:"none",desktop:"block"},children:e.jsxs(L,{type:"simple-table",children:[e.jsxs(L.Head,{children:[e.jsx(b,{children:e.jsx(u,{pl:"sm",ml:-5,children:"Modelo"})}),e.jsx(b,{children:"Tipo de impuesto"}),e.jsx(b,{children:"Periodo"}),e.jsx(b,{children:"Fecha de presentación"}),e.jsx(b,{children:"Estado"}),e.jsx(b,{align:"right",children:e.jsxs(A,{alignItems:"center",gridTemplateColumns:"max-content auto",gridGap:"xxs",children:["Resultado provisional"," ",e.jsx(u,{style:{textAlign:"left"},children:e.jsx(us,{content:"El resultado es provisional y cambiará a medida que añadas ingresos y gastos."})})]})}),e.jsx(b,{children:null})]}),e.jsx(L.Body,{children:t.modelos.map(s=>e.jsx(va,{modelo:s},"desc_m"+s.nombre))})]})}),e.jsx(u,{display:{_:"block",desktop:"none"},id:"listado",children:t.modelos.map(s=>e.jsx(Ma,{modelo:s},"mov_m"+s.nombre))})]}):e.jsx(ya,{})})})]})})},M=class M{static getOptionsListFromKeys(s){return s.map(a=>this.getOptionOfKey(a))}static getOptionOfKey(s){return{value:s,label:this.getLabelOf(s)}}static getLabelOf(s){return this.data[s]}static getLabeFromPaymentType(s){return this.data[s]}};M.DOMICILIACION="DIRECT",M.EFECTIVO="CASH",M.NRC="NRC",M.COMPENSAR="COMPENSAR",M.DEVOLVER="DEVOLVER",M.APLAZAMIENTO="APLAZAMIENTO",M.DOMICILIACION_LABEL="Domiciliación",M.EFECTIVO_LABEL="Efectivo",M.NRC_LABEL="NRC",M.COMPENSAR_LABEL="Compensar",M.DEVOLVER_LABEL="Devolver",M.APLAZAMIENTO_LABEL="Aplazamiento",M.data={[M.DOMICILIACION]:M.DOMICILIACION_LABEL,[M.EFECTIVO]:M.EFECTIVO_LABEL,[M.NRC]:M.NRC_LABEL,[M.COMPENSAR]:M.COMPENSAR_LABEL,[M.DEVOLVER]:M.DEVOLVER_LABEL,[M.APLAZAMIENTO]:M.APLAZAMIENTO_LABEL};let at=M;const ve={M180:"180",M190:"190",M303C:"303C",M347:"347",M349:"349",M390:"390"};class Kt extends c.Component{constructor(s){super(s),this.handleSubmit=()=>{this.isValidated()&&this.props.handleClick()},this.getTowns=a=>this.locationsRepository.getTowns(a),this.getProvinces=()=>this.locationsRepository.getProvinces(!0),this.addressRef=null,this.providerAddressRef=null,this.providerRef=null,this.locationRepository=Ue.instance.getImpuestosRepository(),this.locationsRepository=new dt,this.expensesLocationRepository=Ue.instance.getExpensesLocations(),this.state={errorProvider:"",errorCP:"",disabled:!1,busy:!1}}
1isValidated(){const s=this._validateData(),a=this._validationErrors(s);this.setState({errorProvider:a.provider,errorCp:a.cp,errorRefCat:a.refCat});const o=this.addressRef.isValidated(),n=this.providerAddressRef.isValidated();return s.provider&&s.cp&&s.refCat&&o&&n}_validateData(){const s=this.props.provider.id,a=this.props.provider.cpostal,o=this.props.rentedProperty.referenciaCatastral;return{provider:s&&s.length>0,cp:a&&Se.isValidPostalCode(a),refCat:o&&Se.isValidRefCatastral(o)}}_validationErrors(s){return{provider:s.provider?"":e.jsx(e.Fragment,{children:"Debes elegir un proveedor"}),cp:s.cp?"":e.jsx(e.Fragment,{children:"Debes introducir un código postal válido"}),refCat:s.refCat?"":e.jsx(e.Fragment,{children:"Debes introducir una referencia catastral válida"})}}hasProvider(){return e.jsx(Y,{disabledAction:this.state.disabled,busy:this.state.busy,id:"Modal180Data",handleClose:this.props.handleClose,handleCancel:this.props.handleClose,isOpen:this.props.isOpen,title:e.jsx(e.Fragment,{children:"Revisa que los datos sean correctos"}),labelAction:e.jsx(e.Fragment,{children:"Guardar"}),handleAction:this.handleSubmit,labelCancel:e.jsx(e.Fragment,{children:"Cancelar"}),children:e.jsxs(u,{children:[e.jsx(A,{gridTemplateColumns:"1fr 1fr",mb:"15px",gridColumnGap:"30px",children:e.jsx(u,{children:e.jsx(ps,{required:!0,label:"Proveedor",name:"type",id:"select-provider",value:this.props.provider.id,options:this.props.selectProviderList,clearable:!1,placeholder:e.jsx(e.Fragment,{children:"Filtrar aquí..."}),onChange:s=>{this.props.updateProvider("id",s,this.props.presentationYear)},error:this.state.errorProvider,message:this.state.errorProvider})})}),e.jsx(ut,{required:!0,formName:"ProviderAddress",labelErrorTown:gt,labelErrorProvince:ft,labelErrorCP:xt,labelProvince:mt,labelTown:ht,labelPostalCode:pt,getProvinces:this.getProvinces,getTowns:this.getTowns,cp:this.props.provider.cpostal,province:this.props.provider.provincia_id,town:this.props.provider.poblacion_id,handleProvinciaChange:(s,a)=>this.props.updateProvider("provincia_id",s,a),handlePoblacionChange:s=>{this.props.updateProvider("poblacion_id",s)},handleCpChange:(s,a)=>{this.props.updateProvider("cpostal",s,a)},ref:s=>{s&&(this.providerAddressRef=s)}}),e.jsxs(u,{my:"15px",children:[e.jsx(Ft,{required:!0,label:"Referencia Catastral",value:this.props.rentedProperty.referenciaCatastral,onChange:s=>this.props.updateInmueble("referenciaCatastral",s),error:this.state.errorRefCat,message:this.state.errorRefCat}),e.jsx(H,{target:"new",href:"https://www1.sedecatastro.gob.es/Cartografia/mapa.aspx?buscar=S",children:"¿Cómo encontrar la referencia catastral?"})]}),e.jsx(hs,{formName:"AddressRented",address:this.props.rentedProperty,updateField:this.props.updateInmueble,ref:s=>{s&&(this.addressRef=s)},...this.props})]})})}notHasProvider(){return e.jsx(Ra,{handleClose:this.props.handleClose,isOpen:this.props.isOpen})}render(){return this.props.selectProviderList&&this.props.selectProviderList.length>0?this.hasProvider():this.notHasProvider()}}const Ra=({isOpen:t,handleClose:s})=>{const{push:a}=Ct();return e.jsx(Y,{id:"Modal180Data",handleClose:s,handleCancel:s,isOpen:t,title:e.jsx(e.Fragment,{children:"Para presentar el modelo 180 necesitamos saber cual de tus proveedores es el que te provee el alquiler."}),labelAction:e.jsx(e.Fragment,{children:"Ir a gastos"}),handleAction:()=>a(ee.routes.getExpensesUri()),labelCancel:e.jsx(e.Fragment,{children:"Cancelar"}),children:e.jsx(u,{children:e.jsxs(e.Fragment,{children:[e.jsxs(S,{small:!0,children:["Para ello, puedes"," ",e.jsx(H,{target:"_self",underline:!0,onClick:()=>a(ee.routes.getExpensesUri()),children:"ir a la sección de gastos"})," ","y añadir un nuevo proveedor."]}),e.jsx(S,{small:!0,children:"Si ya tienes tu proveedor creado o lo acabas de crear, tendrás que ingresar un gasto de tipo alquiler con IRPF al 19% y asociarlo a ese proveedor."})]})})})},Ea="Normal",Ta="Alquiler",Ia="Inversión",Oa="Europea",Da="No Europea",wa="Recargo Equivalencia",La="Español",Na="Europeo",ka="No Europeo";class T{static NORMAL="0";static ALQUILER="1";static INVERSION="2";static EURO="3";static NOEURO="4";static RECARGO="5";data=[];constructor(s){s=[{id:T.NORMAL,name:Ea},{id:T.ALQUILER,name:Ta},{id:T.INVERSION,name:Ia},{id:T.EURO,name:Oa},{id:T.NOEURO,name:Da},{id:T.RECARGO,name:wa}],this.data=s}getOptions(){let s=[];for(let a=0;a<this.data.length;a++)s[a]={value:this.data[a].id,label:this.data[a].name};return s}getOptionsWithoutRecargo(){return this.getOptions().filter(s=>s.value!==T.RECARGO)}getSpanishOptionsWithoutRecargo(){return this.getOptions().filter(s=>s.value!==T.RECARGO&&s.value!==T.EURO&&s.value!==T.NOEURO)}getSpanishOptions(){return this.getOptions().filter(s=>s.value!==T.EURO&&s.value!==T.NOEURO)}getIdOfOption(s){let a=null;for(let o=0;o<this.data.length;o++)this.data[o].name===s&&(a=o);return a!=null?this.data[a].name:null}getOptionOfId(s){let a=null;for(let o=0;o<this.data.length;o++)this.data[o].id===s&&(a=o);return a!=null?{value:this.data[a].id,label:this.data[a].name}:null}getLabelOfId(s){let a=null;for(let o=0;o<this.data.length;o++)this.data[o].id===s&&(a=o);return a!=null?this.data[a].name:null}getLabelOfIdOfNewTipado(s){for(let a=0;a<this.data.length;a++)if(this.data[a].id===s){if(s===T.NORMAL||s===T.ALQUILER||s===T.INVERSION||s===T.RECARGO)return La;if(s===T.EURO)return Na;if(s===T.NOEURO)return ka}}}function Fa(t){const s=c.useRef({}),a=new dt,[o,n]=c.useState({}),i=m=>
1{const x=String(m.cif||""),C=String(m.name||""),f=x.trim().length>0&&(ye.isValidSpanishId(x)||ye.isValidEuroCIF(x)||ye.isProviderMaestro(x)||m.tipo===T.NOEURO),g=C.trim().length>0;return{cif:f,name:g}},r=()=>{const m={};return t.providers.forEach((x,C)=>{m[C]=i(x)}),m},d=m=>{const x={};return Object.keys(m).forEach(C=>{const f=m[C];x[C]={cif:f.cif?"":"Debes introducir un CIF/NIF válido",name:f.name?"":"El nombre es obligatorio"}}),x},l=()=>{const m=r(),x=d(m);n(x);let C=!0;return Object.values(s.current).forEach(g=>{g&&typeof g.isValidated=="function"&&(g.isValidated()||(C=!1))}),Object.values(m).every(g=>g.cif&&g.name)&&C},p=()=>{l()&&t.handleClick()},h=m=>a.getTowns(m),v=()=>a.getProvinces(!0);return e.jsx(jt,{id:"Modal190Data",isOpen:t.isOpen,title:"Revisa que los datos sean correctos",actionLabel:"Guardar",onClose:t.handleClose,onAction:p,children:t.providers.map((m,x)=>e.jsxs(e.Fragment,{children:[e.jsx(Va,{index:x,operator:m,errors:o[x]||{},getTowns:h,getProvinces:v,handleUpdate:t.updateProvider,onRefUpdate:C=>{s.current[x]=C}},x),x<t.providers.length-1?e.jsx(u,{my:"md",children:e.jsx(Xe,{})}):null]}))})}function Va({operator:t,index:s,errors:a,getTowns:o,getProvinces:n,handleUpdate:i,onRefUpdate:r}){const d=t.name&&t.name.trim().length>0,l=p=>{d||i("name",s,p)};return e.jsxs(e.Fragment,{children:[e.jsxs(u,{display:"flex",gap:"md",mb:"md",justifyContent:"space-between",flexWrap:"wrap",children:[e.jsx(u,{flex:"1 auto",children:e.jsx(me,{label:"Nombre","aria-label":"Nombre",required:!0,disabled:d,error:!!a.name,helperText:a.name,value:t.name,onChange:p=>l(p.target.value)})}),e.jsx(u,{flex:"1 auto",children:e.jsx(me,{label:"CIF","aria-label":"CIF",error:!!a.cif,helperText:a.cif,value:t.cif,onChange:p=>i("cif",s,p.target.value),required:!0})})]}),e.jsx(ut,{required:!0,formName:`ProviderAddress-${s}`,labelErrorTown:gt,labelErrorProvince:ft,labelErrorCP:xt,labelProvince:mt,labelTown:ht,labelPostalCode:pt,getProvinces:n,getTowns:o,cp:t.cpostal,province:t.provincia_id,town:t.poblacion_id,handleProvinciaChange:p=>i("provincia_id",s,p),handlePoblacionChange:p=>{i("poblacion_id",s,p)},handleCpChange:(p,h)=>{i("cpostal",s,p,h)},ref:p=>{p&&r&&r(p)}})]})}function Tt(t){const s=String(t.cif||""),a=String(t.name||""),o=s.trim().length>0&&(ye.isValidSpanishId(s)||ye.isValidEuroCIF(s)||ye.isProviderMaestro(s)),n=a.trim().length>0;return{cif:o,name:n}}function _a(t){const[s,a]=c.useState({}),[o,n]=c.useState({}),i=c.useRef({}),r=c.useRef({}),d=new dt,l=f=>d.getTowns(f),p=()=>d.getProvinces(!0),h=()=>{const f={};return t.providers.forEach((g,P)=>{f[P]=Tt(g)}),f},v=()=>{const f={};return t.clients.forEach((g,P)=>{f[P]=Tt(g)}),f},m=f=>{const g={};return Object.keys(f).forEach(P=>{const E=f[P];g[P]={cif:E.cif?"":"Debes introducir un CIF/NIF válido",name:E.name?"":"El nombre es obligatorio"}}),g},x=()=>{const f=h(),g=m(f);n(g);const P=v(),E=m(P);a(E);let Z=!0;return Object.values(i.current).forEach(I=>{I&&typeof I.isValidated=="function"&&(I.isValidated()||(Z=!1))}),Object.values(r.current).forEach(I=>{I&&typeof I.isValidated=="function"&&(I.isValidated()||(Z=!1))}),Z&&Object.values(f).every(I=>I.cif&&I.name)&&Object.values(P).every(I=>I.cif&&I.name)},C=()=>{x()&&t.handleClick()};return e.jsx(jt,{id:"Modal347Data",isOpen:t.isOpen,title:"Presentar modelo 347",actionLabel:"Iniciar presentación",onClose:t.handleClose,isActionDisabled:!1,onAction:C,variant:"medium",children:e.jsxs(u,{display:"flex",flexDirection:"column",gap:"md",children:[e.jsxs(u,{display:"flex",flexDirection:"column",gap:"sm",children:[t?.clients?.length>0?e.jsx(Ke,{as:"h3",children:"Datos de clientes"}):null,e.jsx(u,{children:t.clients.map((f,g)=>e.jsxs(e.Fragment,{children:[e.jsx(It,{type:"client",index:g,errors:s[g]||{},getTowns:l,getProvinces:p,operator:f,handleUpdate:t.updateClient,onRefUpdate:P=>{r.current[g]=P}},g),g<t.clients.length-1?e.jsx(u,{my:"md",children:e.jsx(Xe,{})}):null]}))})]}),e.jsx(u,{display:"flex",flexDirection:"column",gap:"sm",children:e.jsxs(u,{display:"flex",flexDirection:"column",gap:"sm",children:[t?.providers?.length>0?e.jsx(Ke,{as:"h3",children:"Datos de proveedores"}):null,e.jsx(u,{children:t.providers.map((f,g)=>e.jsxs(e.Fragment,{children:[e.jsx(It,{index:g,type:"provider",errors:o[g]||{},getTowns:l,getProvinces:p,operator:f,handleUpdate:t.updateProvider,onRefUpdate:P=>{i.current[g]=P}},g),g<t.providers.length-1?e.jsx(u,{my:"md",children:e.jsx(Xe,{})}):null]}))})]})})]})})}function It({operator:t,type:s,index:a,errors:o,handleUpdate:n,getTowns:i,getProvinces:r,onRefUpdate:d}){const l=t.name&&t.name.trim().length>0,p=h=>{l||n("name",a,h)};return e.jsxs(e.Fragment,{children:[e.jsxs(u,{display:"flex",gap:"md",mb:"md",
1justifyContent:"space-between",flexWrap:"wrap",children:[e.jsx(u,{flex:"1 auto",children:e.jsx(me,{label:"Nombre o razón social","aria-label":"Nombre",required:!0,disabled:l,error:!!o.name,helperText:o.name,value:t.name,onChange:h=>p(h.target.value)})}),e.jsx(u,{flex:"1 auto",children:e.jsx(me,{label:"Identificador fiscal","aria-label":"Identificador fiscal",error:!!o.cif,helperText:o.cif,value:t.cif,onChange:h=>n("cif",a,h.target.value),required:!0})})]}),e.jsx(ut,{required:!0,formName:`Operator-${s}-Address-${a}`,labelErrorTown:gt,labelErrorProvince:ft,labelErrorCP:xt,labelProvince:mt,labelTown:ht,labelPostalCode:pt,getProvinces:r,getTowns:i,cp:t.cpostal,province:t.provincia_id,town:t.poblacion_id,handleProvinciaChange:h=>n("provincia_id",a,h),handlePoblacionChange:h=>{n("poblacion_id",a,h)},handleCpChange:(h,v)=>{n("cpostal",a,h,v)},ref:h=>{h&&d&&d(h)}})]})}class Ba extends Dt.Component{handleAction=s=>{s.preventDefault(),ee.goProfileAltaAutonomo()};render(){return e.jsxs(Y,{id:"ModalFirmaDigital",handleClose:this.props.handleClick,isOpen:this.props.isOpen,title:"¿Tienes certificado digital o Cl@ve PIN?",labelAction:"Indícalo en tu perfil ",handleAction:this.handleAction,labelCancel:"Cancelar",handleCancel:this.props.handleClick,variant:"small",children:[e.jsxs(S,{pb:"md",children:["Para presentar este modelo, ",e.jsx("b",{children:"necesitas certificado digital o Cl@ve PIN."}),e.jsx("br",{}),"Si ya lo tienes, debes indicarlo en tu perfil."]}),e.jsx(ge,{tone:"info",full:!0,title:"Si no lo tienes, existen las siguientes opciones:",message:e.jsx(e.Fragment,{children:e.jsxs("ol",{children:[e.jsxs("li",{children:["Tramitar el certificado digital por tu cuenta"," ",e.jsx(H,{underline:!0,href:"https://ayuda.declarando.es/es/articles/1003600-como-puedo-obtener-el-certificado-digital",onClick:s=>{s.preventDefault(),re.showArticle(1003600)},children:"siguiendo estos pasos"})]}),e.jsxs("li",{children:["Tramitar la Cl@ve PIN por tu cuenta"," ",e.jsx(H,{underline:!0,href:"https://ayuda.declarando.es/es/articles/1003567-como-puedo-obtener-la-cl-ve-pin",onClick:s=>{s.preventDefault(),re.showArticle(1003567)},children:"siguiendo estos pasos"})]}),e.jsx("li",{children:"Tramitar el certificado digital con Declarando por 14,56€ (IVA incl.)"})]})})})]})}}function qa(t){const s=Se.isValidIban(t.ibanCode);return e.jsx(Y,{id:"ModalIBAN",handleCancel:t.handleClose,isOpen:t.isOpen,title:e.jsx(e.Fragment,{children:"Número de cuenta para la domiciliación"}),labelAction:e.jsx(e.Fragment,{children:"Guardar"}),disabledAction:!s,handleAction:t.handleClick,children:e.jsxs(u,{pr:"15px",pl:"15px",children:[e.jsx("p",{children:e.jsx(e.Fragment,{children:"Hacienda necesita el IBAN para emitir el cargo. Debe tener 24 carácteres."})}),e.jsx(Ft,{value:t.ibanCode,onChange:t.updateIban})]})})}function Ha(t){let s=!1;return t.justification&&t.justification.length===13&&(s=!0),e.jsx(Be,{id:"ModalJustificationData",isOpen:t.isOpen,title:e.jsx(e.Fragment,{children:"Revisa que el dato sea correcto"}),labelAction:e.jsx(e.Fragment,{children:"Guardar"}),disabledAction:!s,handleClose:t.handleClick,children:e.jsx(me,{label:"Número de justificante","aria-label":"numero-justificante",required:!0,onChange:a=>t.updateJustification(a.target.value),value:t.justification,maxLength:13})})}class Ua extends ct{constructor(){super(...arguments),this.repository=new Ce}faltaContabilidad(){return this.execute(()=>this.repository.faltaContabilidad())}}const de={title:"No tenemos datos contables para todos los trimestres del año",description:"¿Has tenido actividad en los trimestres en los que no hay registrados ni ingresos ni gastos?",no:"No, está correcto",si:"Sí",descriptionConfirm:"No puedes descargar tu modelo 390 de momento <b>porque te falta contabilidad y la presentación del modelo 303 en alguno de los trimestres anteriores.</b> No te preocupes porque estamos trabajando a contrarreloj para poder ayudarte. <b>El equipo ya está avisado, así que en breve te contactará e indicará los pasos a seguir.</b>",entendido:"Entendido"},za=({handleAfirmativeAction:t,handleNegativeAction:s,isOpen:a})=>{const[o,n]=c.useState(!1),i=async()=>
1{if(!o){const{error:r}=await new Ua().faltaContabilidad();return r&&y.notifyError(),n(!0)}return t(),n(!1)};return o?e.jsx(Be,{id:"ModalErrorM390",handleClose:i,isOpen:a,title:de.title,labelAction:de.entendido,children:e.jsx(S,{small:!0,color:"content.Body1",dangerouslySetInnerHTML:{__html:de.descriptionConfirm}})}):e.jsx(Y,{id:"ModalM390IngresosGastosTrimestre",title:de.title,labelAction:de.si,labelCancel:de.no,handleAction:i,isOpen:a,handleCancel:s,children:e.jsx(S,{small:!0,color:"content.Body1",children:de.description})})},Je=class Je{static isModeloBlocked(s,a=N.getNativeDateNow()){switch(s.number){case"100":return!0}return[...Je.missingHaciendaLinkList].includes(s.number)&&a.getMonth()===0}};Je.missingHaciendaLinkList=[];let ot=Je;const Ga=({title:t,description:s,show:a,handleClose:o})=>{const n=ms.sanitize(s,{ALLOWED_TAGS:["b"]});return e.jsx(Be,{id:"ModalErrorM390",handleClose:o,isOpen:a,title:t,labelAction:"Entendido",children:e.jsx(S,{small:!0,color:"content.Body1",dangerouslySetInnerHTML:{__html:n}})})},Ja="/assets/success-CJKIju8u.svg",Qa=t=>{const[s,a]=c.useState(!1),[o,n]=c.useState(null),[i,r]=c.useState(""),[d,l]=c.useState(!1),[p,h]=c.useState(!1),v=`¡Enhorabuena! Has finalizado la presentación de la renta ${ue.getFiscalYear()-1}`,m=C=>{r(""),a(!!C),n(C)},x=async()=>{if(l(!0),!o){l(!1);return}const C=new _t,f=new Ne,g=new FormData;g.append("modelPresentation",o);try{const{success:P}=await f.postModelPresentation("100",ue.getCurrentQuarter(),ue.getFiscalYear()-1,g).catch(E=>{r(E.message)});if(!P){l(!1);return}try{const{success:E}=await C.setModelo100Presentado();E&&(h(!0),sessionStorage.setItem("sessionRentaPresentada","1"),y.notifySuccess(""))}catch{y.notifyError("")}finally{l(!1)}}catch{l(!1)}};return p?e.jsx(xs,{isOpen:t.open,title:v,children:e.jsxs(A,{p:"lg",gridGap:"xl",justifyContent:"center",children:[e.jsx("img",{id:"successImage",src:Ja,alt:"Success"}),e.jsx(Re,{label:"Volver a impuestos",onClick:()=>ee.goToModelosPresentados(100)})]})}):e.jsx(Y,{isOpen:t.open,busy:t.busy,title:e.jsxs(e.Fragment,{children:["¿Has finalizado la presentación de tu declaración de la renta ",ue.getFiscalYear()-1,"?"]}),disabledAction:!s,handleAction:x,handleCancel:t.handleCancel,labelAction:"Marcar como presentada",successChildren:null,success:!1,children:e.jsx(kt,{errorMessage:i,uploading:d,actionLabel:"Arrastra o selecciona el justificante",dropLabel:"Borrar justificante",filecopy:"PDF con un tamaño máximo de 5MB",loaderLabel:"Subiendo PDF...",onChangeFile:m,previewLabel:"Ver justificante",formats:["pdf"],maxMb:5})})},Mt=class Mt extends c.Component{constructor(s){super(s),this.isValidProcessTrimestral=a=>{let o=a.resultado<=0||a.selectedPayment===at.EFECTIVO||this.context.userStatus.digitalSign;return a.nombre===ve.M349&&!this.context.userStatus.digitalSign&&(o=!1),o||this.openPopupDigitalSign(),o},this.isValidProcessAnual=()=>{const a=this.context.userStatus.digitalSign;return a||this.openPopupDigitalSign(),a},this.handleDownloadTrimestral=async(a,o)=>{if(this.setState({model:a,handlerDownload:o}),this.isModeloBlocked(a)){this.setState({showPopupModeloBlocked:!0});return}if(this.isValidProcessTrimestral(a))if(a.nombre===ve.M303C)try{const n=await this.impuestosV2Repository.checkShouldBeRequiredModel303Complementary({year:a.presentacion.year,code:a.presentacion.trimestre});n.status==="REQUIRED"&&await this.impuestosV2Repository.checkValidJustification(a.presentacion.year,a.presentacion.trimestre).then(i=>{const r=i.data;r.valid?o():this.showPopupJustification(r.justification,a)}),(n.status==="NOT_REQUIRED"||n.status==="RECTIFICATION")&&this.setState({status303ComplementaryNotRequired:{showModal:!0,status:n.status}})}catch{y.notifyError("Ha ocurrido un error inesperado")}else o()},this.missingDataM390=()=>{this.setState({openModalM390IngresosGastosTrimestre:!1,successModalM390IngresosGastosTrimestre30:null})},this.handleDownloadAnual=async(a,o)=>{if(this.setState({model:a,handlerDownload:o}),this.isValidProcessAnual()){if(this.isModeloBlocked(a)){this.setState({showPopupModeloBlocked:!0});return}
1switch(a.nombre){case ve.M180:await this.context.Model180Store.init(a.presentacion.year).then(i=>{const r=i.data;r.valid&&r.property.referenciaCatastral?o():this.setState({popup180Open:!0,model180:a})});break;case ve.M190:await this.impuestosV2Repository.checkValidDataModel190(a.presentacion.year).then(i=>{const r=i.data;r.valid?o():this.showPopup190(r.providers,a)});break;case ve.M347:const n=()=>this.impuestosV2Repository.checkValidDataModel347(a.presentacion.year).then(i=>{const r=i.data;r.valid?o():this.showPopup347(r.clients,r.providers,r.countries,a)});this.context.phoneValidated.validado===!1?this.setState({openModalConfirmationPhone:!0,onValidatedPhone:(i,r)=>{this.onValidatedPhone(i,r),n()}}):await n();break;case ve.M390:await this.impuestosV2Repository.checkValidDataModel390(a.presentacion.year).then(i=>{i.data.validIae===!0?o():this.openPopUpMissingIae()});break;default:o()}}},this.openPopupDigitalSign=()=>{this.setState({popupDigital:!0})},this.closePopupDigitalSign=()=>{this.setState({popupDigital:!1})},this.showPopup347=(a,o,n,i)=>{this.setState({popup347Open:!0,popup347Clients:a,popup347Providers:o,popup347Countries:n,model347:i})},this.hidePopup347=()=>{this.setState({popup347Open:!1,popup347Clients:[],popup347Providers:[],popup347Countries:[]})},this.handlePopup347Completed=()=>{this.impuestosV2Repository.sendDataModel347(this.state.popup347Clients,this.state.popup347Providers,this.state?.model347.presentacion?.year).then(()=>{this.hidePopup347(),this.handlerDownload()})},this.showPopup190=(a,o)=>{this.setState({popup190Open:!0,popup190Providers:a,model190:o})},this.hidePopup190=()=>{this.setState({popup190Open:!1,popup190Providers:[]})},this.handlerDownload=()=>{this.state.handlerDownload()},this.handlePopup190Completed=()=>{this.impuestosV2Repository.sendDataModel190(this.state.popup190Providers,this.state?.model190.presentacion?.year).then(()=>{this.hidePopup190(),this.handlerDownload()})},this.showPopup390=(a,o,n)=>{this.setState({popup390Open:!0,popup390UserCnaes:a,popup390CnaesList:o,model390:n})},this.hidePopup390=a=>{this.setState({popup390Open:!1,popup390UserCnaes:[],popup390CnaesList:[]},a)},this.handlePopup390Completed=()=>{this.impuestosV2Repository.sendDataModel390(this.state.popup390UserCnaes).then(()=>{this.hidePopup390(()=>this.handlerDownload())})},this.hidePopup180=()=>{this.setState({popup180Open:!1})},this.showPopupJustification=a=>{this.setState({popupJustificationOpen:!0,popupJustification:a})},this.hidePopupJustification=()=>{this.setState({popupJustificationOpen:!1,popupJustification:""})},this.handlePopupJustificationCompleted=()=>{this.impuestosV2Repository.sendValidDataJustification(this.state.model.presentacion.year,this.state.model.presentacion.trimestre,this.state.popupJustification).then(()=>{this.hidePopupJustification(),this.handlerDownload()})},this.updateClient347=(a,o,n)=>{const i=this.state.popup347Clients.map((r,d)=>o===d?{...r,[a]:n}:r);this.setState({popup347Clients:i})},this.updateProvider347=(a,o,n)=>{const i=this.state.popup347Providers.map((r,d)=>o===d?{...r,[a]:n}:r);this.setState({popup347Providers:i})},this.updateProvider190=(a,o,n)=>{const i=this.state.popup190Providers.map((r,d)=>o===d?{...r,[a]:n}:r);this.setState({popup190Providers:i})},this.updateUserCnaes390=(a,o,n)=>{const i=this.state.popup390UserCnaes.map((r,d)=>o===d?{...r,[a]:n}:r);this.setState({popup390UserCnaes:i})},this.updateJustification=a=>{this.setState({popupJustification:a})},this.showPopupIban=a=>{this.setState({popupIbanOpen:!0,modelIban:a})},this.hidePopupIban=()=>{this.setState({popupIbanOpen:!1,modelIban:null})},this.handlePopupIbanCompleted=()=>{this.hidePopupIban(),this.context.storeUserIdentity().then(()=>{this.handlerDownload()})},this.openPopUpMissingIae=()=>{this.setState({popupOpenMissingIae:!0})},this.closePopUpMissingIae=()=>{this.setState({popupOpenMissingIae:!1})},this.onValidatedPhone=(a,o)=>{this.context.confirmedPhone(a,o),this.setState({openModalConfirmationPhone:!1,onValidatedPhone:null})},this.closePopupModeloBlocked=()=>{this.setState({showPopupModeloBlocked:!1})},this.impuestosV2Repository=new Ve,this.modelsRepository=new Ce,this.routesRepository=new Vt,this.state={popupDigital:!1,popupIbanOpen:!1,modelIban:null,validIae:!1,popupOpenMissingIae:!1,popup347Open:!1,popup347Clients:[],popup347Providers:[],popup347Countries:[],model347:null,popup190Open:!1,popup190Providers:[],model190:null,popup390Open:!1,popup390UserCnaes:[],popup390CnaesList:[],model390:null,popup180Open:!1,popupJustificationOpen:!1,popupJustification:"",selectProviderList:[],selectProvider:[],model180:null,model:null,loadError:!1,generatedModels:[],openM
1odalM390IngresosGastosTrimestre:!1,successModalM390IngresosGastosTrimestre30:null,onValidatedPhone:()=>null,openModalConfirmationPhone:!1,showPopupModeloBlocked:!1,showModalRentaPresentada:!1,busyModalRentaPresentada:!1,errorM390:{show:!1,description:"",title:""},handlerDownload:()=>null}}checkModelo(s,a){const o=["303","303C","349","390","347","190","180"];if(!this.context.userStatus.digitalSign&&o.includes(s.nombre))return this.openPopupDigitalSign();this.setState({model:s,handlerDownload:a},()=>{s.periodicidad===rt.ANUAL?this.handleDownloadAnual(s,a):this.handleDownloadTrimestral(s,a)})}isModeloBlocked(s){return ot.isModeloBlocked({number:s.nombre})}askForAdviceAjusteFiscal(){setTimeout(()=>{this.modelsRepository.askForAdviceAjusteFiscal().then(s=>{s.data===!0&&this.context.advicesList.addAjusteContabilidad(()=>{this.props.history.push(this.routesRepository.getExpensesUri())})})},5e3)}render(){return e.jsxs(e.Fragment,{children:[e.jsx(Ga,{...this.state.errorM390,handleClose:()=>{this.setState({errorM390:{show:!1}})}}),e.jsxs(Be,{isOpen:this.state.showPopupModeloBlocked,handleClose:this.closePopupModeloBlocked,title:e.jsx(e.Fragment,{children:"La presentación de este modelo está bloqueada ahora mismo"}),children:[e.jsx("p",{children:"Estamos trabajando para dejar el modelo listo y en breve estará disponible."}),e.jsx("p",{children:"Gracias por tu paciencia."})]}),e.jsx(Ba,{isOpen:this.state.popupDigital,handleClick:this.closePopupDigitalSign,...this.props}),e.jsx(_a,{isOpen:this.state.popup347Open,handleClick:this.handlePopup347Completed,handleClose:this.hidePopup347,clients:this.state.popup347Clients,providers:this.state.popup347Providers,countries:this.state.popup347Countries,updateClient:this.updateClient347,updateProvider:this.updateProvider347}),e.jsx(Fa,{isOpen:this.state.popup190Open,handleClose:this.hidePopup190,handleClick:this.handlePopup190Completed,providers:this.state.popup190Providers,updateProvider:this.updateProvider190}),e.jsx(Kt,{isOpen:this.state.popup180Open,handleClick:()=>this.context.Model180Store.handleCompleted(()=>{this.state.handlerDownload(),this.context.tasksList.removeMissingDataForRentLocal(),this.context.tasksList.unselect();const s=this.context.Model180Store.propertyJSON();s.provider_id=this.context.Model180Store.state.provider.id,this.context.updateUserWorkAddressFull({...this.context.userWorkAddress,...s}),this.hidePopup180()},this.state?.model180?.presentacion?.year),handleClose:()=>this.hidePopup180(),provider:this.context.Model180Store.state.provider,presentationYear:this.state?.model180?.presentacion?.year,rentedProperty:this.context.Model180Store.state.property,updateProvider:(s,a,o)=>this.context.Model180Store.updateProvider(s,a,o),updateInmueble:(s,a)=>this.context.Model180Store.updateInmueble(s,a),selectProviderList:this.context.Model180Store.state.selectProviderList,selectProvider:this.context.Model180Store.state.selectProvider,...this.props}),e.jsx(Ha,{isOpen:this.state.popupJustificationOpen,handleClick:this.handlePopupJustificationCompleted,justification:this.state.popupJustification,updateJustification:this.updateJustification}),e.jsx(Y,{id:"ModalNoIAESelected",title:e.jsx(e.Fragment,{children:"No tienes ningún IAE marcado en tu perfil"}),isOpen:this.state.popupOpenMissingIae,handleAction:ee.goProfile,handleCancel:this.closePopUpMissingIae,labelAction:e.jsx(e.Fragment,{children:"Ir al Perfil"}),labelCancel:e.jsx(e.Fragment,{children:"No gracias"}),children:e.jsx(u,{children:e.jsx("p",{children:e.jsx(e.Fragment,{children:"Por favor, dirijete al Perfil en la sección de Actividad y selecciona tu actividad."})})})}),e.jsx(qa,{isOpen:this.state.popupIbanOpen,handleClick:this.handlePopupIbanCompleted,handleClose:this.hidePopupIban,updateIban:s=>this.context.updateUserIdentity("iban",s),ibanCode:this.context.userIdentity.iban}),e.jsx(za,{isOpen:this.state.openModalM390IngresosGastosTrimestre,handleAfirmativeAction:this.missingDataM390,handleNegativeAction:()=>{this.state.successModalM390IngresosGastosTrimestre30(),this.setState({openModalM390IngresosGastosTrimestre:!1,successModalM390IngresosGastosTrimestre30:null})}}),this.context.phoneValidated.validado===!1&&e.jsx(fs,{prefijo:this.context.userIdentity.prefijo,phone:String(this.context.userIdentity.phone),blocked:!1,show:this.state.openModalConfirmationPhone,plan:this.context.userInfo?.plan.label,limitDate:this.context.phoneValidated.fecha_limite,onValidatedPhone:this.state.onValidatedPhone,cancelAction:()=>{this.setState({openModalConfirmationPhone:!1})}}),e.jsx(Qa,{open:this.state.showModalRentaPresentada,busy:this.state.busyModalRentaPresentada,handleAction:async()=>{this.setState({busyModalRentaPresentada:!0});try{const{success:s}=await new _t().setModelo100Presentado();s&&(sessionStorage.setItem("sessionRentaPresentada","1"),this.setState({showModalRentaPresentada:!1}),this.context.tasksList.removeRentaPresentada(),y.notifySuccess(""))}catch{y.notifyError("")}finally{this.setState({busyModalRentaPresentada:!1})}},handleCancel:()=>{this.setState({showModalRentaPresentada:!1})},onSuccess:()=>null}),e.jsx(Ya,{isOpen:this.state?.status303ComplementaryNotRequired?.showModal,onClose:()=>{this.setState(s=>({...s,status303ComplementaryNotRequired:{...s.status303ComplementaryNotRequired,showModal:!1}})),this.props.reloadModels()},refreshModels:this.props.reloadModels,status:this.state?.status303ComplementaryNotRequired?.status})]})}};Mt.contextType=Ae;let nt=Mt;const Ya=({status:t,isOpen:s,onClose:a,refreshModels:o})=>{const n=()=>
1{if(t==="NOT_REQUIRED")return e.jsxs(e.Fragment,{children:[e.jsx(S,{children:"Has hecho cambios en tus ingresos y el resultado del Modelo 303 vuelve a coincidir con el ya presentado."}),e.jsx("br",{}),e.jsx(S,{children:"Por eso, tu complementaria se desactivará automáticamente y desaparecerá de tu listado de impuestos."})]});if(t==="RECTIFICATION")return e.jsxs(e.Fragment,{children:[e.jsx(S,{children:"Has hecho cambios en tus ingresos y el resultado del Modelo 303 es distinto al que presentaste."}),e.jsx("br",{}),e.jsx(S,{children:"Tu mentor se encargará de preparar una rectificativa para corregir el dato y revisar si hay que ajustar otros trimestres."})]})};return e.jsx(jt,{customFooter:e.jsx(u,{display:"flex",justifyContent:"center",width:"100%",children:e.jsx(Re,{onClick:o,label:"Entendido"})}),isOpen:s,onClose:a,variant:"small",title:"Ya no necesitas presentar el 303 C",children:n()})},Xt=(t,s)=>{const{iniciarPresentacionModelo:a,isButtonIniciarPresentacionBlock:o,setIsButtonIniciarPresentacionBlock:n}=c.useContext(se),i=He(t),[r,d]=c.useState(!1),l=()=>{V.clickElement({event_label:"Inicia presentacion"}),n(!0),d(!0),setTimeout(()=>{d(!1),n(!1)},2e3),a(t,s.current)},p=Ye[t.nombre];return{fechasModelo:i,isPreloading:r,isButtonIniciarPresentacionBlock:o,onClickIniciarPresentacion:l,articlulo:p}},es=({modelo:t,onSuccess:s,disabled:a})=>e.jsx(e.Fragment,{children:e.jsx(wt,{disabled:a,variant:"secondary",filename:"modelPresentation",size:"M",maxsize:5,accept:".pdf",onError:o=>{y.notifyError("",o)},uploadFile:o=>{V.fileUpload({event_label:"Sube el justificante desde el listado"}),new Ne().postModelPresentation(t.nombre,t.presentacion.trimestre,t.presentacion.year,o).then(()=>{y.success({title:`El justificante del modelo ${t.nombre} se ha subido correctamente`,message:"Has completado la presentación del modelo",link:{label:"Ir a completados",href:ee.routes.getImpuestosModelosPresentadosUri()}}),s()}).catch(n=>{if(n.error===ze.JUSTIFICANTE_NO_VALIDO||n.message===ze.JUSTIFICANTE_NO_VALIDO)return vt();y.warning({message:"Comprueba que sea el justificante correcto.",title:"No ha sido posible subir el justificante",link:{href:"https://ayuda.declarando.es/es/articles/9734474-como-saber-si-he-presentado-un-impuesto-correctamente",label:"¿Qué documento adjuntar?"}})})},children:"Subir justificante"})}),Za={PENDIENTE:"info",PRESENTADO:"warning",FUERA_DE_PLAZO:"danger",BLOQUEADO:"blocked"},Wa=({modelo:t,reload:s,manejadorModalesInicioPresentacionModelo:a})=>{const{articlulo:o,isButtonIniciarPresentacionBlock:n,fechasModelo:i,isPreloading:r,onClickIniciarPresentacion:d}=Xt(t,a),l=t.estado,p=Za[t.estado],h=t.estado==="BLOQUEADO"?{"data-tippy-content":"Para poder presentar este modelo, debes resolver primero las tareas pendientes"}:{};return e.jsxs(L.Row,{boxShadow:!0,status:p,...h,children:[e.jsx(Yt,{children:e.jsx(_,{className:"cell",boldText:!0,text:e.jsxs(A,{as:"span",gridTemplateColumns:"max-content max-content",alignItems:"center",pl:"sm",ml:-5,children:[e.jsxs("span",{children:["Modelo ",t.nombre," "]}),o?e.jsx(he,{size:"S",isIconOnly:!0,variant:"main",icon:"question-circle",onClick:()=>{re.showArticle(o.id)}}):null]})})}),e.jsx(Zt,{children:e.jsx(le,{categoria:t.categoria})}),e.jsx(Wt,{children:e.jsx(fe,{periocidad:t.periodicidad,presentacion:t.presentacion})}),e.jsx($t,{children:e.jsx(xe,{modelo:t,fechas:i,estado:l})}),e.jsx(et,{children:e.jsx(Fe,{estado:l,fechas:i})}),e.jsx(tt,{children:e.jsx(Ee,{modelo:t,informar:t.nombre==="303"&&t.estado!=="PRESENTADO"&&t.estado!=="BLOQUEADO"?d:void 0})}),e.jsx(st,{children:t.estado==="BLOQUEADO"?e.jsxs(pe,{children:[e.jsx(K,{name:"lock",fontSize:"xs"}),t.mensaje?t.mensaje:"Presenta trimestres pendientes"]}):t.estado==="PRESENTADO"?e.jsx(es,{disabled:n,modelo:t,onSuccess:s}):e.jsx(Re,{label:"Iniciar presentación",size:"M",isDisabled:n,isLoading:r,onClick:d})})]})},$a=({modelo:t,reload:s,manejadorModalesInicioPresentacionModelo:a})=>{const{articlulo:o,isButtonIniciarPresentacionBlock:n,fechasModelo:i,isPreloading:r,onClickIniciarPresentacion:d}=Xt(t,a);return t.estado==="BLOQUEADO"?e.jsx(e.Fragment,{children:e.jsxs(k,{px:"sm",py:"xs",style:{borderBottom:"1px solid #DDDDE0",background:Q.colors.semantic.background.secondaryStatusLight.disabled},children:[e.jsxs(u,{children:[e.jsxs($,{justifyContent:"space-between",children:[e.jsx(_,{boldText:!0,text:e.jsxs(A,{as:"span",gridTemplateColumns:"max-content max-content",alignItems:"center",children:[e.jsxs("span",{children:["Modelo ",t.nombre]}),o?e.jsx(he,{size:"M",isIconOnly:!0,variant:"main",icon:"question-circle",onClick:()=>{re.showArticle(o.id)}}):null]})}),e.jsx(Fe,{estado:t.estado,fechas:i})]}),e.jsx($,{justifyContent:"flex-end",children:e.jsx(S,{small:!0,color:Q.colors.semantic.text.general.text2,children:t.mensaje})})]}),e.jsxs(A,{alignItems:"center",gridGap:"sm",gridTemplateColumns:"max-content max-content max-content",children:[e.jsx(le,{categoria:t.categoria}),e.jsx(fe,{periocidad:t.periodicidad,presentacion:t.presentacion,shortText:!0}),e.jsx(xe,{modelo:t,fechas:i,estado:t.estado})]})]})}):e.jsx(e.Fragment,{children:e.jsxs(k,{px:"sm",py:"xs",style:{borderBottom:"1px solid #DDDDE0"},children:[e.jsxs($,{justifyContent:"space-between",children:[e.jsx(_,{boldText:!0,text:e.jsxs(A,{as:"span",gridTemplateColumns:"max-content max-content",alignItems:"center",children:[e.jsxs("span",{children:["Modelo ",t.nombre]}),o?e.jsx(he,{size:"M",isIconOnly:!0,variant:"main",icon:"question-circle",onClick:()=>{re.showArticle(o.id)}}):null]})}),e.jsx(Fe,{estado:t.estado,fechas:i})]}),e.jsxs(A,{alignItems:"center",gridGap:"sm",gridTemplateColumns:"max-content max-content max-content",children:[e.jsx(le,{categoria:t.categoria}),e.jsx(fe,{periocidad:t.periodicidad,presentacion:t.presentacion,shortText:!0}),e.jsx(xe,{modelo:t,fechas:i,estado:t.estado})]}),e.jsxs($,{justifyContent:"space-between",children:[e.jsx(Ee,{modelo:t,informar:t.nombre==="303"&&t.estado!=="PRESENTADO"?d:void 0}),t.estado==="PRESENTADO"?e.jsx(es,{disabled:n,modelo:t,onSuccess:s}):e.jsx(Re,{label:"Iniciar presentación",size:"M",isDisabled:n,isLoading:r,onClick:d})]})]})})},Ot=({children:t})=>e.jsx(u,{minHeight:"600px",borderRadius:"md",backgroundColor:"white",children:t}),Ka=()=>{const t=c.useRef(),s=$s();c.useEffect(()=>{a()},[s.modelos]);const a=()=>{const o=s.modelos.find(n=>`${n.nombre}`=="347");o&&o.estado==="BLOQUEADO"&&o.mensaje&&o.mensaje!=="Presenta trimestres pendientes"&&y.error({title:"No puedes presentar el modelo 347",message:"Has modificado o eliminado datos de uno o más operadores y esto impide la presentación del modelo. Contacta con tu mentor para solucionarlo."})};return s.isLoading?e.jsx(Ot,{children:e.jsx(bt,{})}):e.jsx(Ht,{onSuccess:s.getListaModelosPorPresentar,children:e.jsxs(Ot,{children:[e.jsx(u,{bg:"white",px:0,pt:"xs",borderRadius:"md",children:e.jsxs(Me,{isExpandedDefault:!0,helperText:"Presenta tus modelos siguiendo el orden de la tabla diseña
1do por nuestro equipo legal",children:[e.jsx(Me.Button,{className:"list-pendientes",children:"Modelos pendientes"}),e.jsx(Me.Panel,{maxHeight:"none",children:e.jsx(u,{my:{_:"0",desktop:"-24px"},ml:-32,mr:{_:-7,desktop:-7},overflow:"scroll",children:s.modelos.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(oa,{children:[e.jsx(ba,{}),e.jsx(nt,{reloadModels:s.getListaModelosPorPresentar,ref:t})]}),e.jsx(u,{display:{_:"none",desktop:"block"},children:e.jsxs(L,{type:"simple-table",children:[e.jsxs(L.Head,{children:[e.jsx(b,{children:e.jsx(u,{pl:"sm",ml:-5,children:"Modelo"})}),e.jsx(b,{children:"Tipo de impuesto"}),e.jsx(b,{children:"Periodo"}),e.jsx(b,{children:"Fecha de presentación"}),e.jsx(b,{children:"Estado"}),e.jsx(b,{align:"right",children:"Resultado"}),e.jsx(b,{children:null})]}),e.jsx(L.Body,{children:s.modelos.map(o=>e.jsx(Wa,{manejadorModalesInicioPresentacionModelo:t,modelo:o,reload:s.getListaModelosPorPresentar},"desc_m"+o.nombre))})]})}),e.jsx(u,{display:{_:"block",desktop:"none"},id:"listado",children:s.modelos.map(o=>e.jsx($a,{manejadorModalesInicioPresentacionModelo:t,modelo:o,reload:s.getListaModelosPorPresentar},"mov_m"+o.nombre))})]}):e.jsx(Ws,{})})})]})}),e.jsx(Aa,{})]})})},Xa=t=>{const[s,a]=c.useState(0),{totalModelosPendientes:o}=Nt(),n=[{name:e.jsxs(e.Fragment,{children:["Pendientes"," ",o?e.jsx(gs,{variant:"notification",label:o<10?o:"+9"}):null]}),track_params:At.modelos_pendientes,section:e.jsx(Ka,{}),enabled:!0,path:"/impuestos",tabSelector:"tab-pendientes"},{name:"Completados",track_params:At.modelos_completados,section:e.jsx(Zs,{}),enabled:!0,path:"/impuestos/modelos-presentados",tabSelector:"tab-completados"}];c.useEffect(()=>{const d=n.filter(l=>l.enabled).findIndex(l=>l.path===t.location.pathname);a(d>=0?d:0)},[n]);const i=n.filter(d=>d.enabled),r=[{icon:"graduation-cap",cta:()=>window.open("https://unmarred-mushroom-c93.notion.site/Declarando-Mentor-as-online-55e21cf8969648c384eb7ccf75edf4bd?pvs=74","_blank"),text:"Asiste a las mentorías"},{icon:"question-circle",cta:()=>re.showArticle(Ye.main.id),text:"Saber más"},{icon:"megaphone",cta:()=>window.open("https://declarando1.typeform.com/impuestos-fb","_blank"),text:"Danos tu opinión"}];return e.jsx(Ms,{activeSection:s,setActiveSection:a,tabs:i,title:e.jsx(e.Fragment,{children:"Tus Impuestos"}),extraLinks:r,...t})},eo=({onHide:t,show:s,onSuccess:a=()=>null,reload:o=!1})=>{const[n,i]=c.useState(null),[r,d]=c.useState(!1),[l,p]=c.useState(e.jsx(e.Fragment,{children:"Guardar"})),[h,v]=c.useState(e.jsx(e.Fragment,{children:"Cancelar"})),[m,x]=c.useState(1),{push:C}=Ct(),f=async()=>{if(d(!0),await new Ce().storeDateModel130(n),o){window.location.href=window.location.href+"#modelo-130",window.location.reload();return}a(n),x(2),p(e.jsx(e.Fragment,{children:"Si"})),v(e.jsx(e.Fragment,{children:"No"})),d(!1)},g=()=>{const E=new Vt;t(),C(E.getImpuestosUri()+"#modelo-130")},P=E=>{i(N.formatNativeDateToString(E))};return s?e.jsx(Y,{id:"ModalDateModel130",isOpen:s,busy:r,title:e.jsx(e.Fragment,{children:"¿Marcaste la casilla 600 en el modelo 037 del alta?"}),labelAction:l,labelCancel:h,disabledAction:!n,handleAction:m===1?f:g,handleCancel:()=>{t(),x(1)},children:e.jsx(u,{mb:"25px",children:m===1?e.jsx(u,{mb:"15px",children:e.jsx(u,{pl:"15px",pr:"15px",children:e.jsx(Cs,{id:"fecha-modelo-037",label:"¿En qué fecha has modificado el modelo 037 del alta en Hacienda?",value:n&&N.formatStringToNativeDate(n),onChange:P})})}):e.jsx(u,{display:"flex",justifyContent:"center",children:e.jsx(js,{bold:!0,children:e.jsx(e.Fragment,{children:"Al marcar esta casilla, el Modelo 130 ha sido añadido a tus impuestos. ¿Quieres revisarlo?"})})})})}):e.jsx(e.Fragment,{})},to=({isOpen:t,handleClose:s})=>e.jsxs(Be,{isOpen:t,handleClose:s,title:"¿Qué es un ajuste contable?",children:[e.jsx(Le,{fontSize:"xs",color:"neutral.Light40",fontWeight:"600",children:"La contabilidad que introdujiste en Declarando respecto a la que presentaste en los modelos anteriores a estar con nosotros no coincide debido a descuadres contables en los gastos registrados."}),e.jsxs(A,{gridTemplateColumns:"auto 1fr",gridGap:"xs",pb:"md",children:[e.jsx(K,{name:"folder-plus",color:"neutral.Light40"}),e.jsx(Le,{fontSize:"xs",color:"neutral.Light40",fontWeight:"600",children:"Si el ajuste contable es positivo es porque te olvidaste de introducir algún gasto en Declarando."}),e.jsx(K,{name:"folder-minus",color:"neutral.Light40"}),e.jsx(Le,{fontSize:"xs",color:"neutral.Light40",fontWeight:"600",children:"Si el ajuste contable es negativo es porque registraste algún gasto de más."})]}),e.jsx(Le,{fontWeight:"bold",children:"¿Cómo me afecta que me añadais un gasto en mi contabilidad?"}),e.jsx(Le,{fontSize:"xs",color:"neutral.Light40",fontWeight:"600",children:"Haciendo estos ajustes lo que conseguimos es cuadrar los gastos de todo el año tal y conforme están declarados en Hacienda para no tener ningún error."})]}),so=c.createContext(void 0),ao=({children:t})=>{const[s,a]=c.useState([]),[o,n]=c.useState(!1),i=new Ve,r=c.useCallback(async()=>{n(!0);try{const d=await i.getPendingModels();a(d?.data?.models)}catch(d){const l=d;y.notifyError(l.message)}finally{n(!1)}},[i]);return e.jsx(so.Provider,{value:{modelsToPresent:s,getModelsToPresent:r,isLoading:o},children:t})},po=t=>{const s=Ct(),a=bs();return e.jsx(oo,{...t,history:s,location:a})};class oo extends c.Component{static contextType=Ae;constructor(s){super(s),this.modelsRepository=new Ce,this.repository=new Ve,this.state={showLoader:!0,hasToAskCompensation:!0,popupCompensacionOpen:!1,prevYear:ue.getFiscalYear()-1,reloadData:!1,modalDate130Show:!1,isOpenModalM180:!1,hasCuotaCompensar:!1,hasStickyCuotaCompensar:!1,openModalAjusteContabilidad:!1}}openModalAjusteContabilidad(){this.setState({openModalAjusteContabilidad:!0})}openModalModel180(){this.setState({isOpenModalM180:!0})}closeModalModel180(){this.setState({isOpenModalM180:!1})}async componentDidMount(){if(!this.context.accessControl.policy("Taxes").canAccess()){ee.goHome();return}if(vs.shouldInformCNAE({iaes:this.context.userStatus.iaes})){setTimeout(()=>{this.props.history.push("/inicio",{state:{shouldInformCNAE:!0},replace:!0})},0);return}try{const[s,a]=await Promise.all([this.modelsRepository.getStatusModelsFiscalQuestions(),this.modelsRepository.getDateModel130()]);s.data.status130&&!a.data.fechaAltaM130&&this.setState({modalDate130Show:!0})}catch{}this.loadStickies(),this.loadData(),this.hasCuotaCompensar()}async loadStickies(){const a=new Ue().getCuotaRepository(),[o,n]=await Promise.all([a.checkCuotaCompensar(this.state.prevYear),a.checkComplementaria()]);this.context.tasksList.addCuota(o?.data,()=>{this.setState({hasToAskCompensation:!0,showLoader:!1,hasStickyCuotaCompensar:!0},this.inspectCompensation)}),this.context.tasksList.addComplementaria(n?.data,null)}setHasToAskCompensation(s){this.setState({hasToAskCompensation:s,showLoader:!1},this.inspectCompensation)}loadData=()=>
1{if(sessionStorage.getItem("askedCompensation"))return this.setHasToAskCompensation(!1);this.repository.getCompensation(this.state.prevYear).then(s=>{this.setState({hasToAskCompensation:s.data.askCompensation,showLoader:!1},this.inspectCompensation)})};inspectCompensation=()=>{this.state.hasToAskCompensation&&this.setState({popupCompensacionOpen:!0})};handleOpenCompensacionModal=()=>{this.setState({popupCompensacionOpen:!0})};handleCloseCompensacionModal=()=>{this.setState({popupCompensacionOpen:!1,hasToAskCompensation:!1,hasCuotaCompensar:!0,hasStickyCuotaCompensar:!1})};handleCloseNotificationModal=()=>{this.props.history.push("/inicio")};getContent=()=>{let s=this.state.hasCuotaCompensar&&!this.state.hasStickyCuotaCompensar;return e.jsx(Xa,{handleOpenCompensacionModal:this.handleOpenCompensacionModal,shouldShowLinkModalCompensacion:s,...this.props})};hasCuotaCompensar=()=>{this.modelsRepository.hasCuotaCompensar(this.state.prevYear).then(s=>{this.setState({hasCuotaCompensar:s.data.hasCuota})})};render(){return e.jsxs("div",{id:"impuestosDiv",children:[this.state.showLoader||this.state.hasToAskCompensation?null:e.jsx(ao,{children:this.getContent()}),e.jsx(Bt,{tasksList:this.context.tasksList,isOpen:this.state.popupCompensacionOpen,handleClose:()=>this.setState({popupCompensacionOpen:!1}),handleSaved:this.handleCloseCompensacionModal,repository:this.repository,year:this.state.prevYear,hasCuotaCompensar:this.state.hasCuotaCompensar&&!this.state.hasStickyCuotaCompensar,stickyCuotaAction:()=>{this.setState({hasToAskCompensation:!0,showLoader:!1},this.inspectCompensation)}}),e.jsx(eo,{show:this.state.modalDate130Show,onHide:()=>this.setState({modalDate130Show:!1}),reload:!0}),e.jsx(Kt,{isOpen:this.state.isOpenModalM180,handleClick:{year:ue.getFiscalYear(),callback:()=>this.context.Model180Store.handleCompleted(()=>{this.closeModalModel180(),this.context.tasksList.removeMissingDataForRentLocal(),this.context.tasksList.unselect();const s=this.context.Model180Store.propertyJSON();s.provider_id=this.context.Model180Store.state.provider.id,this.context.updateUserWorkAddressFull({...this.context.userWorkAddress,...s})})},handleClose:()=>this.closeModalModel180(),provider:this.context.Model180Store.state.provider,rentedProperty:this.context.Model180Store.state.property,updateProvider:(s,a,o)=>this.context.Model180Store.updateProvider(s,a,o),updateInmueble:(s,a)=>this.context.Model180Store.updateInmueble(s,a),selectProviderList:this.context.Model180Store.state.selectProviderList,selectProvider:this.context.Model180Store.state.selectProvider,...this.props}),e.jsx(to,{isOpen:this.state.openModalAjusteContabilidad,handleClose:()=>this.setState({openModalAjusteContabilidad:!1})})]})}}export{po 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.