1import{c as C,k as D}from"./primevue-ca313794.js";import{_ as K,u as I,L,A as w,h as A,Z as F}from"./index-cc1a661b.js";import{l as T}from"./layoutDataViewFilters-860124fe.js";import{h as g,i as V,d,e as b,s as r,x as a,F as H,j as k,l as m,g as p,f as l,t as n}from"./vendor-ea0043bb.js";import"./mapbox-v3-eadefc84.js";import"./geo-1391ac6a.js";import"./mapbox-addons-be198bf9.js";import"./editor-b65e0429.js";import"./pdf-7415fc80.js";const _={name:"KiosksPage",mixins:[I,T],components:{Loader:L,TextInput:w,Loading:A},computed:{params(){return{documentCategoryId:193,skip:this.skip,take:this.take,filter:this.filter||null,orderBy:this.sortField?`${this.sortField} ${this.sortDir}`:null}}},data(){return{kiosks:[],isLoading:!1,filter:"",totalRecords:0,skip:0,take:15,layout:"list",sortField:null,sortDir:"ASC"}},mounted(){this.getKiosks()},watch:{layout(){this.getKiosks(!0)}},methods:{createKiosk(){if(!this.userHasAccessTo("add","kiosk")){this.$toast.add({severity:"warn",summary:"Warning",detail:this.$t("You have no rights to access this resource!"),life:5e3});return}this.$router.push("/kiosk/")},editKiosk(e){if(!this.userHasAccessTo("edit","kiosk")){this.$toast.add({severity:"warn",summary:"Warning",detail:this.$t("You have no rights to access this resource!"),life:5e3});return}this.$router.push(`/kiosk/${e}`)},getKiosks(e){e&&(this.skip=0),this.isLoading=!0,this.$store.dispatch("getDevices",{query:{moduleId:this.$route?.meta?.moduleId},data:this.params}).then(t=>{this.kiosks=t,this.totalRecords=t.length?t[0].totalRows:0,this.isLoading=!1}).catch(t=>{this.isLoading=!1,this.$toast.add({severity:"error",summary:"Error",detail:this.$t(t),life:5e3})})},deleteKiosk(e){if(!this.userHasAccessTo("delete","kiosk")){this.$toast.add({severity:"warn",summary:"Warning",detail:this.$t("You have no rights to access this resource!"),life:5e3});return}this.$confirm.require({message:this.$t("Are you sure want to delete?"),header:this.$t("Confirm action!"),icon:"pi pi-exclamation-triangle",accept:()=>{this.isLoading=!0,this.$store.dispatch("deleteDevice",{query:{moduleId:this.$route?.meta?.moduleId},data:e}).then(t=>{this.getKiosks(),this.isLoading=!1}).catch(t=>{this.isLoading=!1,this.$toast.add({severity:"error",summary:"Error",detail:this.$t(t),life:5e3})})},reject:()=>{}})},resetFilters(){this.filter="",this.getKiosks(!0)},onPageChange(e){this.take=e.rows,this.skip=e.page*this.take,this.getKiosks()},onSort(e){this.sortField=e.sortField,this.sortDir=e.sortOrder===1?"ASC":"DESC",this.getKiosks()},formatDate(e){return e?F(e,this.$root.$i18n.locale,"DD-MM-YYYY HH:mm"):this.$t("unknown")},cloneKiosk(e){if(!this.userHasAccessTo("add","kiosk")){this.$toast.add({severity:"warn",summary:"Warning",detail:this.$t("You have no rights to access this resource!"),life:5e3});return}this.$router.push(`/kiosk/?cloneId=${e}`)}}},S={class:"flex align-items-start justify-content-between"};function B(e,t,R,Y,i,o){const u=C,v=g("TextInput"),f=D,y=g("LayoutDataView"),$=g("Loader"),c=V("tooltip");return d(),b(H,null,[r(y,{elements:i.kiosks,elementsLoading:i.isLoading,onPage:t[1]||(t[1]=s=>o.onPageChange(s)),onSort:t[2]||(t[2]=s=>o.onSort(s)),onSearch:t[3]||(t[3]=s=>o.getKiosks(!0)),onResetFilters:o.resetFilters,totalRecords:i.totalRecords,take:i.take,skip:i.skip,availableOptions:["list","grid"],modelValue:i.layout,"onUpdate:modelValue":t[4]||(t[4]=s=>i.layout=s)},{headerButtons:a(()=>[e.userHasAccessTo("add","photoGallery")?k((d(),m(u,{key:0,icon:"pi pi-plus",class:"p-button-success",onClick:o.createKiosk},null,8,["onClick"])),[[c,e.$t("Create"),void 0,{left:!0}]]):p("",!0)]),filters:a(()=>[r(v,{label:"","hide-label":!0,modelValue:i.filter,"onUpdate:modelValue":t[0]||(t[0]=s=>i.filter=s),placeholder:e.$t("Search...")},null,8,["modelValue","placeholder"])]),columns:a(({slotProps:s})=>[r(f,{field:"documentId",header:e.$t("ID"),sortable:""},null,8,["header"]),r(f,{field:"title",header:e.$t("Title"),sortable:""},null,8,["header"]),r(f,{field:"properties.isActive",header:e.$t("Is active"),sortable:""},null,8,["header"])]),rowButtons:a(({slotProps:s})=>[e.userHasAccessTo("edit","kiosk")?k((d(),m(u,{key:0,icon:"pi pi-pencil",class:"p-button-success",onClick:h=>o.editKiosk(s.data.documentId)},null,8,["onClick"])),[[c,e.$t("Edit"),void 0,{left:!0}]]):p("",!0),e.userHasAccessTo("add","kiosk")?k((d(),m(u,{key:1,icon:"fa fa-clone",class:"p-button-secondary",onClick:h=>o.cloneKiosk(s.data.documentId)},null,8,["onClick"])),[[c,e.$t("Add"),void 0,{left:!0}]]):p("",!0),e.userHasAccessTo("delete","kiosk")?k((d(),m(u,{key:2,icon:"pi pi-trash",class:"p-button-danger",onClick:h=>o.deleteKiosk(s.data)},null,8,["onClick"])),[[c,e.$t("Delete"),void 0,{left:!0}]]):p("",!0)]),cardHeader:a(({element:s,index:h})=>[l("div",null,"ID: "+n(s?.documentId),1)]),cardContent:a(({element:s,index:h})=>[l("div",S,[l("div",null,[l("h6",null,n(s.title),1),l("div",null,n(e.$t("Creation date"))+": "+n(o.formatDate(s.creationDate)),1),l("div",null,n(e.$t("Is active"))+": "+n(s.properties.isActive),1)])])]),_:1},8,["elements","elementsLoading","onResetFilters","totalRecords","take","skip","modelValue"]),r($,{"is-loading":i.isLoading},null,8,["is-loading"])],64)}const G=K(_,[["render",B],["__scopeId","data-v-f40ea75e"]]);export{G 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.