import{a8 as b,u as S,v as M,N as C,O as k,G as P,a6 as x,r as m,o as p,K as v,w as a,l as $,a as t,n as w,t as D,e as N,j as z,c as j,L as T,P as F}from"./main-DYvSVgaj.js";import{u as I}from"./payment-f49jS6a5.js";import{_ as L}from"./PaymentModeModal-BoiX4R4b.js";const O={__name:"PaymentModeIndexDropdown",props:{row:{type:Object,default:null},table:{type:Object,default:null},loadData:{type:Function,default:null}},setup(u){const d=u,y=b();S();const{t:s}=M.useI18n(),o=I(),_=C();k();const f=P();x("utils");function g(e){o.fetchPaymentMode(e),f.openModal({title:s("settings.payment_modes.edit_payment_mode"),componentName:"PaymentModeModal",refreshData:d.loadData&&d.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),d.loadData&&d.loadData())})}return(e,l)=>{const n=m("BaseIcon"),c=m("BaseButton"),r=m("BaseDropdownItem"),h=m("BaseDropdown");return p(),v(h,null,{activator:a(()=>[$(_).name==="paymentModes.view"?(p(),v(c,{key:0,variant:"primary"},{default:a(()=>[t(n,{name:"DotsHorizontalIcon",class:"h-5 text-white"})]),_:1})):(p(),v(n,{key:1,name:"DotsHorizontalIcon",class:"h-5 text-gray-500"}))]),default:a(()=>[t(r,{onClick:l[0]||(l[0]=i=>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"}),w(" "+D(e.$t("general.edit")),1)]),_:1}),t(r,{onClick:l[1]||(l[1]=i=>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"}),w(" "+D(e.$t("general.delete")),1)]),_:1})]),_:1})}}},G={__name:"PaymentsModeSetting",setup(u){const d=P();b();const y=I(),{t:s}=M.useI18n(),o=N(null),_=z(()=>[{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 f(){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(){d.openModal({title:s("settings.payment_modes.add_payment_mode"),componentName:"PaymentModeModal",refreshData:o.value&&o.value.refresh,size:"sm"})}return(e,l)=>{const n=m("BaseIcon"),c=m("BaseButton"),r=m("BaseTable"),h=m("BaseSettingCard");return p(),j(F,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(i=>[t(n,{class:T(i.class),name:"PlusIcon"},null,8,["class"])]),default:a(()=>[w(" "+D(e.$t("settings.payment_modes.add_payment_mode")),1)]),_:1})]),default:a(()=>[t(r,{ref_key:"table",ref:o,data:g,columns:_.value,class:"mt-16"},{"cell-actions":a(({row:i})=>[t(O,{row:i.data,table:o.value,"load-data":f},null,8,["row","table"])]),_:1},8,["columns"])]),_:1},8,["title","description"])],64)}}};export{G as default};
