Save Button AddCustomer fixed
This commit is contained in:
@@ -4,12 +4,15 @@ import QtQuick.Layouts
|
||||
|
||||
GridLayout
|
||||
{
|
||||
id: businessGrid
|
||||
id: customerView
|
||||
columns: 2
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
rowSpacing: 9
|
||||
|
||||
property alias businesstxt: firmenName
|
||||
property alias street: streetid
|
||||
property alias postcodetxt: postcode
|
||||
property alias citytxt: city
|
||||
Label
|
||||
{
|
||||
id: lblFirmenName
|
||||
@@ -20,10 +23,11 @@ GridLayout
|
||||
TextField
|
||||
{
|
||||
property string name: "business"
|
||||
|
||||
id: firmenName
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
onTextChanged: isEmptyField()
|
||||
onTextChanged: checkFields()
|
||||
placeholderText: "Pflichtfeld"
|
||||
placeholderTextColor: "red"
|
||||
|
||||
@@ -41,7 +45,7 @@ GridLayout
|
||||
property string name: "street"
|
||||
id: streetid
|
||||
Layout.fillWidth: true
|
||||
onTextChanged: isEmptyField()
|
||||
onTextChanged: checkFields()
|
||||
placeholderText: "Pflichtfeld"
|
||||
placeholderTextColor: "red"
|
||||
}
|
||||
@@ -57,8 +61,8 @@ GridLayout
|
||||
id: postcode
|
||||
Layout.fillWidth: true
|
||||
editable: true
|
||||
onCurrentTextChanged: isEmptyField()
|
||||
onEditTextChanged: isEmptyField()
|
||||
onCurrentTextChanged: checkFields()
|
||||
onEditTextChanged: checkFields()
|
||||
onActivated: currentValue
|
||||
model: address_model
|
||||
textRole: "display"
|
||||
@@ -79,8 +83,8 @@ GridLayout
|
||||
id: city
|
||||
Layout.fillWidth: true
|
||||
editable: true
|
||||
onEditTextChanged: isEmptyField()
|
||||
onCurrentTextChanged: isEmptyField()
|
||||
onEditTextChanged: checkFields()
|
||||
onCurrentTextChanged: checkFields()
|
||||
model: address_model
|
||||
textRole: "city"
|
||||
popup.height: 300
|
||||
@@ -203,4 +207,20 @@ GridLayout
|
||||
}
|
||||
}
|
||||
}
|
||||
function checkBusinessField()
|
||||
{
|
||||
if (!firmenName.text.trim() || !streetid.text.trim())
|
||||
{
|
||||
return false
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!postcode.editText.trim() || !postcode.currentText || !city.editText.trim() || !city.currentText)
|
||||
return false
|
||||
else
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user