mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
Починка добавления сотрудника
This commit is contained in:
@@ -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 . import bot
|
||||||
from .handlers import get_updated_keyboard
|
from .handlers import get_updated_keyboard
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
request_data (dict): Request data including id, description, etc.
|
||||||
|
"""
|
||||||
message_text = (
|
message_text = (
|
||||||
f"Новая заявка №{request_data['id']}\n"
|
f"📋 <b>Заявка #{request_data['id']}</b>\n\n"
|
||||||
f"Отдел: {request_data['department']}\n"
|
f"👤 <b>Сотрудник:</b> {request_data['employee_last_name']} {request_data['employee_first_name']}\n"
|
||||||
f"Тип: {request_data['request_type']}\n"
|
f"🏢 <b>Отдел:</b> {department}\n"
|
||||||
f"Приоритет: {request_data['priority']}\n"
|
f"🚪 <b>Кабинет:</b> {request_data['office']}\n"
|
||||||
f"Описание: {request_data['description']}"
|
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:
|
try:
|
||||||
await bot.send_message(
|
await bot.send_message(
|
||||||
chat_id=settings.chat_id,
|
chat_id=NOTIFICATION_CHAT_ID,
|
||||||
text=message_text,
|
text=message_text,
|
||||||
reply_markup=get_updated_keyboard(request_data['id'], "new")
|
reply_markup=get_updated_keyboard(request_data['id'], "new")
|
||||||
)
|
)
|
||||||
|
@@ -3,11 +3,13 @@
|
|||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import { departments } from '@/utils/constants';
|
import { departments } from '@/utils/constants';
|
||||||
import type { Employee } from '@/types/employee';
|
import type { Employee } from '@/types/employee';
|
||||||
|
import EmployeeForm from './EmployeeForm.vue'; // Добавляем импорт
|
||||||
|
|
||||||
const employees = ref<Employee[]>([]); // Добавляем типизацию массива сотрудников
|
const employees = ref<Employee[]>([]);
|
||||||
const showAddForm = ref(false);
|
const showAddForm = ref(false);
|
||||||
const editingEmployee = ref<Employee | null>(null);
|
const editingEmployee = ref<Employee | null>(null);
|
||||||
|
|
||||||
|
|
||||||
function getDepartmentLabel(value: string) {
|
function getDepartmentLabel(value: string) {
|
||||||
return departments.find(d => d.value === value)?.label || value;
|
return departments.find(d => d.value === value)?.label || value;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user