import{c,a as e,u as r,Z as _,w as d,b as t,o as u,F as p,e as g,t as o,i as x,f as m,N as f}from"./app-z_grtNg1.js";import{_ as h}from"./AdminLayout-D8-5CkB9.js";import{_ as n}from"./AppCard-C2KBW1s0.js";import{_ as b}from"./AppTable-7n8nNCI3.js";import{_ as v}from"./StatusBadge-DAu0ZF3H.js";import"./ToastStack-xenoaUxd.js";const V={class:"flex items-center justify-between gap-4"},$={class:"mx-auto max-w-7xl space-y-6 px-4 py-6 sm:px-6 lg:px-8"},k={class:"grid gap-4 md:grid-cols-4"},N={class:"divide-y divide-gray-100 bg-white text-sm"},w={class:"px-4 py-3"},S={class:"font-medium text-gray-900"},T={class:"text-xs text-gray-500"},B={class:"px-4 py-3 capitalize"},L={class:"px-4 py-3"},j={class:"px-4 py-3"},C={class:"px-4 py-3"},E={class:"text-sm font-medium text-gray-900"},M={class:"px-4 py-3"},O={class:"text-xs text-gray-600"},R={class:"px-4 py-3"},D={class:"flex justify-end gap-2"},F=["onClick"],Y={__name:"Index",props:{vendors:Object,counts:Object},setup(l){const y=i=>{f.post(route("admin.vendors.test-connection",i),{},{preserveScroll:!0})};return(i,a)=>(u(),c(p,null,[e(r(_),{title:"Vendors"}),e(h,null,{header:d(()=>[t("div",V,[a[1]||(a[1]=t("div",null,[t("h2",{class:"text-xl font-semibold text-gray-800"},"Vendors"),t("p",{class:"mt-1 text-sm text-gray-500"}," No vendor count cap is enforced. You can add as many vendors as needed. ")],-1)),e(r(x),{href:i.route("admin.vendors.create"),class:"rounded-md bg-gray-900 px-3 py-2 text-sm font-medium text-white hover:bg-gray-800"},{default:d(()=>[...a[0]||(a[0]=[m(" Add Vendor ",-1)])]),_:1},8,["href"])])]),default:d(()=>[t("div",$,[t("div",k,[e(n,{title:"MSORG",subtitle:`${l.counts.msorg_used||0} configured`},null,8,["subtitle"]),e(n,{title:"VTBox",subtitle:`${l.counts.vtbox_used||0} configured`},null,8,["subtitle"]),e(n,{title:"SMEPlug",subtitle:`${l.counts.smeplug_used||0} configured`},null,8,["subtitle"]),e(n,{title:"VTpass",subtitle:`${l.counts.vtpass_used||0} configured`},null,8,["subtitle"])]),e(b,null,{default:d(()=>[a[3]||(a[3]=t("thead",{class:"bg-gray-50"},[t("tr",{class:"text-left text-xs font-semibold uppercase tracking-wide text-gray-500"},[t("th",{class:"px-4 py-3"},"Vendor"),t("th",{class:"px-4 py-3"},"Type"),t("th",{class:"px-4 py-3"},"Status"),t("th",{class:"px-4 py-3"},"Timeout"),t("th",{class:"px-4 py-3"},"Balance"),t("th",{class:"px-4 py-3"},"Health"),t("th",{class:"px-4 py-3"})])],-1)),t("tbody",N,[(u(!0),c(p,null,g(l.vendors.data,s=>(u(),c("tr",{key:s.id},[t("td",w,[t("div",S,o(s.name),1),t("div",T,o(s.base_url||(s.type==="smeplug"?"Default SMEPlug URL":"No base URL")),1)]),t("td",B,o(s.type),1),t("td",L,[e(v,{status:s.status},null,8,["status"])]),t("td",j,o(s.timeout_seconds)+"s",1),t("td",C,[t("div",E,o(s.last_balance_display||"Not tested yet"),1)]),t("td",M,[t("div",O,[t("div",null,"Latency: "+o(s.last_latency_ms??"-")+"ms",1),t("div",null,"Last check: "+o(s.last_checked_at??"-"),1)])]),t("td",R,[t("div",D,[t("button",{type:"button",class:"rounded border border-gray-300 px-2.5 py-1 text-xs font-medium text-gray-700 hover:bg-gray-50",onClick:P=>y(s.id)}," Test ",8,F),e(r(x),{href:i.route("admin.vendors.edit",s.id),class:"rounded border border-gray-300 px-2.5 py-1 text-xs font-medium text-gray-700 hover:bg-gray-50"},{default:d(()=>[...a[2]||(a[2]=[m(" Edit ",-1)])]),_:1},8,["href"])])])]))),128))])]),_:1})])]),_:1})],64))}};export{Y as default};
