148 lines
7.7 KiB
HTML
148 lines
7.7 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="ru">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>Управление расписанием — Morozovka Portal</title>
|
||
<style>
|
||
body { background: #0d1117; color: #e6edf3; font-family: sans-serif; padding: 40px; }
|
||
.container { max-width: 900px; margin: 0 auto; }
|
||
h2 { color: #58a6ff; border-bottom: 1px solid #30363d; padding-bottom: 10px; }
|
||
h3 { color: #8b949e; margin-top: 30px; }
|
||
.card { background: #161b22; border: 1px solid #30363d; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
|
||
|
||
.form-row { display: flex; gap: 15px; margin-bottom: 15px; align-items: flex-end; }
|
||
.form-group { display: flex; flex-direction: column; flex: 1; }
|
||
.form-group label { margin-bottom: 5px; font-size: 0.85rem; color: #8b949e; }
|
||
input, select, textarea { padding: 8px; background: #0d1117; color: white; border: 1px solid #30363d; border-radius: 5px; font-family: inherit; }
|
||
textarea { resize: vertical; min-height: 60px; }
|
||
|
||
button { padding: 10px 15px; background: #238636; color: white; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; }
|
||
button:hover { background: #2ea043; }
|
||
button.danger { background: #da3633; }
|
||
button.danger:hover { background: #f85149; }
|
||
|
||
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
|
||
th, td { padding: 10px; text-align: left; border-bottom: 1px solid #30363d; }
|
||
th { background: #21262d; color: #8b949e; }
|
||
|
||
.back-link { display: inline-block; margin-bottom: 20px; color: #8b949e; text-decoration: none; }
|
||
.back-link:hover { color: #58a6ff; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="container">
|
||
<a href="/" class="back-link">← На главную</a>
|
||
<h2>Управление расписанием и статусом</h2>
|
||
|
||
<!-- Блок 1: Статус -->
|
||
<div class="card">
|
||
<h3>Текущий статус (выводится на главной странице)</h3>
|
||
<form action="/admin/schedule/status" method="POST">
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label>Статус</label>
|
||
<select name="status">
|
||
<option value="free" {% if status.status == 'free' %}selected{% endif %}>Свободен / Вне расписания</option>
|
||
<option value="on_place" {% if status.status == 'on_place' %}selected{% endif %}>На месте</option>
|
||
<option value="delayed" {% if status.status == 'delayed' %}selected{% endif %}>Опаздываю</option>
|
||
<option value="away" {% if status.status == 'away' %}selected{% endif %}>Вне вуза</option>
|
||
<option value="cancelled" {% if status.status == 'cancelled' %}selected{% endif %}>Отменено</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group" style="flex: 0.5;">
|
||
<label>Опоздание (мин)</label>
|
||
<input type="number" name="delay_minutes" value="{{ status.delay_minutes or 0 }}" min="0">
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Сообщение для студентов</label>
|
||
<input type="text" name="message" value="{{ status.message or '' }}" placeholder="Например: задерживаюсь на 15 минут">
|
||
</div>
|
||
<button type="submit">Обновить статус</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
<!-- Блок 2: Добавление события -->
|
||
<div class="card">
|
||
<h3>Добавить новое событие</h3>
|
||
<form action="/admin/schedule/event/add" method="POST">
|
||
<div class="form-row">
|
||
<div class="form-group" style="flex: 2;">
|
||
<label>Название</label>
|
||
<input type="text" name="title" required>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Тип</label>
|
||
<select name="event_type">
|
||
<option value="lecture">Лекция</option>
|
||
<option value="workshop">Мастер-класс</option>
|
||
<option value="meeting">Встреча</option>
|
||
<option value="personal">Личное</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Место</label>
|
||
<input type="text" name="location">
|
||
</div>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label>Начало</label>
|
||
<input type="datetime-local" name="start_time" required>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Конец</label>
|
||
<input type="datetime-local" name="end_time" required>
|
||
</div>
|
||
<div class="form-group" style="flex: 0.5; flex-direction: row; align-items: center; gap: 10px;">
|
||
<input type="checkbox" name="is_public" checked id="is_public">
|
||
<label for="is_public" style="margin: 0; cursor: pointer;">Публичное</label>
|
||
</div>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label>Описание</label>
|
||
<textarea name="description"></textarea>
|
||
</div>
|
||
<button type="submit" style="height: 60px;">Добавить</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
<!-- Блок 3: Список событий -->
|
||
<div class="card">
|
||
<h3>Запланированные события</h3>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Дата и время</th>
|
||
<th>Название</th>
|
||
<th>Тип</th>
|
||
<th>Публичное</th>
|
||
<th>Действие</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for event in events %}
|
||
<tr>
|
||
<td>{{ event.start_time.strftime('%d.%m %H:%M') }} - {{ event.end_time.strftime('%H:%M') }}</td>
|
||
<td><strong>{{ event.title }}</strong><br><small style="color:#8b949e">{{ event.location or '' }}</small></td>
|
||
<td>{{ event.event_type }}</td>
|
||
<td>{{ 'Да' if event.is_public else 'Нет' }}</td>
|
||
<td>
|
||
<form action="/admin/schedule/event/{{ event.id }}/delete" method="POST" onsubmit="return confirm('Удалить событие?');">
|
||
<button type="submit" class="danger">Удалить</button>
|
||
</form>
|
||
</td>
|
||
</tr>
|
||
{% else %}
|
||
<tr><td colspan="5" style="text-align: center; color: #8b949e;">Нет запланированных событий</td></tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
</div>
|
||
</body>
|
||
</html>
|