PageSourceSearch

https://www.thekusphub.com/assets/new-project-CCH1EW_X.js

js thekusphub.com collected 2026-10-07 08:54:56 UTC 4,565 bytes, 1 lines download raw bytes

1import{cQ as y,r as s,j as e,k as N,p as w}from"./index-C_q4J5Xp.js";import{C as v}from"./content-layout-BfYhIr2m.js";import{I as h}from"./input-B00KVE8M.js";import{L as j}from"./label-D8Cmk4TP.js";import{u as C}from"./add-company-vIW-N7Hv.js";import{C as S}from"./create-project-D_99mzSn.js";import"./head-C21hxwit.js";import"./index-C8upUUJB.js";import"./button-BZKUUToo.js";import"./textarea-YYNCQoq2.js";import"./useMutation-D23XG5zE.js";import"./project-mappers-n79ISNf1.js";import"./get-projects-CFvTDxYC.js";import"./project-role-details-dialog-DIXoxER-.js";import"./badge-BsHQRZM_.js";import"./card-CW7lRWWO.js";import"./separator-qtCEgWqj.js";import"./skeleton-DkKS1jHO.js";import"./checkbox-CzY6Q3Sv.js";import"./index-SXxEdQ42.js";import"./get-billing-C0u8dd1I.js";import"./project-validation-C4p8YUBz.js";import"./project-password-CbaXaQLZ.js";import"./select-DkE2byK-.js";import"./index-EqUkjJHM.js";import"./tooltip-q3te918k.js";import"./job-template-selector-DY_sm9pt.js";import"./scroll-area-NlNBLGVO.js";const f=l=>l.replace(/[^\d]/g,""),m=60,te=()=>{const[l]=y(),g=f(l.get("ownerCompanyId")??""),[o,c]=s.useState(g),[d,p]=s.useState(""),i=C(),u=s.useMemo(()=>{const t=Number(o);return!Number.isInteger(t)||t<=0?null:t},[o]),x=s.useMemo(()=>Array.isArray(i.data)?i.data.filter(t=>typeof(t==null?void 0:t.id)=="number"&&t.id>0):[],[i.data]),r=s.useMemo(()=>{const t=d.trim().toLowerCase(),a=x.filter(n=>(n.approvalStatus??"").toUpperCase()!=="REJECTED");return t?a.filter(n=>`${n.companyName??""} ${n.fullName??""}`.toLowerCase().includes(t)):a},[x,d]),b=s.useMemo(()=>r.slice(0,m),[r]);return e.jsx(v,{title:"Create Project",description:"Create a project from the admin panel",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/60 p-4 shadow-sm",children:[e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"w-full md:max-w-xs space-y-2",children:[e.jsx(j,{htmlFor:"company-search",children:"Find company"}),e.jsx(h,{id:"company-search",placeholder:"Search by company or owner name",value:d,onChange:t=>p(t.target.value)})]}),i.isLoading?e.jsx("div",{className:"rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-600",children:"Loading companies..."}):r.length?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-xs text-slate-500",children:["Found ",r.length," ",r.length===1?"company":"companies",r.length>m?e.jsxs("span",{children:[" ","· showing first ",m," (refine search to narrow the list)"]}):null]}),e.jsx("div",{className:"max-h-72 overflow-y-auto rounded-xl border border-slate-200 bg-white p-2",children:e.jsx("div",{className:"space-y-2",children:b.map(t=>{const a=String(t.id)===o;return e.jsxs("button",{type:"button",onClick:()=>{c(String(t.id)),p(t.companyName??t.fullName??"")},className:`w-full rounded-lg border px-3 py-2 text-left text-sm transition ${a?"border-slate-900 bg-slate-900 text-white":"border-slate-200 bg-white text-slate-700 hover:border-slate-300"}`,children:[e.jsx("div",{className:"truncate font-semibold",children:t.companyName??"Company"}),e.jsxs("div",{className:`text-xs ${a?"text-slate-200":"text-slate-500"}`,children:["ID: ",t.id,t.fullName?` · ${t.fullName}`:""]})]},t.id)})})})]}):e.jsx("div",{className:"rounded-xl border border-dashed border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-600",children:"No companies found for this query."}),e.jsxs("div",{className:"w-full md:max-w-xs space-y-2",children:[e.jsx(j,{htmlFor:"owner-company-id",children:"Owner company ID"}),e.jsx(h,{id:"owner-company-id",inputMode:"numeric",placeholder:"e.g. 124",value:o,onChange:t=>c(f(t.target.value))})]})]}),e.jsx("div",{className:"flex items-end",children:e.jsx(N,{to:"/admin/projects",children:e.jsx(w,{type:"button",variant:"outline",className:"rounded-xl",children:"Back to projects"})})})]}),e.jsxs("p",{className:"mt-2 text-xs text-slate-500",children:["This value is required for admin-created projects and links the project to a company owner. You can also copy it from the URL on the company page: ",e.jsxs("code",{children:["/admin/companies/","{id}"]}),"."]})]}),u?e.jsx(S,{audience:"admin",ownerCompanyId:u}):e.jsx("div",{className:"rounded-2xl border border-dashed border-slate-200 bg-slate-50 p-6 text-sm text-slate-600",children:"Enter a valid owner company ID to open the project creation flow."})]})})};export{te as AdminNewProjectRoute,te 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.