import{_ as h,m as x,q as w,s as D,f as v,i as r,r as f,j as A,o,b as e,h as l,l as m,g as d,c as u,F as V,x as C,t as _,y as B}from"./index-BSoZUQlM.js";import{C as E}from"./ClientLayout-Bem4ha1T.js";import{L as S}from"./LoadingSpinner-Cc4Dbt2l.js";import{E as L}from"./ErrorMessage-5CbE-StE.js";import{S as N}from"./StatusBadge-EcRctg7x.js";import"./LogoutButton-cwsYC0rL.js";const H={class:"home-head"},I={key:2,class:"no-appointment"},T={key:3,class:"appointments-list"},$={class:"appointment-header"},F={class:"appointment-service"},R={class:"appointment-barber"},M={class:"appointment-details"},j={class:"detail-row"},q={class:"detail-value"},O={class:"detail-row"},z={class:"detail-value"},G={key:4,class:"reserve-link"},J={__name:"InicioView",setup(K){const i=f(!0),p=f(""),g=f([]),y=new Date;y.setHours(0,0,0,0);const c=B(()=>g.value.filter(s=>{const t=s.status,a=new Date(s.appointment_date);return a.setHours(0,0,0,0),(t==="pending"||t==="confirmed")&&a>=y}).sort((s,t)=>{const a=new Date(`${s.appointment_date}T${s.start_time}`),n=new Date(`${t.appointment_date}T${t.start_time}`);return a-n}));x(k),w(k);async function k(){i.value=!0,p.value="";try{const s=await D.getAppointments();g.value=s.data||[]}catch{p.value="Error al cargar las citas"}finally{i.value=!1}}function b(s){return new Date(s).toLocaleDateString("es-ES",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}return(s,t)=>{const a=A("router-link");return o(),v(E,null,{default:r(()=>[e("header",H,[t[1]||(t[1]=e("h2",{class:"home-head__title"},"Inicio",-1)),t[2]||(t[2]=e("p",{class:"title-sm home-head__subtitle"},"Tus citas próximas",-1)),l(a,{to:"/client/expediente",class:"home-head__link"},{default:r(()=>[...t[0]||(t[0]=[m("Ver expediente y fotos →",-1)])]),_:1})]),i.value?(o(),v(S,{key:0})):d("",!0),p.value?(o(),v(L,{key:1,message:p.value},null,8,["message"])):d("",!0),!i.value&&c.value.length===0?(o(),u("div",I,[t[4]||(t[4]=e("p",{class:"no-text"},"No tenés citas próximas",-1)),l(a,{to:"/client/book",class:"btn btn-gold"},{default:r(()=>[...t[3]||(t[3]=[m("Reservar Cita",-1)])]),_:1})])):d("",!0),!i.value&&c.value.length>0?(o(),u("div",T,[(o(!0),u(V,null,C(c.value,n=>(o(),u("div",{key:n.id,class:"card appointment-card"},[e("div",$,[e("div",null,[e("h3",F,_(n.service?.name),1),e("p",R,_(n.barber?.user?.name),1)]),l(N,{status:n.status},null,8,["status"])]),e("div",M,[e("div",j,[t[5]||(t[5]=e("span",{class:"title-sm"},"FECHA",-1)),e("span",q,_(b(n.appointment_date)),1)]),e("div",O,[t[6]||(t[6]=e("span",{class:"title-sm"},"HORA",-1)),e("span",z,_(n.start_time),1)])]),l(a,{to:"/client/my-appointment",class:"btn btn-outline",style:{"margin-top":"16px",display:"block","text-align":"center","text-decoration":"none"}},{default:r(()=>[...t[7]||(t[7]=[m(" Ver detalles ",-1)])]),_:1})]))),128))])):d("",!0),!i.value&&c.value.length>0?(o(),u("div",G,[l(a,{to:"/client/book",class:"btn btn-gold"},{default:r(()=>[...t[8]||(t[8]=[m("Reservar otra cita",-1)])]),_:1})])):d("",!0)]),_:1})}}},Z=h(J,[["__scopeId","data-v-0a67c38a"]]);export{Z as default};
