1import{a as c,e as d,g as u,f as $,b as o,h as b,_ as n,c as _,V as y}from"./index-f5c6f890.js";import{m as h}from"./index-3339eeb3.js";import{h as g}from"./helpers-96750fec.js";import{_ as w}from"./VForm-55d1fac3.js";import{_ as m}from"./VRow-477f36c2.js";import{_ as r}from"./VCol-4e2e67ec.js";import{_ as p}from"./VTextField-3c24aecf.js";import{_ as x}from"./VDivider-266197a4.js";import{_ as C}from"./VSwitch-f22141e3.js";import{_ as P}from"./VTooltip-184ef230.js";import{_ as f}from"./VSpacer-1dacdb07.js";import{t as I}from"./table-params-24e95c2b.js";import{t as k}from"./table-filters-8bf6c1b2.js";import{t as R,P as S}from"./Paginator-ad029ac0.js";import{t as M}from"./table-search-0864eeb9.js";import{r as D,_ as N}from"./resizable-columns-ddc521e5.js";import{T as z}from"./TableSearch-a9992141.js";import"./index-e5fee4e1.js";import"./index-b5848854.js";import"./index-f3fc42ae.js";import"./index-3afa7640.js";import"./VSelect-6efada6f.js";import"./index-f54e2dd6.js";import"./VCheckbox-5d96f5a3.js";const B=h(g).extend({name:"ProductCreate",data:()=>({model:{name:"",publicName:"",roleLevel:0,allowExpiredSubscription:!1},rights:[],groups:{},selectedRights:{},overrideRights:{},editMode:!1,initLoading:!0,loading:!1}),async mounted(){await this.loadData()},methods:{async loadData(){this.initLoading=!0;try{Number(this.$route.params.id)&&(this.editMode=!0);const i=this.editMode?this.$API.auth().getEditByModule("products",this.$route.params.id):Promise.resolve(),[t,e,s]=await Promise.all([this.$API.auth().getDataByModule("rights"),this.$API.auth().getDataByModule("rightgroups"),i]);this.setServerResponse(t,e,s)}catch(i){await this.$store.dispatch("alert/showError",i.message||i)}this.initLoading=!1},setServerResponse(i,t,e){if(this.rights=[...t.items,...i.items],this.editMode){this.model=e;for(const s of this.model._embedded.rights)this.selectedRights[s.id]=!0;this.$forceUpdate()}},async submit(){this.loading=!0;try{if(this.$refs.form.validate()){const i={id:null,...this.model,rights:this.getIdsOfType(this.selectedRights),grantRights:this.getIdsOfType(this.overrideRights,"grant"),denyRights:this.getIdsOfType(this.overrideRights,"deny")};this.editMode?await this.$API.auth().updateByModuleName("products",this.$route.params.id,i):(await this.$API.auth().createByModuleName("products",i),await this.$store.dispatch("alert/showSuccess",this.$t("administration.message.product_save_success"))),await this.$router.push(`/administration/${this.$route.params.module}`)}}catch(i){await this.setErrorMessages(i,this.$t("administration.message.product_save_error"))}this.loading=!1},getIdsOfType(i,t){return Object.entries(i).filter(([,e])=>t?e===t:e).map(([e])=>e)}}});var L=function(){var t=this,e=t._self._c;return t._self._setupProxy,e("div",{staticClass:"pt-2"},[t.initLoading?e("div",{staticClass:"loader-container force-centered"},[e(_,{attrs:{color:"primary",indeterminate:"",size:"56"}})],1):e(d,{staticClass:"transparent",attrs:{flat:""}},[e(u,{staticClass:"px-0"},[e(w,{ref:"form",attrs:{"lazy-validation":""},on:{submit:function(s){s.preventDefault()}}},[e(m,[e(r,{staticClass:"py-0",attrs:{cols:"6"}},[e("custom-input",{attrs:{label:t.$t("view.label.role.name"),required:""}},[e(p,{attrs:{"error-messages":t.errorMessages.publicName,rules:[t.$rules.required(),t.$rules.max(150)],outlined:"",dense:""},model:{value:t.model.publicName,callback:function(s){t.$set(t.model,"publicName",s)},expression:"model.publicName"}})],1)],1),e(r,{staticClass:"py-0",attrs:{cols:"6"}},[e("custom-input",{attrs:{label:t.$t("view.label.role.internalName"),required:""}},[e(p,{attrs:{"error-messages":t.errorMessages.name,rules:[t.$rules.required(),t.$rules.max(150)],outlined:"",dense:""},model:{value:t.model.name,callback:function(s){t.$set(t.model,"name",s)},expression:"model.name"}})],1)],1),e(r,{attrs:{cols:"12"}},[e(d,{staticClass:"transparent",attrs:{flat:""}},[e($,[t._v(" "+t._s(t.$t("view.label.right.rights"))+" ")]),e(x,{staticClass:"full-width"}),e(u,[e(m,t._l(t.rights,function(s,v){return e(r,{key:v,staticClass:"d-flex align-center",attrs:{cols:"12",lg:"6"}},[e(C,{staticClass:"mt-0",attrs:{label:s.name,dense:"","hide-details":""},model:{value:t.selectedRights[s.id],callback:function(a){t.$set(t.selectedRights,s.id,a)},expression:` 2 selectedRights[item.id] 3 `}}),s.rights?e(P,{attrs:{bottom:""},scopedSlots:t._u([{key:"activator",fn:function({on:a,attrs:l}){return[e(o,t._g(t._b({staticClass:"ml-2",attrs:{color:"primary"}},"v-icon",l,!1),a),[t._v(" mdi-information-outline ")])]}}],null,!0)},[e("div",t._l(s.rights,function(a,l){return e("p",{key:l,staticClass:"mb-0"},[t._v(" "+t._s(a.name)+" ")])}),0)]):t._e()],1)}),1)],1)],1)],1)],1)],1)],1),e(b,[e(f),e(n,{attrs:{disabled:t.loading,to:`/administration/${this.$route.params.module}`,link:"",outlined:""}},[t._v(" "+t._s(t.$t("view.label.cancel"))+" ")]),e(n,{directives:[{name:"submit-form",rawName:"v-submit-form"}],attrs:{depressed:"",disabled:t.loading}},[t._v(" "+t._s(t.$t("view.label.save"))+" ")])],1)],1)],1)},A=[],T=c(B,L,A,!1,null,null,null,null);const V=T.exports,E=[{text:"name",value:"publicName",sortable:!0}
3,{text:"ctime",value:"ctime",sortable:!0},{text:"mtime",value:"mtime",sortable:!0},{text:"",value:"actions",width:"100%",cellClass:"actions"}],O=h(R,k,I,M,g).extend({name:"ProductOverview",directives:{resizableColumns:D},components:{Paginator:S,TableSearch:z},data:()=>({headers:E,items:[],order:{inProgressStart:"DESC"},initLoading:!0,loading:!0}),async mounted(){this.initLoading=!0,await this.loadData(),this.initLoading=!1},methods:{async loadData(){this.loading=!0;try{const i={limit:this.pagination.limit,offset:(this.pagination.number-1)*this.pagination.limit},t=await this.$API.auth().getDataByModule("products",i);this.setServerResponse(t)}catch(i){await this.$store.dispatch("alert/showError",i.message||i)}this.loading=!1},setServerResponse(i){this.items=i.items,this.totalItems=i.total,this.initLoading&&(this.pagination.limit=i.limit)},async deleteItem(i){this.loading=!0;try{await this.$API.auth().deleteByModule("products",i),await this.loadData()}catch(t){await this.$store.dispatch("alert/showError",t.message||t)}this.loading=!1},editItem(i,{item:t}){this.$router.push(`/administration/product/${t.id}`)}}});var q=function(){var t=this,e=t._self._c;return t._self._setupProxy,e("div",{staticStyle:{position:"sticky",top:"0","z-index":"3"}},[e("div",{staticClass:"px-1 mb-6 d-flex align-center",staticStyle:{"min-height":"40px"}},[e("table-search",{staticClass:"custom-text-field background ml-3",attrs:{loading:t.loading},model:{value:t.search,callback:function(s){t.search=s},expression:"search"}}),e(f),e(n,{staticClass:"text-normalize custom-button",attrs:{disabled:t.loading,to:"/administration/product/create",link:"",small:"",text:"",tile:""}},[e(o,{staticClass:"mr-1",attrs:{size:"18"}},[t._v("mdi-plus-circle-outline")]),e("span",{staticClass:"font-12 letter-spacing-none"},[t._v(" "+t._s(t.$t("view.label.add_new"))+" ")])],1)],1),e("div",{staticClass:"d-flex"},[e(m,[e(r,{attrs:{cols:"4"}})],1)],1),t.initLoading?e("div",{staticClass:"loader-container force-centered"},[e(_,{attrs:{color:"primary",indeterminate:"",size:"56"}})],1):e("div",[e("div",{staticClass:"table-container"},[e(N,{directives:[{name:"resizable-columns",rawName:"v-resizable-columns",value:t.handleSortClick,expression:"handleSortClick"}],key:t.$store.getters["localization/getCurrent"],ref:"table",attrs:{headers:t.headers,items:t.currentItems,"items-per-page":t.pagination.limit,page:t.pagination.number,search:t.search,"sort-by":t.sortBy,"sort-desc":t.sortDesc,"hide-default-footer":"","disable-sort":""},on:{"update:page":function(s){return t.$set(t.pagination,"number",s)},"update:sortBy":function(s){t.sortBy=s},"update:sort-by":function(s){t.sortBy=s},"update:sortDesc":function(s){t.sortDesc=s},"update:sort-desc":function(s){t.sortDesc=s},"dblclick:row":t.editItem},scopedSlots:t._u([{key:"item.ctime",fn:function({item:s}){return[e("span",{attrs:{title:`${t.$moment(s.ctime*1e3).format("lll")}`}},[t._v(" "+t._s(t.$moment(s.ctime*1e3).format("ll"))+" ")])]}},{key:"item.mtime",fn:function({item:s}){return[e("span",{attrs:{title:`${t.$moment(s.mtime*1e3).format("lll")}`}},[t._v(" "+t._s(t.$moment(s.mtime*1e3).format("ll"))+" ")])]}},{key:"item.actions",fn:function({item:s}){return[e("div",{staticClass:"d-inline-flex actions-container"},[e(n,{attrs:{to:`${t.$route.params.module}/${s.id}`,icon:"",link:"",small:"",title:t.$t("view.label.edit")}},[e(o,[t._v(" mdi-pencil")])],1),e(n,{directives:[{name:"confirm",rawName:"v-confirm",value:{title:`${t.$t("view.message.delete_entity_item_new",{entity:t.$t("view.label.product"),item:s.name})}`,message:t.$t("alert.deletion_text"),callback:()=>t.deleteItem(s.id)},expression:`{ 4 title: \`\${$t( 5 'view.message.delete_entity_item_new', 6 { 7 entity: $t('view.label.product'), 8 item: item.name, 9 } 10 )}\`, 11 message: $t('alert.deletion_text'), 12 callback: () => deleteItem(item.id), 13 }`}],attrs:{icon:"",small:"",title:t.$t("view.label.delete")}},[e(o,[t._v(" mdi-delete-empty")])],1)],1)]}}],null,!1,4154559629)})],1),e("paginator",{staticClass:"pl-4",attrs:{items:t.currentItems,"last-page":t.pagesAmount,pagination:t.pagination,"paginator-values":t.itemsPerPageOptions,"total-items":t.totalItems,value:t.pagination.number,"visible-items":t.currentItems.length},on:{input:t.changeTablePagination}})],1)])},F=[],j=c(O,q,F,!1,null,"6615974b",null,null);const U=j.exports,G=y.extend({name:"ProductIndex",components:{create:V,overview:U},data:()=>({view:""}),mounted(){this.setView()},watch:{$route(){this.setView()}},methods:{setView(){this.$route.params.id?this.view="create":this.view="overview"}}});var H=function(){var t=this,e=t._self._c;return t._self._setupProxy,t.view?e("div",{staticClass:"pt-4"},[e(t.view,{tag:"component"})],1):t._e()},J=[],K=c(G,H,J,!1,null,null,null,null);const $t=K.exports;export{$t 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.