import{r as l,d as i,B as o,h as e}from"./p-03169580.js";import{t as n}from"./p-c5cf028c.js";import{s as t}from"./p-29293869.js";import"./p-4cb16df5.js";import"./p-7cbdb4ea.js";import"./p-59c95c5f.js";import"./p-1930048e.js";const a=".modal-send-email-wrapper{--min-width:300px}modal-send-email ion-item-divider{--padding-start:0px}modal-send-email fireenjin-avatar{margin-left:16px}modal-send-email h5,modal-send-email p{display:block;--ion-color-step-600:#666666;font-size:0.9em}modal-send-email ion-button{display:table;margin-left:0px;margin:0 auto}";let d=class{constructor(o){l(this,o);this.floodteamCloseModal=i(this,"floodteamCloseModal",7);this.to=[];this.from="info@thefloodteam.com";this.attachments=[];this.users=[];this.hideTemplateSelect=false}async onSuccess(l){var i;if(((i=l.detail)===null||i===void 0?void 0:i.endpoint)==="sendTemplateEmail"){const l=document.querySelector("ion-modal.modal-send-email-wrapper");if(l===null||l===void 0?void 0:l.dismiss){await l.dismiss();this.presentToast()}}}async presentToast(){const l=await n.create({message:"Your emails are on their way.",duration:2e3});l.present()}onBeforeSubmit(l){return{templateId:(l===null||l===void 0?void 0:l.templateId)?l.templateId:this.templateId?this.templateId:null,attachments:this.attachments,from:(l===null||l===void 0?void 0:l.from)?l.from:this.from?this.from:"info@thefloodteam.com",emails:(l===null||l===void 0?void 0:l.to)?l.to:this.to?this.to:[],filters:this.filters?this.filters:null}}componentWillLoad(){if(!(o===null||o===void 0?void 0:o.isBrowser))return}render(){return[e("ion-header",null,e("ion-toolbar",null,e("ion-title",null,"Send Email"),e("ion-buttons",{slot:"end"},e("ion-button",{onClick:()=>this.formEl.submit(),color:"primary",fill:"solid"},"Send"),e("ion-button",{onClick:()=>this.floodteamCloseModal.emit(),style:{"--color":"var(--ion-text-color)","--color-hover":"var(--ion-color-danger"}},e("ion-icon",{slot:"icon-only",name:"close-circle-outline"}))))),e("ion-content",{style:{"--background":"var(--ion-color-base)"}},e("fireenjin-form",{ref:l=>this.formEl=l,endpoint:"sendTemplateEmail",disableEnterButton:true,hideControls:true,beforeSubmit:this.onBeforeSubmit.bind(this)},e("ion-grid",null,e("ion-row",null,e("ion-col",null,!this.hideTemplateSelect&&e("fireenjin-select",{ref:l=>this.templateSelectEl=l,name:"templateId",label:"Template",labelPosition:"stacked",placeholder:"Select Message Template",value:this.templateId,options:((t===null||t===void 0?void 0:t.templates)||[]).filter((l=>!(l===null||l===void 0?void 0:l.partial)&&(l===null||l===void 0?void 0:l.type)==="email"&&(!this.templateFilter||this.templateFilter(l)))).map((l=>({label:l===null||l===void 0?void 0:l.subject,value:l===null||l===void 0?void 0:l.id}))),interface:"action-sheet"}),e("fireenjin-select-tags",{name:"to",label:"Send To",labelPosition:"stacked",placeholder:"Add Emails",allowAdding:true,value:this.to,multiple:true,options:(this.users||[]).map((l=>({label:(l===null||l===void 0?void 0:l.email)||`${l===null||l===void 0?void 0:l.firstName} ${l===null||l===void 0?void 0:l.lastName} has no Email on File.`,value:l===null||l===void 0?void 0:l.email,disabled:!(l===null||l===void 0?void 0:l.email)})))}))),e("ion-row",null,e("ion-col",null,e("fireenjin-chip-bar",null,(this.attachments||[]).map((l=>{var i,o,n,t,a,d;return e("ion-chip",null,e("ion-icon",{name:"document",class:"ft-icon-style"}),e("ion-label",null,decodeURI(((d=(a=(t=(n=(o=(i=l===null||l===void 0?void 0:l.split)===null||i===void 0?void 0:i.call(l,"/"))===null||o===void 0?void 0:o.pop)===null||n===void 0?void 0:n.call(o))===null||t===void 0?void 0:t.split)===null||a===void 0?void 0:a.call(t,"?"))===null||d===void 0?void 0:d[0])||"No File Name")))})))))),e("ion-accordion-group",null,e("ion-accordion",null,e("ion-item",{slot:"header"},e("ion-label",null,"Advanced")),e("ion-grid",{slot:"content"},e("ion-row",null,e("ion-col",null,e("fireenjin-input",{name:"subject",label:"Subject",labelPosition:"stacked",placeholder:"Email Subject",value:this.subject}))),e("ion-row",null,e("ion-col",null,e("fireenjin-input",{name:"from",label:"Email From",labelPosition:"stacked",placeholder:"Email Address to Send From",value:this.from})),e("ion-col",null,e("fireenjin-input",{name:"replyTo",label:"Reply To",labelPosition:"stacked",placeholder:"Email Address to Reply",value:this.replyTo}))))))))]}};d.style=a;export{d as modal_send_email};
//# sourceMappingURL=p-8004dbb6.entry.js.map