Files
pyqcrm/Gui/AddContact.qml

205 lines
5.0 KiB
QML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Frame
{
id: addContactFrame
property alias contactGrid: addContactLayout
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
GridLayout
{
id: addContactLayout
anchors.fill: parent
// Layout.fillWidth: true
// Layout.fillHeight: true
// Layout.alignment: Qt.AlignTop
columns: 2
rowSpacing: 9
property alias fname: firstname
property alias lname: lastname
Label
{
text: qsTr("Anrede")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
property string name: "title"
id: title
Layout.fillWidth: true
editable: false
model: ["Herr", "Frau"]
}
Label
{
text: qsTr("Vorname")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "firstname"
id: firstname
Layout.fillWidth: true
onTextChanged: checkFields()
}
Label
{
text: qsTr("Nachname")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "lastname"
id: lastname
Layout.fillWidth: true
onTextChanged: checkFields()
}
Label
{
text: qsTr("Position")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
property string name: "jobdescription"
id: jobdescription
Layout.fillWidth: true
editable: true
}
Label
{
text: qsTr("E-Mail")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "email"
id: emailcontact
Layout.fillWidth: true
placeholderText: qsTr("beispiel@domain.de")
validator: RegularExpressionValidator
{
regularExpression: /([\+!#$%&\*\\/\=?\^_`\.{|}\~\-\_0-9A-Za-z]{1,185})@([0-9A-Za-z\.\-\_]{1,64})\.([a-zA-z]{2,5})/
}
}
Label
{
text: qsTr("Telefon")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "telephonecontact"
id: telephonecontact
Layout.fillWidth: true
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
validator: RegularExpressionValidator
{
regularExpression: /([+0-9]{1})([0-9]{1,17})/
}
}
Label
{
text: qsTr("Geburtsdatum")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "birthday"
id: birthday
Layout.fillWidth: true
placeholderText: qsTr("TT.MM.JJJJ")
validator: RegularExpressionValidator
{
regularExpression: /((^|)(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]))\.((^|)(0[1-9]{1}|1[0-2]{1}))\.((^|)(196[0-9]{1}|19[7-9]{1}[0-9]{1}|20[0-9]{2}))/
}
Keys.onPressed: (event)=>
{
if (event.key !== Qt.Key_Backspace)
{
var len = birthday.length
var bd = birthday.text
if (len === 2 || len === 5) birthday.text = bd + "."
}
}
}
Label
{
text: qsTr("Priorität")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
property string name: "rank"
id: rank
Layout.fillWidth: true
editable: false
model: ["Nein", "Ja"]
}
Label
{
text: qsTr("Rechnung")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
property string name: "invoice"
id: invoice
Layout.fillWidth: true
editable: false
objectName: "combo"
model: ["Nein", "Ja"]
}
Label
{
text: qsTr("Mahnung")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
property string name: "due"
id: due
Layout.fillWidth: true
editable: false
model: ["Nein", "Ja"]
}
}
function checkContactField()
{
if (!firstname.text.trim() || !lastname.text.trim())
{
return false
}
else
{
return true
}
}
}