222 lines
6.2 KiB
QML
222 lines
6.2 KiB
QML
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
|
|
}
|
|
|
|
Button
|
|
{
|
|
id: addEmployeeBtn
|
|
icon.source: "qrc:/images/addbusiness.svg"
|
|
icon.color: "olive"
|
|
anchors.right: parent.right
|
|
flat: true
|
|
onClicked: appLoader.source = "AddApplicant.qml"
|
|
}
|
|
|
|
ButtonGroup
|
|
{
|
|
id: criterion
|
|
// buttons: criterion.children
|
|
onClicked:
|
|
{
|
|
viewEmployees(criterion.checkedButton.text)
|
|
}
|
|
}
|
|
|
|
ColumnLayout
|
|
{
|
|
anchors
|
|
{
|
|
|
|
top: searchBar.bottom
|
|
bottom: parent.bottom
|
|
left: parent.left
|
|
right: parent.right
|
|
}
|
|
|
|
RowLayout
|
|
{
|
|
//id: criterion
|
|
|
|
RadioButton
|
|
{
|
|
//id: showAll
|
|
checked: true
|
|
text: qsTr("Alle")
|
|
ButtonGroup.group: criterion
|
|
//onClicked: viewEmployees(showAll)
|
|
}
|
|
RadioButton
|
|
{
|
|
//id: showApplicant
|
|
text: qsTr("Bewerber")
|
|
ButtonGroup.group: criterion
|
|
//onClicked: viewEmployees(showApplicant)
|
|
}
|
|
RadioButton
|
|
{
|
|
//id: showEmployee
|
|
text: qsTr("Mitarbeiter")
|
|
ButtonGroup.group: criterion
|
|
//onClicked: viewEmployees(showEmployee)
|
|
}
|
|
|
|
CheckBox
|
|
{
|
|
id: showEveryone
|
|
text: qsTr("Alle Stati")
|
|
checked: true
|
|
onClicked: viewEmployees(criterion.checkedButton.text)
|
|
onCheckedChanged:
|
|
{
|
|
showFired.checked = false
|
|
showProcessed.checked = false
|
|
}
|
|
}
|
|
CheckBox
|
|
{
|
|
id: showProcessed
|
|
text: qsTr("Erledigt")
|
|
enabled: !showEveryone.checked
|
|
checked: false
|
|
onClicked:
|
|
{
|
|
showFired.checked = false
|
|
viewEmployees(criterion.checkedButton.text)
|
|
}
|
|
}
|
|
CheckBox
|
|
{
|
|
id: showFired
|
|
text: qsTr("Ausgeschieden")
|
|
enabled: !showEveryone.checked
|
|
checked: false
|
|
onClicked:
|
|
{
|
|
showProcessed.checked = false
|
|
viewEmployees(criterion.checkedButton.text)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
HorizontalHeaderView
|
|
{
|
|
id: employeeTableHeader
|
|
Layout.fillWidth: true
|
|
syncView: appliEmpTable
|
|
implicitHeight: 40
|
|
movableColumns: true //@disable-check M16
|
|
delegate: Rectangle
|
|
{
|
|
color: addEmployeeBtn.palette.alternateBase
|
|
border.color: palette.base
|
|
implicitHeight: 40
|
|
Layout.fillWidth: true
|
|
implicitWidth: 1
|
|
Text
|
|
{
|
|
text: model.display
|
|
elide: Text.ElideRight
|
|
width: parent.width
|
|
height: parent.height
|
|
horizontalAlignment: Text.AlignHCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
color: palette.text
|
|
}
|
|
}
|
|
}
|
|
|
|
TableView
|
|
{
|
|
id: appliEmpTable
|
|
Layout.fillHeight: true
|
|
Layout.fillWidth: true
|
|
columnSpacing: 1
|
|
rowSpacing: 2
|
|
alternatingRows: true
|
|
resizableColumns: true
|
|
model: employee_model
|
|
selectionBehavior: TableView.SelectRows
|
|
|
|
ScrollBar.vertical: ScrollBar
|
|
{
|
|
policy: appliEmpTable.contentHeight > appliEmpTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
|
}
|
|
|
|
selectionModel: ItemSelectionModel
|
|
{
|
|
id: selModel
|
|
model: appliEmpTable.model
|
|
}
|
|
|
|
|
|
delegate:Rectangle
|
|
{
|
|
required property bool selected
|
|
required property bool current
|
|
implicitWidth: appliEmpTable.width / appliEmpTable.columns
|
|
implicitHeight: 25
|
|
color: selected
|
|
? addEmployeeBtn.palette.highlight //palette.highlight
|
|
: (appliEmpTable.alternatingRows && row % 2 !== 0
|
|
? addEmployeeBtn.palette.base // palette.base
|
|
: addEmployeeBtn.palette.alternateBase) //palette.alternateBase)
|
|
|
|
Text
|
|
{
|
|
text: model.display === null? "": model.display
|
|
elide: Text.ElideRight
|
|
width: parent.width
|
|
height: parent.height
|
|
verticalAlignment: Text.AlignVCenter
|
|
leftPadding: 9 //@d isable-check M16
|
|
color: palette.text
|
|
|
|
}
|
|
|
|
MouseArea
|
|
{
|
|
id: mouseArea
|
|
property bool hovered:false
|
|
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
|
|
onDoubleClicked:
|
|
{
|
|
employeesStack.push("EmployeeDetails.qml", {selectedEmployee: row});
|
|
}
|
|
|
|
onEntered:
|
|
{
|
|
appliEmpTable.selectionModel.select(appliEmpTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows)
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
Item
|
|
{
|
|
Layout.fillWidth: true
|
|
}
|
|
}
|
|
|
|
function viewEmployees(criterion)
|
|
{
|
|
employee_model.viewCriterion(criterion, showProcessed.checked, showFired.checked, showEveryone.checked)
|
|
}
|
|
Component.onCompleted: employeesStack.pop()
|
|
}
|