87 lines
2.8 KiB
Python
87 lines
2.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
# hub/ticket/ui/dialogs/acceptance_dialog.py
|
|
|
|
"""UI-диалог акта приёмки Ticket."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from gui.containers import SContainer
|
|
|
|
from domain import TicketTaskSnapshot
|
|
from .base_document_dialog import BaseDocumentDialog
|
|
|
|
|
|
class AcceptanceDialog(BaseDocumentDialog):
|
|
"""Диалог подписания акта приёмки."""
|
|
|
|
def __init__(
|
|
self,
|
|
task: TicketTaskSnapshot,
|
|
parent=None,
|
|
):
|
|
self._work_description = None
|
|
self._executor_signature = None
|
|
self._customer_signature = None
|
|
super().__init__(
|
|
task=task,
|
|
title="Акт приёмки",
|
|
submit_text="Подписать акт",
|
|
parent=parent,
|
|
)
|
|
|
|
def build_payload(self) -> dict[str, str]:
|
|
return {
|
|
"work_description": self._work_description.get_text().strip(),
|
|
"executor_signature": self._executor_signature.get_text().strip(),
|
|
"customer_signature": self._customer_signature.get_text().strip(),
|
|
}
|
|
|
|
def _is_ready(self) -> bool:
|
|
payload = self.build_payload()
|
|
return bool(
|
|
payload["work_description"]
|
|
and payload["executor_signature"]
|
|
and payload["customer_signature"]
|
|
)
|
|
|
|
def _build_form(self, container: SContainer) -> None:
|
|
work_description_shell = SContainer(
|
|
height_percent=40,
|
|
orientation="v",
|
|
spacing=6,
|
|
content_fit=False,
|
|
)
|
|
self._work_description = self._populate_text_block(
|
|
work_description_shell,
|
|
"Описание выполненных работ",
|
|
"Опишите объём работ, который передаётся заказчику.",
|
|
)
|
|
container.add_widget(work_description_shell)
|
|
|
|
executor_signature_shell = SContainer(
|
|
height_percent=23,
|
|
orientation="v",
|
|
spacing=6,
|
|
content_fit=False,
|
|
)
|
|
self._executor_signature = self._populate_text_block(
|
|
executor_signature_shell,
|
|
"Исполнитель",
|
|
"Укажите ФИО и должность исполнителя.",
|
|
)
|
|
container.add_widget(executor_signature_shell)
|
|
|
|
customer_signature_shell = SContainer(
|
|
height_percent=23,
|
|
orientation="v",
|
|
spacing=6,
|
|
content_fit=False,
|
|
)
|
|
self._customer_signature = self._populate_text_block(
|
|
customer_signature_shell,
|
|
"Заказчик",
|
|
"Укажите ФИО и должность представителя заказчика.",
|
|
)
|
|
container.add_widget(customer_signature_shell)
|
|
self._refresh_submit_state()
|