feat: UI/UX cleanup V1 with header, import requisites, and status fixes
This commit is contained in:
@@ -14,12 +14,35 @@ class BoqDocument(Base):
|
||||
name = Column(String, nullable=False)
|
||||
version = Column(String)
|
||||
source_file = Column(String)
|
||||
document_number = Column(String)
|
||||
document_date = Column(Date)
|
||||
contract = Column(String)
|
||||
created_at = Column(DateTime, default=func.now())
|
||||
|
||||
# Relationship to project
|
||||
project = relationship("Project", back_populates="boq_documents")
|
||||
agreement = relationship("Agreement", back_populates="boq_documents", foreign_keys=[agreement_id])
|
||||
|
||||
_TECHNICAL_PREFIXES = (
|
||||
"BOQ Import - ",
|
||||
"BOQ Import — ",
|
||||
"BOQ Import —",
|
||||
"BOQ Import -",
|
||||
"Импорт ведомости — ",
|
||||
"Импорт ведомости - ",
|
||||
"Импорт ведомости —",
|
||||
"Импорт ведомости -",
|
||||
)
|
||||
|
||||
@property
|
||||
def display_name(self) -> str:
|
||||
name = (self.name or "").strip()
|
||||
for prefix in self._TECHNICAL_PREFIXES:
|
||||
if name.startswith(prefix):
|
||||
name = name[len(prefix):].strip(" —-–")
|
||||
break
|
||||
return name or f"Ведомость #{self.id}"
|
||||
|
||||
def __repr__(self):
|
||||
return f"<BoqDocument(id={self.id}, name='{self.name}')>"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user