feat(telegram): Unify Trezorerie button (Casa + Banca combined)

- Replace separate [Trezorerie Casa] and [Trezorerie Banca] buttons
  with single unified [Trezorerie] button in main menu
- Add format_treasury_combined_response() formatter showing:
  - Grand total (Sold Trezorerie)
  - Casa section with total + all accounts
  - Banca section with total + all accounts
- Compact menu layout: Row 2 [Sold Companie][Trezorerie],
  Row 3 [Sold Clienti][Sold Furnizori], Row 4 [Evolutie Incasari]
- Use Romanian number format (period as thousands separator)

Also includes:
- Oracle pool: Support both SERVICE_NAME and SID connections
  (ORACLE_SERVICE_NAME takes priority over ORACLE_SID)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-30 19:15:05 +02:00
parent ab160b628d
commit 4a886f0b64
9 changed files with 843 additions and 19 deletions

View File

@@ -1483,6 +1483,37 @@ async def handle_menu_callback(query, telegram_user_id: int, callback_data: str)
is_callback=True
)
elif action == "trezorerie":
# Trezorerie unified (Casa + Banca combined)
from backend.modules.telegram.bot.helpers import get_treasury_breakdown_split
treasury_data = await get_treasury_breakdown_split(company['id'], jwt_token)
from backend.modules.telegram.bot.formatters import format_treasury_combined_response, add_performance_footer
from backend.modules.telegram.bot.menus import create_action_buttons, format_response_with_company
content = format_treasury_combined_response(treasury_data)
response = format_response_with_company(content, company['name'])
# Add performance footer if cache metadata is available
if 'cache_hit' in treasury_data and 'response_time_ms' in treasury_data:
cache_hit = treasury_data['cache_hit']
response_time_ms = treasury_data['response_time_ms']
cache_source = treasury_data.get('cache_source', None)
response = add_performance_footer(response, cache_hit, response_time_ms, cache_source)
keyboard = create_action_buttons("trezorerie", show_export=False, show_refresh=False)
try:
await query.edit_message_text(
response,
reply_markup=keyboard,
parse_mode=ParseMode.MARKDOWN
)
except Exception as e:
# Ignore "Message is not modified" error
if "Message is not modified" not in str(e):
raise
elif action == "casa":
# Trezorerie casa
from backend.modules.telegram.bot.helpers import get_treasury_breakdown_split