1import{c as q}from"./constants.b3b304fb.js";import{d as A,S as B,g as j,r as b,a7 as z,o as n,c as y,a as e,m as V,t as f,l as I,n as k,b as u,i as F,a8 as L,a9 as R,aa as U,ab as E,h as O,F as D,k as M,e as _,s as m,q as Y,u as G,$ as J,G as K,J as H,Y as Q,x as X,y as Z,p as ee,ac as te}from"./index.5fae8736.js";import{h as N,O as T}from"./radio-group.0783afbe.js";import"./form.d33bfb74.js";import"./keyboard.0484eec2.js";import"./use-tree-walker.44d492cb.js";import"./focus-management.76d8efea.js";import"./hidden.3c31f2c3.js";import"./description.de0b5db1.js";import"./label.dbeab01a.js";const se={class:"bg-white border rounded-md",style:{height:"50%"}},oe={class:"p-5 text-2xl"},ae={class:"text-red-600"},re={class:"p-5 divide-y"},ie={"aria-labelledby":"plan-heading"},ne={action:"#",method:"POST"},le={class:"shadow sm:overflow-hidden sm:rounded-md"},ue={class:"space-y-6 bg-white px-4 py-6 sm:p-6"},de={"aria-label":"Pricing plans"},ce={class:"relative -space-y-px rounded-md bg-white"},pe={class:"flex items-center text-sm"},me={class:"ml-3 font-medium text-gray-900"},fe={class:"ml-6 pl-1 text-sm md:ml-0 md:pl-0 md:text-center"},be={class:"bg-gray-50 px-4 py-3 text-left sm:px-6"},ge={key:1,class:"inline-flex"},ve={class:"mt-10"},ye={"aria-label":"Privacy setting"},he={class:"ml-3 flex flex-col"},xe=A({__name:"NoneActiveWorkspace",props:{workspace:{type:Object,required:!0},data:{type:Object,required:!1}},async setup(P){let d,w;const S=B(),{snapshotToModel:W}=Y();let o=j(),c=b();const h=b([]);h.value=([d,w]=z(()=>L(R(E.collection(),U("public","==",!0))).then(i=>i.docs.map(t=>W(t)))),d=await d,w(),d);let g=[];h.value.forEach(i=>{let t=j(),s=i.amount.toString(),p=(i.amount*12).toString(),r=1;t.activeWorkspace.seats&&(r=t.activeWorkspace.seats),g.push({name:i.publicName,priceMonthly:s,priceYearly:p,seats:r.toString()+" seats",Id:i.priceId})});const a=P;function x(){o.activeWorkspace=c.value,o.activeWorkspaceID=o.workspaces.indexOf(c.value)}async function v(){let i=1;a.workspace.seats&&(i=a.workspace.seats),a.workspace.stripeSubscriptionId==null?await O.get("https://suade-tech.herokuapp.com/activateworkspace",{params:{secret:"4b8fff6a-e8a6-11ed-a05b-0242ac120003",workspaceId:a.workspace.id,priceId:l.value.Id,seats:i.toString()}}).then(t=>{window.open(t.data)}):O.get("https://suade-tech.herokuapp.com/customerbilling",{params:{secret:"4b8fff6a-e8a6-11ed-a05b-0242ac120003",customerid:a.workspace.stripeCustomerId}}).then(t=>{console.log(t),window.open(t.data.url)})}const l=b(g[1]);b(!0),(a.data.reason="PurchaseSeats")&&alert("you need to purchase more seats");function $(){S.push({name:"settings"})}return(i,t)=>(n(),y("div",se,[e("div",oe,[t[2]||(t[2]=V(" The Workspace ",-1)),e("strong",ae,f(a.workspace.name),1),t[3]||(t[3]=V(" is not active ",-1))]),e("div",re,[e("section",ie,[e("form",ne,[e("div",le,[e("div",ue,[t[6]||(t[6]=e("div",null,[e("h2",{id:"plan-heading",class:"text-lg font-medium leading-6 text-gray-900"},"Activate now ")],-1)),e("fieldset",de,[I(u(N),{modelValue:l.value,"onUpdate:modelValue":t[0]||(t[0]=s=>l.value=s)},{default:k(()=>[e("div",ce,[(n(!0),y(D,null,M(u(g),(s,p)=>(n(),_(u(T),{as:"template",key:s.name,value:s,"aria-label":s.name,"aria-description":`${s.priceMonthly} per month, ${s.priceYearly} per year, ${s.seats}`},{default:k(({checked:r,active:C})=>[e("div",{class:m([p===0?"rounded-tl-md rounded-tr-md":"",p===u(g).length-1?"rounded-bl-md rounded-br-md":"",r?"z-10 border-orange-200 bg-orange-50":"border-gray-200","relative flex cursor-pointer flex-col border p-4 focus:outline-none md:grid md:grid-cols-3 md:pr-6"])},[e("span",pe,[e("span",{class:m([r?"bg-orange-500 border-transparent":"bg-white border-gray-300",C?"ring-2 ring-offset-2 ring-gray-900":"","h-4 w-4 rounded-full border flex items-center justify-center"]),"aria-hidden":"true"},[...t[4]||(t[4]=[e("span",{class:"rounded-full bg-white w-1.5 h-1.5"},null,-1)])],2),e("span",me,f(s.name),1)]),e("span",fe,[e("span",{class:m([r?"text-orange-900":"text-gray-900","font-medium"])},f(s.priceMonthly)+" / mo",3),t[5]||(t[5]=V(" "+f(" ")+" ",-1)),e("span",{class:m(r?"text-orange-700":"text-gray-500")},"("+f(s.priceYearly)+" / yr)",3)]),e("span",{as:"span",class:m([r?"text-orange-700":"text-gray-500","ml-6 pl-1 text-sm md:ml-0 md:pl-0 md:text-right"])},f(s.seats),3)],2)]),_:2},1032,["value","aria-label","aria-description"]))),128))])]),_:1},8,["modelValue"])])]),e("div",be,[t[7]||(t[7]=e("button",{type:"button",class:"inline-flex justify-center rounded-md bg-gray-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-gray-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-900 mr-2"}
1," Deactive Workspace",-1)),a.data.reason!=="PurchaseSeats"?(n(),y("button",{key:0,type:"button",onClick:v,class:"inline-flex justify-center rounded-md bg-gray-900 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-gray-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-900"}," Purchase ")):(n(),y("div",ge,[e("button",{type:"button",onClick:v,class:"mr-3 inline-flex justify-center rounded-md bg-gray-900 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-gray-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-900"}," Purchase More Seats "),e("button",{type:"button",onClick:$,class:"inline-flex justify-center rounded-md bg-gray-900 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-gray-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-900"}," Deactivate users ")]))])])])]),e("div",ve,[t[9]||(t[9]=e("p",{class:"text-lg"},"Your Workspaces",-1)),e("fieldset",ye,[I(u(N),{modelValue:u(c),"onUpdate:modelValue":t[1]||(t[1]=s=>F(c)?c.value=s:c=s),class:"-space-y-px rounded-md bg-white"},{default:k(()=>[(n(!0),y(D,null,M(u(o).workspaces,(s,p)=>(n(),_(u(T),{as:"template",key:p,value:s,"aria-label":s.name},{default:k(({checked:r,active:C})=>[e("div",{class:m([p===0?"rounded-tl-md rounded-tr-md":"",p===u(o).workspaces.length-1?"rounded-bl-md rounded-br-md":"",r?"z-10 border-indigo-200 bg-indigo-50":"border-gray-200","relative flex cursor-pointer border p-4 focus:outline-none"])},[e("span",{class:m([r?"bg-indigo-600 border-transparent":"bg-white border-gray-300",C?"ring-2 ring-offset-2 ring-indigo-600":"","mt-0.5 h-4 w-4 shrink-0 cursor-pointer rounded-full border flex items-center justify-center"]),"aria-hidden":"true"},[...t[8]||(t[8]=[e("span",{class:"rounded-full bg-white w-1.5 h-1.5"},null,-1)])],2),e("span",he,[e("span",{class:m([r?"text-indigo-900":"text-gray-900","block text-sm font-medium"])},f(s.name),3)])],2)]),_:2},1032,["value","aria-label"]))),128))]),_:1},8,["modelValue"])]),e("div",{class:"flex flex-wrap mt-3"},[e("button",{type:"button",onClick:x,class:"mr-3 block rounded-md bg-indigo-600 px-3 py-2 text-center text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"}," Switch Workspace "),e("button",{type:"button",onClick:x,class:"block rounded-md bg-green-600 px-3 py-2 text-center text-sm font-semibold text-white shadow-sm hover:bg-green-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"}," Add Workspace ")])])])]))}}),we={key:0},De=A({__name:"WorkspaceLayoutView",setup(P){const{user:d,isAuthenticated:w}=G(),{snapshotToModel:S}=Y(),W=J(),o=b(),c=b(),h=b({reason:""}),g=async a=>{if(!a)return;o.value=await ee(te.doc(a)).then(l=>{if(l.exists())return S(l)});const x=o.value.seats;console.log(o.value);const v=Object.keys(o.value.users).length;x<v&&(alert("you need to purchase more seats, or deactivate a user"),c.value=!0,h.value.reason="PurchaseSeats",o.value.active=!1),console.log("in workspace, users, seats")};return w&&(d==null?void 0:d.uid)&&(K(()=>W.params.workspaceId,g,{immediate:!0}),H(q,Q(o))),(a,x)=>{var l;const v=X("router-view");return(l=o.value)!=null&&l.id?(n(),y("div",we,[o.value.active?(n(),_(v,{key:0})):(n(),_(xe,{key:1,workspace:o.value,data:h.value},null,8,["workspace","data"]))])):Z("",!0)}}});export{De 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.