211 lines
5.6 KiB
QML
211 lines
5.6 KiB
QML
import QtQuick
|
|
import QtQuick.Controls.impl
|
|
import QtQuick.Layouts
|
|
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
|
|
|
|
IconLabel {
|
|
color: Colors.foreground
|
|
font: Typography.h2
|
|
icon.color: Colors.foreground
|
|
icon.height: Typography.h2.pixelSize
|
|
icon.source: "qrc:/images/UserCircle"
|
|
icon.width: Typography.h2.pixelSize
|
|
spacing: Dimensions.m
|
|
text: qsTr("Stammdaten")
|
|
}
|
|
RowLayout {
|
|
spacing: Dimensions.m
|
|
|
|
Field {
|
|
label: qsTr("Anrede")
|
|
|
|
ComboBox {
|
|
id: title
|
|
|
|
implicitWidth: fieldM
|
|
model: [qsTr("Keine Angabe"), qsTr("Herr"), qsTr("Frau")]
|
|
|
|
onCurrentTextChanged: {
|
|
switch (title.currentIndex) {
|
|
case 1:
|
|
formofaddress.text = "Sehr geehrter Herr ";
|
|
break;
|
|
case 2:
|
|
formofaddress.text = "Sehr geehrte Frau ";
|
|
break;
|
|
default:
|
|
formofaddress.text = "Guten Tag ";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Field {
|
|
label: qsTr("Vorname")
|
|
mandatory: true
|
|
|
|
TextField {
|
|
id: firstname
|
|
|
|
implicitWidth: fieldM
|
|
placeholderText: qsTr("Max")
|
|
|
|
validator: NotEmptyValidator {
|
|
}
|
|
}
|
|
}
|
|
Field {
|
|
label: qsTr("Nachname")
|
|
mandatory: true
|
|
|
|
TextField {
|
|
id: lastname
|
|
|
|
implicitWidth: fieldM
|
|
placeholderText: qsTr("Mustermann")
|
|
|
|
validator: NotEmptyValidator {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
RowLayout {
|
|
spacing: Dimensions.m
|
|
|
|
Field {
|
|
id: street
|
|
|
|
label: qsTr("Straße")
|
|
|
|
TextField {
|
|
implicitWidth: fieldM
|
|
placeholderText: qsTr("Musterstraße")
|
|
}
|
|
}
|
|
Field {
|
|
id: houseno
|
|
|
|
label: qsTr("Hausnummer")
|
|
|
|
TextField {
|
|
implicitWidth: fieldS
|
|
placeholderText: qsTr("1a")
|
|
}
|
|
}
|
|
Field {
|
|
label: qsTr("PLZ")
|
|
|
|
ComboBox {
|
|
id: postcode
|
|
|
|
currentIndex: -1
|
|
editable: true
|
|
implicitWidth: fieldS
|
|
model: address_model
|
|
textRole: "display"
|
|
|
|
onActivated: currentValue
|
|
onCurrentIndexChanged: city.currentIndex = postcode.currentIndex
|
|
}
|
|
}
|
|
Field {
|
|
label: qsTr("Ort")
|
|
mandatory: true
|
|
|
|
ComboBox {
|
|
id: city
|
|
|
|
currentIndex: -1
|
|
editable: true
|
|
implicitWidth: fieldM
|
|
model: address_model
|
|
textRole: "city"
|
|
|
|
validator: NotEmptyValidator {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
IconLabel {
|
|
color: Colors.foreground
|
|
font: Typography.h2
|
|
icon.color: Colors.foreground
|
|
icon.height: Typography.h2.pixelSize
|
|
icon.source: "qrc:/images/Phone"
|
|
icon.width: Typography.h2.pixelSize
|
|
spacing: Dimensions.m
|
|
text: qsTr("Kontakt")
|
|
}
|
|
RowLayout {
|
|
spacing: Dimensions.m
|
|
|
|
Field {
|
|
label: qsTr("Telefonnummer")
|
|
|
|
TextField {
|
|
id: phone
|
|
|
|
implicitWidth: fieldM
|
|
placeholderText: "+49 1234 567890"
|
|
|
|
validator: OptionalPhoneNumberValidator {
|
|
}
|
|
}
|
|
}
|
|
Field {
|
|
label: qsTr("Mobil")
|
|
|
|
TextField {
|
|
id: mobile
|
|
|
|
implicitWidth: fieldM
|
|
placeholderText: "+49 123 4567891011"
|
|
|
|
validator: OptionalPhoneNumberValidator {
|
|
}
|
|
}
|
|
}
|
|
Field {
|
|
label: qsTr("E-Mail Adresse")
|
|
|
|
TextField {
|
|
id: email
|
|
|
|
implicitWidth: fieldM
|
|
placeholderText: "tero@example.org"
|
|
|
|
validator: OptionalEmailAddressValidator {
|
|
}
|
|
}
|
|
}
|
|
Field {
|
|
label: qsTr("Briefanrede")
|
|
|
|
TextField {
|
|
id: formofaddress
|
|
|
|
implicitWidth: fieldM
|
|
}
|
|
}
|
|
}
|
|
}
|