import{$ as T,Z as k,r as w,a as d,o as A,f as Q,a0 as R,a3 as b,a1 as c,a4 as r,ae as S,a5 as n,a8 as I,ac as l,a6 as x,am as F,a9 as M,af as j,an as E,ao as f,ah as L}from"./index-Dga5rwnp.js";import{Q as O}from"./QSelect-DXNgklLP.js";import{u as X}from"./taxstore-CmFaC9hz.js";import{A as Z}from"./AddressInput-B89Gh5lw.js";import{C as $}from"./CommentAttachment-BLKHYLmH.js";import{u as z}from"./vue-i18n.runtime-Ded595FH.js";import{_ as G}from"./IndexPage-Jyy5NEPK.js";import"./QList-DXKv2E5u.js";import"./LocalStorage-BQmANGBd.js";import"./userstore-DQkB_PaC.js";const H={class:"row items-center"},J={class:"col"},K={class:"text-h5"},W={class:"col-auto"},Y={class:"row items-center q-gutter-md q-mb-sm q-ml-none"},ee={class:"col q-ml-none"},ae={key:0,class:"q-mt-sm"},te=T({__name:"TaxpayerStep",props:{step:{}},emits:["next","prev"],setup(V,{emit:N}){const _=V,v=N,y=_.step,i=X(),e=k({}),{t:s}=z(),u=w(null),D=(o="Required")=>{const a=s("validation.required");return a&&a!=="validation.required"?a:o},m=o=>a=>{const t=o||D();return a==null?t:typeof a=="string"?a.trim()!==""||t:Array.isArray(a)?a.length>0||t:!0},p=d(()=>!!e.prevPreparedByUs),g=d(()=>p.value?[]:[m()]),q=d(()=>p.value?[]:[m()]),B=d(()=>p.value?[]:[m()]);A(async()=>{const o=i.getTaxpayer()||{};Object.assign(e,o),await Q(),u.value?.resetValidation?.()});async function U(){try{if(await(u.value?.validate?.()??!0)===!1)return}catch{return}i.setTaxpayer({prevPreparedByUs:e.prevPreparedByUs,prevDeclaration:e.prevDeclaration,firstName:e.firstName,lastName:e.lastName,birthDate:e.birthDate,address:e.address}),v("next",y.next)}function h(){i.setTaxpayer({prevPreparedByUs:e.prevPreparedByUs,prevDeclaration:e.prevDeclaration,firstName:e.firstName,lastName:e.lastName,birthDate:e.birthDate,address:e.address}),v("prev",y.prev)}function C(){}function P(){}return(o,a)=>(b(),R(L,{flat:"",class:"full-width q-pa-none"},{default:c(()=>[r(S,{class:"full-width"},{default:c(()=>[n("div",H,[n("div",J,[n("div",K,I(l(s)("TAX")),1)]),n("div",W,[r(x,{flat:"",color:"secondary",label:l(s)("button.prev"),onClick:h,class:"q-mr-sm"},null,8,["label"]),r(x,{color:"primary",label:l(s)("button.next"),onClick:U},null,8,["label"])])]),r(F,{class:"q-my-sm"}),r(O,{ref_key:"formRef",ref:u,class:"q-gutter-md q-mt-md"},{default:c(()=>[n("div",Y,[n("div",ee,[r(E,{modelValue:e.prevPreparedByUs,"onUpdate:modelValue":a[0]||(a[0]=t=>e.prevPreparedByUs=t),label:l(s)("taxpayer.prevPreparedByUs")},null,8,["modelValue","label"])])]),e.prevPreparedByUs?(b(),M("div",ae,[r($,{modelValue:e.prevDeclaration,"onUpdate:modelValue":a[1]||(a[1]=t=>e.prevDeclaration=t),label:l(s)("taxpayer.prevDeclaration"),id:"taxpayer"},null,8,["modelValue","label"])])):j("",!0),n("div",null,[r(f,{modelValue:e.firstName,"onUpdate:modelValue":a[2]||(a[2]=t=>e.firstName=t),label:l(s)("taxpayer.firstName"),rules:g.value},null,8,["modelValue","label","rules"]),r(f,{modelValue:e.lastName,"onUpdate:modelValue":a[3]||(a[3]=t=>e.lastName=t),label:l(s)("taxpayer.lastName"),rules:q.value},null,8,["modelValue","label","rules"]),r(f,{modelValue:e.birthDate,"onUpdate:modelValue":a[4]||(a[4]=t=>e.birthDate=t),type:"date",label:l(s)("taxpayer.birthDate"),rules:B.value},null,8,["modelValue","label","rules"]),r(Z,{modelValue:e.address,"onUpdate:modelValue":a[5]||(a[5]=t=>e.address=t),label:l(s)("taxpayer.address"),allowForeign:!0,onSave:P,onCancel:C},null,8,["modelValue","label"])])]),_:1},512)]),_:1})]),_:1}))}}),ce=G(te,[["__scopeId","data-v-e1b08f4f"]]);export{ce as default};
