Add global back button
This commit is contained in:
@@ -1,178 +1,17 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import "../../js/qmldict.js" as JsLib
|
||||
import TeroStyle
|
||||
|
||||
|
||||
ColumnLayout
|
||||
{
|
||||
id: colPar
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
implicitWidth: parent.width
|
||||
Label
|
||||
{
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||
id: headline
|
||||
text: qsTr("Mitarbeiter / Bewerber hinzufügen")
|
||||
font.pixelSize: 35
|
||||
}
|
||||
ButtonGroup
|
||||
{
|
||||
buttons: radio.children
|
||||
onClicked:
|
||||
{
|
||||
checkFields()
|
||||
personalData.requiredField()
|
||||
}
|
||||
}
|
||||
spacing: Dimensions.l
|
||||
|
||||
Row
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
id: radio
|
||||
//Layout.columnSpan: 2
|
||||
RadioButton
|
||||
{
|
||||
checked: true
|
||||
text: qsTr("Bewerber")
|
||||
}
|
||||
RadioButton
|
||||
{
|
||||
text: qsTr("Mitarbeiter")
|
||||
}
|
||||
}
|
||||
|
||||
// ScrollView
|
||||
// {
|
||||
// Layout.fillHeight: true
|
||||
// Layout.fillWidth: true
|
||||
// implicitWidth: parent.width
|
||||
|
||||
// ColumnLayout
|
||||
// {
|
||||
// anchors.fill: parent
|
||||
// //implicitWidth: parent.width
|
||||
// //width: parent.width
|
||||
// //height: parent.height
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
//implicitWidth: parent.width
|
||||
spacing: 50
|
||||
|
||||
Frame
|
||||
{
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
//implicitWidth: parent.width
|
||||
ApplicantPersonalData
|
||||
{
|
||||
id: personalData
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
Frame
|
||||
{
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
visible: radio.children[1].checked
|
||||
ColumnLayout
|
||||
{
|
||||
Layout.alignment: Qt.AlignTop
|
||||
implicitWidth: parent.width
|
||||
|
||||
ApplicantBankData
|
||||
{
|
||||
id: bankAccount
|
||||
}
|
||||
|
||||
ApplicantNationalInsurance
|
||||
{
|
||||
id: nationalInsurance
|
||||
}
|
||||
|
||||
ApplicantVarious
|
||||
{
|
||||
id: applicantVarious
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
ColumnLayout {
|
||||
Layout.fillHeight: true
|
||||
Layout.verticalStretchFactor: 1
|
||||
spacing: Dimensions.l
|
||||
}
|
||||
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Button
|
||||
{
|
||||
text: qsTr("Abbrechen")
|
||||
onClicked: contentStack.pop()
|
||||
}
|
||||
Button
|
||||
{
|
||||
id: saveBtn
|
||||
text: qsTr("Speichern")
|
||||
enabled: false
|
||||
onClicked:
|
||||
{
|
||||
var new_applicant
|
||||
if (radio.children[0].checked)
|
||||
{
|
||||
// Ein Bewerber
|
||||
new_applicant = JsLib.parseForm(personalData)
|
||||
employee_model.addEmployee(new_applicant, true)
|
||||
// appLoader.source = "EmployeeTable.qml"
|
||||
// console.log(JSON.stringify (new_applicant))
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ein Mitarbeiter
|
||||
// console.log(personalData, bankAccount, nationalInsurance, applicantVarious)
|
||||
new_applicant = JsLib.parseForm(personalData, bankAccount, nationalInsurance, applicantVarious)
|
||||
employee_model.addEmployee(new_applicant, false)
|
||||
// var new_contact = JsLib.addApplicant(addContactLayout)
|
||||
// contact_model.addContact(new_contact)
|
||||
// console.log(JSON.stringify (new_applicant))
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
spacing: Dimensions.l
|
||||
}
|
||||
Component.onCompleted:
|
||||
{
|
||||
employee_model.addedNewEmployee.connect(onAddNewEmployee)
|
||||
}
|
||||
|
||||
function onAddNewEmployee(added)
|
||||
{
|
||||
if (added)
|
||||
console.log('addedsuccesfully')
|
||||
else
|
||||
console.log('failedtoadd')
|
||||
contentStack.pop()
|
||||
}
|
||||
|
||||
function checkFields()
|
||||
{
|
||||
if(radio.children[1].checked)
|
||||
{
|
||||
if(!personalData.checkPersonalField())
|
||||
saveBtn.enabled = false
|
||||
else
|
||||
saveBtn.enabled = true
|
||||
}
|
||||
else if (!personalData.checkPersonalField())
|
||||
saveBtn.enabled = false
|
||||
else
|
||||
saveBtn.enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
143
Gui/Employees/AddEmployee.qml
Normal file
143
Gui/Employees/AddEmployee.qml
Normal file
@@ -0,0 +1,143 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import "../../js/qmldict.js" as JsLib
|
||||
|
||||
ColumnLayout {
|
||||
id: colPar
|
||||
|
||||
function checkFields() {
|
||||
if (radio.children[1].checked) {
|
||||
if (!personalData.checkPersonalField())
|
||||
saveBtn.enabled = false;
|
||||
else
|
||||
saveBtn.enabled = true;
|
||||
} else if (!personalData.checkPersonalField())
|
||||
saveBtn.enabled = false;
|
||||
else
|
||||
saveBtn.enabled = true;
|
||||
}
|
||||
function onAddNewEmployee(added) {
|
||||
if (added)
|
||||
console.log('addedsuccesfully');
|
||||
else
|
||||
console.log('failedtoadd');
|
||||
contentStack.pop();
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
ButtonGroup {
|
||||
buttons: radio.children
|
||||
|
||||
onClicked: {
|
||||
checkFields();
|
||||
personalData.requiredField();
|
||||
}
|
||||
}
|
||||
Row {
|
||||
id: radio
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
//Layout.columnSpan: 2
|
||||
RadioButton {
|
||||
checked: true
|
||||
text: qsTr("Bewerber")
|
||||
}
|
||||
RadioButton {
|
||||
text: qsTr("Mitarbeiter")
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 50
|
||||
|
||||
Frame {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
|
||||
//implicitWidth: parent.width
|
||||
ApplicantPersonalData {
|
||||
id: personalData
|
||||
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
Frame {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
visible: radio.children[1].checked
|
||||
|
||||
ColumnLayout {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
implicitWidth: parent.width
|
||||
|
||||
ApplicantBankData {
|
||||
id: bankAccount
|
||||
|
||||
}
|
||||
ApplicantNationalInsurance {
|
||||
id: nationalInsurance
|
||||
|
||||
}
|
||||
ApplicantVarious {
|
||||
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: {
|
||||
var new_applicant;
|
||||
if (radio.children[0].checked) {
|
||||
// Ein Bewerber
|
||||
new_applicant = JsLib.parseForm(personalData);
|
||||
employee_model.addEmployee(new_applicant, true);
|
||||
// appLoader.source = "EmployeeTable.qml"
|
||||
// console.log(JSON.stringify (new_applicant))
|
||||
} else {
|
||||
// Ein Mitarbeiter
|
||||
// console.log(personalData, bankAccount, nationalInsurance, applicantVarious)
|
||||
new_applicant = JsLib.parseForm(personalData, bankAccount, nationalInsurance, applicantVarious);
|
||||
employee_model.addEmployee(new_applicant, false);
|
||||
// var new_contact = JsLib.addApplicant(addContactLayout)
|
||||
// contact_model.addContact(new_contact)
|
||||
// console.log(JSON.stringify (new_applicant))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,10 +45,18 @@ ColumnLayout {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
flat: true
|
||||
icon.source: "qrc:/images/PlusCircle.svg"
|
||||
text: qsTr("Mitarbeiter Hinzufügen")
|
||||
text: qsTr("Bewerber Hinzufügen")
|
||||
|
||||
onClicked: contentStack.push("AddApplicant.qml")
|
||||
}
|
||||
Button {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
flat: true
|
||||
icon.source: "qrc:/images/PlusCircle.svg"
|
||||
text: qsTr("Mitarbeiter Hinzufügen")
|
||||
|
||||
onClicked: contentStack.push("AddEmployee.qml")
|
||||
}
|
||||
}
|
||||
HorizontalHeaderView {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Reference in New Issue
Block a user