Files
minicrm/public/admin.html
2026-02-06 17:11:56 +05:00

421 lines
13 KiB
HTML

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<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">
<div class="modal-content">
<h2>Вход в School CRM</h2>
<form id="login-form">
<div class="form-group">
<label for="login">Логин:</label>
<input type="text" id="login" name="login" required>
</div>
<div class="form-group">
<label for="password">Пароль:</label>
<input type="password" id="password" name="password" required>
</div>
<button type="submit">Войти</button>
</form>
<div class="test-users">
<h3>Тестовые пользователи:</h3>
<ul>
<li><strong>admin</strong> / admin123 (Администратор)</li>
<li><strong>teacher</strong> / teacher123</li>
</ul>
</div>
</div>
</div>
<div class="admin-container">
<div class="admin-header">
<h1>Административная панель</h1>
<div class="user-info">
<span id="current-user"></span>
<button onclick="window.location.href = '/'">Главная</button>
<button onclick="window.location.href = '/doc'">doc</button>
<button onclick="window.location.href = '/admin-doc'">Управление doc</button>
<button onclick="window.location.href = '/admin/profiles'">profiles</button>
<button onclick="logout()">Выйти</button>
</div>
</div>
<div class="admin-tabs">
<button class="admin-tab active" onclick="showAdminSection('dashboard')">Дашборд</button>
<button class="admin-tab" onclick="showAdminSection('users')">Пользователи</button>
<button class="admin-tab" onclick="showAdminSection('stats')">Статистика</button>
</div>
<!-- Контейнер для дашборда - будет заполняться JavaScript -->
<div id="admin-dashboard" class="admin-section active">
<!-- Дашборд будет загружен через JavaScript -->
</div>
<div id="admin-users-section" class="admin-section">
<h2>Управление пользователями</h2>
<div class="search-container">
<input type="text" id="user-search" placeholder="Поиск пользователей по логину, имени или email..." oninput="searchUsers()">
<button onclick="loadUsers()">Сбросить</button>
</div>
<table class="users-table">
<thead>
<tr>
<th>ID</th>
<th>Логин</th>
<th>Имя</th>
<th>Email</th>
<th>Роль</th>
<th>Тип</th>
<th>Дата создания</th>
<th>Последний вход</th>
<th>Действия</th>
</tr>
</thead>
<tbody id="users-table-body">
<tr>
<td colspan="9" class="loading">Загрузка пользователей...</td>
</tr>
</tbody>
</table>
</div>
<!-- Контейнер для детальной статистики -->
<div id="admin-stats-section" class="admin-section">
<!-- Детальная статистика будет загружена через JavaScript -->
</div>
</div>
<div id="edit-user-modal" class="modal">
<div class="modal-content modal-lg">
<span class="close" onclick="closeEditUserModal()">&times;</span>
<h3>Редактировать пользователя</h3>
<form id="edit-user-form">
<input type="hidden" id="edit-user-id">
<div class="form-row">
<div class="form-group">
<label for="edit-login">Логин *</label>
<input type="text" id="edit-login" name="login" required>
</div>
<div class="form-group">
<label for="edit-name">Имя *</label>
<input type="text" id="edit-name" name="name" required>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="edit-email">Email *</label>
<input type="email" id="edit-email" name="email" required>
</div>
<div class="form-group">
<label for="edit-role">Роль</label>
<select id="edit-role" name="role">
<option value="teacher">Учитель</option>
<option value="admin">Администратор</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="edit-auth-type">Тип авторизации</label>
<select id="edit-auth-type" name="auth_type">
<option value="local">Локальная</option>
<option value="ldap">LDAP</option>
</select>
</div>
<div class="form-group">
<label for="edit-groups">Группы (JSON)</label>
<input type="text" id="edit-groups" name="groups" placeholder='["group1", "group2"]'>
</div>
</div>
<div class="form-group">
<label for="edit-description">Описание</label>
<textarea id="edit-description" name="description" rows="3"></textarea>
</div>
<button type="submit">Сохранить изменения</button>
</form>
</div>
</div>
<script src="admin-script.js"></script>
<script src="admin-dashboard.js"></script>
<script src="admin-stats.js"></script>
</body>
</html>