import{C as e,E as t,Ht as n,Q as r,R as i,W as a,g as o,gt as s,v as c,w as l,y as u}from"./vue.runtime.esm-bundler-56z_v_HH.js";import{a as d,i as f}from"./vue-router-_izWfDzq.js";import{n as p}from"./vue-i18n-DhldrKy8.js";import{o as m,x as h}from"./main-CkEZzrzw.js";var g=t({__name:`RecurringInvoiceDropdown`,props:{row:{},table:{default:null},loadData:{type:[Function,null],default:null},canEdit:{type:Boolean,default:!1},canView:{type:Boolean,default:!1},canDelete:{type:Boolean,default:!1}},setup(t){let g=t,_=h(),v=m(),{t:y}=p(),b=f(),x=d(),S=o(()=>b.name===`recurring-invoices.view`);function C(){v.openDialog({title:y(`general.are_you_sure`),message:y(`invoices.confirm_delete`),yesLabel:y(`general.ok`),noLabel:y(`general.cancel`),variant:`danger`,hideNoButton:!1,size:`lg`}).then(async e=>{if(e){let e=g.row;(await _.deleteMultipleRecurringInvoices(e.id)).data.success&&(g.table?.refresh(),_.$patch(e=>{e.selectedRecurringInvoices=[],e.selectAllField=!1}),S.value&&x.push(`/admin/recurring-invoices`))}})}return(o,d)=>{let f=a(`BaseIcon`),p=a(`BaseButton`),m=a(`BaseDropdownItem`),h=a(`router-link`),g=a(`BaseDropdown`);return i(),c(g,{"content-loading":s(_).isFetchingViewData},{activator:r(()=>[S.value?(i(),c(p,{key:0,variant:`primary`},{default:r(()=>[l(f,{name:`EllipsisHorizontalIcon`,class:`h-5 text-white`})]),_:1})):(i(),c(f,{key:1,name:`EllipsisHorizontalIcon`,class:`h-5 text-muted`}))]),default:r(()=>[t.canEdit?(i(),c(h,{key:0,to:`/admin/recurring-invoices/${t.row.id}/edit`},{default:r(()=>[l(m,null,{default:r(()=>[l(f,{name:`PencilIcon`,class:`w-5 h-5 mr-3 text-subtle group-hover:text-muted`}),e(` `+n(o.$t(`general.edit`)),1)]),_:1})]),_:1},8,[`to`])):u(``,!0),!S.value&&t.canView?(i(),c(h,{key:1,to:`recurring-invoices/${t.row.id}/view`},{default:r(()=>[l(m,null,{default:r(()=>[l(f,{name:`EyeIcon`,class:`w-5 h-5 mr-3 text-subtle group-hover:text-muted`}),e(` `+n(o.$t(`general.view`)),1)]),_:1})]),_:1},8,[`to`])):u(``,!0),t.canDelete?(i(),c(m,{key:2,onClick:C},{default:r(()=>[l(f,{name:`TrashIcon`,class:`w-5 h-5 mr-3 text-subtle group-hover:text-muted`}),e(` `+n(o.$t(`general.delete`)),1)]),_:1})):u(``,!0)]),_:1},8,[`content-loading`])}}});export{g as t};