import{$ as e,A as t,C as n,G as r,S as i,Wt as a,_ as o,v as s,vt as c,z as l}from"./vue.runtime.esm-bundler-DAWRyTnP.js";import{a as u,i as d}from"./vue-router-Bna4o8ws.js";import{t as f}from"./notification-BM55Quw3.js";import{t as p}from"./user-gWi04hVo.js";import{n as m}from"./vue-i18n-C4HYJWrq.js";import"./invoice-DZk9hMdo.js";import{B as h,Pn as g,b as _}from"./main-CgSmSYZA.js";var v={__name:`RecurringInvoiceIndexDropdown`,props:{row:{type:Object,default:null},table:{type:Object,default:null},loadData:{type:Function,default:()=>{}}},setup(v){let y=v,b=h(),x=f(),S=_(),C=p(),{t:w}=m(),T=d();u(),t(`utils`);async function E(e=null){S.openDialog({title:w(`general.are_you_sure`),message:w(`invoices.confirm_delete`),yesLabel:w(`general.ok`),noLabel:w(`general.cancel`),variant:`danger`,hideNoButton:!1,size:`lg`}).then(async t=>{t&&await b.deleteMultipleRecurringInvoices(e).then(e=>{e.data.success?(y.table&&y.table.refresh(),b.$patch(e=>{e.selectedRecurringInvoices=[],e.selectAllField=!1}),x.showNotification({type:`success`,message:w(`recurring_invoices.deleted_message`,2)})):e.data.error&&x.showNotification({type:`error`,message:e.data.message})})})}return(t,u)=>{let d=r(`BaseIcon`),f=r(`BaseButton`),p=r(`BaseDropdownItem`),m=r(`router-link`),h=r(`BaseDropdown`);return l(),o(h,{"content-loading":c(b).isFetchingViewData},{activator:e(()=>[c(T).name===`recurring-invoices.view`?(l(),o(f,{key:0,variant:`primary`},{default:e(()=>[n(d,{name:`EllipsisHorizontalIcon`,class:`h-5 text-white`})]),_:1})):(l(),o(d,{key:1,name:`EllipsisHorizontalIcon`,class:`h-5 text-gray-500`}))]),default:e(()=>[c(C).hasAbilities(c(g).EDIT_RECURRING_INVOICE)?(l(),o(m,{key:0,to:`/admin/recurring-invoices/${v.row.id}/edit`},{default:e(()=>[n(p,null,{default:e(()=>[n(d,{name:`PencilIcon`,class:`w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500`}),i(` `+a(t.$t(`general.edit`)),1)]),_:1})]),_:1},8,[`to`])):s(``,!0),c(T).name!==`recurring-invoices.view`&&c(C).hasAbilities(c(g).VIEW_RECURRING_INVOICE)?(l(),o(m,{key:1,to:`recurring-invoices/${v.row.id}/view`},{default:e(()=>[n(p,null,{default:e(()=>[n(d,{name:`EyeIcon`,class:`w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500`}),i(` `+a(t.$t(`general.view`)),1)]),_:1})]),_:1},8,[`to`])):s(``,!0),c(C).hasAbilities(c(g).DELETE_RECURRING_INVOICE)?(l(),o(p,{key:2,onClick:u[0]||=e=>E(v.row.id)},{default:e(()=>[n(d,{name:`TrashIcon`,class:`w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500`}),i(` `+a(t.$t(`general.delete`)),1)]),_:1})):s(``,!0)]),_:1},8,[`content-loading`])}}};export{v as t};