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

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

This commit is contained in:
MoonTestUse1
2025-01-02 05:26:25 +06:00
parent 5823cbfc1b
commit 9dab06d2b9
5 changed files with 32 additions and 14 deletions

View File

@@ -16,6 +16,7 @@ services:
container_name: support-backend
environment:
- DATABASE_URL=postgresql://postgres:postgres123@postgres:5432/support_db
- TEST_DATABASE_URL=postgresql://postgres:postgres123@postgres:5432/support_db_test
ports:
- "8000:8000"
depends_on:
@@ -32,8 +33,10 @@ services:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres123
POSTGRES_DB: support_db
POSTGRES_MULTIPLE_DATABASES: support_db,support_db_test
volumes:
- postgres_data:/var/lib/postgresql/data
- ./backend/scripts/create-multiple-postgresql-databases.sh:/docker-entrypoint-initdb.d/create-multiple-postgresql-databases.sh
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d support_db"]
interval: 5s

View File

@@ -13,8 +13,8 @@ export const getStatusLabel = (status: string): string => {
const statuses: Record<string, string> = {
new: 'Новая',
in_progress: 'В работе',
resolved: 'Решена',
closed: 'Закрыта'
completed: 'Завершена',
rejected: 'Отклонена'
};
return statuses[status] || status;
};

View File

@@ -74,7 +74,7 @@
<!-- Статистика -->
<div v-if="activeSection === 'statistics'" class="space-y-6">
<h2 class="text-2xl font-medium text-gray-900">Статистика</h2>
<div class="grid grid-cols-1 gap-6 sm:grid-cols-3">
<div class="grid grid-cols-1 gap-6 sm:grid-cols-4">
<div class="bg-white p-6 rounded-lg shadow-sm border border-gray-200">
<div class="text-sm font-medium text-gray-500 mb-1">Новые заявки</div>
<div class="text-2xl font-medium text-gray-900">{{ statistics.new || 0 }}</div>
@@ -84,8 +84,12 @@
<div class="text-2xl font-medium text-gray-900">{{ statistics.inProgress || 0 }}</div>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm border border-gray-200">
<div class="text-sm font-medium text-gray-500 mb-1">Решенные</div>
<div class="text-2xl font-medium text-gray-900">{{ statistics.resolved || 0 }}</div>
<div class="text-sm font-medium text-gray-500 mb-1">Завершенные</div>
<div class="text-2xl font-medium text-gray-900">{{ statistics.completed || 0 }}</div>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm border border-gray-200">
<div class="text-sm font-medium text-gray-500 mb-1">Отклоненные</div>
<div class="text-2xl font-medium text-gray-900">{{ statistics.rejected || 0 }}</div>
</div>
</div>
</div>
@@ -130,7 +134,7 @@
Подробнее
</button>
<button
v-if="request.status !== 'resolved'"
v-if="request.status !== 'completed'"
@click="updateRequestStatus(request)"
class="text-blue-600 hover:text-blue-700"
>
@@ -246,7 +250,7 @@
Закрыть
</button>
<button
v-if="selectedRequest?.status !== 'resolved'"
v-if="selectedRequest?.status !== 'completed'"
@click="updateRequestStatus(selectedRequest)"
class="px-4 py-2 text-sm font-medium text-blue-600 hover:text-blue-700"
>
@@ -347,7 +351,8 @@ import axios from 'axios'
interface Statistics {
new: number
inProgress: number
resolved: number
completed: number
rejected: number
}
interface Employee {
@@ -366,7 +371,7 @@ interface Request {
request_type: string
priority: 'low' | 'medium' | 'high' | 'critical'
description: string
status: 'new' | 'in_progress' | 'resolved'
status: 'new' | 'in_progress' | 'completed' | 'rejected'
created_at: string
}
@@ -381,7 +386,7 @@ interface EmployeeForm {
const router = useRouter()
const activeSection = ref('statistics')
const statistics = ref<Statistics>({ new: 0, inProgress: 0, resolved: 0 })
const statistics = ref<Statistics>({ new: 0, inProgress: 0, completed: 0, rejected: 0 })
const requests = ref<Request[]>([])
const employees = ref<Employee[]>([])
const showRequestModal = ref(false)
@@ -407,7 +412,8 @@ const priorityClasses = {
const statusClasses = {
new: 'px-2 py-1 text-xs rounded-full bg-gray-100 text-gray-800',
in_progress: 'px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-800',
resolved: 'px-2 py-1 text-xs rounded-full bg-green-100 text-green-800'
completed: 'px-2 py-1 text-xs rounded-full bg-green-100 text-green-800',
rejected: 'px-2 py-1 text-xs rounded-full bg-red-100 text-red-800'
} as const
const getPriorityClass = (priority: Request['priority'] | undefined) => {
@@ -521,7 +527,9 @@ const updateRequestStatus = async (request: Request | null) => {
if (request.status === 'new') {
newStatus = 'in_progress'
} else if (request.status === 'in_progress') {
newStatus = 'resolved'
newStatus = 'completed'
} else if (request.status === 'completed') {
newStatus = 'rejected'
}
await axios.put(`/api/requests/${request.id}`, { status: newStatus }, { headers })

View File

@@ -113,10 +113,12 @@ const form = ref({
const handleSubmit = async () => {
try {
isSubmitting.value = true;
const token = localStorage.getItem('admin_token');
const response = await fetch('/api/employees/', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify(form.value)
});

View File

@@ -62,7 +62,12 @@ const employees = ref<Employee[]>([]);
const fetchEmployees = async () => {
try {
const response = await fetch('/api/employees/');
const token = localStorage.getItem('admin_token');
const response = await fetch('/api/employees/', {
headers: {
'Authorization': `Bearer ${token}`
}
});
if (!response.ok) throw new Error('Failed to fetch employees');
employees.value = await response.json();
} catch (error) {