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