mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
доработка модального окна в управлении сотрудника2
This commit is contained in:
@@ -6,6 +6,16 @@
|
|||||||
<button class="close-button" @click.stop="closeModal">×</button>
|
<button class="close-button" @click.stop="closeModal">×</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="isLoading" class="loading-state">
|
||||||
|
<p>Загрузка заявок...</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="error" class="error-state">
|
||||||
|
<p>{{ error }}</p>
|
||||||
|
<button @click="fetchRequests" class="retry-button">Повторить</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
<div class="filters">
|
<div class="filters">
|
||||||
<div class="filter-group">
|
<div class="filter-group">
|
||||||
<label>Статус:</label>
|
<label>Статус:</label>
|
||||||
@@ -61,6 +71,7 @@
|
|||||||
<p>Заявки не найдены</p>
|
<p>Заявки не найдены</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -102,11 +113,13 @@ export default {
|
|||||||
async fetchRequests() {
|
async fetchRequests() {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
try {
|
try {
|
||||||
const response = await axios.get('/api/requests', {
|
console.log('Fetching requests...') // Для отладки
|
||||||
|
const response = await axios.get('/api/requests/all', {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${localStorage.getItem('admin_token')}`
|
Authorization: `Bearer ${localStorage.getItem('admin_token')}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
console.log('Requests response:', response.data) // Для отладки
|
||||||
this.requests = response.data
|
this.requests = response.data
|
||||||
|
|
||||||
// Получаем информацию о сотрудниках для отображения имен
|
// Получаем информацию о сотрудниках для отображения имен
|
||||||
@@ -115,6 +128,7 @@ export default {
|
|||||||
Authorization: `Bearer ${localStorage.getItem('admin_token')}`
|
Authorization: `Bearer ${localStorage.getItem('admin_token')}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
console.log('Employees response:', employeesResponse.data) // Для отладки
|
||||||
const employees = employeesResponse.data
|
const employees = employeesResponse.data
|
||||||
|
|
||||||
// Добавляем имена сотрудников к заявкам
|
// Добавляем имена сотрудников к заявкам
|
||||||
@@ -125,9 +139,11 @@ export default {
|
|||||||
employee_name: employee ? `${employee.last_name} ${employee.first_name}` : 'Неизвестный сотрудник'
|
employee_name: employee ? `${employee.last_name} ${employee.first_name}` : 'Неизвестный сотрудник'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
console.log('Processed requests:', this.requests) // Для отладки
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching requests:', error)
|
console.error('Error fetching requests:', error)
|
||||||
this.error = 'Ошибка при загрузке заявок'
|
this.error = 'Ошибка при загрузке заявок'
|
||||||
|
this.requests = []
|
||||||
} finally {
|
} finally {
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
}
|
}
|
||||||
@@ -370,6 +386,29 @@ export default {
|
|||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loading-state,
|
||||||
|
.error-state {
|
||||||
|
text-align: center;
|
||||||
|
padding: 2rem;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.retry-button {
|
||||||
|
background-color: #1a237e;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 1rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
transition: background-color 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.retry-button:hover {
|
||||||
|
background-color: #283593;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.modal-content {
|
.modal-content {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
|
|||||||
Reference in New Issue
Block a user