Änderungen letzt Woche
This commit is contained in:
@@ -23,6 +23,8 @@ GridLayout
|
|||||||
editable: true
|
editable: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 3
|
Layout.columnSpan: 3
|
||||||
|
onEditTextChanged: checkFields()
|
||||||
|
onCurrentTextChanged: checkFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
//// New grid row
|
//// New grid row
|
||||||
@@ -73,6 +75,21 @@ GridLayout
|
|||||||
property string name: "postcode"
|
property string name: "postcode"
|
||||||
id: postcode
|
id: postcode
|
||||||
Layout.fillWidth: true
|
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
|
Label
|
||||||
@@ -106,7 +123,8 @@ GridLayout
|
|||||||
|
|
||||||
SpinBox
|
SpinBox
|
||||||
{
|
{
|
||||||
id: parteien
|
property string name: "partitions"
|
||||||
|
id: partitions
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
from: 1
|
from: 1
|
||||||
to: 100
|
to: 100
|
||||||
@@ -121,6 +139,7 @@ GridLayout
|
|||||||
|
|
||||||
SpinBox
|
SpinBox
|
||||||
{
|
{
|
||||||
|
property string name: "floors"
|
||||||
id: floors
|
id: floors
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
from: 1
|
from: 1
|
||||||
@@ -161,61 +180,7 @@ GridLayout
|
|||||||
|
|
||||||
//New grid row
|
//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
|
Label
|
||||||
{
|
{
|
||||||
@@ -234,7 +199,7 @@ GridLayout
|
|||||||
//// New grid row
|
//// New grid row
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: qsTr("kontaktdaten")
|
text: qsTr("Kontaktdaten")
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,22 +214,32 @@ GridLayout
|
|||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: qsTr("Reingunsmittel wo?")
|
text: qsTr("Reinigungsmittel wo?")
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField
|
TextField
|
||||||
{
|
{
|
||||||
property string name: "cleansing"
|
property string name: "cleansing"
|
||||||
id: cleamsing
|
id: cleansing
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
placeholderText: "Pflichtfeld"
|
placeholderText: "Pflichtfeld"
|
||||||
placeholderTextColor: "red"
|
placeholderTextColor: "red"
|
||||||
|
onTextChanged: checkFields()
|
||||||
}
|
}
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
Layout.fillHeight: true
|
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
|
CheckBox
|
||||||
{
|
{
|
||||||
id: checkAddObject
|
id: checkAddContact
|
||||||
text: qsTr("Ansprechpartner hinzufügen")
|
text: qsTr("Ansprechpartner hinzufügen")
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
checked: false
|
checked: false
|
||||||
onCheckStateChanged:
|
onCheckStateChanged:
|
||||||
{
|
{
|
||||||
//checkFields()
|
checkFields()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout
|
RowLayout
|
||||||
{
|
{
|
||||||
id: addobject
|
id: addObject
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
spacing: 45
|
spacing: 45
|
||||||
@@ -51,7 +51,7 @@ ColumnLayout
|
|||||||
ObjectAddOns
|
ObjectAddOns
|
||||||
{
|
{
|
||||||
id: addObjectLayout
|
id: addObjectLayout
|
||||||
visible: checkAddObject.checked
|
visible: checkAddContact.checked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RowLayout
|
RowLayout
|
||||||
@@ -65,24 +65,25 @@ ColumnLayout
|
|||||||
}
|
}
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
|
property var new_object: null
|
||||||
id: saveBtn
|
id: saveBtn
|
||||||
text: qsTr("Speichern")
|
text: qsTr("Speichern")
|
||||||
enabled: false
|
enabled: false
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
if (!checkAddObject.checked)
|
if (!checkAddContact.checked)
|
||||||
{
|
{
|
||||||
new_object = JsLib.parseForm(objectView)
|
var list = []
|
||||||
// object_model.addObject(new_object, 0)
|
new_object = JsLib.parseForm(newObject)
|
||||||
// appLoader.source = "ObjectTable.qml"
|
object_model.addObject(new_object, list)
|
||||||
console.log(new_object)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new_object = JsLib.parseForm(objectView)
|
new_object = JsLib.parseForm(newObject)
|
||||||
var new_objecto = JsLib.parseForm(addObjectLayout)
|
var new_objecto = addObjectLayout.getForm()
|
||||||
console.log(new_objecto)
|
object_model.addObject(new_object, new_objecto)
|
||||||
//objecto_model.addObject(new_objecto)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,18 +108,18 @@ ColumnLayout
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// function checkFields()
|
function checkFields()
|
||||||
// {
|
{
|
||||||
// if(checkAddObject.checked)
|
if(checkAddContact.checked)
|
||||||
// {
|
{
|
||||||
// if(!objectView.checkObjectField() || !addObjectLayout.checkObjectField())
|
if(!newObject.checkObjectField() || !addObjectLayout.contactPerson.contacts || !addObjectLayout.contactPerson.contacts.length)
|
||||||
// saveBtn.enabled = false
|
saveBtn.enabled = false
|
||||||
// else
|
else
|
||||||
// saveBtn.enabled = true
|
saveBtn.enabled = true
|
||||||
// }
|
}
|
||||||
// else if (!objectView.checkObjectField())
|
else if (!newObject.checkObjectField())
|
||||||
// saveBtn.enabled = false
|
saveBtn.enabled = false
|
||||||
// else
|
else
|
||||||
// saveBtn.enabled = true
|
saveBtn.enabled = true
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ GridLayout
|
|||||||
ComboBox
|
ComboBox
|
||||||
{
|
{
|
||||||
id: title
|
id: title
|
||||||
model: [qsTr("Herr"),qsTr("Frau")]
|
model: [qsTr("Herr"), qsTr("Frau"), qsTr("keine Angabe")]
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
@@ -29,6 +29,7 @@ GridLayout
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
placeholderText: "Pflichtfeld"
|
placeholderText: "Pflichtfeld"
|
||||||
placeholderTextColor: "red"
|
placeholderTextColor: "red"
|
||||||
|
// onTextChanged: checkContactFields()
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
@@ -51,9 +52,26 @@ GridLayout
|
|||||||
{
|
{
|
||||||
id: phonenumber
|
id: phonenumber
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
placeholderText: "Pflichtfeld"
|
placeholderText: mobile.text ? "" : "Pflichtfeld"
|
||||||
placeholderTextColor: "red"
|
placeholderTextColor: "red"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: qsTr("Mobil")
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
}
|
||||||
|
TextField
|
||||||
|
{
|
||||||
|
id: mobile
|
||||||
|
Layout.fillWidth: true
|
||||||
|
placeholderText: phonenumber.text ? "" : "Pflichtfeld"
|
||||||
|
placeholderTextColor: "red"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
@@ -82,32 +100,63 @@ GridLayout
|
|||||||
{
|
{
|
||||||
id: removeContact
|
id: removeContact
|
||||||
text: qsTr("Entfernen")
|
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
|
Button
|
||||||
{
|
{
|
||||||
id: addContact
|
id: addContact
|
||||||
text: qsTr("Hinzufügen")
|
text: qsTr("Hinzufügen")
|
||||||
|
enabled: firstname.text.trim() && lastname.text.trim() && (phonenumber.text.trim() || mobile.text.trim()) && posizion.text.trim()
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
var num_contacts = 0
|
var num_contacts = 0
|
||||||
if (contacts !== null && contacts !== undefined) num_contacts = Object.keys(contacts).length
|
if (contacts !== null && contacts !== undefined) num_contacts = Object.keys(contacts).length
|
||||||
else contacts = {}
|
else contacts = []
|
||||||
if (num_contacts < 3 && firstname.text.trim() !== "" && lastname.text.trim() !== "" && phonenumber.text.trim() !== "" && posizion.text.trim() !== "")
|
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] = {}
|
||||||
contacts[num_contacts]["title"] = title.currentText
|
contacts[num_contacts]["title"] = title.currentText
|
||||||
contacts[num_contacts]["fname"] = firstname.text.trim()
|
contacts[num_contacts]["fname"] = firstname.text.trim()
|
||||||
contacts[num_contacts]["lname"] = lastname.text.trim()
|
contacts[num_contacts]["lname"] = lastname.text.trim()
|
||||||
contacts[num_contacts]["phone"] = phonenumber.text.trim()
|
contacts[num_contacts]["phone"] = phonenumber.text.trim()
|
||||||
|
contacts[num_contacts]["mobile"] = mobile.text.trim()
|
||||||
contacts[num_contacts]["position"] = posizion.text.trim()
|
contacts[num_contacts]["position"] = 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()})
|
||||||
contactModel.append({name: title.currentText + " " + firstname.text.trim() + " " + lastname.text.trim(), phone: phonenumber.text.trim(), posizion: posizion.text.trim()})
|
if (checkFields())
|
||||||
|
{
|
||||||
|
saveBtn.enabled = true
|
||||||
|
}
|
||||||
firstname.text = ""
|
firstname.text = ""
|
||||||
lastname.text = ""
|
lastname.text = ""
|
||||||
phonenumber.text = ""
|
phonenumber.text = ""
|
||||||
|
mobile.text = ""
|
||||||
posizion.text = ""
|
posizion.text = ""
|
||||||
|
|
||||||
|
if (Object.keys(contacts).length >= 3)
|
||||||
|
{
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
removeContact.enabled = true
|
||||||
|
checkFields()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,7 +185,7 @@ GridLayout
|
|||||||
width: 175
|
width: 175
|
||||||
font.bold: true
|
font.bold: true
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
color: "black"
|
color: "white"
|
||||||
}
|
}
|
||||||
|
|
||||||
Text
|
Text
|
||||||
@@ -146,7 +195,17 @@ GridLayout
|
|||||||
width: 100
|
width: 100
|
||||||
font.bold: true
|
font.bold: true
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
color: "black"
|
color: "white"
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
id: cpmobile
|
||||||
|
text: qsTr("Mobil")
|
||||||
|
width: 100
|
||||||
|
font.bold: true
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
color: "white"
|
||||||
}
|
}
|
||||||
|
|
||||||
Text
|
Text
|
||||||
@@ -156,29 +215,43 @@ GridLayout
|
|||||||
width: 150
|
width: 150
|
||||||
font.bold: true
|
font.bold: true
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
color: "black"
|
color: "white"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
|
id: mainRect
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: 100
|
implicitHeight: 100
|
||||||
color: firstname.palette.base
|
color: firstname.palette.base
|
||||||
border.color: firstname.activeFocus? firstname.palette.highlight: firstname.palette.base
|
border.color: firstname.activeFocus? firstname.palette.highlight: firstname.palette.base
|
||||||
|
|
||||||
ListView
|
ListView
|
||||||
{
|
{
|
||||||
id: contactView
|
id: contactView
|
||||||
implicitHeight: parent.height
|
implicitHeight: parent.height
|
||||||
|
implicitWidth: parent.width
|
||||||
model: contactModel
|
model: contactModel
|
||||||
|
|
||||||
header: headline
|
header: headline
|
||||||
|
highlight: Rectangle { color: "grey"}
|
||||||
|
highlightFollowsCurrentItem: false
|
||||||
|
|
||||||
|
onActiveFocusChanged: if(!focus) currentIndex = -1
|
||||||
delegate: Item
|
delegate: Item
|
||||||
{
|
{
|
||||||
width: parent.width
|
width: contactView.width
|
||||||
height: 15
|
height: 15
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
contactView.currentIndex = index
|
||||||
|
contactView.highlightFollowsCurrentItem = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Row
|
Row
|
||||||
{
|
{
|
||||||
@@ -188,18 +261,28 @@ GridLayout
|
|||||||
text: model.name
|
text: model.name
|
||||||
width: 175
|
width: 175
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
color: "white"
|
||||||
}
|
}
|
||||||
Text
|
Text
|
||||||
{
|
{
|
||||||
text: model.phone
|
text: model.phone
|
||||||
width: 100
|
width: 100
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
color: "white"
|
||||||
|
}
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
text: model.mobile
|
||||||
|
width: 100
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
color: "white"
|
||||||
}
|
}
|
||||||
Text
|
Text
|
||||||
{
|
{
|
||||||
text: model.posizion
|
text: model.posizion
|
||||||
width: 150
|
width: 150
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
color: "white"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import "../js/qmldict.js" as JsLib
|
||||||
|
|
||||||
Frame
|
Frame
|
||||||
{
|
{
|
||||||
|
property alias contactPerson: oaocontactperson
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
ColumnLayout
|
ColumnLayout
|
||||||
@@ -19,4 +21,8 @@ Frame
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function getForm()
|
||||||
|
{
|
||||||
|
return oaocontactperson.contacts
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22194
doc/db_schemer_v1.1-pyqcrm-202502191145.sql
Normal file
22194
doc/db_schemer_v1.1-pyqcrm-202502191145.sql
Normal file
File diff suppressed because it is too large
Load Diff
@@ -50,6 +50,19 @@ function parseForm(...form)
|
|||||||
{
|
{
|
||||||
data_form[form[i].children[j].name] = form[i].children[j].checked
|
data_form[form[i].children[j].name] = form[i].children[j].checked
|
||||||
}
|
}
|
||||||
|
else if (form[i].children[j].toString().startsWith("SpinBox"))
|
||||||
|
{
|
||||||
|
data_form[form[i].children[j].name] = form[i].children[j].value
|
||||||
|
}
|
||||||
|
// else if (form[i].children[j].toString().startsWith("QQuickContentItem"))
|
||||||
|
// {
|
||||||
|
// console.log(form[i].children[j].children.children)
|
||||||
|
|
||||||
|
// for (var k = 0; k < form[i].children[j].length; k++)
|
||||||
|
// {
|
||||||
|
// console.log(form[i].children[j].name)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return data_form
|
return data_form
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot, Signal
|
|||||||
from .EmployeeDAO import EmployeeDAO
|
from .EmployeeDAO import EmployeeDAO
|
||||||
from ..PyqcrmFlags import PyqcrmFlags, PyqcrmAppliEmpyFlags
|
from ..PyqcrmFlags import PyqcrmFlags, PyqcrmAppliEmpyFlags
|
||||||
from ..ConfigLoader import ConfigLoader
|
from ..ConfigLoader import ConfigLoader
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
class EmployeeModel(QAbstractTableModel):
|
class EmployeeModel(QAbstractTableModel):
|
||||||
@@ -64,6 +65,8 @@ class EmployeeModel(QAbstractTableModel):
|
|||||||
tr = row[applicant_col] #if type(row[index.column() + 2]) is str else str(row[index.column() + 2], "utf-8")
|
tr = row[applicant_col] #if type(row[index.column() + 2]) is str else str(row[index.column() + 2], "utf-8")
|
||||||
if applicant_col == 2 and self.__everyone:
|
if applicant_col == 2 and self.__everyone:
|
||||||
tr = 'Ja' if tr == 1 else 'Nein'
|
tr = 'Ja' if tr == 1 else 'Nein'
|
||||||
|
else:
|
||||||
|
tr = re.sub("Keine Angabe ","", tr)
|
||||||
#print(f"Data: {tr}")
|
#print(f"Data: {tr}")
|
||||||
# return row[index.column() + 2]
|
# return row[index.column() + 2]
|
||||||
return tr
|
return tr
|
||||||
|
|||||||
26
lib/DB/ObjectDAO.py
Normal file
26
lib/DB/ObjectDAO.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
from .DbManager import DbManager
|
||||||
|
import json
|
||||||
|
import mariadb
|
||||||
|
from PySide6.QtCore import QObject, Signal
|
||||||
|
from ..PyqcrmFlags import PyqcrmAppliEmpyFlags
|
||||||
|
|
||||||
|
|
||||||
|
class ObjectDAO(QObject):
|
||||||
|
newObjectAdded = Signal()
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
#print(f"*** File: {__file__}, __init__()")
|
||||||
|
self.__con = DbManager().getConnection()
|
||||||
|
if self.__con:
|
||||||
|
self.__cur = self.__con.cursor()
|
||||||
|
|
||||||
|
def addObject(self, new_object, new_objcontact, enc_key):
|
||||||
|
try:
|
||||||
|
if self.__cur:
|
||||||
|
self.__cur.callproc("addObject", (json.dumps(new_object), json.dumps(new_objcontact), enc_key,))
|
||||||
|
self.__con.commit()
|
||||||
|
# self.newEmployeeAdded.emit()
|
||||||
|
|
||||||
|
except mariadb.Error as e:
|
||||||
|
print(str(e))
|
||||||
94
lib/DB/ObjectModel.py
Normal file
94
lib/DB/ObjectModel.py
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot, Signal
|
||||||
|
from .ObjectDAO import ObjectDAO
|
||||||
|
from ..PyqcrmFlags import PyqcrmFlags, PyqcrmAppliEmpyFlags
|
||||||
|
from ..ConfigLoader import ConfigLoader
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
class ObjectModel(QAbstractTableModel):
|
||||||
|
__data = None
|
||||||
|
__object_dao = None
|
||||||
|
__visible_index = None
|
||||||
|
__visible_columns = None
|
||||||
|
__col_name = ""
|
||||||
|
__employee_dao = None
|
||||||
|
__col_skip = 2
|
||||||
|
__everyone = True
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.__object_dao = ObjectDAO()
|
||||||
|
self.__object_dao.newObjectAdded.connect(self.__refreshView)
|
||||||
|
self.__conf = ConfigLoader().getConfig()
|
||||||
|
self.__key = self.__conf['pyqcrm']['ENCRYPTION_KEY']
|
||||||
|
#self.__getData()
|
||||||
|
|
||||||
|
@Slot(dict, list, bool)
|
||||||
|
def addObject(self, new_object, new_objcontact):
|
||||||
|
print(new_object)
|
||||||
|
|
||||||
|
print(new_objcontact)
|
||||||
|
|
||||||
|
|
||||||
|
self.__object_dao.addObject(new_object, new_objcontact, self.__key)
|
||||||
|
|
||||||
|
# @Slot(str)
|
||||||
|
# def viewCriterion(self, criterion, processed = False, fired = False):
|
||||||
|
# self.__getData(criterion, processed, fired)
|
||||||
|
|
||||||
|
@Slot()
|
||||||
|
def __refreshView(self):
|
||||||
|
self.__getData()
|
||||||
|
|
||||||
|
# def __getData(self, criterion = "Alle", processed = False, fired = False, every_state = True):
|
||||||
|
# self.beginResetModel()
|
||||||
|
# rows, self.__visible_columns = self.__employee_dao.getEmployees(self.__key, criterion, processed, fired, every_state)
|
||||||
|
# self.__data = rows
|
||||||
|
# self.endResetModel()
|
||||||
|
|
||||||
|
# def rowCount(self, parent= QModelIndex()):
|
||||||
|
# return len (self.__data)
|
||||||
|
|
||||||
|
# def columnCount(self, parent= QModelIndex()):
|
||||||
|
# return len(self.__visible_columns) - self.__col_skip
|
||||||
|
|
||||||
|
# @Slot(str, bool, bool, bool)
|
||||||
|
# def viewCriterion(self, criterion, processed, fired, every_state):
|
||||||
|
# self.__everyone = True if criterion == 'Alle' else False
|
||||||
|
# if self.__everyone and criterion != "Alle":
|
||||||
|
# self.__col_skip = 2
|
||||||
|
# else:
|
||||||
|
# self.__col_skip = 2
|
||||||
|
# self.__getData(criterion, processed, fired, every_state)
|
||||||
|
|
||||||
|
# def data(self, index, role= Qt.DisplayRole):
|
||||||
|
# if role == Qt.DisplayRole:
|
||||||
|
# row = self.__data[index.row()]
|
||||||
|
# applicant_col = index.column() + self.__col_skip
|
||||||
|
# tr = row[applicant_col] #if type(row[index.column() + 2]) is str else str(row[index.column() + 2], "utf-8")
|
||||||
|
# if applicant_col == 2 and self.__everyone:
|
||||||
|
# tr = 'Ja' if tr == 1 else 'Nein'
|
||||||
|
# else:
|
||||||
|
# tr = re.sub("Keine Angabe ","", tr)
|
||||||
|
# #print(f"Data: {tr}")
|
||||||
|
# # return row[index.column() + 2]
|
||||||
|
# return tr
|
||||||
|
# return None
|
||||||
|
|
||||||
|
# def headerData(self, section, orientation, role = Qt.DisplayRole):
|
||||||
|
# if orientation == Qt.Horizontal and role == Qt.DisplayRole:
|
||||||
|
# self.__col_name = self.__visible_columns[section + self.__col_skip]
|
||||||
|
# return self.__col_name
|
||||||
|
# return super().headerData(section, orientation, role)
|
||||||
|
|
||||||
|
# @Slot(int)
|
||||||
|
# def onRowClicked(self, row):
|
||||||
|
# #print(self.__data)
|
||||||
|
# print(f"Selected table row: {row}, corresponding DB ID: {self.__data[row][0]}")
|
||||||
|
# #if not self.__employee_dict['employee'] or self.__data[row][0] != self.__employee_dict['employee']['id']:
|
||||||
|
# #self.__employee = self.__employee_dao.getEmployee(self.__data[row][0], self.__key)
|
||||||
|
# #print(self.__business)
|
||||||
|
# #self.__getEmployeeInfo()
|
||||||
|
# # self.__getContactInfo()
|
||||||
|
# # print(self.__business_dict)
|
||||||
10
main.py
10
main.py
@@ -15,6 +15,7 @@ from lib.DB.AddressModel import AddressModel
|
|||||||
from lib.DB.BTypeModel import BTypeModel
|
from lib.DB.BTypeModel import BTypeModel
|
||||||
from lib.DB.ContactModel import ContactModel
|
from lib.DB.ContactModel import ContactModel
|
||||||
from lib.DB.EmployeeModel import EmployeeModel
|
from lib.DB.EmployeeModel import EmployeeModel
|
||||||
|
from lib.DB.ObjectModel import ObjectModel
|
||||||
from lib.Printers import Printers
|
from lib.Printers import Printers
|
||||||
|
|
||||||
|
|
||||||
@@ -39,12 +40,13 @@ business_model = None
|
|||||||
business_type = None
|
business_type = None
|
||||||
contact_model = None
|
contact_model = None
|
||||||
employee_model = None
|
employee_model = None
|
||||||
|
object_model = None
|
||||||
printers = None
|
printers = None
|
||||||
user = None
|
user = None
|
||||||
|
|
||||||
def initializeProgram():
|
def initializeProgram():
|
||||||
#print(f"In {__file__} file, initializeProgram()")
|
#print(f"In {__file__} file, initializeProgram()")
|
||||||
global address_model, bad_config, business_model, user, business_type, contact_model, employee_model, db_con, printers
|
global address_model, bad_config, business_model, user, business_type, contact_model, employee_model, object_model, db_con, printers
|
||||||
if not bad_config:
|
if not bad_config:
|
||||||
dbconf = config.getConfig()['database']
|
dbconf = config.getConfig()['database']
|
||||||
DbManager(dbconf)
|
DbManager(dbconf)
|
||||||
@@ -57,19 +59,21 @@ def initializeProgram():
|
|||||||
business_type = BTypeModel()
|
business_type = BTypeModel()
|
||||||
contact_model = ContactModel()
|
contact_model = ContactModel()
|
||||||
employee_model = EmployeeModel()
|
employee_model = EmployeeModel()
|
||||||
|
object_model = ObjectModel()
|
||||||
publishContext()
|
publishContext()
|
||||||
|
|
||||||
bad_config = False
|
bad_config = False
|
||||||
|
|
||||||
def publishContext():
|
def publishContext():
|
||||||
# print(f"In {__file__} file, publishContext()")
|
# print(f"In {__file__} file, publishContext()")
|
||||||
global engine, address_model, bad_config, business_model, user, business_type, contact_model, employee_model, printers
|
global engine, address_model, bad_config, business_model, user, business_type, contact_model, object_model, employee_model, printers
|
||||||
engine.rootContext().setContextProperty("loggedin_user", user)
|
engine.rootContext().setContextProperty("loggedin_user", user)
|
||||||
engine.rootContext().setContextProperty("business_model", business_model)
|
engine.rootContext().setContextProperty("business_model", business_model)
|
||||||
engine.rootContext().setContextProperty("address_model", address_model)
|
engine.rootContext().setContextProperty("address_model", address_model)
|
||||||
engine.rootContext().setContextProperty("business_type", business_type)
|
engine.rootContext().setContextProperty("business_type", business_type)
|
||||||
engine.rootContext().setContextProperty("contact_model", contact_model)
|
engine.rootContext().setContextProperty("contact_model", contact_model)
|
||||||
engine.rootContext().setContextProperty("employee_model", employee_model)
|
engine.rootContext().setContextProperty("employee_model", employee_model)
|
||||||
|
engine.rootContext().setContextProperty("object_model", object_model)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
#QResource.registerResource("rc_qml.py")
|
#QResource.registerResource("rc_qml.py")
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
"lib/DB/EmployeeModel.py",
|
"lib/DB/EmployeeModel.py",
|
||||||
"lib/DB/EmployeeDAO.py",
|
"lib/DB/EmployeeDAO.py",
|
||||||
"lib/Printers.py",
|
"lib/Printers.py",
|
||||||
"lib/PyqcrmPDF.py"
|
"lib/PyqcrmPDF.py",
|
||||||
|
"lib/DB/ObjectDAO.py",
|
||||||
|
"lib/DB/ObjectModel.py"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user