This commit is contained in:
2026-02-07 01:34:08 +05:00
parent 8ff87ec2a8
commit 24d76d65ca
5 changed files with 281 additions and 278 deletions

View File

@@ -68,13 +68,13 @@ function renderStatsSection() {
<option value="ldap">LDAP</option>
</select>
</div>
</div>
<div class="filter-actions">
<button class="reset-btn" onclick="resetFilters()">Сбросить фильтры</button>
<button class="export-btn" onclick="exportStats()">Экспорт в CSV</button>
</div>
</div>
</div>
<!-- Детальная статистика -->
<div class="detailed-stats">
<div class="stats-summary">
@@ -554,8 +554,6 @@ function renderStatsTable() {
<td>
<div class="user-info">
<strong>${stat.userName || 'Не указано'}</strong>
<div class="user-login">${stat.userLogin || 'Нет логина'}</div>
<div class="user-email">${stat.userEmail || 'Нет email'}</div>
</div>
</td>
<td>

View File

@@ -5,273 +5,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>School CRM - Административная панель</title>
<link rel="stylesheet" href="/style.css">
<style>
/* Дополнительные стили для детальной статистики */
.filters-container {
background: #fff;
padding: 20px;
border-radius: 8px;
margin-bottom: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.filter-row {
display: flex;
gap: 20px;
margin-bottom: 15px;
flex-wrap: wrap;
}
.filter-group {
flex: 1;
min-width: 200px;
}
.filter-group label {
display: block;
margin-bottom: 5px;
font-weight: 600;
color: #333;
}
.filter-group select {
width: 100%;
padding: 8px 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
}
.filter-actions {
display: flex;
gap: 10px;
margin-top: 10px;
}
.users-stats-table {
width: 100%;
border-collapse: collapse;
background: #fff;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
border-radius: 8px;
overflow: hidden;
}
.users-stats-table th {
background: #f8f9fa;
padding: 12px 15px;
text-align: left;
font-weight: 600;
color: #333;
border-bottom: 2px solid #dee2e6;
}
.users-stats-table td {
padding: 12px 15px;
border-bottom: 1px solid #dee2e6;
}
.users-stats-table tr:hover {
background: #f8f9fa;
}
.statuses-container {
display: flex;
flex-direction: column;
gap: 4px;
}
.status-item {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
}
.status-badge {
display: inline-block;
padding: 3px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 600;
}
.status-assigned { background: #e3f2fd; color: #1976d2; }
.status-in-progress { background: #fff3e0; color: #f57c00; }
.status-completed { background: #e8f5e9; color: #388e3c; }
.status-overdue { background: #ffebee; color: #d32f2f; }
.status-rework { background: #f3e5f5; color: #7b1fa2; }
.status-count {
font-weight: 600;
min-width: 20px;
text-align: right;
}
.no-statuses {
color: #999;
font-style: italic;
font-size: 12px;
}
.user-role {
display: inline-block;
padding: 3px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 600;
background: #f5f5f5;
color: #666;
}
.user-role.admin { background: #ffebee; color: #d32f2f; }
.user-role.teacher { background: #e3f2fd; color: #1976d2; }
.stat-numbers {
display: flex;
gap: 10px;
margin-top: 5px;
}
.stat-number {
background: #f8f9fa;
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
}
.export-btn {
background: #28a745;
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
font-weight: 600;
}
.export-btn:hover {
background: #218838;
}
.reset-btn {
background: #6c757d;
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
}
.reset-btn:hover {
background: #5a6268;
}
.no-data {
text-align: center;
padding: 40px;
color: #666;
font-style: italic;
}
.stats-loading {
text-align: center;
padding: 40px;
color: #666;
}
.stats-error {
text-align: center;
padding: 40px;
color: #dc3545;
}
.pagination {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 20px;
}
.page-btn {
padding: 6px 12px;
border: 1px solid #ddd;
background: white;
border-radius: 4px;
cursor: pointer;
}
.page-btn.active {
background: #007bff;
color: white;
border-color: #007bff;
}
.page-btn:hover:not(.active) {
background: #f8f9fa;
}
.page-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.stats-summary {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.total-count {
font-weight: 600;
color: #333;
}
.page-dots {
padding: 6px 12px;
color: #666;
}
.user-info {
line-height: 1.4;
}
.user-login {
font-size: 12px;
color: #666;
}
.user-email {
font-size: 12px;
color: #999;
}
.stats-header {
margin-bottom: 20px;
}
.stats-header h2 {
margin-bottom: 5px;
}
.stats-header p {
color: #666;
margin: 0;
}
.overall-stats {
margin-bottom: 30px;
}
.overall-stats h3 {
margin-bottom: 15px;
}
.detailed-stats h3 {
margin-bottom: 15px;
}
</style>
</head>
<body>
<div id="login-modal" class="modal">

View File

@@ -3847,3 +3847,268 @@ button.btn-primary {
padding: 14px 20px; /* Увеличиваем внутренние отступы */
font-size: 1.1rem; /* Увеличиваем шрифт */
}
/* Дополнительные стили для детальной статистики */
.filters-container {
background: #fff;
padding: 20px;
border-radius: 8px;
margin-bottom: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.filter-row {
display: flex;
gap: 20px;
margin-bottom: 15px;
flex-wrap: wrap;
}
.filter-group {
flex: 1;
min-width: 200px;
}
.filter-group label {
display: block;
margin-bottom: 5px;
font-weight: 600;
color: #333;
}
.filter-group select {
width: 100%;
padding: 8px 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
}
.filter-actions {
display: flex;
gap: 10px;
margin-top: 10px;
}
.users-stats-table {
width: 100%;
border-collapse: collapse;
background: #fff;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
border-radius: 8px;
overflow: hidden;
}
.users-stats-table th {
background: #f8f9fa;
padding: 12px 15px;
text-align: left;
font-weight: 600;
color: #333;
border-bottom: 2px solid #dee2e6;
}
.users-stats-table td {
padding: 12px 15px;
border-bottom: 1px solid #dee2e6;
}
.users-stats-table tr:hover {
background: #f8f9fa;
}
.statuses-container {
display: flex;
flex-direction: column;
gap: 4px;
}
.status-item {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
}
.status-badge {
display: inline-block;
padding: 3px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 600;
}
.status-assigned { background: #e3f2fd; color: #1976d2; }
.status-in-progress { background: #fff3e0; color: #f57c00; }
.status-completed { background: #e8f5e9; color: #388e3c; }
.status-overdue { background: #ffebee; color: #d32f2f; }
.status-rework { background: #f3e5f5; color: #7b1fa2; }
.status-count {
font-weight: 600;
min-width: 20px;
text-align: right;
}
.no-statuses {
color: #999;
font-style: italic;
font-size: 12px;
}
.user-role {
display: inline-block;
padding: 3px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 600;
background: #f5f5f5;
color: #666;
}
.user-role.admin { background: #ffebee; color: #d32f2f; }
.user-role.teacher { background: #e3f2fd; color: #1976d2; }
.stat-numbers {
display: flex;
gap: 10px;
margin-top: 5px;
}
.stat-number {
background: #f8f9fa;
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
}
.export-btn {
background: #28a745;
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
font-weight: 600;
}
.export-btn:hover {
background: #218838;
}
.reset-btn {
background: #1976d2;
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
}
.reset-btn:hover {
background: #e00707;
}
.no-data {
text-align: center;
padding: 40px;
color: #666;
font-style: italic;
}
.stats-loading {
text-align: center;
padding: 40px;
color: #666;
}
.stats-error {
text-align: center;
padding: 40px;
color: #dc3545;
}
.pagination {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 20px;
}
.page-btn {
padding: 6px 12px;
border: 1px solid #ddd;
background: white;
border-radius: 4px;
cursor: pointer;
}
.page-btn.active {
background: #007bff;
color: white;
border-color: #007bff;
}
.page-btn:hover:not(.active) {
background: #f8f9fa;
}
.page-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.stats-summary {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.total-count {
font-weight: 600;
color: #333;
}
.page-dots {
padding: 6px 12px;
color: #666;
}
.user-info {
line-height: 1.4;
}
.user-login {
font-size: 12px;
color: #666;
}
.user-email {
font-size: 12px;
color: #999;
}
.stats-header {
margin-bottom: 20px;
}
.stats-header h2 {
margin-bottom: 5px;
}
.stats-header p {
color: #666;
margin: 0;
}
.overall-stats {
margin-bottom: 30px;
}
.overall-stats h3 {
margin-bottom: 15px;
}
.detailed-stats h3 {
margin-bottom: 15px;
}

View File

@@ -80,15 +80,16 @@ function renderTasks() {
</div>
<div class="task-content ${isExpanded ? 'expanded' : ''}">
${isExpanded ? `
<div class="task-actions">
${!isDeleted && !isClosed ? `
<button class="copy-btn" onclick="openTaskChat(${task.id})" title="Открыть чат">💬</button>
<button class="add-file-btn" onclick="openAddFileModal(${task.id})" title="Добавить файл">📎</button>
${currentUser && currentUser.login === 'kalugin.o' ? `<button class="edit-btn" onclick="openEditModal(${task.id})" title="Редактировать">✏️</button>` : ''}
${currentUser && currentUser.login === 'kalugin.o' ? `<button class="manage-assignees-btn" onclick="openManageAssigneesModal(${task.id})" title="Управление исполнителями">👥</button>` : ''}
${currentUser && currentUser.login === 'minicrm' ? `<button class="edit-btn" onclick="openEditModal(${task.id})" title="Редактировать">✏️</button>` : ''}
${currentUser && currentUser.login === 'minicrm' ? `<button class="manage-assignees-btn" onclick="openManageAssigneesModal(${task.id})" title="Управление исполнителями">👥</button>` : ''}
<button class="copy-btn" onclick="openCopyModal(${task.id})" title="Создать копию">📋</button>
${canEdit ? `<button class="rework-btn" onclick="openReworkModal(${task.id})" title="Вернуть на доработку">🔄</button>` : ''}
${canEdit ? `<button class="close-btn" onclick="closeTask(${task.id})" title="Закрыть задачу">🔒</button>` : ''}
${currentUser && currentUser.login === 'minicrm' ? `<button class="rework-btn" onclick="openReworkModal(${task.id})" title="Вернуть на доработку">🔄</button>` : ''}
${currentUser && currentUser.login === 'minicrm' ? `<button class="close-btn" onclick="closeTask(${task.id})" title="Закрыть задачу">🔒</button>` : ''}
${canEdit ? `<button class="delete-btn" onclick="deleteTask(${task.id})" title="Удалить">🗑️</button>` : ''}
` : ''}
${isClosed && canEdit ? `
@@ -98,6 +99,7 @@ ${currentUser && currentUser.login === 'kalugin.o' ? `<button class="manage-assi
<button class="restore-btn" onclick="restoreTask(${task.id})" title="Восстановить">↶</button>
` : ''}
</div>
` : ''}
${isCopy && task.original_task_title ? `
<div class="task-original">
@@ -139,7 +141,6 @@ ${task.assignments && task.assignments.length > 0 ?
${task.deleted_at ? `<br><small>Удалена: ${formatDateTime(task.deleted_at)}</small>` : ''}
${task.closed_at ? `<br><small>Закрыта: ${formatDateTime(task.closed_at)}</small>` : ''}
</div>
</div>
`;
}).join('');

View File

@@ -694,6 +694,9 @@ app.get('/api/postgres-health', requireAuth, async (req, res) => {
// Админ панель
app.get('/admin', (req, res) => {
if (!req.session.user) {
return res.redirect('/');
}
if (!req.session.user || req.session.user.role !== 'admin') {
return res.status(403).send('Доступ запрещен');
}
@@ -702,6 +705,9 @@ app.get('/admin', (req, res) => {
// Страница профилей пользователей (только для админов)
app.get('/admin/profiles', (req, res) => {
if (!req.session.user) {
return res.redirect('/');
}
if (!req.session.user || req.session.user.role !== 'admin') {
return res.status(403).send('Доступ запрещен');
}