diff --git a/Gui/Employees/AddApplicant.qml b/Gui/Employees/AddApplicant.qml index 3326d61..35a2877 100644 --- a/Gui/Employees/AddApplicant.qml +++ b/Gui/Employees/AddApplicant.qml @@ -1,49 +1,51 @@ import QtQuick import QtQuick.Layouts +import QtQuick.Controls import TeroStyle 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 - - Button - { - icon.source: "qrc:/images/ArrowLeftCircle-Outline.svg" - text: qsTr("Verwerfen") - - onClicked: contentStack.pop() + Component.onCompleted: { + employee_model.addedNewEmployee.connect(successful => { + if (successful) + 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); + } } } } diff --git a/Gui/Employees/AddEmployee.qml b/Gui/Employees/AddEmployee.qml index 071d970..f488a21 100644 --- a/Gui/Employees/AddEmployee.qml +++ b/Gui/Employees/AddEmployee.qml @@ -2,9 +2,9 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts import Js -ColumnLayout { - id: colPar +ScrollView +{ function checkFields() { if (!personalData.checkPersonalField()) saveBtn.enabled = false; @@ -19,82 +19,90 @@ ColumnLayout { 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 - } - RowLayout { - Layout.alignment: Qt.AlignRight Layout.fillWidth: true + anchors.fill: parent + implicitWidth: parent.width - Button { - text: qsTr("Abbrechen") - - onClicked: contentStack.pop() + Component.onCompleted: { + employee_model.addedNewEmployee.connect(onAddNewEmployee); } - Button { - id: saveBtn - enabled: false - text: qsTr("Speichern") + Label { + id: headline - onClicked: { - const new_applicant = JsLib.parseForm(personalData, bankAccount, nationalInsurance, applicantVarious); - employee_model.addEmployee(new_applicant); + 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 + } + 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); + } } } } diff --git a/Gui/Objects/AddObject.qml b/Gui/Objects/AddObject.qml index 6757f2b..ae934e6 100644 --- a/Gui/Objects/AddObject.qml +++ b/Gui/Objects/AddObject.qml @@ -4,140 +4,148 @@ import QtQuick.Controls import QtQuick.Dialogs import Js -ColumnLayout +ScrollView { - property var new_object: null - //property alias checkAddContact: checkAddContact - Layout.fillWidth: true - Layout.fillHeight: true - spacing: 15 - Label + id: scroll + width: parent.width + height: parent.height + ColumnLayout { - text: qsTr("Objekt anlegen") - horizontalAlignment: Text.AlignHCenter - Layout.fillWidth: true - font.pixelSize: 35 - } - CheckBox - { - id: checkAddObjectContact - text: qsTr("Ansprechpartner hinzufügen") - Layout.alignment: Qt.AlignRight - checked: false - onCheckStateChanged: - { - checkFields() - } - } + height: Screen.desktopAvailableHeight + width: scroll.width + property var new_object: null + //property alias checkAddContact: checkAddContact - RowLayout - { - id: addObject - Layout.fillWidth: true - Layout.fillHeight: true - spacing: 45 - - Frame + spacing: 15 + Label { - Layout.alignment: Qt.AlignTop + text: qsTr("Objekt anlegen") + horizontalAlignment: Text.AlignHCenter Layout.fillWidth: true - AddNewObject + font.pixelSize: 35 + } + CheckBox + { + id: checkAddObjectContact + text: qsTr("Ansprechpartner hinzufügen") + Layout.alignment: Qt.AlignRight + checked: false + onCheckStateChanged: { - id: newObject - width: parent.width + checkFields() } } - ObjectAddOns + RowLayout { - 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: + id: addObject + Layout.fillWidth: true + Layout.fillHeight: true + spacing: 45 + Frame { - - 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") + Layout.alignment: Qt.AlignTop + Layout.fillWidth: true + AddNewObject + { + id: newObject + width: parent.width + } } - 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() { if(checkAddObjectContact.checked)