import { gettext } from "django"; import { customElement, html, TemplateResult } from "lit-element"; import { EVENT_REFRESH } from "../../constants"; import { ModalButton } from "../buttons/ModalButton"; import { Form } from "./Form"; @customElement("ak-forms-modal") export class ModalForm extends ModalButton { confirm(): void { this.querySelectorAll>("[slot=form]").forEach(form => { const formPromise = form.submit(new Event("submit")); if (!formPromise) { return; } formPromise.then(() => { this.open = false; form.reset(); this.dispatchEvent( new CustomEvent(EVENT_REFRESH, { bubbles: true, composed: true, }) ); }).catch((e) => { console.log(e); }); }); } renderModalInner(): TemplateResult { return html`

`; } }