(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3196],{40147:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>u});var a=s(54568),r=s(7620),l=s(79748),o=s(65587),n=s.n(o),i=s(56050);let c="hsl(var(--foreground))",d="hsl(var(--foreground-muted))";function u(){let e=(0,l.useRouter)(),[t,s]=(0,r.useState)(""),[o,u]=(0,r.useState)(""),[m,h]=(0,r.useState)(!1),[p,x]=(0,r.useState)("");async function b(s){s.preventDefault(),h(!0),x("");let a=await fetch("/api/clients",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,primaryDomain:o})});if(!a.ok){h(!1),x((await a.json()).error||"Failed to create client");return}let r=await a.json();e.push(`/clients/${r.id}?connect=true`)}return(0,a.jsxs)("div",{className:"p-8 max-w-2xl mx-auto",children:[(0,a.jsxs)(n(),{href:"/dashboard",className:"inline-flex items-center gap-2 text-sm mb-6 transition-colors",style:{color:d},children:[(0,a.jsx)(i.A,{className:"w-4 h-4"})," Back to Dashboard"]}),(0,a.jsx)("h1",{className:"text-2xl font-bold mb-2",style:{color:c},children:"Add New Client"}),(0,a.jsx)("p",{className:"text-sm mb-8",style:{color:d},children:"Enter your client's basic details. You'll connect to their Google Workspace in the next step."}),(0,a.jsx)("div",{className:"card p-6",children:(0,a.jsxs)("form",{onSubmit:b,className:"space-y-5",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium mb-1.5",style:{color:c},children:"Client / Organisation Name"}),(0,a.jsx)("input",{id:"client-name",type:"text",value:t,onChange:e=>s(e.target.value),required:!0,className:"input-base w-full",placeholder:"Acme Corp"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium mb-1.5",style:{color:c},children:"Primary Domain"}),(0,a.jsx)("input",{id:"client-domain",type:"text",value:o,onChange:e=>u(e.target.value.toLowerCase()),required:!0,className:"input-base w-full",placeholder:"acmecorp.com"}),(0,a.jsx)("p",{className:"text-xs mt-1.5",style:{color:"hsl(var(--foreground-subtle))"},children:"The primary Google Workspace domain (without https://)"})]}),p&&(0,a.jsx)("div",{className:"text-sm rounded-lg px-4 py-3",style:{background:"hsl(var(--destructive-surface))",color:"hsl(var(--destructive))",border:"1px solid hsl(var(--destructive) / 0.2)"},children:p}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-2",children:[(0,a.jsx)(n(),{href:"/dashboard",className:"px-4 py-2 text-sm rounded-lg border transition-colors",style:{color:d,borderColor:"hsl(var(--border))"},children:"Cancel"}),(0,a.jsx)("button",{id:"create-client-submit",type:"submit",disabled:m,className:"px-5 py-2 text-sm font-medium text-white rounded-lg transition-all disabled:opacity-50",style:{background:"hsl(var(--primary))",boxShadow:"0 2px 8px hsl(var(--primary) / 0.25)"},children:m?"Creating...":"Create & Connect →"})]})]})})]})}},56050:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(13454).A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},79748:(e,t,s)=>{"use strict";var a=s(79796);s.o(a,"useParams")&&s.d(t,{useParams:function(){return a.useParams}}),s.o(a,"usePathname")&&s.d(t,{usePathname:function(){return a.usePathname}}),s.o(a,"useRouter")&&s.d(t,{useRouter:function(){return a.useRouter}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})},98305:(e,t,s)=>{Promise.resolve().then(s.bind(s,40147))}},e=>{e.O(0,[8298,587,1968,7358],()=>e(e.s=98305)),_N_E=e.O()}]);