import{aO as E,u as b,a7 as k,M as x,v as C,L as S,e as V,a5 as $,r as c,o as n,m as a,w as o,l as t,a as r,Q as p,p as v,t as _,K as f}from"./main-B9dpPbRR.js";const A={__name:"RecurringInvoiceIndexDropdown",props:{row:{type:Object,default:null},table:{type:Object,default:null},loadData:{type:Function,default:()=>{}}},setup(l){const y=l,g=E(),w=b(),D=k(),m=x(),{t:s}=C.useI18n(),h=S();V(),$("utils");async function B(i=null){D.openDialog({title:s("general.are_you_sure"),message:s("invoices.confirm_delete"),yesLabel:s("general.ok"),noLabel:s("general.cancel"),variant:"danger",hideNoButton:!1,size:"lg"}).then(async u=>{u&&await g.deleteMultipleRecurringInvoices(i).then(e=>{e.data.success?(y.table&&y.table.refresh(),g.$patch(d=>{d.selectedRecurringInvoices=[],d.selectAllField=!1}),w.showNotification({type:"success",message:s("recurring_invoices.deleted_message",2)})):e.data.error&&w.showNotification({type:"error",message:e.data.message})})})}return(i,u)=>{const e=c("BaseIcon"),d=c("BaseButton"),I=c("BaseDropdownItem"),R=c("router-link"),N=c("BaseDropdown");return n(),a(N,{"content-loading":t(g).isFetchingViewData},{activator:o(()=>[t(h).name==="recurring-invoices.view"?(n(),a(d,{key:0,variant:"primary"},{default:o(()=>[r(e,{name:"DotsHorizontalIcon",class:"h-5 text-white"})]),_:1})):(n(),a(e,{key:1,name:"DotsHorizontalIcon",class:"h-5 text-gray-500"}))]),default:o(()=>[t(m).hasAbilities(t(p).EDIT_RECURRING_INVOICE)?(n(),a(R,{key:0,to:`/admin/recurring-invoices/${l.row.id}/edit`},{default:o(()=>[r(I,null,{default:o(()=>[r(e,{name:"PencilIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),v(" "+_(i.$t("general.edit")),1)]),_:1})]),_:1},8,["to"])):f("",!0),t(h).name!=="recurring-invoices.view"&&t(m).hasAbilities(t(p).VIEW_RECURRING_INVOICE)?(n(),a(R,{key:1,to:`recurring-invoices/${l.row.id}/view`},{default:o(()=>[r(I,null,{default:o(()=>[r(e,{name:"EyeIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),v(" "+_(i.$t("general.view")),1)]),_:1})]),_:1},8,["to"])):f("",!0),t(m).hasAbilities(t(p).DELETE_RECURRING_INVOICE)?(n(),a(I,{key:2,onClick:u[0]||(u[0]=O=>B(l.row.id))},{default:o(()=>[r(e,{name:"TrashIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),v(" "+_(i.$t("general.delete")),1)]),_:1})):f("",!0)]),_:1},8,["content-loading"])}}};export{A as _};
