Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ def __init__(self, parent: QWidget):
self.application_date.date_input.setDate(QDate.currentDate())
self.application_subject = LabeledComboBoxComponent("Wniosek o", self, required=True)
self.application_subject.combobox.setPlaceholderText("Wybierz z listy...")
for issue, description in ISSUE_DESCRIPTION_NOMINATIVE_MAPPER.items():
self.application_subject.addItem(description, issue)
self.populate_application_subject()
self.application_subject.combobox.currentTextChanged.connect(self.change_application_subject)

self.application_reason = LabeledComboBoxComponent("Z uwagi na", self, required=True)
Expand Down Expand Up @@ -80,6 +79,15 @@ def change_application_subject(self):
self.application_reason_2.setVisible(False)

self.application_period.combobox.clear()
self.populate_application_reason(application_subject)

def populate_application_subject(self) -> None:
for issue, description in ISSUE_DESCRIPTION_NOMINATIVE_MAPPER.items():
self.application_subject.combobox.addItem(description, issue)

def populate_application_reason(self, application_subject: LabeledComboBoxComponent | None = None) -> None:
if not application_subject:
application_subject = self.application_subject.combobox.currentData()
Comment on lines +82 to +90
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏


for reason, reason_description in self.get_list_of_primary_reasons(application_subject).items():
self.application_reason.addItem(reason_description, reason)
Expand Down Expand Up @@ -171,7 +179,7 @@ def activity_form(self) -> ActivityForm | None:
return self._activity_form.combobox.currentData()

def clear(self):
self.application_date.date_input.clear()
self.application_date.date_input.setDate(QDate.currentDate())
self.application_subject.remove_selection()
self.application_reason.remove_selection()
self.application_reason_2.remove_selection()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ def meeting_data(self) -> MeetingData:

def clear(self):
self.meeting_leader.remove_selection()
self.meeting_leader.combobox.clear()
self.meeting_date.date_input.setDate(QDate.currentDate())
self.meeting_time.clear()
self.meeting_member_group.clear()
Expand Down
17 changes: 14 additions & 3 deletions alinka/widget/containers/main_body/footer/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ def __init__(self, parent: QWidget, visible: bool = False):

self.cancel_btn = QPushButton("Anuluj", self)
self.cancel_btn.clicked.connect(self.cancel_application)
layout.addWidget(self.cancel_btn)

layout.addStretch()

self.print_btn = QPushButton("Drukuj dokumenty", self)
self.print_btn.clicked.connect(self.print_documents)
self.print_btn.setFixedWidth(200)
layout.addWidget(self.print_btn)
self.clear_application_btn = QPushButton("Wyczyść formularz", self)
layout.addWidget(self.print_btn, stretch=3)
self.clear_application_btn.clicked.connect(self.clear_application)
layout.addWidget(self.clear_application_btn, stretch=1)
layout.addWidget(self.cancel_btn)

self.setVisible(visible)

Expand Down Expand Up @@ -82,3 +84,12 @@ def cancel_application(self) -> None:

self.content_container.main_body_container.header_container.set_info_message("Tworzenie dokumentu anulowane")
self.redirect_to_browser()

def clear_application(self):
if not ConfirmationModal(
self,
"Potwierdzenie usunięcia zmian",
"Czy na pewno chcesz usunąć wszystkie wprowadzone dane?",
).confirm():
return
self.content_container.application_container.clear()
Loading
Loading