1import{r as S,y as C,l as g,c as A,i as p,o as n,b as d,d as a,j as s,k as r,w as m,m as c,F as h,h as E,t as x,f as _,q as B,n as V}from"./site-94b02a42.js";const F={class:"flex flex-col space-y-6"},D={class:"grid grid-cols-1 lg:grid-cols-2 gap-x-4 gap-y-6"},R={class:"flex flex-col space-y-4"},T={key:0,class:"bg-white shadow-md rounded-xl px-6 py-6"},L={class:"list-disc pl-4"},z={class:"!mt-8"},M={key:0,class:"text-green-600 mb-4"},O={key:1,class:"text-red-600 mb-4"},I={__name:"UserInvite",props:{options:{type:Object,required:!0},permissions:{type:Object,required:!1,default:null},submitRoute:{type:String,required:!0}},setup(f){const y=f,e=S({loading:!1,errors:{},error:null,message:null,data:{}}),v={salutation:null,first_name:null,last_name:null,email:null,email_confirmation:null,job_title:null,is_staff:"no",role_id:null};C(()=>{e.data=g.cloneDeep(v)});const b=A(()=>e.data.role_id?g.find(y.options.job_roles,{value:e.data.role_id}):null),k=o=>{e.data.is_staff=o,e.data.role_id=null},j=()=>{e.errors={},e.error=null,e.message=null,e.loading=!0,axios.post(y.submitRoute,e.data).then(o=>{var l,u;(l=o.data)!=null&&l.success?(e.message=`An invite has been sent to ${o.data.email}.`,e.data=g.cloneDeep(v)):e.error=(u=o.data)==null?void 0:u.error,e.loading=!1}).catch(({response:o})=>{var l;e.errors=((l=o==null?void 0:o.data)==null?void 0:l.errors)||{},e.loading=!1})};return(o,l)=>{var w,q;const u=p("custom-select"),i=p("input-group"),U=p("single-checkbox"),N=p("button-arrow");return n(),d("form",{class:V({"cursor-wait":e.loading}),onSubmit:()=>{}},[a("div",{class:V({"flex flex-col space-y-12 transition-opacity duration-200 ease-in-out":!0,"opacity-25 pointer-events-none select-none":e.loading})},[a("div",F,[s(i,{errors:e.errors,label:"Salutation",handle:"salutation",class:"w-full",required:""},{default:r(()=>[s(u,{modelValue:e.data.salutation,"onUpdate:modelValue":l[0]||(l[0]=t=>e.data.salutation=t),list:f.options.salutations,handle:"salutation",placeholder:"Select a title",class:"w-full lg:w-auto",required:""},null,8,["modelValue","list"])]),_:1},8,["errors"]),a("div",D,[s(i,{errors:e.errors,label:"First Name",handle:"first_name",class:"w-full",required:""},{default:r(()=>[m(a("input",{"onUpdate:modelValue":l[1]||(l[1]=t=>e.data.first_name=t),id:"first_name",name:"first_name",type:"text",maxlength:"50",placeholder:"First Name",class:"custom-input",autocomplete:"given-name",required:""},null,512),[[c,e.data.first_name]])]),_:1},8,["errors"]),s(i,{errors:e.errors,label:"Last Name",handle:"last_name",class:"w-full",required:""},{default:r(()=>[m(a("input",{"onUpdate:modelValue":l[2]||(l[2]=t=>e.data.last_name=t),id:"last_name",name:"last_name",type:"text",maxlength:"50",placeholder:"Last Name",class:"custom-input",autocomplete:"family-name",required:""},null,512),[[c,e.data.last_name]])]),_:1},8,["errors"])]),a("div",R,[s(i,{errors:e.errors,label:"Email Address",handle:"email",class:"w-full",required:""},{default:r(()=>[m(a("input",{"onUpdate:modelValue":l[3]||(l[3]=t=>e.data.email=t),id:"email",name:"email",type:"email",maxlength:"250",placeholder:"Email Address",class:"custom-input",autocomplete:"email",inputmode:"email",required:""},null,512),[[c,e.data.email]])]),_:1},8,["errors"]),s(i,{errors:e.errors,"label-hidden":!0,label:"Confirm Email Address",handle:"email_confirmation",class:"w-full",required:""},{default:r(()=>[m(a("input",{"onUpdate:modelValue":l[4]||(l[4]=t=>e.data.email_confirmation=t),id:"email_confirmation",name:"email_confirmation",type:"email",maxlength:"250",placeholder:"Confirm Email Address",class:"custom-input",autocomplete:"one-time-code",inputmode:"email",required:""},null,512),[[c,e.data.email_confirmation]])]),_:1},8,["errors"])]),s(i,{errors:e.errors,label:"Job Title",handle:"job_title",class:"w-full",required:""},{default:r(()=>[m(a("input",{"onUpdate:modelValue":l[5]||(l[5]=t=>e.data.job_title=t),id:"job_title",name:"job_title",type:"text",maxlength:"250",class:"custom-input",autocomplete:"organization-title",inputmode:"text",required:""},null,512),[[c,e.data.job_title]])]),_:1},8,["errors"]),(w=f.permissions)!=null&&w.can_add_staff?(n(),d(h,{key:0},[s(i,{errors:e.errors,handle:"is_staff",class:"w-full"},{default:r(()=>[s(U,{"model-value":e.data.is_staff,handle:"is_staff",label:"Grant this account staff access?","true-value":"yes","false-value":"no","onUpdate:modelValue":k},null,8,["model-value"])]),_:1},8,["errors"]),((q=e.data)==null?void 0:q.is_staff)==="yes"?(n(),d(h,{key:0}
1,[s(i,{errors:e.errors,label:"Business School Account Role",handle:"role_id",class:"w-full mb-4",required:""},{default:r(()=>[s(u,{modelValue:e.data.role_id,"onUpdate:modelValue":l[6]||(l[6]=t=>e.data.role_id=t),list:f.options.job_roles,handle:"role_id",required:""},null,8,["modelValue","list"])]),_:1},8,["errors"]),b.value&&b.value.permissions.length>0?(n(),d("div",T,[l[7]||(l[7]=a("p",{class:"mb-2"},"This role will grant the user the following permissions:",-1)),a("ul",L,[(n(!0),d(h,null,E(b.value.permissions,t=>(n(),d("li",{key:t,class:"pl-2"},[a("code",null,x(t),1)]))),128))]),l[8]||(l[8]=a("p",{class:"font-bold mt-3"},"Please ensure these are appropriate for the user being invited before submitting.",-1))])):_("",!0)],64)):_("",!0)],64)):_("",!0),a("div",z,[e.message?(n(),d("div",M,x(e.message),1)):e.error?(n(),d("div",O,x(e.error),1)):_("",!0),s(N,{type:"button",onClick:j},{default:r(()=>l[9]||(l[9]=[B(" Send invite ")])),_:1})])])],2)],34)}}};export{I 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.