Save Button AddCustomer fixed
This commit is contained in:
@@ -11,6 +11,8 @@ GridLayout
|
||||
columns: 2
|
||||
rowSpacing: 9
|
||||
visible: false
|
||||
property alias fname: firstname
|
||||
property alias lname: lastname
|
||||
|
||||
Label
|
||||
{
|
||||
@@ -35,6 +37,7 @@ GridLayout
|
||||
property string name: "firstname"
|
||||
id: firstname
|
||||
Layout.fillWidth: true
|
||||
onTextChanged: checkFields()
|
||||
}
|
||||
|
||||
Label
|
||||
@@ -47,6 +50,7 @@ GridLayout
|
||||
property string name: "lastname"
|
||||
id: lastname
|
||||
Layout.fillWidth: true
|
||||
onTextChanged: checkFields()
|
||||
}
|
||||
Label
|
||||
{
|
||||
@@ -146,6 +150,17 @@ GridLayout
|
||||
Layout.fillWidth: true
|
||||
editable: false
|
||||
model: ["Nein", "Ja"]
|
||||
}
|
||||
|
||||
function checkContactField()
|
||||
{
|
||||
if (!firstname.text.trim() || !lastname.text.trim())
|
||||
{
|
||||
return false
|
||||
}
|
||||
else
|
||||
{
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,13 @@
|
||||
{
|
||||
"files": [
|
||||
"Gui/firststart.qml",
|
||||
"lib/ConfigLoader.py",
|
||||
"lib/__init__.py",
|
||||
"main.py",
|
||||
"Gui/main.qml",
|
||||
"Gui/Dashboard.qml",
|
||||
"js/qmldict.js",
|
||||
"lib/Vermasseln.py",
|
||||
"Gui/SearchBar.qml",
|
||||
"lib/DB/BusinessModel.py",
|
||||
"Gui/AddCustomer.qml",
|
||||
"pyqcrm.qrc",
|
||||
"Gui/TopBar.qml",
|
||||
"qml.qrc",
|
||||
"images/account.svg",
|
||||
"images/add.svg",
|
||||
"images/addbusiness.svg",
|
||||
"images/addperson.svg",
|
||||
"images/filter.svg",
|
||||
"images/menu.svg",
|
||||
"images/search.svg",
|
||||
"lib/DB/DbManager.py",
|
||||
"Gui/DbConfiguration.qml",
|
||||
"lib/DB/UserManager.py",
|
||||
"lib/PyqcrmFlags.py",
|
||||
"lib/DB/UserDAO.py",
|
||||
|
||||
@@ -17,5 +17,6 @@
|
||||
<file>fonts/HussarPrintA.otf</file>
|
||||
<file>fonts/LittleBirdsRegular.ttf</file>
|
||||
<file>fonts/ReginaldScript.ttf</file>
|
||||
<file>images/account.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
PySide6
|
||||
platformdirs
|
||||
pycryptodome
|
||||
psutil
|
||||
toml
|
||||
mariadb
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user