fix(telegram): edit messages in-place during server switch flow

Server switch flow now edits the original message at each step
(progress, error, company list) instead of sending separate messages.
"Server schimbat" notice is folded into the company selection header.
Also adds budget debt breakdown to dashboard formatter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-02-23 09:18:59 +00:00
parent 30f55cf18b
commit aac49542e4
2 changed files with 90 additions and 11 deletions

View File

@@ -63,6 +63,21 @@ def format_dashboard_response(data: Dict[str, Any], company_name: str = None) ->
if tva_recup_cur > 0:
text += f" - TVA de recuperat curent: {tva_recup_cur:,} RON\n"
# Datorii la Buget - breakdown pe grupe (TVA / BASS / CAM), valori luna precedentă
budget_breakdown = data.get('budget_debt_breakdown', [])
if budget_breakdown:
grupe_cu_datorie = [
g for g in budget_breakdown
if round(float(g.get('precedent', 0))) > 0
]
if grupe_cu_datorie:
total_buget = sum(round(float(g.get('precedent', 0))) for g in grupe_cu_datorie)
text += "\n\n**Datorii la Buget:**\n"
for grupa in grupe_cu_datorie:
val = round(float(grupa.get('precedent', 0)))
text += f" - {grupa.get('label', '')}: {val:,} RON\n"
text += f" Total: {total_buget:,} RON\n"
return text