generated from dopt-python/py311
prepare insertion of sessions
This commit is contained in:
+64
-82
@@ -2887,14 +2887,6 @@ class Session:
|
|||||||
user_name: str | None = None
|
user_name: str | None = None
|
||||||
|
|
||||||
|
|
||||||
@dc.dataclass(slots=True)
|
|
||||||
class Page_Consulting_State:
|
|
||||||
session: Session | None = None
|
|
||||||
un_id: InitRecId | None = None
|
|
||||||
pers_id: InitRecId | None = None
|
|
||||||
cons_type: ConsultingType | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@dc.dataclass(slots=True)
|
@dc.dataclass(slots=True)
|
||||||
class ConsultingSession:
|
class ConsultingSession:
|
||||||
user_id: UserId
|
user_id: UserId
|
||||||
@@ -2907,6 +2899,15 @@ class ConsultingSession:
|
|||||||
response: str
|
response: str
|
||||||
|
|
||||||
|
|
||||||
|
@dc.dataclass(slots=True)
|
||||||
|
class Page_Consulting_State:
|
||||||
|
session: Session | None = None
|
||||||
|
un_id: InitRecId | None = None
|
||||||
|
pers_id: InitRecId | None = None
|
||||||
|
cons_type: ConsultingType | None = None
|
||||||
|
cons_sessions: list[ConsultingSession] = dc.field(default_factory=list)
|
||||||
|
|
||||||
|
|
||||||
class Page_Consulting(QWidget):
|
class Page_Consulting(QWidget):
|
||||||
back_main_requested = Signal() # back to main page
|
back_main_requested = Signal() # back to main page
|
||||||
back_requested = Signal(bool) # back to init rec (bool: reset yes/no)
|
back_requested = Signal(bool) # back to init rec (bool: reset yes/no)
|
||||||
@@ -3016,10 +3017,9 @@ class Page_Consulting(QWidget):
|
|||||||
|
|
||||||
container_layout.addSpacing(30)
|
container_layout.addSpacing(30)
|
||||||
|
|
||||||
# self.title_company_name = HeaderCell("Unternehmen: n.v.", font_size=16)
|
type_group_box = QGroupBox("Typ")
|
||||||
# container_layout.addWidget(self.title_company_name)
|
type_layout = QVBoxLayout(type_group_box)
|
||||||
container_layout.addWidget(QLabel("PLATZHALTER"))
|
container_layout.addWidget(type_group_box)
|
||||||
|
|
||||||
self.type_pauschal_btn = QRadioButton("Pauschalberatung")
|
self.type_pauschal_btn = QRadioButton("Pauschalberatung")
|
||||||
self.type_individual_btn = QRadioButton("Individualberatung")
|
self.type_individual_btn = QRadioButton("Individualberatung")
|
||||||
|
|
||||||
@@ -3030,81 +3030,26 @@ class Page_Consulting(QWidget):
|
|||||||
self.type_group.addButton(self.type_individual_btn, 1)
|
self.type_group.addButton(self.type_individual_btn, 1)
|
||||||
self.type_group.idClicked.connect(self.type_consulting_changed)
|
self.type_group.idClicked.connect(self.type_consulting_changed)
|
||||||
|
|
||||||
container_layout.addWidget(self.type_pauschal_btn)
|
type_layout.addWidget(self.type_pauschal_btn)
|
||||||
container_layout.addWidget(self.type_individual_btn)
|
type_layout.addWidget(self.type_individual_btn)
|
||||||
|
|
||||||
container_layout.addSpacing(20)
|
container_layout.addSpacing(20)
|
||||||
|
|
||||||
# separation in left and right
|
self.layout_sessions = QVBoxLayout()
|
||||||
# main_hor_layout = QHBoxLayout()
|
self.layout_sessions.setContentsMargins(0, 0, 0, 0)
|
||||||
# main_hor_layout.setSpacing(20)
|
container_layout.addLayout(self.layout_sessions)
|
||||||
# # main_hor_layout.setContentsMargins(20, 20, 20, 20)
|
self.btn_add_cons_session = QPushButton("+ Hinzufügen")
|
||||||
|
self.btn_add_cons_session.setStyleSheet(
|
||||||
|
"color: #0369a1; font-weight: bold; border: 1px dashed #0369a1; padding: 5px;"
|
||||||
|
)
|
||||||
|
self.btn_add_cons_session.clicked.connect(self.add_cons_entry)
|
||||||
|
self.layout_sessions.addWidget(self.btn_add_cons_session)
|
||||||
|
self.layout_sessions.addStretch(1)
|
||||||
|
|
||||||
# # left column
|
self.cons_entries: list[QWidget] = []
|
||||||
# left_frame = QFrame()
|
|
||||||
# left_frame.setObjectName("Segment")
|
|
||||||
# left_frame.setSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Maximum)
|
|
||||||
# left_layout = QVBoxLayout(left_frame)
|
|
||||||
# main_hor_layout.addWidget(left_frame, stretch=1, alignment=Qt.AlignmentFlag.AlignTop)
|
|
||||||
# master_data_label = HeaderCell("Stammdaten & Vermerke")
|
|
||||||
# master_data_label.setSizePolicy(
|
|
||||||
# QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed
|
|
||||||
# )
|
|
||||||
# left_layout.addWidget(master_data_label)
|
|
||||||
# # self.table_master_data = MasterDataTable()
|
|
||||||
# default_labels = tuple(self.COMPANY_FETAURES_MASTER_DATA.values())
|
|
||||||
# self.table_master_data = MasterDataFormWidget(default_labels)
|
|
||||||
# left_layout.addWidget(self.table_master_data)
|
|
||||||
# left_layout.addWidget(QLabel("PLATZHALTER Vermerke: Welche Notizen?"))
|
|
||||||
|
|
||||||
# # right column
|
# self.layout_sessions.addStretch()
|
||||||
# right_column_layout = QVBoxLayout()
|
|
||||||
# right_column_layout.setSpacing(20)
|
|
||||||
# main_hor_layout.addLayout(right_column_layout, stretch=1)
|
|
||||||
|
|
||||||
# # top right area
|
|
||||||
# top_right_frame = QFrame()
|
|
||||||
# top_right_frame.setObjectName("Segment")
|
|
||||||
# top_right_frame.setSizePolicy(
|
|
||||||
# QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Maximum
|
|
||||||
# )
|
|
||||||
# top_right_layout = QVBoxLayout(top_right_frame)
|
|
||||||
# common_consultancy_label = HeaderCell("Pauschalberatung")
|
|
||||||
# common_consultancy_label.setSizePolicy(
|
|
||||||
# QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed
|
|
||||||
# )
|
|
||||||
# top_right_layout.addWidget(common_consultancy_label)
|
|
||||||
# top_right_new_btn = QPushButton("+ Hinzufügen")
|
|
||||||
# top_right_new_btn.setSizePolicy(
|
|
||||||
# QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed
|
|
||||||
# )
|
|
||||||
# top_right_new_btn.setMinimumHeight(30)
|
|
||||||
# top_right_layout.addWidget(top_right_new_btn)
|
|
||||||
|
|
||||||
# # bottom right area
|
|
||||||
# bottom_right_frame = QFrame()
|
|
||||||
# bottom_right_frame.setObjectName("Segment")
|
|
||||||
# bottom_right_frame.setSizePolicy(
|
|
||||||
# QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Maximum
|
|
||||||
# )
|
|
||||||
# bottom_right_layout = QVBoxLayout(bottom_right_frame)
|
|
||||||
# individual_consultancy_label = HeaderCell("Individualberatung")
|
|
||||||
# individual_consultancy_label.setSizePolicy(
|
|
||||||
# QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed
|
|
||||||
# )
|
|
||||||
# bottom_right_layout.addWidget(individual_consultancy_label)
|
|
||||||
# bottom_right_new_btn = QPushButton("+ Hinzufügen")
|
|
||||||
# bottom_right_new_btn.setSizePolicy(
|
|
||||||
# QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed
|
|
||||||
# )
|
|
||||||
# bottom_right_new_btn.setMinimumHeight(30)
|
|
||||||
# bottom_right_layout.addWidget(bottom_right_new_btn)
|
|
||||||
|
|
||||||
# right_column_layout.addWidget(top_right_frame)
|
|
||||||
# right_column_layout.addWidget(bottom_right_frame)
|
|
||||||
# right_column_layout.addStretch(1)
|
|
||||||
|
|
||||||
# container_layout.addLayout(main_hor_layout)
|
|
||||||
container_layout.addStretch()
|
container_layout.addStretch()
|
||||||
|
|
||||||
# --- STYLE ---
|
# --- STYLE ---
|
||||||
@@ -3139,6 +3084,43 @@ class Page_Consulting(QWidget):
|
|||||||
# }
|
# }
|
||||||
# """)
|
# """)
|
||||||
|
|
||||||
|
def add_cons_entry(self) -> None:
|
||||||
|
logger_gui.debug("[Consulting Page] Adding entry...")
|
||||||
|
|
||||||
|
row_widget = QWidget()
|
||||||
|
entry_row = QHBoxLayout(row_widget)
|
||||||
|
entry_fields = QHBoxLayout()
|
||||||
|
entry_row.addLayout(entry_fields)
|
||||||
|
|
||||||
|
txt1 = QLineEdit()
|
||||||
|
txt2 = QPlainTextEdit()
|
||||||
|
txt2.setMaximumHeight(100)
|
||||||
|
entry_fields.addWidget(txt1)
|
||||||
|
entry_fields.addWidget(txt2)
|
||||||
|
|
||||||
|
del_btn = QPushButton("🗑️")
|
||||||
|
del_btn.setFixedSize(30, 30)
|
||||||
|
# Lambda with default parameter to delete exactly this(!) box
|
||||||
|
del_btn.clicked.connect(
|
||||||
|
lambda checked=False, widget=row_widget: self.remove_cons_entry(widget)
|
||||||
|
)
|
||||||
|
entry_row.addWidget(del_btn)
|
||||||
|
|
||||||
|
row_widget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
|
||||||
|
# row_widget.setMaximumHeight(200)
|
||||||
|
|
||||||
|
self.cons_entries.append(row_widget)
|
||||||
|
self.layout_sessions.insertWidget(self.layout_sessions.count() - 2, row_widget)
|
||||||
|
|
||||||
|
def remove_cons_entry(
|
||||||
|
self,
|
||||||
|
row_widget: QWidget,
|
||||||
|
) -> None:
|
||||||
|
logger_gui.debug("[Consulting Page]: Delete clicked...")
|
||||||
|
self.layout_sessions.removeWidget(row_widget)
|
||||||
|
row_widget.deleteLater()
|
||||||
|
self.cons_entries.remove(row_widget)
|
||||||
|
|
||||||
# TODO placeholder, check if needed
|
# TODO placeholder, check if needed
|
||||||
def _sync_state_to_ui(self) -> None: ...
|
def _sync_state_to_ui(self) -> None: ...
|
||||||
|
|
||||||
@@ -3148,7 +3130,7 @@ class Page_Consulting(QWidget):
|
|||||||
self,
|
self,
|
||||||
button_id: int,
|
button_id: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
logger_gui.debug("[Consultin Page] Trigger type buttons...")
|
logger_gui.debug("[Consulting Page] Trigger type buttons...")
|
||||||
|
|
||||||
cons_type: ConsultingType
|
cons_type: ConsultingType
|
||||||
if button_id == 0:
|
if button_id == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user