import{as as P,$ as q,r as A,a as M,o as S,f as Q,w as b,a0 as v,a3 as c,a1 as f,a4 as n,ae as U,a5 as r,a8 as B,ac as e,a6 as E,am as K,a9 as D,af as _,an as m,ao as O,ah as R}from"./index-Dga5rwnp.js";import{Q as I,a as N}from"./QSelect-DXNgklLP.js";import{P as C}from"./LocalStorage-BQmANGBd.js";import{u as H}from"./vue-i18n.runtime-Ded595FH.js";import{_ as T}from"./IndexPage-Jyy5NEPK.js";import"./QList-DXKv2E5u.js";const y="professionalExpenses:v1",h={expensesChanged:!1,workplaceDescription:"",commuteMethod:null,commuteKm:null,lunchAtHome:!1,eatsOut:!1,hasCanteenOrVouchers:!1};function F(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}const L=P("professionalexpensesstore",{state:()=>{try{let t=C.getItem(y);if(typeof t=="string")try{t=JSON.parse(t)}catch{t=null}if(F(t)){const i={...h,...t};return{data:{...i,hasCanteenOrVouchers:i.hasCanteenOrVouchers===!0}}}}catch{}return{data:{...h}}},actions:{persist(){try{C.set(y,this.data)}catch(t){console.error("professionalExpenses.store: persist error",t)}},getProfessionalExpenses(){return this.data},setProfessionalExpenses(t){this.data={...this.data,...t},this.persist()},replaceProfessionalExpenses(t){this.data=t,this.persist()},resetProfessionalExpenses(){this.data={...h},this.persist()}}}),j={class:"row items-center"},G={class:"col"},J={class:"text-h6"},W={class:"col-auto"},Y={class:"row items-center"},$={class:"col"},z={key:0,class:"q-mt-md"},X={class:"row"},Z={class:"col-6 q-pr-md"},ee={class:"col-6"},se={class:"column"},te=q({__name:"ProfessionalExpensesStep",props:{step:{}},emits:["next","prev"],setup(t,{emit:i}){const u=L(),x=t,V=i,{t:o}=H(),d=A(null),s=u.data,k=M(()=>[{label:o("professionalExpenses.commuteMethodOptions.car"),value:"CAR"},{label:o("professionalExpenses.commuteMethodOptions.bus"),value:"BUS"},{label:o("professionalExpenses.commuteMethodOptions.bike"),value:"BIKE"},{label:o("professionalExpenses.commuteMethodOptions.walk"),value:"WALK"}]);S(async()=>{await Q(),d.value?.resetValidation?.()}),b(()=>s,()=>{u.persist()},{deep:!0}),b(()=>s.eatsOut,p=>{p||(s.hasCanteenOrVouchers=!1)});async function w(){try{if(await(d.value?.validate?.()??!0)===!1)return}catch{return}u.setProfessionalExpenses(s),V("next",x.step?.next)}function g(){u.setProfessionalExpenses(s),V("prev",x.step?.prev)}return(p,a)=>(c(),v(R,{flat:"",class:"full-width q-pa-none"},{default:f(()=>[n(U,{class:"full-width"},{default:f(()=>[r("div",j,[r("div",G,[r("div",J,B(e(o)("PRO")),1)]),r("div",W,[n(E,{flat:"",label:e(o)("button.prev"),onClick:g,class:"q-mr-sm"},null,8,["label"]),n(E,{color:"primary",label:e(o)("button.next"),onClick:w},null,8,["label"])])]),n(K,{class:"q-my-sm"}),n(I,{ref_key:"formRef",ref:d,class:"q-gutter-md q-mt-md"},{default:f(()=>[r("div",Y,[r("div",$,[n(m,{modelValue:e(s).expensesChanged,"onUpdate:modelValue":a[0]||(a[0]=l=>e(s).expensesChanged=l),label:e(o)("professionalExpenses.expensesChanged")},null,8,["modelValue","label"])])]),e(s).expensesChanged?(c(),D("div",z,[n(O,{modelValue:e(s).workplaceDescription,"onUpdate:modelValue":a[1]||(a[1]=l=>e(s).workplaceDescription=l),label:e(o)("professionalExpenses.workplaceDescription"),type:"text",outlined:""},null,8,["modelValue","label"]),r("div",X,[r("div",Z,[n(N,{modelValue:e(s).commuteMethod,"onUpdate:modelValue":a[2]||(a[2]=l=>e(s).commuteMethod=l),options:k.value,label:e(o)("professionalExpenses.commuteMethod"),"emit-value":"","map-options":"",outlined:"",class:"q-mt-md"},null,8,["modelValue","options","label"])]),r("div",ee,[n(O,{modelValue:e(s).commuteKm,"onUpdate:modelValue":a[3]||(a[3]=l=>e(s).commuteKm=l),modelModifiers:{number:!0},label:e(o)("professionalExpenses.commuteKm"),type:"number",outlined:"",class:"q-mt-md"},null,8,["modelValue","label"])])]),r("div",se,[n(m,{modelValue:e(s).lunchAtHome,"onUpdate:modelValue":a[4]||(a[4]=l=>e(s).lunchAtHome=l),label:e(o)("professionalExpenses.lunchAtHome"),class:"q-mt-md"},null,8,["modelValue","label"]),n(m,{modelValue:e(s).eatsOut,"onUpdate:modelValue":a[5]||(a[5]=l=>e(s).eatsOut=l),label:e(o)("professionalExpenses.eatsOut"),class:"q-mt-md"},null,8,["modelValue","label"]),e(s).eatsOut?(c(),v(m,{key:0,modelValue:e(s).hasCanteenOrVouchers,"onUpdate:modelValue":a[6]||(a[6]=l=>e(s).hasCanteenOrVouchers=l),label:e(o)("professionalExpenses.hasCanteenOrVouchers"),class:"q-mt-md"},null,8,["modelValue","label"])):_("",!0)])])):_("",!0)]),_:1},512)]),_:1})]),_:1}))}}),ue=T(te,[["__scopeId","data-v-22af3ece"]]);export{ue as default};
