import{B as e,C as t,H as n,Ot as r,S as i,Tt as a,W as o,_ as s,d as c,g as l,v as u,y as d}from"./vue.esm-bundler-DcNPjsgv.js";import{t as f}from"./message-Dd4UGIcx.js";import{t as p}from"./dollar-sign-BSjB0BB1.js";import{c as m,h,t as g}from"./js/plugin-main-js-file-B1a1bVnR.js";import{t as _}from"./PageTitle-C-u5BEk7.js";import{t as v}from"./CoffeeLoader-Cj27A_ck.js";var y={name:`Gateway`,components:{CreditCard:m,ArrowUpDown:h(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),DollarSign:p,PageTitle:_,CoffeeLoader:v},data(){return{gateways:[],stats:{},loading:!0}},computed:{gatewayList(){return this.gateways},connectedCount(){return this.gatewayList.filter(e=>e.status).length}},methods:{getAllMethods(){this.loading=!0,this.$get({action:`buymecoffee_admin_ajax`,route:`gateways`,buymecoffee_nonce:window.BuyMeCoffeeAdmin.buymecoffee_nonce}).then(e=>{this.gateways=e.data?.gateways||[],e.data?.stats&&(this.stats=e.data.stats)}).catch(()=>{f.error(`Could not load payment gateways.`)}).always(()=>{this.loading=!1})},formatTotal(e){return this.$formatAmount(e,window.BuyMeCoffeeAdmin?.default_currency||`USD`)}},mounted(){this.getAllMethods()}},b={class:`relative min-h-[200px]`},x={key:0,class:`bmc-gw-stats`},S={class:`bmc-gw-stat`},C={class:`bmc-gw-stat__icon bmc-gw-stat__icon--purple`},w={class:`bmc-gw-stat__value`},T={class:`bmc-gw-stat`},E={class:`bmc-gw-stat__icon bmc-gw-stat__icon--blue`},D={class:`bmc-gw-stat__value`},O={class:`bmc-gw-stat`},k={class:`bmc-gw-stat__icon bmc-gw-stat__icon--green`},A={class:`bmc-gw-stat__value`},j={key:1,class:`bmc-gateways`},M={class:`bmc-gateway-card__top`},N={class:`bmc-gateway-card__icon`},P=[`src`,`alt`],F={class:`bmc-gateway-card__info`},I={class:`bmc-gateway-card__name`},L={key:0,class:`bmc-gateway-card__badge bmc-gateway-card__badge--connected`},R={key:1,class:`bmc-gateway-card__badge bmc-gateway-card__badge--inactive`},z=[`onClick`],B={class:`bmc-gateway-card__desc`},V={class:`bmc-gateway-card__details`},H={class:`bmc-gateway-card__detail`},U={class:`bmc-gateway-card__detail-value`},W={class:`bmc-gateway-card__detail`},G={class:`bmc-gateway-card__detail-value`},K={class:`bmc-gateway-card__detail`},q={class:`bmc-gateway-card__detail-value`};function J(f,p,m,h,g,_){let v=o(`CoffeeLoader`),y=o(`PageTitle`),J=o(`CreditCard`),Y=o(`ArrowUpDown`),X=o(`DollarSign`);return e(),d(`div`,b,[t(v,{loading:g.loading},null,8,[`loading`]),t(y,{title:`Payment Gateways`,subtitle:`Configure and manage your payment processing methods.`}),g.loading?u(``,!0):(e(),d(`div`,x,[l(`div`,S,[l(`div`,C,[t(J,{size:18})]),l(`div`,null,[l(`p`,w,r(_.connectedCount)+` Connected`,1),p[0]||=l(`p`,{class:`bmc-gw-stat__label`},`Active gateways`,-1)])]),l(`div`,T,[l(`div`,E,[t(Y,{size:18})]),l(`div`,null,[l(`p`,D,r(g.stats.transaction_count||0)+` Transactions`,1),p[1]||=l(`p`,{class:`bmc-gw-stat__label`},`Total processed`,-1)])]),l(`div`,O,[l(`div`,k,[t(X,{size:18})]),l(`div`,null,[l(`p`,A,r(_.formatTotal(g.stats.total_amount)),1),p[2]||=l(`p`,{class:`bmc-gw-stat__label`},`Total volume`,-1)])])])),g.loading?u(``,!0):(e(),d(`div`,j,[(e(!0),d(c,null,n(_.gatewayList,(t,n)=>(e(),d(`div`,{key:n,class:`bmc-gateway-card`},[l(`div`,M,[l(`div`,N,[t.image?(e(),d(`img`,{key:0,src:t.image,alt:t.title+` logo`,class:`bmc-gateway-card__logo`},null,8,P)):(e(),s(J,{key:1,size:22}))]),l(`div`,F,[l(`h3`,I,r(t.title),1),t.status?(e(),d(`span`,L,` Connected `)):(e(),d(`span`,R,` Not Connected `))]),l(`button`,{class:`bmc-gateway-card__btn`,onClick:e=>f.$router.push({name:t.route})},` Configure `,8,z)]),l(`p`,B,r(t.description),1),l(`div`,V,[l(`div`,H,[p[3]||=l(`span`,{class:`bmc-gateway-card__detail-label`},`API Mode`,-1),l(`span`,U,[l(`span`,{class:a([`bmc-gateway-card__dot`,t.payment_mode===`live`?`bmc-gateway-card__dot--live`:`bmc-gateway-card__dot--test`])},null,2),i(` `+r(t.payment_mode===`live`?`Live`:`Test`),1)])]),l(`div`,W,[p[4]||=l(`span`,{class:`bmc-gateway-card__detail-label`},`Currencies`,-1),l(`span`,G,r(t.currencies||`—`),1)]),l(`div`,K,[p[5]||=l(`span`,{class:`bmc-gateway-card__detail-label`},`Last Transaction`,-1),l(`span`,q,r(t.last_transaction||`—`),1)])])]))),128))]))])}var Y=g(y,[[`render`,J],[`__scopeId`,`data-v-c410885a`]]);export{Y as default};