PageSourceSearch

https://myponza.it/assets/dashboard.prenotazioni-Uq7NxB_u.js

js myponza.it collected 2026-10-09 22:05:08 UTC 6,897 bytes, 1 lines download raw bytes

1import{u as I,p as U,r as l,s as h,w as P,y as _,j as e,B as S,L as c,a8 as w,bT as k,$ as T,S as R}from"./index-DCOXvstu.js";import{C as m,a as C}from"./card-CFlrTX5K.js";import{B as D}from"./badge-zOf-jLuz.js";import{T as V,a as G,b as f,c as j}from"./tabs-DdGEObKD.js";import{B as H}from"./bed-double-BkFDF0DR.js";import{C as L}from"./calendar-DHCD-D0F.js";import{U as $}from"./users-Dy7_NxrY.js";import"./index-DzHEi-MD.js";const A={pending:"bg-warning/15 text-warning-foreground border-warning/30",confirmed:"bg-success/15 text-success border-success/30",cancelled:"bg-destructive/15 text-destructive border-destructive/30",completed:"bg-muted text-muted-foreground border-border",refunded:"bg-muted text-muted-foreground border-border"};function ee(){const{t:a,i18n:d}=I(),{user:i,isAuthenticated:r,loading:s}=U(),[o,t]=l.useState([]),[u,v]=l.useState([]),[x,g]=l.useState(!0);l.useEffect(()=>{s||!r||!i||(async()=>{g(!0);const{data:n}=await h.from("profiles").select("id").eq("user_id",i.id).maybeSingle();if(!n){t([]),v([]),g(!1);return}const[{data:K},{data:q}]=await Promise.all([h.from("bookings").select("id,start_date,end_date,guests_count,total_cents,status,property:property_id(id,slug,name,images)").eq("guest_profile_id",n.id).order("start_date",{ascending:!1}),h.from("service_bookings").select("id,scheduled_at,participants,total_cents,status,service:business_service_id(id,name),business:business_id(id,name,slug,images)").eq("guest_profile_id",n.id).order("scheduled_at",{ascending:!1})]);t(K??[]),v(q??[]),g(!1)})()},[i,r,s]);const b=P(),p=new Date;p.setHours(0,0,0,0);const N=o.filter(n=>_(n.end_date,b)>=0),y=o.filter(n=>_(n.end_date,b)<0),z=u.filter(n=>new Date(n.scheduled_at)>=p),E=u.filter(n=>new Date(n.scheduled_at)<p);return e.jsxs("div",{children:[e.jsx("h1",{className:"font-display text-3xl font-semibold text-foreground",children:a("stay.myBookings.title")}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:a("stay.myBookings.subtitle")}),e.jsxs(V,{defaultValue:"upcoming",className:"mt-8",children:[e.jsxs(G,{children:[e.jsxs(f,{value:"upcoming",children:[a("stay.myBookings.tabs.upcoming")," (",N.length,")"]}),e.jsxs(f,{value:"past",children:[a("stay.myBookings.tabs.past")," (",y.length,")"]}),e.jsxs(f,{value:"experiences",children:[a("nav.experiences")," (",u.length,")"]})]}),e.jsx(j,{value:"upcoming",className:"mt-6",children:e.jsx(B,{items:N,loading:x,t:a,lang:d.language})}),e.jsx(j,{value:"past",className:"mt-6",children:e.jsx(B,{items:y,loading:x,t:a,lang:d.language})}),e.jsx(j,{value:"experiences",className:"mt-6",children:e.jsx(M,{upcoming:z,past:E,loading:x,t:a,lang:d.language})})]})]})}function B({items:a,loading:d,t:i,lang:r}){return d?e.jsx("p",{className:"text-sm text-muted-foreground",children:i("common.loading")}):a.length===0?e.jsx(m,{className:"border-dashed border-border/60",children:e.jsxs(C,{className:"grid place-items-center gap-3 p-12 text-center",children:[e.jsx(H,{className:"h-10 w-10 text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i("stay.myBookings.empty")}),e.jsx(S,{asChild:!0,size:"sm",children:e.jsx(c,{to:"/dormire",search:{guests:2},children:i("stay.myBookings.browse")})})]})}):e.jsx("div",{className:"grid gap-4",children:a.map(s=>e.jsx(m,{className:"border-border/60 overflow-hidden pt-0 pb-0",children:e.jsxs("div",{className:"grid gap-4 p-4 sm:grid-cols-[120px_1fr_auto] sm:items-center",children:[e.jsx("div",{className:"aspect-[16/10] overflow-hidden rounded-lg bg-muted",children:s.property?.images?.[0]?e.jsx("img",{src:s.property.images[0],alt:"",className:"h-full w-full object-cover"}):null}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-display text-base font-semibold text-foreground",children:s.property?.slug?e.jsx(c,{to:"/dormire/$slug",params:{slug:s.property.slug},className:"hover:text-primary",children:s.property?.name}):s.property?.name??"—"}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(L,{className:"h-3 w-3"})," ",w(k(s.start_date),r)," → ",w(k(s.end_date),r)]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx($,{className:"h-3 w-3"})," ",s.guests_count]})]}),e.jsx(D,{variant:"outline",className:`mt-2 ${A[s.status]}`,children:i(`stay.booking.status.${s.status}`)})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:i("stay.myBookings.total")}),e.jsx("div",{className:"font-display text-lg font-semibold text-foreground",children:T(s.total_cents,r)})]})]})},s.id))})}function M({upcoming:a,past:d,loading:i,t:r,lang:s}){if(i)return e.jsx("p",{className:"text-sm text-muted-foreground",children:r("common.loading")});const o=[...a,...d];return o.length===0?e.jsx(m,{className:"border-dashed border-border/60",children:e.jsxs(C,{className:"grid place-items-center gap-3 p-12 text-center",children:[e.jsx(R,{className:"h-10 w-10 text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r("experiences.hub.empty")}),e.jsx(S,{asChild:!0,size:"sm",children:e.jsx(c,{to:"/esperienze",children:r("nav.experiences")})})]})}):e.jsx("div",{className:"grid gap-4",children:o.map(t=>e.jsx(m,{className:"border-border/60 overflow-hidden pt-0 pb-0",children:e.jsxs("div",{className:"grid gap-4 p-4 sm:grid-cols-[120px_1fr_auto] sm:items-center",children:[e.jsx("div",{className:"aspect-[16/10] overflow-hidden rounded-lg bg-muted",children:t.business?.images?.[0]?e.jsx("img",{src:t.business.images[0],alt:"",className:"h-full w-full object-cover"}):null}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-display text-base font-semibold text-foreground",children:t.service?.id?e.jsx(c,{to:"/esperienze/$id",params:{id:t.service.id}
1,className:"hover:text-primary",children:t.service?.name}):t.service?.name??"—"}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:t.business?.name}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(L,{className:"h-3 w-3"}),new Date(t.scheduled_at).toLocaleString(s==="en"?"en-GB":"it-IT",{day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit"})]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx($,{className:"h-3 w-3"})," ",t.participants]})]}),e.jsx(D,{variant:"outline",className:`mt-2 ${A[t.status]}`,children:r(`experiences.booking.status.${t.status}`)})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:r("experiences.booking.total")}),e.jsx("div",{className:"font-display text-lg font-semibold text-foreground",children:T(t.total_cents,s)})]})]})},t.id))})}export{ee as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.