1import{_ as F}from"./D34e-F7J.js";import{a5 as M,d as a,c as t,j as w,p as B,t as l,f as b,F as x,g as y,av as N,aw as z,ax as Y,z as d,L as A,I as G,o,a as D}from"./j9eeThX6.js";import{u as K,d as j}from"./DEDF2X20.js";import{u as P}from"./DTz9PHPz.js";import"./BcJ5BBtZ.js";const H={class:"max-w-2xl mx-auto py-8 px-4"},$={key:0,class:"bg-white rounded-xl shadow-sm border border-cardBorder p-8 text-center"},q={key:1,class:"bg-white rounded-xl shadow-sm border border-cardBorder p-8 text-center"},J={key:0,class:"max-w-sm mx-auto bg-orange-50 border-2 border-dashed border-primary rounded-2xl p-5 my-5"},Q={class:"text-xl sm:text-2xl font-black tracking-wider sm:tracking-widest text-textDark font-mono break-all"},W={key:2,class:"space-y-4"},X={key:0,class:"text-sm text-textLight"},Z={key:0,class:"space-y-3 animate-pulse"},ee={key:1,class:"bg-white rounded-xl shadow-sm border border-cardBorder p-6 text-center"},te={class:"text-textLight"},re={class:"bg-white rounded-xl shadow-sm border border-cardBorder divide-y divide-cardBorder"},se=["checked","onChange"],ae=["src","alt"],oe={class:"flex-1 min-w-0"},de={class:"text-sm font-medium text-textDark line-clamp-2"},le={class:"text-xs text-textLight"},ie=["onUpdate:modelValue"],ne=["value"],ue={class:"bg-white rounded-xl shadow-sm border border-cardBorder p-4"},ce=["value"],me={key:0,class:"text-error text-sm"},be=["disabled"],ke={__name:"iade",setup(xe){K({title:"İade Talebi"});const c=P(),k=d(!1),v=d(!0),p=d(!1),L=d(!1),n=d(""),S=d([]),T=d(!1),V=d(""),_=d(""),h=d(""),g=d(""),f=d(""),i=G({}),C=["Ãrün beklediÄim gibi deÄil","YanlıŠürün gönderildi","Ãrün hasarlı geldi","YanlıŠbeden/ölçü","DiÄer"],I=r=>new Intl.NumberFormat("tr-TR",{style:"currency",currency:"TRY"}).format(r||0),E=A(()=>Object.values(i).some(r=>r>0)&&g.value!==""),O=r=>{i[r.order_item_id]=i[r.order_item_id]>0?0:1},R=async()=>{v.value=!0;try{const r=await j("/ecommerce/guest/returns/eligible-items",{headers:c.headers()});r?.success&&(S.value=r.data.items||[],T.value=r.data.is_eligible,V.value=r.data.reason,_.value=r.data.order_number)}catch(r){if(r.status===401||r.data?.error_code==="INVALID_RETURN_TOKEN"){c.clear(),k.value=!1;return}n.value="Ãrünler yüklenemedi."}finally{v.value=!1}},U=async()=>{n.value="",p.value=!0;const r=Object.entries(i).filter(([,e])=>e>0).map(([e,m])=>({order_item_id:Number(e),quantity:m}));try{const e=await j("/ecommerce/guest/returns",{method:"POST",headers:c.headers(),body:{items:r,reason:g.value,customer_note:f.value}});e?.success?(h.value=e.meta?.return_barcode||"",L.value=!0,c.clear()):n.value=e?.message||"İade talebi oluÅturulamadı."}catch(e){n.value=e.data?.message||"İade talebi oluÅturulamadı."}finally{p.value=!1}};return M(async()=>{const r=c.read();if(k.value=!!r,!r){v.value=!1;return}_.value=r.orderNumber,await R()}),(r,e)=>{const m=F;return o(),a("div",H,[k.value?L.value?(o(),a("div",q,[e[7]||(e[7]=t("div",{class:"w-16 h-16 bg-success/10 text-success rounded-full flex items-center justify-center mx-auto mb-4"},[t("svg",{class:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"3"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"})])],-1)),e[8]||(e[8]=t("h1",{class:"text-xl font-bold text-textDark mb-2"},"İade talebiniz alındı",-1)),h.value?(o(),a("div",J,[e[5]||(e[5]=t("div",{class:"text-xs text-textLight mb-1"},"İade Kargo Barkodunuz",-1)),t("div",Q,l(h.value),1)])):b("",!0),e[9]||(e[9]=t("p",{class:"text-sm text-textLight mb-5"}," Barkodu kargo Åubesine göstererek ürünü ücretsiz gönderebilirsiniz. ",-1)),w(m,{to:"/",class:"inline-block text-primary font-medium hover:underline"},{default:B(()=>[...e[6]||(e[6]=[D(" AlıÅveriÅe Dön ",-1)])]),_:1})])):(o(),a("div",W,[t("div",null,[w(m,{to:"/siparis-takibi",class:"text-sm text-textLight hover:text-primary"},{default:B(()=>[...e[10]||(e[10]=[D(" â SipariÅe dön ",-1)])]),_:1}),e[11]||(e[11]=t("h1",{class:"text-2xl font-bold text-textDark mt-2"},"İade Talebi",-1)),_.value?(o(),a("p",X,"SipariÅ No: "+l(_.value),1)):b("",!0)]),v.value?(o(),a("div",Z,[(o(),a(x,null,y(3,s=>t("div",{key:s,class:"h-24 bg-gray-50 rounded-xl border border-gray-100"})),64))])):T.value?(o(),a(x,{key:2},[t("div",re,[(o(!0),a(x,null,y(S.value,s=>(o(),a("div",{key:s.order_item_id,class:"p-4 flex gap-3 items-center"},[t("input",{type:"checkbox",checked:i[s.order_item_id]>0,onChange:u=>O(s),class:"w-5 h-5 accent-primary shrink-0"},null,40,se),s.image?(o(),a("img",{key:0,src:s.image,alt:s.product_name,class:"w-14 h-14 shrink-0 object-cover rounded-md border border-cardBorder"},null,8,ae)):b("",!0),t("div",oe,[t("p",de,l(s.product_name),1),t("p",le,l(I(s.unit_price)),1)]),i[s.order_item_id]>0?N((o(),a("select",{key:1,"onUpdate:modelValue":u=>i[s.order_item_id]=u,class:"shrink-0 border border-cardBorder rounded-md px-2 py-1 text-sm bg-white"},[(o(!0),a(x,null,y(s.returnable_quantity,u=>(o(),a("option",{key:u,value:u},l(u)+" adet",9,ne))),128))],8,ie)),[[z,i[s.order_item_id],void 0,{number:!0}]]):b("",!0)]))),128))]),t("div",ue,[e[13]||(e[13]=t("label",{class:"block text-sm font-medium text-textDark mb-1"},"İade sebebi",-1)),N(t("select",{"onUpdate:modelValue":e[0]||(e[0]=s=>g.value=s),class:"w-full border border-cardBorder rounded-md px-3 py-2 bg-white mb-3"},[e[12]||(e[12]=t("option",{value:""},"Seçiniz",-1)),(o(),a(x,null,y(C,s=>t("option",{key:s,value:s},l(s),9,ce)),64))],512),[[z,g.value]]),N(t("textarea",{"onUpdate:modelValue":e[1]||(e[1]=s=>f.value=s),rows:"2",placeholder:"Eklemek istediÄiniz not (opsiyonel)",class:"w-full border border-cardBorder rounded-md px-3 py-2"},null,512),[[Y,f.value,void 0,{trim:!0}]])]),n.value?(o(),a("p",me,l(n.value),1)):b("",!0),t("button",{disabled:!E.value||p.value,onClick:U,class:"w-full bg-primary text-white py-3 rounded-md font-medium hover:bg-accent transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},l(p.value?"Gönderiliyor...":"İade Talebi OluÅtur"),9,be)],64)):(o(),a("div",ee,[t("p",te,l(V.value||"Bu sipariÅ için iade oluÅturulamıyor."),1)]))])):(o(),a("div",$,[e[3]||(e[3]=t("h1",{class:"text-xl font-bold text-textDark mb-2"},"DoÄrulama gerekli",-1)),e[4]||(e[4]=t("p",{class:"text-sm text-textLight mb-5"}
1,"İade için sipariÅinizi tekrar sorgulayın",-1)),w(m,{to:"/siparis-takibi",class:"inline-block bg-primary text-white px-6 py-2.5 rounded-md font-medium hover:bg-accent transition-colors"},{default:B(()=>[...e[2]||(e[2]=[D(" SipariÅ Sorgula ",-1)])]),_:1})]))])}}};export{ke 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.