Filtered customer view - clientele, provider, interested...etc
This commit is contained in:
@@ -41,29 +41,34 @@ Item {
|
|||||||
{
|
{
|
||||||
RadioButton
|
RadioButton
|
||||||
{
|
{
|
||||||
|
id: showAll
|
||||||
checked: true
|
checked: true
|
||||||
text: qsTr("Alle")
|
text: qsTr("Alle")
|
||||||
|
onClicked: viewCriterion(showAll)
|
||||||
}
|
}
|
||||||
RadioButton
|
RadioButton
|
||||||
{
|
{
|
||||||
|
id: showInterested
|
||||||
text: qsTr("Interessent")
|
text: qsTr("Interessent")
|
||||||
|
onClicked: viewCriterion(showInterested)
|
||||||
}
|
}
|
||||||
RadioButton
|
RadioButton
|
||||||
{
|
{
|
||||||
|
id: showClientele
|
||||||
text: qsTr("Kunden")
|
text: qsTr("Kunden")
|
||||||
|
onClicked: viewCriterion(showClientele)
|
||||||
}
|
}
|
||||||
RadioButton
|
RadioButton
|
||||||
{
|
{
|
||||||
|
id: showProvider
|
||||||
text: qsTr("Lieferant")
|
text: qsTr("Lieferant")
|
||||||
|
onClicked: viewCriterion(showProvider)
|
||||||
}
|
}
|
||||||
RadioButton
|
RadioButton
|
||||||
{
|
{
|
||||||
|
id: showFinished
|
||||||
text: qsTr("Erledigt")
|
text: qsTr("Erledigt")
|
||||||
|
onClicked: viewCriterion(showFinished)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -196,6 +201,11 @@ Item {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function viewCriterion(criterion)
|
||||||
|
{
|
||||||
|
business_model.viewCriterion(criterion.text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ class BusinessDAO:
|
|||||||
self.__con = DbManager().getConnection()
|
self.__con = DbManager().getConnection()
|
||||||
self.__cur = self.__con.cursor()
|
self.__cur = self.__con.cursor()
|
||||||
|
|
||||||
def getBusiness(self):
|
def getBusiness(self, criterion = "Alle"):
|
||||||
self.__cur.callproc("getCustomerView")
|
self.__cur.callproc("getCustomerView", (criterion,))
|
||||||
self.__all_cols = [desc[0] for desc in self.__cur.description]
|
self.__all_cols = [desc[0] for desc in self.__cur.description]
|
||||||
return self.__cur.fetchall(), self.__all_cols
|
return self.__cur.fetchall(), self.__all_cols
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# This Python file uses the following encoding: utf-8
|
# This Python file uses the following encoding: utf-8
|
||||||
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot, Signal
|
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot, Signal
|
||||||
from .BusinessDAO import BusinessDAO
|
from .BusinessDAO import BusinessDAO
|
||||||
|
from ..PyqcrmFlags import PyqcrmFlags
|
||||||
|
|
||||||
# USERS TABLE
|
# USERS TABLE
|
||||||
# CUSTOMER_COLUMN_NAMES = \
|
# CUSTOMER_COLUMN_NAMES = \
|
||||||
@@ -67,8 +68,8 @@ class BusinessModel(QAbstractTableModel):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.__data = self.__getData()
|
self.__data = self.__getData()
|
||||||
|
|
||||||
def __getData(self):
|
def __getData(self, criterion = "Alle"):
|
||||||
rows, self.__visible_columns = BusinessDAO().getBusiness()
|
rows, self.__visible_columns = BusinessDAO().getBusiness(criterion)
|
||||||
return rows
|
return rows
|
||||||
|
|
||||||
def rowCount(self, parent= QModelIndex()):
|
def rowCount(self, parent= QModelIndex()):
|
||||||
@@ -106,6 +107,12 @@ class BusinessModel(QAbstractTableModel):
|
|||||||
def onRowClicked(self, row):
|
def onRowClicked(self, row):
|
||||||
print(row)
|
print(row)
|
||||||
|
|
||||||
|
@Slot(str)
|
||||||
|
def viewCriterion(self, criterion):
|
||||||
|
self.beginResetModel()
|
||||||
|
self.__data = self.__getData(criterion)
|
||||||
|
self.endResetModel()
|
||||||
|
|
||||||
@Slot(dict, int)
|
@Slot(dict, int)
|
||||||
def addBusiness(self, business, contact_id):
|
def addBusiness(self, business, contact_id):
|
||||||
BusinessDAO().addBusiness(business, contact_id)
|
BusinessDAO().addBusiness(business, contact_id)
|
||||||
|
|||||||
@@ -4,5 +4,6 @@ from PySide6.QtCore import Qt
|
|||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
|
|
||||||
class PyqcrmDataRoles(IntEnum):
|
class PyqcrmDataRoles(IntEnum):
|
||||||
CITY_ROLE = Qt.UserRole + 1
|
CITY_ROLE = Qt.UserRole + 100
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,5 @@ from enum import IntFlag
|
|||||||
class PyqcrmFlags(IntFlag):
|
class PyqcrmFlags(IntFlag):
|
||||||
ADMIN = 1
|
ADMIN = 1
|
||||||
USER = 2
|
USER = 2
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
main.py
1
main.py
@@ -58,6 +58,7 @@ def publishContext():
|
|||||||
engine.rootContext().setContextProperty("business_type", business_type)
|
engine.rootContext().setContextProperty("business_type", business_type)
|
||||||
engine.rootContext().setContextProperty("contact_model", contact_model)
|
engine.rootContext().setContextProperty("contact_model", contact_model)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
#QResource.registerResource("rc_qml.py")
|
#QResource.registerResource("rc_qml.py")
|
||||||
app = QGuiApplication(sys.argv)
|
app = QGuiApplication(sys.argv)
|
||||||
|
|||||||
Reference in New Issue
Block a user