Add Customer/Object/Employee working - DEBUGGING anchor Errors done

This commit is contained in:
2025-05-23 11:23:16 +02:00
parent 75427b1326
commit 096f60a2ec
35 changed files with 30124 additions and 1209 deletions

View File

@@ -4,117 +4,121 @@ import QtQuick.Controls
import QtQuick.Dialogs
import Js
import Gui
ScrollView
{
id: scroll
width: parent.width
height: parent.height
ColumnLayout
{
property var new_business: null
height: Screen.desktopAvailableHeight
width: scroll.width
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 15
Label
ColumnLayout
{
text: qsTr("Kunden anlegen")
horizontalAlignment: Text.AlignHCenter
height: Screen.desktopAvailableHeight
width: scroll.width
Layout.fillWidth: true
font.pixelSize: 35
}
CheckBox
{
id: checkAddContact
text: qsTr("Ansprechpartner hinzufügen")
Layout.alignment: Qt.AlignRight
checked: false
onCheckStateChanged:
{
checkFields()
}
}
Layout.fillHeight: true
spacing: 15
RowLayout
{
id: addCustomer
// Layout.fillWidth: true
// Layout.fillHeight: true
spacing: 45
Frame
Label
{
Layout.alignment: Qt.AlignTop
text: qsTr("Kunden anlegen")
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
CustomerView
font.pixelSize: 35
}
CheckBox
{
id: checkAddContact
text: qsTr("Ansprechpartner hinzufügen")
Layout.alignment: Qt.AlignRight
checked: false
onCheckStateChanged:
{
id: customerView
width: parent.width
checkFields()
}
}
AddContact
RowLayout
{
id: addContactFrame
visible: checkAddContact.checked
}
}
id: addCustomer
// Layout.fillWidth: true
// Layout.fillHeight: true
RowLayout
{
Layout.fillHeight: true
Layout.alignment: Qt.AlignRight
Button
{
text: qsTr("Abbrechen")
onClicked: contentStack.pop()
}
Button
{
id: saveBtn
text: qsTr("Speichern")
enabled: true
onClicked:
spacing: 45
Frame
{
if (!checkAddContact.checked)
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
CustomerView
{
new_business = JsLib.parseForm(customerView)
business_model.addBusiness(new_business, 0)
contentStack.pop()
id: customerView
width: parent.width
}
else
}
AddContact
{
id: addContactFrame
visible: checkAddContact.checked
}
}
RowLayout
{
Layout.fillHeight: true
Layout.alignment: Qt.AlignRight
Button
{
text: qsTr("Abbrechen")
onClicked: contentStack.pop()
}
Button
{
id: saveBtn
text: qsTr("Speichern")
enabled: false
onClicked:
{
new_business = JsLib.parseForm(customerView)
var new_contact = JsLib.parseForm(addContactFrame.contactGrid)
contact_model.addContact(new_contact)
if (!checkAddContact.checked)
{
new_business = JsLib.parseForm(customerView)
console.log(JSON.stringify(new_business))
business_model.addBusiness(new_business, 0)
contentStack.pop()
}
else
{
new_business = JsLib.parseForm(customerView)
var new_contact = JsLib.parseForm(addContactFrame.contactGrid)
contact_model.addContact(new_contact)
}
}
}
}
}
Item
{
id: spacer3
Layout.fillHeight: true
}
//Component.onCompleted: contact_model.contactIdReady.connect(onContactId)
Connections
{
target: contact_model
function onContactIdReady()
Item
{
var con_id = arguments[0]
business_model.addBusiness(new_business, con_id)
contentStack.pop()
id: spacer3
Layout.fillHeight: true
}
}
//Component.onCompleted: contact_model.contactIdReady.connect(onContactId)
Connections
{
target: contact_model
function onContactIdReady()
{
var con_id = arguments[0]
business_model.addBusiness(new_business, con_id)
contentStack.pop()
}
}
}
function checkFields()
{
if(checkAddContact.checked)
@@ -130,4 +134,3 @@ ColumnLayout
saveBtn.enabled = true
}
}
}

View File

@@ -276,7 +276,7 @@ GridLayout
}
function checkBusinessField()
{
if (!firmenName.text.trim() || !streetid.text.trim())
if (!firmenName.text.trim() || !streetid.text.trim() || !housenoid.text.trim())
{
return false

View File

@@ -13,10 +13,10 @@ ColumnLayout {
anchors.fill: parent
spacing: Dimensions.l
Component.onCompleted: contentStack.pop()
// Component.onCompleted: contentStack.pop()
RowLayout
{

View File

@@ -0,0 +1,33 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
GridLayout
{
columns: 2
rowSpacing: 25
// Grid row
ColumnLayout
{
Label
{
color: "darksalmon"
font.bold: true
text: qsTr("Kein Ansprechpartner gefunden")
}
Label
{
color: "goldenrod"
text: qsTr("Was willst du tun?")
}
}
// Grid row
Item
{
Layout.columnSpan: 2
Layout.fillHeight: true
}
}