Add Customer/Object/Employee working - DEBUGGING anchor Errors done
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import json
|
||||
|
||||
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot, Signal, QJsonDocument
|
||||
from PySide6.QtQml import QJSValue
|
||||
|
||||
from PySide6.QtQml import QJSValue, QJSValueIterator
|
||||
from .EmployeeDAO import EmployeeDAO
|
||||
# from ..PyqcrmFlags import PyqcrmFlags, PyqcrmAppliEmpyFlags
|
||||
from ..ConfigLoader import ConfigLoader
|
||||
@@ -35,20 +33,31 @@ class EmployeeModel(QAbstractTableModel):
|
||||
self.__employee_dao.addEmployee(new_employee, self.__key, False)
|
||||
|
||||
@Slot(QJSValue)
|
||||
def addApplicant(self, applicant: QJSValue):
|
||||
self.__employee_dao.addEmployee({
|
||||
"city": applicant.property("city").toString(),
|
||||
"email": applicant.property("email").toString(),
|
||||
"firstname": applicant.property("firstname").toString(),
|
||||
"formofaddress": applicant.property("formofaddress").toString(),
|
||||
"houseno": applicant.property("houseno").toString(),
|
||||
"lastname": applicant.property("lastname").toString(),
|
||||
"mobile": applicant.property("mobile").toString(),
|
||||
"phone": applicant.property("phone").toString(),
|
||||
"postcode": applicant.property("postcode").toInt(),
|
||||
"street": applicant.property("street").toString(),
|
||||
"title": applicant.property("title").toString(),
|
||||
}, self.__key, True)
|
||||
def addApplicant(self, new_applicant):
|
||||
data = {}
|
||||
it = QJSValueIterator(new_applicant)
|
||||
while it.hasNext():
|
||||
it.next()
|
||||
if "function" in it.value().toString() or "objectName" == it.name():
|
||||
continue
|
||||
data[it.name()] = it.value().toString()
|
||||
self.__employee_dao.addEmployee(data, self.__key)
|
||||
|
||||
# @Slot(QJSValue)
|
||||
# def addApplicant(self, applicant: QJSValue):
|
||||
# self.__employee_dao.addEmployee({
|
||||
# "city": applicant.property("city").toString(),
|
||||
# "email": applicant.property("email").toString(),
|
||||
# "firstname": applicant.property("firstname").toString(),
|
||||
# "formofaddress": applicant.property("formofaddress").toString(),
|
||||
# "houseno": applicant.property("houseno").toString(),
|
||||
# "lastname": applicant.property("lastname").toString(),
|
||||
# "mobile": applicant.property("mobile").toString(),
|
||||
# "phone": applicant.property("phone").toString(),
|
||||
# "postcode": applicant.property("postcode").toInt(),
|
||||
# "street": applicant.property("street").toString(),
|
||||
# "title": applicant.property("title").toString(),
|
||||
# }, self.__key, True)
|
||||
|
||||
@Slot(bool)
|
||||
def __refreshView(self, added):
|
||||
|
||||
Reference in New Issue
Block a user