Implement Quick Filters

This commit is contained in:
Yuri Becker
2025-03-21 13:25:03 +01:00
parent 83f64f9af8
commit 721232a975
16 changed files with 196 additions and 238 deletions

View File

@@ -16,7 +16,7 @@ GridLayout
Label
{
text: qsTr("Straße")
text: qsTr("Straße*")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
@@ -27,13 +27,11 @@ GridLayout
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
onTextChanged: checkFields()
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
}
Label
{
text: qsTr("Nr.")
text: qsTr("Nr.*")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
@@ -44,8 +42,6 @@ GridLayout
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
onTextChanged: checkFields()
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
}
// New grid row
@@ -197,7 +193,7 @@ GridLayout
Label
{
text: qsTr("Reinigungsmittel wo?")
text: qsTr("Reinigungsmittel wo?*")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
@@ -206,8 +202,6 @@ GridLayout
property string name: "cleaningproducts"
id: cleaningproducts
Layout.fillWidth: true
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
onTextChanged: checkFields()
}
Item

View File

@@ -37,7 +37,7 @@ GridLayout
}
Label
{
text: qsTr("Vorname")
text: qsTr("Vorname*")
Layout.alignment: Qt.AlignRight
}
TextField
@@ -45,14 +45,12 @@ GridLayout
property string name: "firstname"
id: firstname
Layout.fillWidth: true
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
onTextChanged: checkFields()
Layout.columnSpan: 3
}
Label
{
text: qsTr("Nachname")
text: qsTr("Nachname*")
Layout.alignment: Qt.AlignRight
}
TextField
@@ -60,8 +58,6 @@ GridLayout
property string name: "lastname"
id: lastname
Layout.fillWidth: true
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
onTextChanged: checkFields()
Layout.columnSpan: 3
}
@@ -164,7 +160,7 @@ GridLayout
}
Label
{
text: qsTr("Geburtsdatum")
text: qsTr("Geburtsdatum*")
Layout.alignment: Qt.AlignRight
visible: radio.children[1].checked
}
@@ -173,8 +169,6 @@ GridLayout
property string name: "birthday"
id: birthday
Layout.fillWidth: true
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
onTextChanged: checkFields()
Layout.columnSpan: 3
visible: radio.children[1].checked
@@ -195,7 +189,7 @@ GridLayout
Label
{
text: qsTr("Geburtsort")
text: qsTr("Geburtsort*")
Layout.alignment: Qt.AlignRight
visible: radio.children[1].checked
}
@@ -204,8 +198,6 @@ GridLayout
property string name: "placeofbirth"
id: placeofbirth
Layout.fillWidth: true
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
onTextChanged: checkFields()
Layout.columnSpan: 3
visible: radio.children[1].checked

View File

@@ -16,7 +16,7 @@ GridLayout
Label
{
id: lblFirmenName
text: qsTr("Firmenname")
text: qsTr("Firmenname*")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
@@ -28,34 +28,26 @@ GridLayout
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
onTextChanged: checkFields()
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
Layout.columnSpan: 3
}
Label
{
text: qsTr("Straße")
text: qsTr("Straße*")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
TextField
{
property string name: "street"
id: streetid
Layout.fillWidth: true
onTextChanged: checkFields()
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
}
Label
{
text: qsTr("Nr.")
text: qsTr("Nr.*")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
@@ -65,8 +57,6 @@ GridLayout
id: housenoid
Layout.fillWidth: true
onTextChanged: checkFields()
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
validator: RegularExpressionValidator
{
regularExpression: /([0-9a-zA-Z\-]{1,6})/

View File

@@ -3,78 +3,69 @@ import QtQuick.Layouts
import QtQuick.Controls
import Qt.labs.qmlmodels
Item {
ColumnLayout {
function viewCriterion(criterion) {
business_model.viewCriterion(criterion.text);
}
anchors.fill: parent
Component.onCompleted: customersStack.pop()
SearchBar {
id: searchBar
RowLayout {
Layout.fillWidth: true
Layout.horizontalStretchFactor: 1
spacing: Dimensions.l
anchors.margins: 9
}
SearchBar {
}
Button {
id: addCustomer
QuickFilter {
onSelectedChanged: (name) => {
business_model.viewCriterion(name)
}
anchors.right: parent.right
icon.source: "qrc:/images/PlusCircle.svg"
text: qsTr("Kunde hinzufügen")
model: ListModel {
ListElement {
name: "Alle"
text: qsTr("Alle")
selected: true
}
ListElement {
name: "showProvider"
text: qsTr("Interessent")
selected: false
}
ListElement {
name: "showClientele"
text: qsTr("Kunde")
selected: false
}
ListElement {
name: "showProvider"
text: qsTr("Lieferant")
selected: false
}
ListElement {
name: "showFinished"
text: qsTr("Erledigt")
selected: false
}
}
}
Button {
id: addCustomer
onClicked: appLoader.source = "AddCustomer.qml"
Layout.alignment: Qt.AlignRight
icon.source: "qrc:/images/PlusCircle.svg"
text: qsTr("Kunde Hinzufügen")
onClicked: appLoader.source = "AddCustomer.qml"
}
}
ColumnLayout {
id: tableColumn
clip: true
anchors {
bottom: parent.bottom
left: parent.left
right: parent.right
top: searchBar.bottom
}
RowLayout {
id: sortView
RadioButton {
id: showAll
checked: true
text: qsTr("Alle")
onClicked: viewCriterion(showAll)
}
RadioButton {
id: showInterested
text: qsTr("Interessent")
onClicked: viewCriterion(showInterested)
}
RadioButton {
id: showClientele
text: qsTr("Kunden")
onClicked: viewCriterion(showClientele)
}
RadioButton {
id: showProvider
text: qsTr("Lieferant")
onClicked: viewCriterion(showProvider)
}
RadioButton {
id: showFinished
text: qsTr("Erledigt")
onClicked: viewCriterion(showFinished)
}
}
HorizontalHeaderView {
id: horizontalHeader
@@ -107,7 +98,6 @@ Item {
property real newWidth: 0
Layout.fillHeight: true
//height: tableColumn.height - (sortView.height + horizontalHeader.height)
Layout.fillWidth: true
alternatingRows: true
columnSpacing: 1

View File

@@ -35,71 +35,45 @@ GridLayout
}
Label
{
text: qsTr("Vorname")
text: qsTr("Vorname*")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: firstname
Layout.fillWidth: true
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
// onTextChanged: checkContactFields()
}
Label
{
text: qsTr("Nachname")
text: qsTr("Nachname*")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: lastname
Layout.fillWidth: true
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
}
Label
{
text: qsTr("Telefonnummer")
text: mobile.text ? qsTr("Telefonnummer") : qsTr("Telefonnummer*")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: phonenumber
Layout.fillWidth: true
placeholderText: mobile.text ? "" : "Pflichtfeld"
placeholderTextColor: "red"
}
Label
{
text: qsTr("Mobil")
text: phonenumber.text ? qsTr("Mobil") : qsTr("Mobil*")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: mobile
Layout.fillWidth: true
placeholderText: phonenumber.text ? "" : "Pflichtfeld"
placeholderTextColor: "red"
}
// Label
// {
// text: qsTr("Position")
// Layout.alignment: Qt.AlignRight
// }
// TextField
// {
// id: posizion
// Layout.fillWidth: true
// placeholderText: "Pflichtfeld"
// placeholderTextColor: "red"
// }
RowLayout
{

View File

@@ -27,7 +27,7 @@ GridLayout
Label
{
text: qsTr("Straße")
text: qsTr("Straße*")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
@@ -38,12 +38,10 @@ GridLayout
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
onTextChanged: checkFields()
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
}
Label
{
text: qsTr("Nr.")
text: qsTr("Nr.*")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
@@ -54,13 +52,11 @@ GridLayout
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
onTextChanged: checkFields()
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
}
Label
{
text: qsTr("PLZ")
text: qsTr("PLZ*")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
@@ -70,8 +66,6 @@ GridLayout
id: postcode
Layout.fillWidth: true
onTextChanged: checkFields()
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
}
Label
{

View File

@@ -2,79 +2,12 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
TextField {
Layout.preferredWidth: 300
placeholderText: qsTr("Suche")
RowLayout
{
id: searchBar
TextField
{
id: searchField
placeholderText: qsTr("Suche")
leftPadding: 3
rightPadding: 3
Layout.preferredWidth: 300
Button
{
icon.source: "qrc:/images/MagnifyingGlass.svg"
x: parent.x + parent.width - width
height: parent.height
flat: true
}
Button
{
id: filterBtn
icon.source: "qrc:/images/Funnel.svg"
x: parent.x + parent.width
height: searchField.height
flat: true
onClicked: filterPopup.open()
}
}
Popup
{
id: filterPopup
x: filterBtn.x + filterBtn.width
y: filterBtn.y
width: 100
height: 150
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
contentItem: Item
{
ColumnLayout
{
anchors.fill: parent
//id: filterContent
Repeater
{
model: availableFilters
CheckBox
{
text: model.modelData
onClicked:
{
setFilter(text, checkState)
}
}
}
}
}
}
function setFilter(filter,activated)
{
console.log(filter)
console.log(activated)
Button {
icon.source: "qrc:/images/MagnifyingGlass.svg"
isFieldButton: true
}
}

View File

@@ -53,14 +53,11 @@ ApplicationWindow
anchors
{
left: parent.left
right: parent.right
top: topBar.bottom
bottom: parent.bottom
topMargin: 0
bottomMargin: 5
rightMargin: 9
leftMargin: 9
fill: parent
topMargin: Dimensions.l
bottomMargin: Dimensions.l
rightMargin: Dimensions.l
leftMargin: Dimensions.l
}
property alias window: appWindow