import{r as e,h as i}from"./p-03169580.js";import{t as o}from"./p-c5cf028c.js";import{s as l}from"./p-81b30421.js";import"./p-4cb16df5.js";import"./p-7cbdb4ea.js";import"./p-59c95c5f.js";import"./p-c9699503.js";import"./p-bd8b186e.js";import"./p-795b799a.js";import"./p-3a8e6af1.js";const n="";let a=class{constructor(i){e(this,i)}async onSuccess(e){var i,o,l,n,a,t,d,s,r,u,c;if(e.detail.endpoint==="addLocation"){const n=document.querySelector("ion-router");if(!n||!((l=(o=(i=e===null||e===void 0?void 0:e.detail)===null||i===void 0?void 0:i.data)===null||o===void 0?void 0:o.addLocation)===null||l===void 0?void 0:l.id))return;n.push(`/locations/${e.detail.data.addLocation.id}`)}else if(e.detail.endpoint==="editLocation"){this.presentToast()}else if(((n=e===null||e===void 0?void 0:e.detail)===null||n===void 0?void 0:n.endpoint)==="findLocation"){this.location=((t=(a=e===null||e===void 0?void 0:e.detail)===null||a===void 0?void 0:a.data)===null||t===void 0?void 0:t.location)||null}else if(((d=e===null||e===void 0?void 0:e.detail)===null||d===void 0?void 0:d.endpoint)==="upload"){this.location[(s=e===null||e===void 0?void 0:e.detail)===null||s===void 0?void 0:s.name]=((c=(u=(r=e===null||e===void 0?void 0:e.detail)===null||r===void 0?void 0:r.data)===null||u===void 0?void 0:u.upload)===null||c===void 0?void 0:c.url)||null;this.location={...this.location}}}async presentToast(){const e=await o.create({message:"The location has been updated.",duration:2e3});e.present()}render(){var e,o,n,a,t;return[i("ion-content",{scrollEvents:true,class:"ion-padding"},i("floodteam-title-bar",null,i("ion-router-link",{href:"/locations"},"Locations")),i("ion-card",{class:"ion-padding"},i("fireenjin-form",{fetch:this.locationId==="new"?false:"findLocation",fetchKey:"location",endpoint:this.locationId==="new"?"addLocation":"editLocation",documentId:this.locationId==="new"?null:this.locationId,filterData:["name","phone","email","address","ownerId","defaultPayModelId","website","googleTagManagerId","tags","bannerPhoto","photo","teamPhoto","taxId"],beforeSubmit:e=>({...this.location,...e}),resetButton:null},i("ion-list",null,i("ion-grid",null,i("ion-row",null,i("ion-col",null,i("ion-card",null,i("fireenjin-input-photo",{name:"photo",value:(e=this.location)===null||e===void 0?void 0:e.photo,type:"location"}),i("ion-item",null,i("ion-label",{class:"ion-text-center"},"Photo")))),i("ion-col",null,i("ion-card",null,i("fireenjin-input-photo",{name:"bannerPhoto",value:(o=this.location)===null||o===void 0?void 0:o.bannerPhoto}),i("ion-item",null,i("ion-label",{class:"ion-text-center"},"Banner")))),i("ion-col",null,i("ion-card",null,i("fireenjin-input-photo",{name:"teamPhoto",value:(n=this.location)===null||n===void 0?void 0:n.teamPhoto}),i("ion-item",null,i("ion-label",{class:"ion-text-center"},"Team")))))),i("fireenjin-input",{"data-fill":true,name:"name",label:"Location Name",labelPosition:"stacked"}),i("fireenjin-input",{"data-fill":true,name:"email",type:"email",label:"E-Mail",labelPosition:"stacked"}),i("fireenjin-input",{"data-fill":true,name:"website",label:"Website",labelPosition:"stacked"}),i("fireenjin-input",{"data-fill":true,name:"phone",type:"phone",label:"Phone Number",labelPosition:"stacked"}),i("fireenjin-input-address",{"data-fill":true,name:"address",label:"Address",labelPosition:"stacked",googleMapsKey:(t=(a=l===null||l===void 0?void 0:l.config)===null||a===void 0?void 0:a.firebase)===null||t===void 0?void 0:t.apiKey}),i("fireenjin-input-search-user",{"data-fill":true,label:"Owner",labelPosition:"stacked",name:"ownerId",autofocus:true,placeholder:"Search Users",mode:"popover",required:true}),i("fireenjin-input",{"data-fill":true,name:"taxId",label:"Location EIN (Tax ID)",labelPosition:"stacked"}),i("fireenjin-select",{"data-fill":true,name:"defaultPayModelId",label:"Default Pay Model",endpoint:"listPayModels",limit:100,dataPropsMap:{payModels:"results"}}),i("fireenjin-select-tags",{"data-fill":true,name:"tags",label:"Tags",labelPosition:"stacked",allowAdding:true,options:[]}),i("fireenjin-input",{"data-fill":true,name:"googleTagManagerId",label:"Google Tag Manager ID",labelPosition:"stacked"}),i("fireenjin-input",{"data-fill":true,name:"googleTagManagerCampaignId",label:"Google Tag Manager Campaign ID",labelPosition:"stacked"}))))),i("floodteam-navigation-footer",null)]}};a.style=n;export{a as app_location};
//# sourceMappingURL=p-b0b1ee67.entry.js.map