import{$ as e,A as t,C as n,G as r,S as i,Wt as a,_ as o,d as s,dt as c,h as l,vt as u,y as d,z as f,zt as p}from"./vue.runtime.esm-bundler-DAWRyTnP.js";import{i as m}from"./vue-router-Bna4o8ws.js";import{t as h}from"./notification-BM55Quw3.js";import{t as g}from"./user-BMY0vNyo.js";import{n as _}from"./vue-i18n-C4HYJWrq.js";import{b as v,tt as y}from"./main-Gn9UsJwa.js";import{t as b}from"./payment-BOpWhJDa.js";import{t as x}from"./PaymentModeModal-M5mJWkcm.js";var S={__name:`PaymentModeIndexDropdown`,props:{row:{type:Object,default:null},table:{type:Object,default:null},loadData:{type:Function,default:null}},setup(s){let c=s,l=v();h();let{t:d}=_(),p=b(),x=m();g();let S=y();t(`utils`);function C(e){p.fetchPaymentMode(e),S.openModal({title:d(`settings.payment_modes.edit_payment_mode`),componentName:`PaymentModeModal`,refreshData:c.loadData&&c.loadData,size:`sm`})}function w(e){l.openDialog({title:d(`general.are_you_sure`),message:d(`settings.payment_modes.payment_mode_confirm_delete`),yesLabel:d(`general.ok`),noLabel:d(`general.cancel`),variant:`danger`,hideNoButton:!1,size:`lg`}).then(async t=>{t&&(await p.deletePaymentMode(e),c.loadData&&c.loadData())})}return(t,c)=>{let l=r(`BaseIcon`),d=r(`BaseButton`),p=r(`BaseDropdownItem`),m=r(`BaseDropdown`);return f(),o(m,null,{activator:e(()=>[u(x).name===`paymentModes.view`?(f(),o(d,{key:0,variant:`primary`},{default:e(()=>[n(l,{name:`EllipsisHorizontalIcon`,class:`h-5 text-white`})]),_:1})):(f(),o(l,{key:1,name:`EllipsisHorizontalIcon`,class:`h-5 text-gray-500`}))]),default:e(()=>[n(p,{onClick:c[0]||=e=>C(s.row.id)},{default:e(()=>[n(l,{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}),n(p,{onClick:c[1]||=e=>w(s.row.id)},{default:e(()=>[n(l,{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})]),_:1})}}},C={__name:`PaymentsModeSetting`,setup(t){let o=y();v();let u=b(),{t:m}=_(),h=c(null),g=l(()=>[{key:`name`,label:m(`settings.payment_modes.mode_name`),thClass:`extra`,tdClass:`font-medium text-gray-900`},{key:`actions`,label:``,tdClass:`text-right text-sm font-medium`,sortable:!1}]);async function C(){h.value&&h.value.refresh()}async function w({page:e,filter:t,sort:n}){let r={orderByField:n.fieldName||`created_at`,orderBy:n.order||`desc`,page:e},i=await u.fetchPaymentModes(r);return{data:i.data.data,pagination:{totalPages:i.data.meta.last_page,currentPage:e,totalCount:i.data.meta.total,limit:5}}}function T(){o.openModal({title:m(`settings.payment_modes.add_payment_mode`),componentName:`PaymentModeModal`,refreshData:h.value&&h.value.refresh,size:`sm`})}return(t,o)=>{let c=r(`BaseIcon`),l=r(`BaseButton`),u=r(`BaseTable`),m=r(`BaseSettingCard`);return f(),d(s,null,[n(x),n(m,{title:t.$t(`settings.payment_modes.title`),description:t.$t(`settings.payment_modes.description`)},{action:e(()=>[n(l,{type:`submit`,variant:`primary-outline`,onClick:T},{left:e(e=>[n(c,{class:p(e.class),name:`PlusIcon`},null,8,[`class`])]),default:e(()=>[i(` `+a(t.$t(`settings.payment_modes.add_payment_mode`)),1)]),_:1})]),default:e(()=>[n(u,{ref_key:`table`,ref:h,data:w,columns:g.value,class:`mt-16`},{"cell-actions":e(({row:e})=>[n(S,{row:e.data,table:h.value,"load-data":C},null,8,[`row`,`table`])]),_:1},8,[`columns`])]),_:1},8,[`title`,`description`])],64)}}};export{C as default};