Add Customer/Object/Employee working - DEBUGGING anchor Errors done
This commit is contained in:
255
Gui/Objects/AddNewObject.qml
Normal file
255
Gui/Objects/AddNewObject.qml
Normal file
@@ -0,0 +1,255 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
GridLayout
|
||||
{
|
||||
id: newObject
|
||||
|
||||
columns: 4
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
rowSpacing: 9
|
||||
|
||||
|
||||
//// New grid row
|
||||
Label
|
||||
{
|
||||
text: qsTr("Land")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
visible: false
|
||||
|
||||
}
|
||||
|
||||
ComboBox
|
||||
{
|
||||
property string name: "country"
|
||||
id: country
|
||||
Layout.fillWidth: true
|
||||
editable: true
|
||||
// onEditTextChanged: checkFields()
|
||||
// onCurrentTextChanged: checkFields()
|
||||
model: address_model
|
||||
textRole: "country"
|
||||
popup.height: 300
|
||||
currentIndex: 37
|
||||
visible: false
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("PLZ")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
|
||||
validator: RegularExpressionValidator
|
||||
{
|
||||
regularExpression: /([0-9]{1,5})/
|
||||
}
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Ort")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Straße*")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
property string name: "street"
|
||||
id: street
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
onTextChanged: checkFields()
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Nr.*")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
property string name: "houseno"
|
||||
id: houseno
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
onTextChanged: checkFields()
|
||||
}
|
||||
|
||||
// New grid row
|
||||
|
||||
|
||||
|
||||
// New grid row
|
||||
Label
|
||||
{
|
||||
text: qsTr("Parteien")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
SpinBox
|
||||
{
|
||||
property string name: "units"
|
||||
id: partitions
|
||||
Layout.fillWidth: true
|
||||
from: 1
|
||||
to: 100
|
||||
value: 1
|
||||
editable: true
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Stockwerke")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
SpinBox
|
||||
{
|
||||
property string name: "floors"
|
||||
id: floors
|
||||
Layout.fillWidth: true
|
||||
from: 1
|
||||
to: 100
|
||||
value: 1
|
||||
editable: true
|
||||
}
|
||||
|
||||
// New grid row
|
||||
Label
|
||||
{
|
||||
text: qsTr("Zwischenetage")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
ComboBox
|
||||
{
|
||||
property string name: "mezzanin"
|
||||
id: mezzanin
|
||||
Layout.fillWidth: true
|
||||
editable: false
|
||||
model: [qsTr("Ja"), qsTr("Nein")]
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Aufzug")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
ComboBox
|
||||
{
|
||||
property string name: "lift"
|
||||
id: lift
|
||||
Layout.fillWidth: true
|
||||
editable: false
|
||||
model: [qsTr("Ja"), qsTr("Nein")]
|
||||
}
|
||||
|
||||
//New grid row
|
||||
Label
|
||||
{
|
||||
text: qsTr("Objekt-Nr.")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
TextField
|
||||
{
|
||||
property string name: "objectno"
|
||||
id: objectno
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
placeholderText: qsTr("0 oder leer um eine Nummer automatisch zu generieren")
|
||||
placeholderTextColor: "pink"
|
||||
}
|
||||
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Besonderheiten")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
TextField
|
||||
{
|
||||
property string name: "remarks"
|
||||
id: remarks
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
//// New grid row
|
||||
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Reinigungsmittel wo?*")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
property string name: "cleaningproducts"
|
||||
id: cleaningproducts
|
||||
Layout.fillWidth: true
|
||||
onTextChanged: checkFields()
|
||||
}
|
||||
Item
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
function checkObjectField()
|
||||
{
|
||||
|
||||
return street.text.trim() && houseno.text.trim() &&
|
||||
|
||||
(postcode.editText.trim() || postcode.currentText.trim()) &&
|
||||
(city.editText.trim() || city.currentText.trim()) &&
|
||||
cleaningproducts.text.trim()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
155
Gui/Objects/AddObject.qml
Normal file
155
Gui/Objects/AddObject.qml
Normal file
@@ -0,0 +1,155 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Dialogs
|
||||
import Js
|
||||
|
||||
ColumnLayout
|
||||
{
|
||||
property var new_object: null
|
||||
//property alias checkAddContact: checkAddContact
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 15
|
||||
Label
|
||||
{
|
||||
text: qsTr("Objekt anlegen")
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
font.pixelSize: 35
|
||||
}
|
||||
CheckBox
|
||||
{
|
||||
id: checkAddObjectContact
|
||||
text: qsTr("Ansprechpartner hinzufügen")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
checked: false
|
||||
onCheckStateChanged:
|
||||
{
|
||||
checkFields()
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout
|
||||
{
|
||||
id: addObject
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 45
|
||||
|
||||
Frame
|
||||
{
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
AddNewObject
|
||||
{
|
||||
id: newObject
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
ObjectAddOns
|
||||
{
|
||||
id: addObjectLayout
|
||||
visible: checkAddObjectContact.checked
|
||||
}
|
||||
}
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Button
|
||||
{
|
||||
text: qsTr("Abbrechen")
|
||||
onClicked: contentStack.pop()
|
||||
}
|
||||
Button
|
||||
{
|
||||
property var new_object: null
|
||||
id: saveBtn
|
||||
text: qsTr("Speichern")
|
||||
enabled: false
|
||||
onClicked:
|
||||
|
||||
{
|
||||
|
||||
new_object = JsLib.parseForm(newObject)
|
||||
// For Debugging
|
||||
console.log(JSON.stringify(new_object))
|
||||
//
|
||||
new_object['lift'] = new_object['lift'] === 'Ja' ? 1 : 0
|
||||
new_object['mezzanin'] = new_object['mezzanin'] === 'Ja' ? 1 : 0
|
||||
object_model.addObject(new_object)
|
||||
}
|
||||
}
|
||||
}
|
||||
Item
|
||||
{
|
||||
id: spacer3
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
//object_model.objectAdded.connect(onObjectAdded)
|
||||
//contact_model.objectContactAdded.connect(onObjectContact)
|
||||
}
|
||||
|
||||
|
||||
Connections
|
||||
{
|
||||
target: object_model
|
||||
|
||||
function onObjectIdReady()
|
||||
{
|
||||
var obj_id = arguments[0]
|
||||
if (checkAddObjectContact.checked && obj_id)
|
||||
{
|
||||
var new_objecto = addObjectLayout.getForm()
|
||||
contact_model.addObjectContact(new_objecto, obj_id)
|
||||
object_model.viewCriterion("Alle")
|
||||
}
|
||||
|
||||
contentStack.pop()
|
||||
}
|
||||
}
|
||||
|
||||
// function onObjectAdded(added, oid)
|
||||
// {
|
||||
// if (!added)
|
||||
// console.log(qsTr("Fehler beim Objekt-Anlegen!"))
|
||||
// if (checkAddObjectContact.checked && oid)
|
||||
// {
|
||||
// var new_objecto = addObjectLayout.getForm()
|
||||
|
||||
// contact_model.addObjectContact(new_objecto, oid)
|
||||
// }
|
||||
// else appLoader.source = "ObjectTable.qml"
|
||||
// }
|
||||
|
||||
// function onObjectContact(added)
|
||||
// {
|
||||
// if (!added)
|
||||
// console.log(qsTr("Fehler beim Objekt-Kontakt-Anlegen!"))
|
||||
// else
|
||||
// {
|
||||
// //object_model.viewCriterion("Alle")
|
||||
// appLoader.source = "ObjectTable.qml"
|
||||
// }
|
||||
// }
|
||||
|
||||
function checkFields()
|
||||
{
|
||||
if(checkAddObjectContact.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
|
||||
}
|
||||
}
|
||||
130
Gui/Objects/AddObjectEmployee.qml
Normal file
130
Gui/Objects/AddObjectEmployee.qml
Normal file
@@ -0,0 +1,130 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
ApplicationWindow
|
||||
{
|
||||
id: addMitarbeiter
|
||||
title: qsTr("Objekt - Neuer Mitarbeiter")
|
||||
|
||||
ColumnLayout
|
||||
{
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
Label
|
||||
{
|
||||
text: qsTr("Mitarbeiter zuweisen")
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
font.pixelSize: 35
|
||||
}
|
||||
|
||||
GridLayout
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
columns: 2
|
||||
rowSpacing: 4
|
||||
columnSpacing: 6
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Eingesetzter Mitarbeiter")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
ComboBox
|
||||
{
|
||||
id: assignee
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Lohn Mitarbeiter pro Stunde")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
TextField
|
||||
{
|
||||
id: wage
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Einsatzdauer")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
TextField
|
||||
{
|
||||
id: duration
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Reinigungstage")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
TextField
|
||||
{
|
||||
id: cleanDays
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Tätigkeiten")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
TextField
|
||||
{
|
||||
id: tasks
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Ertrag")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
TextField
|
||||
{
|
||||
id: output
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Item
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
}
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
spacing: 5
|
||||
Item
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Button
|
||||
{
|
||||
text: qsTr("Abbrechen")
|
||||
onClicked: addMitarbeiter.close()
|
||||
}
|
||||
Button
|
||||
{
|
||||
text: qsTr("Hinzufügen")
|
||||
onClicked:
|
||||
{
|
||||
if (duration.text.trim() !== "" && wage.text.trim() !== "" && cleanDays.text.trim() !== "" && tasks.text.trim() !== "" && output.text.trim() !== "")
|
||||
{
|
||||
var ne = {
|
||||
"assignee": assignee.currentText,
|
||||
"duration": duration.text.trim(),
|
||||
"wage": wage.text.trim(),
|
||||
"cleandays": cleanDays.text.trim(),
|
||||
"tasks": tasks.text.trim(),
|
||||
"output": output.text.trim(),
|
||||
};
|
||||
addMitarbeiter.addNewEmployee(ne)
|
||||
addMitarbeiter.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signal addNewEmployee(var new_employee)
|
||||
}
|
||||
317
Gui/Objects/ObjectAddOnContactPerson.qml
Normal file
317
Gui/Objects/ObjectAddOnContactPerson.qml
Normal file
@@ -0,0 +1,317 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
GridLayout
|
||||
{
|
||||
property var contacts: null
|
||||
columns: 2
|
||||
Layout.fillWidth: true
|
||||
Label
|
||||
{
|
||||
text: qsTr("Position")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
}
|
||||
|
||||
ComboBox
|
||||
{
|
||||
//property string name: "contacttype"
|
||||
id: posizion
|
||||
Layout.fillWidth: true
|
||||
editable: false
|
||||
model: [qsTr("Beirat"), qsTr("Hausmeister"), qsTr("Hausbewohner"), qsTr("Sonstiges")]
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Anrede")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
ComboBox
|
||||
{
|
||||
id: title
|
||||
model: [qsTr("Herr"), qsTr("Frau"), qsTr("Keine Angabe")]
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Vorname*")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
TextField
|
||||
{
|
||||
id: firstname
|
||||
Layout.fillWidth: true
|
||||
// onTextChanged: checkContactFields()
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Nachname*")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
TextField
|
||||
{
|
||||
id: lastname
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: mobile.text ? qsTr("Telefonnummer") : qsTr("Telefonnummer*")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
TextField
|
||||
{
|
||||
id: phonenumber
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: phonenumber.text ? qsTr("Mobil") : qsTr("Mobil*")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
TextField
|
||||
{
|
||||
id: mobile
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
|
||||
Item
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
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
|
||||
console.log(contacts)
|
||||
}
|
||||
checkFields()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: addContact
|
||||
text: qsTr("Hinzufügen")
|
||||
enabled: firstname.text.trim() && lastname.text.trim() && (phonenumber.text.trim() || mobile.text.trim()) && (contacts === null || Object.keys(contacts).length < 3)
|
||||
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() !== "" || mobile.text.trim() !== ""))
|
||||
{
|
||||
contacts[num_contacts] = {}
|
||||
contacts[num_contacts]["title"] = title.currentText
|
||||
contacts[num_contacts]["position"] = posizion.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()
|
||||
contactModel.append({name: title.currentText + " " + firstname.text.trim() + " " + lastname.text.trim(), phone: phonenumber.text.trim(), mobile: mobile.text.trim(), posizion: posizion.currentText})
|
||||
if (checkFields())
|
||||
{
|
||||
saveBtn.enabled = true
|
||||
}
|
||||
firstname.text = ""
|
||||
lastname.text = ""
|
||||
phonenumber.text = ""
|
||||
mobile.text = ""
|
||||
posizion.currentIndex = 0
|
||||
title.currentIndex = 0
|
||||
|
||||
removeContact.enabled = true
|
||||
checkFields()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Ansprechpartner")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
}
|
||||
|
||||
ListModel
|
||||
{
|
||||
id: contactModel
|
||||
}
|
||||
|
||||
// Component
|
||||
// {
|
||||
// id: headline
|
||||
// Row
|
||||
// {
|
||||
// spacing: 9
|
||||
// Text
|
||||
// {
|
||||
// id: cpname
|
||||
// text: qsTr("Name")
|
||||
// font.bold: true
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// color: "white"
|
||||
// }
|
||||
|
||||
// Text
|
||||
// {
|
||||
// id: cpphone
|
||||
// text: qsTr("Telefon")
|
||||
// font.bold: true
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// color: "white"
|
||||
// }
|
||||
|
||||
// Text
|
||||
// {
|
||||
// id: cpmobile
|
||||
// text: qsTr("Mobil")
|
||||
// font.bold: true
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// color: "white"
|
||||
// }
|
||||
|
||||
// Text
|
||||
// {
|
||||
// id: cppos
|
||||
// text: qsTr("Position")
|
||||
// font.bold: true
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// color: "white"
|
||||
// }
|
||||
|
||||
// Text
|
||||
// {
|
||||
// id: cttype
|
||||
// text: qsTr("Typ")
|
||||
// font.bold: true
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// color: "white"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Component
|
||||
{
|
||||
id: highlight
|
||||
Rectangle
|
||||
{
|
||||
width: parent.width
|
||||
color: "lightsteelblue"; radius: 5
|
||||
y: contactView.currentItem.y
|
||||
Behavior on y
|
||||
{
|
||||
SpringAnimation
|
||||
{
|
||||
spring: 3
|
||||
damping: 0.2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: mainRect
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 100
|
||||
color: firstname.palette.base
|
||||
border.color: firstname.activeFocus? firstname.palette.highlight: firstname.palette.base
|
||||
clip: true
|
||||
|
||||
ScrollView
|
||||
{
|
||||
id: objContactView
|
||||
// Layout.fillWidth: true
|
||||
// Layout.preferredHeight: 100
|
||||
//Layout.columnSpan: 3
|
||||
anchors.fill: mainRect
|
||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
|
||||
|
||||
|
||||
ListView
|
||||
{
|
||||
id: contactView
|
||||
anchors.fill: objContactView
|
||||
// implicitHeight: objContactView.height
|
||||
// implicitWidth: objContactView.width
|
||||
model: contactModel
|
||||
// header: headline
|
||||
highlight: Rectangle { color: "slategray"; radius: 3}
|
||||
highlightFollowsCurrentItem: false
|
||||
//focus: true test
|
||||
onActiveFocusChanged: if(!focus) currentIndex = -1
|
||||
delegate: Item
|
||||
{
|
||||
width: contactView.width
|
||||
height: 77
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked:
|
||||
{
|
||||
contactView.currentIndex = index
|
||||
contactView.highlightFollowsCurrentItem = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Column
|
||||
{
|
||||
anchors.margins: 5
|
||||
|
||||
//spacing: 3
|
||||
Text
|
||||
{
|
||||
text: '<b>' + qsTr('Name: ') + '</b>' + model.name
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: '<b>' + qsTr('Telefon: ') + '</b>' + model.phone
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: '<b>' + qsTr('Handy: ') + '</b>' + model.mobile
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: '<b>' + qsTr('Position: ') + '</b>' + model.posizion
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
|
||||
} // Column
|
||||
} // delegate
|
||||
} // Listview
|
||||
} // Scrollview
|
||||
}
|
||||
}
|
||||
|
||||
125
Gui/Objects/ObjectAddOnEmployee.qml
Normal file
125
Gui/Objects/ObjectAddOnEmployee.qml
Normal file
@@ -0,0 +1,125 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
GridLayout
|
||||
{
|
||||
// property var employeeForm: null
|
||||
// property var employees: null
|
||||
// id: oaoemployee
|
||||
// columns: 2
|
||||
// rows: 4
|
||||
// Label
|
||||
// {
|
||||
// text: qsTr("Mitarbeiter")
|
||||
// Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
// }
|
||||
|
||||
// ListModel
|
||||
// {
|
||||
// id: employeeModel
|
||||
// }
|
||||
|
||||
// Component
|
||||
// {
|
||||
// id: employeesHeader
|
||||
// Row
|
||||
// {
|
||||
// Text
|
||||
// {
|
||||
// id: empName
|
||||
// text: qsTr("Mitarbeiter")
|
||||
// width: 175
|
||||
// font.bold: true
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// color: "black"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// Rectangle
|
||||
// {
|
||||
// Layout.fillWidth: true
|
||||
// implicitHeight: 75
|
||||
// Layout.rowSpan: 2
|
||||
// color: mitarbeiterhin.palette.base
|
||||
// border.color: mitarbeiterhin.activeFocus? mitarbeiterhin.palette.highlight: mitarbeiterhin.palette.base
|
||||
// ListView
|
||||
// {
|
||||
// id: employeesList
|
||||
// //anchors.fill: parent
|
||||
// implicitHeight: parent.height
|
||||
|
||||
// model: employeeModel
|
||||
|
||||
// header: employeesHeader
|
||||
|
||||
// delegate: Row
|
||||
// {
|
||||
// width: 200
|
||||
// height: 15
|
||||
// //padding: 7
|
||||
// Text
|
||||
// {
|
||||
// text: model.namens
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// RowLayout
|
||||
// {
|
||||
// Layout.columnSpan: 2
|
||||
// Layout.fillWidth: true
|
||||
// Item
|
||||
// {
|
||||
// Layout.fillWidth: true
|
||||
// }
|
||||
|
||||
// Button
|
||||
// {
|
||||
// id: mitarbeiterraus
|
||||
// text: qsTr("Mitarbeiter entfernen")
|
||||
// }
|
||||
|
||||
// Button
|
||||
// {
|
||||
// id: mitarbeiterhin
|
||||
// text: qsTr("Mitarbeiter hinzufügen")
|
||||
// onClicked:
|
||||
// {
|
||||
// var nm = Qt.createComponent("AddObjectEmployee.qml")
|
||||
// if (nm.status === Component.Ready)
|
||||
// {
|
||||
// employeeForm = nm.createObject (appWindow, {width: 600, height: 400})
|
||||
// employeeForm.addNewEmployee.connect(onAddEmployee)
|
||||
// employeeForm.show()
|
||||
// }
|
||||
// else console.log(nm.errorString())
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// function onAddEmployee(new_employee)
|
||||
// {
|
||||
// var num_employees = 0
|
||||
|
||||
// if (employees === null || employees === undefined) employees = {}
|
||||
// else num_employees = Object.keys(employees).length;
|
||||
|
||||
// employees[num_employees] = {}
|
||||
// employees[num_employees]["assignee"] = new_employee["assignee"];
|
||||
// employees[num_employees]["duration"] = new_employee["duration"];
|
||||
// employees[num_employees]["wage"] = new_employee["wage"];
|
||||
// employees[num_employees]["cleandays"] = new_employee["cleandays"];
|
||||
// employees[num_employees]["tasks"] = new_employee["tasks"];
|
||||
// employees[num_employees]["output"] = new_employee["output"];
|
||||
|
||||
// employeeModel.append({namens: new_employee["assignee"]});
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
28
Gui/Objects/ObjectAddOns.qml
Normal file
28
Gui/Objects/ObjectAddOns.qml
Normal file
@@ -0,0 +1,28 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Js
|
||||
|
||||
Frame
|
||||
{
|
||||
property alias contactPerson: oaocontactperson
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
ColumnLayout
|
||||
{
|
||||
id: addObjectLayout
|
||||
width: parent.width
|
||||
ObjectAddOnContactPerson
|
||||
{
|
||||
id: oaocontactperson
|
||||
}
|
||||
Item
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
function getForm()
|
||||
{
|
||||
return oaocontactperson.contacts
|
||||
}
|
||||
}
|
||||
27
Gui/Objects/ObjectDetails.qml
Normal file
27
Gui/Objects/ObjectDetails.qml
Normal file
@@ -0,0 +1,27 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
Item
|
||||
{
|
||||
property int selectedObject: -1
|
||||
id: obDet
|
||||
ColumnLayout
|
||||
{
|
||||
Label
|
||||
{
|
||||
text: qsTr("Ausgewählter Objekt " + selectedObject)
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
text: qsTr("Zurück zu den Objekten")
|
||||
onClicked: contentStack.pop()
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
object_model.onRowClicked(selectedObject)
|
||||
}
|
||||
}
|
||||
238
Gui/Objects/ObjectView.qml
Normal file
238
Gui/Objects/ObjectView.qml
Normal file
@@ -0,0 +1,238 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
GridLayout
|
||||
{
|
||||
id: objectView
|
||||
|
||||
columns: 4
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
rowSpacing: 9
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Firma")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
ComboBox
|
||||
{
|
||||
property string name: "business"
|
||||
id: business
|
||||
editable: true
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 3
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Straße*")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
property string name: "street"
|
||||
id: street
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
onTextChanged: checkFields()
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Nr.*")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
property string name: "houseno"
|
||||
id: houseno
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
onTextChanged: checkFields()
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("PLZ*")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
property string name: "postcode"
|
||||
id: postcode
|
||||
Layout.fillWidth: true
|
||||
onTextChanged: checkFields()
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Ort")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Lohnanteil inkl. Fahrtkosten")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: lohnanteil
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 3
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Materialanteil")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: materialanteil
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 3
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Zusatz 1")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: zusatz1
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 3
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Zusatz 2")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: zusatz2
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 3
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Gesamt Netto")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{id: gesamtnetto
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 3
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("MwSt")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: mwst
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 3
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Gesamt(Netto+MwSt)")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: gesamt
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 3
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Zahlungsziel")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
ComboBox
|
||||
{
|
||||
property string name: "zahlungsziel"
|
||||
id: zahlungsziel
|
||||
Layout.fillWidth: true
|
||||
editable: false
|
||||
textRole: "display"
|
||||
Layout.columnSpan: 3
|
||||
}
|
||||
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Info")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
}
|
||||
ScrollView
|
||||
{
|
||||
id: infoview
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 110
|
||||
Layout.columnSpan: 3
|
||||
ScrollBar.horizontal: ScrollBar
|
||||
{
|
||||
policy: ScrollBar.AlwaysOn
|
||||
}
|
||||
|
||||
TextArea
|
||||
{
|
||||
id: objectInfo
|
||||
property string name: "objectinfo"
|
||||
implicitWidth: parent.width
|
||||
wrapMode: TextEdit.Wrap
|
||||
background: Rectangle
|
||||
{
|
||||
color: objectInfo.palette.base
|
||||
border.color: objectInfo.activeFocus? objectInfo.palette.highlight: objectInfo.palette.base
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
}
|
||||
Item
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
186
Gui/Objects/ObjectsTable.qml
Normal file
186
Gui/Objects/ObjectsTable.qml
Normal file
@@ -0,0 +1,186 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Qt.labs.qmlmodels
|
||||
|
||||
ColumnLayout
|
||||
{
|
||||
property var availableFilters: [""]
|
||||
|
||||
|
||||
spacing: Dimensions.l
|
||||
|
||||
function viewCriterion(criterion)
|
||||
{
|
||||
business_model.viewCriterion(criterion.text);
|
||||
}
|
||||
function onObjectContactAdded(added)
|
||||
{
|
||||
console.log(added)
|
||||
if (added) object_model.viewCriterion("")
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
contact_model.objectContactAdded.connect(onObjectContactAdded)
|
||||
// contentStack.pop()
|
||||
}
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
spacing: Dimensions.l
|
||||
SearchBar
|
||||
{
|
||||
}
|
||||
QuickFilter {
|
||||
onSelectedChanged: (name) => {
|
||||
business_model.viewCriterion(name)
|
||||
}
|
||||
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
|
||||
name: "Alle"
|
||||
text: qsTr("Alle")
|
||||
selected: true
|
||||
}
|
||||
ListElement {
|
||||
name: "Aktiv"
|
||||
text: qsTr("Aktiv")
|
||||
selected: false
|
||||
}
|
||||
ListElement {
|
||||
name: "Ehemalig"
|
||||
text: qsTr("Ehemalig")
|
||||
selected: false
|
||||
}
|
||||
ListElement {
|
||||
name: "Angebote"
|
||||
text: qsTr("Angebote")
|
||||
selected: false
|
||||
}
|
||||
}
|
||||
}
|
||||
Button
|
||||
{
|
||||
id: addObjectBtn
|
||||
icon.source: "qrc:/images/PlusCircle.svg"
|
||||
text: qsTr("Objekt Hinzufügen")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
onClicked: contentStack.push("AddObject.qml")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ColumnLayout
|
||||
{
|
||||
id: tableColumn
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.verticalStretchFactor: 1
|
||||
clip: true
|
||||
// anchors
|
||||
// {
|
||||
// top: searchBar.bottom
|
||||
// bottom: parent.bottom
|
||||
// left: parent.left
|
||||
// right: parent.right
|
||||
// topMargin: 15
|
||||
// }
|
||||
HorizontalHeaderView
|
||||
{
|
||||
id: horizontalHeaderview
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 40
|
||||
movableColumns: true //@disable-check M16
|
||||
syncView: objectTable
|
||||
|
||||
delegate: Rectangle {
|
||||
color: addObjectBtn.palette.alternateBase
|
||||
border.color: addObjectBtn.palette.base
|
||||
implicitHeight: 40
|
||||
Layout.fillWidth: true
|
||||
implicitWidth: 1
|
||||
Text
|
||||
{
|
||||
text: model.display
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: addObjectBtn.palette.text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TableView
|
||||
{
|
||||
property real newWidth: 0
|
||||
id: objectTable
|
||||
z: 1
|
||||
// height: tableColumn.height - horizontalHeaderview.height
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
columnSpacing: 1
|
||||
rowSpacing: 2
|
||||
model: object_model
|
||||
alternatingRows: true
|
||||
resizableColumns: true // @disable-check M16
|
||||
selectionBehavior: TableView.SelectRows
|
||||
ScrollBar.vertical: ScrollBar
|
||||
{
|
||||
policy: objectTable.contentHeight > objectTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
||||
}
|
||||
selectionModel: ItemSelectionModel
|
||||
{
|
||||
id: obmodel
|
||||
model: objectTable.model
|
||||
}
|
||||
|
||||
delegate:Rectangle
|
||||
{
|
||||
required property bool selected
|
||||
required property bool current
|
||||
implicitWidth: objectTable.width / objectTable.columns
|
||||
implicitHeight: 25
|
||||
color: selected
|
||||
? addObjectBtn.palette.highlight //palette.highlight
|
||||
: (objectTable.alternatingRows && row % 2 !== 0
|
||||
? addObjectBtn.palette.base // palette.base
|
||||
: addObjectBtn.palette.alternateBase) //palette.alternateBase)
|
||||
|
||||
Text
|
||||
{
|
||||
text: (model.display === null || model.display === undefined)? "": model.display
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
leftPadding: 9 //@d isable-check M16
|
||||
color: addObjectBtn.palette.text
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
property bool hovered: false
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onDoubleClicked:
|
||||
{
|
||||
contentStack.push("ObjectDetails.qml", {selectedObject: row});
|
||||
}
|
||||
onEntered:
|
||||
{
|
||||
objectTable.selectionModel.select(objectTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
1
Gui/Objects/qmldir
Normal file
1
Gui/Objects/qmldir
Normal file
@@ -0,0 +1 @@
|
||||
module Objects
|
||||
Reference in New Issue
Block a user