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