import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Qt.labs.qmlmodels


Item {
    property var availableFilters: ["Name", "Adresse", "PLZ", "Ort", "Status"]

    SearchBar
    {
        id:searchBar
        anchors.margins: 9
    }

    ColumnLayout
    {
        anchors
        {

            top: searchBar.bottom
            bottom: parent.bottom
            left: parent.left
            right: parent.right

        }

        RowLayout
        {

            RadioButton
            {

                checked: true
                text: qsTr("Alle")
            }
            RadioButton
            {

                text: qsTr("Bewerber")
            }
            RadioButton
            {

                text: qsTr("Mitarbeiter")
            }
            RadioButton
            {

                text: qsTr("Erledigt")
            }
            RadioButton
            {

                text: qsTr("Ausgeschieden")
            }

        }

        HorizontalHeaderView
        {
            id: horizontalHeader
            Layout.fillWidth: true
            syncView: testTable

        }

        TableView
        {
            id: testTable
            Layout.fillHeight: true
            Layout.fillWidth: true
            columnSpacing: 1
            rowSpacing: 2
            model: bm
            selectionBehavior: TableView.SelectRows
            selectionModel: ItemSelectionModel


                            {
                                id: selModel
                                model: testTable.model
                            }


            delegate:Rectangle
            {
                required property bool selected
                required property bool current
                implicitWidth: 200
                implicitHeight: 25
                color: selected? "lightblue": palette.base

                Text
                {
                    Layout.fillWidth: true
                    text: model.display

                }

                MouseArea
                {
                    id: mouseArea
                    property bool hovered:false

                    anchors.fill: parent
                    hoverEnabled: true


                    onClicked:
                    {
                        bm.onRowClicked(row)
                        testTable.selectionModel.select(testTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows)


                    }

                }
            }
        }

    }
}



