272 lines
5.9 KiB
QML
272 lines
5.9 KiB
QML
import QtQuick
|
||
import QtQuick.Controls
|
||
import QtQuick.Layouts
|
||
|
||
GridLayout
|
||
{
|
||
id: customerView
|
||
columns: 4
|
||
Layout.fillWidth: true
|
||
Layout.fillHeight: true
|
||
rowSpacing: 9
|
||
property alias businesstxt: firmenName
|
||
property alias street: streetid
|
||
property alias postcodetxt: postcode
|
||
property alias citytxt: city
|
||
Label
|
||
{
|
||
id: lblFirmenName
|
||
text: qsTr("Firmenname*")
|
||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||
|
||
}
|
||
TextField
|
||
{
|
||
property string name: "business"
|
||
|
||
id: firmenName
|
||
Layout.fillWidth: true
|
||
Layout.alignment: Qt.AlignVCenter
|
||
onTextChanged: checkFields()
|
||
Layout.columnSpan: 3
|
||
}
|
||
|
||
Label
|
||
{
|
||
text: qsTr("Straße*")
|
||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||
}
|
||
|
||
TextField
|
||
{
|
||
property string name: "street"
|
||
id: streetid
|
||
Layout.fillWidth: true
|
||
onTextChanged: checkFields()
|
||
}
|
||
|
||
Label
|
||
{
|
||
text: qsTr("Nr.*")
|
||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||
}
|
||
|
||
TextField
|
||
{
|
||
property string name: "houseno"
|
||
id: housenoid
|
||
Layout.fillWidth: true
|
||
onTextChanged: checkFields()
|
||
validator: RegularExpressionValidator
|
||
{
|
||
regularExpression: /([0-9a-zA-Z\-]{1,6})/
|
||
}
|
||
}
|
||
|
||
|
||
Label
|
||
{
|
||
text: qsTr("PLZ")
|
||
Layout.alignment: Qt.AlignRight
|
||
}
|
||
|
||
|
||
|
||
|
||
ComboBox
|
||
{
|
||
property string name: "postcode"
|
||
id: postcode
|
||
Layout.fillWidth: true
|
||
editable: true
|
||
onCurrentTextChanged: checkFields()
|
||
onEditTextChanged: checkFields()
|
||
onActivated: currentValue
|
||
model: address_model
|
||
textRole: "display"
|
||
popup.height: 300
|
||
currentIndex: -1
|
||
onCurrentIndexChanged: city.currentIndex = postcode.currentIndex
|
||
Layout.columnSpan: 3
|
||
validator: RegularExpressionValidator
|
||
{
|
||
regularExpression: /([0-9]{1,5})/
|
||
}
|
||
|
||
}
|
||
|
||
Label
|
||
{
|
||
text: qsTr("Ort")
|
||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||
}
|
||
ComboBox
|
||
{
|
||
property string name: "city"
|
||
id: city
|
||
Layout.fillWidth: true
|
||
editable: true
|
||
onEditTextChanged: checkFields()
|
||
onCurrentTextChanged: checkFields()
|
||
model: address_model
|
||
textRole: "city"
|
||
popup.height: 300
|
||
currentIndex: -1
|
||
Layout.columnSpan: 3
|
||
}
|
||
|
||
Label
|
||
{
|
||
text: qsTr("Telefon")
|
||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||
}
|
||
TextField
|
||
{
|
||
property string name: "telephone"
|
||
id: telephone
|
||
Layout.fillWidth: true
|
||
Layout.columnSpan: 3
|
||
validator: RegularExpressionValidator
|
||
{
|
||
regularExpression: /([+0-9]{1})([0-9]{1,17})/
|
||
}
|
||
|
||
}
|
||
|
||
Label
|
||
{
|
||
text: qsTr("Mobil")
|
||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||
}
|
||
TextField
|
||
{
|
||
property string name: "cellphone"
|
||
id: cellphone
|
||
Layout.fillWidth: true
|
||
Layout.columnSpan: 3
|
||
validator: RegularExpressionValidator
|
||
{
|
||
regularExpression: /([+0-9]{1})([0-9]{1,17})/
|
||
}
|
||
}
|
||
|
||
Label
|
||
{
|
||
text: qsTr("E-Mail")
|
||
Layout.alignment: Qt.AlignRight
|
||
}
|
||
TextField
|
||
{
|
||
property string name: "email"
|
||
id: email
|
||
Layout.fillWidth: true
|
||
placeholderText: qsTr("beispiel@domain.de")
|
||
Layout.columnSpan: 3
|
||
validator: RegularExpressionValidator
|
||
{
|
||
regularExpression: /([\+!#$%&‘\*\–\/\=?\^_`\.{|}\~\-\_0-9A-Za-z]{1,185})@([0-9A-Za-z\.\-\_]{1,64})\.([a-zA-z]{2,5})/
|
||
}
|
||
}
|
||
|
||
Label
|
||
{
|
||
text: qsTr("Homepage")
|
||
Layout.alignment: Qt.AlignRight
|
||
}
|
||
TextField
|
||
{
|
||
property string name: "homepage"
|
||
id: homepage
|
||
Layout.fillWidth: true
|
||
Layout.columnSpan: 3
|
||
placeholderText: "www.oschkarischtverhaftetwegensexy.jinx"
|
||
}
|
||
|
||
Label
|
||
{
|
||
text: qsTr("Geschäftsführer")
|
||
Layout.alignment: Qt.AlignRight
|
||
}
|
||
TextField
|
||
{
|
||
property string name: "ceo"
|
||
id: ceo
|
||
Layout.fillWidth: true
|
||
Layout.columnSpan: 3
|
||
}
|
||
|
||
Label
|
||
{
|
||
text: qsTr("USt-IdNr")
|
||
Layout.alignment: Qt.AlignRight
|
||
}
|
||
TextField
|
||
{
|
||
property string name: "taxno"
|
||
id: taxno
|
||
Layout.fillWidth: true
|
||
Layout.columnSpan: 3
|
||
}
|
||
Label
|
||
{
|
||
text: qsTr("Typ")
|
||
Layout.alignment: Qt.AlignRight
|
||
}
|
||
ComboBox
|
||
{
|
||
property string name: "typeid"
|
||
id: typeid
|
||
Layout.fillWidth: true
|
||
editable: false
|
||
model: business_type
|
||
textRole: "display"
|
||
Layout.columnSpan: 3
|
||
}
|
||
Label
|
||
{
|
||
text: qsTr("Info")
|
||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||
}
|
||
|
||
ScrollView
|
||
{
|
||
id: infoView
|
||
Layout.fillWidth: true
|
||
Layout.preferredHeight: 100
|
||
Layout.columnSpan: 3
|
||
ScrollBar.horizontal: ScrollBar
|
||
{
|
||
policy: ScrollBar.AlwaysOn
|
||
}
|
||
|
||
TextArea
|
||
{
|
||
property string name: "customerinfo"
|
||
id: customerInfo
|
||
implicitWidth: parent.width
|
||
wrapMode: TextEdit.Wrap
|
||
background: Rectangle
|
||
{
|
||
color: customerInfo.palette.base
|
||
border.color: customerInfo.activeFocus? customerInfo.palette.highlight: customerInfo.palette.base
|
||
}
|
||
}
|
||
}
|
||
function checkBusinessField()
|
||
{
|
||
if (!firmenName.text.trim() || !streetid.text.trim())
|
||
{
|
||
return false
|
||
|
||
}
|
||
else
|
||
{
|
||
if (!postcode.editText.trim() || !postcode.currentText || !city.editText.trim() || !city.currentText)
|
||
return false
|
||
else
|
||
return true
|
||
}
|
||
|
||
}
|
||
}
|