import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

GridLayout
{
    id: objectView

    columns: 4
    Layout.fillWidth: true
    Layout.fillHeight: true
    rowSpacing: 9

    Label
    {
        text: qsTr("Firma")
        Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
    }
    ComboBox
    {
        property string name: "business"
        id: business
        editable: true
        Layout.fillWidth: true
        Layout.columnSpan: 3
    }

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

    TextField
    {
        property string name: "street"
        id: street
        Layout.fillWidth: true
        Layout.alignment: Qt.AlignVCenter
        onTextChanged: checkFields()
    }
    Label
    {
        text: qsTr("Nr.*")
        Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
    }

    TextField
    {
        property string name: "houseno"
        id: houseno
        Layout.fillWidth: true
        Layout.alignment: Qt.AlignVCenter
        onTextChanged: checkFields()
    }

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

    TextField
    {
        property string name: "postcode"
        id: postcode
        Layout.fillWidth: true
        onTextChanged: checkFields()
    }
    Label
    {
        text: qsTr("Ort")
        Layout.alignment: Qt.AlignRight

    }
    ComboBox
    {
        property string name: "city"
        id: city
        Layout.fillWidth: true
        editable: true
        onEditTextChanged: checkFields()
        onCurrentTextChanged: checkFields()
        model: address_model
        textRole: "city"
        popup.height: 300
        currentIndex: -1
    }

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

    TextField
    {
        id: lohnanteil
        Layout.fillWidth: true
        Layout.columnSpan: 3
    }

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

    TextField
    {
        id: materialanteil
        Layout.fillWidth: true
        Layout.columnSpan: 3
    }

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

    TextField
    {
        id: zusatz1
        Layout.fillWidth: true
        Layout.columnSpan: 3
    }

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

    TextField
    {
        id: zusatz2
        Layout.fillWidth: true
        Layout.columnSpan: 3
    }

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

    TextField
    {id: gesamtnetto
        Layout.fillWidth: true
        Layout.columnSpan: 3
    }

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

    TextField
    {
        id: mwst
        Layout.fillWidth: true
        Layout.columnSpan: 3
    }

    Label
    {
        text: qsTr("Gesamt(Netto+MwSt)")
        Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
    }

    TextField
    {
        id: gesamt
        Layout.fillWidth: true
        Layout.columnSpan: 3
    }

    Label
    {
        text: qsTr("Zahlungsziel")
        Layout.alignment: Qt.AlignRight
    }
    ComboBox
    {
        property string name: "zahlungsziel"
        id: zahlungsziel
        Layout.fillWidth: true
        editable: false
        textRole: "display"
        Layout.columnSpan: 3
    }


    Label
    {
        text: qsTr("Info")
        Layout.alignment: Qt.AlignRight | Qt.AlignTop
    }
    ScrollView
    {
        id: infoview
        Layout.fillWidth: true
        Layout.preferredHeight: 110
        Layout.columnSpan: 3
        ScrollBar.horizontal: ScrollBar
        {
            policy: ScrollBar.AlwaysOn
        }

        TextArea
        {
            id: objectInfo
            property string name: "objectinfo"
            implicitWidth: parent.width
            wrapMode: TextEdit.Wrap
            background: Rectangle
            {
                color: objectInfo.palette.base
                border.color: objectInfo.activeFocus? objectInfo.palette.highlight: objectInfo.palette.base
                width: parent.width
            }
        }
    }
    Item
    {
        Layout.fillHeight: true
    }
}








