merge main
This commit is contained in:
@@ -145,8 +145,21 @@ ColumnLayout
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted:
|
||||
{
|
||||
employee_model.addedNewEmployee.connect(onAddNewEmployee)
|
||||
}
|
||||
|
||||
// }
|
||||
// } // ScrollView
|
||||
function onAddNewEmployee(added)
|
||||
{
|
||||
if (added)
|
||||
console.log('addedsuccesfully')
|
||||
else
|
||||
console.log('failedtoadd')
|
||||
appLoader.source = 'EmployeeTable.qml'
|
||||
}
|
||||
|
||||
function checkFields()
|
||||
{
|
||||
|
||||
@@ -11,19 +11,6 @@ GridLayout
|
||||
Layout.fillHeight: true
|
||||
rowSpacing: 9
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Firma")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
ComboBox
|
||||
{
|
||||
property string name: "business"
|
||||
id: business
|
||||
editable: true
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 3
|
||||
}
|
||||
|
||||
//// New grid row
|
||||
|
||||
@@ -158,7 +145,7 @@ GridLayout
|
||||
id: mezzanin
|
||||
Layout.fillWidth: true
|
||||
editable: false
|
||||
model: [qsTr("Jööö"), qsTr("Nöööööööööööööööööööööööööö")]
|
||||
model: [qsTr("Ja"), qsTr("Nein")]
|
||||
}
|
||||
|
||||
Label
|
||||
@@ -173,7 +160,7 @@ GridLayout
|
||||
id: lift
|
||||
Layout.fillWidth: true
|
||||
editable: false
|
||||
model: [qsTr("Jööö"), qsTr("Nöööööööööööööööööööööööööö")]
|
||||
model: [qsTr("Ja"), qsTr("Nein")]
|
||||
}
|
||||
|
||||
//New grid row
|
||||
@@ -188,6 +175,8 @@ GridLayout
|
||||
id: objectno
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
placeholderText: qsTr("0 oder leer um eine Nummer automatisch zu generieren")
|
||||
placeholderTextColor: "pink"
|
||||
}
|
||||
|
||||
|
||||
@@ -230,10 +219,12 @@ GridLayout
|
||||
|
||||
function checkObjectField()
|
||||
{
|
||||
return (street.text.trim() && houseno.text.trim() &&
|
||||
|
||||
return street.text.trim() && houseno.text.trim() &&
|
||||
|
||||
(postcode.editText.trim() || postcode.currentText.trim()) &&
|
||||
(city.editText.trim() || city.currentText.trim()) &&
|
||||
cleaningproducts.text.trim())
|
||||
cleaningproducts.text.trim()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,19 +71,20 @@ ColumnLayout
|
||||
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
|
||||
if (!checkAddContact.checked)
|
||||
{
|
||||
var list = []
|
||||
new_object = JsLib.parseForm(newObject)
|
||||
object_model.addObject(new_object, list)
|
||||
object_model.addObject(new_object, list, false)
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
new_object = JsLib.parseForm(newObject)
|
||||
var new_objecto = addObjectLayout.getForm()
|
||||
object_model.addObject(new_object, new_objecto)
|
||||
object_model.addObject(new_object, new_objecto, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ from ..PyqcrmFlags import PyqcrmAppliEmpyFlags
|
||||
|
||||
|
||||
class EmployeeDAO(QObject):
|
||||
newEmployeeAdded = Signal()
|
||||
newEmployeeAdded = Signal(bool)
|
||||
|
||||
__cur = None
|
||||
__all_cols = None
|
||||
@@ -44,7 +44,8 @@ class EmployeeDAO(QObject):
|
||||
if self.__cur:
|
||||
self.__cur.callproc("addApplicant", (json.dumps(data), applicant, enc_key,))
|
||||
self.__con.commit()
|
||||
self.newEmployeeAdded.emit()
|
||||
self.newEmployeeAdded.emit(True)
|
||||
|
||||
except mariadb.Error as e:
|
||||
print(str(e))
|
||||
self.newEmployeeAdded.emit(False)
|
||||
|
||||
@@ -6,6 +6,7 @@ import re
|
||||
|
||||
|
||||
class EmployeeModel(QAbstractTableModel):
|
||||
addedNewEmployee = Signal(bool)
|
||||
__data = None
|
||||
__employee_dao = None
|
||||
__visible_index = None
|
||||
@@ -26,17 +27,20 @@ class EmployeeModel(QAbstractTableModel):
|
||||
|
||||
@Slot(dict, bool)
|
||||
def addEmployee(self, new_employee, applicant = True):
|
||||
new_employee['worklicense'] = int(new_employee['worklicense'])
|
||||
new_employee['residencetype'] = int(new_employee['residencetype'])
|
||||
if 'worklicense' in new_employee:
|
||||
new_employee['worklicense'] = int(new_employee['worklicense'])
|
||||
new_employee['residencetype'] = int(new_employee['residencetype'])
|
||||
self.__employee_dao.addEmployee(new_employee, self.__key, applicant)
|
||||
|
||||
@Slot(str)
|
||||
def viewCriterion(self, criterion, processed = False, fired = False):
|
||||
self.__getData(criterion, processed, fired)
|
||||
|
||||
@Slot()
|
||||
def __refreshView(self):
|
||||
self.__getData()
|
||||
@Slot(bool)
|
||||
def __refreshView(self, added):
|
||||
if added:
|
||||
self.__getData()
|
||||
self.addedNewEmployee.emit(added)
|
||||
|
||||
def __getData(self, criterion = "Alle", processed = False, fired = False, every_state = True):
|
||||
self.beginResetModel()
|
||||
|
||||
@@ -25,7 +25,7 @@ class ObjectModel(QAbstractTableModel):
|
||||
#self.__getData()
|
||||
|
||||
@Slot(dict, list, bool)
|
||||
def addObject(self, new_object, new_objcontact):
|
||||
def addObject(self, new_object, new_objcontact = None, new_contact = False):
|
||||
print(new_object)
|
||||
|
||||
print(new_objcontact)
|
||||
|
||||
Reference in New Issue
Block a user