Use ORM for applicants
This commit is contained in:
@@ -6,13 +6,6 @@ ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: Dimensions.l
|
||||
|
||||
Component.onCompleted: {
|
||||
employee_model.addedNewEmployee.connect(successful => {
|
||||
if (successful)
|
||||
contentStack.pop();
|
||||
});
|
||||
}
|
||||
|
||||
ApplicantForm {
|
||||
id: applicantForm
|
||||
|
||||
@@ -36,7 +29,8 @@ ColumnLayout {
|
||||
text: qsTr("Speichern")
|
||||
|
||||
onClicked: {
|
||||
employee_model.addApplicant(applicantForm.value);
|
||||
applicantModel.createApplicant(applicantForm.value);
|
||||
contentStack.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.horizontalStretchFactor: 1
|
||||
|
||||
ApplicantPersonalData {
|
||||
EmployeePersonalData {
|
||||
id: personalData
|
||||
|
||||
implicitWidth: parent.width
|
||||
@@ -61,14 +61,14 @@ ColumnLayout {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
implicitWidth: parent.width
|
||||
|
||||
ApplicantBankData {
|
||||
EmployeeBankData {
|
||||
id: bankAccount
|
||||
|
||||
}
|
||||
ApplicantNationalInsurance {
|
||||
EmployeeNationalInsurance {
|
||||
id: nationalInsurance
|
||||
}
|
||||
ApplicantVarious {
|
||||
EmployeeVarious {
|
||||
id: applicantVarious
|
||||
|
||||
}
|
||||
|
||||
@@ -6,19 +6,31 @@ import TeroStyle
|
||||
ColumnLayout {
|
||||
readonly property int fieldM: 235
|
||||
readonly property int fieldS: 110
|
||||
readonly property bool valid: city.acceptableInput && email.acceptableInput && firstname.acceptableInput && lastname.acceptableInput && mobile.acceptableInput && phone.acceptableInput && postcode.acceptableInput && formofaddress.acceptableInput && title.acceptableInput
|
||||
readonly property bool valid: emailAddress.acceptableInput && firstName.acceptableInput && houseNumber.acceptableInput && lastName.acceptableInput && mobileNumber.acceptableInput && phoneNumber.acceptableInput && salutation.acceptableInput&& street.acceptableInput && title.acceptableInput && zipCode.acceptableInput
|
||||
readonly property var value: QtObject {
|
||||
readonly property string city: (city.editText ? city.editText : city.currentText) ?? ""
|
||||
readonly property string email: email.text
|
||||
readonly property string firstname: firstname.text
|
||||
readonly property string formofaddress: formofaddress.currentText ?? ""
|
||||
readonly property string houseno: houseno.text ?? ""
|
||||
readonly property string lastname: lastname.text
|
||||
readonly property string mobile: mobile.text
|
||||
readonly property string phone: phone.text
|
||||
readonly property string postcode: (postcode.editText ? postcode.editText : postcode.currentText) ?? ""
|
||||
readonly property string street: (street.editText ? street.editText : street.currentText) ?? ""
|
||||
readonly property string emailAddress: emailAddress.text ?? ""
|
||||
readonly property string firstName: firstName.text ?? ""
|
||||
readonly property string houseNumber: houseNumber.text ?? ""
|
||||
readonly property string lastName: lastName.text ?? ""
|
||||
readonly property string mobileNumber: mobileNumber.text ?? ""
|
||||
readonly property string phoneNumber: phoneNumber.text ?? ""
|
||||
readonly property string salutation: salutation.text ?? ""
|
||||
readonly property string street: street.text ?? ""
|
||||
readonly property string title: title.currentText
|
||||
readonly property int zipCode: zipCode.currentIndex
|
||||
}
|
||||
|
||||
function setValue(value) {
|
||||
title.currentIndex = value.title ?? 0;
|
||||
firstName.text = value.firstName ?? "";
|
||||
lastName.text = value.lastName ?? "";
|
||||
street.text = value.street ?? "";
|
||||
houseNumber.text = value.houseNumber ?? "";
|
||||
zipCode.currentIndex = value.zipCode ?? -1;
|
||||
phoneNumber.text = value.phoneNumber ?? "";
|
||||
mobileNumber.text = value.mobileNumber ?? "";
|
||||
emailAddress.text = value.emailAddress ?? "";
|
||||
salutation.text = value.salutation ?? 0;
|
||||
}
|
||||
|
||||
spacing: Dimensions.l
|
||||
@@ -48,13 +60,13 @@ ColumnLayout {
|
||||
onCurrentTextChanged: {
|
||||
switch (title.currentIndex) {
|
||||
case 1:
|
||||
formofaddress.text = "Sehr geehrter Herr ";
|
||||
salutation.text = "Sehr geehrter Herr ";
|
||||
break;
|
||||
case 2:
|
||||
formofaddress.text = "Sehr geehrte Frau ";
|
||||
salutation.text = "Sehr geehrte Frau ";
|
||||
break;
|
||||
default:
|
||||
formofaddress.text = "Guten Tag ";
|
||||
salutation.text = "Guten Tag ";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,7 +76,7 @@ ColumnLayout {
|
||||
mandatory: true
|
||||
|
||||
TextField {
|
||||
id: firstname
|
||||
id: firstName
|
||||
|
||||
implicitWidth: fieldM
|
||||
placeholderText: qsTr("Max")
|
||||
@@ -78,7 +90,7 @@ ColumnLayout {
|
||||
mandatory: true
|
||||
|
||||
TextField {
|
||||
id: lastname
|
||||
id: lastName
|
||||
|
||||
implicitWidth: fieldM
|
||||
placeholderText: qsTr("Mustermann")
|
||||
@@ -92,39 +104,30 @@ ColumnLayout {
|
||||
spacing: Dimensions.m
|
||||
|
||||
Field {
|
||||
id: street
|
||||
|
||||
label: qsTr("Straße")
|
||||
mandatory: true
|
||||
|
||||
TextField {
|
||||
id: street
|
||||
|
||||
implicitWidth: fieldM
|
||||
placeholderText: qsTr("Musterstraße")
|
||||
|
||||
validator: NotEmptyValidator {
|
||||
}
|
||||
}
|
||||
}
|
||||
Field {
|
||||
id: houseno
|
||||
mandatory: true
|
||||
|
||||
label: qsTr("Hausnummer")
|
||||
|
||||
TextField {
|
||||
id: houseNumber
|
||||
|
||||
implicitWidth: fieldS
|
||||
placeholderText: qsTr("1a")
|
||||
|
||||
validator: NotEmptyValidator {
|
||||
}
|
||||
}
|
||||
}
|
||||
Field {
|
||||
label: qsTr("PLZ")
|
||||
mandatory: true
|
||||
|
||||
ComboBox {
|
||||
id: postcode
|
||||
id: zipCode
|
||||
|
||||
currentIndex: -1
|
||||
editable: true
|
||||
@@ -133,14 +136,11 @@ ColumnLayout {
|
||||
textRole: "display"
|
||||
|
||||
onActivated: currentValue
|
||||
onCurrentIndexChanged: city.currentIndex = postcode.currentIndex
|
||||
|
||||
validator: NotEmptyValidator {}
|
||||
onCurrentIndexChanged: city.currentIndex = zipCode.currentIndex
|
||||
}
|
||||
}
|
||||
Field {
|
||||
label: qsTr("Ort")
|
||||
mandatory: true
|
||||
|
||||
ComboBox {
|
||||
id: city
|
||||
@@ -150,9 +150,6 @@ ColumnLayout {
|
||||
implicitWidth: fieldM
|
||||
model: address_model
|
||||
textRole: "city"
|
||||
|
||||
validator: NotEmptyValidator {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,7 +170,7 @@ ColumnLayout {
|
||||
label: qsTr("Telefonnummer")
|
||||
|
||||
TextField {
|
||||
id: phone
|
||||
id: phoneNumber
|
||||
|
||||
implicitWidth: fieldM
|
||||
placeholderText: "+49 1234 567890"
|
||||
@@ -186,7 +183,7 @@ ColumnLayout {
|
||||
label: qsTr("Mobil")
|
||||
|
||||
TextField {
|
||||
id: mobile
|
||||
id: mobileNumber
|
||||
|
||||
implicitWidth: fieldM
|
||||
placeholderText: "+49 123 4567891011"
|
||||
@@ -199,7 +196,7 @@ ColumnLayout {
|
||||
label: qsTr("E-Mail Adresse")
|
||||
|
||||
TextField {
|
||||
id: email
|
||||
id: emailAddress
|
||||
|
||||
implicitWidth: fieldM
|
||||
placeholderText: "tero@example.org"
|
||||
@@ -212,7 +209,7 @@ ColumnLayout {
|
||||
label: qsTr("Briefanrede")
|
||||
|
||||
TextField {
|
||||
id: formofaddress
|
||||
id: salutation
|
||||
|
||||
implicitWidth: fieldM
|
||||
}
|
||||
|
||||
@@ -1,26 +1,34 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import TeroStyle
|
||||
|
||||
Item {
|
||||
property var employee
|
||||
property int row
|
||||
ColumnLayout {
|
||||
property int row: -1
|
||||
|
||||
anchors.fill: parent
|
||||
spacing: Dimensions.l
|
||||
|
||||
onRowChanged: {
|
||||
employee = employee_model.fetchApplicant(row);
|
||||
if (row !== -1) {
|
||||
applicantForm.setValue(applicantModel.applicant(row))
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Label {
|
||||
text: qsTr("Ausgewählter Mitarbeiter ") + row
|
||||
}
|
||||
Label {
|
||||
text: employee.postcode ?? ""
|
||||
}
|
||||
Button {
|
||||
text: qsTr("Mitarbeiter zeigen")
|
||||
ApplicantForm {
|
||||
id: applicantForm
|
||||
|
||||
onClicked: contentStack.pop()
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.fillHeight: true
|
||||
Layout.verticalStretchFactor: 1
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: Dimensions.l
|
||||
|
||||
Button {
|
||||
text: qsTr("Als Mitarbeiter:in Einstellen")
|
||||
icon.source: "qrc:/images/InboxArrowDown.svg"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ ColumnLayout {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
columnSpacing: 2
|
||||
model: employee_model
|
||||
model: applicantModel
|
||||
resizableColumns: true
|
||||
rowSpacing: 2
|
||||
selectionBehavior: TableView.SelectRows
|
||||
|
||||
Reference in New Issue
Block a user