import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Fusion

ColumnLayout
{
    Layout.fillWidth: true
    Layout.fillHeight: true
    spacing: 15
    Label
    {
        text: qsTr("Kunden anlegen")
        horizontalAlignment: Text.AlignHCenter
        Layout.fillWidth: true
        font.pixelSize: 35
    }
    CheckBox
    {
        text: qsTr("Ansprechpartner hinzufügen")
        Layout.alignment: Qt.AlignRight
        checked: false
        onCheckStateChanged: addContactLayout.visible = checked
    }

    RowLayout
    {
        Layout.fillWidth: true
        Layout.fillHeight: true
        spacing: 45
        GridLayout
        {
            columns: 2
            Layout.fillWidth: true
            Layout.fillHeight: true
            rowSpacing: 9

            Label
            {
                text: qsTr("Firmenname")
                Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
            }

            TextField
            {
                id: firmenName
                Layout.fillWidth: true
                Layout.alignment: Qt.AlignVCenter
            }

            Label
            {
                text: qsTr("Straße")
                Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
            }

            TextField
            {
                id: street
                Layout.fillWidth: true
            }
            Label
            {
                text: qsTr("PLZ")
                Layout.alignment: Qt.AlignRight
            }

            ComboBox
            {
                Layout.fillWidth: true
                editable: true
            }

            Label
            {
                text: qsTr("Ort")
                Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
            }
            TextField
            {
                id: location
                Layout.fillWidth: true
            }

            Label
            {
                text: qsTr("Telefon")
                Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
            }
            TextField
            {
                id: telephone
                Layout.fillWidth: true
            }

            Label
            {
                text: qsTr("E-Mail")
                Layout.alignment: Qt.AlignRight
            }
            TextField
            {
                id: email
                Layout.fillWidth: true
            }

            Label
            {
                text: qsTr("Homepage")
                Layout.alignment: Qt.AlignRight
            }
            TextField
            {
                id: homepage
                Layout.fillWidth: true
            }

            Label
            {
                text: qsTr("Geschäftsführer")
                Layout.alignment: Qt.AlignRight
            }
            TextField
            {
                id: ceo
                Layout.fillWidth: true
            }

            Label
            {
                text: qsTr("USt-IdNr")
                Layout.alignment: Qt.AlignRight
            }
            TextField
            {
                id: taxno
                Layout.fillWidth: true
            }
            Label
            {
                text: qsTr("Info")
                Layout.alignment: Qt.AlignRight | Qt.AlignTop
            }
            ScrollView
            {
                Layout.fillWidth: true
                Layout.preferredHeight: 100

                TextArea
                {

                    id: customerInfo
                    background: Rectangle
                    {
                        color: customerInfo.palette.base
                        border.color: customerInfo.activeFocus? customerInfo.palette.highlight: customerInfo.palette.base
                    }
                }
            }


        }

        GridLayout
        {
            id: addContactLayout
            Layout.fillWidth: true
            Layout.fillHeight: true
            Layout.alignment: Qt.AlignTop
            columns: 2
            rowSpacing: 9
            visible: false

            Label
            {
                text: qsTr("Anrede")
                Layout.alignment: Qt.AlignRight
            }
            ComboBox
            {
                id: title
                Layout.fillWidth: true
                editable: true
            }
            Label
            {
                text: qsTr("Vorname")
                Layout.alignment: Qt.AlignRight
            }
            TextField
            {
                id: firstname
                Layout.fillWidth: true
            }

            Label
            {
                text: qsTr("Nachname")
                Layout.alignment: Qt.AlignRight
            }
            TextField
            {
                id: lastname
                Layout.fillWidth: true
            }
            Label
            {
                text: qsTr("Position")
                Layout.alignment: Qt.AlignRight
            }
            ComboBox
            {
                id: jobdescription
                Layout.fillWidth: true
                editable: true
            }
            Label
            {
                text: qsTr("E-Mail")
                Layout.alignment: Qt.AlignRight
            }
            TextField
            {
                id: emailcontact
                Layout.fillWidth: true
            }

            Label
            {
                text: qsTr("Telefon")
                Layout.alignment: Qt.AlignRight
            }
            TextField
            {
                id: telephonecontact
                Layout.fillWidth: true
            }
            Label
            {
                text: qsTr("Geburtsdatum")
                Layout.alignment: Qt.AlignRight
            }
            TextField
            {
                id: birthday
                Layout.fillWidth: true
            }

            Label
            {
                text: qsTr("Priorität")
                Layout.alignment: Qt.AlignRight
            }
            ComboBox
            {
                id: rank
                Layout.fillWidth: true
                editable: true
            }
            Label
            {
                text: qsTr("Rechnung")
                Layout.alignment: Qt.AlignRight
            }
            ComboBox
            {
                id: invoice
                Layout.fillWidth: true
                editable: true
            }
            Label
            {
                text: qsTr("Mahnung")
                Layout.alignment: Qt.AlignRight
            }
            ComboBox
            {
                id: due
                Layout.fillWidth: true
                editable: true
            }
        }
    }
    RowLayout
    {
        Layout.fillHeight: true
        Layout.alignment: Qt.AlignRight
        Button
        {
            text: qsTr("Abbrechen")
            onClicked: appLoader.source = "CustomerTables.qml"

        }
        Button
        {
            text: qsTr("Speichern")

        }
    }
    Item
    {
        id: spacer3
        Layout.fillHeight: true
    }
}
