Save Button AddCustomer fixed
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user