1import{r as i,j as e}from"./vendor-query-Z3GGpY1C.js";import{l as G,k as I,r as V,C as L}from"./index-BcefymES.js";import{L as x}from"./loader-circle-Bxlvln1-.js";import{C as y}from"./circle-check-big-Bo3oAiTN.js";import"./vendor-radix-Dl5I7pIb.js";const N=["12:00","12:30","13:00","13:30","14:00","14:30","15:00","15:30","16:00","16:30","17:00","17:30","18:00","18:30","19:00","19:30","20:00","20:30","21:00"];function k(){return new Date().toISOString().split("T")[0]}function W(){const[,u]=G("/reservation/edit/:token"),o=(u==null?void 0:u.token)??"",{language:S}=I(),s=(t,n,m,O)=>({nl:t,en:n,fr:m,de:O})[S]??n,[C,E]=i.useState(!0),[R,p]=i.useState(!1),[f,b]=i.useState(!1),[z,T]=i.useState(!1),[A,P]=i.useState(!1),[D,l]=i.useState(!1),[g,v]=i.useState(!1),[w,a]=i.useState(""),[r,h]=i.useState({name:"",email:"",guests:2,date:k(),time:"19:00",note:"",venue:"riverside"});i.useEffect(()=>{o&&fetch(`/api/reservations/edit/${o}`).then(t=>t.ok?t.json():(p(!0),null)).then(t=>{t&&h(n=>({...n,...t}))}).catch(()=>p(!0)).finally(()=>E(!1))},[o]);const j=r.venue==="riverside"?N.filter(t=>V(r.date,t)):[],d=N.filter(t=>!j.includes(t)),B=j.length>0;i.useEffect(()=>{r.time&&!d.includes(r.time)&&h(t=>({...t,time:d.includes("20:00")?"20:00":d[0]??""}))},[r.date,r.venue]);const c=(t,n)=>h(m=>({...m,[t]:n})),F=async()=>{v(!0),a("");try{const t=await fetch(`/api/reservations/cancel/${o}`,{method:"POST"});if(t.status===400){const n=await t.json().catch(()=>({}));n.error==="too_late"?a(s("Te laat om online te annuleren. Bel ons op voor last-minute wijzigingen.","Too late to cancel online. Please call us for last-minute changes.","Trop tard pour annuler en ligne. Veuillez nous appeler.","Zu spät für eine Online-Stornierung. Bitte rufen Sie uns an.")):n.error==="group_too_large"?a(s("Voor groepen van 9 of meer personen vragen wij u contact op te nemen via [email protected].","For groups of 9 or more, please contact us at [email protected].","Pour les groupes de 9 personnes ou plus, veuillez nous contacter à [email protected].","Für Gruppen ab 9 Personen kontaktieren Sie uns bitte unter [email protected].")):a(s("Er is iets misgegaan. Probeer opnieuw.","Something went wrong. Please try again.","Une erreur s'est produite. Veuillez réessayer.","Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.")),l(!1)}else if(t.ok)P(!0);else throw new Error("failed")}catch{a(s("Er is iets misgegaan. Probeer opnieuw.","Something went wrong. Please try again.","Une erreur s'est produite. Veuillez réessayer.","Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.")),l(!1)}finally{v(!1)}},U=async t=>{t.preventDefault(),b(!0),a("");try{if(!(await fetch(`/api/reservations/edit/${o}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guests:r.guests,date:r.date,time:r.time,note:r.note})})).ok)throw new Error("failed");T(!0)}catch{a(s("Er is iets misgegaan. Probeer opnieuw.","Something went wrong. Please try again.","Une erreur s'est produite. Veuillez réessayer.","Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut."))}finally{b(!1)}};return e.jsx("div",{className:"min-h-screen flex items-center justify-center p-4",style:{backgroundColor:"#1a0a03"},children:e.jsxs("div",{className:"w-full max-w-md bg-[#2a1206] border border-hotel-gold/20 rounded-2xl shadow-2xl overflow-hidden",children:[e.jsxs("div",{className:"px-6 pt-6 pb-4 border-b border-hotel-gold/15 text-center",children:[e.jsx("p",{className:"text-hotel-gold text-[10px] tracking-[0.25em] uppercase font-medium mb-1",children:"Elfde Gebod · Riverside"}),e.jsx("h1",{className:"text-white font-serif text-xl font-bold",children:s("Reservering wijzigen","Change your reservation","Modifier votre réservation","Reservierung ändern")})]}),e.jsx("div",{className:"px-6 py-6",children:C?e.jsx("div",{className:"flex justify-center py-10",children:e.jsx(x,{className:"h-8 w-8 text-hotel-gold animate-spin"})}):A?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(y,{className:"h-10 w-10 text-white/40 mx-auto mb-3"}),e.jsx("p",{className:"text-white font-serif text-lg font-bold mb-2",children:s("Geannuleerd","Reservation cancelled","Réservation annulée","Storniert")}),e.jsx("p",{className:"text-white/50 text-sm",children:s("Uw reservering is geannuleerd. U ontvangt een bevestiging per e-mail.","Your reservation has been cancelled. A confirmation has been sent to your email.","Votre réservation a été annulée. Une confirmation a été envoyée à votre adresse e-mail.","Ihre Reservierung wurde storniert. Eine Bestätigung wurde an Ihre E-Mail gesendet.")})]}):R?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(L,{className:"h-10 w-10 text-red-400 mx-auto mb-3"}),e.jsx("p",{className:"text-white font-serif text-lg font-bold mb-2",children:s("Niet gevonden","N
1ot found","Introuvable","Nicht gefunden")}),e.jsx("p",{className:"text-white/50 text-sm",children:s("Deze reservering bestaat niet of is al geannuleerd.","This reservation does not exist or has been cancelled.","Cette réservation n'existe pas ou a déjà été annulée.","Diese Reservierung existiert nicht oder wurde bereits storniert.")})]}):z?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(y,{className:"h-10 w-10 text-hotel-gold mx-auto mb-3"}),e.jsx("p",{className:"text-white font-serif text-lg font-bold mb-2",children:s("Gewijzigd!","Updated!","Modifié !","Aktualisiert!")}),e.jsx("p",{className:"text-white/50 text-sm",children:s("Uw reservering is bijgewerkt. Tot binnenkort!","Your reservation has been updated. See you soon!","Votre réservation a été mise à jour. à bientôt !","Ihre Reservierung wurde aktualisiert. Bis bald!")})]}):e.jsxs("form",{onSubmit:U,className:"space-y-4",children:[e.jsxs("div",{className:"bg-white/5 rounded-xl px-4 py-3 text-sm text-white/70",children:[e.jsx("span",{className:"text-hotel-gold font-medium",children:r.name})," · ",r.email]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"col-span-1",children:[e.jsx("label",{className:"text-white/60 text-xs tracking-wider uppercase block mb-1.5",children:s("Gasten","Guests","Personnes","Gäste")}),e.jsx("select",{value:r.guests,onChange:t=>c("guests",parseInt(t.target.value)),className:"w-full bg-[#1a0a03] border border-hotel-gold/20 rounded-lg px-3 py-2.5 text-white text-sm focus:outline-none focus:border-hotel-gold/50",children:Array.from({length:20},(t,n)=>n+1).map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"text-white/60 text-xs tracking-wider uppercase block mb-1.5",children:s("Datum","Date","Date","Datum")}),e.jsx("input",{required:!0,type:"date",min:k(),value:r.date,onChange:t=>c("date",t.target.value),onClick:t=>{const n=t.currentTarget;if(typeof n.showPicker=="function")try{n.showPicker()}catch{}},style:{colorScheme:"dark"},className:"w-full bg-[#1a0a03] border border-hotel-gold/20 rounded-lg px-3 py-2.5 text-white text-sm focus:outline-none focus:border-hotel-gold/50 cursor-pointer"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-white/60 text-xs tracking-wider uppercase block mb-2",children:s("Tijd","Time","Heure","Uhrzeit")}),e.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:d.map(t=>e.jsx("button",{type:"button",onClick:()=>c("time",t),className:`py-1.5 rounded-lg text-xs font-medium transition-all ${r.time===t?"bg-hotel-gold text-[#1a0a03]":"bg-white/5 text-white/60 border border-hotel-gold/15 hover:border-hotel-gold/40"}`,children:t},t))}),B&&e.jsx("p",{className:"text-white/40 text-[11px] mt-2",children:s("Op vrijdag en zaterdag zijn reserveringen tussen 18:15 en 19:45 niet beschikbaar.","On Friday and Saturday, reservations between 18:15 and 19:45 are not available.","Le vendredi et le samedi, les réservations entre 18h15 et 19h45 ne sont pas disponibles.","Freitags und samstags sind Reservierungen zwischen 18:15 und 19:45 Uhr nicht verfügbar.")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-white/60 text-xs tracking-wider uppercase block mb-1.5",children:s("Opmerkingen","Notes","Remarques","Anmerkungen")}),e.jsx("textarea",{value:r.note,onChange:t=>c("note",t.target.value),rows:2,placeholder:s("Allergieën, speciale wensen...","Allergies, special requests...","Allergies, demandes spéciales...","Allergien, besondere Wünsche..."),className:"w-full bg-white/5 border border-hotel-gold/20 rounded-lg px-4 py-2.5 text-white text-sm placeholder:text-white/25 focus:outline-none focus:border-hotel-gold/50 resize-none"})]}),w&&e.jsx("p",{className:"text-red-400 text-xs bg-red-900/20 border border-red-500/20 rounded-lg px-3 py-2",children:w}),e.jsxs("button",{type:"submit",disabled:f,className:"w-full bg-hotel-gold text-[#1a0a03] py-3 rounded-full font-bold text-sm tracking-wide hover:bg-[#d4b050] transition-colors disabled:opacity-60 flex items-center justify-center gap-2",children:[f&&e.jsx(x,{className:"h-4 w-4 animate-spin"}),s("Wijzigingen opslaan","Save changes","Enregistrer les modifications","Ãnderungen speichern")]}),D?e.jsxs("div",{className:"bg-red-950/30 border border-red-500/20 rounded-xl p-4 space-y-3",children:[e.jsx("p",{className:"text-white/80 text-sm text-center",children:s("Zeker weten? Deze actie kan niet ongedaan worden gemaakt.","Are you sure? This cannot be undone.","Ãtes-vous sûr ? Cette action est irréversible.","Sind Sie sicher? Diese Aktion kann nicht rückgängig gemacht werden.")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>l(!1),disabled:g,className:"flex-1 border border-white/20 text-white/60 py-2 rounded-full text-sm font-medium hover:border-white/40 transition-colors disabled:opacity-50",children:s("Terug","Go back","Retour","Zurück")}),e.jsxs("button",{type:"button",onClick:F,disabled:g,className:"flex-1 bg-red-600 text-white py-2 rounded-full text-sm font-bold hover:bg-red-700 transition-colors disabled:opacity-60 flex items-center justify-center gap-1.5",children:[g&&e.jsx(x,{className:"h-3.5 w-3.5 animate-spin"}),s("Ja, annuleren","Yes, cancel","Oui, annuler","Ja, stornieren")]})]})]}):e.jsx("button",{type:"button",onClick:()=>l(!0),className:"w-full text-white/35 text-xs py-1.5 hover:text-red-400 transition-colors",children:s("Reservering annuleren","Cancel reservation","Annuler la réservation","Reservierung stornieren")})]})})]})})}export{W as default};
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.