Add global back button

This commit is contained in:
Yuri Becker
2025-04-03 14:46:36 +02:00
parent fc9b1c0801
commit 1e9ba40b6b
10 changed files with 213 additions and 209 deletions

4
.idea/discord.xml generated
View File

@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="DiscordProjectSettings"> <component name="DiscordProjectSettings">
<option name="show" value="APPLICATION" /> <option name="show" value="PROJECT_FILES" />
<option name="nameOverrideEnabled" value="true" />
<option name="nameOverrideText" value="the qml thing (╯°□°)╯︵ ┻━┻" />
<option name="description" value="" /> <option name="description" value="" />
<option name="applicationTheme" value="default" /> <option name="applicationTheme" value="default" />
<option name="iconsTheme" value="default" /> <option name="iconsTheme" value="default" />

5
.idea/qmlSettings.xml generated
View File

@@ -6,6 +6,11 @@
<entry key=""> <entry key="">
<value> <value>
<PerProfileState> <PerProfileState>
<option name="myExtraQmlPaths">
<list>
<option value="$PROJECT_DIR$/TeroStyle" />
</list>
</option>
<option name="myLSPEnabled" value="true" /> <option name="myLSPEnabled" value="true" />
<option name="myQmlFormatEnabled" value="true" /> <option name="myQmlFormatEnabled" value="true" />
</PerProfileState> </PerProfileState>

View File

@@ -1,178 +1,17 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import "../../js/qmldict.js" as JsLib import TeroStyle
ColumnLayout {
ColumnLayout
{
id: colPar
anchors.fill: parent anchors.fill: parent
Layout.fillWidth: true spacing: Dimensions.l
Layout.fillHeight: true
implicitWidth: parent.width
Label
{
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
id: headline
text: qsTr("Mitarbeiter / Bewerber hinzufügen")
font.pixelSize: 35
}
ButtonGroup
{
buttons: radio.children
onClicked:
{
checkFields()
personalData.requiredField()
}
}
Row ColumnLayout {
{
Layout.fillWidth: true
id: radio
//Layout.columnSpan: 2
RadioButton
{
checked: true
text: qsTr("Bewerber")
}
RadioButton
{
text: qsTr("Mitarbeiter")
}
}
// ScrollView
// {
// Layout.fillHeight: true
// Layout.fillWidth: true
// implicitWidth: parent.width
// ColumnLayout
// {
// anchors.fill: parent
// //implicitWidth: parent.width
// //width: parent.width
// //height: parent.height
RowLayout
{
Layout.fillWidth: true
//implicitWidth: parent.width
spacing: 50
Frame
{
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
//implicitWidth: parent.width
ApplicantPersonalData
{
id: personalData
width: parent.width
}
}
Frame
{
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
visible: radio.children[1].checked
ColumnLayout
{
Layout.alignment: Qt.AlignTop
implicitWidth: parent.width
ApplicantBankData
{
id: bankAccount
}
ApplicantNationalInsurance
{
id: nationalInsurance
}
ApplicantVarious
{
id: applicantVarious
}
}
}
}
Item
{
Layout.fillHeight: true Layout.fillHeight: true
Layout.verticalStretchFactor: 1
spacing: Dimensions.l
} }
RowLayout {
RowLayout spacing: Dimensions.l
{
Layout.fillWidth: true
Layout.alignment: Qt.AlignRight
Button
{
text: qsTr("Abbrechen")
onClicked: contentStack.pop()
}
Button
{
id: saveBtn
text: qsTr("Speichern")
enabled: false
onClicked:
{
var new_applicant
if (radio.children[0].checked)
{
// Ein Bewerber
new_applicant = JsLib.parseForm(personalData)
employee_model.addEmployee(new_applicant, true)
// appLoader.source = "EmployeeTable.qml"
// console.log(JSON.stringify (new_applicant))
}
else
{
// Ein Mitarbeiter
// console.log(personalData, bankAccount, nationalInsurance, applicantVarious)
new_applicant = JsLib.parseForm(personalData, bankAccount, nationalInsurance, applicantVarious)
employee_model.addEmployee(new_applicant, false)
// var new_contact = JsLib.addApplicant(addContactLayout)
// contact_model.addContact(new_contact)
// console.log(JSON.stringify (new_applicant))
}
}
}
} }
Component.onCompleted: }
{
employee_model.addedNewEmployee.connect(onAddNewEmployee)
}
function onAddNewEmployee(added)
{
if (added)
console.log('addedsuccesfully')
else
console.log('failedtoadd')
contentStack.pop()
}
function checkFields()
{
if(radio.children[1].checked)
{
if(!personalData.checkPersonalField())
saveBtn.enabled = false
else
saveBtn.enabled = true
}
else if (!personalData.checkPersonalField())
saveBtn.enabled = false
else
saveBtn.enabled = true
}
}

View File

@@ -0,0 +1,143 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import "../../js/qmldict.js" as JsLib
ColumnLayout {
id: colPar
function checkFields() {
if (radio.children[1].checked) {
if (!personalData.checkPersonalField())
saveBtn.enabled = false;
else
saveBtn.enabled = true;
} else if (!personalData.checkPersonalField())
saveBtn.enabled = false;
else
saveBtn.enabled = true;
}
function onAddNewEmployee(added) {
if (added)
console.log('addedsuccesfully');
else
console.log('failedtoadd');
contentStack.pop();
}
Layout.fillHeight: true
Layout.fillWidth: true
anchors.fill: parent
implicitWidth: parent.width
Component.onCompleted: {
employee_model.addedNewEmployee.connect(onAddNewEmployee);
}
Label {
id: headline
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
font.pixelSize: 35
text: qsTr("Mitarbeiter / Bewerber hinzufügen")
}
ButtonGroup {
buttons: radio.children
onClicked: {
checkFields();
personalData.requiredField();
}
}
Row {
id: radio
Layout.fillWidth: true
//Layout.columnSpan: 2
RadioButton {
checked: true
text: qsTr("Bewerber")
}
RadioButton {
text: qsTr("Mitarbeiter")
}
}
RowLayout {
Layout.fillWidth: true
spacing: 50
Frame {
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
//implicitWidth: parent.width
ApplicantPersonalData {
id: personalData
width: parent.width
}
}
Frame {
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
visible: radio.children[1].checked
ColumnLayout {
Layout.alignment: Qt.AlignTop
implicitWidth: parent.width
ApplicantBankData {
id: bankAccount
}
ApplicantNationalInsurance {
id: nationalInsurance
}
ApplicantVarious {
id: applicantVarious
}
}
}
}
Item {
Layout.fillHeight: true
}
RowLayout {
Layout.alignment: Qt.AlignRight
Layout.fillWidth: true
Button {
text: qsTr("Abbrechen")
onClicked: contentStack.pop()
}
Button {
id: saveBtn
enabled: false
text: qsTr("Speichern")
onClicked: {
var new_applicant;
if (radio.children[0].checked) {
// Ein Bewerber
new_applicant = JsLib.parseForm(personalData);
employee_model.addEmployee(new_applicant, true);
// appLoader.source = "EmployeeTable.qml"
// console.log(JSON.stringify (new_applicant))
} else {
// Ein Mitarbeiter
// console.log(personalData, bankAccount, nationalInsurance, applicantVarious)
new_applicant = JsLib.parseForm(personalData, bankAccount, nationalInsurance, applicantVarious);
employee_model.addEmployee(new_applicant, false);
// var new_contact = JsLib.addApplicant(addContactLayout)
// contact_model.addContact(new_contact)
// console.log(JSON.stringify (new_applicant))
}
}
}
}
}

View File

@@ -45,10 +45,18 @@ ColumnLayout {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
flat: true flat: true
icon.source: "qrc:/images/PlusCircle.svg" icon.source: "qrc:/images/PlusCircle.svg"
text: qsTr("Mitarbeiter Hinzufügen") text: qsTr("Bewerber Hinzufügen")
onClicked: contentStack.push("AddApplicant.qml") onClicked: contentStack.push("AddApplicant.qml")
} }
Button {
Layout.alignment: Qt.AlignRight
flat: true
icon.source: "qrc:/images/PlusCircle.svg"
text: qsTr("Mitarbeiter Hinzufügen")
onClicked: contentStack.push("AddEmployee.qml")
}
} }
HorizontalHeaderView { HorizontalHeaderView {
Layout.fillWidth: true Layout.fillWidth: true

View File

@@ -3,77 +3,79 @@ import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
ColumnLayout { ColumnLayout {
property bool onSubPage: false
height: parent.height height: parent.height
spacing: 0 spacing: 0
z: 3
Component.onCompleted: {
onSubPage = Qt.binding(() => contentStack.depth > 1);
}
anchors { anchors {
left: parent.left left: parent.left
top: parent.top top: parent.top
} }
ButtonGroup { ButtonGroup {
id: buttonBar id: mainNav
} }
BarButton { BarButton {
id: dashBoard ButtonGroup.group: mainNav
ButtonGroup.group: buttonBar
icon.source: "qrc:/images/Square3Stack3D-Outline.svg" icon.source: "qrc:/images/Square3Stack3D-Outline.svg"
text: qsTr("Dashboard")
target: "/Gui/Dashboard.qml" target: "/Gui/Dashboard.qml"
text: qsTr("Dashboard")
visible: !onSubPage
} }
BarButton { BarButton {
id: kunden ButtonGroup.group: mainNav
ButtonGroup.group: buttonBar
icon.source: "qrc:/images/UserGroup-Outline.svg" icon.source: "qrc:/images/UserGroup-Outline.svg"
text: qsTr("Kunden")
target: "/Gui/CustomersTable.qml" target: "/Gui/CustomersTable.qml"
text: qsTr("Kunden")
visible: !onSubPage
} }
BarButton { BarButton {
id: objekt ButtonGroup.group: mainNav
ButtonGroup.group: buttonBar
icon.source: "qrc:/images/BuildingOffice2-Outline.svg" icon.source: "qrc:/images/BuildingOffice2-Outline.svg"
text: qsTr("Objekt")
target: "/Gui/ObjectsTable.qml" target: "/Gui/ObjectsTable.qml"
text: qsTr("Objekt")
visible: !onSubPage
} }
BarButton { BarButton {
id: mitarbeiter ButtonGroup.group: mainNav
ButtonGroup.group: buttonBar
icon.source: "qrc:/images/Identification-Outline.svg" icon.source: "qrc:/images/Identification-Outline.svg"
text: qsTr("Mitarbeiter")
target: "/Gui/Employees/EmployeesTable.qml" target: "/Gui/Employees/EmployeesTable.qml"
text: qsTr("Mitarbeiter")
visible: !onSubPage
} }
BarButton { BarButton {
id: offers ButtonGroup.group: mainNav
ButtonGroup.group: buttonBar
icon.source: "qrc:/images/RectangleStack-Outline.svg" icon.source: "qrc:/images/RectangleStack-Outline.svg"
text: qsTr("Angebote")
target: "/Gui/OffersTable.qml" target: "/Gui/OffersTable.qml"
text: qsTr("Angebote")
visible: !onSubPage
} }
BarButton { BarButton {
id: abrechnung ButtonGroup.group: mainNav
ButtonGroup.group: buttonBar
icon.source: "qrc:/images/Wallet-Outline.svg" icon.source: "qrc:/images/Wallet-Outline.svg"
text: qsTr("Abrechnung") text: qsTr("Abrechnung")
visible: !onSubPage
}
BarButton {
icon.source: "qrc:/images/ArrowLeftCircle-Outline.svg"
text: qsTr("Zurück")
visible: onSubPage
checkable: false
onClicked: contentStack.pop();
} }
Item { Item {
id: hspacer
Layout.fillHeight: true Layout.fillHeight: true
} }
BarButton { BarButton {
id: atajos
Layout.bottomMargin: Dimensions.s
checkable: false checkable: false
flat: true
icon.source: "qrc:/images/Bars3.svg" icon.source: "qrc:/images/Bars3.svg"
implicitHeight: 90
implicitWidth: 90
onClicked: mainMenu.open() onClicked: mainMenu.open()
@@ -87,6 +89,7 @@ ColumnLayout {
// TODO: Check if logged-in user is admin first!! // TODO: Check if logged-in user is admin first!!
contentStack.push("PyqcrmConf.qml"); contentStack.push("PyqcrmConf.qml");
} }
} }
MenuSeparator { MenuSeparator {

View File

@@ -54,7 +54,6 @@ T.ToolButton {
onClicked: { onClicked: {
if(!target) { if(!target) {
console.warn(`BarButton with text ${this.text} has no target.`)
return return
} }
contentStack.replace(target) contentStack.replace(target)

View File

@@ -0,0 +1,3 @@
<svg fill="none" stroke-width="2" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" data-slot="icon">
<path stroke-linecap="round" stroke-linejoin="round" d="m11.25 9-3 3m0 0 3 3m-3-3h7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"></path>
</svg>

After

Width:  |  Height:  |  Size: 288 B

View File

@@ -1,6 +1,7 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>qtquickcontrols2.conf</file> <file>qtquickcontrols2.conf</file>
<file>images/ArrowLeftCircle-Outline.svg</file>
<file>images/ArrowRightEndOnRectangle.svg</file> <file>images/ArrowRightEndOnRectangle.svg</file>
<file>images/Bars3.svg</file> <file>images/Bars3.svg</file>
<file>images/BuildingOffice2-Outline.svg</file> <file>images/BuildingOffice2-Outline.svg</file>

View File

@@ -19,10 +19,6 @@
<file>Gui/ObjectAddOnContactPerson.qml</file> <file>Gui/ObjectAddOnContactPerson.qml</file>
<file>Gui/ObjectAddOnEmployee.qml</file> <file>Gui/ObjectAddOnEmployee.qml</file>
<file>Gui/AddObjectEmployee.qml</file> <file>Gui/AddObjectEmployee.qml</file>
<file>Gui/Employees/ApplicantPersonalData.qml</file>
<file>Gui/Employees/ApplicantBankData.qml</file>
<file>Gui/Employees/ApplicantNationalInsurance.qml</file>
<file>Gui/Employees/ApplicantVarious.qml</file>
<file>Gui/CustomersTable.qml</file> <file>Gui/CustomersTable.qml</file>
<file>Gui/CustomerDetails.qml</file> <file>Gui/CustomerDetails.qml</file>
<file>Gui/ObjectsTable.qml</file> <file>Gui/ObjectsTable.qml</file>
@@ -42,6 +38,11 @@
<file>Gui/UtilityDialogs.qml</file> <file>Gui/UtilityDialogs.qml</file>
<file>Gui/OffersTable.qml</file> <file>Gui/OffersTable.qml</file>
<file>Gui/Employees/AddApplicant.qml</file> <file>Gui/Employees/AddApplicant.qml</file>
<file>Gui/Employees/AddEmployee.qml</file>
<file>Gui/Employees/ApplicantPersonalData.qml</file>
<file>Gui/Employees/ApplicantBankData.qml</file>
<file>Gui/Employees/ApplicantNationalInsurance.qml</file>
<file>Gui/Employees/ApplicantVarious.qml</file>
<file>Gui/Employees/EmployeeDetails.qml</file> <file>Gui/Employees/EmployeeDetails.qml</file>
<file>Gui/Employees/EmployeesTable.qml</file> <file>Gui/Employees/EmployeesTable.qml</file>
<file>Gui/Employees/qmldir</file> <file>Gui/Employees/qmldir</file>