1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

Починка добавления сотрудника

This commit is contained in:
MoonTestUse1
2024-12-27 02:08:13 +06:00
parent 985ea2ca4e
commit 80efa4c6e4
2 changed files with 25 additions and 10 deletions

View File

@@ -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"📋 <b>Заявка #{request_data['id']}</b>\n\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['office']}\n"
f"{REQUEST_TYPE_EMOJI.get(request_data['request_type'], '📝')} <b>Тип заявки:</b> {request_type}\n"
f"{PRIORITY_EMOJI.get(request_data['priority'], '')} <b>Приоритет:</b> {priority}\n\n"
f"📝 <b>Описание:</b>\n<blockquote>{request_data['description']}</blockquote>\n\n"
f"🕒 <b>Создана:</b> {created_at}\n"
f"📊 <b>Статус:</b> {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")
)

View File

@@ -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<Employee[]>([]); // Добавляем типизацию массива сотрудников
const employees = ref<Employee[]>([]);
const showAddForm = ref(false);
const editingEmployee = ref<Employee | null>(null);
function getDepartmentLabel(value: string) {
return departments.find(d => d.value === value)?.label || value;
}