import{r as i,h as t,H as e,e as o}from"./p-ee1e0eb4.js";import{S as s}from"./p-5efc6566.js";import{t as l}from"./p-2ff67662.js";import"./p-1d4c7c11.js";import"./p-2f569553.js";import"./p-b226f54d.js";import"./p-871106e0.js";import"./p-add30d46.js";import"./p-d68092b7.js";const n=class{constructor(t){i(this,t),this.formControls={type:{isValid:!0,value:1,validate:i=>!!i},note:{isValid:!1,value:"",validate:i=>!!i}},this.submitted=!0}async onSubmit(i){i.preventDefault(),this.submitted=!0;let t=!0;for(let i in this.formControls){let e=this.formControls[i];e.validate(e.value),e.isValid||(t=!1)}if(t){let i=await s.getInstance().submitFeedback({Note:this.formControls.note.value,Type:this.formControls.type.value});console.log(i),i.Succeeded?((await l.create({message:"Feedback submitted successfully",duration:3e3})).present(),this.dismiss()):(await l.create({message:i.Message,duration:3e3})).present()}}dismiss(i){this.el.closest("ion-modal").dismiss({dismissed:!0})}changeFormValue(i,t){this.formControls=Object.assign(Object.assign({},this.formControls),{[i]:Object.assign(Object.assign({},this.formControls[i]),{value:t,isValid:this.formControls[i].validate(t)})})}render(){return t(e,null,t("ion-header",{translucent:!0},t("ion-toolbar",null,t("ion-title",null,"Feedback"),t("ion-buttons",{slot:"end"},t("ion-button",{onClick:()=>this.dismiss()},"Close")))),t("ion-content",{class:"ion-padding"},t("form",{onSubmit:i=>this.onSubmit(i),novalidate:!0},t("ion-list",null,t("ion-radio-group",{value:this.formControls.type.value,onChange:i=>this.changeFormValue("type",+i.target.value)},t("ion-list-header",null,t("ion-label",null,"Feedback Type")),t("ion-item",null,t("ion-label",null,"Comments"),t("ion-radio",{value:1})),t("ion-item",null,t("ion-label",null,"Suggestions"),t("ion-radio",{value:2})),t("ion-item",null,t("ion-label",null,"Questions"),t("ion-radio",{value:3}))),t("ion-item",null,t("ion-label",{position:"floating"},"Notes"),t("ion-textarea",{value:this.formControls.note.value,onChange:i=>this.changeFormValue("note",i.target.value)})),t("br",null),t("ion-button",{color:"primary",type:"submit"},"Submit")))))}get el(){return o(this)}};n.style=":host{display:block}";export{n as sparkle_feedback}