Extract Employee View into own dir
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import "../js/qmldict.js" as JsLib
|
import "../../js/qmldict.js" as JsLib
|
||||||
|
|
||||||
|
|
||||||
ColumnLayout
|
ColumnLayout
|
||||||
@@ -114,7 +114,7 @@ ColumnLayout
|
|||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
text: qsTr("Abbrechen")
|
text: qsTr("Abbrechen")
|
||||||
onClicked: appLoader.source = "EmployeeTable.qml"
|
onClicked: appLoader.source = "Employees/EmployeesView.qml"
|
||||||
}
|
}
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
@@ -150,15 +150,13 @@ ColumnLayout
|
|||||||
employee_model.addedNewEmployee.connect(onAddNewEmployee)
|
employee_model.addedNewEmployee.connect(onAddNewEmployee)
|
||||||
}
|
}
|
||||||
|
|
||||||
// }
|
|
||||||
// } // ScrollView
|
|
||||||
function onAddNewEmployee(added)
|
function onAddNewEmployee(added)
|
||||||
{
|
{
|
||||||
if (added)
|
if (added)
|
||||||
console.log('addedsuccesfully')
|
console.log('addedsuccesfully')
|
||||||
else
|
else
|
||||||
console.log('failedtoadd')
|
console.log('failedtoadd')
|
||||||
appLoader.source = 'EmployeeTable.qml'
|
appLoader.source = 'Employees/EmployeesView.qml'
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkFields()
|
function checkFields()
|
||||||
134
Gui/Employees/EmployeesTable.qml
Normal file
134
Gui/Employees/EmployeesTable.qml
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls
|
||||||
|
import Qt.labs.qmlmodels
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: Dimensions.l
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: Dimensions.l
|
||||||
|
|
||||||
|
SearchBar {
|
||||||
|
}
|
||||||
|
QuickFilter {
|
||||||
|
model: ListModel {
|
||||||
|
ListElement {
|
||||||
|
name: "Alle"
|
||||||
|
selected: true
|
||||||
|
text: qsTr("Alle")
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
name: "Bewerber"
|
||||||
|
selected: false
|
||||||
|
text: qsTr("Bewerber")
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
name: "Mitarbeiter"
|
||||||
|
selected: false
|
||||||
|
text: qsTr("Kunde")
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
name: "Erledigt"
|
||||||
|
selected: false
|
||||||
|
text: qsTr("Erledigt")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onSelectedChanged: name => {
|
||||||
|
employee_model.viewCriterion(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
flat: true
|
||||||
|
icon.source: "qrc:/images/PlusCircle.svg"
|
||||||
|
text: qsTr("Mitarbeiter Hinzufügen")
|
||||||
|
|
||||||
|
onClicked: appLoader.source = "Employees/AddApplicant.qml"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HorizontalHeaderView {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
implicitHeight: 40
|
||||||
|
movableColumns: true //@disable-check M16
|
||||||
|
syncView: appliEmpTable
|
||||||
|
|
||||||
|
delegate: Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
border.color: palette.base
|
||||||
|
color: palette.alternateBase
|
||||||
|
implicitHeight: 40
|
||||||
|
implicitWidth: 1
|
||||||
|
|
||||||
|
Text {
|
||||||
|
color: palette.text
|
||||||
|
elide: Text.ElideRight
|
||||||
|
height: parent.height
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: model.display
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TableView {
|
||||||
|
id: appliEmpTable
|
||||||
|
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
alternatingRows: true
|
||||||
|
columnSpacing: 1
|
||||||
|
model: employee_model
|
||||||
|
resizableColumns: true
|
||||||
|
rowSpacing: 2
|
||||||
|
selectionBehavior: TableView.SelectRows
|
||||||
|
z: 1
|
||||||
|
|
||||||
|
ScrollBar.vertical: ScrollBar {
|
||||||
|
policy: appliEmpTable.contentHeight > appliEmpTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
||||||
|
}
|
||||||
|
delegate: Rectangle {
|
||||||
|
required property bool current
|
||||||
|
required property bool selected
|
||||||
|
|
||||||
|
color: selected ? palette.highlight : (appliEmpTable.alternatingRows && row % 2 !== 0 ? palette.base : palette.alternateBase)
|
||||||
|
implicitHeight: 25
|
||||||
|
implicitWidth: appliEmpTable.width / appliEmpTable.columns
|
||||||
|
|
||||||
|
Text {
|
||||||
|
color: palette.text
|
||||||
|
elide: Text.ElideRight
|
||||||
|
height: parent.height
|
||||||
|
leftPadding: 9
|
||||||
|
text: (model.display === null || model.display === undefined) ? "" : model.display
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
property bool hovered: false
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
|
onDoubleClicked: {
|
||||||
|
employeesStack.push("EmployeeDetails.qml", {
|
||||||
|
selectedEmployee: row
|
||||||
|
});
|
||||||
|
}
|
||||||
|
onEntered: {
|
||||||
|
appliEmpTable.selectionModel.select(appliEmpTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selectionModel: ItemSelectionModel {
|
||||||
|
model: appliEmpTable.model
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
1
Gui/Employees/qmldir
Normal file
1
Gui/Employees/qmldir
Normal file
@@ -0,0 +1 @@
|
|||||||
|
module Employees
|
||||||
@@ -1,187 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtQuick.Controls
|
|
||||||
import Qt.labs.qmlmodels
|
|
||||||
|
|
||||||
ColumnLayout
|
|
||||||
{
|
|
||||||
|
|
||||||
function viewEmployees(criterion)
|
|
||||||
{
|
|
||||||
employee_model.viewCriterion(criterion)
|
|
||||||
// employee_model.viewCriterion(criterion, showProcessed.checked, showFired.checked, showEveryone.checked)
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: Dimensions.l
|
|
||||||
|
|
||||||
Component.onCompleted: employeesStack.pop()
|
|
||||||
// property var availableFilters: ["Name", "Adresse", "PLZ", "Ort", "Status"]
|
|
||||||
RowLayout
|
|
||||||
{
|
|
||||||
Layout.fillWidth: true
|
|
||||||
spacing: Dimensions.l
|
|
||||||
SearchBar
|
|
||||||
{
|
|
||||||
id:searchBar
|
|
||||||
}
|
|
||||||
QuickFilter
|
|
||||||
{
|
|
||||||
onSelectedChanged: (name) =>
|
|
||||||
{
|
|
||||||
business_model.viewCriterion(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
model: ListModel
|
|
||||||
{
|
|
||||||
ListElement
|
|
||||||
{
|
|
||||||
|
|
||||||
name: "Alle"
|
|
||||||
text: qsTr("Alle")
|
|
||||||
selected: true
|
|
||||||
}
|
|
||||||
ListElement
|
|
||||||
{
|
|
||||||
name: "Bewerber"
|
|
||||||
text: qsTr("Bewerber")
|
|
||||||
selected: false
|
|
||||||
}
|
|
||||||
ListElement
|
|
||||||
{
|
|
||||||
name: "Mitarbeiter"
|
|
||||||
text: qsTr("Kunde")
|
|
||||||
selected: false
|
|
||||||
}
|
|
||||||
|
|
||||||
ListElement
|
|
||||||
{
|
|
||||||
name: "Erledigt"
|
|
||||||
text: qsTr("Erledigt")
|
|
||||||
selected: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Button
|
|
||||||
{
|
|
||||||
id: addEmployeeBtn
|
|
||||||
text: qsTr("Mitarbeiter Hinzufügen")
|
|
||||||
icon.source: "qrc:/images/PlusCircle.svg"
|
|
||||||
Layout.alignment: Qt.AlignRight
|
|
||||||
flat: true
|
|
||||||
onClicked: appLoader.source = "AddApplicant.qml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
HorizontalHeaderView
|
|
||||||
{
|
|
||||||
id: employeeTableHeader
|
|
||||||
Layout.fillWidth: true
|
|
||||||
syncView: appliEmpTable
|
|
||||||
implicitHeight: 40
|
|
||||||
movableColumns: true //@disable-check M16
|
|
||||||
delegate: Rectangle
|
|
||||||
{
|
|
||||||
color: addEmployeeBtn.palette.alternateBase
|
|
||||||
border.color: palette.base
|
|
||||||
implicitHeight: 40
|
|
||||||
Layout.fillWidth: true
|
|
||||||
implicitWidth: 1
|
|
||||||
Text
|
|
||||||
{
|
|
||||||
text: model.display
|
|
||||||
elide: Text.ElideRight
|
|
||||||
width: parent.width
|
|
||||||
height: parent.height
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
color: palette.text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TableView
|
|
||||||
{
|
|
||||||
id: appliEmpTable
|
|
||||||
//Layout.fillHeight: true
|
|
||||||
//height: tableParent.height - (viewCriterion.height + employeeTableHeader.height)
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
columnSpacing: 1
|
|
||||||
rowSpacing: 2
|
|
||||||
alternatingRows: true
|
|
||||||
resizableColumns: true
|
|
||||||
model: employee_model
|
|
||||||
selectionBehavior: TableView.SelectRows
|
|
||||||
z: 1
|
|
||||||
ScrollBar.vertical: ScrollBar
|
|
||||||
{
|
|
||||||
policy: appliEmpTable.contentHeight > appliEmpTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
|
||||||
}
|
|
||||||
|
|
||||||
selectionModel: ItemSelectionModel
|
|
||||||
{
|
|
||||||
id: selModel
|
|
||||||
model: appliEmpTable.model
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
delegate:Rectangle
|
|
||||||
{
|
|
||||||
required property bool selected
|
|
||||||
required property bool current
|
|
||||||
implicitWidth: appliEmpTable.width / appliEmpTable.columns
|
|
||||||
implicitHeight: 25
|
|
||||||
color: selected
|
|
||||||
? addEmployeeBtn.palette.highlight //palette.highlight
|
|
||||||
: (appliEmpTable.alternatingRows && row % 2 !== 0
|
|
||||||
? addEmployeeBtn.palette.base // palette.base
|
|
||||||
: addEmployeeBtn.palette.alternateBase) //palette.alternateBase)
|
|
||||||
|
|
||||||
Text
|
|
||||||
{
|
|
||||||
text: (model.display === null || model.display === undefined)? "": model.display
|
|
||||||
elide: Text.ElideRight
|
|
||||||
width: parent.width
|
|
||||||
height: parent.height
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
leftPadding: 9 //@d isable-check M16
|
|
||||||
color: palette.text
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea
|
|
||||||
{
|
|
||||||
id: mouseArea
|
|
||||||
property bool hovered:false
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
|
|
||||||
onDoubleClicked:
|
|
||||||
{
|
|
||||||
employeesStack.push("EmployeeDetails.qml", {selectedEmployee: row});
|
|
||||||
}
|
|
||||||
|
|
||||||
onEntered:
|
|
||||||
{
|
|
||||||
appliEmpTable.selectionModel.select(appliEmpTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item
|
|
||||||
{
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// function viewEmployees(criterion)
|
|
||||||
// {
|
|
||||||
// employee_model.viewCriterion(criterion, showProcessed.checked, showFired.checked, showEveryone.checked)
|
|
||||||
// }
|
|
||||||
// Component.onCompleted: employeesStack.pop()
|
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ ColumnLayout {
|
|||||||
text: qsTr("Mitarbeiter")
|
text: qsTr("Mitarbeiter")
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
appLoader.source = "EmployeeTable.qml";
|
appLoader.source = "Employees/EmployeesView.qml";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BarButton {
|
BarButton {
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
module gui
|
module gui
|
||||||
TopBar 1.0 Navigation.qml
|
Navigation 1.0 Navigation.qml
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ TextField TextField.qml
|
|||||||
BarButton BarButton.qml
|
BarButton BarButton.qml
|
||||||
Label Label.qml
|
Label Label.qml
|
||||||
QuickFilter QuickFilter.qml
|
QuickFilter QuickFilter.qml
|
||||||
|
SearchBar SearchBar.qml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,14 +49,11 @@ class EmployeeModel(QAbstractTableModel):
|
|||||||
def columnCount(self, parent= QModelIndex()):
|
def columnCount(self, parent= QModelIndex()):
|
||||||
return len(self.__visible_columns) - self.__col_skip
|
return len(self.__visible_columns) - self.__col_skip
|
||||||
|
|
||||||
@Slot(str, bool, bool, bool)
|
@Slot(str)
|
||||||
def viewCriterion(self, criterion, processed, fired, every_state):
|
def viewCriterion(self, criterion):
|
||||||
self.__everyone = True if criterion == 'Alle' else False
|
self.__everyone = criterion == 'Alle'
|
||||||
if self.__everyone and criterion != "Alle":
|
self.__col_skip = 2
|
||||||
self.__col_skip = 2
|
self.__getData(criterion, criterion == 'Erledigt', False, criterion == 'Alle')
|
||||||
else:
|
|
||||||
self.__col_skip = 2
|
|
||||||
self.__getData(criterion, processed, fired, every_state)
|
|
||||||
|
|
||||||
def data(self, index, role= Qt.DisplayRole):
|
def data(self, index, role= Qt.DisplayRole):
|
||||||
if role == Qt.DisplayRole:
|
if role == Qt.DisplayRole:
|
||||||
|
|||||||
13
qml.qrc
13
qml.qrc
@@ -9,9 +9,7 @@
|
|||||||
<file>Gui/AddCustomer.qml</file>
|
<file>Gui/AddCustomer.qml</file>
|
||||||
<file>Gui/CustomerTable.qml</file>
|
<file>Gui/CustomerTable.qml</file>
|
||||||
<file>Gui/Dashboard.qml</file>
|
<file>Gui/Dashboard.qml</file>
|
||||||
<file>Gui/EmployeeTable.qml</file>
|
|
||||||
<file>Gui/main.qml</file>
|
<file>Gui/main.qml</file>
|
||||||
<file>Gui/SearchBar.qml</file>
|
|
||||||
<file>js/qmldict.js</file>
|
<file>js/qmldict.js</file>
|
||||||
<file>Gui/CustomerView.qml</file>
|
<file>Gui/CustomerView.qml</file>
|
||||||
<file>Gui/NoDbConnection.qml</file>
|
<file>Gui/NoDbConnection.qml</file>
|
||||||
@@ -23,7 +21,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/AddApplicant.qml</file>
|
|
||||||
<file>Gui/ApplicantPersonalData.qml</file>
|
<file>Gui/ApplicantPersonalData.qml</file>
|
||||||
<file>Gui/ApplicantBankData.qml</file>
|
<file>Gui/ApplicantBankData.qml</file>
|
||||||
<file>Gui/ApplicantNationalInsurance.qml</file>
|
<file>Gui/ApplicantNationalInsurance.qml</file>
|
||||||
@@ -31,8 +28,6 @@
|
|||||||
<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>
|
||||||
<file>Gui/EmployeesTable.qml</file>
|
|
||||||
<file>Gui/EmployeeDetails.qml</file>
|
|
||||||
<file>Gui/ObjectDetails.qml</file>
|
<file>Gui/ObjectDetails.qml</file>
|
||||||
<file>Gui/AddNewObject.qml</file>
|
<file>Gui/AddNewObject.qml</file>
|
||||||
<file>Gui/PrinterDialog.qml</file>
|
<file>Gui/PrinterDialog.qml</file>
|
||||||
@@ -49,6 +44,12 @@
|
|||||||
<file>Gui/UtilityDialogs.qml</file>
|
<file>Gui/UtilityDialogs.qml</file>
|
||||||
<file>Gui/OffersTable.qml</file>
|
<file>Gui/OffersTable.qml</file>
|
||||||
<file>Gui/OfferTable.qml</file>
|
<file>Gui/OfferTable.qml</file>
|
||||||
|
<file>Gui/Employees/AddApplicant.qml</file>
|
||||||
|
<file>Gui/Employees/EmployeeDetails.qml</file>
|
||||||
|
<file>Gui/Employees/EmployeesTable.qml</file>
|
||||||
|
<file>Gui/Employees/EmployeesView.qml</file>
|
||||||
|
<file>Gui/Employees/qmldir</file>
|
||||||
|
<file>TeroStyle/BarButton.qml</file>
|
||||||
<file>TeroStyle/Button.qml</file>
|
<file>TeroStyle/Button.qml</file>
|
||||||
<file>TeroStyle/Colors.qml</file>
|
<file>TeroStyle/Colors.qml</file>
|
||||||
<file>TeroStyle/ComboBox.qml</file>
|
<file>TeroStyle/ComboBox.qml</file>
|
||||||
@@ -57,9 +58,9 @@
|
|||||||
<file>TeroStyle/Label.qml</file>
|
<file>TeroStyle/Label.qml</file>
|
||||||
<file>TeroStyle/qmldir</file>
|
<file>TeroStyle/qmldir</file>
|
||||||
<file>TeroStyle/QuickFilter.qml</file>
|
<file>TeroStyle/QuickFilter.qml</file>
|
||||||
|
<file>TeroStyle/SearchBar.qml</file>
|
||||||
<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>Gui/AddOffer.qml</file>
|
<file>Gui/AddOffer.qml</file>
|
||||||
<file>Gui/AddNewOffer.qml</file>
|
<file>Gui/AddNewOffer.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
|||||||
Reference in New Issue
Block a user