import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

ColumnLayout
{
    property int selectedClient: -1
    property var client: null
    property var contact: null
    id: clDet

    Button
    {
        text: qsTr("Zurück")
        onClicked: contentStack.pop()
    }

    SplitView
    {
        id: clDetView
        Layout.fillHeight: true
        Layout.fillWidth: true
        leftPadding: 9
        rightPadding: 9

        CustomerDetailsView
        {
            id: customerDetails
        }

        CustomerContactDetails
        {
            id: contactDetails
            visible: false
        }

        NoCustomerContact
        {
            id: noCustomerContact
            visible: false
        }
    }

    Item
    {
        //Layout.columnSpan: 2
        Layout.fillHeight: true
    }

    Component.onCompleted:
    {
        //business_model.onRowClicked(selectedClient)
        client = business_model.getClientDetails()
        if (client['business']['contactid'] > 0)
        {
            contact = contact_model.getContactDetails(client['business']['contactid'])
            contactDetails.visible = true
        }
        else noCustomerContact.visible = true
    }
}
