1import{q as w,r as x,s as C,l as p,j as e,L as r,B as i,p as v,C as h,a as u,f as o,A as L,w as S,x as D,y as R,z as q,I as E,W as A}from"./pages-admin-CBNFTGIo.js";function k(){const[,a]=w(),[t,f]=x.useState(""),[n,c]=x.useState(!1),{toast:d}=C(),{data:b,isLoading:j}=p({queryKey:["/api/auth/product-roles"]}),l=b?.roles?.includes("corporate_admin"),{data:m,isLoading:y}=p({queryKey:["/api/corp/my-company"],enabled:!!l}),N=async s=>{if(s.preventDefault(),!!t.trim()){c(!0);try{await A("POST","/api/corporate/setup-company",{companyName:t.trim()}),d({title:"Company created!",description:"Set up billing to activate your corporate account."}),a("/corporate/dashboard?tab=billing")}catch(g){d({title:"Failed to create company",description:g.message||"Please try again.",variant:"destructive"})}finally{c(!1)}}};return j?e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-[#1a2e4a] to-[#0f1f35] flex items-center justify-center p-4","data-testid":"corporate-setup",children:e.jsx(r,{className:"h-8 w-8 animate-spin text-[#c9a227]"})}):l?y?e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-[#1a2e4a] to-[#0f1f35] flex items-center justify-center p-4","data-testid":"corporate-setup",children:e.jsx(r,{className:"h-8 w-8 animate-spin text-[#c9a227]"})}):m?.hasCompany?e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-[#1a2e4a] to-[#0f1f35] flex items-center justify-center p-4","data-testid":"corporate-setup",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-gradient-to-br from-[#c9a227] to-[#d4b340] mb-4",children:e.jsx(v,{className:"h-8 w-8 text-white"})}),e.jsx("h1",{className:"text-2xl font-bold text-white mb-2","data-testid":"text-setup-title",children:"Your Company is Ready"}),e.jsxs("p",{className:"text-white/70 text-sm",children:["Your company ",e.jsx("strong",{className:"text-white",children:m.companyName})," is already set up."]})]}),e.jsx(h,{className:"border-0 shadow-2xl",children:e.jsx(u,{className:"pt-6",children:e.jsxs(i,{onClick:()=>a("/corporate/dashboard"),className:"w-full bg-gradient-to-r from-[#c9a227] to-[#d4b340] text-white","data-testid":"button-go-to-dashboard",children:[e.jsx(o,{className:"h-4 w-4 mr-2"}),"Go to Dashboard",e.jsx(L,{className:"h-4 w-4 ml-2"})]})})})]})}):e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-[#1a2e4a] to-[#0f1f35] flex items-center justify-center p-4","data-testid":"corporate-setup",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-gradient-to-br from-[#c9a227] to-[#d4b340] mb-4",children:e.jsx(o,{className:"h-8 w-8 text-white"})}),e.jsx("h1",{className:"text-2xl font-bold text-white mb-2","data-testid":"text-setup-title",children:"Welcome to RESOLVEit Corporate"}),e.jsx("p",{className:"text-white/70 text-sm",children:"Set up your organization to get started"})]}),e.jsxs(h,{className:"border-0 shadow-2xl",children:[e.jsxs(S,{children:[e.jsx(D,{"data-testid":"text-setup-card-title",children:"Create Your Company"}),e.jsx(R,{children:"Enter your company name to set up your corporate account"})]}),e.jsx(u,{children:e.jsxs("form",{onSubmit:N,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{htmlFor:"companyName",children:"Company Name"}),e.jsx(E,{id:"companyName",value:t,onChange:s=>f(s.target.value),placeholder:"Acme Corporation",required:!0,"data-testid":"input-company-name"})]}),e.jsxs(i,{type:"submit",className:"w-full bg-gradient-to-r from-[#c9a227] to-[#d4b340] text-white",disabled:n||!t.trim(),"data-testid":"button-create-company",children:[n?e.jsx(r,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(o,{className:"h-4 w-4 mr-2"}),"Create Company & Continue"]})]})})]})]})}):e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-[#1a2e4a] to-[#0f1f35] flex items-center justify-center p-4","data-testid":"corporate-setup",children:e.jsxs("div",{className:"w-full max-w-md text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-white mb-4","data-testid":"text-setup-forbidden",children:"Access Denied"}),e.jsx("p",{className:"text-white/70 mb-6",children:"You do not have corporate admin access."}),e.jsx(i,{onClick:()=>a("/"),variant:"outline",className:"border-white/30 text-white","data-testid":"button-go-home",children:"Go Home"})]})})}export{k 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.