import{c as N}from"./crud-HgA7krBk.js";import{_ as U,R as z,az as F,aA as H,b as I,E as j,r as l,o as d,c as E,a,w as n,G as D,h as q,l as i,t as r,i as _,k as m,j as G,ay as J,aB as $,aC as L,q as Q,B as W,a0 as X,J as Y}from"./app-DyK1k-lL.js";import{A as Z,f as x}from"./AddEdit-49EI1zFD.js";import{S as ee}from"./SettingSidebar-Cll4T40R.js";import{A as ae}from"./AdminPageHeader-DvckKcMF.js";import"./datatable-CE60mo9E.js";import"./filter-D9xdVtXb.js";import"./apiAdmin-I34Xe3Oj.js";import"./SaveOutlined-BNo3Yq0P.js";import"./MailOutlined-DWzdPUv5.js";import"./TranslationOutlined-B31Ad7sh.js";import"./UserOutlined-BvZJcUdY.js";import"./ShoppingCartOutlined-CQ7XsBiT.js";import"./ScheduleOutlined-BgXa0dBI.js";import"./AppstoreAddOutlined-DyGqleK0.js";import"./FormOutlined-BlxA-1Lv.js";import"./index-IxYN3YHr.js";const ne={components:{PlusOutlined:z,EditOutlined:F,DeleteOutlined:H,AddEdit:Z,SettingSidebar:ee,AdminPageHeader:ae},setup(){const{permsArray:e}=I(),{url:C,addEditUrl:A,initData:t,columns:k,filterableColumns:g,preFetchData:f,getPreFetchData:y}=x(),o=N();return j(()=>{y(),o.tableUrl.value={url:C,filters:""},o.table.filterableColumns=g,o.fetch({page:1}),o.crudUrl.value=A,o.langKey.value="role",o.initData.value={...t},o.formData.value={...t}}),{permsArray:e,columns:k,...o,filterableColumns:g,preFetchData:f}}},te={class:"table-responsive"};function oe(e,C,A,t,k,g){const f=J,y=l("router-link"),o=$,w=L,v=l("AdminPageHeader"),S=l("SettingSidebar"),c=Q,O=l("PlusOutlined"),u=W,h=l("DeleteOutlined"),B=X,b=q,P=l("admin-page-filters"),T=l("AddEdit"),V=l("EditOutlined"),R=Y,K=l("admin-page-table-content");return d(),E(D,null,[a(v,null,{header:n(()=>[a(f,{title:e.$t("menu.roles"),class:"p-0"},null,8,["title"])]),breadcrumb:n(()=>[a(w,{separator:"-",style:{"font-size":"12px"}},{default:n(()=>[a(o,null,{default:n(()=>[a(y,{to:{name:"admin.dashboard.index"}},{default:n(()=>[i(r(e.$t("menu.dashboard")),1)]),_:1},8,["to"])]),_:1}),a(o,null,{default:n(()=>[i(r(e.$t("menu.settings")),1)]),_:1}),a(o,null,{default:n(()=>[i(r(e.$t("menu.roles")),1)]),_:1})]),_:1})]),_:1}),a(b,null,{default:n(()=>[a(c,{xs:24,sm:24,md:24,lg:4,xl:4,class:"bg-setting-sidebar"},{default:n(()=>[a(S)]),_:1}),a(c,{xs:24,sm:24,md:24,lg:20,xl:20},{default:n(()=>[a(P,null,{default:n(()=>[a(b,{gutter:[16,16]},{default:n(()=>[a(c,{xs:24,sm:24,md:12,lg:10,xl:10},{default:n(()=>[a(B,null,{default:n(()=>[t.permsArray.includes("roles_create")||t.permsArray.includes("admin")?(d(),_(u,{key:0,type:"primary",onClick:e.addItem},{default:n(()=>[a(O),i(" "+r(e.$t("role.add")),1)]),_:1},8,["onClick"])):m("",!0),e.table.selectedRowKeys.length>0&&(t.permsArray.includes("roles_delete")||t.permsArray.includes("admin"))?(d(),_(u,{key:1,type:"primary",onClick:e.showSelectedDeleteConfirm,danger:""},{icon:n(()=>[a(h)]),default:n(()=>[i(" "+r(e.$t("common.delete")),1)]),_:1},8,["onClick"])):m("",!0)]),_:1})]),_:1})]),_:1})]),_:1}),a(K,null,{default:n(()=>[a(T,{addEditType:e.addEditType,visible:e.addEditVisible,url:e.addEditUrl,onAddEditSuccess:e.addEditSuccess,onClosed:e.onCloseAddEdit,formData:e.formData,data:e.viewData,pageTitle:e.pageTitle,successMessage:e.successMessage},null,8,["addEditType","visible","url","onAddEditSuccess","onClosed","formData","data","pageTitle","successMessage"]),a(b,null,{default:n(()=>[a(c,{span:24},{default:n(()=>[G("div",te,[a(R,{"row-selection":{selectedRowKeys:e.table.selectedRowKeys,onChange:e.onRowSelectChange,getCheckboxProps:s=>({disabled:!((t.permsArray.includes("roles_delete")||t.permsArray.includes("admin"))&&s.name!="admin"),name:s.xid})},columns:t.columns,"row-key":s=>s.xid,"data-source":e.table.data,pagination:e.table.pagination,loading:e.table.loading,onChange:e.handleTableChange,bordered:"",size:"middle"},{bodyCell:n(({column:s,record:p})=>[s.dataIndex==="action"?(d(),E(D,{key:0},[(t.permsArray.includes("roles_edit")||t.permsArray.includes("admin"))&&p.name!="admin"?(d(),_(u,{key:0,type:"primary",onClick:M=>e.editItem(p),style:{"margin-left":"4px"}},{icon:n(()=>[a(V)]),_:2},1032,["onClick"])):m("",!0),(t.permsArray.includes("roles_delete")||t.permsArray.includes("admin"))&&p.name!="admin"?(d(),_(u,{key:1,type:"primary",onClick:M=>e.showDeleteConfirm(p.xid),style:{"margin-left":"4px"}},{icon:n(()=>[a(h)]),_:2},1032,["onClick"])):m("",!0)],64)):m("",!0)]),_:1},8,["row-selection","columns","row-key","data-source","pagination","loading","onChange"])])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})],64)}const he=U(ne,[["render",oe]]);export{he as default};
