From 80efa4c6e44ac03d5e5daf888967093f6495dff7 Mon Sep 17 00:00:00 2001 From: MoonTestUse1 Date: Fri, 27 Dec 2024 02:08:13 +0600 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D1=87=D0=B8=D0=BD=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=81=D0=BE=D1=82=D1=80=D1=83=D0=B4=D0=BD=D0=B8=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/bot/notifications.py | 31 +++++++++++++------ .../src/components/admin/EmployeeList.vue | 4 ++- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/backend/app/bot/notifications.py b/backend/app/bot/notifications.py index 397f5a4..313b183 100644 --- a/backend/app/bot/notifications.py +++ b/backend/app/bot/notifications.py @@ -1,21 +1,34 @@ -"""Notifications module for the Telegram bot""" -from .config import settings +""" +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 . import bot from .handlers import get_updated_keyboard async def send_notification(request_data: dict): - """Send notification about new request to Telegram chat""" + """ + Send notification about new request to Telegram chat. + + Args: + request_data (dict): Request data including id, description, etc. + """ message_text = ( - f"Новая заявка №{request_data['id']}\n" - f"Отдел: {request_data['department']}\n" - f"Тип: {request_data['request_type']}\n" - f"Приоритет: {request_data['priority']}\n" - f"Описание: {request_data['description']}" + f"📋 Заявка #{request_data['id']}\n\n" + f"👤 Сотрудник: {request_data['employee_last_name']} {request_data['employee_first_name']}\n" + f"🏢 Отдел: {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}" ) try: await bot.send_message( - chat_id=settings.chat_id, + chat_id=NOTIFICATION_CHAT_ID, text=message_text, reply_markup=get_updated_keyboard(request_data['id'], "new") ) diff --git a/frontend/src/components/admin/EmployeeList.vue b/frontend/src/components/admin/EmployeeList.vue index cebd0bf..1d4520e 100644 --- a/frontend/src/components/admin/EmployeeList.vue +++ b/frontend/src/components/admin/EmployeeList.vue @@ -3,11 +3,13 @@ import { ref, onMounted } from 'vue'; import { departments } from '@/utils/constants'; import type { Employee } from '@/types/employee'; +import EmployeeForm from './EmployeeForm.vue'; // Добавляем импорт -const employees = ref([]); // Добавляем типизацию массива сотрудников +const employees = ref([]); const showAddForm = ref(false); const editingEmployee = ref(null); + function getDepartmentLabel(value: string) { return departments.find(d => d.value === value)?.label || value; }