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