Fixing qml connection to save business with a new contact - some

database modifications
This commit is contained in:
2024-12-14 15:32:10 +01:00
parent 59e5fadd26
commit 559ad1b882
7 changed files with 54 additions and 22 deletions

View File

@@ -125,7 +125,14 @@ GridLayout
placeholderText: qsTr("TT.MM.JJJJ")
validator: RegularExpressionValidator
{
regularExpression: /((^|)([0-2]{1}[0-9]{1}|3[0-1]))\.((^|)([0-1]{1,2}|12))\.([0-9]{4})/
regularExpression: /((^|)([0-2]{1}[0-9]{1}|3[0-1]))\.((^|)(0[1-9]{1}|1[0-2]{1}))\.((^|)(196[0-9]{1}|19[7-9]{1}[0-9]{1}|20[0-9]{2}))/
}
onTextChanged:
{
var len = birthday.length
var bd = birthday.text
if (len == 2 || len == 5) birthday.text = bd + "."
}
}

View File

@@ -85,7 +85,18 @@ ColumnLayout
Layout.fillHeight: true
}
Component.onCompleted: contact_model.contactIdReady.connect(onContactId)
//Component.onCompleted: contact_model.contactIdReady.connect(onContactId)
Connections
{
target: contact_model
onContactIdReady:
{
var con_id = arguments[0]
business_model.addBusiness(new_business, con_id)
appLoader.source = "CustomerTable.qml"
}
}
function checkFields()
{
@@ -101,10 +112,4 @@ ColumnLayout
else
saveBtn.enabled = true
}
function onContactId(con_id)
{
business_model.addBusiness(new_business, con_id)// bm
appLoader.source = "CustomerTable.qml"
}
}

View File

@@ -107,6 +107,10 @@ Item {
id: customerTable
Layout.fillHeight: true
Layout.fillWidth: true
ScrollBar.vertical: ScrollBar
{
policy: customerTable.contentHeight > customerTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
}
columnSpacing: 1
rowSpacing: 2
model: business_model
@@ -162,7 +166,7 @@ Item {
Text
{
text: model.display
text: model.display == null? "": model.display
elide: Text.ElideRight
width: parent.width
height: parent.height
@@ -197,7 +201,7 @@ Item {
Item
{
Layout.fillHeight: true
//Layout.fillHeight: true
Layout.fillWidth: true
}
}