Fix Mitarbeiter Table
This commit is contained in:
@@ -6,7 +6,6 @@ import Qt.labs.qmlmodels
|
|||||||
Item {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
property var availableFilters: ["Name", "Adresse", "PLZ", "Ort"]
|
property var availableFilters: ["Name", "Adresse", "PLZ", "Ort"]
|
||||||
id: test
|
|
||||||
|
|
||||||
StackView
|
StackView
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,11 +4,9 @@ import QtQuick.Controls
|
|||||||
import Qt.labs.qmlmodels
|
import Qt.labs.qmlmodels
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
function viewCriterion(criterion) {
|
|
||||||
business_model.viewCriterion(criterion.text);
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
spacing: Dimensions.l
|
||||||
|
|
||||||
Component.onCompleted: customersStack.pop()
|
Component.onCompleted: customersStack.pop()
|
||||||
|
|
||||||
@@ -32,22 +30,22 @@ ColumnLayout {
|
|||||||
selected: true
|
selected: true
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "showProvider"
|
name: "Interessent"
|
||||||
text: qsTr("Interessent")
|
text: qsTr("Interessent")
|
||||||
selected: false
|
selected: false
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "showClientele"
|
name: "Kunde"
|
||||||
text: qsTr("Kunde")
|
text: qsTr("Kunde")
|
||||||
selected: false
|
selected: false
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "showProvider"
|
name: "Lieferant"
|
||||||
text: qsTr("Lieferant")
|
text: qsTr("Lieferant")
|
||||||
selected: false
|
selected: false
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "showFinished"
|
name: "Erledigt"
|
||||||
text: qsTr("Erledigt")
|
text: qsTr("Erledigt")
|
||||||
selected: false
|
selected: false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,14 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Qt.labs.qmlmodels
|
import Qt.labs.qmlmodels
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
Item
|
StackView {
|
||||||
{
|
|
||||||
StackView
|
|
||||||
{
|
|
||||||
id: employeesStack
|
id: employeesStack
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
initialItem: "EmployeesTable.qml"
|
initialItem: "EmployeesTable.qml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,222 +3,195 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Qt.labs.qmlmodels
|
import Qt.labs.qmlmodels
|
||||||
|
|
||||||
Item
|
ColumnLayout {
|
||||||
{
|
|
||||||
property var availableFilters: ["Name", "Adresse", "PLZ", "Ort", "Status"]
|
property var availableFilters: ["Name", "Adresse", "PLZ", "Ort", "Status"]
|
||||||
|
|
||||||
SearchBar
|
function viewEmployees(criterion) {
|
||||||
{
|
employee_model.viewCriterion(criterion, showProcessed.checked, showFired.checked, showEveryone.checked);
|
||||||
id:searchBar
|
|
||||||
anchors.margins: 9
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Button
|
anchors.fill: parent
|
||||||
{
|
spacing: Dimensions.s
|
||||||
id: addEmployeeBtn
|
|
||||||
text: qsTr("Mitarbeiter Hinzufügen")
|
|
||||||
icon.source: "qrc:/images/PlusCircle.svg"
|
|
||||||
anchors.right: parent.right
|
|
||||||
flat: true
|
|
||||||
onClicked: appLoader.source = "AddApplicant.qml"
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonGroup
|
Component.onCompleted: employeesStack.pop()
|
||||||
{
|
|
||||||
id: criterion
|
RowLayout {
|
||||||
// buttons: criterion.children
|
Layout.fillWidth: true
|
||||||
onClicked:
|
Layout.horizontalStretchFactor: 1
|
||||||
{
|
spacing: Dimensions.l
|
||||||
viewEmployees(criterion.checkedButton.text)
|
|
||||||
|
SearchBar {
|
||||||
|
}
|
||||||
|
|
||||||
|
QuickFilter {
|
||||||
|
model: ListModel {
|
||||||
|
ListElement {
|
||||||
|
name: "Alle"
|
||||||
|
selected: true
|
||||||
|
text: qsTr("Alle")
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
name: "Bewerber"
|
||||||
|
selected: false
|
||||||
|
text: qsTr("Bewerber")
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
name: "Mitarbeiter"
|
||||||
|
text: qsTr("Mitarbeiter")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onSelectedChanged: name => {
|
||||||
|
viewEmployees(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
id: addEmployeeBtn
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
icon.source: "qrc:/images/PlusCircle.svg"
|
||||||
|
text: qsTr("Mitarbeiter Hinzufügen")
|
||||||
|
|
||||||
|
onClicked: appLoader.source = "AddApplicant.qml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RowLayout {
|
||||||
|
id: viewCriterion
|
||||||
|
|
||||||
ColumnLayout
|
CheckBox {
|
||||||
{
|
id: showEveryone
|
||||||
|
|
||||||
|
checked: true
|
||||||
|
text: qsTr("Alle Stati")
|
||||||
|
|
||||||
|
onCheckedChanged: {
|
||||||
|
showFired.checked = false;
|
||||||
|
showProcessed.checked = false;
|
||||||
|
}
|
||||||
|
onClicked: viewEmployees(criterion.checkedButton.text)
|
||||||
|
}
|
||||||
|
CheckBox {
|
||||||
|
id: showProcessed
|
||||||
|
|
||||||
|
checked: false
|
||||||
|
enabled: !showEveryone.checked
|
||||||
|
text: qsTr("Erledigt")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
showFired.checked = false;
|
||||||
|
viewEmployees(criterion.checkedButton.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CheckBox {
|
||||||
|
id: showFired
|
||||||
|
|
||||||
|
checked: false
|
||||||
|
enabled: !showEveryone.checked
|
||||||
|
text: qsTr("Ausgeschieden")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
showProcessed.checked = false;
|
||||||
|
viewEmployees(criterion.checkedButton.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ColumnLayout {
|
||||||
id: tableParent
|
id: tableParent
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.verticalStretchFactor: 1
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
anchors
|
|
||||||
{
|
|
||||||
|
|
||||||
top: searchBar.bottom
|
HorizontalHeaderView {
|
||||||
bottom: parent.bottom
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout
|
|
||||||
{
|
|
||||||
id: viewCriterion
|
|
||||||
|
|
||||||
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
|
id: employeeTableHeader
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
syncView: appliEmpTable
|
width: tableParent.width
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
movableColumns: true //@disable-check M16
|
movableColumns: true //@disable-check M16
|
||||||
delegate: Rectangle
|
syncView: appliEmpTable
|
||||||
{
|
|
||||||
color: addEmployeeBtn.palette.alternateBase
|
delegate: Rectangle {
|
||||||
border.color: palette.base
|
|
||||||
implicitHeight: 40
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
border.color: palette.base
|
||||||
|
color: addEmployeeBtn.palette.alternateBase
|
||||||
|
implicitHeight: 40
|
||||||
implicitWidth: 1
|
implicitWidth: 1
|
||||||
Text
|
|
||||||
{
|
Text {
|
||||||
text: model.display
|
color: palette.text
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
width: parent.width
|
|
||||||
height: parent.height
|
height: parent.height
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: model.display
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
color: palette.text
|
width: parent.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TableView {
|
||||||
TableView
|
|
||||||
{
|
|
||||||
id: appliEmpTable
|
id: appliEmpTable
|
||||||
//Layout.fillHeight: true
|
|
||||||
height: tableParent.height - (viewCriterion.height + employeeTableHeader.height)
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.verticalStretchFactor: 1
|
||||||
columnSpacing: 1
|
columnSpacing: 1
|
||||||
rowSpacing: 2
|
height: tableParent.height - employeeTableHeader.height
|
||||||
alternatingRows: true
|
|
||||||
resizableColumns: true
|
|
||||||
model: employee_model
|
model: employee_model
|
||||||
|
resizableColumns: true
|
||||||
|
rowSpacing: 2
|
||||||
selectionBehavior: TableView.SelectRows
|
selectionBehavior: TableView.SelectRows
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar
|
ScrollBar.vertical: ScrollBar {
|
||||||
{
|
|
||||||
policy: appliEmpTable.contentHeight > appliEmpTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
policy: appliEmpTable.contentHeight > appliEmpTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
||||||
}
|
}
|
||||||
|
delegate: Rectangle {
|
||||||
selectionModel: ItemSelectionModel
|
|
||||||
{
|
|
||||||
id: selModel
|
|
||||||
model: appliEmpTable.model
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
delegate:Rectangle
|
|
||||||
{
|
|
||||||
required property bool selected
|
|
||||||
required property bool current
|
required property bool current
|
||||||
implicitWidth: appliEmpTable.width / appliEmpTable.columns
|
required property bool selected
|
||||||
|
|
||||||
|
color: selected ? addEmployeeBtn.palette.highlight //palette.highlight
|
||||||
|
: (appliEmpTable.alternatingRows && row % 2 !== 0 ? addEmployeeBtn.palette.base // palette.base
|
||||||
|
: addEmployeeBtn.palette.alternateBase) //palette.alternateBase)
|
||||||
|
|
||||||
implicitHeight: 25
|
implicitHeight: 25
|
||||||
color: selected
|
implicitWidth: appliEmpTable.width / appliEmpTable.columns
|
||||||
? addEmployeeBtn.palette.highlight //palette.highlight
|
|
||||||
: (appliEmpTable.alternatingRows && row % 2 !== 0
|
|
||||||
? addEmployeeBtn.palette.base // palette.base
|
|
||||||
: addEmployeeBtn.palette.alternateBase) //palette.alternateBase)
|
|
||||||
|
|
||||||
Text
|
Text {
|
||||||
{
|
|
||||||
text: (model.display === null || model.display === undefined)? "": model.display
|
|
||||||
elide: Text.ElideRight
|
|
||||||
width: parent.width
|
|
||||||
height: parent.height
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
leftPadding: 9 //@d isable-check M16
|
|
||||||
color: palette.text
|
color: palette.text
|
||||||
|
elide: Text.ElideRight
|
||||||
|
height: parent.height
|
||||||
|
leftPadding: 9 //@d isable-check M16
|
||||||
|
text: (model.display === null || model.display === undefined) ? "" : model.display
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
width: parent.width
|
||||||
}
|
}
|
||||||
|
MouseArea {
|
||||||
MouseArea
|
|
||||||
{
|
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
property bool hovered:false
|
|
||||||
|
property bool hovered: false
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
onDoubleClicked:
|
onDoubleClicked: {
|
||||||
{
|
employeesStack.push("EmployeeDetails.qml", {
|
||||||
employeesStack.push("EmployeeDetails.qml", {selectedEmployee: row});
|
selectedEmployee: row
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
onEntered: {
|
||||||
onEntered:
|
appliEmpTable.selectionModel.select(appliEmpTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows);
|
||||||
{
|
|
||||||
appliEmpTable.selectionModel.select(appliEmpTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
selectionModel: ItemSelectionModel {
|
||||||
|
id: selModel
|
||||||
|
|
||||||
Item
|
model: appliEmpTable.model
|
||||||
{
|
}
|
||||||
|
}
|
||||||
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function viewEmployees(criterion)
|
|
||||||
{
|
|
||||||
employee_model.viewCriterion(criterion, showProcessed.checked, showFired.checked, showEveryone.checked)
|
|
||||||
}
|
|
||||||
Component.onCompleted: employeesStack.pop()
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,8 +146,7 @@ GridLayout
|
|||||||
}
|
}
|
||||||
|
|
||||||
TextField
|
TextField
|
||||||
{
|
{id: gesamtnetto
|
||||||
id: gesamtnetto
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 3
|
Layout.columnSpan: 3
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user