PageSourceSearch

https://www.xpark.ai/assets/AdminLayout-CL2RoDRE.js

js xpark.ai collected 2026-10-05 14:02:22 UTC 6,426 bytes, 26 lines download raw bytes

1import{h as m,a as N,c as A,r,d as k,g as I,u as R,i as z,j as a,f as B,N as _,k as E,l as O,B as w,L as H,m as U,e as D,O as j,U as M,n as V,T as W,p as T,C as X,q as $,P as G,v as F,M as J}from"./index-FWKSGZPO.js";import{M as C}from"./message-circle-D33wQSco.js";import{B as S}from"./bot-BJNvdIwS.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const L=m("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const K=m("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const P=m("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
17 * @license lucide-react v0.462.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const Q=m("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
22 * @license lucide-react v0.462.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const Y=m("SquareParking",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);function Z(){const{user:t,loading:o}=N(),s=A(),[p,n]=r.useState(!0),[i,x]=r.useState(!1),[l,g]=r.useState(null),[h,f]=r.useState(null),[b,y]=r.useState(!1);return r.useEffect(()=>{if(o)return;if(!t){s("/admin/login",{replace:!0});return}let c=!0;return(async()=>{var v;const{data:e}=await k.from("user_roles").select("role").eq("user_id",t.id);if(!c)return;const u=new Set((e??[]).map(q=>String(q.role)));if(u.has("xpark_admin")){x(!0),n(!1);return}if(u.has("atendimento")){y(!0),n(!1);return}const{data:d}=await k.from("memberships").select("organization_id, organizations(slug)").eq("user_id",t.id).limit(1).maybeSingle();if(c){if(d!=null&&d.organization_id){g(d.organization_id),f(((v=d.organizations)==null?void 0:v.slug)??null),n(!1);return}I.error("Esta área é restrita."),s("/",{replace:!0})}})(),()=>{c=!1}},[t,o,s]),{isAdmin:i,orgId:l,orgSlug:h,isAttendance:b,checking:o||p}}const aa=[{to:"/admin",label:"Dashboard",icon:P,end:!0},{to:"/admin/reservas",label:"Reservas",icon:L},{to:"/admin/clientes",label:"Clientes",icon:M},{to:"/admin/usuarios",label:"Usuários",icon:V},{to:"/admin/vagas",label:"Vagas",icon:Y},{to:"/admin/precos",label:"Preços",icon:W},{to:"/admin/cupons",label:"Cupons",icon:T},{to:"/admin/alteracoes",label:"Alterações",icon:K},{to:"/admin/cancelamentos",label:"Cancelamentos",icon:X},{to:"/admin/avaliacoes",label:"Avaliações",icon:$},{to:"/admin/viajantes",label:"Viajantes",icon:G},{to:"/admin/assinaturas",label:"Assinaturas",icon:Q},{to:"/admin/pagamentos",label:"Pagamentos",icon:F},{to:"/admin/whatsapp",label:"WhatsApp",icon:C},{to:"/admin/bandi",label:"Bandy IA",icon:S},{to:"/admin/email-preview",label:"E-mails",icon:J}],ea=[{to:"/admin",label:"Dashboard",icon:P,end:!0},{to:"/admin/reservas",label:"Reservas",icon:L},{to:"/admin/clientes",label:"Clientes",icon:M}],ta=[{to:"/admin/whatsapp",label:"WhatsApp",icon:C},{to:"/admin/bandi",label:"Bandy IA",icon:S}],sa=["/admin/whatsapp","/admin/bandi"];function oa(){R();const t=Z(),{checking:o,isAdmin:s,orgId:p,orgSlug:n,isAttendance:i}=t,{signOut:x,user:l}=N(),g=A(),h=z(),f=h.pathname.startsWith("/admin/whatsapp");if(o||!(s||!!p||!!i))return a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx(B,{className:"h-6 w-6 animate-spin text-muted-foreground"})});if(i&&!s&&!sa.some(e=>h.pathname.startsWith(e)))return a.jsx(_,{to:"/admin/whatsapp",replace:!0});const y=s?aa:i?ta:ea,c=s?"Admin":i?"Atendimento":n?`Parceiro · ${n.charAt(0).toUpperCase()+n.slice(1)}`:"Parceiro";return a.jsxs("div",{className:"min-h-screen flex w-full bg-muted/30 notranslate",translate:"no",children:[a.jsx(E,{title:"Admin · xpark",description:"Painel interno do xpark.",path:"/admin",noindex:!0}),a.jsxs("aside",{className:"w-60 border-r bg-card flex flex-col sticky top-0 h-screen self-start",children:[a.jsxs("div",{className:"px-5 py-4 border-b",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"Xpark.ai"}),a.jsx("div",{className:"font-semibold",children:c})]}),a.jsx("nav",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:y.map(e=>a.jsxs(O,{to:e.to,end:e.end,className:({isActive:u})=>`flex items-center gap-2 rounded-md px-3 py-2 text-sm transition ${u?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:[a.jsx(e.icon,{className:"h-4 w-4"}),e.label]},e.to))}),a.jsxs("div",{className:"p-3 border-t space-y-2 mt-auto",children:[a.jsx("div",{className:"text-xs text-muted-foreground truncate",children:l==null?void 0:l.email}),a.jsx(w,{asChild:!0,variant:"outline",size:"sm",className:"w-full",children:a.jsxs(H,{to:"/",children:[a.jsx(U,{className:"h-4 w-4 mr-2"}),"Voltar para o site"]})}),a.jsxs(w,{variant:"outline",size:"sm",className:"w-full",onClick:async()=>{await x(),g("/admin/login")},children:[a.jsx(D,{className:"h-4 w-4 mr-2"}),"Sair"]})]})]}),f?a.jsx("main",{className:"flex-1 overflow-hidden",children:a.jsx(j,{context:t})}):a.jsx("main",{className:"flex-1 overflow-auto",children:a.jsx("div",{className:"p-6 max-w-[1600px] mx-auto",children:a.jsx(j,{context:t})})})]})}export{oa 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.