PageSourceSearch

https://mmohub.app/assets/AdminSubscriptionPlans-CqrZu3Y1.js

js mmohub.app collected 2026-10-02 01:14:40 UTC 8,493 bytes, 1 lines download raw bytes

1import{c as r,o,a as t,d as L,r as u,e as q,y,k as M,w as B,h as _,i as g,j as k,u as m,t as n,F as E,g as I,n as V,l as O,G as $,z as i,A as d,N as R,_ as j}from"./index-EaLmg-Ni.js";import{_ as z}from"./DashboardLayout.vue_vue_type_script_setup_true_lang-B5Fp9Obf.js";import{r as T}from"./PlusIcon-DUJh80o5.js";import{r as G}from"./CheckCircleIcon-DNtydSXF.js";import{r as K}from"./ExclamationTriangleIcon-y-jUX5oK.js";import{r as H}from"./PencilIcon-Jfbzy_0x.js";import{r as J}from"./EyeIcon-s15l79wt.js";import"./useI18n-DJ3Xy1Go.js";import"./ShieldCheckIcon-BF8Bt-c4.js";import"./BookOpenIcon-DIE_f_q9.js";import"./CpuChipIcon-IlHlDgIv.js";import"./LanguageSwitcher.vue_vue_type_script_setup_true_lang-Bitf4i4g.js";function Q(D,b){return o(),r("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"})])}const W={class:"admin-subscription-plans"},X={class:"page-header"},Y={key:0,class:"success-banner"},Z={key:1,class:"error-banner"},tt={key:2,class:"loading-state"},et={key:3,class:"plans-table-container"},lt={class:"plans-table"},st={class:"plan-name-cell"},at={class:"font-semibold"},ot={class:"text-xs text-muted-foreground"},nt={class:"font-mono"},it={class:"font-mono"},rt={class:"action-buttons"},ut=["onClick"],dt=["onClick","title"],pt={key:0,class:"empty-state"},ct={class:"modal-title"},mt={class:"form-grid"},vt={class:"form-group"},ft={class:"form-group"},_t={class:"form-group full-width"},bt={class:"form-group"},yt={class:"form-group"},gt={class:"form-group"},kt={class:"form-group"},xt={class:"form-group"},ht={class:"form-group"},wt={class:"form-group"},Pt={class:"checkbox-label"},Ct={class:"modal-actions"},Mt=["disabled"],Vt={key:0,class:"spinner-small"},$t=L({__name:"AdminSubscriptionPlans",setup(D){const b=u([]),x=u(!0),v=u(!1),f=u(""),p=u(""),h=u(!1),w=u(!1),c=u(null),s=u({name:"",slug:"",description:null,price_monthly:0,daily_credits:0,rpm_limit:null,polar_product_id:null,polar_price_id:null,is_active:!0,display_order:0});q(async()=>{await P()});async function P(){try{x.value=!0;const a=await y.get("/subscriptions/plans");b.value=a.data}catch{p.value="Failed to load plans"}finally{x.value=!1}}function U(a){c.value=a,s.value={...a},w.value=!0}async function N(){var a,e;try{v.value=!0,p.value="",c.value?(await y.put(`/admin/subscription-plans/${c.value.id}`,s.value),f.value="Plan updated successfully"):(await y.post("/admin/subscription-plans",s.value),f.value="Plan created successfully"),await P(),C()}catch(l){p.value=((e=(a=l.response)==null?void 0:a.data)==null?void 0:e.detail)||"Failed to save plan"}finally{v.value=!1}}async function S(a){try{await y.put(`/admin/subscription-plans/${a.id}`,{is_active:!a.is_active}),f.value=`Plan ${a.is_active?"deactivated":"activated"} successfully`,await P()}catch{p.value="Failed to update plan status"}}function C(){h.value=!1,w.value=!1,c.value=null,s.value={name:"",slug:"",description:null,price_monthly:0,daily_credits:0,rpm_limit:null,polar_product_id:null,polar_price_id:null,is_active:!0,display_order:0}}function A(a){if(!a)return"0";const e=typeof a=="string"?parseFloat(a):a;return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(0)+"K":e.toString()}return(a,e)=>(o(),M(z,null,{default:B(()=>[t("div",W,[t("div",X,[e[13]||(e[13]=t("div",null,[t("h1",{class:"text-3xl font-bold text-landing"},"Subscription Plans Management"),t("p",{class:"text-muted-foreground mt-2"}," Create and manage subscription plans for your platform ")],-1)),t("button",{onClick:e[0]||(e[0]=l=>h.value=!0),class:"btn-primary"},[g(m(T),{class:"w-5 h-5 mr-2"}),e[12]||(e[12]=k(" Create Plan ",-1))])]),f.value?(o(),r("div",Y,[g(m(G),{class:"w-5 h-5"}),k(" "+n(f.value),1)])):_("",!0),p.value?(o(),r("div",Z,[g(m(K),{class:"w-5 h-5"}),k(" "+n(p.value),1)])):_("",!0),x.value?(o(),r("div",tt,[...e[14]||(e[14]=[t("div",{class:"spinner"},null,-1),t("p",{class:"text-muted-foreground mt-4"},"Loading plans...",-1)])])):(o(),r("div",et,[t("table",lt,[e[15]||(e[15]=t("thead",null,[t("tr",null,[t("th",null,"Plan Name"),t("th",null,"Price/Month"),t("th",null,"Daily Credits (24h)"),t("th",null,"RPM Limit"),t("th",null,"Status"),t("th",null,"Actions")])],-1)),t("tbody",null,[(o(!0),r(E,null,I(b.value,l=>(o(),r("tr",{key:l.id,class:V({"inactive-row":!l.is_active})},[t("td",null,[t("div",st,[t("span",at,n(l.name),1),t("span",ot,n(l.slug),1)])]),t("td",nt,"$"+n(l.price_monthly),1),t("td",it,n(A(l.daily_credits)),1),t("td",null,n(l.rpm_limit||"-"),1),t("td",null,[t("span",{class:V(["status-badge",l.is_active?"status-active":"status-inactive"])},n(l.is_active?"Active":"Inactive"),3)]),t("td",null,[t("div",rt,[t("button",{onClick:F=>U(l),class:"btn-icon",title:"Edit"},[g(m(H),{class:"w-4 h-4"})],8,ut),t("button",{onClick:F=>S(l),class:"btn-icon",title:l.is_active?"Deactivate":"Activate"},[(o(),M(O(l.is_active?m(Q):m(J)),{class:"w-4 h-4"}))],8,dt)])])],2))),128))])]),b.value.length===0?(o(),r("div",pt,[...e[16]||(e[16]=[t("p",{class:"text-muted-foreground"},"No subscription plans found",-1)])])):_("",!0)])),h.value||w.value?(o(),r("div",{key:4,class:"modal-overlay",onClick:C},[t("div",{class:"modal-content",onClick:e[11]||(e[11]=$(()=>{},["stop"]))},[t("h3",ct,n(c.value?"Edit Plan":"Create New Plan"),1),t("form",{onSubmit:$(N,["prevent"]),class:"plan-form"},[t("div",mt,[t("div",vt,[e[17]||(e[17]=t("label",null,"Plan Name",-1)),i(t("input",{"onUpdate:modelValue":e[1]||(e[1]=l=>s.value.name=l),type:"text",required:"",placeholder:"e.g., Pro",class:"form-input"},null,512),[[d,s.value.name]])]),t("div",ft,[e[18]||(e[18]=t("label",null,"Slug",-1)),i(t("input",{"onUpdate:modelValue":e[2]||(e[2]=l=>s.value.slug=l),type:"text",required:"",placeholder:"e.g., pro",class:"form-input"},null,512),[[d,s.value.slug]])]),t("div",_t,[e[19]||(e[19]=t("label",null,"Description",-1)),i(t("textarea",{"onUpdate:modelValue":e[3]||(e[3]=l=>s.value.description=l),rows:"2",placeholder:"Plan description",class:"form-input"},null,512),[[d,s.value.description]])]),t("div",bt,[e[20]||(e[20]=t("label",null,"Price per Month ($)",-1)),i(t("input",{"onUpdate:modelValue":e[4]||(e[4]=l=>s.value.price_monthly=l),type:"number",step:"0.01",required:"",class:"form-input"},null,512),[[d,s.value.price_monthly,void 0,{number:!0}]])]),t("div",yt,[e[21]||(e[21]=t("label",null,"Daily Credits (tokens)",-1)),i(t("input",{"onUpdate:modelValue":e[5]||(e[5]=l=>s.value.daily_credits=l),type:"number",required:"",class:"form-input"},null,512),[[d,s.value.daily_credits,void 0,{number:!0}]])]),t("div",gt,[e[22]||(e[22]=t("label",null,"RPM Limit",-1)),i(t("input",{"onUpdate:modelValue":e[6]||(e[6]=l=>s.value.rpm_limit=l),type:"number",placeholder:"Requests per minute",class:"form-input"},null,512),[[d,s.value.rpm_limit,void 0,{number:!0}]])]),t("div",kt,[e[23]||(e[23]=t("label",null,"Display Order",-1)),i(t("input",{"onUpdate:modelValue":e[7]||
1(e[7]=l=>s.value.display_order=l),type:"number",class:"form-input"},null,512),[[d,s.value.display_order,void 0,{number:!0}]])]),t("div",xt,[e[24]||(e[24]=t("label",null,"Polar Product ID",-1)),i(t("input",{"onUpdate:modelValue":e[8]||(e[8]=l=>s.value.polar_product_id=l),type:"text",placeholder:"Optional",class:"form-input"},null,512),[[d,s.value.polar_product_id]])]),t("div",ht,[e[25]||(e[25]=t("label",null,"Polar Price ID",-1)),i(t("input",{"onUpdate:modelValue":e[9]||(e[9]=l=>s.value.polar_price_id=l),type:"text",placeholder:"Optional",class:"form-input"},null,512),[[d,s.value.polar_price_id]])]),t("div",wt,[t("label",Pt,[i(t("input",{"onUpdate:modelValue":e[10]||(e[10]=l=>s.value.is_active=l),type:"checkbox",class:"form-checkbox"},null,512),[[R,s.value.is_active]]),e[26]||(e[26]=t("span",null,"Active",-1))])])]),t("div",Ct,[t("button",{type:"button",onClick:C,class:"btn-secondary"}," Cancel "),t("button",{type:"submit",disabled:v.value,class:"btn-primary"},[v.value?(o(),r("div",Vt)):_("",!0),k(" "+n(v.value?"Saving...":c.value?"Update Plan":"Create Plan"),1)],8,Mt)])],32)])])):_("",!0)])]),_:1}))}}),Rt=j($t,[["__scopeId","data-v-2d3103a3"]]);export{Rt 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.