import{c as b}from"./modules-n_9BHTn9.js";import{C as w}from"./ClientLayout-CInqszsu.js";import{L as D}from"./LoadingSpinner-BwucH-rm.js";import{E as A}from"./ErrorMessage-DdwsDJ1D.js";import{S as C}from"./StatusBadge-D3hMSVIw.js";import{_ as V,l as h,m as B,d as v,g as u,r as _,h as E,o,a as e,e as i,c as l,f as c,j as g,F as S,n as L,t as m,p as N}from"./index-BjuSGa5E.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"},z={class:"detail-row"},O={class:"detail-value"},q={key:4,class:"reserve-link"},G={__name:"InicioView",setup(J){const r=_(!0),d=_(""),f=_([]),y=new Date;y.setHours(0,0,0,0);const p=N(()=>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}));h(k),B(k);async function k(){r.value=!0,d.value="";try{const s=await b.getAppointments();f.value=s.data||[]}catch{d.value="Error al cargar las citas"}finally{r.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=E("router-link");return o(),v(w,null,{default:u(()=>[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)),r.value?(o(),v(D,{key:0})):i("",!0),d.value?(o(),v(A,{key:1,message:d.value},null,8,["message"])):i("",!0),!r.value&&p.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:u(()=>[...t[0]||(t[0]=[g("Reservar Cita",-1)])]),_:1})])):i("",!0),!r.value&&p.value.length>0?(o(),l("div",I,[(o(!0),l(S,null,L(p.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(C,{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",z,[t[3]||(t[3]=e("span",{class:"title-sm"},"HORA",-1)),e("span",O,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:u(()=>[...t[4]||(t[4]=[g(" Ver detalles ",-1)])]),_:1})]))),128))])):i("",!0),!r.value&&p.value.length>0?(o(),l("div",q,[c(a,{to:"/client/book",class:"btn btn-gold"},{default:u(()=>[...t[5]||(t[5]=[g("Reservar otra cita",-1)])]),_:1})])):i("",!0)]),_:1})}}},Y=V(G,[["__scopeId","data-v-0839f205"]]);export{Y as default};
