Files
advotracker/advotracker_qml/resources/pages/PaneNumberHarmAdmin.qml
2020-06-19 17:44:02 +02:00

290 lines
11 KiB
QML
Executable File

/*
* AdvoTracker - Hotline tackingtool for Advocats
*
* Copyright (c) 2017 Ralf Zerres <ralf.zerres@networkx.de>
*
* AdvoTracker is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* AdvoTracker is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with AdvoTracker; If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.10 // Qt 5.10
import QtQuick.Controls 2.3 // Qt 5.10
import QtQuick.Layouts 1.3 // Qt 5.10
import QtQuick.Controls.Material 2.3 // Qt 5.10
// AdvoTracker Module
import de.networkx.AdvoTracker 1.0 as Nwx
import SortFilterProxyModel 0.2
Pane {
id: paneNumberHarmAdmin
Layout.fillWidth:true
leftPadding: 18
rightPadding: 18
topPadding: 18
bottomPadding: 18
ColumnLayout {
id: columnNumberHarmAdmin
width: parent.width
//anchors.topMargin: 12
spacing:25
GroupBox {
id: groupBoxDataAdmin
title: qsTr("Administative Data")
width: parent.width
//height: filterNumberHarmClerk.count * height + 2 * anchors.margins
height: Layout.preferredHeight
Layout.fillWidth: true
Layout.preferredHeight: 95
//Layout.preferredHeight: rowClerk.height + 12
Item {
focus: true
Keys.onPressed: {
console.log("KeyReader captured:",
event.text);
event.accepted = true;
}
}
SortFilterProxyModel {
id: filterNumberHarmClerk
sourceModel: modelNumberHarmClerk
filters: RegExpFilter {
roleName: "numberHarm"
pattern: numberHarm
//caseSensitivity: Qt.CaseInsensitive
//caseSensitivity: Qt.Sensitive
}
sorters: [ StringSorter { roleName: "clerkId" } ]
} // filterNumberHarmClerk
Component {
id: delegateDataAdmin
ItemDelegate {
id: itemNumberHarmList
Layout.fillWidth: true
width: parent.width
anchors.right: parent.fill
contentItem: RowLayout {
id: rowClerk
Layout.fillWidth: true
spacing: 6
Item {
id: itemWidth
property int labelWidth: 140
//property int textFieldWidth: 180
}
Nwx.Label {
id: labelClerkName
text: qsTr("Clerkname")
Layout.minimumWidth: 100
Layout.preferredWidth: itemWidth.labelWidth
//horizontalAlignment: Qt.AlignHRight
//verticalAlignment: Qt.AlignTop
} // labelClerkName
Nwx.Label {
id: clerkId
text: model.clerkId
//Layout.preferredWidth: itemWidth.labelWidth
//Layout.maximumWidth: itemWidth.labelWidth
} // clerkId
Nwx.Label {
id: clerkName
text: model.clerkFirstName + " " + model.clerkLastName
//Layout.preferredWidth: itemWidth.labelWidth
//Layout.maximumWidth: itemWidth.labelWidth
} // clerkName
} // rowClerk
} // itemNumberHarmList
} // delegateDataAdmin
ListView {
id: listNumberHarmClerk
anchors.fill: parent
Layout.fillWidth: true
//clip: true
property string numberHarm
//focus: true
model: filterNumberHarmClerk
delegate: delegateDataAdmin
//highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
} // listNumberHarmClerk
} // groupBoxDataAdmin
GroupBox {
id: groupBoxDataHistory
title: qsTr("Data history")
width: parent.width
height: Layout.preferredHeight
Layout.fillWidth: true
Layout.preferredHeight: 400
//anchors.top: groupBoxDataAdmin.bottom
//anchors.top: rowClerk.bottom
//anchors.topMargin: 18
//anchors.fill: parent
SortFilterProxyModel {
id: filterNumberHarmHistory
sourceModel: modelNumberHarmHistory
filters: RegExpFilter {
roleName: "numberHarm"
pattern: numberHarm
}
sorters: [
StringSorter { roleName: "dateChanged"; sortOrder: Qt.DescendingOrder },
StringSorter { roleName: "userIdChanged"; sortOrder: Qt.AscendingOrder }
]
} // filterNumberHarmHistory
Component {
id: headerDataHistory
Pane {
id: frameHeaderDataHistory
Layout.fillWidth: true
//Layout.fillHeight: true
height: userIdChanged.implicitHeight * 0.9
width: parent.width
//anchors.top: groupBoxDataAdmin.bottom
//Material.background: Material.color(Material.Grey)
RowLayout {
id: rowHeaderDataHistory
spacing: 8
width: parent.width
//anchors.verticalCenter: parent.verticalCenter
Layout.fillWidth: true
//Material.foreground: Material.accent
Label {
id: labelHeaderDateChanged
text: qsTr("Date changed")
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Layout.preferredWidth: 200
Layout.minimumWidth: 200
//anchors.right: rowHeaderDataHistory.right
}
Label {
id: labelHeaderUserId
text: qsTr("Id")
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Layout.preferredWidth: 90
Layout.minimumWidth: 90
}
Label {
id: labelHeaderUserName
text: qsTr("User Name")
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Layout.fillWidth: true
Layout.preferredWidth: 180
Layout.minimumWidth: 180
anchors.left: labelHeaderUserId.right
anchors.right: parent.right;
}
} // rowHeaderDataHistory
} // frameHeaderDataHistory
} // headerDataHistory
Component {
id: delegateDataHistory
ItemDelegate {
id: itemDataHistory
Layout.fillWidth: true
height: userIdChanged.implicitHeight * 0.9 // or implicit height of children,
width: parent.width
anchors.right: parent.fill
focus: true
contentItem: RowLayout {
id: rowUser
Layout.fillWidth: true
spacing: 12
Nwx.Label {
id: dateChanged
text: Qt.formatDateTime(model.dateChanged, "ddd dd.MM.yyyy hh:mm")
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Layout.preferredWidth: 200
Layout.minimumWidth: 200
} // dateChanged
Nwx.Label {
id: userIdChanged
//Layout.preferredWidth: itemWidth.labelWidth
//Layout.maximumWidth: itemWidth.labelWidth
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Layout.preferredWidth: 90
Layout.minimumWidth: 90
text: model.userIdChanged
} // userName
Nwx.Label {
id: userName
Layout.preferredWidth: 180
Layout.minimumWidth: 180
Layout.fillWidth: true
text: model.userFirstName + " " + model.userLastName
//text: model.userId
anchors.left: userIdChanged.right
anchors.right: parent.right
} // userName
} // rowUser
} // itemDataAdmin
} // delegateDataHistory
ListView {
id: listNumberHarmHistory
anchors.fill: parent
anchors.rightMargin: 12
height: groupBoxDataHistory.height * 0.7
//anchors.top: groupBoxDataAdmin.bottom
//focus: true
clip: true
spacing: 1
model: filterNumberHarmHistory
header: headerDataHistory
delegate: delegateDataHistory
ScrollBar.vertical: Nwx.ScrollBar {
id: scrollBarNumberHarmHistory
// leftPadding: 2
// topPadding: 2
// color: "lightsteelblue"
parent: listNumberHarmHistory.parent
anchors.top: listNumberHarmHistory.top
anchors.left: listNumberHarmHistory.right
anchors.bottom: listNumberHarmHistory.bottom
}
} // listNumberHarmHistory
} // groupBoxDataHistory
} // columnNumberHarmAdmin
} // paneNumberHarmAdmin