Files
pyqcrm/Gui/Employees/AddEmployee.qml
2025-04-15 15:24:31 +02:00

111 lines
2.5 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import "../../js/qmldict.js" as JsLib
ColumnLayout {
id: colPar
function checkFields() {
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();
}
}
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: {
const new_applicant = JsLib.parseForm(personalData, bankAccount, nationalInsurance, applicantVarious);
employee_model.addEmployee(new_applicant, false);
}
}
}
}