UNPKG

yekonga-server

Version:
2 lines (1 loc) 10.6 kB
import{g as e,o as t,c as o,h as a,j as i,k as s,t as n,n as u,v as r,H as l,aa as d,q as p,x as h,B as c,m}from"./vendor.38a5f540.js";import{_ as G}from"./Form.cd234191.js";import f from"./View.f2cda2e5.js";import"./index.esm.ef3672ff.js";const w={name:"AuthGroupDataItemComponent",props:{index:{type:Number,default:0},data:{type:Object,default:()=>{}},selectedItems:{type:Array,default:()=>[]},parentComp:{type:Object,default:()=>{}},paginatorComp:{type:Object,default:()=>{}}},methods:{toggleItem(e,t){var o=!this.paginatorComp.selectedListIDs.includes(t.uuid);this.paginatorComp.onSelect(t,o)}}},g={class:"col-12 mb-3"},y={class:"d-flex flex-grow-1 min-width-zero ps-2"},I={class:"card-body d-flex flex-column flex-md-row align-self-center align-items-lg-center justify-content-between min-width-zero py-3"},x={class:"w-30 w-sm-100"},$={class:"d-block"},b=a("div",{class:"w-70 w-sm-100"},[a("div",{class:"row flex-column flex-md-row align-items-lg-center"})],-1),v={class:"d-inline-block align-self-center me-4"},A=[a("i",{class:"ye ye-eye"},null,-1)],C=[a("i",{class:"ye ye-edit"},null,-1)],k=[a("i",{class:"ye ye-trash"},null,-1)],M=["checked"];w.render=function(l,d,p,h,c,m){const G=e("router-link");return t(),o("div",g,[a("div",{class:r(["card d-flex",{active:p.paginatorComp.selectedListIDs.includes(p.data.uuid)}]),"no-body":""},[a("div",y,[a("div",I,[a("div",x,[i(G,{to:{path:"/app/permissions/auth-groups/show/"+p.data.authGroupId},class:"d-block"},{default:s((()=>[a("span",$,n(p.data.name),1)])),_:1},8,["to"])]),b]),a("div",v,[a("div",{onClick:d[0]||(d[0]=e=>p.parentComp.onContextMenuAction("show",p.data)),class:"badge badge-outline-dark rounded pointer"},A),a("div",{onClick:d[1]||(d[1]=e=>p.parentComp.onContextMenuAction("edit",p.data)),class:"badge badge-outline-primary rounded pointer ms-1"},C),a("div",{onClick:d[2]||(d[2]=e=>p.parentComp.onContextMenuAction("delete",p.data)),class:"badge badge-outline-danger rounded pointer ms-1"},k)]),a("div",{onClick:d[3]||(d[3]=u((e=>m.toggleItem(e,p.data)),["prevent"])),class:"custom-control custom-checkbox ps-1 align-self-center pe-4"},[a("input",{type:"checkbox",checked:p.paginatorComp.selectedListIDs.includes(p.data.uuid),disabled:!0,class:"form-check-input"},null,8,M)])])],2)])};const D={name:"AuthGroupListComponent",computed:l({currentUser:"user"}),components:{DataItem:w,AuthGroupForm:G,AuthGroupView:f},props:{showHeader:{type:Boolean,default:!0},profileId:String},watch:{showAuthGroupFormModal:function(e,t){0==e&&(this.authGroupId=null)},showAuthGroupViewModal:function(e,t){0==e&&(this.authGroupId=null)},"$route.params.profileId":function(e,t){this.profileId=e,this.listOptions.args.profileId=[this.profileId]}},data(){return{displayMode:"list",authGroupId:null,singleSelectedData:null,showHeaderSection:!0,queryLimit:10,querySearch:"",currentComp:null,showAuthGroupFormModal:!1,showAuthGroupViewModal:!1,showAuthGroupImportModal:!1,listOptions:{name:"authGroupPaginate",listName:"authGroup",paginateName:"authGroupPaginate",downloadName:"downloadAuthGroups",orderOptions:{name:this.$t("authGroup.name"),description:this.$t("authGroup.description")},query:"{uuid:authGroupId,profileId,authGroupId,name,description,profile{name,name},authGroupPermissions{uuid:authGroupPermissionId,authGroupId,authPermissionId},authUserGroups{uuid:authUserGroupId,userId,authGroupId,authPermissionId}}",downloadQuery:"{uuid:authGroupId,profileId,authGroupId,name,description,profile{name,name},authGroupPermissions{uuid:authGroupPermissionId,authGroupId,authPermissionId},authUserGroups{uuid:authUserGroupId,userId,authGroupId,authPermissionId}}",downloadOrientation:"PORTRAIT",args:{},loadingMode:"paginate",noResultMessage:this.$t("authGroup.noData"),modeOptions:["list"],showToolbar:!0,showHeader:!0,showFooter:!0,tableMode:!1,padding:"0px",height:"300px",searchFields:["profileId","code","authGroupId","name","description"],columns:{name:this.$t("authGroup.name"),description:this.$t("authGroup.description")},filters:[],actions:[{label:this.$t("authGroup.delete"),callback:this.onDeleteAuthGroups}]}}},created(){this.loading=!0,this.currentComp=this,this.$route.meta&&void 0!==this.$route.meta.showHeader?this.showHeaderSection=this.$route.meta.showHeader:this.showHeaderSection=this.showHeader,this.$route.params.profileId&&(this.listOptions.args.profileId=[this.$route.params.profileId])},mounted(){var e=this;window.jQuery("#modelViewAuthGroup").on("hidden.bs.modal",(function(t){e.authGroupId=null})),window.jQuery("#modelFormAuthGroup").on("hidden.bs.modal",(function(t){e.authGroupId=null}))},methods:{updateList:function(e){this.loading=!1,this.processing=!1,this.authGroupList=e},changeDisplayMode:function(e){this.displayMode=e},onLoading:function(e){e||(this.loading=e),this.processing=e},reloadData:function(e){e&&e.authGroupId&&(this.authGroupId=e.authGroupId),this.$refs.paginator.reload()},onShow:function(e){this.authGroupId=e,this.showAuthGroupViewModal=!0},onEdit:function(e){this.authGroupId=e,this.showAuthGroupFormModal=!0},handleContextMenu(e){var t=e?e.componentOptions.propsData.data:null;this.singleSeletedData=t},onContextMenuAction(e,t=null){let o=this.singleSeletedData?this.singleSeletedData:t,a=o?o.uuid:null;"show"==e?this.onShow(a):"edit"==e?this.onEdit(a):"delete"==e&&this.onDelete(a)},onDelete:async function(e,t="auth group"){if(await window.customConfirm(this.$t("authGroup.alertSingleDelete",{title:t}))){this.processing=!0;var o=`mutation { delete:deleteAuthGroup(where:{authGroupId:{equalTo:"${e}"}}){status,message} }`,a=await window.ajaxGraphql(o,{});a.delete&&a.delete.status?(this.reloadData(),window.customAlert(this.$t("authGroup.alertDeleteSuccess"),"success")):window.customAlert(this.$t("authGroup.alertDeleteFail"),"danger"),this.processing=!1}},onDeleteAuthGroups:async function(e,t="auth groups"){if(await window.customConfirm(this.$t("authGroup.alertMultipleDelete"))){this.processing=!0;var o=e.map((e=>e.uuid)),a=`mutation { delete:deleteAuthGroup(where:{authGroupId:{in:${JSON.stringify(o)}}}){status,message} }`,i=await window.ajaxGraphql(a,{});i.delete&&i.delete.status?(this.reloadData(),window.customAlert(this.$t("authGroup.actionDeleteSuccess"),"success")):window.customAlert(this.$t("authGroup.actionDeleteFail"),"danger"),this.processing=!1}return!1}}},P={class:"main-container-middle p-4"},j={key:0,class:"container-header container-customer",style:{overflow:"visible"}},S={class:"row align-items-center justify-content-between py-3 mx-0"},F={class:"col d-flex align-items-center justify-content-between mb-2 mb-md-0 px-0"},V={class:"h5 m-0"},O=[a("i",{class:"ye ye-plus-circle"},null,-1)],L={class:"col-4 d-none d-lg-block px-0"},H={key:0,class:"col text-end d-none d-md-block px-0"},q=a("i",{class:"ye ye-plus-circle me-1"},null,-1),U=a("div",{class:"separator"},null,-1),_={class:"container-detail"},N={class:"container-customer rounded"},T={class:"text-center py-5"},Q=a("div",{class:"d-inline-block"},[a("span",{class:"d-flex rounded border border-primary px-4 py-3"},[a("i",{class:"ye ye-file-plus ye-2x text-muted"})])],-1),R={class:"my-4"},z=a("i",{class:"ye ye-plus-circle me-1"},null,-1),B=a("i",{class:"ye ye-upload me-1"},null,-1),E=a("i",{class:"simple-icon-doc"},null,-1),J=a("i",{class:"iconsminds-file-edit"},null,-1),K=a("i",{class:"simple-icon-trash"},null,-1);D.render=function(u,r,l,G,f,w){const g=e("DataItem"),y=e("paginator"),I=e("v-contextmenu-item"),x=e("v-contextmenu"),$=e("AuthGroupForm"),b=e("modal-pro"),v=e("AuthGroupView"),A=d("contextmenu");return t(),o("div",P,[f.showHeaderSection?(t(),o("div",j,[a("div",S,[a("div",F,[a("span",V,n(u.$t("authGroup.authGroup")),1),u.$isPermitted("authGroup.create")?(t(),o("a",{key:0,onClick:r[0]||(r[0]=e=>f.showAuthGroupFormModal=!0),href:"javascript:;",class:"btn btn-primary d-inline-block d-md-none"},O)):p("",!0)]),a("div",L,[p("",!0)]),(u.$refs.paginator&&u.$refs.paginator.emptyCollection,t(),o("div",H,[u.$isPermitted("authGroup.create")?(t(),o("a",{key:0,href:"javascript:;",onClick:r[2]||(r[2]=e=>f.showAuthGroupFormModal=!0),class:"btn btn-primary"},[q,h(" "+n(u.$t("general.addNew")),1)])):p("",!0)]))])])):p("",!0),U,a("div",_,[a("div",N,[i(y,{ref:"paginator",limit:f.queryLimit,search:f.querySearch,options:f.listOptions},{default:s((({item:e,index:t})=>[c(i(g,{data:e,index:t,selectedItems:u.$refs.paginator.selectedList,paginatorComp:u.$refs.paginator,parentComp:f.currentComp},null,8,["data","index","selectedItems","paginatorComp","parentComp"]),[[A,void 0,"contextmenu"]])])),noData:s((()=>[a("div",T,[Q,a("div",R,n(u.$t("authGroup.noData")),1),a("div",null,[u.$isPermitted("authGroup.create")?(t(),o("a",{key:0,href:"javascript:;",onClick:r[3]||(r[3]=e=>f.showAuthGroupFormModal=!0),class:"btn btn-outline-primary me-2"},[z,h(" "+n(u.$t("general.addNew")),1)])):p("",!0),u.$isPermitted("authGroup.import")?(t(),o("a",{key:1,href:"javascript:;",onClick:r[4]||(r[4]=e=>f.showAuthGroupImportModal=!0),class:"btn btn-outline-secondary"},[B,h(" "+n(u.$t("general.importData")),1)])):p("",!0)])])])),_:1},8,["limit","search","options"]),i(x,{onContextmenu:w.handleContextMenu,ref:"contextmenu"},{default:s((()=>[u.$isPermitted("authGroup.information")?(t(),m(I,{key:0,onClick:r[5]||(r[5]=e=>w.onContextMenuAction("show"))},{default:s((()=>[E,a("span",null,n(u.$t("general.information")),1)])),_:1})):p("",!0),u.$isPermitted("authGroup.edit")?(t(),m(I,{key:1,onClick:r[6]||(r[6]=e=>w.onContextMenuAction("edit"))},{default:s((()=>[J,a("span",null,n(u.$t("general.edit")),1)])),_:1})):p("",!0),u.$isPermitted("authGroup.delete")?(t(),m(I,{key:2,onClick:r[7]||(r[7]=e=>w.onContextMenuAction("delete"))},{default:s((()=>[K,a("span",null,n(u.$t("general.delete")),1)])),_:1})):p("",!0)])),_:1},8,["onContextmenu"])])]),u.$isPermitted("authGroup.create")||u.$isPermitted("authGroup.edit")?(t(),m(b,{key:1,title:f.authGroupId?u.$t("authGroup.editAuthGroup"):u.$t("authGroup.createAuthGroup"),modelValue:f.showAuthGroupFormModal,"onUpdate:modelValue":r[8]||(r[8]=e=>f.showAuthGroupFormModal=e)},{default:s((()=>[i($,{onUpdate:w.reloadData,oneLine:!1,authGroupId:f.authGroupId,ref:"authGroupForm"},null,8,["onUpdate","authGroupId"])])),_:1},8,["title","modelValue"])):p("",!0),u.$isPermitted("authGroup.information")?(t(),m(b,{key:2,title:u.$t("authGroup.viewAuthGroup"),modelValue:f.showAuthGroupViewModal,"onUpdate:modelValue":r[9]||(r[9]=e=>f.showAuthGroupViewModal=e)},{default:s((()=>[i(v,{oneLine:!0,authGroupId:f.authGroupId,ref:"authGroupView"},null,8,["authGroupId"])])),_:1},8,["title","modelValue"])):p("",!0)])};export{D as default};