PageSourceSearch

https://ouasa.lovable.app/assets/org-form-dialog-BhcG5bw1.js

js ouasa.lovable.app collected 2026-10-03 03:35:16 UTC 8,035 bytes, 1 lines download raw bytes

1import{aR as z,r as b,am as D,ak as T,s as S,j as e,be as I,bf as U,bg as F,bh as P,bi as O,ae as o,aW as M,aX as Q,aY as B,aZ as H,a_ as K,bn as A,ah as G,bj as V,B as k,L as W,bk as $,bl as i,bm as c,bo as p,bp as X,bq as Y,aq as Z}from"./index-Vi894iiS.js";import{U as L}from"./us-state-combobox-Dut-oinM.js";import{a as J}from"./classification-tags-DbqSNlbH.js";import{s as ee}from"./classification-tags-B3C9r0UJ.js";const R=["startup","partner","sponsor","academic","government","nonprofit","military","other"],ae=$({legal_name:i().trim().min(1,"Required").max(200),dba:i().trim().max(200).optional().or(c("")),website:i().trim().url("Invalid URL").max(500).optional().or(c("")),linkedin_url:i().trim().url("Invalid URL").max(500).optional().or(c("")),crunchbase_url:i().trim().url("Invalid URL").max(500).optional().or(c("")),category:Y(R),sector:i().trim().max(100).optional().or(c("")),city:i().trim().max(100).optional().or(c("")),state:i().trim().max(100).optional().or(c("")),oregon_based:X(),incorporation_type:i().trim().max(80).optional().or(c("")),incorporation_state:i().trim().max(80).optional().or(c("")),founded_on:i().optional().or(c("")),headcount_ft:p.number().int().min(0).max(1e6).optional().nullable(),headcount_pt:p.number().int().min(0).max(1e6).optional().nullable(),ttm_revenue_dollars:p.number().min(0).max(1e12).optional().nullable(),capital_raised_dollars:p.number().min(0).max(1e12).optional().nullable(),trl:p.number().int().min(1).max(9).optional().nullable(),notes:i().max(5e3).optional().or(c(""))}),E={legal_name:"",dba:"",website:"",linkedin_url:"",crunchbase_url:"",category:"startup",sector:"",city:"",state:"",oregon_based:!1,incorporation_type:"",incorporation_state:"",founded_on:"",headcount_ft:null,headcount_pt:null,ttm_revenue_dollars:null,capital_raised_dollars:null,trl:null,notes:""};function se({open:d,onOpenChange:m,orgId:g,initial:v,onSaved:q}){const j=z(),x=!!g,[r,l]=b.useState(E),[C,N]=b.useState([]),[s,f]=b.useState({});b.useEffect(()=>{if(d){f({});const{classification_tags:a,...t}=v??{};l({...E,...t}),N(ee(a))}},[d]);const y=D({mutationFn:async()=>{const a=ae.safeParse(r);if(!a.success){const u={};throw a.error.issues.forEach(h=>{u[h.path.join(".")]=h.message}),f(u),new Error("Please fix the errors below")}f({});const t=a.data,w={legal_name:t.legal_name,dba:t.dba||null,website:t.website||null,linkedin_url:t.linkedin_url||null,crunchbase_url:t.crunchbase_url||null,category:t.category,sector:t.sector||null,city:t.city||null,state:t.state||null,oregon_based:t.oregon_based,incorporation_type:t.incorporation_type||null,incorporation_state:t.incorporation_state||null,founded_on:t.founded_on||null,headcount_ft:t.headcount_ft??null,headcount_pt:t.headcount_pt??null,ttm_revenue_cents:t.ttm_revenue_dollars!=null?Math.round(t.ttm_revenue_dollars*100):null,capital_raised_cents:t.capital_raised_dollars!=null?Math.round(t.capital_raised_dollars*100):null,trl:t.trl??null,notes:t.notes||null,classification_tags:C};let _=g;if(x&&_){const{error:u}=await S.from("organizations").update(w).eq("id",_);if(u)throw u}else{const{data:u,error:h}=await S.from("organizations").insert(w).select("id").single();if(h)throw h;_=u.id}return _},onSuccess:a=>{T.success(x?"Organization updated":"Organization created"),j.invalidateQueries({queryKey:["orgs"]}),j.invalidateQueries({queryKey:["org",a]}),j.invalidateQueries({queryKey:["orgs-options"]}),m(!1),q?.(a)},onError:a=>{a.message!=="Please fix the errors below"&&T.error(a.message)}});return e.jsx(I,{open:d,onOpenChange:m,children:e.jsxs(U,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(F,{children:[e.jsx(P,{children:x?"Edit organization":"New organization"}),e.jsx(O,{children:"Unified company/entity record used across all modules."})]}),e.jsxs("div",{className:"grid gap-4 py-2",children:[e.jsx(n,{label:"Legal name",error:s.legal_name,required:!0,children:e.jsx(o,{value:r.legal_name,onChange:a=>l({...r,legal_name:a.target.value})})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(n,{label:"DBA",error:s.dba,children:e.jsx(o,{value:r.dba,onChange:a=>l({...r,dba:a.target.value})})}),e.jsx(n,{label:"Category",children:e.jsxs(M,{value:r.category,onValueChange:a=>l({...r,category:a}),children:[e.jsx(Q,{children:e.jsx(B,{})}),e.jsx(H,{children:R.map(a=>e.jsx(K,{value:a,className:"capitalize",children:a},a))})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(n,{label:"Sector",error:s.sector,children:e.jsx(o,{value:r.sector,onChange:a=>l({...r,sector:a.target.value})})}),e.jsx(n,{label:"Founded on",error:s.founded_on,children:e.jsx(o,{type:"date",value:r.founded_on,onChange:a=>l({...r,founded_on:a.target.value})})})]}),e.jsx(n,{label:"Website",error:s.website,children:e.jsx(o,{placeholder:"https://…",value:r.website,onChange:a=>l({...r,website:a.target.value})})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(n,{label:"LinkedIn URL",error:s.linkedin_url,children:e.jsx(o,{value:r.linkedin_url,onChange:a=>l({...r,linkedin_url:a.target.value})})}),e.jsx(n,{label:"Crunchbase URL",error:s.crunchbase_url,children:e.jsx(o,{value:r.crunchbase_url,onChange:a=>l({...r,crunchbase_url:a.target.value})})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(n,{label:"City",error:s.city,children:e.jsx(o,{value:r.city,onChange:a=>l({...r,city:a.target.value})})}),e.jsx(n,{label:"State",error:s.state,children:e.jsx(L,{value:r.state,onChange:a=>l({...r,state:a??""})})}),e.jsx(n,{label:"Oregon-based",children:e.jsx("div",{className:"h-10 flex items-center",children:e.jsx(A,{checked:r.oregon_based,onCheckedChange:a=>l({...r,oregon_based:a})})})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(n,{label:"Incorporation type",error:s.incorporation_type,children:e.jsx(o,{placeholder:"C-Corp, LLC, …",value:r.
1incorporation_type,onChange:a=>l({...r,incorporation_type:a.target.value})})}),e.jsx(n,{label:"Incorporation state",error:s.incorporation_state,children:e.jsx(L,{value:r.incorporation_state,onChange:a=>l({...r,incorporation_state:a??""})})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(n,{label:"Headcount FT",error:s.headcount_ft,children:e.jsx(o,{type:"number",min:0,value:r.headcount_ft??"",onChange:a=>l({...r,headcount_ft:a.target.value===""?null:Number(a.target.value)})})}),e.jsx(n,{label:"Headcount PT",error:s.headcount_pt,children:e.jsx(o,{type:"number",min:0,value:r.headcount_pt??"",onChange:a=>l({...r,headcount_pt:a.target.value===""?null:Number(a.target.value)})})}),e.jsx(n,{label:"TRL (1-9)",error:s.trl,children:e.jsx(o,{type:"number",min:1,max:9,value:r.trl??"",onChange:a=>l({...r,trl:a.target.value===""?null:Number(a.target.value)})})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(n,{label:"TTM revenue ($)",error:s.ttm_revenue_dollars,children:e.jsx(o,{type:"number",min:0,step:"0.01",value:r.ttm_revenue_dollars??"",onChange:a=>l({...r,ttm_revenue_dollars:a.target.value===""?null:Number(a.target.value)})})}),e.jsx(n,{label:"Capital raised ($)",error:s.capital_raised_dollars,children:e.jsx(o,{type:"number",min:0,step:"0.01",value:r.capital_raised_dollars??"",onChange:a=>l({...r,capital_raised_dollars:a.target.value===""?null:Number(a.target.value)})})})]}),e.jsx(n,{label:"Tags",children:e.jsx(J,{value:C,onChange:N})}),e.jsx(n,{label:"Notes",error:s.notes,children:e.jsx(G,{rows:4,value:r.notes,onChange:a=>l({...r,notes:a.target.value})})})]}),e.jsxs(V,{children:[e.jsx(k,{variant:"ghost",onClick:()=>m(!1),children:"Cancel"}),e.jsxs(k,{onClick:()=>y.mutate(),disabled:y.isPending,children:[y.isPending&&e.jsx(W,{className:"mr-2 h-4 w-4 animate-spin"}),x?"Save changes":"Create organization"]})]})]})})}function n({label:d,children:m,error:g,required:v}){return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(Z,{className:"text-xs",children:[d,v&&e.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),m,g&&e.jsx("p",{className:"text-xs text-destructive",children:g})]})}export{se as O};

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.