Add Dispatch_V0.1.1
This commit is contained in:
11
Dispatch_V0.1.1/ui/dialogs/report_dialogs/__init__.py
Normal file
11
Dispatch_V0.1.1/ui/dialogs/report_dialogs/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# hub/ticket/ui/dialogs/report_dialogs/__init__.py
|
||||
|
||||
"""Диалоги отчётов Ticket."""
|
||||
|
||||
from .report_dialog import DiagnosticReportDialog, RepairReportDialog
|
||||
|
||||
__all__ = [
|
||||
"DiagnosticReportDialog",
|
||||
"RepairReportDialog",
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
137
Dispatch_V0.1.1/ui/dialogs/report_dialogs/report_dialog.py
Normal file
137
Dispatch_V0.1.1/ui/dialogs/report_dialogs/report_dialog.py
Normal file
@@ -0,0 +1,137 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# hub/ticket/ui/dialogs/report_dialogs/report_dialog.py
|
||||
|
||||
"""UI-диалоги отчётов Ticket поверх application document-flow."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from gui.containers import SContainer
|
||||
|
||||
from domain import TicketTaskSnapshot
|
||||
from ui.dialogs.base_document_dialog import BaseDocumentDialog
|
||||
|
||||
|
||||
class DiagnosticReportDialog(BaseDocumentDialog):
|
||||
"""Диалог диагностического отчёта."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
task: TicketTaskSnapshot,
|
||||
parent=None,
|
||||
):
|
||||
self._initial_cause = None
|
||||
self._actual_cause = None
|
||||
super().__init__(
|
||||
task=task,
|
||||
title="Диагностический отчёт",
|
||||
submit_text="Подписать диагностику",
|
||||
parent=parent,
|
||||
)
|
||||
|
||||
def build_payload(self) -> dict[str, str]:
|
||||
return {
|
||||
"initial_cause": self._initial_cause.get_text().strip(),
|
||||
"actual_cause": self._actual_cause.get_text().strip(),
|
||||
}
|
||||
|
||||
def _is_ready(self) -> bool:
|
||||
payload = self.build_payload()
|
||||
return bool(payload["initial_cause"] and payload["actual_cause"])
|
||||
|
||||
def _build_form(self, container: SContainer) -> None:
|
||||
initial_cause_shell = SContainer(
|
||||
height_percent=48,
|
||||
orientation="v",
|
||||
spacing=6,
|
||||
content_fit=False,
|
||||
)
|
||||
self._initial_cause = self._populate_text_block(
|
||||
initial_cause_shell,
|
||||
"Первичное заключение",
|
||||
"Кратко опишите исходную причину неисправности.",
|
||||
)
|
||||
container.add_widget(initial_cause_shell)
|
||||
|
||||
actual_cause_shell = SContainer(
|
||||
height_percent=48,
|
||||
orientation="v",
|
||||
spacing=6,
|
||||
content_fit=False,
|
||||
)
|
||||
self._actual_cause = self._populate_text_block(
|
||||
actual_cause_shell,
|
||||
"Вторичное заключение",
|
||||
"Зафиксируйте подтверждённую причину по итогам диагностики.",
|
||||
)
|
||||
container.add_widget(actual_cause_shell)
|
||||
self._refresh_submit_state()
|
||||
|
||||
|
||||
class RepairReportDialog(BaseDocumentDialog):
|
||||
"""Диалог ремонтного отчёта."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
task: TicketTaskSnapshot,
|
||||
parent=None,
|
||||
):
|
||||
self._work_done = None
|
||||
self._used_parts = None
|
||||
self._recommendations = None
|
||||
super().__init__(
|
||||
task=task,
|
||||
title="Ремонтный отчёт",
|
||||
submit_text="Подписать ремонт",
|
||||
parent=parent,
|
||||
)
|
||||
|
||||
def build_payload(self) -> dict[str, str]:
|
||||
return {
|
||||
"work_done": self._work_done.get_text().strip(),
|
||||
"used_parts": self._used_parts.get_text().strip(),
|
||||
"recommendations": self._recommendations.get_text().strip(),
|
||||
}
|
||||
|
||||
def _is_ready(self) -> bool:
|
||||
return bool(self.build_payload()["work_done"])
|
||||
|
||||
def _build_form(self, container: SContainer) -> None:
|
||||
work_done_shell = SContainer(
|
||||
height_percent=31,
|
||||
orientation="v",
|
||||
spacing=6,
|
||||
content_fit=False,
|
||||
)
|
||||
self._work_done = self._populate_text_block(
|
||||
work_done_shell,
|
||||
"Выполненные работы",
|
||||
"Опишите фактически выполненные работы.",
|
||||
)
|
||||
container.add_widget(work_done_shell)
|
||||
|
||||
used_parts_shell = SContainer(
|
||||
height_percent=31,
|
||||
orientation="v",
|
||||
spacing=6,
|
||||
content_fit=False,
|
||||
)
|
||||
self._used_parts = self._populate_text_block(
|
||||
used_parts_shell,
|
||||
"Использованные запчасти",
|
||||
"Перечислите использованные узлы и материалы, если они были.",
|
||||
)
|
||||
container.add_widget(used_parts_shell)
|
||||
|
||||
recommendations_shell = SContainer(
|
||||
height_percent=31,
|
||||
orientation="v",
|
||||
spacing=6,
|
||||
content_fit=False,
|
||||
)
|
||||
self._recommendations = self._populate_text_block(
|
||||
recommendations_shell,
|
||||
"Рекомендации",
|
||||
"Добавьте рекомендации для следующего обслуживания.",
|
||||
)
|
||||
container.add_widget(recommendations_shell)
|
||||
self._refresh_submit_state()
|
||||
Reference in New Issue
Block a user