1import{J as L,D as S,N as M,o as V,c,a as m,b as t,h as b,w as k,v as y,f as o,E as j,F as _,r as R,x as v,l as i,t as n,g as U,i as B,m as x,j as H,d as p,_ as P}from"./BiSZ_CVW.js";const T={class:"w-full flex justify-center p-4 bg-gray-100"},z={class:"flex flex-row min-h-[100vh] lg:w-[70%] w-full justify-center flex-grow"},E={class:"mr-4 p-6 bg-white w-1/4 hidden rounded-md shadow-lg min-w-[20ch] max-w-[30ch] lg:flex flex-col"},F={class:"p-8 bg-white rounded-md shadow-md w-full min-h-[90vh] lg:w-3/4"},I={key:0,class:"border rounded shadow bg-white max-h-48 overflow-y-auto"},O=["onClick"],q={key:1,class:"p-4 border rounded bg-gray-50 my-4"},W={class:"mb-1"},Z={class:"mb-1"},A={class:"mb-1"},G={class:"w-full flex items-center gap-8 my-4"},J={class:"bg-white rounded-[16px] shadow-md p-4 w-[157px] shadow-box"},Y={class:"font-bold text-[#022B45] text-[16px] mb-1 lg:mb-2 bricolage-grotesque-custom leading-[1.2]"},K={key:0,class:"text-[#444444] text-[12px] lg:text-[13px]"},te={__name:"[id]",setup(Q){const h=L(),C=S(),r=x({}),d=x(""),f=x([]),l=x(null),N=async()=>{try{const s=await $fetch(`/api/products/productOfWeek/${h.params.id}`);r.value=s,d.value=s.name}catch(s){console.error("Nem sikerült lekérni a modellt:",s)}},D=async()=>{try{await $fetch(`/api/admin/productsOfWeek/edit/${h.params.id}`,{method:"PUT",body:r.value}),C.push("/admin/productsOfWeek")}catch(s){console.error("Hiba a mentéskor:",s)}},$=s=>{l.value=s,f.value=[],d.value=s.name,r.value.name=s.name,r.value.picUrl=s.coverImage,r.value.price=(s.priceData?.sale_price??s.priceData?.price??0).toString();const e=new URLSearchParams;s.storage&&e.append("storage",s.storage);let g=s.productName.replace(/\s+/g,"-").toLowerCase();const u=s.category;if(["iPhone","FelújÃtott készülékek"].includes(u)&&s.storage){const w=s.storage.replace(/\s+/g,"-").toLowerCase();g+=`-${w}`}r.value.link=`${g}?${e.toString()}`};return M(d,async s=>{if(s.length<2){f.value=[];return}try{const e=await $fetch(`/api/products?query=${encodeURIComponent(s)}`);f.value=e.products}catch(e){console.error("Hiba a keresés során:",e)}}),V(N),(s,e)=>{const g=P,u=B,w=H;return p(),c(_,null,[m(g),t("div",T,[t("div",z,[t("div",E,[m(u,{to:"/",class:"text-xl font-semibold"},{default:b(()=>[...e[2]||(e[2]=[t("div",{class:"flex items-center gap-2 mb-8"},[t("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.7071 4.29289C16.0976 4.68342 16.0976 5.31658 15.7071 5.70711L9.41421 12L15.7071 18.2929C16.0976 18.6834 16.0976 19.3166 15.7071 19.7071C15.3166 20.0976 14.6834 20.0976 14.2929 19.7071L7.29289 12.7071C7.10536 12.5196 7 12.2652 7 12C7 11.7348 7.10536 11.4804 7.29289 11.2929L14.2929 4.29289C14.6834 3.90237 15.3166 3.90237 15.7071 4.29289Z",fill:"#000000"})]),t("p",null,"Vissza")],-1)])]),_:1}),m(u,{to:"/admin/blogs",class:"font-bold mb-2"},{default:b(()=>[...e[3]||(e[3]=[i("Blogok",-1)])]),_:1}),m(u,{to:"/admin/infos",class:"font-bold mb-2"},{default:b(()=>[...e[4]||(e[4]=[i("Infók",-1)])]),_:1}),m(u,{to:"/admin/productsOfWeek",class:"font-bold"},{default:b(()=>[...e[5]||(e[5]=[i("Hét termékei",-1)])]),_:1})]),t("div",F,[e[14]||(e[14]=t("h1",{class:"text-xl font-bold mb-6"},"Hét terméke szerkesztése",-1)),k(t("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>j(d)?d.value=a:null),placeholder:"Telefon keresése név alapján...",class:"border px-4 py-2 w-full rounded mb-4"},null,512),[[y,o(d)]]),o(f)?.length?(p(),c("ul",I,[(p(!0),c(_,null,R(o(f),a=>(p(),c("li",{key:a.id,onClick:X=>$(a),class:"px-4 py-2 hover:bg-gray-100 cursor-pointer"},n(a.name)+" â "+n(a.color)+" â "+n(a.storage),9,O))),128))])):v("",!0),o(l)?(p(),c("div",q,[t("p",W,[e[6]||(e[6]=t("strong",null,"Név:",-1)),i(" "+n(o(l).name),1)]),t("p",Z,[e[7]||(e[7]=t("strong",null,"SzÃn:",-1)),i(" "+n(o(l).color),1)]),t("p",A,[e[8]||(e[8]=t("strong",null,"Tárhely:",-1)),i(" "+n(o(l).storage),1)]),t("p",null,[e[9]||(e[9]=t("strong",null,"Ãr:",-1)),i(" "+n(o(l).priceData?.sale_price??o(l).priceData?.price)+" Ft",1)]),t("div",G,[m(w,{src:o(l).coverImage,class:"h-40"},null,8,["src"]),t("div",J,[e[10]||(e[10]=t("div",{class:"bg-[#D95E1E] text-white w-fit text-[10px] mb-[10px] font-semibold rounded-lg flex items-center justify-center py-0.5 px-2"}
1," NAGYON NÃPSZERŰ ",-1)),t("p",Y,n(o(l).name),1),o(l).priceData?(p(),c("p",K,"Már "+n((o(l).priceData.sale_price?o(l).priceData.sale_price:o(l).priceData.price).toLocaleString("hu-HU"))+" Ft-tól",1)):v("",!0),e[11]||(e[11]=t("button",{class:"text-blue-500 border w-full border-blue-500 font-semibold rounded-full py-1 px-4 mt-4 bricolage-grotesque-custom"},"Vásárlás",-1))])])])):v("",!0),t("form",{onSubmit:U(D,["prevent"]),class:"space-y-4"},[t("div",null,[e[12]||(e[12]=t("label",{class:"block mb-1 font-medium"},"Termék linkje",-1)),k(t("input",{"onUpdate:modelValue":e[1]||(e[1]=a=>o(r).link=a),placeholder:"Link",class:"border px-4 py-2 w-full rounded",required:""},null,512),[[y,o(r).link]])]),e[13]||(e[13]=t("button",{type:"submit",class:"bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700"}," Mentés ",-1))],32)])])])],64)}}};export{te 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.