import{r as x,w as p,a as m,c as v,b as y,d as w,u as g,h as S,e as t,t as a,f,v as k,g as A,o as r,i as d,F as h,j as _,n as b,l as T,k as F,m as V}from"./app-Dtb5XozN.js";import{_ as j}from"./AdminLayout--JZAX24q.js";const E={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between mb-6 gap-4"},L={class:"text-sm text-gray-500"},N={class:"flex gap-3"},B={class:"bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden"},M={class:"overflow-x-auto"},C={class:"w-full"},D={class:"divide-y divide-gray-100"},U={class:"px-6 py-4 text-sm font-medium text-gray-900"},q={class:"px-6 py-4 font-mono text-xs text-gray-600"},z={class:"px-6 py-4 text-sm text-gray-600"},H={class:"px-6 py-4"},O={class:"flex items-center space-x-2"},R={class:"text-sm capitalize text-gray-600"},I={class:"px-6 py-4 text-sm text-gray-500"},$={class:"px-6 py-4 text-sm text-gray-500"},G={class:"px-6 py-4 text-sm text-gray-600"},J={key:0,class:"px-6 py-4 border-t border-gray-100 flex items-center justify-between"},K={class:"text-sm text-gray-500"},P={class:"flex gap-2"},X={__name:"Activations",props:{activations:Object,filters:Object,total_active:Number},setup(o){const c=o,i=x(c.filters.search||""),l=x(c.filters.status||"");let u;return p(i,n=>{clearTimeout(u),u=setTimeout(()=>{m.get("/storesight/admin/activations",{search:n,status:l.value},{preserveState:!0,replace:!0})},300)}),p(l,n=>{m.get("/storesight/admin/activations",{search:i.value,status:n},{preserveState:!0,replace:!0})}),(n,s)=>(r(),v(j,null,{title:y(()=>[...s[2]||(s[2]=[V("Activations",-1)])]),default:y(()=>[w(g(S),{title:"Activations - Admin"}),t("div",E,[t("div",null,[s[3]||(s[3]=t("h2",{class:"text-xl font-bold text-gray-900"},"Site Activations",-1)),t("p",L,a(o.total_active)+" active sites",1)]),t("div",N,[f(t("input",{"onUpdate:modelValue":s[0]||(s[0]=e=>i.value=e),type:"text",placeholder:"Search domain or license...",class:"px-4 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-[#4F46E5] focus:border-[#4F46E5] outline-none w-64"},null,512),[[k,i.value]]),f(t("select",{"onUpdate:modelValue":s[1]||(s[1]=e=>l.value=e),class:"px-4 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-[#4F46E5] outline-none"},[...s[4]||(s[4]=[t("option",{value:""},"All Statuses",-1),t("option",{value:"active"},"Active",-1),t("option",{value:"inactive"},"Inactive",-1),t("option",{value:"revoked"},"Revoked",-1)])],512),[[A,l.value]])])]),t("div",B,[t("div",M,[t("table",C,[s[5]||(s[5]=t("thead",{class:"bg-gray-50"},[t("tr",null,[t("th",{class:"text-left text-xs font-medium text-gray-500 uppercase px-6 py-3"},"Domain"),t("th",{class:"text-left text-xs font-medium text-gray-500 uppercase px-6 py-3"},"License"),t("th",{class:"text-left text-xs font-medium text-gray-500 uppercase px-6 py-3"},"User"),t("th",{class:"text-left text-xs font-medium text-gray-500 uppercase px-6 py-3"},"Status"),t("th",{class:"text-left text-xs font-medium text-gray-500 uppercase px-6 py-3"},"Activated"),t("th",{class:"text-left text-xs font-medium text-gray-500 uppercase px-6 py-3"},"Last Seen"),t("th",{class:"text-left text-xs font-medium text-gray-500 uppercase px-6 py-3"},"Requests (24h)")])],-1)),t("tbody",D,[(r(!0),d(h,null,_(o.activations.data,e=>(r(),d("tr",{key:e.id},[t("td",U,a(e.domain),1),t("td",q,a(e.license_key),1),t("td",z,a(e.user_name),1),t("td",H,[t("div",O,[t("span",{class:b([{"bg-green-400":e.status==="active","bg-yellow-400":e.status==="inactive","bg-red-400":e.status==="revoked"},"w-2 h-2 rounded-full"])},null,2),t("span",R,a(e.status),1)])]),t("td",I,a(e.activated_at||"—"),1),t("td",$,a(e.last_seen_at||"—"),1),t("td",G,a(e.requests_24h),1)]))),128))])])]),o.activations.last_page>1?(r(),d("div",J,[t("p",K,"Showing "+a(o.activations.from)+"-"+a(o.activations.to)+" of "+a(o.activations.total),1),t("div",P,[(r(!0),d(h,null,_(o.activations.links,e=>(r(),v(g(T),{key:e.label,href:e.url||"#",class:b([e.active?"bg-[#4F46E5] text-white":e.url?"bg-white text-gray-700 hover:bg-gray-50":"bg-gray-100 text-gray-400 cursor-not-allowed","px-3 py-1 border border-gray-200 rounded text-sm"]),innerHTML:e.label},null,8,["href","class","innerHTML"]))),128))])])):F("",!0)])]),_:1}))}};export{X as default};
