Compare commits

..

2 Commits

Author SHA256 Message Date
1cb250e3d1 Merge branch 'schnacke'
Scrollview in all Forms, Debugged Error in AddEmployee.qml
2025-05-23 14:17:58 +02:00
bcc8e3a015 Added Scrollview in all forms, debugged error in AddEmployee.qml 2025-05-23 14:17:35 +02:00
3 changed files with 241 additions and 223 deletions

View File

@@ -1,49 +1,51 @@
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Controls
import TeroStyle import TeroStyle
import Js import Js
ColumnLayout { ScrollView
{
ColumnLayout {
anchors.fill: parent
spacing: Dimensions.l
Component.onCompleted: {
employee_model.addedNewEmployee.connect(successful => {
if (successful)
contentStack.pop();
});
}
ApplicantForm
{
id: applicantForm
Layout.alignment: Qt.AlignTop
Layout.fillHeight: true
Layout.verticalStretchFactor: 1
}
RowLayout
{
Layout.alignment: Qt.AlignRight
spacing: Dimensions.l spacing: Dimensions.l
Component.onCompleted: {
Button employee_model.addedNewEmployee.connect(successful => {
{ if (successful)
icon.source: "qrc:/images/ArrowLeftCircle-Outline.svg" contentStack.pop();
text: qsTr("Verwerfen") });
onClicked: contentStack.pop()
} }
Button
{
enabled: applicantForm.valid
icon.source: "qrc:/images/CheckCircle.svg"
text: qsTr("Speichern")
onClicked: ApplicantForm
{
id: applicantForm
Layout.alignment: Qt.AlignTop
Layout.fillHeight: true
Layout.verticalStretchFactor: 1
}
RowLayout
{
Layout.alignment: Qt.AlignRight
spacing: Dimensions.l
Button
{ {
employee_model.addApplicant(applicantForm.value); icon.source: "qrc:/images/ArrowLeftCircle-Outline.svg"
text: qsTr("Verwerfen")
onClicked: contentStack.pop()
}
Button
{
enabled: applicantForm.valid
icon.source: "qrc:/images/CheckCircle.svg"
text: qsTr("Speichern")
onClicked:
{
employee_model.addApplicant(applicantForm.value);
}
} }
} }
} }

View File

@@ -2,9 +2,9 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Js import Js
ColumnLayout {
id: colPar
ScrollView
{
function checkFields() { function checkFields() {
if (!personalData.checkPersonalField()) if (!personalData.checkPersonalField())
saveBtn.enabled = false; saveBtn.enabled = false;
@@ -19,82 +19,90 @@ ColumnLayout {
console.log('failedtoadd'); console.log('failedtoadd');
} }
} }
ColumnLayout {
id: colPar
Layout.fillHeight: true
Layout.fillWidth: true
anchors.fill: parent
implicitWidth: parent.width
Component.onCompleted: {
employee_model.addedNewEmployee.connect(onAddNewEmployee);
}
Label {
id: headline
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
font.pixelSize: 35
text: qsTr("Mitarbeiter / Bewerber hinzufügen")
}
RowLayout {
Layout.fillWidth: true
spacing: Dimensions.l
Frame {
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
Layout.horizontalStretchFactor: 1
EmployeePersonalData {
id: personalData
implicitWidth: parent.width
}
}
Frame {
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
Layout.horizontalStretchFactor: 1
ColumnLayout {
Layout.alignment: Qt.AlignTop
implicitWidth: parent.width
EmployeeBankData {
id: bankAccount
}
EmployeeNationalInsurance {
id: nationalInsurance
}
EmployeeVarious {
id: applicantVarious
}
}
}
}
Item {
Layout.fillHeight: true Layout.fillHeight: true
}
RowLayout {
Layout.alignment: Qt.AlignRight
Layout.fillWidth: true Layout.fillWidth: true
anchors.fill: parent
implicitWidth: parent.width
Button { Component.onCompleted: {
text: qsTr("Abbrechen") employee_model.addedNewEmployee.connect(onAddNewEmployee);
onClicked: contentStack.pop()
} }
Button {
id: saveBtn
enabled: false Label {
text: qsTr("Speichern") id: headline
onClicked: { Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
const new_applicant = JsLib.parseForm(personalData, bankAccount, nationalInsurance, applicantVarious); font.pixelSize: 35
employee_model.addEmployee(new_applicant); text: qsTr("Mitarbeiter / Bewerber hinzufügen")
}
RowLayout {
Layout.fillWidth: true
spacing: Dimensions.l
Frame {
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
Layout.horizontalStretchFactor: 1
EmployeePersonalData {
id: personalData
implicitWidth: parent.width
}
}
Frame {
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
Layout.horizontalStretchFactor: 1
ColumnLayout {
Layout.alignment: Qt.AlignTop
implicitWidth: parent.width
EmployeeBankData {
id: bankAccount
}
EmployeeNationalInsurance {
id: nationalInsurance
}
EmployeeVarious {
id: applicantVarious
}
}
}
}
Item {
Layout.fillHeight: true
}
RowLayout {
Layout.alignment: Qt.AlignRight
Layout.fillWidth: true
Button {
text: qsTr("Abbrechen")
onClicked: contentStack.pop()
}
Button {
id: saveBtn
enabled: false
text: qsTr("Speichern")
onClicked: {
const new_applicant = JsLib.parseForm(personalData, bankAccount, nationalInsurance, applicantVarious);
employee_model.addEmployee(new_applicant);
}
} }
} }
} }

View File

@@ -4,140 +4,148 @@ import QtQuick.Controls
import QtQuick.Dialogs import QtQuick.Dialogs
import Js import Js
ColumnLayout ScrollView
{ {
property var new_object: null id: scroll
//property alias checkAddContact: checkAddContact width: parent.width
Layout.fillWidth: true height: parent.height
Layout.fillHeight: true ColumnLayout
spacing: 15
Label
{ {
text: qsTr("Objekt anlegen") height: Screen.desktopAvailableHeight
horizontalAlignment: Text.AlignHCenter width: scroll.width
Layout.fillWidth: true property var new_object: null
font.pixelSize: 35 //property alias checkAddContact: checkAddContact
}
CheckBox
{
id: checkAddObjectContact
text: qsTr("Ansprechpartner hinzufügen")
Layout.alignment: Qt.AlignRight
checked: false
onCheckStateChanged:
{
checkFields()
}
}
RowLayout spacing: 15
{ Label
id: addObject
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 45
Frame
{ {
Layout.alignment: Qt.AlignTop text: qsTr("Objekt anlegen")
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
AddNewObject font.pixelSize: 35
}
CheckBox
{
id: checkAddObjectContact
text: qsTr("Ansprechpartner hinzufügen")
Layout.alignment: Qt.AlignRight
checked: false
onCheckStateChanged:
{ {
id: newObject checkFields()
width: parent.width
} }
} }
ObjectAddOns RowLayout
{ {
id: addObjectLayout id: addObject
visible: checkAddObjectContact.checked Layout.fillWidth: true
} Layout.fillHeight: true
} spacing: 45
RowLayout
{
Layout.fillHeight: true
Layout.alignment: Qt.AlignRight
Button
{
text: qsTr("Abbrechen")
onClicked: contentStack.pop()
}
Button
{
property var new_object: null
id: saveBtn
text: qsTr("Speichern")
enabled: false
onClicked:
Frame
{ {
Layout.alignment: Qt.AlignTop
new_object = JsLib.parseForm(newObject) Layout.fillWidth: true
// For Debugging AddNewObject
console.log(JSON.stringify(new_object)) {
// id: newObject
new_object['lift'] = new_object['lift'] === 'Ja' ? 1 : 0 width: parent.width
new_object['mezzanin'] = new_object['mezzanin'] === 'Ja' ? 1 : 0 }
object_model.addObject(new_object)
}
}
}
Item
{
id: spacer3
Layout.fillHeight: true
}
Component.onCompleted:
{
//object_model.objectAdded.connect(onObjectAdded)
//contact_model.objectContactAdded.connect(onObjectContact)
}
Connections
{
target: object_model
function onObjectIdReady()
{
var obj_id = arguments[0]
if (checkAddObjectContact.checked && obj_id)
{
var new_objecto = addObjectLayout.getForm()
contact_model.addObjectContact(new_objecto, obj_id)
object_model.viewCriterion("Alle")
} }
contentStack.pop() ObjectAddOns
{
id: addObjectLayout
visible: checkAddObjectContact.checked
}
} }
RowLayout
{
Layout.fillHeight: true
Layout.alignment: Qt.AlignRight
Button
{
text: qsTr("Abbrechen")
onClicked: contentStack.pop()
}
Button
{
property var new_object: null
id: saveBtn
text: qsTr("Speichern")
enabled: false
onClicked:
{
new_object = JsLib.parseForm(newObject)
// For Debugging
console.log(JSON.stringify(new_object))
//
new_object['lift'] = new_object['lift'] === 'Ja' ? 1 : 0
new_object['mezzanin'] = new_object['mezzanin'] === 'Ja' ? 1 : 0
object_model.addObject(new_object)
}
}
}
Item
{
id: spacer3
Layout.fillHeight: true
}
Component.onCompleted:
{
//object_model.objectAdded.connect(onObjectAdded)
//contact_model.objectContactAdded.connect(onObjectContact)
}
Connections
{
target: object_model
function onObjectIdReady()
{
var obj_id = arguments[0]
if (checkAddObjectContact.checked && obj_id)
{
var new_objecto = addObjectLayout.getForm()
contact_model.addObjectContact(new_objecto, obj_id)
object_model.viewCriterion("Alle")
}
contentStack.pop()
}
}
// function onObjectAdded(added, oid)
// {
// if (!added)
// console.log(qsTr("Fehler beim Objekt-Anlegen!"))
// if (checkAddObjectContact.checked && oid)
// {
// var new_objecto = addObjectLayout.getForm()
// contact_model.addObjectContact(new_objecto, oid)
// }
// else appLoader.source = "ObjectTable.qml"
// }
// function onObjectContact(added)
// {
// if (!added)
// console.log(qsTr("Fehler beim Objekt-Kontakt-Anlegen!"))
// else
// {
// //object_model.viewCriterion("Alle")
// appLoader.source = "ObjectTable.qml"
// }
// }
} }
// function onObjectAdded(added, oid)
// {
// if (!added)
// console.log(qsTr("Fehler beim Objekt-Anlegen!"))
// if (checkAddObjectContact.checked && oid)
// {
// var new_objecto = addObjectLayout.getForm()
// contact_model.addObjectContact(new_objecto, oid)
// }
// else appLoader.source = "ObjectTable.qml"
// }
// function onObjectContact(added)
// {
// if (!added)
// console.log(qsTr("Fehler beim Objekt-Kontakt-Anlegen!"))
// else
// {
// //object_model.viewCriterion("Alle")
// appLoader.source = "ObjectTable.qml"
// }
// }
function checkFields() function checkFields()
{ {
if(checkAddObjectContact.checked) if(checkAddObjectContact.checked)