import{_ as g,a as l,c as a,b as o,t as m,f as c,F as p,g as _,h as f,o as i,J as b,E as y}from"./Bgmy51Qv.js";import{_ as w}from"./vU4aS4uy.js";import{u as k}from"./7pZkuj9N.js";import{u as v}from"./BHvLfWtM.js";import"./BE7GDBwC.js";import"./DKgjlGGV.js";const C={setup(){const{deleteData:t,getRequest:e}=k();return{deleteData:t,getRequest:e}},name:"images",data(){return{loading:!1,imageList:[]}},directives:{},components:{Spinner:l},mixins:[v],computed:{imageCount(){return this.thumbs.length},thumbs(){var t;return(t=this.imageList)==null?void 0:t.filter(e=>e.startsWith("thumb-"))}},methods:{async deleteImage(t){if(confirm(this.$t("admin.dltMsg")))try{this.loading=!0,await this.deleteData({params:this.thumbToMain(this.thumbs[t]),api:"imgDelete"}),await this.fetchingData(),this.loading=!1}catch(e){f({statusCode:400,message:e.message})}},thumbToMain(t){return t=t.replace("thumb-",""),t},async fetchingData(){this.loading=!0,this.imageList=await this.getRequest({params:{},api:"imgAll"}),this.loading=!1}},async mounted(){await this.fetchingData()}},D={class:"mb-20"},L={key:0,class:"spinner-wrapper"},M={key:1,class:"image-container"},T=["onClick"];function x(t,e,I,z,u,s){const h=l,d=w;return i(),a("div",null,[o("h5",D,m(t.$t("list.show",{from:1,to:s.imageCount,total:s.imageCount})),1),u.loading?(i(),a("div",L,[c(h,{radius:100,color:"primary",class:"mr-15"})])):(i(),a("div",M,[(i(!0),a(p,null,_(s.thumbs,(n,r)=>(i(),a("div",{key:r,class:"card"},[c(d,{class:"mr-20","lazy-src":t.getImageURL(n),alt:s.thumbToMain(n)},null,8,["lazy-src","alt"]),b(" "+m(s.thumbToMain(n))+" ",1),o("button",{class:"",onClick:y(B=>s.deleteImage(r),["prevent"])}," ✖ ",8,T)]))),128))]))])}const F=g(C,[["render",x]]);export{F as default};
