import{_ as A,m as D,q as S,s as V,f as _,i as r,r as v,j as B,o as i,b as o,h as l,l as a,g as c,c as f,t as p,x as h}from"./index-BpX-8PVd.js";import{C}from"./ClientLayout-wQqeC4BS.js";import{L as E}from"./LoadingSpinner-CgzRbRTY.js";import{E as N}from"./ErrorMessage-CobjTTmY.js";import{S as $}from"./StatusBadge-Dq9A1VR1.js";import"./LogoutButton-CpnNrqee.js";const I={class:"home-actions","aria-label":"Accesos"},L={key:2,class:"home-section"},T={class:"home-next card"},H={class:"home-next__top"},M={class:"home-next__svc"},R={class:"home-next__meta"},j={class:"home-next__when"},q={key:3,class:"home-empty card"},P={key:4,class:"home-more"},W={__name:"InicioView",setup(z){const n=v(!0),m=v(""),y=v([]),x=new Date;x.setHours(0,0,0,0);const g=h(()=>y.value.filter(e=>{const t=e.status,s=new Date(e.appointment_date);return s.setHours(0,0,0,0),(t==="pending"||t==="confirmed")&&s>=x}).sort((e,t)=>{const s=new Date(`${e.appointment_date}T${e.start_time}`),d=new Date(`${t.appointment_date}T${t.start_time}`);return s-d})),u=h(()=>g.value[0]||null),k=h(()=>g.value.length);D(b),S(b);async function b(){n.value=!0,m.value="";try{const e=await V.getAppointments();y.value=e.data||[]}catch{m.value="Error al cargar las citas"}finally{n.value=!1}}function w(e){const s=new Date(e.appointment_date).toLocaleDateString("es-ES",{weekday:"short",day:"numeric",month:"short"}),d=String(e.start_time||"").slice(0,5);return`${s} · ${d}`}return(e,t)=>{const s=B("router-link");return i(),_(C,null,{default:r(()=>[t[9]||(t[9]=o("header",{class:"home-hero"},[o("h1",{class:"home-hero__title"},"Inicio"),o("p",{class:"home-hero__lead"},"Resumen de tu próxima visita y accesos rápidos")],-1)),o("nav",I,[l(s,{to:"/client/book",class:"home-actions__primary"},{default:r(()=>[...t[0]||(t[0]=[a("Nueva reserva",-1)])]),_:1}),l(s,{to:"/client/my-appointment",class:"home-actions__link"},{default:r(()=>[...t[1]||(t[1]=[a("Ver todas las citas",-1)])]),_:1}),l(s,{to:"/client/expediente",class:"home-actions__link"},{default:r(()=>[...t[2]||(t[2]=[a("Expediente y fotos",-1)])]),_:1})]),n.value?(i(),_(E,{key:0})):c("",!0),m.value?(i(),_(N,{key:1,message:m.value},null,8,["message"])):c("",!0),!n.value&&u.value?(i(),f("section",L,[t[3]||(t[3]=o("h2",{class:"home-section__label"},"Próxima cita",-1)),o("div",T,[o("div",H,[o("span",M,p(u.value.service?.name),1),l($,{status:u.value.status},null,8,["status"])]),o("p",R,p(u.value.barber?.user?.name),1),o("p",j,p(w(u.value)),1)])])):!n.value&&!m.value?(i(),f("div",q,[t[5]||(t[5]=o("p",{class:"home-empty__text"},"No tenés citas próximas.",-1)),l(s,{to:"/client/book",class:"btn btn-gold home-empty__btn"},{default:r(()=>[...t[4]||(t[4]=[a("Reservar",-1)])]),_:1})])):c("",!0),!n.value&&k.value>1?(i(),f("p",P,[t[7]||(t[7]=a(" Tenés ",-1)),o("strong",null,p(k.value),1),t[8]||(t[8]=a(" citas próximas. ",-1)),l(s,{to:"/client/my-appointment"},{default:r(()=>[...t[6]||(t[6]=[a("Ver listado completo",-1)])]),_:1})])):c("",!0)]),_:1})}}},U=A(W,[["__scopeId","data-v-0f6abb0a"]]);export{U as default};
