Add employee in GUI and set up a dictionary for it

This commit is contained in:
2025-01-15 09:35:54 +01:00
parent 80a269a729
commit 3eadad5d5b
3 changed files with 87 additions and 18 deletions

View File

@@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
ApplicationWindow
{
id: addmitarbeiter
id: addMitarbeiter
title: qsTr("Objekt - Neuer Mitarbeiter")
ColumnLayout
@@ -31,6 +31,7 @@ ApplicationWindow
}
TextField
{
id: assignee
Layout.fillWidth: true
}
Label
@@ -40,6 +41,7 @@ ApplicationWindow
}
TextField
{
id: wage
Layout.fillWidth: true
}
Label
@@ -49,6 +51,7 @@ ApplicationWindow
}
TextField
{
id: duration
Layout.fillWidth: true
}
Label
@@ -58,6 +61,7 @@ ApplicationWindow
}
TextField
{
id: cleanDays
Layout.fillWidth: true
}
Label
@@ -67,6 +71,7 @@ ApplicationWindow
}
TextField
{
id: tasks
Layout.fillWidth: true
}
Label
@@ -76,6 +81,7 @@ ApplicationWindow
}
TextField
{
id: output
Layout.fillWidth: true
}
}
@@ -90,11 +96,30 @@ ApplicationWindow
Button
{
text: qsTr("Abbrechen")
onClicked: addMitarbeiter.close()
}
Button
{
text: qsTr("Hinzufügen")
onClicked:
{
if (assignee.text.trim() !== "" && duration.text.trim() !== "" && wage.text.trim() !== "" && cleanDays.text.trim() !== "" && tasks.text.trim() !== "" && output.text.trim() !== "")
{
var ne = {
"assignee": assignee.text.trim(),
"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)
}