import QtQuick
import QtQuick.Layouts
import TeroStyle

ColumnLayout {
    anchors.fill: parent
    spacing: Dimensions.l

    ApplicantForm {
        id: applicantForm

        Layout.alignment: Qt.AlignTop
        Layout.fillHeight: true
        Layout.verticalStretchFactor: 1
    }
    RowLayout {
        Layout.alignment: Qt.AlignRight
        spacing: Dimensions.l

        Button {
            icon.source: "qrc:/images/ArrowLeftCircle-Outline.svg"
            text: qsTr("Verwerfen")

            onClicked: contentStack.pop()
        }
        Button {
            enabled: applicantForm.valid
            icon.source: "qrc:/images/CheckCircle.svg"
            text: qsTr("Speichern")

            onClicked: {
                applicantModel.createApplicant(applicantForm.value);
                contentStack.pop();
            }
        }
    }
}