diff --git a/backend/app/bot/notifications.py b/backend/app/bot/notifications.py index 313b183..c869615 100644 --- a/backend/app/bot/notifications.py +++ b/backend/app/bot/notifications.py @@ -3,10 +3,24 @@ Notifications module for the Telegram bot. Handles sending notifications about new requests and status updates. """ from aiogram import types -from .config import NOTIFICATION_CHAT_ID +from .config import settings # Изменено с NOTIFICATION_CHAT_ID на settings from . import bot from .handlers import get_updated_keyboard +# Константы для эмодзи +REQUEST_TYPE_EMOJI = { + "hardware": "🔧", + "software": "💻", + "network": "🌐", + "other": "📝" +} + +PRIORITY_EMOJI = { + "high": "🔴", + "medium": "🟡", + "low": "🟢" +} + async def send_notification(request_data: dict): """ Send notification about new request to Telegram chat. @@ -17,19 +31,19 @@ async def send_notification(request_data: dict): message_text = ( f"📋 Заявка #{request_data['id']}\n\n" f"👤 Сотрудник: {request_data['employee_last_name']} {request_data['employee_first_name']}\n" - f"🏢 Отдел: {department}\n" + f"🏢 Отдел: {request_data['department']}\n" f"🚪 Кабинет: {request_data['office']}\n" - f"{REQUEST_TYPE_EMOJI.get(request_data['request_type'], '📝')} Тип заявки: {request_type}\n" - f"{PRIORITY_EMOJI.get(request_data['priority'], '⚪')} Приоритет: {priority}\n\n" - f"📝 Описание:\n
{request_data['description']}\n\n" - f"🕒 Создана: {created_at}\n" - f"📊 Статус: {status}" + f"{REQUEST_TYPE_EMOJI.get(request_data['request_type'], '📝')} Тип заявки: {request_data['request_type']}\n" + f"{PRIORITY_EMOJI.get(request_data['priority'], '⚪')} Приоритет: {request_data['priority']}\n\n" + f"📝 Описание:\n{request_data['description']}\n\n" + f"🕒 Создана: {request_data['created_at']}" ) try: await bot.send_message( - chat_id=NOTIFICATION_CHAT_ID, + chat_id=settings.chat_id, # Используем settings.chat_id вместо NOTIFICATION_CHAT_ID text=message_text, + parse_mode="HTML", reply_markup=get_updated_keyboard(request_data['id'], "new") ) except Exception as e: diff --git a/frontend/src/components/admin/EmployeeList.vue b/frontend/src/components/admin/EmployeeList.vue index 1d4520e..d09c2fe 100644 --- a/frontend/src/components/admin/EmployeeList.vue +++ b/frontend/src/components/admin/EmployeeList.vue @@ -1,4 +1,3 @@ -