import{r as o,d as e,h as t,B as i}from"./p-03169580.js";import{t as n}from"./p-c5cf028c.js";import{s as l}from"./p-46225039.js";import{g as a}from"./p-e9a3b467.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 s="modal-note fireenjin-editor{width:calc(100% - 75px);margin:0 0 0 60px}modal-note fireenjin-editor .codex-editor__redactor{padding-bottom:0 !important}@media only screen and (max-width: 800px){.modal-note{--width:100%;--max-width:auto}}";let d=class{constructor(t){o(this,t);this.floodteamCloseModal=e(this,"floodteamCloseModal",7);this.fireenjinFetch=e(this,"fireenjinFetch",7);this.steps=["note","options","preview"];this.heading="Add a Note";this.note={};this.noteInput={}}async onEditorChange(){var o;if(!((o=this.editorEl)===null||o===void 0?void 0:o.exportHTML))return;this.previewHTML=await this.editorEl.exportHTML()}async onChange(o){var e,t,i,n;if(((e=o===null||o===void 0?void 0:o.target)===null||e===void 0?void 0:e.name)==="sendAlert"){this.noteInput.sendAlert=!!((t=o===null||o===void 0?void 0:o.detail)===null||t===void 0?void 0:t.checked)}else if(((i=o===null||o===void 0?void 0:o.target)===null||i===void 0?void 0:i.name)==="tags"){this.noteInput.tags=((n=o===null||o===void 0?void 0:o.target)===null||n===void 0?void 0:n.value)?o.target.value:[]}}onReset(o){var e;if(((e=o.detail)===null||e===void 0?void 0:e.endpoint)==="addNote"){const o=document.querySelector("ion-modal.modal-note");if(o===null||o===void 0?void 0:o.dismiss){o.dismiss()}}}async onSuccess(o){var e;if(((e=o.detail)===null||e===void 0?void 0:e.endpoint)==="addNote"){const o=document.querySelector("ion-modal.modal-note");if(o===null||o===void 0?void 0:o.dismiss){await o.dismiss();this.presentToast()}}}async presentToast(){const o=await n.create({message:`Note has been added successfully!`,duration:2e3});o.present()}render(){var o,e;return[t("ion-header",null,t("ion-toolbar",null,t("ion-title",null,this.heading),t("ion-buttons",{slot:"end"},t("ion-button",{onClick:()=>this.floodteamCloseModal.emit()},t("ion-icon",{slot:"icon-only",name:"close-circle-outline"}))))),t("ion-content",null,t("ion-tabs",{ref:o=>this.tabsEl=o},t("ion-tab-bar",{ref:o=>this.tabBarEl=o,slot:"top"},t("ion-tab-button",{tab:"note"},t("ion-icon",{name:"create"}),t("ion-label",null,"Note")),t("ion-tab-button",{tab:"options"},t("ion-icon",{name:"cog"}),t("ion-label",null,"Options")),t("ion-tab-button",{tab:"preview"},t("ion-icon",{name:"eye"}),t("ion-label",null,"Preview"))),t("ion-tab",{tab:"note"},t("ion-content",null,t("ion-card",{style:{overflow:"visible"}},t("fireenjin-form",{name:"note",endpoint:"addNote",beforeSubmit:async o=>({...this.noteInput,...o,jobId:this.jobId,userId:this.userId,html:this.previewHTML}),submitButton:"Save",resetButton:"Cancel",resetButtonColor:"medium",disableLoader:true,disableEnterButton:true},t("fireenjin-editor",{ref:o=>this.editorEl=o}))))),t("ion-tab",{tab:"options"},t("ion-content",null,t("ion-card",{class:"ion-padding",style:{overflow:"visible"}},t("fireenjin-form",{name:"note",hideControls:true},t("fireenjin-toggle",{label:"Send an Alert",name:"sendAlert",value:!!((o=this.note)===null||o===void 0?void 0:o.alert)}),t("fireenjin-select-tags",{name:"tags",label:"Tags",labelPosition:"stacked",value:((e=this.note)===null||e===void 0?void 0:e.tags)?this.note.tags:[],multiple:true,allowAdding:true,options:[{label:"Important",value:"important"},{label:"Referral",value:"referral"},{label:"Plumber",value:"plumber"},{label:"Staff",value:"staff"},{label:"Agent",value:"agent"},{label:"Property Manager",value:"property manager"},{label:"PEU",value:"peu"}]}))))),t("ion-tab",{tab:"preview"},t("ion-content",null,t("ion-card",{class:"ion-padding"},(i===null||i===void 0?void 0:i.isBrowser)&&t("fireenjin-render-template",{templateId:"fBRGqXAzDw8CwFfJtQgJ",partials:l===null||l===void 0?void 0:l.templates.filter((o=>!!(o===null||o===void 0?void 0:o.partial))),helpers:a(),data:{html:this.previewHTML?this.previewHTML:"",user:l===null||l===void 0?void 0:l.profile,createdAt:new Date}}))))))]}};d.style=s;export{d as modal_note};
//# sourceMappingURL=p-683936be.entry.js.map