import{An as e,C as t,Nn as n,On as r,P as i,Pn as a,Qt as o,_n as s,an as c,bn as l,en as u,kt as d,mt as f,nn as p,on as m,rn as h,tn as g,vn as _,wn as v}from"./app-4kCgdoJR.js";import{t as y}from"./AdminLayout-DEe0k-dp.js";import b from"./Form-CYZrmtOu.js";var x={class:`flex grow flex-col items-stretch justify-stretch self-stretch bg-white px-4 sm:px-6 lg:px-8 dark:bg-gray-800`},S={class:`flow-root grow`},C={class:`-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8`},w={class:`my-2 inline-block min-w-full border-b border-gray-200 align-middle dark:border-gray-700`},T={class:`fixed-actions min-w-full divide-y divide-gray-200 dark:divide-gray-700`},E={scope:`col`,class:`text-focus py-3.5 ps-4 pe-3 text-start text-sm font-semibold whitespace-nowrap sm:ps-6 lg:ps-8`},D={scope:`col`,class:`text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap`},O={scope:`col`,class:`relative w-16 py-3.5 ps-3 pe-4 sm:pe-6 lg:pe-8`},k={class:`sr-only`},A={class:`divide-y divide-gray-200 bg-white dark:divide-gray-700 dark:bg-gray-900`},j=[`onClick`],M=[`onClick`],N={class:`relative w-16 py-4 ps-3 pe-4 text-end text-sm font-medium whitespace-nowrap sm:pe-6 lg:pe-8`},P={key:1},F={colspan:`100%`},I={class:`text-mute py-3.5 ps-4 pe-3 text-sm font-light whitespace-nowrap sm:ps-2 lg:ps-4`},L={class:`-mx-4 sm:-mx-6 lg:-mx-8`},R=Object.assign({layout:y},{__name:`Index`,props:[`roles`],setup(y){let R=r(!1),z=r(null),B=r(!1),V=r(!1);function H(e){z.value=e,R.value=!0}function U(e){V.value=!0,a.delete(route(`roles.destroy`,e.id),{preserveScroll:!0,onSuccess:()=>B.value=e.id,onFinish:()=>V.value=!1})}function W(){z.value=null,R.value=!1}return(r,a)=>{let G=l(`Head`),K=l(`Header`);return s(),h(o,null,[m(G,null,{default:v(()=>[u(`title`,null,n(r.$t(`Roles`)),1)]),_:1}),m(K,null,{subheading:v(()=>[c(n(r.$t(`Please review the data below`)),1)]),menu:v(()=>[r.$can(`create-roles`)?(s(),g(e(i),{key:0,type:`button`,onClick:a[0]||=e=>R.value=!0},{default:v(()=>[c(n(r.$t(`Add {x}`,{x:r.$t(`Role`)})),1)]),_:1})):p(``,!0)]),default:v(()=>[c(n(r.$t(`Roles`))+` `,1)]),_:1}),u(`div`,x,[u(`div`,S,[u(`div`,C,[u(`div`,w,[u(`table`,T,[u(`thead`,null,[u(`tr`,null,[u(`th`,E,n(r.$t(`Name`)),1),u(`th`,D,n(r.$t(`Created at`)),1),u(`th`,O,[u(`span`,k,n(r.$t(`Actions`)),1)])])]),u(`tbody`,A,[y.roles&&y.roles.data&&y.roles.data.length?(s(!0),h(o,{key:0},_(y.roles.data,t=>(s(),h(`tr`,{key:t.id},[u(`td`,{onClick:e=>r.viewRow(t),class:`cursor-pointer py-4 ps-4 pe-3 text-sm whitespace-nowrap sm:ps-6 lg:ps-8`},n(t.name),9,j),u(`td`,{onClick:e=>r.viewRow(t),class:`cursor-pointer px-3 py-4 text-sm whitespace-nowrap`},n(r.$datetime(t.created_at)),9,M),u(`td`,N,[m(e(f),{row:t,deleted:B.value,permission:`roles`,deleting:V.value,record:r.$t(`Role`),editRow:[`Super Admin`,`Customer`,`Supplier`].includes(t.name)?null:H,deleteRow:[`Super Admin`,`Customer`,`Supplier`].includes(t.name)?null:U},null,8,[`row`,`deleted`,`deleting`,`record`,`editRow`,`deleteRow`])])]))),128)):(s(),h(`tr`,P,[u(`td`,F,[u(`div`,I,n(r.$t(`There is no data to display!`)),1)])]))])])])])]),u(`div`,L,[m(e(t),{class:`mx-4 mt-auto py-2 text-sm sm:mx-6`,meta:y.roles.meta,links:y.roles.links},null,8,[`meta`,`links`])]),m(e(d),{show:R.value,backdrop:!1,overflow:!0,"max-width":`2xl`,closeable:!0,onClose:W},{default:v(()=>[m(b,{current:z.value,onClose:W,onDone:W},null,8,[`current`])]),_:1},8,[`show`])])],64)}}});export{R as default};