import{r as e,h as o}from"./p-f8363b1b.js";import{t as i}from"./p-510e3bc9.js";import{s as n}from"./p-c78d1e1b.js";import"./p-d2ac57a0.js";import"./p-f44f0a67.js";import"./p-3775d1fc.js";import"./p-80de33dc.js";import"./p-c2fbed0d.js";import"./p-5717491f.js";import"./p-de14d315.js";const l=class{constructor(o){e(this,o)}async onSuccess(e){var o,i,n,l,a,t,d,s,r,u,c;if("addLocation"===e.detail.endpoint){const l=document.querySelector("ion-router");if(!l||!(null===(n=null===(i=null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.data)||void 0===i?void 0:i.addLocation)||void 0===n?void 0:n.id))return;l.push(`/locations/${e.detail.data.addLocation.id}`)}else"editLocation"===e.detail.endpoint?this.presentToast():"findLocation"===(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.endpoint)?this.location=(null===(t=null===(a=null==e?void 0:e.detail)||void 0===a?void 0:a.data)||void 0===t?void 0:t.location)||null:"upload"===(null===(d=null==e?void 0:e.detail)||void 0===d?void 0:d.endpoint)&&(this.location[null===(s=null==e?void 0:e.detail)||void 0===s?void 0:s.name]=(null===(c=null===(u=null===(r=null==e?void 0:e.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 e,i,l,a,t;return[o("ion-content",{scrollEvents:!0,class:"ion-padding"},o("floodteam-title-bar",null,o("ion-router-link",{href:"/locations"},"Locations")),o("ion-card",{class:"ion-padding"},o("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:e=>({...this.location,...e}),resetButton:null},o("ion-list",null,o("ion-grid",null,o("ion-row",null,o("ion-col",null,o("ion-card",null,o("fireenjin-input-photo",{name:"photo",value:null===(e=this.location)||void 0===e?void 0:e.photo,type:"location"}),o("ion-item",null,o("ion-label",{class:"ion-text-center"},"Photo")))),o("ion-col",null,o("ion-card",null,o("fireenjin-input-photo",{name:"bannerPhoto",value:null===(i=this.location)||void 0===i?void 0:i.bannerPhoto}),o("ion-item",null,o("ion-label",{class:"ion-text-center"},"Banner")))),o("ion-col",null,o("ion-card",null,o("fireenjin-input-photo",{name:"teamPhoto",value:null===(l=this.location)||void 0===l?void 0:l.teamPhoto}),o("ion-item",null,o("ion-label",{class:"ion-text-center"},"Team")))))),o("fireenjin-input",{"data-fill":!0,name:"name",label:"Location Name",labelPosition:"stacked"}),o("fireenjin-input",{"data-fill":!0,name:"email",type:"email",label:"E-Mail",labelPosition:"stacked"}),o("fireenjin-input",{"data-fill":!0,name:"website",label:"Website",labelPosition:"stacked"}),o("fireenjin-input",{"data-fill":!0,name:"phone",type:"phone",label:"Phone Number",labelPosition:"stacked"}),o("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}),o("fireenjin-input-search-user",{"data-fill":!0,label:"Owner",labelPosition:"stacked",name:"ownerId",autofocus:!0,placeholder:"Search Users",mode:"popover",required:!0}),o("fireenjin-input",{"data-fill":!0,name:"taxId",label:"Location EIN (Tax ID)",labelPosition:"stacked"}),o("fireenjin-select",{"data-fill":!0,name:"defaultPayModelId",label:"Default Pay Model",endpoint:"listPayModels",limit:100,dataPropsMap:{payModels:"results"}}),o("fireenjin-select-tags",{"data-fill":!0,name:"tags",label:"Tags",labelPosition:"stacked",allowAdding:!0,options:[]}),o("fireenjin-input",{"data-fill":!0,name:"googleTagManagerId",label:"Google Tag Manager ID",labelPosition:"stacked"}),o("fireenjin-input",{"data-fill":!0,name:"googleTagManagerCampaignId",label:"Google Tag Manager Campaign ID",labelPosition:"stacked"}),o("fireenjin-input",{"data-fill":!0,name:"googleTagManagerPhoneId",label:"Google TM Phone Campaign ID",labelPosition:"stacked"}))))),o("floodteam-navigation-footer",null)]}};l.style="";export{l as app_location}