/
Benis
/
Korochki
Обзор
Документация
Войти
/
Benis
/
Korochki
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
admin/dashboard.php
174 строки
9 KB
Benis
pervaya versyia Korochki.yest
13 май 2026, 12:37
13 май 2026, 12:37
1e34d0e
Код
Авторство
О чём код?
<?php session_start(); $page_title = 'Панель администратора — Корочки.есть'; if (!isset($_SESSION['user_id']) || $_SESSION['user_role'] !== 'admin') { header('Location: ../login.php'); exit(); } require_once '../php/application_functions.php'; $status_filter = $_GET['status'] ?? ''; $search = $_GET['search'] ?? ''; $page = isset($_GET['page']) ? (int)$_GET['page'] : 1; $items_per_page = 5; $applications = getAllApplicationsFiltered($status_filter, $search, $page, $items_per_page); $total_applications = getTotalApplicationsCount($status_filter, $search); $total_pages = ceil($total_applications / $items_per_page); include '../includes/header.php'; ?> <?php if (isset($_SESSION['admin_success'])): ?> <div data-success-message="<?php echo htmlspecialchars($_SESSION['admin_success']); ?>" style="display:none;"></div> <?php unset($_SESSION['admin_success']); ?> <?php endif; ?> <?php if (isset($_SESSION['admin_error'])): ?> <div data-error-message="<?php echo htmlspecialchars($_SESSION['admin_error']); ?>" style="display:none;"></div> <?php unset($_SESSION['admin_error']); ?> <?php endif; ?> <!-- Page header --> <div style="display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:36px;flex-wrap:wrap;gap:16px;"> <div> <h1 style="margin-bottom:4px;">Панель администратора</h1> <p style="color:var(--muted);font-size:.9rem;">Управление заявками на обучение</p> </div> </div> <!-- Stats --> <div class="row mb-4"> <div class="col-md-3"> <div class="card stat-card"> <h3><?php echo $total_applications; ?></h3> <p>Всего заявок</p> </div> </div> </div> <!-- Filters --> <div class="card mb-4"> <div style="display:flex;gap:16px;flex-wrap:wrap;align-items:flex-end;"> <div style="flex:1;min-width:180px;"> <label class="form-label">Статус</label> <select class="form-select" onchange="filterByStatus(this.value)"> <option value="all" <?php echo $status_filter === '' ? 'selected' : ''; ?>>Все статусы</option> <option value="Новая" <?php echo $status_filter === 'Новая' ? 'selected' : ''; ?>>Новые</option> <option value="Идет обучение" <?php echo $status_filter === 'Идет обучение' ? 'selected' : ''; ?>>В процессе</option> <option value="Обучение завершено" <?php echo $status_filter === 'Обучение завершено' ? 'selected' : ''; ?>>Завершённые</option> </select> </div> <div style="flex:2;min-width:220px;"> <label class="form-label">Поиск</label> <div class="input-group"> <input type="text" id="search-input" class="form-control" placeholder="ФИО или название курса" value="<?php echo htmlspecialchars($search); ?>"> <button class="btn btn-primary" onclick="searchApplications()"> <i class="fas fa-magnifying-glass"></i> </button> </div> </div> <div> <button class="btn btn-secondary" onclick="window.location.href='dashboard.php'"> <i class="fas fa-rotate-left"></i> Сбросить </button> </div> </div> </div> <!-- Table --> <div class="table-responsive"> <table class="table"> <thead> <tr> <th>#</th> <th>Пользователь</th> <th>Курс</th> <th>Дата начала</th> <th>Оплата</th> <th>Статус</th> <th>Подана</th> <th>Отзыв</th> <th>Действия</th> </tr> </thead> <tbody> <?php if (empty($applications)): ?> <tr> <td colspan="9" class="text-center" style="padding:40px;color:var(--muted);"> <i class="fas fa-inbox" style="font-size:1.5rem;display:block;margin-bottom:8px;opacity:.4;"></i> Заявки не найдены </td> </tr> <?php else: ?> <?php foreach ($applications as $app): ?> <tr> <td style="color:var(--muted);font-size:.82rem;"><?php echo $app['id']; ?></td> <td> <span style="font-weight:500;color:var(--cream);"><?php echo htmlspecialchars($app['user_name']); ?></span> <small><?php echo htmlspecialchars($app['user_email']); ?></small> </td> <td style="font-weight:500;color:var(--cream-dim);"><?php echo htmlspecialchars($app['course_name']); ?></td> <td><?php echo date('d.m.Y', strtotime($app['desired_start_date'])); ?></td> <td style="font-size:.88rem;"><?php echo htmlspecialchars($app['payment_method_name']); ?></td> <td> <span class="status-badge status-<?php echo $app['status'] === 'Новая' ? 'new' : ($app['status'] === 'Идет обучение' ? 'progress' : 'completed'); ?>"> <?php echo htmlspecialchars($app['status']); ?> </span> </td> <td style="color:var(--muted);font-size:.85rem;"><?php echo date('d.m.Y', strtotime($app['created_at'])); ?></td> <td> <?php if (!empty($app['review'])): ?> <span style="color:var(--gold);font-size:.85rem;" title="<?php echo htmlspecialchars($app['review']); ?>"> <i class="fas fa-star"></i> Есть </span> <?php else: ?> <span style="color:var(--muted);font-size:.82rem;">—</span> <?php endif; ?> </td> <td> <form action="update_status.php" method="POST" style="display:flex;gap:8px;align-items:center;"> <input type="hidden" name="application_id" value="<?php echo $app['id']; ?>"> <select name="status" class="form-select form-select-sm" style="width:140px;"> <option value="Новая" <?php echo $app['status'] === 'Новая' ? 'selected' : ''; ?>>Новая</option> <option value="Идет обучение" <?php echo $app['status'] === 'Идет обучение' ? 'selected' : ''; ?>>В процессе</option> <option value="Обучение завершено" <?php echo $app['status'] === 'Обучение завершено' ? 'selected' : ''; ?>>Завершена</option> </select> <button type="submit" class="btn btn-sm btn-success"> <i class="fas fa-check"></i> </button> </form> </td> </tr> <?php endforeach; ?> <?php endif; ?> </tbody> </table> </div> <!-- Pagination --> <?php if ($total_pages > 1): ?> <nav style="margin-top:24px;"> <ul class="pagination justify-content-center"> <li class="page-item <?php echo $page <= 1 ? 'disabled' : ''; ?>"> <a class="page-link" href="#" onclick="goToPage(<?php echo $page-1; ?>)"> <i class="fas fa-chevron-left" style="font-size:.75rem;"></i> </a> </li> <?php for ($i = 1; $i <= $total_pages; $i++): ?> <li class="page-item <?php echo $i === $page ? 'active' : ''; ?>"> <a class="page-link" href="#" onclick="goToPage(<?php echo $i; ?>)"><?php echo $i; ?></a> </li> <?php endfor; ?> <li class="page-item <?php echo $page >= $total_pages ? 'disabled' : ''; ?>"> <a class="page-link" href="#" onclick="goToPage(<?php echo $page+1; ?>)"> <i class="fas fa-chevron-right" style="font-size:.75rem;"></i> </a> </li> </ul> </nav> <?php endif; ?> <!-- notifications loaded in footer --></script> <?php include '../includes/footer.php'; ?>