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-CDvcaxiQ.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:`text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap`},k={scope:`col`,class:`text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap`},A={scope:`col`,class:`relative w-16 py-3.5 ps-3 pe-4 sm:pe-6 lg:pe-8`},j={class:`sr-only`},M={class:`divide-y divide-gray-200 bg-white dark:divide-gray-700 dark:bg-gray-900`},N={class:`py-4 ps-4 pe-3 text-sm whitespace-nowrap sm:ps-6 lg:ps-8`},P={class:`px-3 py-4 text-sm whitespace-nowrap`},F={class:`px-3 py-4 text-sm whitespace-nowrap`},I={class:`px-3 py-4 text-sm`},L={class:`line-clamp-2 max-w-xs min-w-56`},R={class:`relative w-16 py-4 ps-3 pe-4 text-end text-sm font-medium whitespace-nowrap sm:pe-6 lg:pe-8`},z={key:1},B={colspan:`100%`},V={class:`text-mute py-3.5 ps-4 pe-3 text-sm font-light whitespace-nowrap sm:ps-2 lg:ps-4`},H={class:`-mx-4 sm:-mx-6 lg:-mx-8`},U=Object.assign({layout:y},{__name:`Index`,props:[`customer_groups`,`price_groups`],setup(y){let U=r(!1),W=r(null),G=r(!1),K=r(!1);function q(e){W.value=e,U.value=!0}function J(e){K.value=!0,a.delete(route(`customer_groups.destroy`,e.id),{preserveScroll:!0,onSuccess:()=>G.value=e.id,onFinish:()=>K.value=!1})}function Y(){W.value=null,U.value=!1}return(r,a)=>{let X=l(`Head`),Z=l(`Header`);return s(),h(o,null,[m(X,null,{default:v(()=>[u(`title`,null,n(r.$t(`Customer Groups`)),1)]),_:1}),m(Z,null,{subheading:v(()=>[c(n(r.$t(`Please review the data below`)),1)]),menu:v(()=>[r.$can(`create-customer-groups`)?(s(),g(e(i),{key:0,type:`button`,onClick:a[0]||=e=>U.value=!0},{default:v(()=>[c(n(r.$t(`Add {x}`,{x:r.$t(`Customer Group`)})),1)]),_:1})):p(``,!0)]),default:v(()=>[c(n(r.$t(`Customer Groups`))+` `,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(`Discount`)),1),u(`th`,O,n(r.$t(`Price Group`)),1),u(`th`,k,n(r.$t(`Details`)),1),u(`th`,A,[u(`span`,j,n(r.$t(`Actions`)),1)])])]),u(`tbody`,M,[y.customer_groups&&y.customer_groups.data&&y.customer_groups.data.length?(s(!0),h(o,{key:0},_(y.customer_groups.data,t=>(s(),h(`tr`,{key:t.id},[u(`td`,N,n(t.name),1),u(`td`,P,n(r.$number(t.discount)),1),u(`td`,F,n(t.price_group?.name||``),1),u(`td`,I,[u(`div`,L,n(t.details),1)]),u(`td`,R,[m(e(f),{row:t,editRow:q,deleted:G.value,deleting:K.value,deleteRow:J,permission:`customer-groups`,record:r.$t(`Customer Group`)},null,8,[`row`,`deleted`,`deleting`,`record`])])]))),128)):(s(),h(`tr`,z,[u(`td`,B,[u(`div`,V,n(r.$t(`There is no data to display!`)),1)])]))])])])])]),u(`div`,H,[m(e(t),{class:`mx-4 mt-auto py-2 text-sm sm:mx-6`,meta:y.customer_groups.meta,links:y.customer_groups.links},null,8,[`meta`,`links`])]),m(e(d),{show:U.value,backdrop:!1,"max-width":`2xl`,closeable:!0,onClose:Y},{default:v(()=>[m(b,{current:W.value,onClose:Y,onDone:Y,price_groups:y.price_groups},null,8,[`current`,`price_groups`])]),_:1},8,[`show`])])],64)}}});export{U as default};