diff --git a/Desktop/data/connect.py b/Desktop/data/connect.py
index 74f9e00..3250456 100644
--- a/Desktop/data/connect.py
+++ b/Desktop/data/connect.py
@@ -48,6 +48,7 @@ class User(base):
post = relationship('Post', back_populates='users')
comments = relationship('Comment', back_populates='user')
+ users_event = relationship('UserEvent', back_populates='user')
class DepartmentUser(base):
@@ -131,6 +132,8 @@ class EventType(base):
id = Column(Integer, primary_key=True, autoincrement=True)
title = Column(VARCHAR(100))
+ events = relationship('Event', back_populates='type')
+
class EventStatus(base):
__tablename__ = 'event_statuses'
@@ -150,6 +153,9 @@ class Event(base):
type_id = Column(Integer, ForeignKey('event_types.id'))
status_id = Column(Integer, ForeignKey('event_statuses.id'))
+ type = relationship('EventType', back_populates='events')
+ users_event = relationship('UserEvent', back_populates='event')
+
class DepartmentEvent(base):
__tablename__ = 'department_events'
@@ -174,6 +180,9 @@ class UserEvent(base):
event_id = Column(Integer, ForeignKey('events.id'))
user_id = Column(Integer, ForeignKey('users.id'))
+ event = relationship('Event', back_populates='users_event')
+ user = relationship('User', back_populates='users_event')
+
class WorkingCalendar(base):
__tablename__ = 'workingcalendar'
@@ -191,7 +200,7 @@ class Attendance(base):
is_attended = Column(Boolean)
reason = Column(Text)
- user = Column(Integer, ForeignKey('users.id'))
+ user_id = Column(Integer, ForeignKey('users.id'))
class VacationTimetable(base):
@@ -201,7 +210,7 @@ class VacationTimetable(base):
start_date = Column(Date)
end_date = Column(Date)
- user = Column(Integer, ForeignKey('users.id'))
+ user_id = Column(Integer, ForeignKey('users.id'))
def init_db():
diff --git a/Desktop/employee_card_widget.py b/Desktop/employee_card_widget.py
index 7531e18..0d6d115 100644
--- a/Desktop/employee_card_widget.py
+++ b/Desktop/employee_card_widget.py
@@ -1,6 +1,7 @@
from PyQt6 import uic
from PyQt6.QtWidgets import QWidget
+from Desktop.events_list_dialog import EventsListDialog
from data.connect import connect, Department, Post
diff --git a/Desktop/employee_dialog_widget.py b/Desktop/employee_dialog_widget.py
index 3bc8934..6b0c6bf 100644
--- a/Desktop/employee_dialog_widget.py
+++ b/Desktop/employee_dialog_widget.py
@@ -10,8 +10,6 @@ class EmployeeDialogWidget(QDialog):
uic.loadUi('ui/employee_dialog_window.ui', self)
- self.pushButton.clicked.connect(self.close)
-
self.lineEdit_5.setText(department.title)
self.user = user
diff --git a/Desktop/events_list_dialog.py b/Desktop/events_list_dialog.py
new file mode 100644
index 0000000..12a5587
--- /dev/null
+++ b/Desktop/events_list_dialog.py
@@ -0,0 +1,21 @@
+from PyQt6 import uic
+from PyQt6.QtWidgets import QDialog
+
+from data.connect import connect, Event, UserEvent, EventType, Attendance, VacationTimetable
+
+
+class EventsListDialog(QDialog):
+ def __init__(self, user):
+ super().__init__()
+
+ uic.loadUi('ui/events_dialog_window.ui', self)
+
+ with connect() as session:
+ self.curses = session.query(Event).join(UserEvent).join(EventType).filter(
+ UserEvent.user_id == user.id,
+ EventType.title == 'Обучение'
+ ).all()
+
+ self.attendances = session.query(Attendance).filter(Attendance.user_id == user.id).all()
+
+ self.vacations = session.query(VacationTimetable).filter(VacationTimetable.user_id == user.id).all()
diff --git a/Desktop/main_window.py b/Desktop/main_window.py
index e5ef7b7..c67e123 100644
--- a/Desktop/main_window.py
+++ b/Desktop/main_window.py
@@ -1,6 +1,7 @@
from PyQt6 import uic
from PyQt6.QtWidgets import QMainWindow
+from Desktop.events_list_dialog import EventsListDialog
from employee_dialog_widget import EmployeeDialogWidget
from employee_card_widget import EmployeeCardWidget
from data.connect import connect, User, Department
@@ -46,7 +47,10 @@ class MainWindow(QMainWindow):
button = self.sender()
employee = button.employee
- self.create_employee_dialog = EmployeeDialogWidget(self.selected_department, self.department_employees, self, employee)
+ edit_widget = EmployeeDialogWidget(self.selected_department, self.department_employees, self,
+ employee)
+ self.create_employee_dialog = EventsListDialog(employee)
+ self.create_employee_dialog.gridLayout_2.addWidget(edit_widget)
self.create_employee_dialog.exec()
def search_employees(self, department_id):
diff --git a/Desktop/ui/employee_dialog_window.ui b/Desktop/ui/employee_dialog_window.ui
index dbbadd8..52e9e81 100644
--- a/Desktop/ui/employee_dialog_window.ui
+++ b/Desktop/ui/employee_dialog_window.ui
@@ -32,6 +32,33 @@ background-color: #2f9836;
}
+ -
+
+
+ +7 (000) 000-00-00
+
+
+ 18
+
+
+
+ -
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Прочая информация
+
+
+
-
@@ -39,6 +66,20 @@ background-color: #2f9836;
+ -
+
+
+ Электронная почта
+
+
+
+ -
+
+
+ Рабочий телефон
+
+
+
-
@@ -59,54 +100,17 @@ background-color: #2f9836;
- -
-
-
-
- 40
- 20
-
-
-
-
- -
-
+
-
+
- Рабочий телефон
+ Мобильный телефон
- -
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- Электронная почта
-
-
-
- -
-
+
-
+
-
-
-
- true
-
-
-
- -
-
-
- Департамент
+ Дата рождения
@@ -120,10 +124,34 @@ background-color: #2f9836;
- -
-
+
-
+
- Назад
+
+
+
+ true
+
+
+
+ -
+
+
+ Должность
+
+
+
+ -
+
+
+ Имя
+
+
+
+ -
+
+
+ Департамент
@@ -140,8 +168,8 @@ background-color: #2f9836;
- -
-
+
-
+
20
@@ -163,8 +191,15 @@ background-color: #2f9836;
- -
-
+
-
+
+
+ Отчество
+
+
+
+ -
+
40
@@ -180,13 +215,6 @@ background-color: #2f9836;
- -
-
-
- Имя
-
-
-
-
@@ -194,78 +222,18 @@ background-color: #2f9836;
- -
-
-
- Должность
-
-
-
- -
-
-
- Отчество
-
-
-
- -
-
-
- +7 (000) 000-00-00
-
-
- 18
-
-
-
- -
-
-
- Мобильный телефон
-
-
-
- -
-
-
- Прочая информация
-
-
-
-
- -
-
-
- Дата рождения
-
-
-
- -
-
-
+
-
+
+
- 80
- 80
+ 40
+ 20
-
-
- 80
- 80
-
-
-
-
-
-
- ../res/Logo.png
-
-
- true
-
-
+
@@ -282,25 +250,7 @@ background-color: #2f9836;
lineEdit_8
lineEdit_9
pushButton_2
- pushButton
-
-
- pushButton
- clicked()
- Dialog
- close()
-
-
- 616
- 27
-
-
- 630
- 228
-
-
-
-
+
diff --git a/Desktop/ui/events_dialog_window.ui b/Desktop/ui/events_dialog_window.ui
index 06a2492..8402ad0 100644
--- a/Desktop/ui/events_dialog_window.ui
+++ b/Desktop/ui/events_dialog_window.ui
@@ -6,8 +6,8 @@
0
0
- 718
- 579
+ 1020
+ 682
@@ -32,50 +32,6 @@ background-color: #2f9836;
}
- -
-
-
- Назад
-
-
-
- -
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- true
-
-
-
-
- 0
- 0
- 305
- 529
-
-
-
-
-
-
@@ -86,8 +42,8 @@ background-color: #2f9836;
0
0
- 385
- 529
+ 923
+ 606
@@ -126,8 +82,8 @@ background-color: #2f9836;
0
0
- 365
- 477
+ 903
+ 554
@@ -169,8 +125,40 @@ background-color: #2f9836;
- -
-
+
-
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 69
+ 606
+
+
+
+
-
+
+
+
+
+
+
+ -
+
+
+ Назад
+
+
+
+ -
+
+
+ Qt::Horizontal
+
40
@@ -179,8 +167,24 @@ background-color: #2f9836;
- -
-
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
40
diff --git a/Desktop/ui/main.ui b/Desktop/ui/main.ui
index 46fa0b7..64e5555 100644
--- a/Desktop/ui/main.ui
+++ b/Desktop/ui/main.ui
@@ -25,8 +25,8 @@
-
-
-
+
-
+
Qt::Horizontal
@@ -38,60 +38,6 @@
- -
-
-
-
- 50
- 50
-
-
-
-
- 50
- 50
-
-
-
-
- 21
- true
-
-
-
- #pushButton {
- background-color: rgb(228, 244, 204);
-border-radius: 25px;
-border: 1px solid rgb(0, 0, 0);
-}
-
-
- +
-
-
-
- -
-
-
- true
-
-
-
-
- 0
- 0
- 419
- 399
-
-
-
-
-
-
-
-
-
-
-
-
@@ -166,19 +112,6 @@ border: 1px solid rgb(0, 0, 0);
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
@@ -201,6 +134,60 @@ border: 1px solid rgb(0, 0, 0);
+ -
+
+
+
+ 50
+ 50
+
+
+
+
+ 50
+ 50
+
+
+
+
+ 21
+ true
+
+
+
+ #pushButton {
+ background-color: rgb(228, 244, 204);
+border-radius: 25px;
+border: 1px solid rgb(0, 0, 0);
+}
+
+
+ +
+
+
+
+ -
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 419
+ 399
+
+
+
+
-
+
+
+
+
+
+