Filtered customer view - clientele, provider, interested...etc
This commit is contained in:
@@ -8,8 +8,8 @@ class BusinessDAO:
|
||||
self.__con = DbManager().getConnection()
|
||||
self.__cur = self.__con.cursor()
|
||||
|
||||
def getBusiness(self):
|
||||
self.__cur.callproc("getCustomerView")
|
||||
def getBusiness(self, criterion = "Alle"):
|
||||
self.__cur.callproc("getCustomerView", (criterion,))
|
||||
self.__all_cols = [desc[0] for desc in self.__cur.description]
|
||||
return self.__cur.fetchall(), self.__all_cols
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# This Python file uses the following encoding: utf-8
|
||||
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot, Signal
|
||||
from .BusinessDAO import BusinessDAO
|
||||
from ..PyqcrmFlags import PyqcrmFlags
|
||||
|
||||
# USERS TABLE
|
||||
# CUSTOMER_COLUMN_NAMES = \
|
||||
@@ -67,8 +68,8 @@ class BusinessModel(QAbstractTableModel):
|
||||
super().__init__()
|
||||
self.__data = self.__getData()
|
||||
|
||||
def __getData(self):
|
||||
rows, self.__visible_columns = BusinessDAO().getBusiness()
|
||||
def __getData(self, criterion = "Alle"):
|
||||
rows, self.__visible_columns = BusinessDAO().getBusiness(criterion)
|
||||
return rows
|
||||
|
||||
def rowCount(self, parent= QModelIndex()):
|
||||
@@ -106,6 +107,12 @@ class BusinessModel(QAbstractTableModel):
|
||||
def onRowClicked(self, row):
|
||||
print(row)
|
||||
|
||||
@Slot(str)
|
||||
def viewCriterion(self, criterion):
|
||||
self.beginResetModel()
|
||||
self.__data = self.__getData(criterion)
|
||||
self.endResetModel()
|
||||
|
||||
@Slot(dict, int)
|
||||
def addBusiness(self, business, contact_id):
|
||||
BusinessDAO().addBusiness(business, contact_id)
|
||||
|
||||
Reference in New Issue
Block a user