mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
Починка добавления сотрудника
This commit is contained in:
@@ -3,10 +3,24 @@ Notifications module for the Telegram bot.
|
|||||||
Handles sending notifications about new requests and status updates.
|
Handles sending notifications about new requests and status updates.
|
||||||
"""
|
"""
|
||||||
from aiogram import types
|
from aiogram import types
|
||||||
from .config import NOTIFICATION_CHAT_ID
|
from .config import settings # Изменено с NOTIFICATION_CHAT_ID на settings
|
||||||
from . import bot
|
from . import bot
|
||||||
from .handlers import get_updated_keyboard
|
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):
|
async def send_notification(request_data: dict):
|
||||||
"""
|
"""
|
||||||
Send notification about new request to Telegram chat.
|
Send notification about new request to Telegram chat.
|
||||||
@@ -17,19 +31,19 @@ async def send_notification(request_data: dict):
|
|||||||
message_text = (
|
message_text = (
|
||||||
f"📋 <b>Заявка #{request_data['id']}</b>\n\n"
|
f"📋 <b>Заявка #{request_data['id']}</b>\n\n"
|
||||||
f"👤 <b>Сотрудник:</b> {request_data['employee_last_name']} {request_data['employee_first_name']}\n"
|
f"👤 <b>Сотрудник:</b> {request_data['employee_last_name']} {request_data['employee_first_name']}\n"
|
||||||
f"🏢 <b>Отдел:</b> {department}\n"
|
f"🏢 <b>Отдел:</b> {request_data['department']}\n"
|
||||||
f"🚪 <b>Кабинет:</b> {request_data['office']}\n"
|
f"🚪 <b>Кабинет:</b> {request_data['office']}\n"
|
||||||
f"{REQUEST_TYPE_EMOJI.get(request_data['request_type'], '📝')} <b>Тип заявки:</b> {request_type}\n"
|
f"{REQUEST_TYPE_EMOJI.get(request_data['request_type'], '📝')} <b>Тип заявки:</b> {request_data['request_type']}\n"
|
||||||
f"{PRIORITY_EMOJI.get(request_data['priority'], '⚪')} <b>Приоритет:</b> {priority}\n\n"
|
f"{PRIORITY_EMOJI.get(request_data['priority'], '⚪')} <b>Приоритет:</b> {request_data['priority']}\n\n"
|
||||||
f"📝 <b>Описание:</b>\n<blockquote>{request_data['description']}</blockquote>\n\n"
|
f"📝 <b>Описание:</b>\n{request_data['description']}\n\n"
|
||||||
f"🕒 <b>Создана:</b> {created_at}\n"
|
f"🕒 <b>Создана:</b> {request_data['created_at']}"
|
||||||
f"📊 <b>Статус:</b> {status}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await bot.send_message(
|
await bot.send_message(
|
||||||
chat_id=NOTIFICATION_CHAT_ID,
|
chat_id=settings.chat_id, # Используем settings.chat_id вместо NOTIFICATION_CHAT_ID
|
||||||
text=message_text,
|
text=message_text,
|
||||||
|
parse_mode="HTML",
|
||||||
reply_markup=get_updated_keyboard(request_data['id'], "new")
|
reply_markup=get_updated_keyboard(request_data['id'], "new")
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import { departments } from '@/utils/constants';
|
import { departments } from '@/utils/constants';
|
||||||
|
Reference in New Issue
Block a user