import{r as l,d as i,B as n,h as e,H as o}from"./p-f8363b1b.js";import{s as a}from"./p-c78d1e1b.js";import"./p-3775d1fc.js";import"./p-80de33dc.js";import"./p-c2fbed0d.js";import"./p-5717491f.js";import"./p-de14d315.js";const s=class{constructor(n){l(this,n),this.fireenjinFetch=i(this,"fireenjinFetch",7),this.showPhoto=!1,this.hideControls=!1}onSuccess(l){var i,n,e;"findUser"===(null===(i=null==l?void 0:l.detail)||void 0===i?void 0:i.endpoint)&&(this.user=null===(e=null===(n=null==l?void 0:l.detail)||void 0===n?void 0:n.data)||void 0===e?void 0:e.user)}componentDidLoad(){(null==n?void 0:n.isBrowser)&&this.userId&&this.fireenjinFetch.emit({endpoint:"findUser",params:{id:this.userId,withFriends:!0,withRoles:!1}})}render(){var l,i,n,s,t,d,u,r,v,p,m,c,b,h,f,j,g,w,P;return e(o,null,e("fireenjin-form",{hideControls:this.hideControls,endpoint:"new"===this.userId?"addUser":"editUser",documentId:"new"===this.userId?null:this.userId,resetButton:null},e("ion-list",null,this.showPhoto&&e("fireenjin-input-photo",{name:"photo",documentId:this.userId,value:(null===(l=this.user)||void 0===l?void 0:l.photo)||"/assets/svg/ft-person-suit.svg"}),e("ion-grid",null,(null===(i=null==a?void 0:a.claims)||void 0===i?void 0:i.admin)&&e("ion-row",null,e("ion-col",null,e("fireenjin-select",{label:"Team Role",name:"role",options:((null==a?void 0:a.roles)||[]).map((l=>{return{label:(i=l,i.charAt(0).toUpperCase()+i.slice(1)),value:l};var i})),value:null===(n=this.user)||void 0===n?void 0:n.role}))),e("ion-row",null,e("ion-col",null,e("fireenjin-input",{name:"firstName",label:"First Name",labelPosition:"stacked",value:null===(s=this.user)||void 0===s?void 0:s.firstName})),e("ion-col",null,e("fireenjin-input",{name:"lastName",labelPosition:"stacked",label:"Last Name",value:null===(t=this.user)||void 0===t?void 0:t.lastName}))),e("ion-row",null,e("ion-col",null,e("fireenjin-input",{name:"email",labelPosition:"stacked",label:"Email Address",value:null===(d=this.user)||void 0===d?void 0:d.email}))),e("ion-row",null,e("ion-col",null,e("fireenjin-input",{name:"phone",label:"Phone Number",labelPosition:"stacked",value:null===(u=this.user)||void 0===u?void 0:u.phone}))),e("ion-row",null,e("ion-col",null,e("fireenjin-input",{name:"slackHandle",label:"Slack Handle",labelPosition:"stacked",value:null===(r=this.user)||void 0===r?void 0:r.slackHandle}))),e("ion-row",null,e("ion-col",null,e("fireenjin-input-address",{name:"address",label:"Address",labelPosition:"stacked",value:null===(v=this.user)||void 0===v?void 0:v.address,googleMapsKey:null===(m=null===(p=null==a?void 0:a.config)||void 0===p?void 0:p.firebase)||void 0===m?void 0:m.apiKey}))),e("ion-row",null,e("ion-col",null,e("fireenjin-input-address",{name:"billingAddress",label:"Billing Address",labelPosition:"stacked",value:null===(c=this.user)||void 0===c?void 0:c.billingAddress,googleMapsKey:null===(h=null===(b=null==a?void 0:a.config)||void 0===b?void 0:b.firebase)||void 0===h?void 0:h.apiKey}))),e("ion-row",null,e("ion-col",null,e("fireenjin-select",{label:"Location",name:"locationId",options:((null==a?void 0:a.locations)||[]).map((l=>({label:(null==l?void 0:l.name)||"No Location Name",value:null==l?void 0:l.id}))),value:null===(j=null===(f=this.user)||void 0===f?void 0:f.location)||void 0===j?void 0:j.id}))),e("ion-row",null,e("ion-col",null,e("fireenjin-select",{name:"companyId",label:"Company",labelPosition:"stacked",value:null===(w=null===(g=this.user)||void 0===g?void 0:g.company)||void 0===w?void 0:w.id,endpoint:"listCompanies",limit:100,resultsKey:"companies"}))),e("ion-row",null,e("ion-col",null,e("fireenjin-select-tags",{name:"tags",labelPosition:"stacked",label:"Tags",value:(null===(P=this.user)||void 0===P?void 0:P.tags)||[],allowAdding:!0,options:[{label:"Important",value:"important"},{label:"Referral",value:"referral"},{label:"Plumber",value:"plumber"},{label:"Staff",value:"staff"},{label:"Agent",value:"agent"},{label:"Property Manager",value:"property manager"},{label:"PEU",value:"peu"}]})))))))}};export{s as floodteam_form_user}