Fix adding a contact person to an object and db autocommit

This commit is contained in:
2025-03-12 15:43:13 +01:00
parent 898d808b1f
commit 773d398f8c
9 changed files with 64 additions and 48 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -334,13 +334,6 @@ GridLayout
color: "white"
}
Text
{
text: '<b>' + qsTr('Typ: ') + '</b>' + model.cdata
horizontalAlignment: Text.AlignLeft
color: "white"
}
} // Column
} // delegate
} // Listview

View File

@@ -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