Validate applicant and call database procedure
This commit is contained in:
@@ -6,23 +6,38 @@ 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 {
|
||||
spacing: Dimensions.l
|
||||
Layout.alignment: Qt.AlignRight
|
||||
spacing: Dimensions.l
|
||||
|
||||
Button {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,7 @@ ColumnLayout {
|
||||
id: colPar
|
||||
|
||||
function checkFields() {
|
||||
if (radio.children[1].checked) {
|
||||
if (!personalData.checkPersonalField())
|
||||
saveBtn.enabled = false;
|
||||
else
|
||||
saveBtn.enabled = true;
|
||||
} else if (!personalData.checkPersonalField())
|
||||
if (!personalData.checkPersonalField())
|
||||
saveBtn.enabled = false;
|
||||
else
|
||||
saveBtn.enabled = true;
|
||||
@@ -49,20 +44,6 @@ ColumnLayout {
|
||||
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
|
||||
@@ -121,22 +102,8 @@ ColumnLayout {
|
||||
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))
|
||||
}
|
||||
const new_applicant = JsLib.parseForm(personalData, bankAccount, nationalInsurance, applicantVarious);
|
||||
employee_model.addEmployee(new_applicant, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,20 @@ 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 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 title: title.currentText
|
||||
}
|
||||
|
||||
spacing: Dimensions.l
|
||||
|
||||
@@ -34,31 +48,43 @@ ColumnLayout {
|
||||
onCurrentTextChanged: {
|
||||
switch (title.currentIndex) {
|
||||
case 1:
|
||||
salutation.text = "Sehr geehrter Herr ";
|
||||
formofaddress.text = "Sehr geehrter Herr ";
|
||||
break;
|
||||
case 2:
|
||||
salutation.text = "Sehr geehrte Frau ";
|
||||
formofaddress.text = "Sehr geehrte Frau ";
|
||||
break;
|
||||
default:
|
||||
salutation.text = "Guten Tag ";
|
||||
formofaddress.text = "Guten Tag ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Field {
|
||||
label: qsTr("Vorname*")
|
||||
label: qsTr("Vorname")
|
||||
mandatory: true
|
||||
|
||||
TextField {
|
||||
id: firstname
|
||||
|
||||
implicitWidth: fieldM
|
||||
placeholderText: "Max"
|
||||
placeholderText: qsTr("Max")
|
||||
|
||||
validator: NotEmptyValidator {
|
||||
}
|
||||
}
|
||||
}
|
||||
Field {
|
||||
label: qsTr("Nachname*")
|
||||
label: qsTr("Nachname")
|
||||
mandatory: true
|
||||
|
||||
TextField {
|
||||
id: lastname
|
||||
|
||||
implicitWidth: fieldM
|
||||
placeholderText: qsTr("Mustermann")
|
||||
|
||||
validator: NotEmptyValidator {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,6 +92,8 @@ ColumnLayout {
|
||||
spacing: Dimensions.m
|
||||
|
||||
Field {
|
||||
id: street
|
||||
|
||||
label: qsTr("Straße")
|
||||
|
||||
TextField {
|
||||
@@ -74,6 +102,8 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
Field {
|
||||
id: houseno
|
||||
|
||||
label: qsTr("Hausnummer")
|
||||
|
||||
TextField {
|
||||
@@ -86,6 +116,8 @@ ColumnLayout {
|
||||
|
||||
ComboBox {
|
||||
id: postcode
|
||||
|
||||
currentIndex: -1
|
||||
editable: true
|
||||
implicitWidth: fieldS
|
||||
model: address_model
|
||||
@@ -97,14 +129,19 @@ ColumnLayout {
|
||||
}
|
||||
Field {
|
||||
label: qsTr("Ort")
|
||||
mandatory: true
|
||||
|
||||
ComboBox {
|
||||
id: city
|
||||
|
||||
currentIndex: -1
|
||||
editable: true
|
||||
implicitWidth: fieldM
|
||||
model: address_model
|
||||
textRole: "city"
|
||||
|
||||
validator: NotEmptyValidator {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,10 +162,12 @@ ColumnLayout {
|
||||
label: qsTr("Telefonnummer")
|
||||
|
||||
TextField {
|
||||
id: phone
|
||||
|
||||
implicitWidth: fieldM
|
||||
placeholderText: "+49 1234 567890"
|
||||
|
||||
validator: PhoneNumberValidator {
|
||||
validator: OptionalPhoneNumberValidator {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,10 +175,12 @@ ColumnLayout {
|
||||
label: qsTr("Mobil")
|
||||
|
||||
TextField {
|
||||
id: mobile
|
||||
|
||||
implicitWidth: fieldM
|
||||
placeholderText: "+49 123 4567891011"
|
||||
|
||||
validator: PhoneNumberValidator {
|
||||
validator: OptionalPhoneNumberValidator {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,10 +188,12 @@ ColumnLayout {
|
||||
label: qsTr("E-Mail Adresse")
|
||||
|
||||
TextField {
|
||||
id: email
|
||||
|
||||
implicitWidth: fieldM
|
||||
placeholderText: "tero@example.org"
|
||||
|
||||
validator: EmailAddressValidator {
|
||||
validator: OptionalEmailAddressValidator {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,7 +201,7 @@ ColumnLayout {
|
||||
label: qsTr("Briefanrede")
|
||||
|
||||
TextField {
|
||||
id: salutation
|
||||
id: formofaddress
|
||||
|
||||
implicitWidth: fieldM
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user