import{r as l,e as i,B as o,h as n,H as e}from"./p-a89095f5.js";import{s as a}from"./p-188ef7e9.js";import{g as s}from"./p-0f51e48c.js";import"./p-d7f93824.js";import"./p-2a0c7fc9.js";import"./p-86bd3473.js";import"./p-65879f9e.js";import"./p-60cf0cc2.js";const t=class{constructor(o){l(this,o),this.fireenjinFetch=i(this,"fireenjinFetch",7),this.userId=void 0,this.user=void 0,this.invoiceType=void 0,this.showPhoto=!1,this.hideControls=!1}onSuccess(l){var i,o,n;"findUser"===(null===(i=null==l?void 0:l.detail)||void 0===i?void 0:i.endpoint)&&(this.user=null===(n=null===(o=null==l?void 0:l.detail)||void 0===o?void 0:o.data)||void 0===n?void 0:n.user)}componentDidLoad(){(null==o?void 0:o.isBrowser)&&this.userId&&this.fireenjinFetch.emit({endpoint:"findUser",params:{id:this.userId,withFriends:!0,withRoles:!1}})}render(){var l,i,o,t,d,u,r,v,p,m,c,h,f,b,j,g,w,P,k;return n(e,null,n("fireenjin-form",{hideControls:this.hideControls,endpoint:"new"===this.userId?"addUser":"editUser",documentId:"new"===this.userId?null:this.userId,resetButton:null},n("ion-list",null,this.showPhoto&&n("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"}),n("ion-grid",null,(null===(i=null==a?void 0:a.claims)||void 0===i?void 0:i.admin)&&n("ion-row",null,n("ion-col",null,n("fireenjin-select",{label:"Team Role",name:"role",options:s(),value:null===(o=this.user)||void 0===o?void 0:o.role}))),n("ion-row",null,n("ion-col",null,n("fireenjin-input",{name:"firstName",label:"First Name",labelPosition:"stacked",value:null===(t=this.user)||void 0===t?void 0:t.firstName})),n("ion-col",null,n("fireenjin-input",{name:"lastName",labelPosition:"stacked",label:"Last Name",value:null===(d=this.user)||void 0===d?void 0:d.lastName}))),n("ion-row",null,n("ion-col",null,n("fireenjin-input",{name:"email",labelPosition:"stacked",label:"Email Address",value:null===(u=this.user)||void 0===u?void 0:u.email}))),n("ion-row",null,n("ion-col",null,n("fireenjin-input",{name:"phone",label:"Phone Number",labelPosition:"stacked",value:null===(r=this.user)||void 0===r?void 0:r.phone}))),n("ion-row",null,n("ion-col",null,n("fireenjin-input",{name:"slackHandle",label:"Slack Handle",labelPosition:"stacked",value:null===(v=this.user)||void 0===v?void 0:v.slackHandle}))),n("ion-row",null,n("ion-col",null,n("fireenjin-input-address",{name:"address",label:"Address",labelPosition:"stacked",value:null===(p=this.user)||void 0===p?void 0:p.address,googleMapsKey:null===(c=null===(m=null==a?void 0:a.config)||void 0===m?void 0:m.firebase)||void 0===c?void 0:c.apiKey}))),n("ion-row",null,n("ion-col",null,n("fireenjin-input-address",{name:"billingAddress",label:"Billing Address",labelPosition:"stacked",value:null===(h=this.user)||void 0===h?void 0:h.billingAddress,googleMapsKey:null===(b=null===(f=null==a?void 0:a.config)||void 0===f?void 0:f.firebase)||void 0===b?void 0:b.apiKey}))),n("ion-row",null,n("ion-col",null,n("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===(g=null===(j=this.user)||void 0===j?void 0:j.location)||void 0===g?void 0:g.id}))),n("ion-row",null,n("ion-col",null,n("fireenjin-select",{name:"companyId",label:"Company",labelPosition:"stacked",value:null===(P=null===(w=this.user)||void 0===w?void 0:w.company)||void 0===P?void 0:P.id,endpoint:"listCompanies",limit:100,resultsKey:"companies"}))),n("ion-row",null,n("ion-col",null,n("fireenjin-select-tags",{name:"tags",labelPosition:"stacked",label:"Tags",value:(null===(k=this.user)||void 0===k?void 0:k.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{t as floodteam_form_user}