PageSourceSearch

https://app.declarando.es/assets/UserConfig-DDjVf-xb.js

js declarando.es collected 2026-10-01 10:12:36 UTC 69,774 bytes, 3 lines download raw bytes

1import{dR as T,d3 as e,m as r,ar as O,bu as d,q as b,dd as p,b3 as Ee,br as Y,dE as Me,cd as Pe,c as Q,bs as j,h as ge,ao as x,R as A,a$ as ke,bK as V,bQ as y,cm as F,ap as we,Y as m,aR as Fe,a6 as Re,bc as J,an as h,d as Ve,Z as je,cn as be,dG as Ne,P as Te,dW as Z,co as S,bp as $,ae as L,aT as q,c0 as Le,b_ as C,aU as Ue,ch as Be,aY as ve,bR as Oe,aH as f,b as H,aM as qe,a8 as R,N as _e,cf as We,ad as He,bW as re,bU as _,bP as ye,b6 as ne,a0 as oe,dS as Ge,b9 as ze,aJ as G,dq as Ye,a2 as Qe,bY as Je,aK as Ke,d8 as N,cV as Xe,aq as Ze,az as le,C as U,c9 as ce,a1 as de,ck as $e,dX as Ce,dZ as et,du as I}from"./index-4k09vm5V.js";import{a as tt,I as B,c as at,b as st,C as it,u as Se,E as rt}from"./IaeLabelsMapper-W3HODLfV.js";import{S as nt}from"./SectionSwitcher-DlnBnR5k.js";import{S as ee}from"./spinner-B5EtcyKk.js";import{M as ot}from"./ModelsRepository-37Ve7g-M.js";import{R as lt}from"./RentaRepository-DPtT1PpL.js";import{S as ct}from"./ServerSideTable-CjdpBZ_A.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"8a504455661812f5e913b30c07b22ab249739644"}}catch{}})();try{(function(){var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="fd660499-291a-4ccf-95ec-d08db2fea186",s._sentryDebugIdIdentifier="sentry-dbid-fd660499-291a-4ccf-95ec-d08db2fea186")})()}catch{}const dt=()=>{const s=T();return e.jsxs(r,{display:"flex",justifyContent:"center",flexDirection:"column",alignCenter:!0,maxWidth:800,mx:"auto",children:[e.jsx(r,{mb:"md",maxWidth:"fit-content",mx:"auto",textColor:"semantic.text.status.link",children:e.jsx(O,{name:"traffic-barrier",fontSize:64,color:"inerit"})}),e.jsx(d,{inline:!0,bold:!0,large:!0,mb:"xs",children:"Todavía no está disponible para tu actividad"}),e.jsx(d,{inline:!0,textColor:"semantic.text.general.text2",children:"Por ahora, solo pueden conectar su tienda online los usuarios de ciertas actividades. Estamos trabajando para ampliar esta funcionalidad para más tipos de IAE."}),e.jsx(r,{maxWidth:"fit-content",mt:"md",mx:"auto",children:e.jsx(b,{label:"Me interesa conectar mi tienda",onClick:()=>s.showModal()})}),e.jsx(tt,{modal:s})]})};function ht(){const[s,t]=p.useState(window.innerWidth<=560);return p.useEffect(()=>{function a(){t(window.innerWidth<=560)}return window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),s}const ut="data:image/png;base64,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",pt=()=>e.jsx(r,{width:"64px",minWidth:64,height:"64px",display:"flex",alignItems:"center",justifyContent:"flex-end",backgroundColor:"#D4C7E5",marginRight:"sm",borderRadius:"sm",children:e.jsx("img",{src:ut,alt:"WooCommerce Logo",style:{width:"46.412px",height:"27.738px",marginRight:"8px"}})}),mt=({modal:s,ecommerce:t,isLoading:a,removeConnection:i})=>e.jsxs(Ee,{id:"DeleteEcommerceModal",title:"Acción permanente",actionLabel:"Borrar conexión",iconActionLabel:"trash-alt",onAction:i,isLoading:a,destructiveAction:!0,closeLabel:"Cancelar",variant:"small",onClose:()=>s.closeModal(),isOpen:s.show,children:[e.jsx(d,{mb:"xs",children:"¿Seguro que quieres borrar esta conexión?"}),e.jsx(Y,{tone:"info",title:"Detalles de la tienda online:",full:!0,message:e.jsx(e.Fragment,{children:e.jsxs("ul",{style:{margin:0,paddingLeft:18},children:[e.jsxs("li",{children:[e.jsx("b",{children:"IAE:"})," ",t.iae.name," (IAE: ",t.iae.code,")"]}),e.jsxs("li",{children:[e.jsx("b",{children:"Régimen fiscal:"})," ",B(t.iae.taxRegime)]}),e.jsxs("li",{children:[e.jsx("b",{children:"Tipo de venta:"})," ",B(t.salesType)]}),e.jsxs("li",{children:[e.jsx("b",{children:"Fecha:"})," ",t.createdAt]})]})})})]}),xt=()=>{const s=at(),t=st(s);return{mutation:Me({queryKey:["DELETE_ECOMMERCE"],mutationFn:i=>t.deleteEcommerce(i)})}},ft=({ecommerce:s})=>{const t=ht(),a=T(),[i,n]=p.useState(!1),o=T(),{mutation:c}=xt(),l=c.isPending||a.busy,g=async()=>{c.mutate(s.id,{onSuccess:()=>{a.closeModal(),j.success({title:"La conexión se ha borrado correctamente"}),n(!0)},onError:()=>j.error({title:"No ha sido posible posible completar la acción",message:"Por favor, vuelve a intentarlo."})})};return i?null:e.jsxs(r,{display:"flex",hoverStyles:{cursor:"pointer",backgroundColor:"#EBF4FF"},p:"sm",bg:"semantic.background.general.default",width:652,borderRadius:"md",children:[e.jsx(pt,{}),e.jsxs(r,{width:"100%",maxWidth:{_:"100%",tablet:"100%"},children:[e.jsxs(r,{alignItems:"center",display:{_:"block",tablet:"flex"},justifyContent:"space-between",mb:"xs",children:[e.jsxs(d,{style:{flex:1,maxWidth:t?"100%":"400px"},fontSize:18,lineHeight:"24px",fontWeight:"700",textColor:"semantic.text.general.text1",truncate:!t,mb:{_:"xs",desktop:"0"},maxWidth:"380px",children:[s.iae.name," (",s.iae.code,")"]}),e.jsx(Pe,{size:"small",variant:s.isConnected?"success":"warning",children:s.isConnected?"Conectada":"No conectada"})]}),e.jsxs(r,{children:[e.jsxs(d,{small:!0,textColor:"semantic.text.general.text2",children:[" ",e.jsx("b",{children:"Régimen fiscal: "}),B(s.iae.taxRegime)]}),e.jsxs(d,{small:!0,textColor:"semantic.text.general.text2",children:[" ",e.jsx("b",{children:"Tipo de venta: "}),B(s.salesType)]}),e.jsxs(d,{small:!0,textColor:"semantic.text.general.text2",marginBottom:"sm",children:[e.jsx("b",{children:"Fecha:"})," ",s.createdAt]})]}),e.jsxs(r,{display:"flex",flexDirection:{_:"column",tablet:"row"},alignItems:{_:"start",tablet:"center"},gap:{_:"xs",tablet:"sm"},children:[!s.isConnected&&e.jsx(r,{children:e.jsx(Q,{icon:"trash-alt",label:"Eliminar",size:"S",variant:"delete",onClick:()=>o.showModal()})}),e.jsx(r,{display:"flex",flexDirection:"row",alignItems:"center",gap:"xxs",children:e.jsx(Q,{icon:"eye",label:"Código de conexión",size:"S",onClick:()=>a.showModal()})})]})]}),e.jsx(it,{title:"Código de conexión de tu tienda",modal:a,token:s.token,handleAction:()=>a.closeModal(),actionLabel:"Entendido"}),e.jsx(mt,{modal:o,ecommerce:s,isLoading:l,removeConnection:g})]})},gt=()=>{const{data:s}=Se();return e.jsxs(e.Fragment,{children:[e.jsxs(r,{display:"flex",flexDirection:{_:"column",tablet:"row"},justifyContent:"space-between",alignItems:"flex-start",marginBottom:"md",children:[e.jsxs(r,{display:"flex",flexDirection:"column",gap:"xs",marginBottom:{_:"md",tablet:"xl"}
1,children:[e.jsx(d,{fontSize:24,bold:!0,textColor:"semantic.text.general.text1",children:"Tienda online"}),e.jsx(d,{small:!0,alignSelf:"stretch",textColor:"semantic.text.general.text2",children:"Gestiona la conexión de tu tienda Woocommerce con Declarando."})]}),e.jsx(b,{variant:"main",size:"L",label:"Conectar otra tienda",icon:"plus",iconPosition:"left",onClick:ge.goToEcommerceConnection})]}),e.jsx(r,{display:"flex",flexDirection:"row",gap:"md",flexWrap:"wrap",children:s.map((t,a)=>e.jsx(ft,{ecommerce:t},a))})]})},jt=()=>e.jsxs(r,{maxWidth:"800px",display:"flex",flexDirection:"column",alignItems:"center",mx:"auto",mt:"xl",minHeight:"800px",children:[e.jsx(O,{name:"shop",fontSize:64,color:"semantic.text.status.link",marginBottom:24}),e.jsx(x,{as:"h3",textAlign:"center",bold:!0,marginBottom:"xs",children:"Conectar mi tienda online con Declarando"}),e.jsx(d,{textAlign:"center",textColor:"semantic.text.general.text2",marginBottom:24,children:"Tus ventas al día sin que te des cuenta. Conecta tu tienda y lo haremos por ti, sin líos ni errores. Solo dinos qué vendes y nosotros nos encargamos del resto."}),e.jsx(r,{display:"flex",marginBottom:"xl",gap:"18px",children:e.jsx(b,{variant:"main",size:"L",label:"Conectar mi tienda",onClick:ge.goToEcommerceConnection,icon:"plus",iconPosition:"left"})})]}),bt=()=>{const{ecommerces:s,isLoading:t,compatibleIaes:a}=Se();return e.jsx(A,{children:e.jsx(r,{minHeight:550,children:t?e.jsx(r,{minHeight:500,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",children:e.jsx(ke,{title:"Cargando..."})}):e.jsx(r,{flex:1,children:!s||s.length===0?a?.length?e.jsx(jt,{}):e.jsx(dt,{}):e.jsx(gt,{})})})})},vt=()=>e.jsx(rt,{children:e.jsx(bt,{})}),yt="Información sobre la actividad";class Ct extends V.Component{static contextType=y;constructor(t){super(t),this.updateIaeMain=this.updateIaeMain.bind(this),this.updateIvaExempt=this.updateIvaExempt.bind(this),this.updateEquivalence=this.updateEquivalence.bind(this),this.updateFechaAlta=this.updateFechaAlta.bind(this),this.handleRemoveIae=this.handleRemoveIae.bind(this),this.iaesRefs=[],this.state={allIaes:[],openPopupIvaExemptEquivalence:!1,iaesLoading:!1,openCantRemoveIaeModal:!1}}componentDidMount(){this.loadIaes()}isValidated(){return this.allIaesValids()}allIaesValids(){return this.iaesRefs.map(t=>t.isValidated()).every(t=>t)}filterIaes(t,a){const n=a.map(o=>o.id).filter(o=>o!==t.id);return this.state.allIaes.filter(o=>!n.includes(o.value))}loadIaes(){this.setState(()=>({iaesLoading:!0}),()=>{new F().getAllIaes().then(t=>{t.data&&this.setState({allIaes:t.data,iaesLoading:!1})})})}getActiveIaes=()=>this.props.iaes.filter(t=>+t.activo==1);updateIae=(t,a)=>{let i=this.props.iaes;i[t].id=a,this.state.allIaes.forEach(o=>{o.value===a&&(new we(i[t]).isAlquilerDeViviendas()&&(i[t].ivaExempt=!0),i[t].denominacion=o.label)}),this.props.updateIaes(i)};updateIaeMain=t=>{let a=[...this.props.iaes];a.forEach(i=>{i.main=!1}),a[t].main=!0,this.props.updateIaes(a)};isMinimumDate=(t,a)=>{let i=!0;const n=m.formatStringToDate(a);return t.forEach(o=>{const c=m.formatStringToDate(o.fechaAlta);i=i&&!c.isBefore(n)}),i};updateFechaAlta(t,a){let i=[...this.props.iaes];i[t].fechaAlta=a,this.props.updateIaes(i,()=>{this.isMinimumDate(i,a)&&this.context.updateUserStatus("altaDate",a)})}updateIvaExempt(t){let a=[...this.props.iaes];if(a[t].equivalenceSurcharge)this.setState({openPopupIvaExemptEquivalence:!0});else{a[t].ivaExempt=!a[t].ivaExempt;let i=Fe.getQuantity(a);this.context.updateUserStatus("ivaExempt",i,()=>this.context.updateUserStatus("iaes",a))}}updateEquivalence(t){let a=[...this.props.iaes];if(a[t].ivaExempt)this.setState({openPopupIvaExemptEquivalence:!0});else{a[t].equivalenceSurcharge=!a[t].equivalenceSurcharge;let i=Re.getQuantity(a);this.context.updateUserStatus("equivalence",i,()=>this.context.updateUserStatus("iaes",a))}}handleAddIae=()=>{if(this.getActiveIaes()===0||this.allIaesValids()){let t=m.getNow().format("DD-MM-YYYY"),a=this.getActiveIaes();a[a.length]={id:null,fechaAlta:t,activo:!0,main:a.length===0,ivaExempt:!1,equivalenceSurcharge:!1},this.props.updateIaes(a)}};generateNewIae=t=>({id:null,fechaAlta:m.getNow().format("DD-MM-YYYY"),activo:!0,main:t,ivaExempt:!1,equivalenceSurcharge:!1});handleRemoveIae=async t=>{const a=this.props.iaes.find((n,o)=>
1{if(t===o)return n});if(a.id){const{isBorrable:n}=await new F().getIaeBorrable(a.id);if(!n)return this.setState({openCantRemoveIaeModal:!0})}let i=this.props.iaes.filter((n,o)=>{if(t!==o)return n});if(this.props.updateIaes(i),this.iaesRefs=this.iaesRefs.filter((n,o)=>{if(t!==o)return n}),i.length>0){let n=!1;i.forEach(o=>{o.main&&(n=!0)}),n===!1&&(i[0].main=!0)}};render(){return e.jsxs("div",{children:[e.jsx(J,{title:"No es posible borrar esta actividad",labelAction:"Entendido",isOpen:this.state.openCantRemoveIaeModal,handleClose:()=>{this.setState({openCantRemoveIaeModal:!1})},children:e.jsx(d,{small:!0,children:"Esta actividad (IAE) lleva contabilidad vinculada, por tanto, no es posible eliminarla."})}),e.jsx(J,{isOpen:this.state.openPopupIvaExemptEquivalence,title:yt,handleClose:()=>{this.setState({openPopupIvaExemptEquivalence:!1})},children:e.jsx(e.Fragment,{children:"Una actividad no puede estar en recargo de equivalencia ni exenta de IVA."})}),e.jsx(h,{gridTemplateColumns:["1fr",this.props.onlyMain?"1fr":"1fr 1fr"],gridColumnGap:"sm",gridRowGap:"26px",children:this.props.iaes.filter(t=>this.props.onlyMain?t.main:t.activo).map((t,a)=>e.jsx(e.Fragment,{children:e.jsx(Ve,{index:a,iae:t,proratePercentage:t?.proratePercentage,ivaExemptDisabled:t.id==="1072",iaes:this.filterIaes(t,this.props.iaes),updateFechaAlta:this.updateFechaAlta,onChangeActividadPrincipal:()=>this.updateIaeMain(a),onChangeIsRecargoEquivalencia:()=>this.updateEquivalence(a),onChangeIsExentaDeIva:()=>this.updateIvaExempt(a),removeActivity:this.props.onlyMain?!1:()=>this.handleRemoveIae(a),updateIae:i=>this.updateIae(a,i)},St())}))})]})}}const St=()=>Math.random().toString(36).substr(2,9);class At extends je{constructor(t){super(),this.repository=t,this.repository=t}async getUserEconomicActivities(){return this.execute(()=>this.repository.getUserEconomicActivities(),{bodyAsData:!0})}}const It=s=>new At(s);class Dt extends be{getUserEconomicActivities(){return this.get("/user/iaes")}}const Et=()=>new Dt,Mt=s=>s.data.map(t=>({id:t.id,provisionalProrate:t.provisionalProrate.toFixed(2)})),Pt=()=>{const s=It(Et()),t=Ne({queryKey:["user","activities"],fetchFn:()=>s.getUserEconomicActivities(),config:{select:a=>({...a,data:a.data?.data?Mt(a.data):void 0})}});return{userEconomicActivities:t.data?.data,isLoading:t.isLoading,isError:t.error,refetch:t.refetch}};class kt extends p.Component{static contextType=y;constructor(t){super(t),this.refIaesList=null,this.userV2Repository=new F,this.contabilidadRepository=new Te,this.state={popupOpen:null,savingIaes:!1}}validateIaeList=()=>{let t=[...this.context.userStatus.iaes],a=!0,i=[];return t.forEach((n,o)=>{if(n.id===null){a=!1;let c={...n,invalid:!0};t.splice(o,1),i.push(c)}}),a||this.context.updateUserStatus("iaes",[...t,...i]),a};handleSaveClick=()=>{this.validateIaeList()&&(this.setState({savingIaes:!0}),this.context.storeUserStatus().then(()=>{this.userV2Repository.getUserIaes().then(t=>{this.context.updateUserStatus("iaes",t.data),j.notifySuccess(),this.context.iaesHelper.hasIaesChanged(!0)})}).finally(()=>this.setState({savingIaes:!1})))};render(){return e.jsx("div",{children:e.jsxs(A,{children:[e.jsxs(r,{mb:"20px",children:[e.jsxs(h,{mb:"20px",gridTemplateColumns:"1fr auto",children:[e.jsx(x,{as:"h2",weight:"bold",children:e.jsx(e.Fragment,{children:"¿A qué te dedicas?"})}),e.jsx(b,{label:"Añadir actividad",onClick:()=>this.refIaesList.handleAddIae()})]}),e.jsx(wt,{...this.props,ref:t=>{t&&(this.refIaesList=t)}})]}),e.jsx(r,{children:e.jsx(b,{label:"Guardar",id:"save",onClick:this.handleSaveClick,isDisabled:this.state.savingIaes})})]})})}}const wt=p.forwardRef((s,t)=>{const{userStatus:a,updateUserStatus:i}=Z(),{userEconomicActivities:n,refetch:o}=Pt(),c=a.iaes.map(l=>{const g=n?.find(k=>k.id===l.id);return{...l,proratePercentage:g?.provisionalProrate}});return e.jsx(Ct,{showFechaAlta:!0,iaes:c,updateIaes:(l,g)=>{i("iaes",l,g),o()},ref:t,...s})}),Ft="Debes introducir una fecha válida",Rt="Fecha de alta";class Vt extends V.Component{static contextType=y;constructor(t){super(t),this.state={errorAltaDate:""}}updateAltaDate=t=>{t&&this.context.updateUserStatus("altaDate",m.formatNativeDateToString(t))};
1isValidated(){const t=this._validateData(),a=this._validationErrors(t);return this.setState({errorAltaDate:a.altaDateValMsg}),t.altaDateValid}_validateData(){return{altaDateValid:this.context.userStatus.altaDate&&S.isValidDate(this.context.userStatus.altaDate)}}_validationErrors(t){return{altaDateValMsg:t.altaDateValid?"":Ft}}render(){return e.jsxs("div",{children:[e.jsx(h,{gridTemplateColumns:["1fr","1fr"],children:e.jsx($,{label:Rt,required:!0,value:this.context.userStatus.altaDate&&m.formatStringToNativeDate(this.context.userStatus.altaDate),onChange:this.updateAltaDate,error:!!this.state.errorAltaDate,message:this.state.errorAltaDate})}),this.state.errorAltaDate]})}}const te=({onClick:s})=>e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"Error de carga"}),e.jsx(b,{label:"Recargar",onClick:s})]});class Nt extends p.Component{constructor(t){super(t),this.repository=new L,this.state={selectedFile:t.file.valid,file:new File([""],t.file.filename)}}componentDidUpdate(t,a,i){this.props.file!==t.file&&this.setState({selectedFile:this.props.file.valid,file:new File([""],this.props.file.filename)})}clickInputFile=()=>{this.inputFileElement.click()};fileChanged(){const t=this.inputFileElement.files;if(t.length>0){let a=new FormData;a.append("fichero037",t[0]),this.repository.store037(a).then(i=>{const n=new File([""],i.data.name);this.setState({selectedFile:!0,file:n})}).catch(i=>{j.notifyError(i.message)})}}deleteFileModel(){this.repository.delete037().then(()=>{this.setState({selectedFile:!1,file:null})})}render(){let t=null;return this.state.selectedFile&&(t=e.jsx("span",{title:e.jsx(e.Fragment,{children:"Borrar archivo"}),onClick:this.deleteFileModel.bind(this),style:{cursor:"pointer"},children:e.jsx(O,{name:"multiply",deleteButton:!0})})),e.jsx("div",{children:e.jsxs(h,{gridTemplateColumns:["1fr","1fr 2fr"],gridColumnGap:"sm",alignItems:"center",children:[e.jsx(r,{display:"flex",justifyContent:["left","end"],mb:["15px","0px"],pt:"8px",children:e.jsx(q,{style:{fontSize:"14px",fontWeight:"600"},asterisk:!0,children:e.jsx(e.Fragment,{children:"Justificante de alta"})})}),e.jsx(r,{marginTop:"6px",children:this.state.selectedFile?e.jsxs("span",{children:[e.jsx("a",{style:{fontWeight:"700"},href:"https://api.declarando.es/v2/fichero/037",target:"_blank",rel:"noopener noreferrer",children:this.state.file.name})," ",t]}):e.jsx(Le,{accept:".jpg, .jpeg, .pdf",onClick:this.clickInputFile,inputFileElement:this.inputFileElement,onChange:this.fileChanged.bind(this),reference:a=>this.inputFileElement=a,children:e.jsx(e.Fragment,{children:"Seleccionar archivo"})})})]})})}}const Tt=()=>{const{userStatus:s}=p.useContext(y);return s.fechaBajaAutonomo===null?null:e.jsxs(r,{mb:"40px",children:[e.jsx(x,{as:"h3",marginBottom:"40px",children:"Baja de Autónomo en Hacienda"}),e.jsx(h,{gridTemplateColumns:["1fr","1fr 1fr"],gridColumnGap:"50px",gridRowGap:"15px",children:e.jsx(h,{gridTemplateColumns:["1fr","1fr 1fr"],children:e.jsx(f,{value:s.fechaBajaAutonomo,inform:!0,icon:"calender","aria-label":"Fecha baja autonomo",label:"Fecha de baja"})})})]})};class Lt extends p.Component{static contextType=y;constructor(t){super(t),this.modelsRepository=new ot,this.fileRepository=new L,this.refAltaDate=null,this.state={digitalSign:null,status111:null,status130:null,popupOpen:!1,busy:!1,loadError:!1,alta037:{filename:"",valid:!1},modalDate130Show:!1,hasDateRegisterModel130:!1,fechaAltaM130:null,fechaAltaM130Error:!1,submitting:!1}}get roi(){return this.context.userStatus.roi??{}}async componentDidMount(){this.setState({digitalSign:this.context.userStatus.digitalSign}),this.loadData();const t=await this.modelsRepository.getDateModel130();t.data.fechaAltaM130&&this.setState({hasDateRegisterModel130:!0,fechaAltaM130:t.data.fechaAltaM130})}async saveDateModel130(){if(this.state.status130)return this.modelsRepository.storeDateModel130(this.state.fechaAltaM130)}loadData=()=>{this.setState(()=>({busy:!0,loadError:!1}),()=>{this.modelsRepository.getStatusModelsFiscalQuestions().then(t=>{this.setState({status111:t.data.status111,status130:t.data.status130},()=>{this.fileRepository.get037().then(a=>{this.setState({alta037:{valid:a.data.hasFile,filename:a.data.fileName},loadError:!1,busy:!1})}).catch(()=>{this.setState(()=>({busy:!1}),this.handLoadError)})})}).catch(()=>{this.setState(()=>({busy:!1}),this.handLoadError)})})};handLoadError=()=>{this.setState(()=>({loadError:!0}))};validateDateModel130(){return this.state.status130&&!this.state.fechaAltaM130?(this.setState({fechaAltaM130Error:!0}),!1):(this.setState({fechaAltaM130Error:!1}),!0)}handleSaveClick=async()=>{this.refAltaDate.isValidated()&&this.validateDateModel130()&&(this.setState({submitting:!0}),this.modelsRepository.storeStatusModelsFiscalQuestions({status111:this.state.status111,status130:this.state.status130}),this.saveDateModel130(),this.context.updateUserStatus("digitalSign",this.state.digitalSign,()=>this.context.storeUserStatus().then(()=>{j.notifySuccess()}).finally(()=>{this.setState({submitting:!1})}
1)))};updateDigitalSign=t=>{const a=t===!0;this.setState({digitalSign:a})};updateModelStatusAnswer=(t,a)=>{const i=a===!0;this.setState({[t]:i}),i&&this.context.planHelper.isFree()&&t==="status111"&&this.context.openPopUpContrata()};checkModel130Date(){this.state.hasDateRegisterModel130?this.updateModelStatusAnswer("status130",!0):this.setState({modalDate130Show:!0})}closePopUp=()=>{this.setState({popupOpen:!1})};buildContent=()=>{const t=[{id:"digital-signature-true",label:"Sí",checked:this.state.digitalSign==!0,name:"digital-signature",value:!0},{id:"digital-signature-false",label:"No",checked:this.state.digitalSign==!1,name:"digital-signature",value:!1}],a=[{id:"status111-true",label:"Sí",checked:this.state.status111==!0,name:"status111",value:!0},{id:"status111-false",label:"No",checked:this.state.status111==!1,name:"status111",value:!1}],i=[{id:"status130-true",label:"Sí",checked:this.state.status130==!0,name:"status130",value:!0},{id:"status130-false",label:"No",checked:this.state.status130==!1,name:"status130",value:!1}];return e.jsxs(e.Fragment,{children:[e.jsxs(r,{children:[e.jsxs(r,{mb:"10px",children:[e.jsx(Tt,{}),e.jsx(x,{as:"h2",marginBottom:"24px",children:"Alta de Autónomo en Hacienda"}),e.jsxs(h,{gridTemplateColumns:["1fr","1fr 1fr"],mb:"md",gridColumnGap:"64px",children:[e.jsx(r,{width:"100%",children:e.jsx(Vt,{ref:n=>{this.refAltaDate=n},...this.props})}),e.jsx(Nt,{repository:new L,file:this.state.alta037})]})]}),e.jsxs(r,{children:[e.jsx(r,{mb:"md",children:e.jsx(C,{id:"digital-sign",label:"¿Tienes certificado digital o clave PIN?",required:!0,variant:"radio",selectors:t,onChange:n=>{const o=n[0]==="digital-signature-true";this.updateDigitalSign(o)}})}),e.jsx(r,{mb:"md",children:e.jsx(C,{id:"status111",label:"¿Marcaste la casilla 701 en el modelo 037 del alta? (Modelo 111)",required:!0,variant:"radio",selectors:a,onChange:n=>{const o=n[0]==="status111-true";this.updateModelStatusAnswer("status111",o)}})}),e.jsx(r,{mb:"md",children:e.jsx(C,{id:"status130",label:"¿Marcaste la casilla 600 en el modelo 037 del alta? (Modelo 130)",required:!0,variant:"radio",selectors:i,onChange:n=>{const o=n[0]==="status130-true";this.updateModelStatusAnswer("status130",o)}})})]}),this.state.status130&&e.jsx(h,{gridTemplateColumns:["1fr","1fr 1fr"],mb:"xl",gridColumnGap:"64px",children:e.jsx($,{label:"Fecha de alta en el modelo 130",required:!0,value:this.state.fechaAltaM130&&m.formatStringToNativeDate(this.state.fechaAltaM130),onChange:n=>n?(this.setState({fechaAltaM130:m.formatNativeDateToString(n)}),this.setState({fechaAltaM130Error:!1})):this.setState({fechaAltaM130Error:!0}),error:this.state.fechaAltaM130Error,message:this.state.fechaAltaM130Error&&"Campo obligatorio"})})]}
1),this.roi.fechaAlta&&e.jsxs(e.Fragment,{children:[e.jsx(r,{my:"lg",children:e.jsx(Ue,{variant:"separator"})}),e.jsxs(x,{as:"h2",mb:"lg",children:["Alta en el ROI para operaciones europeas"," ",e.jsx(Be,{placement:"left",content:e.jsxs(e.Fragment,{children:["Estar dado de alta en el ROI te permite operar con las ventajas propias de los operadores intracomunitarios. En caso de darte de baja en el ROI, debes comunicárselo a tu asesor.",e.jsx(ve,{styles:{textDecoration:"underline",display:"block"},underline:!0,href:"https://ayuda.declarando.es/es/articles/997094-como-darme-de-alta-en-el-roi",children:"Saber más"})]}),children:e.jsx(O,{name:"question-circle",size:"sm",color:"primary.Main"})})]}),e.jsx(Oe,{cols:2,children:e.jsxs(h,{gridTemplateColumns:["1fr",`repeat(${[this.roi.nifIva,this.roi.fechaAlta,this.roi.fechaBaja].filter(n=>n).length}, 1fr)`],gridGap:"md",children:[this.roi.nifIva&&e.jsx(f,{label:"Tu NIF IVA",required:!0,value:this.roi.nifIva,readOnly:!0,info:"Este es el número de identificador fiscal que se mostrará en tus facturas emitidas a operadores europeos"}
1),this.roi.fechaAlta&&e.jsx(f,{label:"Fecha de alta",required:!0,value:this.roi.fechaAlta,readOnly:!0}),this.roi.fechaBaja&&e.jsx(f,{label:"Fecha de baja",required:!0,value:this.roi.fechaBaja,readOnly:!0})]})})]}),e.jsx("div",{className:"mb-6"}),e.jsx(r,{display:"flex",children:e.jsx(b,{label:"Guardar",onClick:this.handleSaveClick,isDisabled:this.state.submitting})})]})};getContent=()=>this.state.busy?e.jsx(ee,{}):this.state.loadError?e.jsx(te,{onClick:this.loadData}):this.buildContent();render(){const t=this.getContent();return e.jsxs("div",{children:[e.jsx(J,{isOpen:this.state.popupOpen,handleClose:this.closePopUp,title:e.jsx(e.Fragment,{children:"¡Importante!"}),children:e.jsx("p",{children:e.jsx(e.Fragment,{children:"Recuerda que tienes que informar a Hacienda de que trabajas en un local alquilado."})})}),e.jsx(A,{children:t})]})}}class Ut extends V.Component{calculateAccountFromIban(){this.validateIban(this.props.iban)&&this.setState({cta:H.calculateAccountFromIban(this.props.iban)})}isValidated=()=>!this.props.required&&this.props.iban.length===0||!this.props.required&&this.props.iban.length>0;validateIban(t){if(t.length!==24||!t)return!1;{const a=H.calculateAccountFromIban(t);return H.validateAccountDC(a)}}render(){const t=this.props.required?e.jsx("span",{className:"text-danger",children:"*"}):null;return e.jsxs(e.Fragment,{children:[e.jsxs(h,{mb:"15px",gridTemplateColumns:["1fr"],gridRowGap:"10px",width:["100%","450px"],children:[e.jsxs(q,{children:["IBAN ",t]}),e.jsx(qe,{value:this.props.iban,onChange:a=>this.props.onchange(a)})]}),this.props.error]})}}const P={CATALAN:"CA",ENGLISH:"EN",SPANISH:"ES"},Bt=1e4;function Ot(s){return e.jsxs(r,{mb:"24px",children:[e.jsxs(q,{children:[s.iae.denominacion," (IAE: ",s.iae.grupo,")"]}),e.jsx(r,{display:"flex",flexDirection:"column",alignItems:"flex-start",marginTop:"8px",children:e.jsx(He,{fileKey:"ficheroLogo",waitForTriggerStore:!1,file:s.file,variant:"M",handleStore:t=>s.fileRepository.postInvoiceLogo(t,s.iae.id).then(a=>{s.updateLogoFile(a.success,a.data.name,s.iae,s.index)}),handleGet:()=>s.handleGet(s.iae.id),handleDelete:()=>s.fileRepository.deleteInvoiceLogo(s.iae.id).then(()=>{s.updateLogoFile(!1,"",s.iae,s.index)}),textButton:"Selecciona el logo de la actividad",fileTypes:["jpg","jpeg","png"],maxImageDimensions:{width:512,height:512},message:"Imagen de hasta 5 MB y 512x512 px"})})]})}class qt extends p.Component{static contextType=y;constructor(t){super(t),this.repository=new L,this.userV2Repository=new F,this.state={logo:0,style:"",color:"#007AFF",link:null,language:P.SPANISH,numeration:"1",email:"",iban:"",errorIban:"",userLogoFile:[],busy:!1,loadError:!1}}componentDidUpdate(){this.context.userIdentity.iban!==this.prevContext.userIdentity.iban&&this.setState({iban:this.context.userIdentity.iban}),this.context.iaesChanged&&(this.loadLogoFile(),this.context.iaesHelper.hasIaesChanged(!1)),this.prevContext=this.context}componentDidMount(){this.setState({iban:this.context.userIdentity.iban}),this.prevContext=this.context,this.loadData()}loadData=()=>{this.setState({busy:!0,loadError:!1},()=>{this.loadLogoFile().then(t=>{if(t.data){const a=t.data;this.storeLogoFile(a),this.loadInvoiceStyleInfo().then(i=>{if(i.data){const n=i.data;this.storeInvoiceStyleInfo(n)}else this.setState(()=>({busy:!1}),this.handLoadError)}).catch(()=>{this.setState(()=>({busy:!1}),this.handLoadError)})}else this.setState(()=>({busy:!1}),this.handLoadError)}).catch(()=>{this.setState(()=>({busy:!1}),this.handLoadError)})})};handLoadError=()=>{this.setState(()=>({loadError:!0}))};storeLogoFile=t=>{this.setState({userLogoFile:t})};loadLogoFile=()=>this.repository.hasInvoiceLogo();storeInvoiceStyleInfo=t=>{this.setState({logo:t.invoiceLogo+"",link:t.invoiceLink+"",style:t.invoiceStyle,color:t.invoiceColor,language:t.invoiceLanguage,numeration:t.invoiceNumeration,email:t.invoiceEmail,declarandoTradeMark:t.declarandoTradeMark,isPrivacyDataEnabled:t.isPrivacyDataEnabled,privacyDataText:t.privacyDataText,loadError:!1,busy:!1})};loadInvoiceStyleInfo=()=>this.userV2Repository.getInvoiceStyleInfo();handleGet=t=>this.repository.getInvoiceLogoUrl(t);handleSaveClick=()=>{const t={logo:this.state.logo,style:this.state.style,color:this.state.color,link:this.state.link,language:this.state.language,numeration:this.state.numeration,email:this.state.email,iban:this.state.iban,declarandoTradeMark:this.state.declarandoTradeMark,isPrivacyDataEnabled:this.state.isPrivacyDataEnabled,privacyDataText:this.state.privacyDataText};this.userV2Repository.storeInvoiceStyleInfo(t).then(a=>{if(a.success){j.notifySuccess();const i=this.state.numeration==="1";this.context.updateUserStatus("autoNumInvoice",i)}}).finally(()=>this.setState({busy:!1}))};updateLogoFile=(t,a,i,n)=>{const o=this.state.userLogoFile.map((c,l)=>(l===n&&(c.filename=a,c.valid=t,c.iae=i),c));this.setState({userLogoFile:o})};updateStyle=t=>{this.setState({style:t})};updateLanguage=t=>{this.setState({language:t})};updateEmail=t=>{this.setState({email:t})};updateColor=t=>{this.setState({color:t})};updateLogo=t=>{this.setState({logo:t})};updateLink=t=>{this.setState({link:t})};updateNumeration=t=>{this.setState({numeration:t})};updateIban=t=>{this.setState({iban:t,errorIban:""})};updateDeclarandoTradeMark=t=>{this.setState({declarandoTradeMark:t})};updateIsPrivacyDataEnabled=t=>{this.setState({isPrivacyDataEnabled:t})};validateInvoiceStyle=()=>{S.isValidIban(this.state.iban)||this.state.link==="0"?(this.setState({busy:!0}
1),this.context.updateUserIdentity("iban",this.state.iban),this.handleSaveClick()):this.setState({errorIban:e.jsx(R,{text:"El IBAN introducido no es correcto"})})};buildContent=()=>{const t=[{id:"1",label:"Sí",checked:this.state.numeration==="1",name:"numeration"},{id:"0",label:"No",checked:this.state.numeration==="0",name:"numeration"}],a=[{id:P.SPANISH,label:"Español",name:"lang",checked:this.state.language===P.SPANISH},{id:P.ENGLISH,label:"English",name:"lang",checked:this.state.language===P.ENGLISH},{id:P.CATALAN,label:"Català",name:"lang",checked:this.state.language===P.CATALAN}],i=[{id:"1",label:"Sí",name:"paymentButton",checked:this.state.link==="1"},{id:"0",label:"No",name:"paymentButton",checked:this.state.link==="0"}],n=[{id:"1",label:"Sí",name:"logo",checked:this.state.logo==="1"},{id:"0",label:"No",name:"logo",checked:this.state.logo==="0"}],o=[{id:"trademark-yes",label:"Sí",checked:this.state.declarandoTradeMark===!0},{id:"trademark-no",label:"No",checked:this.state.declarandoTradeMark===!1}],c=[{id:"data-privacy-yes",label:"Sí",checked:this.state.isPrivacyDataEnabled===!0},{id:"data-privacy-no",label:"No",checked:this.state.isPrivacyDataEnabled===!1}];return e.jsxs(r,{children:[e.jsx(x,{fontWeight:"700",style:{fontSize:"24px"},mb:"md",textColor:"semantic.text.general.text1",children:"Configuración de las facturas"}),e.jsx(h,{gridTemplateColumns:["1fr","3fr 1fr 1fr 1fr"],gridRowGap:"10px",gridColumnGap:"10px",children:e.jsx(C,{id:"numeration",label:"Utilizar el formato de numeración automática",variant:"radio",selectors:t,onChange:l=>{this.updateNumeration(l[0])}})}),e.jsx(x,{fontWeight:"700",textColor:"semantic.text.general.text1",style:{fontSize:"24px"},mb:"md",mt:"48px",children:"Personalización del PDF de la factura"}),e.jsx(h,{mb:"24px",gridTemplateColumns:["1fr","1fr 1fr"],gridRowGap:"10px",gridColumnGap:"10px",children:e.jsx(C,{id:"lang",label:"Selecciona el idioma",variant:"radio",selectors:a,onChange:l=>{const g=l[0];this.updateLanguage(g)}})}),e.jsxs(h,{mb:"24px",gridGap:"xxs",width:["100%","450px"],children:[e.jsx(q,{children:"Correo electrónico a mostrar"}),e.jsx(f,{name:"emailOriginal",value:this.state.email,onChange:l=>this.updateEmail(l.target.value)})]}),e.jsx(h,{gridTemplateColumns:["1fr","3fr 1fr 1fr 1fr"],gridRowGap:"10px",gridColumnGap:"10px",mb:"24px",children:e.jsx(C,{id:"paymentLink",label:"Añadir botón de pagar",variant:"radio",selectors:i,onChange:l=>{this.updateLink(l[0])}})}),this.state.link==="1"?e.jsx(Ut,{iban:this.state.iban,error:this.state.errorIban,onchange:this.updateIban}):null,e.jsx(h,{mb:"24px",gridGap:"xxs",children:e.jsx(_e,{value:this.state.color,onChange:l=>this.updateColor(l.target.value),label:"Selecciona el color principal"})}),e.jsx(h,{mb:"24px",gridTemplateColumns:["1fr","4fr 2fr 1fr 1fr"],gridRowGap:"10px",gridColumnGap:"10px",children:e.jsx(C,{id:"logo",label:"Utilizar un logo personalizado",variant:"radio",selectors:n,onChange:l=>{this.updateLogo(l[0])}})}),this.state.logo==="1"&&this.state.userLogoFile.length?this.state.userLogoFile.map((l,g)=>e.jsx(Ot,{file:l,handleGet:this.handleGet,fileRepository:this.repository,updateLogoFile:this.updateLogoFile,iae:l.iae,index:g})):null,e.jsx(h,{mb:"24px",gridTemplateColumns:["1fr","4fr 2fr 1fr 1fr"],gridRowGap:"10px",gridColumnGap:"10px",children:e.jsx(C,{id:"trademark",label:"Mostrar la marca de Declarando",variant:"radio",selectors:o,onChange:l=>{this.updateDeclarandoTradeMark(l[0]==="trademark-yes")}})}),e.jsxs(r,{mb:"md",children:[e.jsx(h,{mb:this.state.isPrivacyDataEnabled?"21px":"",gridTemplateColumns:["1fr","4fr 2fr 1fr 1fr"],gridRowGap:"10px",gridColumnGap:"10px",children:e.jsx(C,{id:"privacy-data",label:"Mostrar la cláusula de protección de datos",variant:"radio",selectors:c,onChange:l=>{this.updateIsPrivacyDataEnabled(l[0]==="data-privacy-yes")}})}),this.state.isPrivacyDataEnabled?e.jsx(r,{maxWidth:"500px",children:e.jsx(We,{label:"Texto de la cláusula de protección de datos",resize:"vertical",rows:5,shouldHideMaxCharacters:!0,onChange:l=>{this.setState({privacyDataText:l.target.value})},maxLength:Bt,value:this.state.privacyDataText})}):null]}),e.jsx(r,{display:"flex",children:e.jsx(b,{label:"Guardar",id:"guardar",className:"pull-right",onClick:this.validateInvoiceStyle})})]})};getContent=()=>this.state.busy?e.jsx(ee,{}):this.state.loadError?e.jsx(te,{onClick:this.loadData}):this.buildContent();render(){const t=this.getContent();return e.jsx(A,{children:t})}}const _t=e.jsx(e.Fragment,{children:"Casa en propiedad"}),Wt=e.jsx(e.Fragment,{children:"Casa en alquiler"}),Ht=e.jsx(e.Fragment,{children:"Oficina/Local alquilado"}),Gt=e.jsx(e.Fragment,{children:"Oficina/Local en propiedad"}
1),zt=e.jsx(e.Fragment,{children:"Otras situaciones"});class u{static atHome="0";static atRentedOffice="1";static atRentedHome="2";static atOwnOffice="3";static atOther="4";static getOptionsList(){return[{value:u.atHome,label:_t},{value:u.atRentedHome,label:Wt},{value:u.atRentedOffice,label:Ht},{value:u.atOwnOffice,label:Gt},{value:u.atOther,label:zt}]}static worksAtHome(t){return t===u.atHome||t===u.atRentedHome}static worksAtRentedOffice(t){return t===u.atRentedOffice}}const Yt=e.jsxs(e.Fragment,{children:[" ","son los metros cuadrados de tu casa que utilizas como oficina. Por ejemplo, la superficie del despacho o la superficie de la sala de estar en la que trabajas habitualmente."]}),he="Debes introducir un número positivo",Qt="Superficie",Jt="¿Cuántos m² ocupas para trabajar?",Kt="¿Cuántos m² tiene tu casa?",Xt="¿Dónde vas a trabajar?",ue="Filtra aquí...";class Ae extends p.Component{static contextType=y;constructor(t){super(t),this.state={errorSuperficie:"",errorProviderId:"",errorProviderCP:"",errorRefCatastro:""}}componentDidMount(){this.context.Model180Store.init(m.getNow().year())}componentWillUnmount(){j.clearNotifications()}isValidated(){const t=this._validateData(),a=this.compararSuperficies(),i=this._validationErrors(t);return this.setState({errorSuperficie:a.superficieValMsg?a.superficieValMsg:i.superficieValMsg,errorSuperficieTotal:i.superficieTotalValMsg,errorProviderId:i.providerIdValMsg,errorProviderCP:i.providerCPValMsg,errorRefCatastro:i.refCatastroValMsg}),t.superficieVal&&t.superficieTotalVal&&t.providerId&&t.providerCP&&t.refCatastro&&a.superficieValMsg===""}_validateData(){return{superficieVal:this._validateSuperficie(),superficieTotalVal:this._validateSuperficieTotal(),providerId:this._validateProviderId(),providerCP:this._validateProviderCP(),refCatastro:this._validateRefCatastro()}}_hasProvider(){return this.context.Model180Store.state.selectProviderList.length>0}_validateProviderId(){return!u.worksAtRentedOffice(this.props.workplace)||!this._hasProvider()?!0:!!this.context.Model180Store.state.provider?.id}_validateProviderCP(){return!0}_validateRefCatastro(){return!u.worksAtRentedOffice(this.props.workplace)||!this.context.Model180Store.state.property.referenciaCatastral?!0:S.isValidRefCatastral(this.context.Model180Store.state.property.referenciaCatastral)}_validateSuperficie(){return u.worksAtHome(this.props.workplace)?S.isValidPositiveInteger(this.props.userAddress.superficie):!0}_validateSuperficieTotal(){return u.worksAtHome(this.props.workplace)?S.isValidPositiveInteger(this.props.userAddress.superficieTotal):!0}_validationErrors(t){return{superficieValMsg:t.superficieVal?"":he,superficieTotalValMsg:t.superficieTotalVal?"":he,providerIdValMsg:t.providerId?"":"Debes seleccionar un proveedor",providerCPValMsg:t.providerCP?"":"Debes introducir un código postal válido",refCatastroValMsg:t.refCatastro?"":"Código de referencia catastral inválido"}}updateHomeRented=async t=>{this.context.updateUserStatus("local",t),await this.updateWorkplaceArea("superficieTotal",0),await this.updateWorkplaceArea("superficie",0),j.clearNotifications(),[u.atHome,u.atRentedHome].includes(t)&&j.handleNotification([e.jsxs("strong",{children:[Qt," (M",e.jsx("sup",{children:"2"}),"):"]}),Yt])};validateSuperficies=()=>{const{superficieValMsg:t}=this.compararSuperficies();this.setState({errorSuperficie:t})};compararSuperficies=()=>{const{userAddress:t}=this.props,a={superficieValMsg:""},i=+t.superficie,n=+t.superficieTotal;return u.worksAtHome(this.props.workplace)&&i>n&&(a.superficieValMsg="La superficie que ocupas para trabajar no puede ser mayor a la superficie de tu casa"),a}
1;updateWorkplaceArea=async(t,a)=>{await this.props.updateUserWorkAddress(t,a),await this.props.updateUserAddress(t,a)};updateProvider=(t,a)=>{t==="provider_id"?(this.context.Model180Store.updateProvider("id",a),this.props.updateUserWorkAddress(t,a),this.props.updateUserAddress(t,a)):(this.context.Model180Store.updateProvider("cp",a),this.props.updateUserWorkAddress(t,a),this.props.updateUserAddress(t,a))};updateInmueble=(t,a)=>{this.context.Model180Store.updateInmueble("referenciaCatastral",a),this.props.updateUserWorkAddress(t,a),this.props.updateUserAddress(t,a)};render(){const t=this.props.userAddress.superficie,a=this.props.userAddress.superficieTotal;return e.jsxs("div",{children:[e.jsx(r,{width:["100%","30%"],marginTop:"xl",children:e.jsxs(r,{mb:"md",children:[e.jsx(x,{as:"h2",mb:"md",children:Xt}),e.jsx(re,{name:"workPlaceOption",id:"select-workPlace",value:this.props.workplace,options:this.props.selectWorkPlaceList,clearable:!1,placeholder:ue,onChange:this.updateHomeRented,disabled:this.props.disabled})]})}),u.worksAtRentedOffice(this.props.workplace)&&e.jsxs(r,{marginTop:"xl",marginBottom:"xl",children:[e.jsx(x,{as:"h3",mb:"md",children:"Información necesaria para el modelo 180"}),e.jsxs(h,{gridTemplateColumns:["1fr","1fr 1fr 1fr"],gridColumnGap:"30px",children:[e.jsx(r,{children:e.jsx(f,{label:"Referencia catastral",type:"text",name:"ref_catastral",value:this.context.Model180Store.state.property.referenciaCatastral,onChange:i=>this.updateInmueble(i.target.name,i.target.value),error:this.state.errorRefCatastro,message:this.state.errorRefCatastro})}),e.jsx(r,{children:e.jsx(re,{required:!0,label:"Proveedor",name:"provider_id",id:"select-proveedor",value:this.context.Model180Store.state.provider?.id,options:this.context.Model180Store.state.selectProviderList,clearable:!1,placeholder:ue,onChange:i=>this.updateProvider("provider_id",i),disabled:this.props.disabled,error:!!this.state.errorProviderId,message:this.state.errorProviderId})})]}),e.jsx(Q,{icon:"external-link-alt",label:"Buscador oficial de referencia catastral",onClick:()=>window.open("https://www1.sedecatastro.gob.es/Cartografia/mapa.aspx?buscar=S","_blank")})]}),u.worksAtHome(this.props.workplace)?e.jsxs(_,{maxWidth:350,children:[e.jsx(r,{marginBottom:"8px",children:e.jsx(f,{required:!0,label:Kt,type:"text",name:"superficieTotal",value:a,onChange:i=>this.updateWorkplaceArea(i.target.name,i.target.value),error:!!this.state.errorSuperficieTotal,message:this.state.errorSuperficieTotal,onBlur:()=>this.validateSuperficies()})}),e.jsx(f,{required:!0,label:Jt,type:"text",name:"superficie",value:t,onChange:i=>{this.updateWorkplaceArea(i.target.name,i.target.value)},error:!!this.state.errorSuperficie,message:this.state.errorSuperficie,onBlur:()=>this.validateSuperficies()})]}):null]})}}Ae.defaultProps={disabled:!1,wideStyle:!1,selectWorkPlaceList:u.getOptionsList()};const pe="modify",me="unregister";class Zt extends p.Component{static contextType=y;constructor(t){super(t),this.refAddress=null,this.refWorkAddress=null,this.refWorkPlaceSelect=null,this.locationRepository=ye.instance.getImpuestosRepository(),this.state={popupModifyOpen:!1,popupUnregisterOpen:!1,busy:!1}}handleSaveClick=()=>{let t=this.refAddress.isValidated(),a=null;t=t&&this.refWorkPlaceSelect.isValidated(),u.worksAtHome(this.context.userStatus.local)?a=me:(t=t&&this.refWorkAddress.isValidated(),a=pe),t&&(this.setState({busy:!0}),u.worksAtHome(this.context.userStatus.local)||this.context.storeUserWorkAddress(),this.context.storeUserStatus(),this.context.storeUserAddress().then(()=>{switch(j.success({}),a){case pe:this.showModifyPopup();break;case me:this.showUnregisterPopup();break;default:return}}).catch(i=>{i.message==="INVALID_WORK_AREA"?(j.notifyError("La superficie que ocupas para trabajar no puede ser mayor a la superficie de tu casa"),this.refWorkPlaceSelect.setState({errorSuperficie:"La superficie que ocupas para trabajar no puede ser mayor a la superficie de tu casa"})):j.notifyError()}).finally(()=>{this.setState({busy:!1})}))};showModifyPopup=()=>{this.setState({popupModifyOpen:!0})};showUnregisterPopup=()=>{this.setState({popupUnregisterOpen:!0})};confirmModyfyRenting=()=>{this.closeModifyPopup(),this.props.history.push(this.locationRepository.gotoModifyRenting())};confirmUnregisterRenting=()=>{this.closeUnregisterPopup(),this.props.history.push(this.locationRepository.gotoUnregisterRenting())};closeModifyPopup=()=>{this.setState({popupModifyOpen:!1})};closeUnregisterPopup=()=>{this.setState({popupUnregisterOpen:!1})};render(){return e.jsxs("div",{id:"userconfigLivingPlace",children:[e.jsx(ne,{id:"inform-modify-renting-modal",handleCancel:this.closeUnregisterPopup,isOpen:this.state.popupUnregisterOpen,title:e.jsx(e.Fragment,{children:"¡Importante!"}),idAction:"buttonAction",labelAction:e.jsx(e.Fragment,{children:"Informar a Hacienda"}
1),handleAction:this.confirmUnregisterRenting,idCancel:"buttonCancel",labelCancel:e.jsx(e.Fragment,{children:"Ya he informado"}),children:e.jsx(r,{children:e.jsx("p",{children:e.jsxs(e.Fragment,{children:["Recuerda que tienes que ",e.jsx("strong",{children:"informar a Hacienda"})," que trabajas en casa."]})})})}),e.jsx(ne,{id:"inform-modify-renting-modal",handleCancel:this.closeModifyPopup,isOpen:this.state.popupModifyOpen,title:e.jsx(e.Fragment,{children:"¡Importante!"}),idAction:"buttonAction",labelAction:e.jsx(e.Fragment,{children:"Informar a Hacienda"}),handleAction:this.confirmModyfyRenting,idCancel:"buttonCancel",labelCancel:e.jsx(e.Fragment,{children:"Ya he informado"}),children:e.jsx(r,{children:e.jsx("p",{children:e.jsxs(e.Fragment,{children:["Recuerda que tienes que ",e.jsx("strong",{children:"informar a Hacienda"})," que no trabajas en casa."]})})})}),e.jsxs(A,{children:[e.jsxs(r,{mb:"48px",children:[e.jsx(x,{as:"h2",mb:"md",children:"¿Dónde vives habitualmente?"}),e.jsx(oe,{formName:"LivingPlace",address:this.context.userAddress,updateField:this.context.updateUserAddress,ref:t=>{t&&(this.refAddress=t)},...this.props})]}),e.jsx(r,{mb:"lg",children:e.jsx(Ae,{ref:t=>{t&&(this.refWorkPlaceSelect=t)},workplace:this.context.userStatus.local,userAddress:this.context.userAddress,userWorkAddress:this.context.userWorkAddress,updateUserAddress:this.context.updateUserAddress,updateUserWorkAddress:this.context.updateUserWorkAddress,updateUserWorkPlace:this.context.updateUserWorkPlace,disabled:!1,...this.props})}),u.worksAtHome(this.context.userStatus.local)?e.jsx("div",{className:"mb-4"}):e.jsxs("div",{style:{marginTop:"50px"},children:[e.jsx(r,{children:e.jsx(x,{as:"h3",mb:"md",children:"Dirección de trabajo"})}),e.jsx(oe,{formName:"WorkPlace",address:this.context.userWorkAddress,updateField:this.context.updateUserWorkAddress,ref:t=>{t&&(this.refWorkAddress=t)},...this.props})]}),e.jsx("div",{className:"mb-6"}),e.jsx(r,{children:e.jsx(b,{label:"Guardar",isDisabled:this.state.busy,onClick:this.handleSaveClick})})]})]})}}const $t="Las contraseñas no coinciden",ea=({modal:s})=>{const{errors:t,nueva:a,actual:i,confirmacion:n,onchangeActual:o,onchangeNueva:c,onchangeConfirmacion:l,touched:g,reset:k,errorConfirmacion:D,onSubmmit:W,errorActual:E}=Ge(s);p.useEffect(()=>{s.show||k()},[s.show]);const M=g&&t.length>0;return e.jsx(ze,{busy:s.busy,isOpen:s.show,title:"Cambiar mi contraseña",id:"ModalResetPassword",handleAction:W,labelAction:"Confirmar nueva contraseña",handleCancel:()=>{s.closeModal(),k()},variant:"small",children:e.jsxs(_,{children:[e.jsx(G,{placeholder:"Introduce la contraseña actual",onChange:v=>o(v.target.value),value:i,id:"actual",error:E,label:"Contraseña actual"}),e.jsx(G,{placeholder:"Introduce tu nueva contraseña",onChange:v=>c(v.target.value),value:a,id:"nueva",success:t.length===0&&!!n&&!D,error:E||M||!!n&&D,label:"Nueva contraseña"}),e.jsx(G,{placeholder:"Confirma la nueva contraseña",onChange:v=>l(v.target.value),value:n,id:"confirmacion",label:"Confirmación de la nueva contraseña",success:!!(n&&a===n),error:n&&D||M||E,helperText:n&&D?$t:""}),i&&n&&a===n&&!E?e.jsx(Y,{shrink:!1,full:!0,tone:"success",title:"La contraseña cumple con todos los requisitos",message:"Clica en 'Confirmar nueva contraseña'"}):null,t.length>0||i&&E?e.jsx(Y,{shrink:!1,full:!0,tone:g?"error":"info",title:"Para que la contraseña sea válida",message:e.jsxs(e.Fragment,{children:[E?e.jsxs(d,{small:!0,children:[e.jsx("b",{children:"·"})," Revisa la contraseña actual y/o asegúrate de que la nueva contraseña sea diferente a las anteriores."]},"error-actual"):null,t.map((v,De)=>e.jsxs(d,{small:!0,children:[e.jsx("b",{children:"·"})," ",v]},"error"+De))]})}):null]})},"ModalResetPassword")},{colors:ta}=Ye,aa=()=>{const{userIdentity:s}=Z();return{email:s.email}},sa=()=>{const{email:s}=aa(),t=T();return e.jsxs(e.Fragment,{children:[e.jsxs(_,{my:"lg",children:[e.jsx(x,{as:"h2",children:"Datos de acceso"}),e.jsxs(d,{color:ta.semantic.text.general.text2,children:["Accede con"," ",e.jsx(d,{as:"span",inline:!0,children:s})," ","y con tu contraseña"]}),e.jsx(d,{children:e.jsx(b,{label:"Cambiar mi contraseña",icon:"edit",variant:"secondary",onClick:t.showModal})})]}),e.jsx(ea,{modal:t})]})},ia=()=>e.jsx(sa,{}),ra=()=>{const{storeUserIdentity:s,userIdentity:t}=Z(),[a,i]=p.useState("");return{storeUserIdentity:s,userIdentity:t,setErrorNif:i,errors:{errorNif:a}}},ae=p.createContext({}),na=()=>{const s=p.useContext(ae);
1if(!s)throw new Error("useFormUserIdentityContext must be inside an FormUserIdentityContextProvider");return s},oa=({children:s})=>e.jsx(ae.Provider,{value:ra(),children:s}),la="Debes introducir el nombre",ca="Debes introducir los apellidos",da="Debes introducir un DNI/NIF válido",z="Debes introducir un teléfono válido",xe="Este teléfono ya existe",ha="Debes introducir un prefijo válido",ua="Debes introducir una fecha válida",pa="Debes seleccionar una nacionalidad",ma="Nombre",xa="Apellidos",fa="Teléfono",ga="DNI",ja="Fecha de nacimiento";function Ie(s){const{errors:t,setErrorNif:a}=na();return e.jsx(f,{label:ga,required:!0,type:"text",name:"nif",id:"nif",placeholder:"12345678Z",value:s.context.userIdentity.nif,onChange:i=>{a(""),s.onChange(i)},error:!!s.errorDni||!!t.errorNif,helperText:t.errorNif?t.errorNif:s.errorDni})}Ie.propTypes={context:N.any,onChange:N.func,errorDni:N.any,formUserIdentityContext:N.any};class ba extends V.Component{static contextType=y;constructor(t){super(t),this.state={errorFirstName:"",errorLastName:"",errorNif:"",errorPhone:"",errorPrefix:"",errorBirthDate:"",enabledPhonenumber:null,errorNationality:""}}isValidated(){const t=this._validateData(),a=this._validationErrors(t);return this.setState({errorFirstName:a.fistNameValMsg,errorLastName:a.lastNameValMsg,errorDni:a.nifValMsg,errorPhone:a.phoneValMsg,errorPrefix:a.prefixValMsg,errorBirthDate:a.birthDateValMsg,errorNationality:a.nationalityValMsg}),t.firstNameVal&&t.lastNameVal&&t.nifVal&&t.phoneVal&&t.prefixVal&&t.birthDateVal&&t.nationalityVal}_validateData(){return{firstNameVal:this.context.userIdentity.firstName.length>0,lastNameVal:this.context.userIdentity.lastName.length>0,nifVal:Qe.isValidSpanishId(this.context.userIdentity.nif),phoneVal:this.state.enabledPhonenumber&&S.isValidPhone(this.context.userIdentity.prefijo,this.context.userIdentity.phone),prefixVal:S.isValidPrefix(this.context.userIdentity.prefijo),birthDateVal:this._validateBirthDate(),nationalityVal:!!this.context.userIdentity.nationality}}_validateBirthDate(){return this.context.userIdentity.birthDate?S.isValidDate(this.context.userIdentity.birthDate):!0}_validationErrors(t){return{fistNameValMsg:t.firstNameVal?"":la,lastNameValMsg:t.lastNameVal?"":ca,nifValMsg:t.nifVal?"":da,phoneValMsg:t.phoneVal?"":z,prefixValMsg:t.prefixVal?"":ha,birthDateValMsg:t.birthDateVal?"":ua,nationalityValMsg:t.nationalityVal?"":pa}}updateBirthDate=t=>{t&&this.context.updateUserIdentity("birthDate",t)};validatePhone=()=>{if(this.setState({errorPhone:"",errorPrefix:""}),!S.isValidPhone(this.context.userIdentity.prefijo,this.context.userIdentity.phone))return this.setState({errorPhone:z});this.setState({enabledPhonenumber:!1}),this.props.setBusyButton(!0),setTimeout(async()=>{const t=ye.instance.getPhoneRepository();if(+this.context.userIdentity.phone==+this.props.snapShotUserIdentity.phone&&+this.context.userIdentity.prefijo==+this.props.snapShotUserIdentity.prefijo)return this.props.setBusyButton(!1),this.setState({enabledPhonenumber:!0});try{const a=await t.checkExistPhone(this.context.userIdentity.prefijo,this.context.userIdentity.phone);return this.props.setBusyButton(!1),this.setState({enabledPhonenumber:!a.exists,errorPhone:a.exists?xe:""})}catch{this.setState({enabledPhonenumber:!0,errorPhone:z})}this.props.setBusyButton(!1)},400)};changePhone=t=>{this.setState({enabledPhonenumber:!0}
1),this.context.updateUserIdentity("phone",t),setTimeout(()=>this.validatePhone(),10)};changeNationality=t=>{this.context.updateUserIdentity("nationality",t)};changePrefixPhone=t=>{this.setState({enabledPhonenumber:!0}),this.context.updateUserIdentity("prefijo",t),setTimeout(()=>this.validatePhone(),10)};render(){const t=this.state.errorPrefix?this.state.errorPrefix:!this.state.enabledPhonenumber&&!this.props.busy?xe:this.state.errorPhone;return e.jsx("div",{children:e.jsxs(h,{gridTemplateColumns:["1fr","1fr 1fr"],gridColumnGap:"30px",children:[e.jsx(r,{mb:"15px",children:e.jsx(f,{label:ma,required:!0,type:"text",name:"firstName",id:"firstName",value:this.context.userIdentity.firstName,onChange:a=>this.context.updateUserIdentity(a.target.name,a.target.value),error:!!this.state.errorFirstName,message:this.state.errorFirstName})}),e.jsx(r,{mb:"15px",children:e.jsx(f,{label:xa,required:!0,type:"text",name:"lastName",id:"lastName",value:this.context.userIdentity.lastName,onChange:a=>this.context.updateUserIdentity(a.target.name,a.target.value),message:this.state.errorLastName,error:!!this.state.errorLastName})}),e.jsx(r,{mb:"15px",children:e.jsx(Ie,{context:this.context,onChange:a=>{this.context.updateUserIdentity(a.target.name,a.target.value)},errorDni:this.state.errorDni})}),e.jsx(r,{mb:"15px",children:e.jsx($,{placeholder:"dd-mm-aaaa",label:ja,value:this.context.userIdentity.birthDate&&m.formatStringToNativeDate(this.context.userIdentity.birthDate),disabledDate:a=>{const i={date:m.formatNativeDateToString(a,"yyyy-MM-dd"),from:m.formatDateToString(m.getNow().subtract(120,"years"),"yyyy-MM-DD"),to:m.formatDateToString(m.getNow().subtract(18,"years"),"yyyy-MM-DD")};return!m.isDateBetweenProvidedDates(i)},error:!!this.state.errorBirthDate,message:this.state.errorBirthDate,onChange:a=>this.updateBirthDate(m.formatNativeDateToString(a)),onBlur:a=>this.updateBirthDate(m.formatNativeDateToString(a))})}),e.jsx(r,{mb:"15px",children:e.jsx(Je,{label:"Nacionalidad",required:!0,id:"nationality",value:this.context.userIdentity.nationality,onChange:a=>this.changeNationality(a),error:!!this.state.errorNationality,message:this.state.errorNationality})}),e.jsx(r,{mb:"15px",children:e.jsx(Ke,{label:fa,required:!0,id:"phone",placeholder:"Introduce tu número de teléfono...",prefixValue:this.context.userIdentity.prefijo,numberValue:String(this.context.userIdentity.phone),onChangePhonenumber:a=>{this.changePhone(a)},onChangePrefixPhone:a=>this.changePrefixPhone(a),error:!!t,message:t})})]})})}}const va="Los emails no coinciden",ya="Debes introducir un email válido",Ca="Esta dirección ya está en uso",Sa="Correo electrónico",Aa="Confirmar correo electrónico",Ia="Selecciona el método de pago",se=class se extends V.Component{constructor(t){super(t),this.isValidEmail=()=>{const a=this._validateData(),i=this._validationErrors(a),n=a.emailMatch&&a.emailVal&&this.state.notFoundEmailColision;return this.setState({errorEmailMatch:i.emailMatchMsg,errorEmailVal:i.emailValMsg}),n&&this.context.updateUserIdentity("email",this.state.emailOriginal),n},this._existsOriginalEmail=()=>{this.repository.checkEmail(this.state.emailOriginal).then(a=>{const i=a.data===1;this.setState({notFoundEmailColision:!i})})},this.onOriginalEmailChange=a=>{this.setState({emailOriginal:a},()=>{this.existsOriginalEmail(),this.isValidEmail()})},this.onCopyEmailChange=a=>{this.setState({emailCopy:a},this.isValidEmail)},this.repository=new F,this.refPersonalInfo=null,this.existsOriginalEmail=Xe(()=>this._existsOriginalEmail(),1e3),this.ibanRef=null,this.state={errorEmailMatch:"",errorEmailVal:"",emailOriginal:this.props.userIdentity.email,emailCopy:"",notFoundEmailColision:!0}}componentDidUpdate(t){this.props.userIdentity.email!==t.userIdentity.email&&this.setState({emailOriginal:this.props.userIdentity.email})}isValidated(){return this.refPersonalInfo.isValidated()&&this.isValidEmail()&&this.ibanRef.isValidated()}_validateData(){return{emailMatch:this.props.userIdentity.email===this.state.emailOriginal?!0:this.state.emailOriginal===this.state.emailCopy,emailVal:S.isValidEmail(this.state.emailOriginal)}}_validationErrors(t){return{emailMatchMsg:t.emailMatch?"":e.jsx(R,{text:va}),emailValMsg:t.emailVal?"":e.jsx(R,{text:ya})}}render(){const t=this.state.errorEmailVal?this.state.errorEmailVal:this.state.notFoundEmailColision?this.state.errorEmailMatch:Ca;return e.jsxs("div",{children:[e.jsx(ba,{ref:a=>{a&&(this.refPersonalInfo=a)},busy:this.props.busy,setBusyButton:this.props.setBusyButton,updateUserIdentity:this.context.updateUserIdentity,userIdentity:this.props.userIdentity,snapShotUserIdentity:{...this.props.userIdentity}}),e.jsxs(h,{gridTemplateColumns:["1fr","1fr 1fr"],gridColumnGap:"30px",children:[e.jsx(r,{mb:"15px",children:e.jsx(f,{label:Sa,required:!0,type:"text",name:"emailOriginal",id:"emailOriginal",value:this.state.emailOriginal,onCh
1ange:a=>this.onOriginalEmailChange(a.target.value),error:!!t,message:t})}),this.props.userIdentity.email!==this.state.emailOriginal&&e.jsx(r,{mb:"15px",children:e.jsx(f,{label:Aa,required:!0,type:"text",name:"emailCopy",id:"emailCopy",value:this.state.emailCopy,onChange:a=>this.onCopyEmailChange(a.target.value),onPaste:a=>a.preventDefault()})})]}),e.jsx(ia,{}),e.jsx(h,{gridTemplateColumns:{_:"1fr",tablet:"50%"},my:"xl",children:e.jsxs(r,{children:[e.jsx(x,{as:"h2",mb:"md",children:Ia}),e.jsx(Ze,{required:!1,ref:a=>{a&&(this.ibanRef=a)},iban:this.props.userIdentity.iban,updateIban:a=>this.context.updateUserIdentity("iban",a)})]})})]})}};se.contextType=y;let K=se;const ie=class ie extends p.Component{constructor(t){super(t),this.setBusyButton=a=>{this.setState({busy:a})},this.refPersonalInfo=null,this.state={busy:!1}}handleSaveClick(){this.refPersonalInfo.isValidated()&&(this.setState({busy:!0}),this.context.storeUserIdentity().then(()=>{j.notifySuccess(),this.setState({busy:!1})}).catch(a=>{a.message==="NIF_DUPLICADO"&&this.context.setErrorNif("Este identificador fiscal ya existe")}).finally(()=>{this.setState({busy:!1})}))}render(){return e.jsx(A,{children:e.jsxs(r,{children:[e.jsx(r,{mb:"md",children:e.jsx(x,{as:"h2",weight:"bold",children:e.jsx(e.Fragment,{children:"Datos personales que necesita Hacienda"})})}),e.jsx(K,{userIdentity:this.context.userIdentity,ref:t=>{t&&(this.refPersonalInfo=t)},...this.props,busy:this.state.busy,setBusyButton:this.setBusyButton}),e.jsx(r,{display:"flex",children:e.jsx(b,{id:"guardar-btn",onClick:this.handleSaveClick.bind(this),isLoading:this.state.busy,label:"Guardar"})})]})})}};ie.contextType=ae;let X=ie;const Da=()=>e.jsx(oa,{children:e.jsx(X,{})}),fe=e.jsx(e.Fragment,{children:"Error número de hijos"});class Ea extends p.Component{constructor(t){super(t),this.state={errorHijosMenores:"",errorHijos:""}}componentDidMount(){this.isValidated(this.props.hijos,this.props.hijosMenores)}isValidated(t,a){const i=+t>=+a;return this.setState({errorHijosMenores:i?"":e.jsx(R,{text:fe}),errorHijos:i?"":e.jsx(R,{text:fe})}),i}sendForm(){this.isValidated(this.props.hijos,this.props.hijosMenores)&&this.props.save()}render(){const t=[{id:"civilStatusYes",label:"Sí",name:"civilStatus",checked:this.props.casado===!0,value:!0},{id:"civilStatusNo",label:"No",name:"civilStatus",checked:this.props.casado===!1,value:!1}];return e.jsxs(r,{children:[e.jsx(r,{children:e.jsx(x,{as:"h3",mb:"xl",style:{fontSize:"24px"},children:e.jsx(e.Fragment,{children:"Información sobre tu situación personal"})})}),e.jsx(r,{}),e.jsxs(h,{children:[e.jsx(C,{id:"civilStatus",label:"¿Estás casado?",variant:"radio",selectors:t,onChange:a=>{const i=a[0]==="civilStatusYes";this.props.updateEstadoCivil(i)}}),e.jsxs(r,{display:"flex",flexDirection:"column",mt:"md",style:{gap:"4px",alignItems:"flex-start"},children:[e.jsx(r,{children:e.jsxs(d,{children:[e.jsx(e.Fragment,{children:"¿Cuántos hijos menores de 25 viven contigo y ganan menos de 8.000€ al año? "}),e.jsxs(r,{display:"inline-flex",style:{gap:"8px"},children:[e.jsx("span",{style:{color:"#EE3756",fontSize:"14px",fontWeight:"600px"},children:"*"}),e.jsx(le,{content:`Indica si, a 31 de diciembre, tienes hijos menores de 25 años que convivan
2                                            contigo y que tengan ingresos inferiores a 8.000€`})]})]})}),e.jsxs(r,{children:[e.jsx(f,{type:"number",id:"hijosMenores25",value:this.props.hijos,onChange:a=>{const i=a.target.value;let n=this.props.hijosMenores;i||(this.props.updateHijosMenores(0),n=0),this.props.updateHijos(a.target.value),this.isValidated(i,n)}}),this.state.errorHijos]})]}),this.props.hijos>0&&e.jsxs(r,{display:"flex",flexDirection:"column",mt:"md",style:{gap:"4px",alignItems:"flex-start"},children:[e.jsx(r,{display:"flex",children:e.jsxs(d,{children:[e.jsx(e.Fragment,{children:"Y de estos, ¿Cuántos hijos menores de 3 años viven contigo? "}),e.jsxs(r,{display:"inline-flex",style:{gap:"8px"},children:[e.jsx("span",{style:{color:"#EE3756",fontSize:"14px",fontWeight:"600px"},children:"*"}),e.jsx(le,{content:`Del total de hijos que has indicado en la pregunta anterior, cuántos
3                                                tienen menos de 3 años`})]})]})}),e.jsxs(r,{children:[e.jsx(f,{type:"number",id:"hijoMenores8",value:this.props.hijosMenores,onChange:a=>{const i=a.target.value;this.props.updateHijosMenores(i),this.isValidated(this.props.hijos,i)}}),this.state.errorHijosMenores]})]}),e.jsx(r,{pt:"xl",children:e.jsx(b,{label:"Guardar",isLoading:this.props.busy,onClick:this.sendForm.bind(this)})})]})]})}}class Ma extends p.Component{constructor(t){super(t),this.rentaRepository=new lt,this.refRentaData=null,this.state={casado:!1,hijosMenores:0,hijos:0,busy:!1,loadError:!1}}componentDidMount(){this.loadData()}loadErr=()=>{this.setState(()=>({busy:!1,loadError:!0}))};loadData=()=>{this.setState(()=>({busy:!0,loadError:!1}),()=>{this.rentaRepository.getBasicData().then(t=>{if(t.data){const a=t.data;this.setState({casado:a.matrimonio,hijosMenores:a.hijosMenores,hijos:a.hijos,busy:!1})}else this.loadErr()}).catch(()=>{this.loadErr()})})};saveData=async()=>{this.setState({busy:!0}
3),await this.rentaRepository.saveData(this.state.casado,this.state.hijosMenores,this.state.hijos).then(()=>{j.notifySuccess()}),this.setState({busy:!1})};updateEstadoCivil=t=>{this.setState({casado:t})};updateHijosMenores=t=>{t>=0&&this.setState({hijosMenores:t})};updateHijos=t=>{t>=0&&this.setState({hijos:t})};buildContent=()=>e.jsx(Ea,{ref:t=>{this.refRentaData=t},casado:this.state.casado,hijosMenores:this.state.hijosMenores,hijos:this.state.hijos,updateEstadoCivil:this.updateEstadoCivil,updateHijosMenores:this.updateHijosMenores,updateHijos:this.updateHijos,save:this.saveData,busy:this.state.busy});getContent=()=>this.state.busy?e.jsx(ee,{}):this.state.loadError?e.jsx(te,{onClick:this.loadData}):this.buildContent();render(){const t=this.getContent();return e.jsx(A,{children:t})}}const Pa=()=>e.jsx(r,{display:"flex",width:"100",children:e.jsxs(A,{children:[e.jsx(x,{as:"h3",children:"Integraciones"}),e.jsxs(r,{display:"flex",marginTop:"24px",flexDirection:"column",gap:"13px",width:"70%",children:[e.jsx(r,{children:e.jsxs(r,{paddingY:"20px",gap:"13px",display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(r,{children:["Acceso a movimientos de cuentas (Powens)",e.jsx(U,{children:"Permite acceder a los movimientos bancarios de tu empresa y agrupar todas las cuentas bancarias dentro de la plataforma de Declarando"})]}),e.jsx(r,{children:e.jsx(ce,{disabled:!0,checked:!0})})]})}),e.jsx(de,{}),e.jsxs(r,{paddingY:"20px",gap:"13px",display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(r,{children:["Aplicación móvil de recuperación del IVA (DevoluIVA)",e.jsx(U,{children:"Permite la conversión de gastos detallados en la plataforma de Declarando en factura para recuperar el IVA nacional e internacional"})]}),e.jsx(r,{children:e.jsx(ce,{disabled:!0,checked:!0})})]}),e.jsx(de,{})]})]})});class ka extends be{getActions(t){const a=$e.setQueryParams(t);return this.get("/user/actions?"+a)}}class wa extends je{constructor(t=new ka){super(),this.repository=t}getListado(t){return this.execute(()=>this.repository.getActions(t))}}const Fa={inicio_sesion:{text:"Nuevo inicio de sesión"},carga_datos:{text:"Carga de datos"}},w={ingreso_editado:{text:"Editar 1 ingreso",seccion:"/ingresos/ingresos"},ingreso_creado:{text:"Crear 1 ingreso",seccion:"/ingresos/ingresos"},ingreso_borrado:{text:"Borrar 1 ingreso",seccion:"/ingresos/ingresos"},factura_editada:{text:"Editar 1 ingreso",seccion:"/ingresos/ingresos"},factura_creada:{text:"Crear 1 ingreso",seccion:"/ingresos/ingresos"},factura_borrada:{text:"Borrar 1 ingreso",seccion:"/ingresos/ingresos"},gasto_editado:{text:"Editar 1 gasto",seccion:"/gastos/gastos"},gasto_creado:{text:"Crear 1 gasto",seccion:"/gastos/gastos"},gasto_borrado:{text:"Borrar 1 gasto",seccion:"/gastos/gastos"}},Ra=()=>{const{push:s}=Ce(),t=(i,n,o)=>{const c=m.formatFullDateToFriendlyOutput(o);return e.jsx(d,{small:!0,bold:!0,children:c})},a=(i,n,o)=>{const c=m.getHourFromDate(n.fecha);return o==="inicio_sesion"||o==="carga_datos"?e.jsxs(d,{small:!0,children:[c,"h ",Fa[o].text,n.data._ip?e.jsxs(U,{children:["IP ",n.data._ip," "]}):e.jsx(d,{children:" "})]}):e.jsx(e.Fragment,{children:w[o]?e.jsxs(d,{small:!0,children:[c,"h acción en la sección"," ",e.jsx(ve,{href:w[o].seccion,onClick:l=>{l.preventDefault(),s(w[o].seccion)},children:w[o].seccion}),e.jsx(U,{children:w[o].text})]}):e.jsx(d,{children:o})})};return e.jsxs(A,{children:[e.jsx(x,{as:"h3",children:"Registros de acceso"}),e.jsxs(d,{small:!0,textColor:"body2",children:["Estos son los registros de acceso a tu cuenta Declarando durante los últimos días."," "]}),e.jsx(r,{display:"flex",marginTop:"24px",flexDirection:"column",gap:"13px",children:e.jsx(ct,{disabledHead:!0,id:"incomes-operators-list-table",handleGet:(i,n)=>new wa().getListado({page:i,rows:n}),filters:{},orders:[],cols:[{name:"Fecha",data:"fecha",md:2,handler:t},{name:"Acción",data:"accion",md:2,handler:a}]})})]})},Va=()=>e.jsx(h,{margin:"md",justifyContent:"space-between",p:"lg",pb:0,bg:"white",gridTemplateColumns:["1fr","max-content max-content"],children:e.jsx(A,{children:e.jsxs(_,{children:[e.jsx(x,{as:"h2",children:"Aplicación móvil de recuperación del IVA"}),e.jsx(d,{children:"Enhorabuena. La aplicación móvil de conversión de tiquets a factura 
3se ha activado correctamente."})]})})}),_a=s=>{const[t,a]=p.useState(0),i=et(),n=Ce(),{userStatus:o,loadUserInfo:c,userInfo:l}=p.useContext(y);p.useEffect(()=>()=>{c()},[]);const g={name:"Conversión tiquets",section:e.jsx(Va,{}),enabled:!0,path:"/user/profile/integracion-movil"},k=l?.id==="111925",D=[{name:e.jsx(e.Fragment,{children:"Datos personales"}),track_params:I.datos_personales,section:e.jsx(Da,{...s}),enabled:!0,path:"/user/profile/datos-personales"},{name:e.jsx(e.Fragment,{children:"Vivienda"}),track_params:I.vivienda,section:e.jsx(Zt,{...s,history:n}),enabled:!0,path:"/user/profile/vivienda"},{name:"Datos fiscales",track_params:I.datos_fiscales,section:e.jsx(Lt,{...s}),enabled:!0,path:"/user/profile/alta-autonomo"},{name:e.jsx(e.Fragment,{children:"Actividad"}),track_params:I.actividad,section:e.jsx(kt,{...s}),enabled:!0,path:"/user/profile/actividad"},{name:e.jsx(e.Fragment,{children:"Estilo de Facturas"}),track_params:I.estilo_facturas,section:e.jsx(qt,{...s}),enabled:!0,path:"/user/profile/estilos-facturas"},{name:e.jsx(e.Fragment,{children:"Renta"}),track_params:I.renta_configuracion,section:e.jsx(Ma,{...s}),enabled:o.renta,path:"/user/profile/renta"},{name:"Tienda online",track_params:I.ecommerce,section:e.jsx(vt,{}),enabled:!0,path:"/user/profile/ecommerce",tag:{size:"small",variant:"notification",children:"Novedad"}},{name:"Integraciones",track_params:I.integraciones,section:e.jsx(Pa,{}),enabled:!0,path:"/user/profile/integraciones"},{name:"Registros de acceso",track_params:I.registros_de_acceso,section:e.jsx(Ra,{}),enabled:!0,path:"/user/profile/registro-de-acceso"},k?g:null],W="/user/profile/";p.useEffect(()=>{const M=D.filter(v=>v?.enabled).findIndex(v=>v.path===W+i?.tab);a(M>=0?M:0)},[i?.tab,D,o.renta]);const E=D.filter(M=>M?.enabled);return e.jsx(nt,{activeSection:t,setActiveSection:a,tabs:E,title:e.jsx(e.Fragment,{children:"Perfil"}),...s})};export{_a 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.