import{d as y,g as _,u as g,A as h,r as v,m as l,o as r,a as s,F as b,p as k,b as c,e as m,t as n,C as w,x as p,a7 as C,I as F,X as A,T as D}from"./index-URM8LaDt.js";import{c as N}from"./client-QI4n_O0h.js";const $={class:""},S={key:0,class:"flex flex-wrap justify-evenly w-full"},B={class:"p-6 mx-auto mt-6 bg-white rounded-2xl border border-sky-700 shadow-lg min-w-96"},T={class:"flex items-center mb-4 text-blue-600"},U={class:"space-y-4 text-gray-800"},V={class:"flex items-center"},q={class:"flex items-center"},z={class:"flex items-center"},E=["onClick"],H={key:1},L=y({__name:"FutureAppointments",setup(M){const a=_([]),d=N(),u=g(),f=async()=>{try{(await w(p(u,`users/${d.clientUid}/FutureAppointments`))).forEach(e=>{a.value.push({id:e.id,...e.data()}),console.log(e.data())}),console.log(a.value)}catch(t){console.log(t)}};h(()=>{f()});const x=async t=>{try{await C(F(u,`users/${d.clientUid}/FutureAppointments/${t}`)),await A(p(u,`users/${d.clientUid}/HistoryAppointments`),{...a.value.find(e=>e.id===t),id:t,finalizationDate:D.now()}),a.value=a.value.filter(e=>e.id!==t),f()}catch(e){console.log(e)}};return(t,e)=>{const i=v("v-icon");return r(),l("div",$,[e[4]||(e[4]=s("h2",{class:"text-2xl font-bold text-center text-white bg-sky-700"},"Próximas Citas",-1)),a.value.length?(r(),l("section",S,[(r(!0),l(b,null,k(a.value,o=>(r(),l("div",{key:o.id},[s("article",B,[s("div",T,[c(i,{name:"fa-user-check",class:"mr-2",scale:"1.2"}),e[0]||(e[0]=s("h3",{class:"text-lg font-semibold"},"Cita Confirmada",-1))]),s("div",U,[s("div",V,[c(i,{name:"fa-calendar-day",class:"mr-3 text-rose-500"}),s("p",null,[e[1]||(e[1]=s("span",{class:"font-medium"},"Fecha:",-1)),m(" "+n(o.day)+", "+n(o.dayNumber)+" de "+n(o.month)+" del "+n(o.year),1)])]),s("div",q,[c(i,{name:"fa-clock",class:"mr-3 text-green-600"}),s("p",null,[e[2]||(e[2]=s("span",{class:"font-medium"},"Hora:",-1)),m(" "+n(o.hour),1)])]),s("div",z,[c(i,{name:"fa-user-tie",class:"mr-3 text-purple-900"}),s("p",null,[e[3]||(e[3]=s("span",{class:"font-medium"},"Profesional:",-1)),m(" "+n(o.proffession),1)])]),s("button",{onClick:P=>x(o.id),class:"px-4 py-2 text-white bg-emerald-800 rounded transition hover:bg-emerald-700"},"Marcar como finalizada",8,E)])])]))),128))])):(r(),l("p",H,"No hay citas programadas"))])}}});export{L as default};
