1import{a as o,j as h,_ as r,b as n,c as u,e as f,f as g,g as v,h as b,V as w}from"./index-f5c6f890.js";import{_ as $}from"./teleport.esm-592e26b9.js";import{m}from"./index-3339eeb3.js";import{t as x}from"./table-filters-8bf6c1b2.js";import{t as y}from"./table-multiselect-fe709b48.js";import{t as C}from"./table-multiselect-dialog-52e28269.js";import{t as k,P as M}from"./Paginator-ad029ac0.js";import{t as I}from"./table-params-24e95c2b.js";import{t as A}from"./table-search-0864eeb9.js";import{r as P,_ as S}from"./resizable-columns-ddc521e5.js";import{M as D,a as R}from"./MultiselectDialog-9cff6546.js";import{T as F}from"./TableSearch-a9992141.js";import{_ as l}from"./VSpacer-1dacdb07.js";import{_ as c}from"./VCheckbox-5d96f5a3.js";import{h as T}from"./helpers-96750fec.js";import{_ as U}from"./VForm-55d1fac3.js";import{_ as z}from"./VRow-477f36c2.js";import{_ as d}from"./VCol-4e2e67ec.js";import{_ as O}from"./VAutocomplete-664978db.js";import{_ as L}from"./VTextField-3c24aecf.js";import{_ as V}from"./VCombobox-cc6d19a6.js";import"./VSelect-6efada6f.js";import"./index-3afa7640.js";import"./VDivider-266197a4.js";import"./index-b5848854.js";import"./index-f54e2dd6.js";import"./VTooltip-184ef230.js";import"./ComboboxColored-7939ae89.js";import"./csv-chips-cc2317de.js";import"./ItemChipList-8caddd80.js";import"./index-e5fee4e1.js";const j=m(x,y,C,k,I,A).extend({name:"AssignFiltersOverview",directives:{resizableColumns:P},components:{MultiselectActions:D,MultiselectDialog:R,Paginator:M,TableSearch:F,Teleport:$},data:()=>({headers:[{text:"checkbox",value:"checkbox",sortable:!1,width:"30px",class:"checkbox"},{text:"table.header.username",value:"assignedUser",sortable:!0},{text:"table.header.filter",value:"filters",sortable:!1},{text:"",value:"actions",cellClass:"actions"}],items:[],limitInfo:{},search:"",loading:!0,initLoading:!0}),computed:{currentCustomer(){return this.$store.getters["authentication/credentials"].currentCustomer},currentUser(){return this.$store.getters["authentication/credentials"].currentUser.username},pagesAmount(){return Math.ceil(this.totalItems/this.pagination.limit)}},watch:{$route(i,e){e.path!==i.path&&(this.init(),this.loadData())}},async mounted(){this.initLoading=!0,this.init(),await this.loadData(),this.initLoading=!1},methods:{init(){this.scrollToTop(),this.pagination.number=1,this.pagination.limit=25},async loadData(){this.loading=!0;try{const i=Number(this.$route.query.limit)||1e3,t={offset:((Number(this.$route.query.number)||1)-1)*i,limit:i},s=await this.$API.assignedFilters().getData(this.currentCustomer.id,t);this.setServerResponse(s)}catch(i){await this.$store.dispatch("alert/showError",i.message||i)}this.loading=!1},setServerResponse(i){const e=i.items;this.totalItems=i.total,this.limitInfo=i.limitInfo||{current:this.totalItems,max:this.totalItems+1e3},this.items=e.map(({id:t,filters:s,assignedUser:a,owner:p})=>({id:t,filters:s.map(({name:_})=>_).join(", "),assignedUser:a.username,owner:p}))},async deleteItem(i){this.loading=!0;try{await this.$API.assignedFilters().delete(i),await this.$store.dispatch("alert/showSuccess",this.$t("view.message.data_delete_success")),await this.loadData()}catch(e){await this.$store.dispatch("alert/showError",e.message||e)}this.loading=!1},editItem(i,{item:e}){this.isOwner(e)&&this.$router.push(`${this.$route.params.module}/${e.id}`)},isOwner(i){return this.currentUser==i.owner}}});var N=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("div",{staticStyle:{position:"sticky",top:"0","z-index":"3"}},[e.isMultiselect?t("teleport",{attrs:{to:"#multiselectActionsTarget"}},[t(h,{staticClass:"view-actions__wrapper",attrs:{appear:"","hide-on-leave":"","leave-absolute":"",origin:"right"}},[t("div",{staticClass:"d-flex align-center"},[t("span",{staticClass:"mx-3",staticStyle:{color:"var(--v-error-base)"}},[e._v(" "+e._s(e.$t("view.table.message.selectedRows",{current:e.numberOfSelectedRows,max:e.maxSelectRows}))+" ")]),t("MultiselectActions",{attrs:{mode:e.multiselectMode,"delete-action":""},on:{mode:function(s){e.multiselectMode=s},cancel:function(s){return e.deselectAllRows()}}}
1)],1)])],1):e._e(),t("div",{staticClass:"px-1 mb-6 d-flex align-center",staticStyle:{"min-height":"40px"}},[t("table-search",{staticClass:"background ml-3",attrs:{disabled:e.loading||e.isMultiselect,loading:e.loading},model:{value:e.search,callback:function(s){e.search=s},expression:"search"}}),t(l),t(r,{staticClass:"text-normalize custom-button",attrs:{disabled:e.loading||e.isMultiselect,small:"",text:"",tile:"",to:`${e.$route.params.module}/create`}},[t(n,{attrs:{size:"16"}},[e._v(" mdi-plus-circle-outline")]),t("span",{staticClass:"ml-2 text-normalize"},[e._v(" "+e._s(e.$t("view.label.add_new"))+" ")])],1)],1),e.initLoading?t("div",{staticClass:"d-flex flex-column align-center fill-height justify-center",staticStyle:{"padding-top":"10vh"}},[t(u,{attrs:{color:"primary",indeterminate:"",size:"56"}})],1):t("div",{staticClass:"table-container"},[t(S,{directives:[{name:"resizable-columns",rawName:"v-resizable-columns"}],attrs:{headers:e.headers,items:e.currentItems,search:e.search,"items-per-page":e.pagination.limit,page:e.pagination.number,"sort-by":e.sortBy,"sort-desc":e.sortDesc,"hide-default-footer":""},on:{"update:page":function(s){return e.$set(e.pagination,"number",s)},"update:sortBy":function(s){e.sortBy=s},"update:sort-by":function(s){e.sortBy=s},"update:sortDesc":function(s){e.sortDesc=s},"update:sort-desc":function(s){e.sortDesc=s},"dblclick:row":e.editItem},scopedSlots:e._u([{key:"header.checkbox",fn:function(){return[t("div",{staticClass:"d-flex"},[t(c,{staticClass:"mt-0 pt-0",attrs:{indeterminate:"",readonly:"","hide-details":""},on:{click:e.selectAllRows}})],1)]},proxy:!0},{key:"item.checkbox",fn:function({item:s}){return[t("div",{staticClass:"d-flex align-center checkbox-container"},[t(c,{staticClass:"mt-0",attrs:{ripple:!0,"hide-details":""},on:{click:function(a){return e.$emit("updateSelectedRows",e.selectedRows)}},model:{value:e.selectedRows[s.id],callback:function(a){e.$set(e.selectedRows,s.id,a)},expression:"selectedRows[item.id]"}})],1)]}},{key:"item.actions",fn:function({item:s}){return[t("div",{staticClass:"d-flex align-center"},[t(r,{attrs:{title:e.$t("view.label.edit"),to:`${e.$route.params.module}/${s.id}`,disabled:!e.isOwner(s),icon:"",link:"",small:""}},[t(n,[e._v(" mdi-pencil")])],1),t(r,{directives:[{name:"confirm",rawName:"v-confirm",value:{title:e.$t("alert.deletion_title"),message:e.$t("alert.deletion_text"),callback:()=>e.deleteItem(s.id)},expression:`{ 2 title: $t('alert.deletion_title'), 3 message: $t('alert.deletion_text'), 4 callback: () => deleteItem(item.id), 5 }`}],attrs:{title:e.$t("view.label.delete"),disabled:!e.isOwner(s),icon:"",small:""}},[t(n,[e._v(" mdi-delete-empty")])],1)],1)]}}],null,!1,1579993716)}),t("paginator",{staticClass:"pl-4",attrs:{items:e.currentItems,"last-page":e.pagesAmount,pagination:e.pagination,"paginator-values":e.itemsPerPageOptions,"total-items":e.totalItems,loading:e.loading,"visible-items":e.currentItems.length},on:{changeLimit:function(s){return e.scrollToTop()},input:function(s){return e.changePage(s)}}})],1),e.multiselectMode?t("multiselect-dialog",{attrs:{mode:e.multiselectMode,items:e.items,"selected-items":e.selectedItems,show:e.multiselectDialog,context:"assignedFilters","text-property":"item.assignedUser"},on:{close:e.closeMultiselectDialog,cancel:e.cancelMultiselectDialog,update:e.loadData}}):e._e()],1)},q=[],B=o(j,N,q,!1,null,"9c6e09b0",null,null);const E=B.exports,Y=m(T).extend({name:"AssignFiltersOverview",data:()=>({model:{},user:"",selects:{permittedUsers:[],filters:[]},editMode:!1,loading:!0,initLoading:!0}),computed:{currentCustomer(){return this.$store.getters["authentication/credentials"].currentCustomer}},async mounted(){this.initLoading=!0,await this.loadData(),this.initLoading=!1},methods:{async loadData(){this.loading=!0;try{Number(this.$route.params.id)&&(this.editMode=!0);const i={limit:1e3,offset:0},[e,t,s]=await Promise.all([this.$API.tools().getFilters(i),!this.editMode&&this.$API.auth().getPermittedUsers(this.currentCustomer.id,i),this.editMode&&this.$API.auth().getAssignedFiltersById(this.$route.params.id)]);this.setServerResponse(e,t,s)}catch{}this.loading=!1},setServerResponse(i,e,t){try{if(this.selects.filters=i==null?void 0:i.items,e&&(this.selects.permittedUsers=e==null?void 0:e.items.map(({id:s,username:a})=>({assignedUser:{id:s},assignedTrackingAccount:{id:this.currentCustomer.id},username:a}))),t){const{id:s,assignedUser:a}=t;this.user=a.username,this.model.user={id:s,assignedUser:a,assignedTrackingAccount:this.currentCustomer},this.model.filters=t==null?void 0:t.filters}}catch(s){console.log(s)}},async submit(){this.loading=!0;try{if(this.$refs.form.validate()){const i={...this.model.user,filters:this.model.filters,id:this.editMode?this.$route.params.id:null,owner:this.currentCustomer.owner.username,_embedded:null,_links:{}};this.editMode?await this.$API.assignedFilters().editAssignedFilters(this.$route.params.id,i):await this.$API.assignedFilters().createAssignedFilters(i),await this.$store.dispatch("alert/s
5howSuccess",this.$t("configuration.message.save_success")),await this.$router.push(`/tools/${this.$route.params.module}`)}}catch(i){await this.setErrorMessages(i,this.$t("configuration.message.save_error"))}this.loading=!1}}});var G=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("div",{staticClass:"fill-height pt-2"},[e.loading?t("div",{staticClass:"d-flex flex-column align-center fill-height justify-center",staticStyle:{"padding-top":"30vh"}},[t(u,{attrs:{color:"primary",indeterminate:"",size:"56"}})],1):t(f,{staticClass:"transparent",attrs:{flat:""}},[t(g,{staticClass:"pt-1 px-3 mb-4 d-flex align-center",staticStyle:{"min-height":"40px"},attrs:{id:"title"}},[t("span",{staticClass:"body-2 neutral-4--text"},[e._v(" "+e._s(e.$t("view.subtitle.filter_create"))+" ")]),t(l)],1),t(v,{staticClass:"pb-0 pt-5"},[e.loading?e._e():t("div",[t(U,{ref:"form",attrs:{"lazy-validation":""},on:{submit:function(s){s.preventDefault()}}},[t(z,[t(d,{attrs:{cols:"12"}},[t("custom-input",{attrs:{width:"100%",required:"",label:e.$t("view.label.user")}},[e.editMode?t(L,{attrs:{value:e.user,disabled:"",dense:"",outlined:"","persistent-placeholder":""}}):t(O,{attrs:{"error-messages":e.errorMessages.user,items:e.selects.permittedUsers,"menu-props":{bottom:!0,offsetY:!0},rules:[e.$rules.required("username")],dense:"",outlined:"","item-text":"username","item-value":"username","persistent-placeholder":"","return-object":""},on:{keypress:function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"enter",13,s.key,"Enter")?null:e.submit.apply(null,arguments)}},model:{value:e.model.user,callback:function(s){e.$set(e.model,"user",s)},expression:"model.user"}})],1)],1),t(d,{attrs:{cols:"12"}},[t("custom-input",{attrs:{width:"100%",required:"",label:e.$t("report.label.filters")}},[t(V,{attrs:{"error-messages":e.errorMessages.filters,items:e.selects.filters,chips:"","deletable-chips":"",dense:"",outlined:"","hide-selected":"","persistent-placeholder":"","item-text":"name",multiple:"","return-object":""},on:{keypress:function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"enter",13,s.key,"Enter")?null:e.submit.apply(null,arguments)}},model:{value:e.model.filters,callback:function(s){e.$set(e.model,"filters",s)},expression:"model.filters"}})],1)],1)],1)],1)],1)]),t(b,{staticClass:"d-flex align-center justify-end py-5 px-4"},[t(l),t(r,{attrs:{disabled:e.loading,to:`/tools/${e.$route.params.module}`,link:"",outlined:""}},[e._v(" "+e._s(e.$t("view.label.cancel"))+" ")]),t(r,{directives:[{name:"submit-form",rawName:"v-submit-form"}],attrs:{depressed:"",disabled:e.loading}},[e._v(" "+e._s(e.$t("view.label.save"))+" ")])],1)],1)],1)},H=[],J=o(Y,G,H,!1,null,"bb05ceb4",null,null);const K=J.exports,Q=w.extend({name:"AssignFilters",components:{overview:E,create:K},data:()=>({view:null}),watch:{$route:{immediate:!0,handler(){this.setView()}}},methods:{setView(){this.$route.params.id?this.view="create":this.view="overview"}}});var W=function(){var e=this,t=e._self._c;return e._self._setupProxy,e.view?t("div",{staticClass:"pt-4"},[t(e.view,{tag:"component"})],1):e._e()},X=[],Z=o(Q,W,X,!1,null,"1111a41e",null,null);const De=Z.exports;export{De 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.