"use strict";(self["webpackChunkSimple_Web_based_Interface_for_Scanner"]=self["webpackChunkSimple_Web_based_Interface_for_Scanner"]||[]).push([[402],{402:(e,t,i)=>{i.r(t),i.d(t,{default:()=>w});var n=i(3673),s=i(2323);const o=["href"];function a(e,t,i,a,l,c){const r=(0,n.up)("q-img"),f=(0,n.up)("q-item-section"),u=(0,n.up)("q-btn"),h=(0,n.up)("q-item"),p=(0,n.up)("q-list"),m=(0,n.up)("q-page");return(0,n.wg)(),(0,n.j4)(m,{class:"col"},{default:(0,n.w5)((()=>[(0,n.Wm)(p,{class:"shadow-2 rounded-borders q-mx-lg q-my-lg",style:{width:"96%"}},{default:(0,n.w5)((()=>[((0,n.wg)(!0),(0,n.iD)(n.HY,null,(0,n.Ko)(e.items,(t=>((0,n.wg)(),(0,n.j4)(h,{key:t,style:{"border-bottom":"1px solid #eee"}},{default:(0,n.w5)((()=>[(0,n.Wm)(f,{thumbnail:""},{default:(0,n.w5)((()=>[(0,n.Wm)(r,{class:"text-center",fit:"contain",style:{width:"128px","max-height":"128px",border:"1px solid #eee"},"img-style":{"min-width":"100%","min-height":"100%","object-fit":"cover"},src:`${t.src}`,"spinner-color":"black"},null,8,["src"])])),_:2},1024),(0,n.Wm)(f,{style:{"overflow-wrap":"break-word",hyphens:"auto","word-break":"break-all"}},{default:(0,n.w5)((()=>[(0,n._)("a",{href:t.src,style:{"font-size":"0.9rem"}},(0,s.zw)(t.filename),9,o)])),_:2},1024),(0,n.Wm)(f,{avatar:""},{default:(0,n.w5)((()=>[(0,n.Wm)(u,{color:"red",label:"",icon:"delete",size:"sm",onClick:i=>e.removeImage(t.filename)},null,8,["onClick"])])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1})}i(2100);const l=(0,n.aZ)({name:"PageScanList",data:function(){return{files:[],config:void 0}},created:function(){},computed:{items:function(){return this.files.map((e=>({filename:e,src:`http://${this.config.api_url}:${this.config.api_port}${this.config.scans_url}/${e}`,type:this.getFileType(e)})))}},mounted(){this.getJSON("config","config.json").then((e=>{this.config=e,this.$axios.get(`http://${this.config.api_url}:${this.config.api_port}/scans`).then((e=>{200==(null===e||void 0===e?void 0:e.status)&&(this.files=e.data)})).catch((function(e){}))}))},methods:{getJSON:function(e,t){return new Promise(((i,n)=>{this.$axios.get(t).then((t=>{let n=t.data;localStorage.setItem(e,JSON.stringify(n)),i(n)})).catch((e=>{console.log(e),n(e)}))}))},getFileType:function(e){let t=e.split(".").pop().toLowerCase();return["jpg","jpeg","png"].includes(t)?"img":"other"},removeImage:function(e){this.$axios.delete(`http://${this.config.api_url}:${this.config.api_port}/scans/${e}`).then((t=>{200==(null===t||void 0===t?void 0:t.status)&&(this.files=this.files.filter((t=>t!=e)))})).catch((function(e){}))}}});var c=i(4260),r=i(4379),f=i(7011),u=i(3414),h=i(2035),p=i(4027),m=i(4607),d=i(7518),g=i.n(d);const _=(0,c.Z)(l,[["render",a]]),w=_;g()(l,"components",{QPage:r.Z,QList:f.Z,QItem:u.Z,QItemSection:h.Z,QImg:p.Z,QBtn:m.Z})}}]);