1import{d as B,K as S,P as A,u as D,j as b,ab as L,y as T,I as j,c as a,e as s,A as c,m as r,F as x,t as n,r as k,q as f,v as P,s as F,f as _,g as M,w as U,_ as q,B as z,h as $,z as E,o}from"./CzwuPRNn.js";import{u as K}from"./BLsM4lMr.js";const O={class:"bg-bg min-h-screen"},G={class:"container mx-auto px-4 py-12 md:py-16"},H={class:"max-w-xl mx-auto"},J={class:"display text-2xl md:text-4xl text-ink leading-tight"},Q={class:"text-elegant text-ink-2 leading-relaxed mt-3"},W={class:"mt-8 space-y-6"},X={class:"flex items-center gap-4"},Y={class:"w-14 h-[70px] rounded-md overflow-hidden bg-bgalt border border-line shrink-0 flex items-center justify-center"},Z=["src","alt"],ee={class:"display text-base text-ink leading-snug flex-1"},te={key:0,class:"inline-flex items-center gap-1 text-xs text-accent shrink-0"},se={key:0,class:"mt-4"},oe={class:"flex items-center gap-1"},ae=["onClick","aria-label"],ne={class:"block text-sm font-medium text-ink mt-4 mb-1.5"},re=["onUpdate:modelValue","placeholder"],le=["onClick","disabled"],ie={key:0,class:"mt-6"},de={class:"block text-sm font-medium text-ink mb-1.5"},ce=["placeholder"],pe={key:1,class:"text-sm text-accent mt-4"},ue={key:2,class:"text-elegant text-ink-2 mt-6"},he={key:1,class:"text-center py-16"},me={class:"text-muted mt-4 leading-relaxed"},ve=B({__name:"review",async setup(ge){let u,v;const C=S(),{api:y}=A(),{t:w}=D(),h=String(C.query.order??""),i=b(""),m=b(""),{data:I,pending:V}=([u,v]=L(()=>K(`shop-review-${h}`,()=>h?y(`/shop/review-context/${h}`).catch(()=>null):Promise.resolve(null))),u=await u,v(),u),d=b([]);T(I,e=>{d.value=(e?.items??[]).map(p=>({...p,rating:0,body:"",sending:!1,done:p.alreadyReviewed}))},{immediate:!0});const N=async e=>{if(!(!e.rating||!i.value.trim()||e.sending)){e.sending=!0,m.value="";try{await y("/shop/reviews",{method:"POST",body:{orderId:h,productId:e.productId,rating:e.rating,name:i.value.trim(),...e.body.trim()?{body:e.body.trim()}:{}}}),e.done=!0}catch{m.value=w("shop.reviewPage.error")}finally{e.sending=!1}}};return j({title:()=>w("shop.reviewPage.title")+" | RobeMarie",robots:"noindex, nofollow"}),(e,p)=>{const g=M,R=q;return o(),a("div",O,[s("div",G,[s("div",H,[r(d).length?(o(),a(x,{key:0},[s("h1",J,n(e.$t("shop.reviewPage.title")),1),s("p",Q,n(e.$t("shop.reviewPage.subtitle")),1),s("div",W,[(o(!0),a(x,null,k(r(d),t=>(o(),a("div",{key:t.productId,class:"bg-paper border border-line rounded-lg p-5 md:p-6"},[s("div",X,[s("div",Y,[t.image?(o(),a("img",{key:0,src:t.image,alt:t.name,class:"w-full h-full object-cover"},null,8,Z)):(o(),z(g,{key:1,name:"heroicons:sparkles",class:"w-5 h-5 text-muted"}))]),s("h2",ee,n(t.name),1),t.done?(o(),a("span",te,[_(g,{name:"heroicons:check",class:"w-4 h-4"}),$(" "+n(t.alreadyReviewed?e.$t("shop.reviewPage.alreadyReviewed"):e.$t("shop.reviewPage.submitted")),1)])):c("",!0)]),t.done?c("",!0):(o(),a("div",se,[s("div",oe,[(o(),a(x,null,k(5,l=>s("button",{key:l,onClick:_e=>t.rating=l,class:"p-0.5","aria-label":`${l}/5`},[_(g,{name:l<=t.rating?"heroicons:star-solid":"heroicons:star",class:E(["w-7 h-7 transition-colors",l<=t.rating?"text-accent":"text-ink/20 hover:text-ink/40"])},null,8,["name","class"])],8,ae)),64))]),s("label",ne,n(e.$t("shop.reviewPage.commentLabel")),1),f(s("textarea",{"onUpdate:modelValue":l=>t.body=l,rows:"3",placeholder:e.$t("shop.reviewPage.commentPlaceholder"),class:"w-full rounded-md border border-line bg-bg px-3 py-2.5 text-sm text-ink placeholder:text-muted focus:border-ink focus:ring-0"},null,8,re),[[P,t.body]]),s("button",{onClick:l=>N(t),disabled:!t.rating||!r(i).trim()||t.sending,class:"btn btn-primary w-full px-5 py-3 mt-3 text-sm disabled:opacity-50"},n(t.sending?e.$t("shop.reviewPage.sending"):e.$t("shop.reviewPage.submit")),9,le)]))]))),128))]),r(d).some(t=>!t.done)?(o(),a("div",ie,[s("label",de,n(e.$t("shop.reviewPage.yourName")),1),f(s("input",{"onUpdate:modelValue":p[0]||(p[0]=t=>F(i)?i.value=t:null),type:"text",placeholder:e.$t("shop.reviewPage.namePlaceholder"),class:"w-full rounded-md border border-line bg-paper px-3 py-2.5 text-sm text-ink placeholder:text-muted focus:border-ink focus:ring-0"},null,8,ce),[[P,r(i)]])])):c("",!0),r(m)?(o(),a("p",pe,n(r(m)),1)):c("",!0),r(d).length&&r(d).every(t=>t.done)?(o(),a("p",ue,n(e.$t("shop.reviewPage.allDone")),1)):c("",!0)],64)):r(V)?c("",!0):(o(),a("div",he,[_(g,{name:"heroicons:envelope-open",class:"w-10 h-10 text-muted mx-auto"}),s("p",me,n(e.$t("shop.reviewPage.notFound")),1),_(R,{to:"/shop",class:"btn btn-primary inline-flex mt-6 px-6 py-3"},{default:U(()=>[$(n(e.$t("shop.backToShop")),1)]),_:1})]))])])])}}});
1export{ve 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.