offer form not ready

This commit is contained in:
2025-03-25 13:20:54 +01:00
parent 7b8c3630f8
commit 16ba24b13d
7 changed files with 432 additions and 209 deletions

213
Gui/AddNewOffer.qml Normal file
View File

@@ -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()
// }
}

112
Gui/AddOffer.qml Normal file
View File

@@ -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
// }
}

View File

@@ -64,7 +64,7 @@ ColumnLayout
icon.source: "qrc:/images/PlusCircle.svg" icon.source: "qrc:/images/PlusCircle.svg"
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
flat: true flat: true
//onClicked: appLoader.source = "AddOffer.qml" onClicked: appLoader.source = "AddOffer.qml"
} }
} }
Item { Item {

View File

@@ -1,22 +1,59 @@
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls
import QtQuick.Templates as T import QtQuick.Templates as T
import QtQuick.Controls
import QtQuick.Controls.impl
T.ComboBox { T.ComboBox {
id: control id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, font: Typography.body
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding, implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + 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 { delegate: ItemDelegate {
required property var model required property var model
required property int index required property int index
@@ -25,222 +62,71 @@ T.ComboBox {
text: model[control.textRole] text: model[control.textRole]
// palette.text: control.palette.text // palette.text: control.palette.text
// palette.highlightedText: control.palette.highlightedText // 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 highlighted: control.highlightedIndex === index
hoverEnabled: control.hoverEnabled hoverEnabled: control.hoverEnabled
} }
indicator: Rectangle {
id: indicator
indicator: ColorImage { border.color: Colors.interactive
x: control.mirrored ? control.padding : control.width - width - control.padding bottomRightRadius: Dimensions.radius
y: control.topPadding + (control.availableHeight - height) / 2 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" IconLabel {
opacity: enabled ? 1 : 0.3 anchors.fill: parent
} bottomPadding: Dimensions.s
icon.color: Colors.foreground
contentItem: T.TextField { icon.source: "qrc:/images/ChevronDown.svg"
// leftPadding: !control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1 leftPadding: Dimensions.s
// rightPadding: control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1 rightPadding: Dimensions.s
// topPadding: 6 - control.padding topPadding: Dimensions.s
// bottomPadding: 6 - control.padding }
implicitHeight: Typography.body.pixelSize + bottomPadding + topPadding MouseArea {
text: control.editable ? control.editText : control.displayText anchors.fill: parent
padding: Dimensions.m cursorShape: Qt.PointingHandCursor
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
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 { popup: T.Popup {
y: control.height
width: control.width
height: Math.min(contentItem.implicitHeight, control.Window.height - topMargin - bottomMargin)
topMargin: 6
bottomMargin: 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 { contentItem: ListView {
clip: true clip: true
implicitHeight: contentHeight
model: control.delegateModel
currentIndex: control.highlightedIndex currentIndex: control.highlightedIndex
highlightMoveDuration: 0 implicitHeight: contentHeight
model: control.popup.visible ? control.delegateModel : null
Rectangle { T.ScrollBar.vertical: ScrollBar {
z: 10 }
width: parent.width highlight: Rectangle {
height: parent.height color: Colors.primary
color: "transparent" opacity: Colors.highlightOpacity
border.color: control.palette.mid
} }
T.ScrollIndicator.vertical: ScrollIndicator { }
} }
}
background: Rectangle { Component.onCompleted:
color: control.palette.window {
} 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)
// }
// }

View File

@@ -28,6 +28,15 @@ Item
kerning: body.kerning, 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: readonly property font dash:
({ ({
family: body.family, family: body.family,

View File

@@ -22,6 +22,7 @@ from lib.Printers import Printers
os.environ['QML_XHR_ALLOW_FILE_READ'] = '1' os.environ['QML_XHR_ALLOW_FILE_READ'] = '1'
# [pyqcrm] # [pyqcrm]
# program-name="" # program-name=""
# version= # version=

View File

@@ -60,6 +60,8 @@
<file>TeroStyle/TextField.qml</file> <file>TeroStyle/TextField.qml</file>
<file>TeroStyle/Typography.qml</file> <file>TeroStyle/Typography.qml</file>
<file>TeroStyle/BarButton.qml</file> <file>TeroStyle/BarButton.qml</file>
<file>Gui/AddOffer.qml</file>
<file>Gui/AddNewOffer.qml</file>
</qresource> </qresource>
<qresource prefix="/TeroStyle"/> <qresource prefix="/TeroStyle"/>
</RCC> </RCC>