1import{g as j,A as D,o as a,c as o,a as w,u as t,h as L,j as N,b as e,t as i,F as h,k as V,d as _,e as g,n as f,w as k,G as A,H as M,p as b}from"./app-eHacUajv.js";import{S as P}from"./ShopLayout-DFQQOB-m.js";import{u as B}from"./i18n-DiJuqdZO.js";import"./consent-DRHcYphK.js";import"./FlashMessages-CUs57ZZn.js";import"./wfSearch-BsAdOZ3O.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";const F={class:"max-w-2xl mx-auto py-8"},R={class:"text-2xl font-bold"},U={class:"text-gray-500 text-sm mt-1"},z={key:0,class:"mt-6 text-sm text-gray-500"},O={class:"flex items-center gap-3"},T=["src","alt"],q={class:"font-semibold text-sm truncate"},E=["aria-label"],G=["onClick"],H=["onUpdate:modelValue","placeholder"],I={class:"mt-2"},J={class:"text-xs text-gray-500"},K=["onChange"],Q={key:0,class:"mt-1 text-sm text-red-600"},W={key:0,class:"bg-white border border-gray-200 rounded-lg p-4"},X={class:"text-sm font-semibold px-1"},Y=["value"],Z={class:"text-gray-500"},ee=["disabled"],te={key:1,class:"mt-6 space-y-4"},se={class:"flex items-center gap-3"},ae=["src","alt"],oe={class:"min-w-0"},re={class:"font-semibold text-sm truncate"},ie={class:"text-xs text-gray-500"},le=["aria-label"],ne={key:0,class:"mt-2 text-sm text-gray-700 whitespace-pre-line"},pe={__name:"OrderReview",props:{store:Object,categories:Array,orderNumber:String,token:String,reviewable:Boolean,items:Array,authorDisplays:{type:Array,default:()=>[]},reviewPhotoLimits:{type:Object,default:()=>({count:3,maxMb:12})}},setup(d){const u=d,n=B(),y=b(()=>u.items.filter(c=>!c.reviewed)),x=b(()=>u.items.filter(c=>c.reviewed)),v=()=>({token:u.token||void 0,author_display:"initial",items:y.value.map(c=>({product_id:c.id,rating:0,body:"",photos:[]}))}),r=j(v());D(y,()=>{r.defaults(v()),r.reset()});const $=b(()=>r.items.some(c=>c.rating>0));function C(c,p){r.items[c].photos=Array.from(p.target.files).slice(0,u.reviewPhotoLimits.count)}function S(){r.post(`/objednavka/${u.orderNumber}/recenze${u.token?`?token=${encodeURIComponent(u.token)}`:""}`,{preserveScroll:!0,forceFormData:!0})}return(c,p)=>(a(),o(h,null,[w(t(L),{title:`${t(n)("review_order_title")} - ${d.store.name}`},null,8,["title"]),w(P,{store:d.store,categories:d.categories},{default:N(()=>[e("div",F,[e("h1",R,i(t(n)("review_order_title")),1),e("p",U,i(t(n)("review_order_intro",{number:d.orderNumber})),1),d.reviewable?(a(),o(h,{key:1},[y.value.length?(a(),o("form",{key:0,class:"mt-6 space-y-4",onSubmit:V(S,["prevent"])},[(a(!0),o(h,null,_(y.value,(s,l)=>(a(),o("div",{key:s.id,class:"bg-white border border-gray-200 rounded-lg p-4"},[e("div",O,[s.image?(a(),o("img",{key:0,src:s.image,alt:s.name,class:"h-12 w-12 rounded object-contain bg-gray-50"},null,8,T)):g("",!0),e("div",q,i(s.name),1)]),e("div",{class:"flex items-center gap-1 mt-3",role:"radiogroup","aria-label":t(n)("review_rating")},[(a(),o(h,null,_(5,m=>e("button",{key:m,type:"button",class:f(["text-2xl leading-none",m<=t(r).items[l].rating?"text-amber-500":"text-gray-300 hover:text-amber-300"]),onClick:de=>t(r).items[l].rating=m},"â
",10,G)),64))],8,E),k(e("textarea",{"onUpdate:modelValue":m=>t(r).items[l].body=m,rows:"2",placeholder:t(n)("review_text"),class:"mt-2 w-full rounded border-gray-300 text-base"},null,8,H),[[A,t(r).items[l].body]]),e("div",I,[e("label",J,i(t(n)("review_photos",{count:d.reviewPhotoLimits.count,size:d.reviewPhotoLimits.maxMb})),1),e("input",{type:"file",accept:"image/*",multiple:"",class:"mt-1 block text-xs text-gray-600",onChange:m=>C(l,m)},null,40,K),t(r).errors[`items.${l}.photos.0`]?(a(),o("p",Q,i(t(r).errors[`items.${l}.photos.0`]),1)):g("",!0)])]))),128)),d.authorDisplays.length?(a(),o("fieldset",W,[e("legend",X,i(t(n)("review_author_label")),1),(a(!0),o(h,null,_(d.authorDisplays,s=>(a(),o("label",{key:s.value,class:"flex items-center gap-2 mt-2 text-sm cursor-pointer"},[k(e("input",{"onUpdate:modelValue":p[0]||(p[0]=l=>t(r).author_display=l),type:"radio",value:s.value,class:"text-gray-900"},null,8,Y),[[M,t(r).author_display]]),e("span",null,i(t(n)(`review_author_${s.value}`)),1),e("span",Z,"- "+i(s.preview),1)]))),128))])):g("",!0),e("button",{type:"submit",disabled:t(r).processing||!$.value,class:"px-5 py-2.5 rounded bg-gray-900 text-white text-sm font-medium disabled:opacity-40"},i(t(n)("review_send")),9,ee)],32)):g("",!0),x.value.length?(a(),o("div",te,[(a(!0),o(h,null,_(x.value,s=>(a(),o("div",{key:s.id,class:"bg-gray-50 border border-gray-200 rounded-lg p-4"},[e("div",se,[s.image?(a(),o("img",{key:0,src:s.image,alt:s.name,class:"h-12 w-12 rounded object-contain bg-white"},null,8,ae)):g("",!0),e("div",oe,[e("div",re,i(s.name),1),e("div",ie,i(t(n)("review_thanks")),1)])]),e("div",{class:"mt-3 text-amber-500 text-xl leading-none","aria-label":`${s.rating}/5`},[(a(),o(h,null,_(5,l=>e("span",{key:l,class:f(l<=s.rating?"":"text-gray-300")},"â
",2)),64))],8,le),s.body?(a(),o("p",ne,i(s.body),1)):g("",!0)]))),128))])):g("",!0)],64)):(a(),o("p",z,i(t(n)("review_requires_purchase")),1))])]),_:1},8,["store","categories"])],64))}};export{pe 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.