import{r as i,d as t,h as s}from"./p-03169580.js";import{t as o}from"./p-c5cf028c.js";import{s as e}from"./p-81b30421.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";let n=class{constructor(s){i(this,s);this.fireenjinSubmit=t(this,"fireenjinSubmit",7);this.floodteamCloseModal=t(this,"floodteamCloseModal",7);this.headerTitle="E-sign";this.loading=false;this.signed=false;this.isLoaded=false}onModalPresent(){this.isLoaded=true}async onChange(i){var t;if(((t=i===null||i===void 0?void 0:i.target)===null||t===void 0?void 0:t.name)==="signature"){const t=await i.target.toDataURL();if(t.length<=10){alert("Signature is required to submit!");return}this.loading=true;this.fireenjinSubmit.emit({endpoint:"signContract",data:{jobId:this.jobId,signature:await i.target.toDataURL(),templateId:this.templateId}})}}async onSuccess(i){var t,s;if(((t=i===null||i===void 0?void 0:i.detail)===null||t===void 0?void 0:t.endpoint)==="signContract"){this.presentToast();this.loading=false;this.signed=true;this.floodteamCloseModal.emit()}else if(((s=i.detail)===null||s===void 0?void 0:s.endpoint)==="findJob"){this.loading=false}}async presentToast(){const i=await o.create({message:`File(s) added successfully to Efile!`,duration:2e3});i.present()}render(){return[s("ion-header",null,s("ion-toolbar",null,s("ion-title",null,this.headerTitle),s("ion-buttons",{slot:"end"},s("ion-button",{onClick:()=>this.floodteamCloseModal.emit()},s("ion-icon",{slot:"icon-only",name:"close-circle-outline"}))))),s("ion-content",{class:{"ion-padding":true,"is-loading":this.loading}},this.signed?s("div",{style:{width:"90%",maxWidth:"500px",margin:"0 auto"}},s("ion-icon",{name:"checkmark-circle",color:"success",style:{height:"150px",width:"150px",display:"block",margin:"30px auto"}}),s("h1",null,"Signature Submitted!"),s("p",null,"Thank you for your time, you can now close this browser tab.")):s("div",null,s("floodteam-template",{class:"fullscreen",templateId:this.templateId,data:{timestamp:(new Date).toISOString(),job:e===null||e===void 0?void 0:e.job,user:e===null||e===void 0?void 0:e.profile}}))),this.isLoaded&&s("floodteam-signature-pad",{class:{"is-loading":this.loading},ref:i=>this.signaturePadEl=i})]}};export{n as modal_esign};
//# sourceMappingURL=p-cca9dc85.entry.js.map