mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
Починка админки полностью
This commit is contained in:
@@ -1,12 +1,19 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import type { Request } from '@/types/request';
|
|
||||||
|
interface Request {
|
||||||
|
id: number;
|
||||||
|
employee_last_name: string;
|
||||||
|
request_type: string;
|
||||||
|
status: string;
|
||||||
|
created_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
export function useRequests() {
|
export function useRequests() {
|
||||||
const requests = ref<Request[]>([]);
|
const requests = ref<Request[]>([]);
|
||||||
|
|
||||||
const fetchRequests = async () => {
|
const fetchRequests = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/api/admin/requests');
|
const response = await fetch('/api/requests/');
|
||||||
if (!response.ok) throw new Error('Failed to fetch requests');
|
if (!response.ok) throw new Error('Failed to fetch requests');
|
||||||
requests.value = await response.json();
|
requests.value = await response.json();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@@ -1,22 +1,20 @@
|
|||||||
const STATUS_LABELS: Record<string, string> = {
|
export const getRequestTypeLabel = (type: string): string => {
|
||||||
|
const types: Record<string, string> = {
|
||||||
|
hardware: 'Оборудование',
|
||||||
|
software: 'Программное обеспечение',
|
||||||
|
network: 'Сеть',
|
||||||
|
access: 'Доступ',
|
||||||
|
other: 'Другое'
|
||||||
|
};
|
||||||
|
return types[type] || type;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getStatusLabel = (status: string): string => {
|
||||||
|
const statuses: Record<string, string> = {
|
||||||
new: 'Новая',
|
new: 'Новая',
|
||||||
in_progress: 'В работе',
|
in_progress: 'В работе',
|
||||||
resolved: 'Решена',
|
resolved: 'Решена',
|
||||||
closed: 'Закрыта'
|
closed: 'Закрыта'
|
||||||
};
|
};
|
||||||
|
return statuses[status] || status;
|
||||||
const REQUEST_TYPE_LABELS: Record<string, string> = {
|
};
|
||||||
hardware: 'Проблемы с оборудованием',
|
|
||||||
software: 'Проблемы с ПО',
|
|
||||||
network: 'Проблемы с сетью',
|
|
||||||
access: 'Доступ к системам',
|
|
||||||
other: 'Другое'
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getStatusLabel = (status: string): string => {
|
|
||||||
return STATUS_LABELS[status] || status;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getRequestTypeLabel = (type: string): string => {
|
|
||||||
return REQUEST_TYPE_LABELS[type] || type;
|
|
||||||
};
|
|
Reference in New Issue
Block a user