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