Save Button AddCustomer fixed

This commit is contained in:
2024-12-12 12:27:26 +01:00
parent 89dc1d3010
commit 3858d7a46a
6 changed files with 58 additions and 44 deletions

View File

@@ -24,7 +24,11 @@ ColumnLayout
text: qsTr("Ansprechpartner hinzufügen")
Layout.alignment: Qt.AlignRight
checked: false
onCheckStateChanged: addContactLayout.visible = checked
onCheckStateChanged:
{
addContactLayout.visible = checked
checkFields()
}
}
RowLayout
@@ -52,7 +56,6 @@ ColumnLayout
{
text: qsTr("Abbrechen")
onClicked: appLoader.source = "CustomerTable.qml"
}
Button
{
@@ -63,18 +66,17 @@ ColumnLayout
{
if (!checkAddContact.checked)
{
new_business = JsLib.addBusiness(businessGrid)
new_business = JsLib.addBusiness(customerView)
business_model.addBusiness(new_business, 0)
appLoader.source = "CustomerTable.qml"
}
else
{
new_business = JsLib.addBusiness(businessGrid)
new_business = JsLib.addBusiness(customerView)
var new_contact = JsLib.addBusiness(addContactLayout)
contact_model.addContact(new_contact)
}
}
}
}
Item
@@ -85,19 +87,19 @@ ColumnLayout
Component.onCompleted: contact_model.contactIdReady.connect(onContactId)
function isEmptyField()
function checkFields()
{
if (!firmenName.text.trim() || !streetid.text.trim())
if(checkAddContact.checked)
{
saveBtn.enabled = false
}
else
{
if (!postcode.editText.trim() || !postcode.currentText || !city.editText.trim() || !city.currentText)
if(!customerView.checkBusinessField() || !addContactLayout.checkContactField())
saveBtn.enabled = false
else
saveBtn.enabled = true
}
else if (!customerView.checkBusinessField())
saveBtn.enabled = false
else
saveBtn.enabled = true
}
function onContactId(con_id)