import{r as o,d as t,h as e}from"./p-03169580.js";import{t as i}from"./p-5a032a89.js";import{s as n}from"./p-e1ee6da1.js";import"./p-4cb16df5.js";import"./p-f44f0a67.js";import"./p-59c95c5f.js";import"./p-3775d1fc.js";import"./p-80de33dc.js";import"./p-c2fbed0d.js";import"./p-5717491f.js";import"./p-de14d315.js";const l="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 a=class{constructor(e){o(this,e);this.floodteamCloseModal=t(this,"floodteamCloseModal",7);this.fireenjinFetch=t(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 t,e,i,n;if(((t=o===null||o===void 0?void 0:o.target)===null||t===void 0?void 0:t.name)==="sendAlert"){this.noteInput.sendAlert=!!((e=o===null||o===void 0?void 0:o.detail)===null||e===void 0?void 0:e.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 t;if(((t=o.detail)===null||t===void 0?void 0:t.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 t;if(((t=o.detail)===null||t===void 0?void 0:t.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 i.create({message:`Note has been added successfully!`,duration:2e3});o.present()}render(){var o,t;return[e("ion-header",null,e("ion-toolbar",null,e("ion-title",null,this.heading),e("ion-buttons",{slot:"end"},e("ion-button",{onClick:()=>this.floodteamCloseModal.emit()},e("ion-icon",{slot:"icon-only",name:"close-circle-outline"}))))),e("ion-content",null,e("ion-tabs",{ref:o=>this.tabsEl=o},e("ion-tab-bar",{ref:o=>this.tabBarEl=o,slot:"top"},e("ion-tab-button",{tab:"note"},e("ion-icon",{name:"create"}),e("ion-label",null,"Note")),e("ion-tab-button",{tab:"options"},e("ion-icon",{name:"cog"}),e("ion-label",null,"Options")),e("ion-tab-button",{tab:"preview"},e("ion-icon",{name:"eye"}),e("ion-label",null,"Preview"))),e("ion-tab",{tab:"note"},e("ion-content",null,e("ion-card",{style:{overflow:"visible"}},e("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},e("fireenjin-editor",{partials:n.templates,ref:o=>this.editorEl=o}))))),e("ion-tab",{tab:"options"},e("ion-content",null,e("ion-card",{class:"ion-padding",style:{overflow:"visible"}},e("fireenjin-form",{name:"note",hideControls:true},e("fireenjin-toggle",{label:"Send an Alert",name:"sendAlert",value:!!((o=this.note)===null||o===void 0?void 0:o.alert)}),e("fireenjin-select-tags",{name:"tags",label:"Tags",labelPosition:"stacked",value:((t=this.note)===null||t===void 0?void 0:t.tags)?this.note.tags:[],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"}]}))))),e("ion-tab",{tab:"preview"},e("ion-content",null,e("ion-card",{class:"ion-padding"},e("floodteam-template",{templateId:"fBRGqXAzDw8CwFfJtQgJ",data:{html:this.previewHTML?this.previewHTML:"",user:n===null||n===void 0?void 0:n.profile,createdAt:new Date}}))))))]}};a.style=l;export{a as modal_note};
//# sourceMappingURL=p-4aabe85e.entry.js.map