Employee/Applicant GUI and DB

This commit is contained in:
2025-02-14 12:05:45 +01:00
parent 80bd2c9be2
commit 5ff4749247
10 changed files with 199 additions and 52 deletions

View File

@@ -8,6 +8,9 @@ ColumnLayout
{
id: colPar
anchors.fill: parent
Layout.fillWidth: true
Layout.fillHeight: true
implicitWidth: parent.width
Label
{
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
@@ -29,7 +32,7 @@ ColumnLayout
{
Layout.fillWidth: true
id: radio
Layout.columnSpan: 2
//Layout.columnSpan: 2
RadioButton
{
checked: true
@@ -40,15 +43,30 @@ ColumnLayout
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
@@ -64,7 +82,7 @@ ColumnLayout
ColumnLayout
{
Layout.alignment: Qt.AlignTop
width: parent.width
implicitWidth: parent.width
ApplicantBankData
{
@@ -84,9 +102,14 @@ ColumnLayout
}
}
RowLayout
Item
{
Layout.fillHeight: true
}
RowLayout
{
Layout.fillWidth: true
Layout.alignment: Qt.AlignRight
Button
{
@@ -105,7 +128,7 @@ ColumnLayout
{
// Ein Bewerber
new_applicant = JsLib.parseForm(personalData)
employee_model.addEmployee(new_applicant, false)
employee_model.addEmployee(new_applicant, true)
// appLoader.source = "EmployeeTable.qml"
// console.log(JSON.stringify (new_applicant))
}
@@ -114,7 +137,7 @@ ColumnLayout
// Ein Mitarbeiter
// console.log(personalData, bankAccount, nationalInsurance, applicantVarious)
new_applicant = JsLib.parseForm(personalData, bankAccount, nationalInsurance, applicantVarious)
employee_model.addEmployee(new_applicant, true)
employee_model.addEmployee(new_applicant, false)
// var new_contact = JsLib.addApplicant(addContactLayout)
// contact_model.addContact(new_contact)
// console.log(JSON.stringify (new_applicant))
@@ -122,10 +145,9 @@ ColumnLayout
}
}
}
Item
{
Layout.fillHeight: true
}
// }
// } // ScrollView
function checkFields()
{
if(radio.children[1].checked)

View File

@@ -114,6 +114,19 @@ GridLayout
property string name: "idexpiry"
id: idexpiry
Layout.fillWidth: true
validator: RegularExpressionValidator
{
regularExpression: /((^|)(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]))\.((^|)(0[1-9]{1}|1[0-2]{1}))\.((^|)(196[0-9]{1}|19[7-9]{1}[0-9]{1}|20[0-9]{2}))/
}
Keys.onPressed: (event)=>
{
if (event.key !== Qt.Key_Backspace)
{
var len = idexpiry.length
var bd = idexpiry.text
if (len === 2 || len === 5) idexpiry.text = bd + "."
}
}
}
Label
{
@@ -137,6 +150,19 @@ GridLayout
property string name: "idissued"
id: idissued
Layout.fillWidth: true
validator: RegularExpressionValidator
{
regularExpression: /((^|)(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]))\.((^|)(0[1-9]{1}|1[0-2]{1}))\.((^|)(196[0-9]{1}|19[7-9]{1}[0-9]{1}|20[0-9]{2}))/
}
Keys.onPressed: (event)=>
{
if (event.key !== Qt.Key_Backspace)
{
var len = idissued.length
var bd = idissued.text
if (len === 2 || len === 5) idissued.text = bd + "."
}
}
}
CheckBox
{
@@ -191,6 +217,19 @@ GridLayout
id: residenceissued
visible: residencetype.checked
Layout.fillWidth: true
validator: RegularExpressionValidator
{
regularExpression: /((^|)(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]))\.((^|)(0[1-9]{1}|1[0-2]{1}))\.((^|)(196[0-9]{1}|19[7-9]{1}[0-9]{1}|20[0-9]{2}))/
}
Keys.onPressed: (event)=>
{
if (event.key !== Qt.Key_Backspace)
{
var len = residenceissued.length
var bd = residenceissued.text
if (len === 2 || len === 5) residenceissued.text = bd + "."
}
}
}
Label
{
@@ -204,6 +243,19 @@ GridLayout
id: residenceexpiry
visible: residencetype.checked
Layout.fillWidth: true
validator: RegularExpressionValidator
{
regularExpression: /((^|)(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]))\.((^|)(0[1-9]{1}|1[0-2]{1}))\.((^|)(196[0-9]{1}|19[7-9]{1}[0-9]{1}|20[0-9]{2}))/
}
Keys.onPressed: (event)=>
{
if (event.key !== Qt.Key_Backspace)
{
var len = residenceexpiry.length
var bd = residenceexpiry.text
if (len === 2 || len === 5) residenceexpiry.text = bd + "."
}
}
}
}

View File

@@ -6,7 +6,6 @@ GridLayout
{
id: personalData
columns: 4
Label
{
text: qsTr("Anrede")
@@ -336,6 +335,15 @@ GridLayout
{
regularExpression: /((^|)(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]))\.((^|)(0[1-9]{1}|1[0-2]{1}))\.((^|)(196[0-9]{1}|19[7-9]{1}[0-9]{1}|20[0-9]{2}))/
}
Keys.onPressed: (event)=>
{
if (event.key !== Qt.Key_Backspace)
{
var len = contractstart.length
var bd = contractstart.text
if (len === 2 || len === 5) contractstart.text = bd + "."
}
}
}
Label
{
@@ -356,6 +364,15 @@ GridLayout
{
regularExpression: /((^|)(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]))\.((^|)(0[1-9]{1}|1[0-2]{1}))\.((^|)(196[0-9]{1}|19[7-9]{1}[0-9]{1}|20[0-9]{2}))/
}
Keys.onPressed: (event)=>
{
if (event.key !== Qt.Key_Backspace)
{
var len = contractend.length
var bd = contractend.text
if (len === 2 || len === 5) contractend.text = bd + "."
}
}
}
Label
{

View File

@@ -101,16 +101,17 @@ Item
id: customerTable
Layout.fillHeight: true
Layout.fillWidth: true
ScrollBar.vertical: ScrollBar
{
policy: customerTable.contentHeight > customerTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
}
columnSpacing: 1
rowSpacing: 2
model: business_model
alternatingRows: true
resizableColumns: true
selectionBehavior: TableView.SelectRows
ScrollBar.vertical: ScrollBar
{
policy: customerTable.contentHeight > customerTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
}
selectionModel: ItemSelectionModel
{
id: selModel

View File

@@ -22,6 +22,6 @@ Item
Component.onCompleted:
{
business_model.onRowClicked(selectedEmployee)
employee_model.onRowClicked(selectedEmployee)
}
}

View File

@@ -23,6 +23,16 @@ Item
onClicked: appLoader.source = "AddApplicant.qml"
}
ButtonGroup
{
id: criterion
// buttons: criterion.children
onClicked:
{
viewEmployees(criterion.checkedButton.text)
}
}
ColumnLayout
{
anchors
@@ -32,50 +42,74 @@ Item
bottom: parent.bottom
left: parent.left
right: parent.right
}
RowLayout
{
//id: criterion
RadioButton
{
//id: showAll
checked: true
text: qsTr("Alle")
ButtonGroup.group: criterion
//onClicked: viewEmployees(showAll)
}
RadioButton
{
//id: showApplicant
text: qsTr("Bewerber")
ButtonGroup.group: criterion
//onClicked: viewEmployees(showApplicant)
}
RadioButton
{
//id: showEmployee
text: qsTr("Mitarbeiter")
ButtonGroup.group: criterion
//onClicked: viewEmployees(showEmployee)
}
RadioButton
CheckBox
{
id: showProcessed
text: qsTr("Erledigt")
onClicked: viewEmployees(criterion.checkedButton.text)
}
RadioButton
CheckBox
{
id: showFired
text: qsTr("Ausgeschieden")
onClicked: viewEmployees(criterion.checkedButton.text)
}
}
HorizontalHeaderView
{
id: horizontalHeader
id: employeeTableHeader
Layout.fillWidth: true
syncView: appliEmpTable
implicitHeight: 40
visible: false
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
@@ -85,6 +119,8 @@ Item
Layout.fillWidth: true
columnSpacing: 1
rowSpacing: 2
alternatingRows: true
resizableColumns: true
model: employee_model
selectionBehavior: TableView.SelectRows
@@ -104,13 +140,13 @@ Item
{
required property bool selected
required property bool current
//implicitWidth: 200
implicitWidth: appliEmpTable.width / appliEmpTable.columns
implicitHeight: 25
color: selected
? palette.highlight //palette.highlight
: (objectTable.alternatingRows && row % 2 !== 0
? palette.base // palette.base
: palette.alternateBase) //palette.alternateBase)
? addEmployeeBtn.palette.highlight //palette.highlight
: (appliEmpTable.alternatingRows && row % 2 !== 0
? addEmployeeBtn.palette.base // palette.base
: addEmployeeBtn.palette.alternateBase) //palette.alternateBase)
Text
{
@@ -152,5 +188,9 @@ Item
}
}
function viewEmployees(criterion)
{
employee_model.viewCriterion(criterion, showProcessed.checked, showFired.checked)
}
Component.onCompleted: employeesStack.pop()
}

View File

@@ -44,6 +44,7 @@ ApplicationWindow
Loader
{
id: appLoader
anchors
{
left: parent.left