Merge branch 'main' into schnacke
Doku
This commit is contained in:
@@ -8,7 +8,7 @@ import "../js/qmldict.js" as JsLib
|
|||||||
ColumnLayout
|
ColumnLayout
|
||||||
{
|
{
|
||||||
property var new_object: null
|
property var new_object: null
|
||||||
property alias checkAddContact: checkAddContact
|
//property alias checkAddContact: checkAddContact
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
spacing: 15
|
spacing: 15
|
||||||
@@ -21,7 +21,7 @@ ColumnLayout
|
|||||||
}
|
}
|
||||||
CheckBox
|
CheckBox
|
||||||
{
|
{
|
||||||
id: checkAddContact
|
id: checkAddObjectContact
|
||||||
text: qsTr("Ansprechpartner hinzufügen")
|
text: qsTr("Ansprechpartner hinzufügen")
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
checked: false
|
checked: false
|
||||||
@@ -52,7 +52,7 @@ ColumnLayout
|
|||||||
ObjectAddOns
|
ObjectAddOns
|
||||||
{
|
{
|
||||||
id: addObjectLayout
|
id: addObjectLayout
|
||||||
visible: checkAddContact.checked
|
visible: checkAddObjectContact.checked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RowLayout
|
RowLayout
|
||||||
@@ -87,48 +87,56 @@ ColumnLayout
|
|||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
object_model.objectAdded.connect(onObjectAdded)
|
//object_model.objectAdded.connect(onObjectAdded)
|
||||||
contact_model.objectContactAdded.connect(onObjectContact)
|
//contact_model.objectContactAdded.connect(onObjectContact)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connections
|
|
||||||
// {
|
|
||||||
// target: spacer3
|
|
||||||
|
|
||||||
// function onObjectIdReady()
|
Connections
|
||||||
// {
|
|
||||||
// var obj_id = arguments[0]
|
|
||||||
// object_model.addObject(new_object, obj_id)
|
|
||||||
// appLoader.source = "ObjectTable.qml"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
function onObjectAdded(added, oid)
|
|
||||||
{
|
{
|
||||||
if (!added)
|
target: object_model
|
||||||
console.log(qsTr("Fehler beim Objekt-Anlegen!"))
|
|
||||||
if (checkAddContact.checked && oid)
|
|
||||||
{
|
|
||||||
var new_objecto = addObjectLayout.getForm()
|
|
||||||
contact_model.addObjectContact(new_objecto, oid)
|
|
||||||
}
|
|
||||||
else appLoader.source = "ObjectTable.qml"
|
|
||||||
}
|
|
||||||
|
|
||||||
function onObjectContact(added)
|
function onObjectIdReady()
|
||||||
{
|
|
||||||
if (!added)
|
|
||||||
console.log(qsTr("Fehler beim Objekt-Kontakt-Anlegen!"))
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
//object_model.viewCriterion("Alle")
|
var obj_id = arguments[0]
|
||||||
|
if (checkAddObjectContact.checked && obj_id)
|
||||||
|
{
|
||||||
|
var new_objecto = addObjectLayout.getForm()
|
||||||
|
contact_model.addObjectContact(new_objecto, obj_id)
|
||||||
|
object_model.viewCriterion("Alle")
|
||||||
|
}
|
||||||
|
|
||||||
appLoader.source = "ObjectTable.qml"
|
appLoader.source = "ObjectTable.qml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function onObjectAdded(added, oid)
|
||||||
|
// {
|
||||||
|
// if (!added)
|
||||||
|
// console.log(qsTr("Fehler beim Objekt-Anlegen!"))
|
||||||
|
// if (checkAddObjectContact.checked && oid)
|
||||||
|
// {
|
||||||
|
// var new_objecto = addObjectLayout.getForm()
|
||||||
|
|
||||||
|
// contact_model.addObjectContact(new_objecto, oid)
|
||||||
|
// }
|
||||||
|
// else appLoader.source = "ObjectTable.qml"
|
||||||
|
// }
|
||||||
|
|
||||||
|
// function onObjectContact(added)
|
||||||
|
// {
|
||||||
|
// if (!added)
|
||||||
|
// console.log(qsTr("Fehler beim Objekt-Kontakt-Anlegen!"))
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// //object_model.viewCriterion("Alle")
|
||||||
|
// appLoader.source = "ObjectTable.qml"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
function checkFields()
|
function checkFields()
|
||||||
{
|
{
|
||||||
if(checkAddContact.checked)
|
if(checkAddObjectContact.checked)
|
||||||
{
|
{
|
||||||
if(!newObject.checkObjectField() || !addObjectLayout.contactPerson.contacts || !addObjectLayout.contactPerson.contacts.length)
|
if(!newObject.checkObjectField() || !addObjectLayout.contactPerson.contacts || !addObjectLayout.contactPerson.contacts.length)
|
||||||
saveBtn.enabled = false
|
saveBtn.enabled = false
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Item
|
|||||||
ColumnLayout
|
ColumnLayout
|
||||||
{
|
{
|
||||||
id: tableColumn
|
id: tableColumn
|
||||||
|
clip: true
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
top: searchBar.bottom
|
top: searchBar.bottom
|
||||||
@@ -35,6 +36,7 @@ Item
|
|||||||
|
|
||||||
RowLayout
|
RowLayout
|
||||||
{
|
{
|
||||||
|
id: sortView
|
||||||
RadioButton
|
RadioButton
|
||||||
{
|
{
|
||||||
id: showAll
|
id: showAll
|
||||||
@@ -99,7 +101,9 @@ Item
|
|||||||
{
|
{
|
||||||
property real newWidth: 0
|
property real newWidth: 0
|
||||||
id: customerTable
|
id: customerTable
|
||||||
|
z: 1
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
//height: tableColumn.height - (sortView.height + horizontalHeader.height)
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
columnSpacing: 1
|
columnSpacing: 1
|
||||||
rowSpacing: 2
|
rowSpacing: 2
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ Item
|
|||||||
|
|
||||||
ColumnLayout
|
ColumnLayout
|
||||||
{
|
{
|
||||||
|
id: tableParent
|
||||||
|
clip: true
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ Item
|
|||||||
|
|
||||||
RowLayout
|
RowLayout
|
||||||
{
|
{
|
||||||
//id: criterion
|
id: viewCriterion
|
||||||
|
|
||||||
RadioButton
|
RadioButton
|
||||||
{
|
{
|
||||||
@@ -140,7 +142,8 @@ Item
|
|||||||
TableView
|
TableView
|
||||||
{
|
{
|
||||||
id: appliEmpTable
|
id: appliEmpTable
|
||||||
Layout.fillHeight: true
|
//Layout.fillHeight: true
|
||||||
|
height: tableParent.height - (viewCriterion.height + employeeTableHeader.height)
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
columnSpacing: 1
|
columnSpacing: 1
|
||||||
rowSpacing: 2
|
rowSpacing: 2
|
||||||
|
|||||||
@@ -334,13 +334,6 @@ GridLayout
|
|||||||
color: "white"
|
color: "white"
|
||||||
}
|
}
|
||||||
|
|
||||||
Text
|
|
||||||
{
|
|
||||||
text: '<b>' + qsTr('Typ: ') + '</b>' + model.cdata
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
color: "white"
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Column
|
} // Column
|
||||||
} // delegate
|
} // delegate
|
||||||
} // Listview
|
} // Listview
|
||||||
|
|||||||
@@ -26,14 +26,15 @@ Item
|
|||||||
ColumnLayout
|
ColumnLayout
|
||||||
{
|
{
|
||||||
id: tableColumn
|
id: tableColumn
|
||||||
|
clip: true
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
top: searchBar.bottom
|
top: searchBar.bottom
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
topMargin: 15
|
||||||
}
|
}
|
||||||
|
|
||||||
HorizontalHeaderView
|
HorizontalHeaderView
|
||||||
{
|
{
|
||||||
id: horizontalHeaderview
|
id: horizontalHeaderview
|
||||||
@@ -66,7 +67,8 @@ Item
|
|||||||
{
|
{
|
||||||
property real newWidth: 0
|
property real newWidth: 0
|
||||||
id: objectTable
|
id: objectTable
|
||||||
Layout.fillHeight: true
|
z: 0
|
||||||
|
height: tableColumn.height - horizontalHeaderview.height
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
columnSpacing: 1
|
columnSpacing: 1
|
||||||
rowSpacing: 2
|
rowSpacing: 2
|
||||||
|
|||||||
@@ -22,8 +22,13 @@ class ContactDAO(QObject):
|
|||||||
if self.__cur:
|
if self.__cur:
|
||||||
self.__cur.callproc("addContactPerson", (enc_key, json.dumps(contact),))
|
self.__cur.callproc("addContactPerson", (enc_key, json.dumps(contact),))
|
||||||
self.__con.commit()
|
self.__con.commit()
|
||||||
|
self.__cur.callproc("getLastInsertId")
|
||||||
|
contact_id = self.__cur.fetchone()
|
||||||
self.__cur.callproc("logger",(contact_id[0], "INSERT", "addContactPerson: New Contact added",))
|
self.__cur.callproc("logger",(contact_id[0], "INSERT", "addContactPerson: New Contact added",))
|
||||||
self.__con.commit()
|
self.__con.commit()
|
||||||
|
return contact_id[0]
|
||||||
|
else:
|
||||||
|
return None
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
print("MDB: " + str(e))
|
print("MDB: " + str(e))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -36,7 +41,7 @@ class ContactDAO(QObject):
|
|||||||
self.__con.commit()
|
self.__con.commit()
|
||||||
self.__cur.callproc("logObjectContact")
|
self.__cur.callproc("logObjectContact")
|
||||||
self.__con.commit()
|
self.__con.commit()
|
||||||
self.newObjectContactAdded.emit(True)
|
# self.newObjectContactAdded.emit(True)
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
print("MDB (addObjectContact): " + str(e))
|
print("MDB (addObjectContact): " + str(e))
|
||||||
self.newObjectContactAdded.emit(False)
|
self.newObjectContactAdded.emit(False)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class DbManager():
|
|||||||
def __initializeConfig(cls, dbconf):
|
def __initializeConfig(cls, dbconf):
|
||||||
cls.__con_param = { 'user': dbconf['DB_USER'], 'password': dbconf['DB_PASS'],
|
cls.__con_param = { 'user': dbconf['DB_USER'], 'password': dbconf['DB_PASS'],
|
||||||
'port': int (dbconf['DB_PORT']), 'host': dbconf['DB_HOST'],
|
'port': int (dbconf['DB_PORT']), 'host': dbconf['DB_HOST'],
|
||||||
'database': dbconf['DB_NAME'], 'connect_timeout': 5
|
'database': dbconf['DB_NAME'], 'connect_timeout': 5, 'autocommit': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,6 @@ class EmployeeModel(QAbstractTableModel):
|
|||||||
new_employee['residencetype'] = int(new_employee['residencetype'])
|
new_employee['residencetype'] = int(new_employee['residencetype'])
|
||||||
self.__employee_dao.addEmployee(new_employee, self.__key, applicant)
|
self.__employee_dao.addEmployee(new_employee, self.__key, applicant)
|
||||||
|
|
||||||
@Slot(str)
|
|
||||||
def viewCriterion(self, criterion, processed = False, fired = False):
|
|
||||||
self.__getData(criterion, processed, fired)
|
|
||||||
|
|
||||||
@Slot(bool)
|
@Slot(bool)
|
||||||
def __refreshView(self, added):
|
def __refreshView(self, added):
|
||||||
if added:
|
if added:
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class ObjectDAO(QObject):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
self.newObjectAdded.emit(False)
|
self.newObjectAdded.emit(False, None)
|
||||||
print(str(e))
|
print(str(e))
|
||||||
|
|
||||||
def getObjects(self, criterion, enc_key = None):
|
def getObjects(self, criterion, enc_key = None):
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import json
|
|||||||
|
|
||||||
class ObjectModel(QAbstractTableModel):
|
class ObjectModel(QAbstractTableModel):
|
||||||
objectAdded = Signal(bool, int)
|
objectAdded = Signal(bool, int)
|
||||||
|
objectIdReady = Signal(int)
|
||||||
|
|
||||||
__data = None
|
__data = None
|
||||||
__object_dao = None
|
__object_dao = None
|
||||||
@@ -32,6 +33,7 @@ class ObjectModel(QAbstractTableModel):
|
|||||||
#print(new_object)
|
#print(new_object)
|
||||||
|
|
||||||
o = self.__object_dao.addObject(new_object)
|
o = self.__object_dao.addObject(new_object)
|
||||||
|
self.objectIdReady.emit(o)
|
||||||
|
|
||||||
# @Slot(str)
|
# @Slot(str)
|
||||||
# def viewCriterion(self, criterion, processed = False, fired = False):
|
# def viewCriterion(self, criterion, processed = False, fired = False):
|
||||||
@@ -55,7 +57,6 @@ class ObjectModel(QAbstractTableModel):
|
|||||||
|
|
||||||
@Slot(str)
|
@Slot(str)
|
||||||
def viewCriterion(self, criterion):
|
def viewCriterion(self, criterion):
|
||||||
print(f"Criterion: {criterion}")
|
|
||||||
self.__getData(criterion)
|
self.__getData(criterion)
|
||||||
|
|
||||||
def data(self, index, role= Qt.DisplayRole):
|
def data(self, index, role= Qt.DisplayRole):
|
||||||
|
|||||||
Reference in New Issue
Block a user