1import{d as C,b as p,r as A,L as T,K as $,f as a,i as t,t as h,l as c,j as r,n as d,_ as f,F as E,N,D as S,a as g,v as n,x,z as _,m as U,k as j,e as D}from"./index.16ba4ea0.js";import"./vendor-highcharts.9b480a8e.js";import"https://cdn.jsdelivr.net/npm/[email protected]/dist/buttplug-wasm.mjs";const F={class:"mx-auto max-w-4xl px-4 py-6"},M={class:"flex flex-col sm:flex-row justify-between items-stretch sm:items-center gap-3 mb-4"},B={key:0,class:"bg-red-600 rounded px-3 py-1 text-white font-medium text-center text-sm sm:text-base shrink-0"},P={class:"overflow-x-auto bg-zinc-800 rounded-lg shadow-lg border border-zinc-700"},L={key:0,class:"items-center w-full bg-transparent"},H={class:"border-t-0 px-6 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4 text-left flex items-center"},K={class:"ml-3 font-bold text-white"},R={class:"border-t-0 px-6 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4"},q={class:"border-t-0 px-6 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4 flex gap-4"},G={key:1,class:"justify-center text-red-500 p-4"},I={key:0,class:"py-12 flex justify-center items-center"},Z=C({__name:"Subscribe",setup(J){const o=p([]),v=p("add"),m=p(""),u=p(!1),s=A({loading:!1,editing:!1,fields:{email:"",expireOn:""}}),w=(i="",e="")=>{v.value=i?"Update Expiration Date":"Add Premium User",s.fields.email=i,s.fields.expireOn=e,s.editing=!0},k=async()=>{try{if(s.fields.email!==""&&s.fields.expireOn!==""){const i=await g.admin.updatePremium(s.fields.email,s.fields.expireOn);y(i),b()}}catch(i){console.error("Error updating subscription:",i)}},V=async()=>{try{o.value=await g.admin.getPremiumUsers(),u.value=!1}catch(i){o.value=[],console.error("Error fetching premium users:",i)}},b=async()=>{s.editing=!1,s.fields.email="",s.fields.expireOn="",V()},z=async i=>{if(confirm("This will revoke the user's premium status without deleting the user.")&&i!==""){const e=await g.admin.removePremiumUser(i);y(e),b()}},y=i=>{m.value=i,setTimeout(()=>{m.value=""},2e3)};return T(async()=>{u.value=!0,await b()}),$(()=>{D({meta:[{name:"description",content:"Manage premium user access on FapTap. View, add, edit, or remove premium users and their subscription expiration dates. Admin panel for active premium accounts"}],link:[{rel:"canonical",href:"https://faptap.net/subscribe"}]})}),(i,e)=>(n(),a("div",F,[t("div",M,[e[5]||(e[5]=t("div",{class:"flex items-center"},[t("h1",{class:"text-white font-thin text-xl"},"Premium Users Active")],-1)),m.value?(n(),a("div",B,h(m.value),1)):c("",!0),r(f,{onClick:e[0]||(e[0]=l=>w()),theme:"blue",class:"flex gap-x-1.5 items-center justify-center w-full sm:w-auto self-start sm:self-auto px-4 py-2"},{default:d(()=>[r(x,{name:"plus",class:"h-5 w-5"}),e[4]||(e[4]=t("span",null,"Add",-1))]),_:1})]),t("div",P,[o.value.length>0&&!u.value?(n(),a("table",L,[e[6]||(e[6]=t("thead",null,[t("tr",null,[t("th",{class:"px-6 align-middle border border-solid py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left bg-zinc-800 text-zinc-300 border-zinc-700"}," Email"),t("th",{class:"px-6 align-middle border border-solid py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left bg-zinc-800 text-zinc-300 border-zinc-700"}," Expire On [yyyy-mm-dd]"),t("th",{class:"px-6 align-middle border border-solid py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left bg-zinc-800 text-zinc-300 border-zinc-700"}," Action")])],-1)),t("tbody",null,[(n(!0),a(E,null,N(o.value,(l,Q)=>(n(),a("tr",null,[t("th",H,[t("span",K,h(l.email),1)]),t("td",R,h(l.expireOn.split("T")[0]),1),t("td",q,[r(f,{theme:"light",dense:"",onClick:O=>w(l.email,l.expireOn.split("T")[0])},{default:d(()=>[r(x,{name:"pencil",class:"h-4 w-4 text-white"})]),_:1},8,["onClick"]),r(f,{theme:"red",dense:"",onClick:O=>z(l.email)},{default:d(()=>[r(x,{name:"trash",class:"h-4 w-4 text-white"})]),_:1},8,["onClick"])])]))),256))])])):c("",!0),o.value.length===0?(n(),a("div",G," Sorry, no premium users found. ")):c("",!0)]),u.value?(n(),a("div",I,[r(x,{name:"loading",class:"h-10 w-10 text-blue-500 animate-spin"})])):c("",!0),r(S,{modelValue:s.editing,"onUpdate:modelValue":e[3]||(e[3]=l=>s.editing=l),title:`${v.value}`,onupdate:""},{default:d(()=>[t("form",{onSubmit:j(k,["prevent"]),class:"mt-4 flex flex-col gap-y-3"},[r(_,{modelValue:s.fields.email,"onUpdate:modelValue":e[1]||(e[1]=l=>s.fields.email=l),type:"email",placeholder:"[email protected]"},null,8,["modelValue"]),r(_,{modelValue:s.fields.expireOn,"onUpdate:modelValue":e[2]||(e[2]=l=>s.fields.expireOn=l),type:"date"},null,8,["modelValue"]),r(f,{theme:"blue"},{default:d(()=>[...e[7]||(e[7]=[U("Submit",-1)])]),_:1})],32),e[8]||(e[8]=t("br",null,null,-1)),e[9]||(e[9]=t("small",null,"Note: Creates a new user if they do not exist and updates their premium status based on the provided input date",-1))]),_:1},8,["modelValue","title"])]))}});
1export{Z as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.