import{a7 as M,u as S,v as b,L as k,M as C,F as I,a5 as x,r as m,o as p,m as v,w as a,l as $,a as t,p as w,t as D,f as N,k as z,c as T,J as j,N as F}from"./main-B9dpPbRR.js";import{u as P}from"./payment-Y8OywN76.js";import{_ as L}from"./PaymentModeModal-ywSNH2DC.js";const H={__name:"PaymentModeIndexDropdown",props:{row:{type:Object,default:null},table:{type:Object,default:null},loadData:{type:Function,default:null}},setup(u){const d=u,y=M();S();const{t:s}=b.useI18n(),o=P(),_=k();C();const f=I();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})}}},J={__name:"PaymentsModeSetting",setup(u){const d=I();M();const y=P(),{t:s}=b.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(),T(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:j(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(H,{row:i.data,table:o.value,"load-data":f},null,8,["row","table"])]),_:1},8,["columns"])]),_:1},8,["title","description"])],64)}}};export{J as default};
