import{aU as E,u as b,a8 as k,O as x,v as C,N as S,q as V,a6 as $,r as c,o as n,K as a,w as o,l as t,a as r,U as p,n as v,t as _,M as f}from"./main-DYvSVgaj.js";const j={__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 N(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"),B=c("BaseDropdown");return n(),a(B,{"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=>N(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{j as _};
