1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1480],{23136:(e,t,l)=>{"use strict";var r=l(29563);t.A=void 0;var a=r(l(59628)),i=l(37876);t.A=(0,a.default)((0,i.jsx)("path",{d:"M6.54 5c.06.89.21 1.76.45 2.59l-1.2 1.2c-.41-1.2-.67-2.47-.76-3.79zm9.86 12.02c.85.24 1.72.39 2.6.45v1.49c-1.32-.09-2.59-.35-3.8-.75zM7.5 3H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.49c0-.55-.45-1-1-1-1.24 0-2.45-.2-3.57-.57-.1-.04-.21-.05-.31-.05-.26 0-.51.1-.71.29l-2.2 2.2c-2.83-1.45-5.15-3.76-6.59-6.59l2.2-2.2c.28-.28.36-.67.25-1.02C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1"}),"LocalPhoneOutlined")},64355:(e,t,l)=>{"use strict";var r=l(29563);t.A=void 0;var a=r(l(59628)),i=l(37876);t.A=(0,a.default)((0,i.jsx)("path",{d:"M22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2zm-2 0-8 5-8-5zm0 12H4V8l8 5 8-5z"}),"EmailOutlined")},64479:(e,t,l)=>{"use strict";var r=l(29563);t.A=void 0;var a=r(l(59628)),i=l(37876);t.A=(0,a.default)((0,i.jsx)("path",{d:"M12 7V3H2v18h20V7zM6 19H4v-2h2zm0-4H4v-2h2zm0-4H4V9h2zm0-4H4V5h2zm4 12H8v-2h2zm0-4H8v-2h2zm0-4H8V9h2zm0-4H8V5h2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8zm-2-8h-2v2h2zm0 4h-2v2h2z"}),"BusinessOutlined")},75532:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/projects/[id]/team",function(){return l(99088)}])},99088:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>K});var r=l(37876),a=l(49351),i=l(65749),n=l(14232),s=l(52894),o=l(38388),d=l(72147),c=l(41316),m=l(35003),x=l(85649),p=l(39505),h=l(14729),u=l(60595),j=l(95389),g=l(63356),y=l(64479),b=l(64355),v=l(23136),A=l(78087),f=l(55766);let _=[{bg:A.$[100],color:A.$[700]},{bg:A.$[50],color:A.$[600]},{bg:A.$[200],color:A.$[900]},{bg:A.$[100],color:A.$[500]}],z=e=>{let{icon:t,text:l}=e;return(0,r.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[(0,r.jsx)(o.A,{sx:{color:"text.secondary",display:"flex",flexShrink:0},children:t}),(0,r.jsx)(m.A,{variant:"body2",color:"text.secondary",noWrap:!0,children:l})]})},S=e=>{let{member:t}=e,l=_[(e=>{let t=0;for(let l=0;l<e.length;l+=1)t=e.charCodeAt(l)+((t<<5)-t);return Math.abs(t)})(t.name)%_.length];return(0,r.jsx)(u.A,{variant:"outlined",sx:{borderRadius:2,height:"100%"},children:(0,r.jsxs)(j.A,{children:[(0,r.jsxs)(o.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",mb:2},children:[(0,r.jsx)(h.A,{sx:{bgcolor:l.bg,color:l.color,fontWeight:600},children:(0,f.I)({name:t.name})}),(0,r.jsx)(g.A,{label:"sigmatic"===t.team_type?"Sigmatic":"Client",size:"small",color:"sigmatic"===t.team_type?"primary":"default",variant:"sigmatic"===t.team_type?"filled":"outlined"})]}),(0,r.jsx)(m.A,{variant:"subtitle1",fontWeight:600,noWrap:!0,children:t.name}),t.role&&(0,r.jsx)(m.A,{variant:"body2",color:"text.secondary",noWrap:!0,sx:{mb:2},children:t.role}),(0,r.jsxs)(o.A,{sx:{display:"flex",flexDirection:"column",gap:1,mt:2},children:[t.org&&(0,r.jsx)(z,{icon:(0,r.jsx)(y.A,{fontSize:"small"}),text:t.org}),t.email&&(0,r.jsx)(z,{icon:(0,r.jsx)(b.A,{fontSize:"small"}),text:t.email}),t.phone&&(0,r.jsx)(z,{icon:(0,r.jsx)(v.A,{fontSize:"small"}),text:t.phone})]})]})})};var C=l(79270),I=l(44395),T=l(80553),O=l(67906),k=l(66471),M=l(1912),E=l(88992),$=l(91408),H=l(71090),w=l(69923),B=l(13988),V=l(92344),q=l(51002),N=l(90998),D=l(72709);let P=[{value:"existing",label:"Select Existing User"},{value:"external",label:"Add External Contact"}],W=[{value:"client",label:"Client"},{value:"sigmatic",label:"Sigmatic"}],Y=e=>{let{projectId:t,onSubmitted:l,onCancel:a}=e,[i,s]=(0,n.useState)(""),[c,p]=(0,n.useState)(""),[h,u]=(0,n.use
1State)(""),[j,g]=(0,n.useState)([]),[y,b]=(0,n.useState)(!1),[v,A]=(0,n.useState)(!1),[f,_]=(0,n.useState)(null),[z,S]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let e=!0;b(!0);let t=setTimeout(async()=>{try{let r=await V.A.getUsers({page:0,pageSize:10,search:h});if(e){var t,l;g(null!=(l=null==r||null==(t=r.data)?void 0:t.users)?l:[]),A(!1)}}catch(t){q.Ay.error("Failed to search platform users for the team member picker",{error:t}),e&&(g([]),A(!0))}finally{e&&b(!1)}},300);return()=>{e=!1,clearTimeout(t)}},[h]);let C=async()=>{if(f&&i)try{S(!0);let e=await B.A.createTeamMember(t,{user_id:f.user_id,name:f.name,team_type:i,...f.role_display_name?{role:f.role_display_name}:{},...f.email?{email:f.email}:{}});D.D.success("Team member added"),l(e)}catch(e){D.D.error((0,N.gJ)(e,"Failed to add team member"))}finally{S(!1)}};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(T.A,{sx:{pt:0},children:(0,r.jsxs)(o.A,{sx:{display:"flex",flexDirection:"column",gap:4,pt:1},children:[(0,r.jsx)(x.zB,{label:"Type",id:"existing-team-type",required:!0,children:(0,r.jsxs)(x.l6,{id:"existing-team-type",value:i,onChange:e=>s(e.target.value),children:[(0,r.jsx)("option",{value:"",disabled:!0,children:"Select type"}),W.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))]})}),(0,r.jsx)(x.zB,{label:"User",id:"existing-user",required:!0,children:(0,r.jsx)(k.A,{id:"existing-user",value:f,onChange:(e,t)=>
1_(t),inputValue:c,onInputChange:(e,t,l)=>{p(t),"input"===l&&(u(t),f&&t!==f.name&&_(null))},options:j,loading:y,filterOptions:e=>e,getOptionLabel:e=>e.name,isOptionEqualToValue:(e,t)=>e.user_id===t.user_id,noOptionsText:v?"Couldn't load users - you may not have permission to browse the user list":c?"No matching users":"Start typing a name or email",renderOption:(e,t)=>(0,n.createElement)("li",{...e,key:t.user_id},(0,r.jsxs)(o.A,{children:[(0,r.jsx)(m.A,{variant:"body2",children:t.name}),(0,r.jsx)(m.A,{variant:"caption",color:"text.secondary",children:[t.email,t.role_display_name].filter(Boolean).join(" \xb7 ")})]})),renderInput:e=>(0,r.jsx)(M.A,{...e,placeholder:"Search by name or email",InputProps:{...e.InputProps,endAdornment:(0,r.jsxs)(r.Fragment,{children:[y?(0,r.jsx)(d.A,{color:"inherit",size:16}):null,e.InputProps.endAdornment]})}})})}),f&&(0,r.jsxs)(m.A,{variant:"caption",color:"text.secondary",children:["Selected: ",f.name,f.email?" (".concat(f.email,")"):"",f.role_display_name?" \xb7 ".concat(f.role_display_name):""]})]})}),(0,r.jsxs)(O.A,{sx:{p:2,px:3,pb:3},children:[(0,r.jsx)(x.$n,{variant:"ghost",type:"button",onClick:a,disabled:z,children:"Cancel"}),(0,r.jsx)(x.$n,{variant:"primary",type:"button",onClick:C,disabled:!f||!i||z,loading:z,children:z?null:"Add Member"})]})]})},F=$.Ik().shape({name:$.Yj().trim().required("Name is required"),team_type:$.Yj().oneOf(["client","sigmatic"],"Type is required").required("Type is required"),role:$.Yj(),org:$.Yj(),email:$.Yj().email("Must be a valid email address"),phone:$.Yj()}),U={name:"",team_type:"",role:"",org:"",email:"",phone:""},L=e=>{let{projectId:t,onSubmitted:l,onCancel:a}=e,[i,s]=(0,n.useState)(!1),{control:d,handleSubmit:c,formState:{errors:m,isValid:p}}=(0,E.mN)({mode:"onChange",defaultValues:U,resolver:(0,H.t)(F)}),h=async e=>{try{s(!0);let r=await B.A.createTeamMember(t,{name:e.name,team_type:e.team_type,...e.role?{role:e.role}:{},...e.org?{org:e.org}:{},...e.email?{email:e.email}:{},...e.phone?{phone:e.phone}:{}});D.D.success("Team member added"),l(r)}catch(e){D.D.error((0,N.gJ)(e,"Failed to add team member"))}finally{s(!1)}};return(0,r.jsxs)("form",{onSubmit:c(h),children:[(0,r.jsx)(T.A,{sx:{pt:0},children:(0,r.jsxs)(o.A,{sx:{display:"flex",flexDirection:"column",gap:4,pt:1},children:[(0,r.jsx)(E.xI,{name:"name",control:d,render:e=>{var t;let{field:l}=e;return(0,r.jsx)(x.zB,{label:"Name",id:"name",required:!0,error:null==(t=m.name)?void 0:t.message,children:(0,r.jsx)(x.pd,{...l,id:"name",placeholder:"e.g. Dr. Sarah Chen"})})}}),(0,r.jsx)(E.xI,{name:"team_type",control:d,render:e=>{var t;let{field:l}=e;return(0,r.jsx)(x.zB,{label:"Type",id:"team_type",required:!0,error:null==(t=m.team_type)?void 0:t.message,children:(0,r.jsxs)(x.l6,{...l,id:"team_type",children:[(0,r.jsx)("option",{value:"",disabled:!0,children:"Select type"}),(0,r.jsx)("option",{value:"client",children:"Client"}),(0,r.jsx)("option",{value:"sigmatic",children:"Sigmatic"})]})})}}),(0,r.jsx)(E.xI,{name:"role",control:d,render:e=>{let{field:t}=e;return(0,r.jsx)(x.zB,{label:"Role",id:"role",children:(0,r.jsx)(x.pd,{...t,id:"role",placeholder:"Optional"})})}}),(0,r.jsx)(E.xI,{name:"org",control:d,render:e=>{let{field:t}=e;return(0,r.jsx)(x.zB,{label:"Organization",id:"org",children:(0,r.jsx)(x.pd,{...t,id:"org",placeholder:"Optional"})})}}),(0,r.jsx)(E.xI,{name:"email",control:d,render:e=>{var t;let{field:l}=e;return(0,r.jsx)(x.zB,{label:"Email",id:"email",error:null==(t=m.email)?void 0:t.message,children:(0,r.jsx)(x.pd,{...l,id:"email",type:"email",placeholder:"Optional"})})}}),(0,r.jsx)(E.xI,{name:"phone",control:d,render:e=>{let{field:t}=e;return(0,r.jsx)(x.zB,{label:"Phone",id:"phone",children:(0,r.jsx)(x.pd,{...t,id:"phone",placeholder:"Optional"})})}})]})}),(0,r.jsxs)(O.A,{sx:{p:2,px:3,pb:3},children:[(0,r.jsx)(x.$n,{variant:"ghost",type:"button",onClick:a,disabled:i,children:"Cancel"}),(0,r.jsx)(x.$n,{variant:"primary",type:"submit",disabled:!p||i,loading:i,children:i?null:"Add Member"})]})]})},J=e=>{let{open:t,projectId:l,onClose:a,onMemberAdded:i}=e,[s,d]=(0,n.useState)("existing"),c=()=>{d("existing"),a()},m=e=>{i(e),d("existing"),a()};return(0,r.jsxs)(C.A,{open:t,onClose:c,fullWidth:!0,maxWidth:"sm",children:[(0,r.jsx)(I.A,{sx:{...w.U.h3},children:"Add Team Member"}),(0,r.jsx)(o.A,{sx:{px:3},children:(0,r.jsx)(x.Iz,{options:P,value:s,onChange:e=>d(e)})}),"existing"===s?(0,r.jsx)(Y,{projectId:l,onSubmitted:m,onCancel:c},"existing"):(0,r.jsx)(L,{projectId:l,onSubmitted:m,onCancel:c},"external")]})},R=e=>{let{title:t,members:l}=e;return 0===l.length?null:(0,r.jsxs)(o.A,{sx:{mb:4},children:[(0,r.jsx)(m.A,{variant:"overline",color:"text.secondary",sx:{letterSpacing:1,mb:1,display:"block"},children:t}),(0,r.jsx)(c.Ay,{container:!0,spacing:3,children:l.map(e=>(0,r.jsx)(c.Ay,{item:!0,xs:12,sm:6,md:4,children:(0,r.jsx)(S,{member:e})},e.member_id))})]})},X=()=>{let{currentProject:e,team:t,loading:l,errors:a,fetchTeam:i}
1=(0,p.B)(),[c,h]=(0,n.useState)(!1);(0,n.useEffect)(()=>{e&&i(e.project_id)},[e,i]);let u=t.filter(e=>"client"===e.team_type),j=t.filter(e=>"sigmatic"===e.team_type);return(0,r.jsxs)(o.A,{children:[(0,r.jsx)(x.zY,{title:"Project Team",subtitle:"Directory of all stakeholders and participants.",action:(0,r.jsx)(x.$n,{variant:"primary",onClick:()=>h(!0),children:"Add Team Member"})}),l.team&&0===t.length?(0,r.jsx)(o.A,{sx:{display:"flex",justifyContent:"center",py:6},children:(0,r.jsx)(d.A,{})}):a.team?(0,r.jsx)(s.A,{severity:"error",children:a.team}):0===t.length?(0,r.jsx)(m.A,{variant:"body2",color:"text.secondary",children:"No team members yet. Add the first one to get started."}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(R,{title:"Client",members:u}),(0,r.jsx)(R,{title:"Sigmatic",members:j})]}),e&&(0,r.jsx)(J,{open:c,projectId:e.project_id,onClose:()=>h(!1),onMemberAdded:()=>{e&&i(e.project_id)}})]})},G=()=>(0,r.jsx)(X,{});G.acl={action:"read",subject:"Projects"},G.getLayout=e=>(0,r.jsx)(a.A,{children:(0,r.jsx)(i.A,{children:e})});let K=G}},e=>{e.O(0,[6471,5749,636,6593,8792],()=>e(e.s=75532)),_N_E=e.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.