Adding customer done..still the GUI needs retouches

This commit is contained in:
2024-12-11 18:50:18 +01:00
parent e2fe0c89c0
commit 9ea0c94674
5 changed files with 10 additions and 13 deletions

View File

@@ -253,7 +253,7 @@ ColumnLayout
if (!checkAddContact.checked) if (!checkAddContact.checked)
{ {
new_business = JsLib.addBusiness(businessGrid) new_business = JsLib.addBusiness(businessGrid)
business_model.addBusiness(new_business) business_model.addBusiness(new_business, 0)
appLoader.source = "CustomerTable.qml" appLoader.source = "CustomerTable.qml"
} }
else else

View File

@@ -74,7 +74,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
implicitHeight: 40 implicitHeight: 40
movableColumns: true //@disable-check M16 movableColumns: true //@disable-check M16
syncView: testTable syncView: customerTable
delegate: Rectangle { delegate: Rectangle {
color: addBusinessBtn.palette.alternateBase color: addBusinessBtn.palette.alternateBase
@@ -99,7 +99,7 @@ Item {
{ {
//property var customWidths: [0.2, 0.5, 0.3, 05, 0.2, 0.2] //property var customWidths: [0.2, 0.5, 0.3, 05, 0.2, 0.2]
property real newWidth: 0 property real newWidth: 0
id: testTable id: customerTable
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
columnSpacing: 1 columnSpacing: 1
@@ -111,7 +111,7 @@ Item {
selectionModel: ItemSelectionModel selectionModel: ItemSelectionModel
{ {
id: selModel id: selModel
model: testTable.model model: customerTable.model
} }
// columnWidthProvider: function(column) // columnWidthProvider: function(column)
@@ -137,7 +137,7 @@ Item {
repeat: false repeat: false
onTriggered: onTriggered:
{ {
testTable.forceLayout(); customerTable.forceLayout();
} }
} }
@@ -147,11 +147,11 @@ Item {
{ {
required property bool selected required property bool selected
required property bool current required property bool current
implicitWidth: testTable.width / testTable.columns implicitWidth: customerTable.width / customerTable.columns
implicitHeight: 25 implicitHeight: 25
color: selected color: selected
? addBusinessBtn.palette.highlight //palette.highlight ? addBusinessBtn.palette.highlight //palette.highlight
: (testTable.alternatingRows && row % 2 !== 0 : (customerTable.alternatingRows && row % 2 !== 0
? addBusinessBtn.palette.base // palette.base ? addBusinessBtn.palette.base // palette.base
: addBusinessBtn.palette.alternateBase) //palette.alternateBase) : addBusinessBtn.palette.alternateBase) //palette.alternateBase)
@@ -178,7 +178,7 @@ Item {
} }
onEntered: onEntered:
{ {
testTable.selectionModel.select(testTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows) customerTable.selectionModel.select(customerTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows)
} }
} }
} }

View File

@@ -15,7 +15,6 @@ class BusinessDAO:
def addBusiness(self, data, contact_id): def addBusiness(self, data, contact_id):
try: try:
print(data)
self.__cur.callproc("addBusiness", (json.dumps(data), contact_id)) self.__cur.callproc("addBusiness", (json.dumps(data), contact_id))
self.__con.commit() self.__con.commit()

View File

@@ -1,5 +1,5 @@
# 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 from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot, Signal
from .BusinessDAO import BusinessDAO from .BusinessDAO import BusinessDAO
# USERS TABLE # USERS TABLE
@@ -109,8 +109,7 @@ class BusinessModel(QAbstractTableModel):
@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)
#BusinessDAO().addPlz() self.__data = self.__getData()
@Slot(dict) @Slot(dict)
def setContact(self, contact): def setContact(self, contact):

View File

@@ -18,7 +18,6 @@ class ContactDAO:
self.__con.commit() self.__con.commit()
self.__cur.callproc("getLastInsertId") self.__cur.callproc("getLastInsertId")
contact_id = self.__cur.fetchone() contact_id = self.__cur.fetchone()
print(contact_id)
return contact_id[0] return contact_id[0]
except mariadb.Error as e: except mariadb.Error as e:
print("MDB: " + str(e)) print("MDB: " + str(e))