import{C as e,E as t,Ht as n,Q as r,R as i,W as a,g as o,v as s,w as c,y as l}from"./vue.runtime.esm-bundler-56z_v_HH.js";import{a as u,i as d}from"./vue-router-_izWfDzq.js";import{n as f}from"./vue-i18n-DhldrKy8.js";import{I as p,o as m}from"./main-CkEZzrzw.js";import{t as h}from"./store-D_xKg5fZ.js";var g=t({__name:`PaymentDropdown`,props:{row:{},table:{default:null},contentLoading:{type:Boolean,default:!1},canEdit:{type:Boolean,default:!1},canView:{type:Boolean,default:!1},canDelete:{type:Boolean,default:!1},canSend:{type:Boolean,default:!1}},setup(t){let g=t,_=h(),v=m(),y=p(),{t:b}=f(),x=d(),S=u(),C=o(()=>x.name===`payments.view`);function w(){v.openDialog({title:b(`general.are_you_sure`),message:b(`payments.confirm_delete`),yesLabel:b(`general.ok`),noLabel:b(`general.cancel`),variant:`danger`,hideNoButton:!1,size:`lg`}).then(async e=>{if(e){let e=g.row;await _.deletePayment({ids:[e.id]}),S.push(`/admin/payments`),g.table?.refresh()}})}function T(){let e=g.row,t=`${window.location.origin}/payments/pdf/${e.unique_hash}`;navigator.clipboard.writeText(t).catch(()=>{let e=document.createElement(`textarea`);e.value=t,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)})}function E(){let e=g.row;y.openModal({title:b(`payments.send_payment`),componentName:`SendPaymentModal`,id:e.id,data:e,variant:`lg`})}return(o,u)=>{let d=a(`BaseIcon`),f=a(`BaseButton`),p=a(`BaseDropdownItem`),m=a(`router-link`),h=a(`BaseDropdown`);return i(),s(h,{"content-loading":t.contentLoading},{activator:r(()=>[C.value?(i(),s(f,{key:0,variant:`primary`},{default:r(()=>[c(d,{name:`EllipsisHorizontalIcon`,class:`h-5 text-white`})]),_:1})):(i(),s(d,{key:1,name:`EllipsisHorizontalIcon`,class:`h-5 text-muted`}))]),default:r(()=>[C.value&&t.canView?(i(),s(p,{key:0,class:`rounded-md`,onClick:T},{default:r(()=>[c(d,{name:`LinkIcon`,class:`w-5 h-5 mr-3 text-subtle group-hover:text-muted`}),e(` `+n(o.$t(`general.copy_pdf_url`)),1)]),_:1})):l(``,!0),t.canEdit?(i(),s(m,{key:1,to:`/admin/payments/${t.row.id}/edit`},{default:r(()=>[c(p,null,{default:r(()=>[c(d,{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`])):l(``,!0),!C.value&&t.canView?(i(),s(m,{key:2,to:`/admin/payments/${t.row.id}/view`},{default:r(()=>[c(p,null,{default:r(()=>[c(d,{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`])):l(``,!0),!C.value&&t.canSend?(i(),s(p,{key:3,onClick:E},{default:r(()=>[c(d,{name:`PaperAirplaneIcon`,class:`w-5 h-5 mr-3 text-subtle group-hover:text-muted`}),e(` `+n(o.$t(`payments.send_payment`)),1)]),_:1})):l(``,!0),t.canDelete?(i(),s(p,{key:4,onClick:w},{default:r(()=>[c(d,{name:`TrashIcon`,class:`w-5 h-5 mr-3 text-subtle group-hover:text-muted`}),e(` `+n(o.$t(`general.delete`)),1)]),_:1})):l(``,!0)]),_:1},8,[`content-loading`])}}});export{g as t};