diff --git a/Gui/AddNewOffer.qml b/Gui/AddNewOffer.qml
new file mode 100644
index 0000000..798b457
--- /dev/null
+++ b/Gui/AddNewOffer.qml
@@ -0,0 +1,213 @@
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+GridLayout
+{
+ id: newObject
+
+ columns: 4
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ rowSpacing: 9
+
+ //New Grid
+ Label
+ {
+ text: qsTr("Objekt:")
+ Layout.alignment: Qt.AlignRight
+ font: Typography.h2
+
+
+ }
+ Item
+ {
+ Layout.columnSpan: 3
+ }
+
+ //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
+ }
+
+ Button
+ {
+ text: qsTr("Objekt hinzufügen")
+ icon.source: "qrc:/images/PlusCircle.svg"
+ }
+ Item
+ {
+
+ }
+
+
+ //// New grid row
+
+ 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
+ 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
+ }
+
+ //New Grid
+ Label
+ {
+ text: qsTr("Kunde:")
+ Layout.alignment: Qt.AlignRight
+ font: Typography.h2
+
+
+ }
+ Item
+ {
+ Layout.columnSpan: 3
+ }
+
+ //New grid row
+ Label
+ {
+ text: qsTr("Kunden-Nr.")
+ Layout.alignment: Qt.AlignRight
+ }
+
+ TextField
+ {
+ property string name: "customerno"
+ id: customerno
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignVCenter
+ }
+ Button
+ {
+ text: qsTr("Kunde hinzufügen")
+ icon.source: "qrc:/images/PlusCircle.svg"
+ }
+ Item
+ {
+
+ }
+
+
+ // New grid row
+ Label
+ {
+ text: qsTr("Kunden-Name")
+ Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
+ }
+
+ TextField
+ {
+
+ id: customerName
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignVCenter
+ }
+
+
+
+ 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()
+ // }
+}
+
+
+
+
+
+
+
+
+
diff --git a/Gui/AddOffer.qml b/Gui/AddOffer.qml
new file mode 100644
index 0000000..5aba818
--- /dev/null
+++ b/Gui/AddOffer.qml
@@ -0,0 +1,112 @@
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.Controls
+import QtQuick.Dialogs
+import "../js/qmldict.js" as JsLib
+
+ColumnLayout
+{
+ property var new_object: null
+ //property alias checkAddContact: checkAddContact
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ spacing: 15
+ Label
+ {
+ text: qsTr("Angebot anlegen")
+ horizontalAlignment: Text.AlignHCenter
+ Layout.fillWidth: true
+ font.pixelSize: 35
+ }
+
+
+ RowLayout
+ {
+ id: addObject
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ spacing: 45
+
+ Frame
+ {
+ Layout.alignment: Qt.AlignTop
+ Layout.fillWidth: true
+ AddNewOffer
+ {
+ id: newOffer
+ width: parent.width
+ }
+ }
+
+
+ }
+ RowLayout
+ {
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignRight
+ Button
+ {
+ text: qsTr("Abbrechen")
+ onClicked: appLoader.source = "OfferTable.qml"
+ }
+ Button
+ {
+ property var new_object: null
+ id: saveBtn
+ text: qsTr("Speichern")
+ enabled: false
+ onClicked:
+ {
+ // new_object = JsLib.parseForm(newObject)
+ // 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")
+ // }
+
+ // 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
+ // }
+}
diff --git a/Gui/OffersTable.qml b/Gui/OffersTable.qml
index aebc30e..6414a68 100644
--- a/Gui/OffersTable.qml
+++ b/Gui/OffersTable.qml
@@ -64,7 +64,7 @@ ColumnLayout
icon.source: "qrc:/images/PlusCircle.svg"
Layout.alignment: Qt.AlignRight
flat: true
- //onClicked: appLoader.source = "AddOffer.qml"
+ onClicked: appLoader.source = "AddOffer.qml"
}
}
Item {
diff --git a/TeroStyle/ComboBox.qml b/TeroStyle/ComboBox.qml
index 78c3840..46e5189 100644
--- a/TeroStyle/ComboBox.qml
+++ b/TeroStyle/ComboBox.qml
@@ -1,22 +1,59 @@
-pragma ComponentBehavior: Bound
-
import QtQuick
-import QtQuick.Controls.impl
-import QtQuick.Controls
import QtQuick.Templates as T
+import QtQuick.Controls
+import QtQuick.Controls.impl
T.ComboBox {
id: control
- implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
- implicitContentWidth + leftPadding + rightPadding)
+ font: Typography.body
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
- leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
- rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
+ contentItem: T.TextField {
+ id: test
+ autoScroll: control.editable
+ color: Colors.foreground
+ enabled: control.editable
+
+ font: Typography.body
+ implicitHeight: Typography.body.pixelSize + topPadding + bottomPadding
+ inputMethodHints: control.inputMethodHints
+ padding: Dimensions.m
+ readOnly: control.down
+ selectByMouse: control.selectTextByMouse
+ text: control.editable ? control.editText : control.displayText
+ validator: control.validator
+ width: control.width - indicator.width
+ verticalAlignment: Text.AlignVCenter
+ }
+ background: Rectangle {
+ border.color: Colors.interactive
+ border.width: 1
+ color: Colors.mantle
+ // height: parent.height
+ radius: Dimensions.radius
+ width: parent.width
+ }
+ // delegate: MenuItem {
+ // id: menuItem
+
+ // required property int index
+ // required property var model
+
+ // highlighted: control.highlightedIndex === index
+ // hoverEnabled: control.hoverEnabled
+ // text: model[control.textRole]
+ // width: control.width
+
+ // background: Rectangle {
+ // color: menuItem.down || menuItem.highlighted ? Colors.primary : "transparent"
+ // height: menuItem.height
+ // width: menuItem.width
+ // }
+ // }
delegate: ItemDelegate {
required property var model
required property int index
@@ -25,222 +62,71 @@ T.ComboBox {
text: model[control.textRole]
// palette.text: control.palette.text
// palette.highlightedText: control.palette.highlightedText
- font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
+ // font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
highlighted: control.highlightedIndex === index
hoverEnabled: control.hoverEnabled
}
+ indicator: Rectangle {
+ id: indicator
- indicator: ColorImage {
- x: control.mirrored ? control.padding : control.width - width - control.padding
- y: control.topPadding + (control.availableHeight - height) / 2
+ border.color: Colors.interactive
+ bottomRightRadius: Dimensions.radius
+ color: Colors.primary
+ height: control.height
+ topRightRadius: Dimensions.radius
+ width: 20 + Dimensions.s * 2
+ x: control.width - width
+ y: 0
+ z: 2
- source: "qrc:/images/ChevronDown.svg"
- opacity: enabled ? 1 : 0.3
- }
-
- contentItem: T.TextField {
- // leftPadding: !control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1
- // rightPadding: control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1
- // topPadding: 6 - control.padding
- // bottomPadding: 6 - control.padding
- implicitHeight: Typography.body.pixelSize + bottomPadding + topPadding
- text: control.editable ? control.editText : control.displayText
- padding: Dimensions.m
- enabled: control.editable
- autoScroll: control.editable
- readOnly: control.down
- inputMethodHints: control.inputMethodHints
- validator: control.validator
- selectByMouse: control.selectTextByMouse
-
- color: Colors.foreground
- // selectionColor: control.palette.highlight
- // selectedTextColor: control.palette.highlightedText
- verticalAlignment: Text.AlignVCenter
-
- background: Rectangle {
- visible: control.enabled && control.editable && !control.flat
- border.width: parent && parent.activeFocus ? 2 : 1
- border.color: Colors.interactive
- radius: Dimensions.radius
- color: Colors.mantle
+ IconLabel {
+ anchors.fill: parent
+ bottomPadding: Dimensions.s
+ icon.color: Colors.foreground
+ icon.source: "qrc:/images/ChevronDown.svg"
+ leftPadding: Dimensions.s
+ rightPadding: Dimensions.s
+ topPadding: Dimensions.s
+ }
+ MouseArea {
+ anchors.fill: parent
+ cursorShape: Qt.PointingHandCursor
+ onPressed: () => {
+ control.popup.visible = true;
+ control.popup.forceActiveFocus()
+ }
}
}
-
- background: Rectangle {
- implicitWidth: 140
- implicitHeight: 40
- radius: Dimensions.radius
- color: Colors.mantle
- border.color: Colors.interactive
- border.width: 1
- visible: !control.flat || control.down
- }
-
popup: T.Popup {
- y: control.height
- width: control.width
- height: Math.min(contentItem.implicitHeight, control.Window.height - topMargin - bottomMargin)
- topMargin: 6
bottomMargin: 6
- palette: control.palette
+ height: Math.min(contentItem.implicitHeight + 2, control.Window.height - topMargin - bottomMargin)
+ padding: 1
+ topMargin: 6
+ width: control.width
+ y: control.height
+ background: Rectangle {
+ border.color: Colors.interactive
+ color: Colors.mantle
+ radius: Dimensions.radius
+ }
contentItem: ListView {
clip: true
- implicitHeight: contentHeight
- model: control.delegateModel
currentIndex: control.highlightedIndex
- highlightMoveDuration: 0
+ implicitHeight: contentHeight
+ model: control.popup.visible ? control.delegateModel : null
- Rectangle {
- z: 10
- width: parent.width
- height: parent.height
- color: "transparent"
- border.color: control.palette.mid
+ T.ScrollBar.vertical: ScrollBar {
+ }
+ highlight: Rectangle {
+ color: Colors.primary
+ opacity: Colors.highlightOpacity
}
-
- T.ScrollIndicator.vertical: ScrollIndicator { }
}
-
- background: Rectangle {
- color: control.palette.window
- }
-
+ }
+ Component.onCompleted:
+ {
+ console.log(control.implicitContentHeight)
}
}
-
-
-// import QtQuick
-// import QtQuick.Templates as T
-// import QtQuick.Controls
-// import QtQuick.Controls.impl
-
-// T.ComboBox {
-// id: control
-
-// font: Typography.body
-// implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
-// implicitContentHeight + topPadding + bottomPadding,
-// implicitIndicatorHeight + topPadding + bottomPadding)
-
-
-// contentItem: T.TextField {
-// id: test
-// autoScroll: control.editable
-// color: Colors.foreground
-// enabled: control.editable
-
-// font: Typography.body
-// implicitHeight: Typography.body.pixelSize + topPadding + bottomPadding
-// inputMethodHints: control.inputMethodHints
-// padding: Dimensions.m
-// readOnly: control.down
-// selectByMouse: control.selectTextByMouse
-// text: control.editable ? control.editText : control.displayText
-// validator: control.validator
-// width: control.width - indicator.width
-// verticalAlignment: Text.AlignVCenter
-// }
-// background: Rectangle {
-// border.color: Colors.interactive
-// border.width: 1
-// color: Colors.mantle
-// // height: parent.height
-// radius: Dimensions.radius
-// width: parent.width
-// }
-// // delegate: MenuItem {
-// // id: menuItem
-
-// // required property int index
-// // required property var model
-
-// // highlighted: control.highlightedIndex === index
-// // hoverEnabled: control.hoverEnabled
-// // text: model[control.textRole]
-// // width: control.width
-
-// // background: Rectangle {
-// // color: menuItem.down || menuItem.highlighted ? Colors.primary : "transparent"
-// // height: menuItem.height
-// // width: menuItem.width
-// // }
-// // }
-// delegate: ItemDelegate {
-// required property var model
-// required property int index
-
-// width: ListView.view.width
-// text: model[control.textRole]
-// // palette.text: control.palette.text
-// // palette.highlightedText: control.palette.highlightedText
-// // font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
-// highlighted: control.highlightedIndex === index
-// hoverEnabled: control.hoverEnabled
-// }
-// indicator: Rectangle {
-// id: indicator
-
-// border.color: Colors.interactive
-// bottomRightRadius: Dimensions.radius
-// color: Colors.primary
-// height: control.height
-// topRightRadius: Dimensions.radius
-// width: 20 + Dimensions.s * 2
-// x: control.width - width
-// y: 0
-// z: 2
-
-// IconLabel {
-// anchors.fill: parent
-// bottomPadding: Dimensions.s
-// icon.color: Colors.foreground
-// icon.source: "qrc:/images/ChevronDown.svg"
-// leftPadding: Dimensions.s
-// rightPadding: Dimensions.s
-// topPadding: Dimensions.s
-// }
-// MouseArea {
-// anchors.fill: parent
-// cursorShape: Qt.PointingHandCursor
-
-// onPressed: () => {
-// control.popup.visible = true;
-// control.popup.forceActiveFocus()
-// }
-// }
-// }
-// popup: T.Popup {
-// bottomMargin: 6
-// height: Math.min(contentItem.implicitHeight + 2, control.Window.height - topMargin - bottomMargin)
-// padding: 1
-// topMargin: 6
-// width: control.width
-// y: control.height
-
-// background: Rectangle {
-// border.color: Colors.interactive
-// color: Colors.mantle
-// radius: Dimensions.radius
-// }
-// contentItem: ListView {
-// clip: true
-// currentIndex: control.highlightedIndex
-// implicitHeight: contentHeight
-// model: control.popup.visible ? control.delegateModel : null
-
-// T.ScrollBar.vertical: ScrollBar {
-// }
-// highlight: Rectangle {
-// color: Colors.primary
-// opacity: Colors.highlightOpacity
-// }
-// }
-// }
-// Component.onCompleted:
-// {
-// console.log(control.implicitContentHeight)
-// }
-// }
diff --git a/TeroStyle/Typography.qml b/TeroStyle/Typography.qml
index 145d16d..fe87417 100644
--- a/TeroStyle/Typography.qml
+++ b/TeroStyle/Typography.qml
@@ -28,6 +28,15 @@ Item
kerning: body.kerning,
})
+ readonly property font h2:
+ ({
+ family: body.family,
+ pointSize: 20,
+ weight: body.weight,
+ letterSpacing: body.letterSpacing,
+ kerning: body.kerning,
+ })
+
readonly property font dash:
({
family: body.family,
diff --git a/main.py b/main.py
index 6336235..7fa4103 100644
--- a/main.py
+++ b/main.py
@@ -22,6 +22,7 @@ from lib.Printers import Printers
os.environ['QML_XHR_ALLOW_FILE_READ'] = '1'
+
# [pyqcrm]
# program-name=""
# version=
diff --git a/qml.qrc b/qml.qrc
index 05ec096..49a6c7c 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -60,6 +60,8 @@
TeroStyle/TextField.qml
TeroStyle/Typography.qml
TeroStyle/BarButton.qml
+ Gui/AddOffer.qml
+ Gui/AddNewOffer.qml