import{J as D,G as I,ah as x,r as d,o as p,l as b,w as a,u as M,f as t,i as v,t as w,B as $,k as j,e as N,m as z,F as T}from"./vendor.d12b5734.js";import{u as P}from"./payment.93619753.js";import{j as C,u as F,e as H,c as S}from"./main.465728e1.js";import{_ as L}from"./PaymentModeModal.a0b58785.js";const O={props:{row:{type:Object,default:null},table:{type:Object,default:null},loadData:{type:Function,default:null}},setup(u){const i=u,y=C();F();const{t:s}=D(),o=P(),f=I();H();const _=S();x("utils");function g(e){o.fetchPaymentMode(e),_.openModal({title:s("settings.payment_modes.edit_payment_mode"),componentName:"PaymentModeModal",refreshData:i.loadData&&i.loadData,size:"sm"})}function B(e){y.openDialog({title:s("general.are_you_sure"),message:s("settings.payment_modes.payment_mode_confirm_delete"),yesLabel:s("general.ok"),noLabel:s("general.cancel"),variant:"danger",hideNoButton:!1,size:"lg"}).then(async l=>{l&&(await o.deletePaymentMode(e),i.loadData&&i.loadData())})}return(e,l)=>{const n=d("BaseIcon"),c=d("BaseButton"),r=d("BaseDropdownItem"),h=d("BaseDropdown");return p(),b(h,null,{activator:a(()=>[M(f).name==="paymentModes.view"?(p(),b(c,{key:0,variant:"primary"},{default:a(()=>[t(n,{name:"DotsHorizontalIcon",class:"h-5 text-white"})]),_:1})):(p(),b(n,{key:1,name:"DotsHorizontalIcon",class:"h-5 text-gray-500"}))]),default:a(()=>[t(r,{onClick:l[0]||(l[0]=m=>g(u.row.id))},{default:a(()=>[t(n,{name:"PencilIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),v(" "+w(e.$t("general.edit")),1)]),_:1}),t(r,{onClick:l[1]||(l[1]=m=>B(u.row.id))},{default:a(()=>[t(n,{name:"TrashIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),v(" "+w(e.$t("general.delete")),1)]),_:1})]),_:1})}}},R={setup(u){const i=S();C();const y=P(),{t:s}=D(),o=$(null),f=j(()=>[{key:"name",label:s("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 _(){o.value&&o.value.refresh()}async function g({page:e,filter:l,sort:n}){let c={orderByField:n.fieldName||"created_at",orderBy:n.order||"desc",page:e},r=await y.fetchPaymentModes(c);return{data:r.data.data,pagination:{totalPages:r.data.meta.last_page,currentPage:e,totalCount:r.data.meta.total,limit:5}}}function B(){i.openModal({title:s("settings.payment_modes.add_payment_mode"),componentName:"PaymentModeModal",refreshData:o.value&&o.value.refresh,size:"sm"})}return(e,l)=>{const n=d("BaseIcon"),c=d("BaseButton"),r=d("BaseTable"),h=d("BaseSettingCard");return p(),N(T,null,[t(L),t(h,{title:e.$t("settings.payment_modes.title"),description:e.$t("settings.payment_modes.description")},{action:a(()=>[t(c,{type:"submit",variant:"primary-outline",onClick:B},{left:a(m=>[t(n,{class:z(m.class),name:"PlusIcon"},null,8,["class"])]),default:a(()=>[v(" "+w(e.$t("settings.payment_modes.add_payment_mode")),1)]),_:1})]),default:a(()=>[t(r,{ref:(m,k)=>{k.table=m,o.value=m},data:g,columns:M(f),class:"mt-16"},{"cell-actions":a(({row:m})=>[t(O,{row:m.data,table:o.value,"load-data":_},null,8,["row","table"])]),_:1},8,["columns"])]),_:1},8,["title","description"])],64)}}};export{R as default};
