Files
appco_dist/.output/public/_nuxt/B8IDeuha.js
T
2025-07-22 23:06:16 +03:30

2 lines
1.8 KiB
JavaScript

import{ax as m,N as _,d as p,G as v,ai as y,y as d,z as l,a3 as b,H as s,A as r,S as w,a6 as B,aj as C,ah as k,B as x,C as c,r as S,K as z,cE as N,D as $}from"./CwKn53hw.js";import{B as u}from"./fSnp-cKK.js";import{p as f}from"./Cco3B7sz.js";import{C as j}from"./DoLnxKlT.js";const G=async e=>{let t=_.from("brands").select("*");return e!=null&&e.length&&t.like("title",`%${e}%`),(await t.select("*").order("created_at",{ascending:!1})).data},H=async e=>{await m.fetch("brands","insert",{data:e})},K=async(e,t)=>m.fetch("brands","update",{data:t,field:"id",value:e}),O=async e=>m.fetch("brands","delete",{field:"id",value:e}),D={class:"flex items-center"},E=["alt"],V={class:"ms-5 text-sm"},F={key:0,class:"flex items-center gap-2"},P=p({__name:"BrandCard",props:{item:{},hasFunction:{type:Boolean,default:!0}},emits:["edit","delete"],setup(e,{emit:t}){const i=v(),o=t;return(a,n)=>{const h=y("lazy");return l(),d("div",{class:b(["flex w-full mt-2 p-2 items-center justify-between rounded-lg",s(i).isNightStore?"bg-zinc-800":"bg-gray-50"])},[r("div",D,[B(r("img",{alt:s(k),class:"w-2.5rem h-2.5rem rounded-lg object-contain"},null,8,E),[[h,{src:s(C)(a.item.image),loading:s(f),error:s(f)}]]),r("div",V,x(a.item.title),1)]),a.hasFunction?(l(),d("div",F,[c(u,{icon:"vuesax-linear:edit",color:"blue",onClick:n[0]||(n[0]=g=>o("edit",a.item))}),c(u,{icon:"vuesax-linear:trash",color:"red",onClick:n[1]||(n[1]=g=>o("delete",a.item.id))})])):w("",!0)],2)}}}),I=["width"],U=p({__name:"BrandCardSkeleton",setup(e){const t=S(null),i=z(N(t,{width:0,height:0},{box:"border-box"}));return(o,a)=>(l(),d("div",{ref_key:"skeletonRatio",ref:t,class:"h-fit"},[c(s(j),{width:i.width,height:"60"},{default:$(()=>[r("rect",{height:"50",rx:"3",ry:"3",width:i.width,x:"0",y:"8"},null,8,I)]),_:1},8,["width"])],512))}});export{P as _,U as a,H as c,O as d,G as g,K as u};