160 lines
4.8 KiB
QML
160 lines
4.8 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QtQuick.Controls
|
|
import Qt.labs.qmlmodels
|
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
|
spacing: Dimensions.l
|
|
|
|
Component.onCompleted: customersStack.pop()
|
|
|
|
RowLayout {
|
|
Layout.fillWidth: true
|
|
Layout.horizontalStretchFactor: 1
|
|
spacing: Dimensions.l
|
|
|
|
SearchBar {
|
|
}
|
|
|
|
QuickFilter {
|
|
onSelectedChanged: (name) => {
|
|
business_model.viewCriterion(name)
|
|
}
|
|
|
|
model: ListModel {
|
|
ListElement {
|
|
name: "Alle"
|
|
text: qsTr("Alle")
|
|
selected: true
|
|
}
|
|
ListElement {
|
|
name: "Interessent"
|
|
text: qsTr("Interessent")
|
|
selected: false
|
|
}
|
|
ListElement {
|
|
name: "Kunde"
|
|
text: qsTr("Kunde")
|
|
selected: false
|
|
}
|
|
ListElement {
|
|
name: "Lieferant"
|
|
text: qsTr("Lieferant")
|
|
selected: false
|
|
}
|
|
ListElement {
|
|
name: "Erledigt"
|
|
text: qsTr("Erledigt")
|
|
selected: false
|
|
}
|
|
}
|
|
}
|
|
Button {
|
|
id: addCustomer
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
icon.source: "qrc:/images/PlusCircle.svg"
|
|
text: qsTr("Kunde Hinzufügen")
|
|
|
|
onClicked: appLoader.source = "AddCustomer.qml"
|
|
}
|
|
}
|
|
ColumnLayout {
|
|
clip: true
|
|
|
|
HorizontalHeaderView {
|
|
id: horizontalHeader
|
|
|
|
Layout.fillWidth: true
|
|
implicitHeight: 40
|
|
movableColumns: true //@disable-check M16
|
|
syncView: customerTable
|
|
|
|
delegate: Rectangle {
|
|
Layout.fillWidth: true
|
|
border.color: addCustomer.palette.base
|
|
color: addCustomer.palette.alternateBase
|
|
implicitHeight: 40
|
|
implicitWidth: 1
|
|
|
|
Text {
|
|
color: addCustomer.palette.text
|
|
elide: Text.ElideRight
|
|
height: parent.height
|
|
horizontalAlignment: Text.AlignHCenter
|
|
text: model.display
|
|
verticalAlignment: Text.AlignVCenter
|
|
width: parent.width
|
|
}
|
|
}
|
|
}
|
|
TableView {
|
|
id: customerTable
|
|
|
|
property real newWidth: 0
|
|
|
|
Layout.fillHeight: true
|
|
Layout.fillWidth: true
|
|
alternatingRows: true
|
|
columnSpacing: 1
|
|
model: business_model
|
|
resizableColumns: true
|
|
rowSpacing: 2
|
|
selectionBehavior: TableView.SelectRows
|
|
z: 1
|
|
|
|
ScrollBar.vertical: ScrollBar {
|
|
policy: customerTable.contentHeight > customerTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
|
}
|
|
delegate: Rectangle {
|
|
required property bool current
|
|
required property bool selected
|
|
|
|
color: selected ? addCustomer.palette.highlight //palette.highlight
|
|
: (customerTable.alternatingRows && row % 2 !== 0 ? addCustomer.palette.base // palette.base
|
|
: addCustomer.palette.alternateBase) //palette.alternateBase)
|
|
implicitHeight: 25
|
|
implicitWidth: customerTable.width / customerTable.columns
|
|
|
|
Text {
|
|
color: addCustomer.palette.text
|
|
elide: Text.ElideRight
|
|
height: parent.height
|
|
leftPadding: 9
|
|
text: model.display == null ? "" : model.display // @disable-check M126
|
|
verticalAlignment: Text.AlignVCenter
|
|
width: parent.width
|
|
}
|
|
MouseArea {
|
|
id: mouseArea
|
|
|
|
property bool hovered: false
|
|
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
|
|
onDoubleClicked: {
|
|
business_model.onRowClicked(row);
|
|
customersStack.push("CustomerDetails.qml", {
|
|
selectedClient: row
|
|
});
|
|
}
|
|
onEntered: {
|
|
customerTable.selectionModel.select(customerTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows);
|
|
}
|
|
}
|
|
}
|
|
selectionModel: ItemSelectionModel {
|
|
id: selModel
|
|
|
|
model: customerTable.model
|
|
}
|
|
}
|
|
Item {
|
|
Layout.fillWidth: true
|
|
}
|
|
}
|
|
}
|