Änderungen letzt Woche
This commit is contained in:
@@ -23,6 +23,8 @@ GridLayout
|
||||
editable: true
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 3
|
||||
onEditTextChanged: checkFields()
|
||||
onCurrentTextChanged: checkFields()
|
||||
}
|
||||
|
||||
//// New grid row
|
||||
@@ -73,6 +75,21 @@ GridLayout
|
||||
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
|
||||
popup.y: postcode.y + 5 - (postcode.height * 2)
|
||||
currentIndex: -1
|
||||
onCurrentIndexChanged: city.currentIndex = postcode.currentIndex
|
||||
|
||||
validator: RegularExpressionValidator
|
||||
{
|
||||
regularExpression: /([0-9]{1,5})/
|
||||
}
|
||||
}
|
||||
|
||||
Label
|
||||
@@ -106,7 +123,8 @@ GridLayout
|
||||
|
||||
SpinBox
|
||||
{
|
||||
id: parteien
|
||||
property string name: "partitions"
|
||||
id: partitions
|
||||
Layout.fillWidth: true
|
||||
from: 1
|
||||
to: 100
|
||||
@@ -121,6 +139,7 @@ GridLayout
|
||||
|
||||
SpinBox
|
||||
{
|
||||
property string name: "floors"
|
||||
id: floors
|
||||
Layout.fillWidth: true
|
||||
from: 1
|
||||
@@ -161,61 +180,7 @@ GridLayout
|
||||
|
||||
//New grid row
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Fenster")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
ComboBox
|
||||
{
|
||||
property string name: "windows"
|
||||
id: windows
|
||||
Layout.fillWidth: true
|
||||
editable: false
|
||||
model: [qsTr("Jööö"), qsTr("Nöööööööööööööööööööööööööö")]
|
||||
onCurrentIndexChanged: nrWindows.enabled = (windows.currentIndex === 0)? true: false
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Anzahl")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
SpinBox
|
||||
{
|
||||
id: nrWindows
|
||||
Layout.fillWidth: true
|
||||
from: 0
|
||||
to: 100
|
||||
value: 0
|
||||
}
|
||||
|
||||
// New grid row
|
||||
CheckBox
|
||||
{
|
||||
id: ladder
|
||||
text: qsTr("Leiter")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
checked: false
|
||||
onCheckStateChanged:
|
||||
{
|
||||
//checkFields()
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox
|
||||
{
|
||||
id: accessible
|
||||
text: qsTr("Erreichbar")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
checked: false
|
||||
onCheckStateChanged:
|
||||
{
|
||||
//checkFields()
|
||||
}
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
@@ -234,7 +199,7 @@ GridLayout
|
||||
//// New grid row
|
||||
Label
|
||||
{
|
||||
text: qsTr("kontaktdaten")
|
||||
text: qsTr("Kontaktdaten")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
}
|
||||
|
||||
@@ -249,22 +214,32 @@ GridLayout
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Reingunsmittel wo?")
|
||||
text: qsTr("Reinigungsmittel wo?")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
property string name: "cleansing"
|
||||
id: cleamsing
|
||||
id: cleansing
|
||||
Layout.fillWidth: true
|
||||
placeholderText: "Pflichtfeld"
|
||||
placeholderTextColor: "red"
|
||||
onTextChanged: checkFields()
|
||||
}
|
||||
Item
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
function checkObjectField()
|
||||
{
|
||||
return ((business.editText.trim() || business.currentText.trim()) &&
|
||||
street.text.trim() && houseno.text.trim() &&
|
||||
(postcode.editText.trim() || postcode.currentText.trim()) &&
|
||||
(city.editText.trim() || city.currentText.trim()) &&
|
||||
cleansing.text.trim())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,19 +20,19 @@ ColumnLayout
|
||||
}
|
||||
CheckBox
|
||||
{
|
||||
id: checkAddObject
|
||||
id: checkAddContact
|
||||
text: qsTr("Ansprechpartner hinzufügen")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
checked: false
|
||||
onCheckStateChanged:
|
||||
{
|
||||
//checkFields()
|
||||
checkFields()
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout
|
||||
{
|
||||
id: addobject
|
||||
id: addObject
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 45
|
||||
@@ -51,7 +51,7 @@ ColumnLayout
|
||||
ObjectAddOns
|
||||
{
|
||||
id: addObjectLayout
|
||||
visible: checkAddObject.checked
|
||||
visible: checkAddContact.checked
|
||||
}
|
||||
}
|
||||
RowLayout
|
||||
@@ -65,24 +65,25 @@ ColumnLayout
|
||||
}
|
||||
Button
|
||||
{
|
||||
property var new_object: null
|
||||
id: saveBtn
|
||||
text: qsTr("Speichern")
|
||||
enabled: false
|
||||
onClicked:
|
||||
{
|
||||
if (!checkAddObject.checked)
|
||||
if (!checkAddContact.checked)
|
||||
{
|
||||
new_object = JsLib.parseForm(objectView)
|
||||
// object_model.addObject(new_object, 0)
|
||||
// appLoader.source = "ObjectTable.qml"
|
||||
console.log(new_object)
|
||||
var list = []
|
||||
new_object = JsLib.parseForm(newObject)
|
||||
object_model.addObject(new_object, list)
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
new_object = JsLib.parseForm(objectView)
|
||||
var new_objecto = JsLib.parseForm(addObjectLayout)
|
||||
console.log(new_objecto)
|
||||
//objecto_model.addObject(new_objecto)
|
||||
new_object = JsLib.parseForm(newObject)
|
||||
var new_objecto = addObjectLayout.getForm()
|
||||
object_model.addObject(new_object, new_objecto)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,18 +108,18 @@ ColumnLayout
|
||||
// }
|
||||
// }
|
||||
|
||||
// function checkFields()
|
||||
// {
|
||||
// if(checkAddObject.checked)
|
||||
// {
|
||||
// if(!objectView.checkObjectField() || !addObjectLayout.checkObjectField())
|
||||
// saveBtn.enabled = false
|
||||
// else
|
||||
// saveBtn.enabled = true
|
||||
// }
|
||||
// else if (!objectView.checkObjectField())
|
||||
// saveBtn.enabled = false
|
||||
// else
|
||||
// saveBtn.enabled = true
|
||||
// }
|
||||
function checkFields()
|
||||
{
|
||||
if(checkAddContact.checked)
|
||||
{
|
||||
if(!newObject.checkObjectField() || !addObjectLayout.contactPerson.contacts || !addObjectLayout.contactPerson.contacts.length)
|
||||
saveBtn.enabled = false
|
||||
else
|
||||
saveBtn.enabled = true
|
||||
}
|
||||
else if (!newObject.checkObjectField())
|
||||
saveBtn.enabled = false
|
||||
else
|
||||
saveBtn.enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ GridLayout
|
||||
ComboBox
|
||||
{
|
||||
id: title
|
||||
model: [qsTr("Herr"),qsTr("Frau")]
|
||||
model: [qsTr("Herr"), qsTr("Frau"), qsTr("keine Angabe")]
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label
|
||||
@@ -29,6 +29,7 @@ GridLayout
|
||||
Layout.fillWidth: true
|
||||
placeholderText: "Pflichtfeld"
|
||||
placeholderTextColor: "red"
|
||||
// onTextChanged: checkContactFields()
|
||||
}
|
||||
Label
|
||||
{
|
||||
@@ -51,9 +52,26 @@ GridLayout
|
||||
{
|
||||
id: phonenumber
|
||||
Layout.fillWidth: true
|
||||
placeholderText: "Pflichtfeld"
|
||||
placeholderText: mobile.text ? "" : "Pflichtfeld"
|
||||
placeholderTextColor: "red"
|
||||
|
||||
|
||||
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Mobil")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
TextField
|
||||
{
|
||||
id: mobile
|
||||
Layout.fillWidth: true
|
||||
placeholderText: phonenumber.text ? "" : "Pflichtfeld"
|
||||
placeholderTextColor: "red"
|
||||
|
||||
|
||||
|
||||
}
|
||||
Label
|
||||
{
|
||||
@@ -82,32 +100,63 @@ GridLayout
|
||||
{
|
||||
id: removeContact
|
||||
text: qsTr("Entfernen")
|
||||
enabled: false
|
||||
onClicked:
|
||||
{
|
||||
|
||||
if (contactView.highlightFollowsCurrentItem)
|
||||
{
|
||||
delete contacts[contactView.currentIndex]
|
||||
contacts = contacts.filter(elm => elm)
|
||||
contactModel.remove(contactView.currentIndex)
|
||||
contactView.highlightFollowsCurrentItem = false
|
||||
contactView.currentIndex = -1
|
||||
if (Object.keys(contacts).length === 0)
|
||||
{
|
||||
enabled = false
|
||||
}
|
||||
checkFields()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: addContact
|
||||
text: qsTr("Hinzufügen")
|
||||
enabled: firstname.text.trim() && lastname.text.trim() && (phonenumber.text.trim() || mobile.text.trim()) && posizion.text.trim()
|
||||
onClicked:
|
||||
{
|
||||
var num_contacts = 0
|
||||
if (contacts !== null && contacts !== undefined) num_contacts = Object.keys(contacts).length
|
||||
else contacts = {}
|
||||
if (num_contacts < 3 && firstname.text.trim() !== "" && lastname.text.trim() !== "" && phonenumber.text.trim() !== "" && posizion.text.trim() !== "")
|
||||
else contacts = []
|
||||
if (num_contacts < 3 && firstname.text.trim() !== "" && lastname.text.trim() !== "" && (phonenumber.text.trim() !== "" || mobile.text.trim() !== "") && posizion.text.trim() !== "")
|
||||
{
|
||||
contacts[num_contacts] = {}
|
||||
contacts[num_contacts]["title"] = title.currentText
|
||||
contacts[num_contacts]["fname"] = firstname.text.trim()
|
||||
contacts[num_contacts]["lname"] = lastname.text.trim()
|
||||
contacts[num_contacts]["phone"] = phonenumber.text.trim()
|
||||
contacts[num_contacts]["mobile"] = mobile.text.trim()
|
||||
contacts[num_contacts]["position"] = posizion.text.trim()
|
||||
|
||||
contactModel.append({name: title.currentText + " " + firstname.text.trim() + " " + lastname.text.trim(), phone: phonenumber.text.trim(), posizion: posizion.text.trim()})
|
||||
|
||||
contactModel.append({name: title.currentText + " " + firstname.text.trim() + " " + lastname.text.trim(), phone: phonenumber.text.trim(), mobile: mobile.text.trim(), posizion: posizion.text.trim()})
|
||||
if (checkFields())
|
||||
{
|
||||
saveBtn.enabled = true
|
||||
}
|
||||
firstname.text = ""
|
||||
lastname.text = ""
|
||||
phonenumber.text = ""
|
||||
mobile.text = ""
|
||||
posizion.text = ""
|
||||
|
||||
if (Object.keys(contacts).length >= 3)
|
||||
{
|
||||
enabled = false
|
||||
}
|
||||
|
||||
removeContact.enabled = true
|
||||
checkFields()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,7 +185,7 @@ GridLayout
|
||||
width: 175
|
||||
font.bold: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "black"
|
||||
color: "white"
|
||||
}
|
||||
|
||||
Text
|
||||
@@ -146,7 +195,17 @@ GridLayout
|
||||
width: 100
|
||||
font.bold: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "black"
|
||||
color: "white"
|
||||
}
|
||||
|
||||
Text
|
||||
{
|
||||
id: cpmobile
|
||||
text: qsTr("Mobil")
|
||||
width: 100
|
||||
font.bold: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
|
||||
Text
|
||||
@@ -156,29 +215,43 @@ GridLayout
|
||||
width: 150
|
||||
font.bold: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "black"
|
||||
color: "white"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: mainRect
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 100
|
||||
color: firstname.palette.base
|
||||
border.color: firstname.activeFocus? firstname.palette.highlight: firstname.palette.base
|
||||
|
||||
ListView
|
||||
{
|
||||
id: contactView
|
||||
implicitHeight: parent.height
|
||||
implicitWidth: parent.width
|
||||
model: contactModel
|
||||
|
||||
header: headline
|
||||
highlight: Rectangle { color: "grey"}
|
||||
highlightFollowsCurrentItem: false
|
||||
|
||||
onActiveFocusChanged: if(!focus) currentIndex = -1
|
||||
delegate: Item
|
||||
{
|
||||
width: parent.width
|
||||
width: contactView.width
|
||||
height: 15
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked:
|
||||
{
|
||||
contactView.currentIndex = index
|
||||
contactView.highlightFollowsCurrentItem = true
|
||||
}
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
@@ -188,18 +261,28 @@ GridLayout
|
||||
text: model.name
|
||||
width: 175
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: model.phone
|
||||
width: 100
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: model.mobile
|
||||
width: 100
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: model.posizion
|
||||
width: 150
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import "../js/qmldict.js" as JsLib
|
||||
|
||||
Frame
|
||||
{
|
||||
property alias contactPerson: oaocontactperson
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
ColumnLayout
|
||||
@@ -19,4 +21,8 @@ Frame
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
function getForm()
|
||||
{
|
||||
return oaocontactperson.contacts
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user