PageSourceSearch

https://globetrotter-engine.lovable.app/assets/EsimCheckout-CfV5hh_F.js

js globetrotter-engine.lovable.app collected 2026-10-03 03:27:57 UTC 8,224 bytes, 1 lines download raw bytes

1import{u as C,O as P,r as $,aq as M,j as e,S as w,N as _,a as m,t as o,w as x,b as u,B as g,F as S,aM as I,ao as q,a7 as A,e as O,$ as n,s as l,L as h,aO as D,I as p,_ as L,Z as T,ar as z,a5 as B,aK as j,ab as N}from"./index-XdapicsC.js";import{D as R}from"./database-p5Cwpbxq.js";function G(i){if(typeof i=="number")return i;if(typeof i=="string"){const f=i.replace(/[^0-9.,]/g,"").replace(",",".");return parseFloat(f)||0}return 0}function U(){const i=C(),s=P().state,[t,c]=$.useState({guestName:"",guestEmail:"",guestPhone:""}),v=s!=null&&s.package?G(s.package.price):0,r=v*((s==null?void 0:s.quantity)||1),d=M({mutationFn:async()=>{const{data:{user:a}}=await N.auth.getUser(),{data:b,error:y}=await N.from("esim_orders").insert({package_id:s.package.id,plan_code:s.package.plan_code,customer_name:t.guestName,customer_email:t.guestEmail,customer_phone:t.guestPhone,quantity:s.quantity,total_amount:r,order_status:"pending",payment_status:"pending",user_id:(a==null?void 0:a.id)||null,is_guest:!a}).select().single();if(y)throw y;const{data:F,error:k}=await N.from("reservations").insert({booking_type:"esim",booking_id:b.id,booking_date:new Date().toISOString(),customer_name:t.guestName,customer_email:t.guestEmail,customer_phone:t.guestPhone,total_amount:r,status:"pending",payment_status:"pending",user_id:(a==null?void 0:a.id)||null,is_guest:!a}).select().single();if(k)throw k;return{order:b,reservation:F}},onSuccess:({reservation:a})=>{j.success("Sipariş oluşturuldu!"),i(`/checkout?reservation_id=${a.id}&amount=${r}&customer_name=${t.guestName}&customer_email=${t.guestEmail}&customer_phone=${t.guestPhone}`)},onError:a=>
1{j.error(a.message||"Sipariş oluşturulamadı")}}),E=a=>{if(a.preventDefault(),!t.guestName||!t.guestEmail){j.error("Lütfen zorunlu alanları doldurun");return}d.mutate()};return s?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(w,{title:`Sipariş Onayı - ${s.package.name}`,description:"eSIM sipariş onay sayfası"}),e.jsx(_,{}),e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs(g,{variant:"ghost",onClick:()=>i(-1),className:"mb-6",children:[e.jsx(I,{className:"h-4 w-4 mr-2"}),"Geri Dön"]}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsxs(m,{children:[e.jsx(o,{children:e.jsx(x,{children:"eSIM Sipariş Özeti"})}),e.jsxs(u,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"p-3 bg-primary/10 rounded-lg",children:e.jsx(q,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold",children:s.package.name}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mt-1",children:[e.jsx(A,{className:"h-4 w-4"}),e.jsx("span",{children:s.package.region})]})]})]}),s.package.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s.package.description}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-muted/30 p-4 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[e.jsx(R,{className:"h-4 w-4"}),e.jsx("span",{children:"Veri"})]}),e.jsx("p",{className:"font-bold text-lg",children:s.package.data_amount})]}),e.jsxs("div",{className:"bg-muted/30 p-4 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[e.jsx(O,{className:"h-4 w-4"}),e.jsx("span",{children:"Süre"})]}),e.jsx("p",{className:"font-bold text-lg",children:s.package.duration})]}),e.jsxs("div",{className:"bg-muted/30 p-4 rounded-lg",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:e.jsx("span",{className:"text-sm",children:"Adet"})}),e.jsx("p",{className:"font-bold text-lg",children:s.quantity})]})]})]}),e.jsx(n,{}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-3",children:"eSIM Avantajları"}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{variant:"secondary",className:"w-fit",children:"✓"}),e.jsx("span",{children:"Anında aktivasyon"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{variant:"secondary",className:"w-fit",children:"✓"}),e.jsx("span",{children:"Fiziksel SIM karta gerek yok"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{variant:"secondary",className:"w-fit",children:"✓"}),e.jsx("span",{children:"QR kod ile kolay kurulum"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{variant:"secondary",className:"w-fit",children:"✓"}),e.jsx("span",{children:"7/24 destek"})]})]})]}),e.jsx(n,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"font-semibold",children:"Fiyat Detayları"}),e.jsx("div",{className:"space-y-2 text-sm",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-muted-foreground",children:["$",v.toFixed(2)," x ",s.quantity," adet"]}),e.jsxs("span",{children:["$",r.toFixed(2)]})]})}),e.jsx(n,{}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"font-semibold text-lg",children:"Toplam Tutar"}),e.jsxs("span",{className:"text-2xl font-bold text-primary",children:["$",r.toFixed(2)]})]})]})]})]})}),e.jsx("div",{className:"lg:col-span-1",children:e.jsxs(m,{className:"sticky top-4",children:[e.jsx(o,{children:e.jsx(x,{children:"İletişim Bilgileri"})}),e.jsx(u,{children:e.jsxs("form",{onSubmit:E,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{htmlFor:"guestName",className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-4 w-4"}),"Ad Soyad *"]}),e.jsx(p,{id:"guestName",value:t.guestName,onChange:a=>c({...t,guestName:a.target.value}),placeholder:"Ad Soyad",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{htmlFor:"guestEmail",className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-4 w-4"}),"E-posta *"]}),e.jsx(p,{id:"guestEmail",type:"email",value:t.guestEmail,onChange:a=>c({...t,guestEmail:a.target.value}),placeholder:"[email protected]",required:!0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"QR kod bu e-posta adresine gönderilecektir"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{htmlFor:"guestPhone",className:"flex items-center gap-2",children:[e.jsx(T,{className:"h-4 w-4"}),"Telefon"]}),e.jsx(p,{id:"guestPhone",type:"tel",value:t.guestPhone,onChange:a=>c({...t,guestPhone:a.target.value}),placeholder:"+90 555 123 45 67"})]}),e.jsx(n,{className:"my-6"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-muted/30 p-4 rounded-lg",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Toplam Tutar"}),e.jsxs("span",{className:"text-2xl font-bold text-primary",children:["$",r.toFixed(2)]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Vergiler dahildir"})]}),e.jsx(g,{type:"submit",className:"w-full",size:"lg",disabled:d.isPending,children:d.isPending?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"h-4 w-4 mr-2 animate-spin"}),"Sipariş Oluşturuluyor..."]}):e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"h-4 w-4 mr-2"}),"Ödemeye Geç"]})}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Ödeme sonrası QR kod e-postanıza gönderilecektir"})]})]})})]})})]})]}),e.jsx(S,{})]}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(w,{title:"Hata - eSIM Siparişi",de
1scription:"Sipariş bilgileri eksik"}),e.jsx(_,{}),e.jsx("div",{className:"container mx-auto px-4 py-16",children:e.jsxs(m,{className:"max-w-md mx-auto",children:[e.jsx(o,{children:e.jsx(x,{children:"Hata"})}),e.jsxs(u,{children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"Sipariş bilgileri bulunamadı."}),e.jsx(g,{onClick:()=>i("/esim"),className:"w-full",children:"eSIM Paketlerine Dön"})]})]})}),e.jsx(S,{})]})}export{U 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.