import{r as e,d as i,h as l,e as t}from"./p-03169580.js";import{t as n}from"./p-c5cf028c.js";import"./p-4cb16df5.js";import"./p-7cbdb4ea.js";const o=".fireenjin-mx-modal-send-email-wrapper{--min-width:300px}fireenjin-mx-modal-send-email ion-item-divider{--padding-start:0px}fireenjin-mx-modal-send-email fireenjin-avatar{margin-left:16px}fireenjin-mx-modal-send-email h5,fireenjin-mx-modal-send-email p{display:block;--ion-color-step-600:#666666;font-size:0.9em}fireenjin-mx-modal-send-email ion-button{display:table;margin-left:0px;margin:0 auto}";let a=class{constructor(l){e(this,l);this.fireenjinTrigger=i(this,"fireenjinTrigger",7);this.to=[];this.options=[];this.hideTemplateSelect=false;this.pageTitle="Send Email"}onReset(e){var i;if(((i=e.detail)===null||i===void 0?void 0:i.endpoint)==="sendTemplateEmail"){this.fireenjinTrigger.emit({name:"closeModal"})}}async onSuccess(e){var i;if(((i=e.detail)===null||i===void 0?void 0:i.endpoint)==="sendTemplateEmail"){this.fireenjinTrigger.emit({name:"closeModal"});this.presentToast()}}async presentToast(){const e=await n.create({message:"Your emails are on their way.",duration:2e3});e.present()}onBeforeSubmit(e){return{templateId:(e===null||e===void 0?void 0:e.templateId)?e.templateId:this.templateId?this.templateId:null,from:(e===null||e===void 0?void 0:e.from)?e.from:this.from?this.from:"info@thefloodteam.com",emails:(e===null||e===void 0?void 0:e.to)?e.to:this.to?this.to:[],filters:this.filters?this.filters:null}}componentWillLoad(){var e,i;if(((e=this.to)===null||e===void 0?void 0:e.length)&&!((i=this.options)===null||i===void 0?void 0:i.length)){this.options=this.to.map((e=>({value:e,label:e})))}}render(){return[l("ion-header",null,l("ion-toolbar",null,l("ion-title",null,this.pageTitle),l("ion-buttons",{slot:"end"},l("ion-button",{onClick:()=>this.fireenjinTrigger.emit({name:"closeModal",el:this.modalEl,component:"mx-modal-send-email"})},l("ion-icon",{slot:"icon-only",name:"close-circle-outline"}))))),l("ion-content",{style:{"--background":"var(--ion-color-base)"}},l("fireenjin-form",{endpoint:"sendTemplateEmail",disableEnterButton:true,beforeSubmit:this.onBeforeSubmit.bind(this)},l("ion-list",{style:{contain:"none"}},l("fireenjin-input",{name:"subject",label:"Subject",labelPosition:"stacked",placeholder:"Email Subject",value:this.subject}),l("fireenjin-input",{name:"from",label:"Email From",labelPosition:"stacked",placeholder:"Email Address to Send From",value:this.from}),l("fireenjin-input",{name:"replyTo",label:"Reply To",labelPosition:"stacked",placeholder:"Email Address to Reply",value:this.replyTo}),!this.hideTemplateSelect&&l("fireenjin-select",{ref:e=>this.templateSelectEl=e,name:"templateId",label:"Template",labelPosition:"stacked",placeholder:"Select Template",value:this.templateId,endpoint:"listTemplates",interface:"action-sheet",optionEl:e=>l("ion-select-option",{value:e.id},e.subject),params:{withHtml:true},resultsKey:"templates",limit:100}),l("fireenjin-select-tags",{name:"to",label:"Send To",labelPosition:"stacked",placeholder:"Add Emails",allowAdding:true,value:this.to,multiple:true,options:this.options}))))]}get modalEl(){return t(this)}};a.style=o;export{a as fireenjin_mx_modal_send_email};
//# sourceMappingURL=p-f78196bc.entry.js.map