PageSourceSearch

https://aerya.ai/assets/SuperAdmin-DNtiy7cL.js

js aerya.ai collected 2026-10-05 11:47:01 UTC 27,956 bytes, 6 lines download raw bytes

1import{c as ee,u as w,r as b,j as e,C as N,a as S,d as C,e as D,L as f,I as p,k as v,m as j,n as U,o as ae,b as A,p as se,q as ie,s as te,D as B,t as R,v as G,w as K,x as H,y as L,z as Q,B as P,E as ne,F as le,G as ce,H as F,T as re}from"./index-C6q0mM1b.js";import{P as oe,F as de}from"./PSSConfigFields-BlEKoYW7.js";import{S as y,a as k,b as V,c as _,d as u}from"./select-SKl2E0BS.js";import{D as ue}from"./database-D7NjmInW.js";import{C as fe}from"./checkbox-ChswXqkt.js";import{C as me}from"./credit-card-CcqS-0ER.js";import{T as $,a as W,b as M,c as h,d as J,e as x}from"./table-DhmXy9qM.js";import{o as ge,s as I,e as xe,u as X,t as he}from"./types-DA6RIfOb.js";import{P as Y}from"./plus-CTyOnF1h.js";import{E as pe}from"./ellipsis-vertical-dwiZKXmg.js";import{E as be}from"./external-link-DIKNHSIo.js";import{S as ve}from"./square-pen-BbXQ-lT3.js";import{D as Z}from"./dollar-sign-Um87n2Vu.js";import{T as je,a as we,b as E,c as O}from"./tabs-WtTRamOo.js";import{U as ye}from"./users-DS-NyWwu.js";import"./switch-CavfHCuw.js";import"./index-bBnHd0YD.js";import"./server-D5IdwKDB.js";import"./trash-2-JI7-p9cW.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 ke=ee("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);function Ve({organizationId:s,settings:l}){var c;const{t:a}=w(),[i,o]=b.useState(((c=l.integrations.database)==null?void 0:c.type)||"postgresql"),[r,d]=b.useState(""),t=()=>{j.success(a("backoffice_views.databaseIntegration.toasts.success",{defaultValue:"Database configured successfully"}))};return e.jsxs(N,{className:"shadow-soft",children:[e.jsx(S,{children:e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(ue,{className:"h-5 w-5"}),a("backoffice_views.databaseIntegration.title",{defaultValue:"Database Connection"})]})}),e.jsxs(D,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:a("backoffice_views.databaseIntegration.typeLabel",{defaultValue:"Database Type"})}),e.jsxs(y,{value:i,onValueChange:g=>o(g),children:[e.jsx(k,{children:e.jsx(V,{})}),e.jsxs(_,{children:[e.jsx(u,{value:"postgresql",children:a("backoffice_views.databaseIntegration.typePostgres",{defaultValue:"PostgreSQL"})}),e.jsx(u,{value:"mysql",children:a("backoffice_views.databaseIntegration.typeMysql",{defaultValue:"MySQL"})}),e.jsx(u,{value:"mongodb",children:a("backoffice_views.databaseIntegration.typeMongo",{defaultValue:"MongoDB"})})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:a("backoffice_views.databaseIntegration.connectionStringLabel",{defaultValue:"Connection String"})}),e.jsx(p,{type:"password",placeholder:a("backoffice_views.databaseIntegration.connectionStringPlaceholder",{defaultValue:"postgresql://user:password@host:port/database"}),value:r,onChange:g=>d(g.target.value)})]}),e.jsx(v,{onClick:t,className:"w-full",children:a("backoffice_views.databaseIntegration.save",{defaultValue:"Save Configuration"})})]})]})}function _e({organizationId:s,settings:l}){const{t:a}=w(),[i,o]=b.useState(l.enabledModules||[]),r=[{id:"ai-agent",name:a("backoffice_views.modulesConfig.modules.aiAgentName",{defaultValue:"AI Agent"}),description:a("backoffice_views.modulesConfig.modules.aiAgentDescription",{defaultValue:"AI-powered support"})},{id:"reports",name:a("backoffice_views.modulesConfig.modules.reportsName",{defaultValue:"Reports"}),description:a("backoffice_views.modulesConfig.modules.reportsDescription",{defaultValue:"Analytics & insights"})}],d=c=>{o(g=>g.includes(c)?g.filter(n=>n!==c):[...g,c])},t=()=>{j.success(a("backoffice_views.modulesConfig.toasts.success",{defaultValue:"Modules configuration saved"}))};return e.jsxs(N,{className:"shadow-soft",children:[e.jsx(S,{children:e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"h-5 w-5"}),a("backoffice_views.modulesConfig.title",{defaultValue:"Active Modules"})]})}),e.jsxs(D,{className:"space-y-4",children:[e.jsx("div",{className:"space-y-3",children:r.map(c=>e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx(fe,{id:c.id,checked:i.includes(c.id),onCheckedChange:()=>d(c.id)}),e.jsxs("div",{className:"flex-1",children:[e.jsx(f,{htmlFor:c.id,className:"font-medium cursor-pointer",children:c.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:c.description})]})]},c.id))}),e.jsx(v,{onClick:t,className:"w-full",children:a("backoffice_views.modulesConfig.save",{defaultValue:"Save Configuration"})})]})]})}function Ne({organizationId:s,settings:l}){var n,m;const{t:a}=w(),[i,o]=b.useState(((n=l.integrations.paymentGateway)==null?void 0:n.provider)||"stripe"),[r,d]=b.useState(""),[t,c]=b.useState(((m=l.integrations.paymentGateway)==null?void 0:m.webhookUrl)||""),g=()=>{j.success(a("backoffice_views.paymentIntegration.toasts.success",{defaultValue:"Payment gateway configured successfully"}))};return e.jsxs(N,{className:"shadow-soft",children:[e.jsx(S,{children:e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-5 w-5"}),a("backoffice_views.paymentIntegration.title",{defaultValue:"Payment Gateway"})]})}),e.jsxs(D,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:a("backoffice_views.paymentIntegration.providerLabel",{defaultValue:"Provider"})}),e.jsxs(y,{value:i,onValueChange:z=>o(z),children:[e.jsx(k,{children:e.jsx(V,{})}),e.jsxs(_,{children:[e.jsx(u,{value:"stripe",children:a("backoffice_views.paymentIntegration.providerStripe",{defaultValue:"Stripe"})}),e.jsx(u,{value:"paypal",children:a("backoffice_views.paymentIntegration.providerPaypal",{defaultValue:"PayPal"})}),e.jsx(u,{value:"custom",children:a("backoffice_views.paymentIntegration.providerCustom",{defaultValue:"Custom"})})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:a("backoffice_views.paymentIntegration.apiKeyLabel",{defaultValue:"API Key"})}),e.jsx(p,{type:"password",placeholder:a("backoffice_views.paymentIntegration.apiKeyPlaceholder",{defaultValue:"sk_live_..."}),value:r,onChange:z=>d(z.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:a("backoffice_views.paymentIntegration.webhookUrlLabel",{defaultValue:"Webhook URL"})}),e.jsx(p,{placeholder:a("backoffice_views.paymentIntegration.webhookUrlPlaceholder",{defaultValue:"https://..."}),value:t,onChange:z=>c(z.target.value)})]}),e.jsx(v,{onClick:g,className:"w-full",children:a("backoffice_views.paymentIntegration.save",{defaultValue:"Save Configuration"})})]})]})}function Se(){const{t:s}=w(),[l,a]=b.useState(""),{data:i=[]}
6=U(),o=l?{organizationId:l,branding:{whiteLabel:!1},enabledModules:["conversations","reservations","users"],integrations:{}}:void 0;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(N,{className:"shadow-soft",children:[e.jsxs(S,{children:[e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-5 w-5"}),s("backoffice_views.integrationsSuite.title",{defaultValue:"Integration Configuration Suite"})]}),e.jsx(A,{children:s("backoffice_views.integrationsSuite.description",{defaultValue:"Configure integrations, modules, and services for each organization"})})]}),e.jsx(D,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:s("backoffice_views.integrationsSuite.selectOrganization",{defaultValue:"Select Organization"})}),e.jsxs(y,{value:l,onValueChange:a,children:[e.jsx(k,{className:"w-full",children:e.jsx(V,{placeholder:s("backoffice_views.integrationsSuite.selectOrganizationPlaceholder",{defaultValue:"Choose an organization to configure"})})}),e.jsx(_,{children:i.map(r=>e.jsxs(u,{value:r.id,children:[r.name," (",r.slug,")"]},r.id))})]})]})})]}),l&&o&&e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(_e,{organizationId:l,settings:o}),e.jsx(Ne,{organizationId:l,settings:o}),e.jsx(Ve,{organizationId:l,settings:o}),e.jsx(oe,{orgId:l,asCard:!0})]})]})}const Ce=ge({name:I().min(2,"Name is required"),subdomain:I().min(2,"Subdomain is required"),contactEmail:I().email("Invalid email"),contactPhone:I().optional(),subscriptionTier:xe(["trial","basic","professional","enterprise"])});function De({open:s,onOpenChange:l,organization:a}){const{t:i}=w(),o=se(),r=!!a,d=X({resolver:he(Ce),defaultValues:{name:(a==null?void 0:a.name)||"",subdomain:(a==null?void 0:a.subdomain)||"",contactEmail:(a==null?void 0:a.contactEmail)||"",contactPhone:(a==null?void 0:a.contactPhone)||"",subscriptionTier:(a==null?void 0:a.subscriptionTier)||"basic"}}),t=ie({mutation:{onSuccess:()=>{o.invalidateQueries({queryKey:L()}),j.success(i("backoffice_views.organizationDialog.toasts.createSuccess",{defaultValue:"Organization created successfully"})),l(!1)},onError:()=>{j.error(i("backoffice_views.organizationDialog.toasts.createError",{defaultValue:"Failed to create organization"}))}}}),c=te({mutation:{onSuccess:()=>{o.invalidateQueries({queryKey:L()}),j.success(i("backoffice_views.organizationDialog.toasts.updateSuccess",{defaultValue:"Organization updated successfully"})),l(!1)},onError:()=>{j.error(i("backoffice_views.organizationDialog.toasts.updateError",{defaultValue:"Failed to update organization"}))}}}),g=n=>{r?c.mutate({orgId:a.id,data:{name:n.name,contact_email:n.contactEmail,contact_phone:n.contactPhone||void 0}}):t.mutate({data:{name:n.name,slug:n.subdomain,admin_email:n.contactEmail,admin_password:crypto.randomUUID().slice(0,12)}})};return e.jsx(B,{open:s,onOpenChange:l,children:e.jsxs(R,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(G,{children:[e.jsx(K,{children:r?i("backoffice_views.organizationDialog.titleEdit",{defaultValue:"Edit Organization"}):i("backoffice_views.organizationDialog.titleCreate",{defaultValue:"Create New Organization"})}),e.jsx(H,{children:r?i("backoffice_views.organizationDialog.descriptionEdit",{defaultValue:"Update organization details and configuration"}):i("backoffice_views.organizationDialog.descriptionCreate",{defaultValue:"Add a new client organization to the platform"})})]}),e.jsx(de,{...d,children:e.jsxs("form",{onSubmit:d.handleSubmit(g),className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"name",children:i("backoffice_views.organizationDialog.fields.name",{defaultValue:"Organization Name *"})}),e.jsx(p,{id:"name",...d.register("name",{required:!0}),placeholder:i("backoffice_views.organizationDialog.fields.namePlaceholder",{defaultValue:"Airline Premium SA"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"subdomain",children:i("backoffice_views.organizationDialog.fields.subdomain",{defaultValue:"Subdomain *"})}),e.jsx(p,{id:"subdomain",...d.register("subdomain",{required:!r}),placeholder:i("backoffice_views.organizationDialog.fields.subdomainPlaceholder",{defaultValue:"airline-premium"}),disabled:r})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"contactEmail",children:i("backoffice_views.organizationDialog.fields.contactEmail",{defaultValue:"Contact Email *"})}),e.jsx(p,{id:"contactEmail",type:"email",...d.register("contactEmail",{required:!0}),placeholder:i("backoffice_views.organizationDialog.fields.contactEmailPlaceholder",{defaultValue:"[email protected]"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"contactPhone",children:i("backoffice_views.organizationDialog.fields.contactPhone",{defaultValue:"Contact Phone"})}),e.jsx(p,{id:"contactPhone",...d.register("contactPhone"),placeholder:i("backoffice_views.organizationDialog.fields.contactPhonePlaceholder",{defaultValue:"+1234567890"})})]})]}),!r&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"subscriptionTier",children:i("backoffice_views.organizationDialog.fields.subscriptionTier",{defaultValue:"Initial Subscription Tier *"})}),e.jsxs(y,{value:d.watch("subscriptionTier"),onValueChange:n=>d.setValue("subscriptionTier",n),children:[e.jsx(k,{children:e.jsx(V,{})}),e.jsxs(_,{children:[e.jsx(u,{value:"trial",children:i("backoffice_views.organizationDialog.fields.tierTrial",{defaultValue:"Trial (30 days free)"})}),e.jsx(u,{value:"basic",children:i("backoffice_views.organizationDialog.fields.tierBasic",{defaultValue:"Basic - $299/month"})}),e.jsx(u,{value:"professional",children:i("backoffice_views.organizationDialog.fields.tierProfessional",{defaultValue:"Professional - $999/month"})}),e.jsx(u,{value:"enterprise",children:i("backoffice_views.organizationDialog.fields.tierEnterprise",{defaultValue:"Enterprise - Custom pricing"})})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(v,{type:"button",variant:"outline",onClick:()=>l(!1),children:i("backoffice_views.organizationDialog.cancel",{defaultValue:"Cancel"})}),e.jsxs(v,{type:"submit",disabled:t.isPending||c.isPending,children:[r?i("backoffice_views.organizationDialog.update",{defaultValue:"Update"}):i("backoffice_views.organizationDialog.create",{defaultValue:"Create"})," ",i("backoffice_views.organizationDialog.organizationSuffix",{defaultValue:"Organization"})]})]})]})})]})})}function ze(s){return{id:s.id,name:s.name,subdomain:s.subdomain??s.slug,status:s.status,createdAt:s.created_at,contactEmail:s.contact_email??"",contactPhone:s.contact_phone??void 0,subscriptionTier:"basic",subscriptionStatus:"active",totalUsers:0,totalConversations:s.message_count??0,monthlyUsage:0,storageUsed:0}}function Te(){const{t:s}=w(),[l,a]=b.useState(!1),[i,o]=b.useState(),{data:r=[],isLoading:d}=U(),t=n=>{const m={active:"default",inactive:"secondary",suspended:"destructive"};return e.jsx(P,{variant:m[n]||"secondary",children:n})},c=n=>{o(ze(n)),a(!0)},g=n=>{j.info(s("backoffice_views.organizationsTable.toasts.navigating",{defaultValue:"Navigating to {{subdomain}} dashboard (mock)",subdomain:n??"unknown"}))};return e.jsxs(e.Fragment,{children:[e.jsxs(N,{className:"shadow-soft",children:[e.jsxs(S,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"h-5 w-5"}),s("backoffice_views.organizationsTable.title",{defaultValue:"Organizations"})]}),e.jsx(A,{children:s("backoffice_views.organizationsTable.description",{defaultValue:"Manage all client organizations"})})]}),e.jsxs(v,{onClick:()=>{o(void 0),a(!0)},className:"bg-primary hover:bg-primary/90",children:[e.jsx(Y,{className:"mr-2 h-4 w-4"}),s("backoffice_views.organizationsTable.addOrganization",{defaultValue:"Add Organization"})]})]}),e.jsx(D,{children:d?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:s("backoffice_views.organizationsTable.loading",{defaultValue:"Loading..."})}):e.jsxs($,{children:[e.jsx(W,{children:e.jsxs(M,{children:[e.jsx(h,{children:s("backoffice_views.organizationsTable.table.name",{defaultValue:"Name"})}),e.jsx(h,{children:s("backoffice_views.organizationsTable.table.slug",{defaultValue:"Slug"})}),e.jsx(h,{children:s("backoffice_views.organizationsTable.table.type",{defaultValue:"Type"})}),e.jsx(h,{children:s("backoffice_views.organizationsTable.table.status",{defaultValue:"Status"})}),e.jsx(h,{className:"text-right",children:s("backoffice_views.organizationsTable.table.messages",{defaultValue:"Messages"})}),e.jsx(h,{children:s("backoffice_views.organizationsTable.table.created",{defaultValue:"Created"})}),e.jsx(h,{className:"w-[70px]"})]})}),e.jsx(J,{children:r.map(n=>e.jsxs(M,{children:[e.jsx(x,{className:"font-medium",children:n.name}),e.jsx(x,{children:e.jsx("code",{className:"text-xs bg-muted px-2 py-1 rounded",children:n.slug})}),e.jsx(x,{children:e.jsx(P,{variant:"secondary",children:n.org_type})}),e.jsx(x,{children:t(n.status)}),e.jsx(x,{className:"text-right",children:(n.message_count??0).toLocaleStr
6ing()}),e.jsx(x,{children:new Date(n.created_at).toLocaleDateString()}),e.jsx(x,{children:e.jsxs(ne,{children:[e.jsx(le,{asChild:!0,children:e.jsx(v,{variant:"ghost",size:"icon",children:e.jsx(pe,{className:"h-4 w-4"})})}),e.jsxs(ce,{align:"end",children:[e.jsxs(F,{onClick:()=>g(n.subdomain),children:[e.jsx(be,{className:"mr-2 h-4 w-4"}),s("backoffice_views.organizationsTable.table.openDashboard",{defaultValue:"Open Dashboard"})]}),e.jsxs(F,{onClick:()=>c(n),children:[e.jsx(ve,{className:"mr-2 h-4 w-4"}),s("backoffice_views.organizationsTable.table.edit",{defaultValue:"Edit"})]})]})]})})]},n.id))})]})})]}),e.jsx(De,{open:l,onOpenChange:a,organization:i})]})}function Me({open:s,onOpenChange:l}){const{t:a}=w(),{data:i=[]}=U(),{register:o,handleSubmit:r,watch:d,setValue:t}=X({defaultValues:{organizationId:"",tier:"basic",billingModel:"monthly",price:299,currency:"USD",maxUsers:20,maxConversations:2e3,maxStorage:1e3}}),c=d("tier"),g=m=>{t("tier",m);const T={trial:{price:0,maxUsers:10,maxConversations:500,maxStorage:500},basic:{price:299,maxUsers:20,maxConversations:2e3,maxStorage:1e3},professional:{price:999,maxUsers:100,maxConversations:1e4,maxStorage:5e3},enterprise:{price:2499,maxUsers:500,maxConversations:5e4,maxStorage:1e4}}[m];T&&(t("price",T.price),t("maxUsers",T.maxUsers),t("maxConversations",T.maxConversations),t("maxStorage",T.maxStorage))},n=m=>{j.success(a("backoffice_views.subscriptionDialog.toasts.created",{defaultValue:"Subscription created (mock)"})),l(!1)};return e.jsx(B,{open:s,onOpenChange:l,children:e.jsxs(R,{className:"max-w-2xl",children:[e.jsxs(G,{children:[e.jsx(K,{children:a("backoffice_views.subscriptionDialog.title",{defaultValue:"Create Subscription"})}),e.jsx(H,{children:a("backoffice_views.subscriptionDialog.description",{defaultValue:"Set up a new subscription plan for an organization"})})]}),e.jsxs("form",{onSubmit:r(n),className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"organizationId",children:a("backoffice_views.subscriptionDialog.fields.organization",{defaultValue:"Organization *"})}),e.jsxs(y,{value:d("organizationId"),onValueChange:m=>t("organizationId",m),children:[e.jsx(k,{children:e.jsx(V,{placeholder:a("backoffice_views.subscriptionDialog.fields.organizationPlaceholder",{defaultValue:"Select organization"})})}),e.jsx(_,{children:i.map(m=>e.jsx(u,{value:m.id,children:m.name},m.id))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"tier",children:a("backoffice_views.subscriptionDialog.fields.tier",{defaultValue:"Subscription Tier *"})}),e.jsxs(y,{value:c,onValueChange:g,children:[e.jsx(k,{children:e.jsx(V,{})}),e.jsxs(_,{children:[e.jsx(u,{value:"trial",children:a("backoffice_views.subscriptionDialog.fields.tierTrial",{defaultValue:"Trial"})}),e.jsx(u,{value:"basic",children:a("backoffice_views.subscriptionDialog.fields.tierBasic",{defaultValue:"Basic"})}),e.jsx(u,{value:"professional",children:a("backoffice_views.subscriptionDialog.fields.tierProfessional",{defaultValue:"Professional"})}),e.jsx(u,{value:"enterprise",children:a("backoffice_views.subscriptionDialog.fields.tierEnterprise",{defaultValue:"Enterprise"})})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"billingModel",children:a("backoffice_views.subscriptionDialog.fields.billingModel",{defaultValue:"Billing Model *"})}),e.jsxs(y,{value:d("billingModel"),onValueChange:m=>t("billingModel",m),children:[e.jsx(k,{children:e.jsx(V,{})}),e.jsxs(_,{children:[e.jsx(u,{value:"monthly",children:a("backoffice_views.subscriptionDialog.fields.billingMonthly",{defaultValue:"Monthly"})}),e.jsx(u,{value:"annual",children:a("backoffice_views.subscriptionDialog.fields.billingAnnual",{defaultValue:"Annual"})}),e.jsx(u,{value:"usage",children:a("backoffice_views.subscriptionDialog.fields.billingUsage",{defaultValue:"Usage-based"})}),e.jsx(u,{value:"custom",children:a("backoffice_views.subscriptionDialog.fields.billingCustom",{defaultValue:"Custom"})})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"price",children:a("backoffice_views.subscriptionDialog.fields.price",{defaultValue:"Price *"})}),e.jsx(p,{id:"price",type:"number",...o("price",{required:!0,valueAsNumber:!0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"currency",children:a("backoffice_views.subscriptionDialog.fields.currency",{defaultValue:"Currency"})}),e.jsxs(y,{value:d("currency"),onValueChange:m=>t("currency",m),children:[e.jsx(k,{children:e.jsx(V,{})}),e.jsxs(_,{children:[e.jsx(u,{value:"USD",children:a("backoffice_views.subscriptionDialog.fields.currencyUSD",{defaultValue:"USD"})}),e.jsx(u,{value:"EUR",children:a("backoffice_views.subscriptionDialog.fields.currencyEUR",{defaultValue:"EUR"})}),e.jsx(u,{value:"GBP",children:a("backoffice_views.subscriptionDialog.fields.currencyGBP",{defaultValue:"GBP"})})]})]})]})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("h4",{className:"font-semibold mb-3 text-foreground",children:a("backoffice_views.subscriptionDialog.resourceLimits",{defaultValue:"Resource Limits"})}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"maxUsers",children:a("backoffice_views.subscriptionDialog.maxUsers",{defaultValue:"Max Users"})}),e.jsx(p,{id:"maxUsers",type:"number",...o("maxUsers",{required:!0,valueAsNumber:!0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"maxConversations",children:a("backoffice_views.subscriptionDialog.maxConversations",{defaultValue:"Max Conversations"})}),e.jsx(p,{id:"maxConversations",type:"number",...o("maxConversations",{required:!0,valueAsNumber:!0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"maxStorage",children:a("backoffice_views.subscriptionDialog.maxStorage",{defaultValue:"Max Storage (MB)"})}),e.jsx(p,{id:"maxStorage",type:"number",...o("maxStorage",{required:!0,valueAsNumber:!0})})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(v,{type:"button",variant:"outline",onClick:()=>l(!1),children:a("backoffice_views.subscriptionDialog.cancel",{defaultValue:"Cancel"})}),e.jsx(v,{type:"submit",children:a("backoffice_views.subscriptionDialog.create",{defaultValue:"Create Subscription"})})]})]})]})})}const q=[];function Ie(){const{t:s}=w(),[l,a]=b.useState(!1),{data:i=[]}=U(),o=t=>{var c;return((c=i.find(g=>g.id===t))==null?void 0:c.name)||s("backoffice_views.subscriptionsManager.unknownOrganization",{defaultValue:"Unknown"})},r=t=>({active:"default",trial:"secondary",expired:"destructive",cancelled:"destructive"})[t]||"secondary",d=t=>({trial:"bg-muted text-muted-foreground",basic:"bg-primary/10 text-primary",professional:"bg-accent/20 text-accent-foreground",enterprise:"bg-gradient-primary text-white"})[t]||"";return e.jsxs(e.Fragment,{children:[e.jsxs(N,{className:"shadow-soft",children:[e.jsxs(S,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-5 w-5"}),s("backoffice_views.subscriptionsManager.title",{defaultValue:"Subscriptions Management"})]}),e.jsx(A,{children:s("backoffice_views.subscriptionsManager.description",{defaultValue:"Manage subscription plans and billing"})})]}),e.jsxs(v,{onClick:()=>a(!0),className:"bg-primary hover:bg-primary/90",children:[e.jsx(Y,{className:"mr-2 h-4 w-4"}),s("backoffice_views.subscriptionsManager.createSubscription",{defaultValue:"Create Subscription"})]})]}),e.jsx(D,{children:e.jsxs($,{children:[e.jsx(W,{children:e.jsxs(M,{children:[e.jsx(h,{children:s("backoffice_views.subscriptionsManager.table.organization",{defaultValue:"Organization"})}),e.jsx(h,{children:s("backoffice_views.subscriptionsManager.table.tier",{defaultValue:"Tier"})}),e.jsx(h,{children:s("backoffice_views.subscriptionsManager.table.billing",{defaultValue:"Billing"})}),e.jsx(h,{children:s("backoffice_views.subscriptionsManager.table.status",{defaultValue:"Status"})}),e.jsx(h,{className:"text-right",children:s("backoffice_views.subscriptionsManager.table.price",{defaultValue:"Price"})}),e.jsx(h,{children:s("backoffice_views.subscriptionsManager.table.startDate",{defaultValue:"Start Date"})}),e.jsx(h,{children:s("backoffice_views.subscriptionsManager.table.limits",{defaultValue:"Limits"})})]})}),e.jsx(J,{children:q.length===0?e.jsx(M,{children:e.jsx(x,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:s("backoffice_views.subscriptionsManager.noSubscriptions",{defaultValue:"No subscriptions foun
6d"})})}):q.map(t=>e.jsxs(M,{children:[e.jsx(x,{className:"font-medium",children:o(t.organizationId)}),e.jsx(x,{children:e.jsx(P,{className:d(t.tier),children:t.tier})}),e.jsx(x,{children:e.jsx("div",{className:"flex items-center gap-1 text-sm",children:t.billingModel})}),e.jsx(x,{children:e.jsx(P,{variant:r(t.status),children:t.status})}),e.jsxs(x,{className:"text-right font-semibold",children:[t.currency," $",t.price.toLocaleString()]}),e.jsx(x,{children:t.startDate}),e.jsx(x,{children:e.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsx("div",{children:s("backoffice_views.subscriptionsManager.users",{defaultValue:"{{count}} users",count:t.maxUsers})}),e.jsx("div",{children:s("backoffice_views.subscriptionsManager.conversationsK",{defaultValue:"{{count}}k conversations",count:(t.maxConversations/1e3).toFixed(0)})}),e.jsx("div",{children:s("backoffice_views.subscriptionsManager.storageGB",{defaultValue:"{{count}}GB storage",count:(t.maxStorage/1e3).toFixed(0)})})]})})]},t.id))})]})})]}),e.jsx(Me,{open:l,onOpenChange:a})]})}function Ze(){const{t:s}=w(),l=[{title:s("sweep.superAdmin.totalOrganizations",{defaultValue:"Total Organizations"}),value:"142",change:"+12.5%",icon:Q,trend:"up"},{title:s("sweep.superAdmin.activeUsers",{defaultValue:"Active Users"}),value:"8,429",change:"+18.2%",icon:ye,trend:"up"},{title:s("sweep.superAdmin.monthlyRevenue",{defaultValue:"Monthly Revenue"}),value:"$284,592",change:"+24.1%",icon:Z,trend:"up"},{title:s("sweep.superAdmin.systemHealth",{defaultValue:"System Health"}),value:"99.8%",change:s("sweep.superAdmin.operational",{defaultValue:"Operational"}),icon:re,trend:"stable"}];return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:l.map(a=>e.jsxs(N,{className:"shadow-soft",children:[e.jsxs(S,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(C,{className:"text-sm font-medium",children:a.title}),e.jsx(a.icon,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(D,{children:[e.jsx("div",{className:"text-2xl font-bold text-foreground",children:a.value}),e.jsxs("p",{className:`text-xs ${a.trend==="up"?"text-success":a.trend==="down"?"text-destructive":"text-muted-foreground"}`,children:[a.change," ",s("sweep.superAdmin.fromLastMonth",{defaultValue:"from last month"})]})]})]},a.title))}),e.jsxs(je,{defaultValue:"organizations",className:"space-y-4",children:[e.jsxs(we,{children:[e.jsx(E,{value:"organizations",children:s("sweep.superAdmin.organizations",{defaultValue:"Organizations"})}),e.jsx(E,{value:"subscriptions",children:s("sweep.superAdmin.subscriptions",{defaultValue:"Subscriptions"})}),e.jsx(E,{value:"integrations",children:s("sweep.superAdmin.integrationSuite",{defaultValue:"Integration Suite"})})]}),e.jsx(O,{value:"organizations",className:"space-y-4",children:e.jsx(Te,{})}),e.jsx(O,{value:"subscriptions",className:"space-y-4",children:e.jsx(Ie,{})}),e.jsx(O,{value:"integrations",className:"space-y-4",children:e.jsx(Se,{})})]})]})}export{Ze 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.