Formulário de Sugestão
form {
width: 100%;
max-width: 60rem;
}label {
margin-bottom: 0.5rem;
color: #84868f;
}textarea {
min-height: 12.5rem;
resize: vertical;
}
.success,
.error {
text-align: center;
}.success {
color: greenyellow;
}.error {
color: tomato;
}
class FormSubmit { constructor(settings) { this.settings = settings; this.form = document.querySelector(settings.form); this.formButton = document.querySelector(settings.button); if (this.form) { this.url = this.form.getAttribute(“action”); } this.sendForm = this.sendForm.bind(this); }displaySuccess() { this.form.innerHTML = this.settings.success; }displayError() { this.form.innerHTML = this.settings.error; }getFormObject() { const formObject = {}; const fields = this.form.querySelectorAll(“[name]”); fields.forEach((field) => { formObject[field.getAttribute(“name”)] = field.value; }); return formObject; }onSubmission(event) { event.preventDefault(); event.target.disabled = true; event.target.innerText = “Enviando…”; }async sendForm(event) { try { this.onSubmission(event); await fetch(this.url, { method: “POST”, headers: { “Content-Type”: “application/json”, Accept: “application/json”, }, body: JSON.stringify(this.getFormObject()), }); this.displaySuccess(); } catch (error) { this.displayError(); throw new Error(error); } }init() { if (this.form) this.formButton.addEventListener(“click”, this.sendForm); return this; } }const formSubmit = new FormSubmit({ form: “[data-form]”, button: “[data-button]”, success: “
FORMULÁRIO SOBRE A DIVULGAÇÃO DE PROPOSTAS PMIS nº 001/2023-SES
Abaixo, disponibilizamos formulário para sugestões da sociedade civil acerca da divulgação de propostas PMIS nº 001/2023-SES.
Objeto do Procedimento: Atividades de gerenciamento, operacionalização e execução de serviços de saúde no Hospital Regional de Balsas – CNES: 9336508, Centro de Hemodiálise de Balsas – CNES: 675628, Hospital Regional da Baixada Maranhense Dr. Jackson Lago – CNES: 7826060 e o Centro de Hemodiálise de Pinheiro – CNES: 452033.
class FormSubmit { constructor(settings) { this.settings = settings; this.form = document.querySelector(settings.form); this.formButton = document.querySelector(settings.button); if (this.form) { this.url = this.form.getAttribute(“action”); } this.sendForm = this.sendForm.bind(this); }displaySuccess() { this.form.innerHTML = this.settings.success; }displayError() { this.form.innerHTML = this.settings.error; }getFormObject() { const formObject = {}; const fields = this.form.querySelectorAll(“[name]”); fields.forEach((field) => { formObject[field.getAttribute(“name”)] = field.value; }); return formObject; }onSubmission(event) { event.preventDefault(); event.target.disabled = true; event.target.innerText = “Enviando…”; }async sendForm(event) { try { this.onSubmission(event); await fetch(this.url, { method: “POST”, headers: { “Content-Type”: “application/json”, Accept: “application/json”, }, body: JSON.stringify(this.getFormObject()), }); this.displaySuccess(); } catch (error) { this.displayError(); throw new Error(error); } }init() { if (this.form) this.formButton.addEventListener(“click”, this.sendForm); return this; } }const formSubmit = new FormSubmit({ form: “[data-form]”, button: “[data-button]”, success: “