Add Customer/Object/Employee working - DEBUGGING anchor Errors done
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user