import{$ as e,C as t,E as n,Ht as r,Lt as i,Q as a,R as o,W as s,X as c,_ as l,b as u,g as d,l as f,lt as p,ut as m,v as h,w as g}from"./vue.runtime.esm-bundler-56z_v_HH.js";import{n as _}from"./vue-i18n-DhldrKy8.js";import{t as v}from"./admin.store-C8xuxISP.js";var y=n({__name:`AdminCompanyDropdown`,props:{row:{},table:{},loadData:{type:[Function,null]}},setup(e){return(n,i)=>{let c=s(`BaseIcon`),l=s(`BaseDropdownItem`),u=s(`router-link`),d=s(`BaseDropdown`);return o(),h(d,null,{activator:a(()=>[g(c,{name:`EllipsisHorizontalIcon`,class:`h-5 text-muted`})]),default:a(()=>[g(u,{to:`/admin/administration/companies/${e.row.id}/edit`},{default:a(()=>[g(l,null,{default:a(()=>[g(c,{name:`PencilIcon`,class:`w-5 h-5 mr-3 text-subtle group-hover:text-muted`}),t(` `+r(n.$t(`general.edit`)),1)]),_:1})]),_:1},8,[`to`])]),_:1})}}}),b={class:`flex items-center justify-end space-x-5`},x={class:`relative table-container`},S={key:0},C={key:1,class:`text-subtle`},w={key:0},T={key:1,class:`text-subtle`},E=n({__name:`AdminCompaniesView`,setup(n){let E=v(),{t:D}=_(),O=m(!1),k=m(!0),A=m(null),j=p({search:``}),M=d(()=>[{key:`name`,label:D(`administration.companies.company_name`),thClass:`extra`,tdClass:`font-medium text-heading`},{key:`owner`,label:D(`administration.companies.owner`),sortable:!1},{key:`owner_email`,label:D(`general.email`),sortable:!1},{key:`actions`,tdClass:`text-right text-sm font-medium`,sortable:!1}]),N=d(()=>!E.totalCompanies&&!k.value);c(j,()=>{P()},{deep:!0});function P(){A.value?.refresh()}async function F({page:e,sort:t}){let n={search:j.search||``,orderByField:t.fieldName||`name`,orderBy:t.order||`asc`,page:e};k.value=!0;let r=await E.fetchCompanies(n);return k.value=!1,{data:r.data,pagination:{totalPages:r.meta.last_page,currentPage:e,totalCount:r.meta.total,limit:10}}}function I(){j.search=``}function L(){O.value&&I(),O.value=!O.value}return(n,c)=>{let d=s(`BaseBreadcrumbItem`),p=s(`BaseBreadcrumb`),m=s(`BaseIcon`),_=s(`BaseButton`),v=s(`BasePageHeader`),E=s(`BaseInput`),D=s(`BaseInputGroup`),k=s(`BaseFilterWrapper`),R=s(`BaseEmptyPlaceholder`),z=s(`router-link`),B=s(`BaseTable`),V=s(`BasePage`);return o(),h(V,null,{default:a(()=>[g(v,{title:n.$t(`administration.companies.title`)},{actions:a(()=>[l(`div`,b,[g(_,{variant:`primary-outline`,onClick:L},{right:a(e=>[O.value?(o(),h(m,{key:1,name:`XMarkIcon`,class:i(e.class)},null,8,[`class`])):(o(),h(m,{key:0,name:`FunnelIcon`,class:i(e.class)},null,8,[`class`]))]),default:a(()=>[t(r(n.$t(`general.filter`))+` `,1)]),_:1})])]),default:a(()=>[g(p,null,{default:a(()=>[g(d,{title:n.$t(`general.home`),to:`dashboard`},null,8,[`title`]),g(d,{title:n.$t(`administration.companies.title`),to:`#`,active:``},null,8,[`title`])]),_:1})]),_:1},8,[`title`]),g(k,{show:O.value,class:`mt-3`,onClear:I},{default:a(()=>[g(D,{label:n.$t(`administration.companies.company_name`),class:`flex-1 mt-2`},{default:a(()=>[g(E,{modelValue:j.search,"onUpdate:modelValue":c[0]||=e=>j.search=e,type:`text`,name:`search`,autocomplete:`off`},null,8,[`modelValue`])]),_:1},8,[`label`])]),_:1},8,[`show`]),e(g(R,{title:n.$t(`administration.companies.no_companies`),description:n.$t(`administration.companies.list_description`)},{default:a(()=>[g(m,{name:`BuildingOfficeIcon`,class:`mt-5 mb-4 h-16 w-16 text-subtle`})]),_:1},8,[`title`,`description`]),[[f,N.value]]),e(l(`div`,x,[g(B,{ref_key:`tableRef`,ref:A,data:F,columns:M.value,class:`mt-3`},{"cell-name":a(({row:e})=>[g(z,{to:{name:`admin.companies.edit`,params:{id:e.data.id}},class:`font-medium text-primary-500`},{default:a(()=>[t(r(e.data.name),1)]),_:2},1032,[`to`])]),"cell-owner":a(({row:e})=>[e.data.owner?(o(),u(`span`,S,r(e.data.owner.name),1)):(o(),u(`span`,C,`-`))]),"cell-owner_email":a(({row:e})=>[e.data.owner?(o(),u(`span`,w,r(e.data.owner.email),1)):(o(),u(`span`,T,`-`))]),"cell-actions":a(({row:e})=>[g(y,{row:e.data,table:A.value,"load-data":P},null,8,[`row`,`table`])]),_:1},8,[`columns`])],512),[[f,!N.value]])]),_:1})}}});export{E as default};