import Dialog from "./Dialog.js";
import TilorswiftAddRowsEvent from "../events/TilorswiftAddRowsEvent.js";

export default class DialogAddRows extends Dialog
{
    constructor() {
        super();
        this.inputPosition = this.createInputNumber('Einfügen vor Zeile');
        this.inputRows = this.createInputNumber('Anzahl Zeilen');
        this.buttonOk = this.createButton('OK');
        this.buttonOk.addEventListener(
            'click',
            () => {
                window.dispatchEvent(new TilorswiftAddRowsEvent(this.getPosition(), this.getRowsCount()));
            }
        )
    }

    getPosition()
    {
        return parseInt(this.inputPosition.value);
    }

    getRowsCount()
    {
        return parseInt(this.inputRows.value);
    }
}