redisign and bug fix
This commit is contained in:
parent
a18b5ad1ce
commit
8542ce8e01
10 changed files with 1622 additions and 1169 deletions
|
|
@ -3,37 +3,58 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Админка - Расписание</title>
|
||||
<link rel="stylesheet" href="/admin/static/style.css">
|
||||
<title>Админка расписания</title>
|
||||
<link rel="stylesheet" href="/admin/static/style.css?v=3">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1>Админка расписания</h1>
|
||||
<div class="week-navigation">
|
||||
<button id="prev-week">← Предыдущая неделя</button>
|
||||
<span id="week-range"></span>
|
||||
<button id="next-week">Следующая неделя →</button>
|
||||
<div class="app-shell">
|
||||
<header class="hero">
|
||||
<div>
|
||||
<p class="eyebrow">Schedule Studio</p>
|
||||
<h1>Редактор расписания</h1>
|
||||
<p class="hero-copy">Планируйте задачи и занятия на несколько недель вперед, меняйте серии целиком и переносите встречи прямо мышкой по сетке времени.</p>
|
||||
</div>
|
||||
<div class="hero-actions">
|
||||
<button id="today-btn" class="btn btn-secondary">Текущая неделя</button>
|
||||
<button id="add-task-btn" class="btn btn-secondary">Новая задача</button>
|
||||
<button id="add-event-btn" class="btn btn-primary">Новое занятие</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="actions">
|
||||
<button id="add-task-btn" class="btn btn-primary">➕ Добавить задачу</button>
|
||||
<button id="add-event-btn" class="btn btn-primary">➕ Добавить занятие</button>
|
||||
|
||||
<section class="toolbar">
|
||||
<div class="week-navigation">
|
||||
<button id="prev-week" class="nav-btn">← Назад</button>
|
||||
<div>
|
||||
<div class="toolbar-label">Видимый диапазон</div>
|
||||
<div id="week-range" class="range-title"></div>
|
||||
</div>
|
||||
<button id="next-week" class="nav-btn">Вперед →</button>
|
||||
</div>
|
||||
<div class="legend">
|
||||
<span class="legend-chip task-chip">Задачи</span>
|
||||
<span class="legend-chip event-chip">Занятия</span>
|
||||
<span class="legend-chip recurring-chip">Цикличные</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="hint-panel">
|
||||
<span>Клик по дню добавляет занятие.</span>
|
||||
<span>`Ctrl/Cmd + клик` открывает создание задачи.</span>
|
||||
<span>Перетаскивайте карточки занятий на новое время или другой день.</span>
|
||||
</section>
|
||||
|
||||
<div class="schedule-scroll">
|
||||
<main id="schedule-grid" class="schedule-grid"></main>
|
||||
</div>
|
||||
|
||||
<div id="schedule-grid" class="schedule-grid"></div>
|
||||
</div>
|
||||
|
||||
<!-- Модальное окно для добавления/редактирования -->
|
||||
|
||||
<div id="modal" class="modal">
|
||||
<div class="modal-content">
|
||||
<span class="close">×</span>
|
||||
<button class="close" type="button" aria-label="Закрыть">×</button>
|
||||
<div id="modal-body"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/admin/static/script.js"></script>
|
||||
|
||||
<script src="/admin/static/script.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,264 +1,513 @@
|
|||
:root {
|
||||
--bg: #f6efe5;
|
||||
--paper: rgba(255, 252, 248, 0.88);
|
||||
--paper-strong: #fffaf2;
|
||||
--text: #1f2937;
|
||||
--muted: #6b7280;
|
||||
--line: rgba(123, 92, 62, 0.18);
|
||||
--brand: #d97706;
|
||||
--brand-deep: #9a3412;
|
||||
--task: #15803d;
|
||||
--event: #0f766e;
|
||||
--accent: #f59e0b;
|
||||
--shadow: 0 20px 55px rgba(101, 67, 33, 0.12);
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||
background: #f5f5f5;
|
||||
padding: 20px;
|
||||
min-height: 100vh;
|
||||
font-family: Georgia, "Times New Roman", serif;
|
||||
color: var(--text);
|
||||
background:
|
||||
radial-gradient(circle at top left, rgba(217, 119, 6, 0.18), transparent 28%),
|
||||
radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.14), transparent 22%),
|
||||
linear-gradient(180deg, #f9f4ec 0%, #efe5d5 100%);
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1400px;
|
||||
.app-shell {
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
header {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
.hero,
|
||||
.toolbar,
|
||||
.hint-panel,
|
||||
.day-card,
|
||||
.modal-content {
|
||||
backdrop-filter: blur(14px);
|
||||
background: var(--paper);
|
||||
border: 1px solid rgba(255, 255, 255, 0.55);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
header h1 {
|
||||
margin-bottom: 15px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.week-navigation {
|
||||
.hero {
|
||||
border-radius: 30px;
|
||||
padding: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.week-navigation button {
|
||||
padding: 8px 16px;
|
||||
background: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.week-navigation button:hover {
|
||||
background: #45a049;
|
||||
}
|
||||
|
||||
#week-range {
|
||||
font-weight: 600;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.actions {
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 10px 20px;
|
||||
.eyebrow {
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.2em;
|
||||
font-size: 12px;
|
||||
color: var(--brand-deep);
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.hero h1 {
|
||||
font-size: clamp(34px, 4vw, 56px);
|
||||
line-height: 0.95;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.hero-copy {
|
||||
max-width: 760px;
|
||||
font-size: 18px;
|
||||
line-height: 1.5;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.hero-actions,
|
||||
.week-navigation,
|
||||
.legend,
|
||||
.hint-panel,
|
||||
.task-list,
|
||||
.item-actions,
|
||||
.scope-row,
|
||||
.form-row {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.hero-actions {
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.btn,
|
||||
.nav-btn {
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
border-radius: 999px;
|
||||
padding: 12px 18px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
|
||||
}
|
||||
|
||||
.btn:hover,
|
||||
.nav-btn:hover {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: #2196F3;
|
||||
background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background: #0b7dda;
|
||||
.btn-secondary,
|
||||
.nav-btn {
|
||||
background: rgba(255, 248, 236, 0.95);
|
||||
color: var(--text);
|
||||
border: 1px solid rgba(123, 92, 62, 0.16);
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
border-radius: 24px;
|
||||
padding: 18px 22px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.toolbar-label {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.15em;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.range-title {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.legend {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.legend-chip {
|
||||
padding: 8px 12px;
|
||||
border-radius: 999px;
|
||||
font-size: 13px;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.task-chip {
|
||||
background: rgba(21, 128, 61, 0.12);
|
||||
color: var(--task);
|
||||
}
|
||||
|
||||
.event-chip {
|
||||
background: rgba(15, 118, 110, 0.12);
|
||||
color: var(--event);
|
||||
}
|
||||
|
||||
.recurring-chip {
|
||||
background: rgba(245, 158, 11, 0.16);
|
||||
color: var(--brand-deep);
|
||||
}
|
||||
|
||||
.hint-panel {
|
||||
border-radius: 20px;
|
||||
padding: 14px 18px;
|
||||
margin-bottom: 22px;
|
||||
flex-wrap: wrap;
|
||||
color: var(--muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.schedule-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
gap: 15px;
|
||||
grid-template-columns: repeat(7, minmax(220px, 1fr));
|
||||
gap: 14px;
|
||||
padding-bottom: 8px;
|
||||
min-width: 1624px;
|
||||
}
|
||||
|
||||
.day-column {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
.schedule-scroll {
|
||||
overflow-x: auto;
|
||||
overflow-y: visible;
|
||||
padding-bottom: 10px;
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
|
||||
.day-card {
|
||||
border-radius: 26px;
|
||||
padding: 16px;
|
||||
min-height: 820px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.day-card.is-today {
|
||||
outline: 2px solid rgba(217, 119, 6, 0.28);
|
||||
}
|
||||
|
||||
.day-header {
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 2px solid #4CAF50;
|
||||
color: #333;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 16px;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.day-items {
|
||||
min-height: 200px;
|
||||
.day-title {
|
||||
font-size: 22px;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.item {
|
||||
background: #f9f9f9;
|
||||
padding: 10px;
|
||||
margin-bottom: 8px;
|
||||
border-radius: 4px;
|
||||
border-left: 3px solid #4CAF50;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
.day-subtitle {
|
||||
color: var(--muted);
|
||||
margin-top: 6px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.item:hover {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
.item.task {
|
||||
border-left-color: #FF9800;
|
||||
}
|
||||
|
||||
.item.event {
|
||||
border-left-color: #2196F3;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-weight: 500;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.item-time {
|
||||
.day-badge {
|
||||
border-radius: 999px;
|
||||
background: rgba(217, 119, 6, 0.12);
|
||||
color: var(--brand-deep);
|
||||
padding: 8px 10px;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.task-section {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.section-label {
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.15em;
|
||||
color: var(--muted);
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.task-list {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.task-item,
|
||||
.empty-state {
|
||||
border-radius: 18px;
|
||||
padding: 12px 14px;
|
||||
}
|
||||
|
||||
.task-item {
|
||||
background: rgba(21, 128, 61, 0.08);
|
||||
border: 1px solid rgba(21, 128, 61, 0.16);
|
||||
}
|
||||
|
||||
.task-title,
|
||||
.event-title {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.meta-text {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.item-actions {
|
||||
margin-top: 8px;
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
margin-top: 10px;
|
||||
flex-wrap: wrap;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.item-actions button {
|
||||
padding: 4px 8px;
|
||||
font-size: 11px;
|
||||
.task-item.is-active .item-actions,
|
||||
.event-block.is-active .item-actions {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.item-action {
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
border-radius: 999px;
|
||||
padding: 6px 10px;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-edit {
|
||||
background: #FFC107;
|
||||
color: #333;
|
||||
.item-action.edit {
|
||||
background: rgba(15, 118, 110, 0.12);
|
||||
color: var(--event);
|
||||
}
|
||||
|
||||
.btn-delete {
|
||||
background: #f44336;
|
||||
.item-action.delete {
|
||||
background: rgba(154, 52, 18, 0.12);
|
||||
color: var(--brand-deep);
|
||||
}
|
||||
|
||||
.timeline {
|
||||
position: relative;
|
||||
height: 576px;
|
||||
border-radius: 22px;
|
||||
background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(252, 246, 238, 0.95) 100%);
|
||||
border: 1px solid var(--line);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.timeline-dropzone {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
.timeline-hour {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 48px;
|
||||
border-top: 1px solid rgba(123, 92, 62, 0.12);
|
||||
}
|
||||
|
||||
.timeline-hour-label {
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
left: 10px;
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
background: rgba(255, 250, 242, 0.9);
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.event-block {
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
right: 14px;
|
||||
border-radius: 18px;
|
||||
padding: 12px 14px;
|
||||
background: linear-gradient(160deg, rgba(15, 118, 110, 0.92), rgba(17, 94, 89, 0.84));
|
||||
color: white;
|
||||
box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
|
||||
cursor: grab;
|
||||
user-select: none;
|
||||
transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
|
||||
}
|
||||
|
||||
.event-block.recurring {
|
||||
outline: 2px solid rgba(245, 158, 11, 0.55);
|
||||
}
|
||||
|
||||
.event-block.is-active {
|
||||
transform: scale(1.01);
|
||||
box-shadow: 0 18px 32px rgba(15, 118, 110, 0.28);
|
||||
}
|
||||
|
||||
.event-block.dragging {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.event-time {
|
||||
font-size: 12px;
|
||||
opacity: 0.82;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
color: var(--muted);
|
||||
border: 1px dashed rgba(123, 92, 62, 0.2);
|
||||
background: rgba(255, 255, 255, 0.35);
|
||||
}
|
||||
|
||||
/* Модальное окно */
|
||||
.modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(41, 28, 16, 0.38);
|
||||
z-index: 1000;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background-color: white;
|
||||
margin: 5% auto;
|
||||
padding: 30px;
|
||||
border-radius: 8px;
|
||||
width: 90%;
|
||||
max-width: 500px;
|
||||
width: min(720px, 100%);
|
||||
max-height: calc(100vh - 48px);
|
||||
overflow-y: auto;
|
||||
margin: 0 auto;
|
||||
border-radius: 28px;
|
||||
padding: 28px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
top: 15px;
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
color: #aaa;
|
||||
top: 18px;
|
||||
right: 18px;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 999px;
|
||||
border: none;
|
||||
background: rgba(123, 92, 62, 0.08);
|
||||
cursor: pointer;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.close:hover {
|
||||
color: #000;
|
||||
.modal-title {
|
||||
font-size: 30px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.modal-subtitle {
|
||||
color: var(--muted);
|
||||
margin-bottom: 22px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 15px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.form-group.full {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 6px;
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.form-group input,
|
||||
.form-group select,
|
||||
.form-group textarea {
|
||||
.form-group textarea,
|
||||
.form-group select {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
padding: 12px 14px;
|
||||
border-radius: 16px;
|
||||
border: 1px solid rgba(123, 92, 62, 0.18);
|
||||
background: rgba(255, 255, 255, 0.85);
|
||||
font-size: 15px;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.form-group textarea {
|
||||
min-height: 80px;
|
||||
min-height: 108px;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.checkbox-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
.checkbox-card,
|
||||
.scope-card {
|
||||
border-radius: 18px;
|
||||
border: 1px solid rgba(123, 92, 62, 0.14);
|
||||
background: rgba(255, 250, 242, 0.8);
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.checkbox-group input[type="checkbox"] {
|
||||
.checkbox-card input,
|
||||
.scope-card input {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.weekdays-select {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 10px;
|
||||
.scope-row {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.weekdays-select label {
|
||||
.scope-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
font-weight: normal;
|
||||
gap: 10px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.actions-row {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 18px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.schedule-grid {
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
min-width: 1624px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.schedule-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
@media (max-width: 860px) {
|
||||
body {
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.schedule-grid {
|
||||
.hero,
|
||||
.toolbar {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.form-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.timeline {
|
||||
height: 520px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,22 +4,33 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Расписание</title>
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
<link rel="stylesheet" href="/static/style.css?v=3">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div id="today-section" class="day-section">
|
||||
<h1 class="day-title" id="today-title">Сегодня</h1>
|
||||
<div id="today-content"></div>
|
||||
</div>
|
||||
|
||||
<div id="tomorrow-section" class="day-section">
|
||||
<h1 class="day-title" id="tomorrow-title">Завтра</h1>
|
||||
<div id="tomorrow-content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/script.js?v=2"></script>
|
||||
<main class="board">
|
||||
<section class="board-hero">
|
||||
<p class="board-label">Сегодня и завтра</p>
|
||||
<h1>Расписание на ближайшие дни</h1>
|
||||
<p class="board-copy">Задачи отображаются сверху, занятия ниже по времени. Данные обновляются автоматически каждые пять минут.</p>
|
||||
</section>
|
||||
|
||||
<section class="days-grid">
|
||||
<article id="today-section" class="day-panel">
|
||||
<div class="panel-head">
|
||||
<h2 class="day-title" id="today-title">Сегодня</h2>
|
||||
</div>
|
||||
<div id="today-content"></div>
|
||||
</article>
|
||||
|
||||
<article id="tomorrow-section" class="day-panel">
|
||||
<div class="panel-head">
|
||||
<h2 class="day-title" id="tomorrow-title">Завтра</h2>
|
||||
</div>
|
||||
<div id="tomorrow-content"></div>
|
||||
</article>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<script src="/static/script.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,88 +1,35 @@
|
|||
const TZ = 'Europe/Moscow';
|
||||
const MOSCOW_TIMEZONE = 'Europe/Moscow';
|
||||
const WEEKDAYS = ['Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота', 'Воскресенье'];
|
||||
const MONTHS = ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'];
|
||||
|
||||
function formatDate(dateStr) {
|
||||
const date = new Date(dateStr + 'T00:00:00');
|
||||
// getDay() возвращает 0=воскресенье, 1=понедельник, ..., 6=суббота
|
||||
// Конвертируем в формат где 0=понедельник
|
||||
const jsDay = date.getDay();
|
||||
const weekdayIndex = jsDay === 0 ? 6 : jsDay - 1; // 0=пн, 6=вс
|
||||
const weekdays = ['Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота', 'Воскресенье'];
|
||||
const months = ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня',
|
||||
'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'];
|
||||
|
||||
const weekday = weekdays[weekdayIndex];
|
||||
const day = date.getDate();
|
||||
const month = months[date.getMonth()];
|
||||
|
||||
return `${weekday}, ${day} ${month}`;
|
||||
}
|
||||
|
||||
function getTodayInMoscow() {
|
||||
// Получаем текущую дату в таймзоне Moscow
|
||||
const now = new Date();
|
||||
function getMoscowDateString() {
|
||||
const formatter = new Intl.DateTimeFormat('en-CA', {
|
||||
timeZone: 'Europe/Moscow',
|
||||
timeZone: MOSCOW_TIMEZONE,
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit'
|
||||
});
|
||||
return formatter.format(now);
|
||||
return formatter.format(new Date());
|
||||
}
|
||||
|
||||
function getTomorrowInLondon() {
|
||||
const today = getTodayInMoscow();
|
||||
const date = new Date(today);
|
||||
date.setDate(date.getDate() + 1);
|
||||
return date.toISOString().split('T')[0];
|
||||
function parseISODate(value) {
|
||||
const [year, month, day] = value.split('-').map(Number);
|
||||
return new Date(year, month - 1, day);
|
||||
}
|
||||
|
||||
function renderDay(container, titleEl, dateStr, items, isToday = false, isTomorrow = false) {
|
||||
let titleText = formatDate(dateStr);
|
||||
if (isToday) {
|
||||
// Преобразуем "Вторник, 30 декабря" в "Сегодня вторник, 30 декабря"
|
||||
const parts = titleText.split(', ');
|
||||
if (parts.length === 2) {
|
||||
titleText = `Сегодня ${parts[0].toLowerCase()}, ${parts[1]}`;
|
||||
}
|
||||
} else if (isTomorrow) {
|
||||
// Преобразуем "Среда, 31 декабря" в "Завтра среда, 31 декабря"
|
||||
const parts = titleText.split(', ');
|
||||
if (parts.length === 2) {
|
||||
titleText = `Завтра ${parts[0].toLowerCase()}, ${parts[1]}`;
|
||||
}
|
||||
}
|
||||
titleEl.textContent = titleText;
|
||||
|
||||
const tasks = items.filter(item => item.kind === 'task');
|
||||
const events = items.filter(item => item.kind === 'event');
|
||||
|
||||
let html = '';
|
||||
|
||||
if (tasks.length > 0) {
|
||||
html += '<div class="tasks-list">';
|
||||
tasks.forEach(task => {
|
||||
html += `<div class="task-item">• ${task.title}</div>`;
|
||||
});
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
if (events.length > 0) {
|
||||
html += '<div class="events-list">';
|
||||
events.sort((a, b) => a.start_time.localeCompare(b.start_time)).forEach(event => {
|
||||
const endTime = calculateEndTime(event.start_time, event.duration_min);
|
||||
html += `<div class="event-item">
|
||||
<span class="event-time">${event.start_time}-${endTime}</span>
|
||||
<span class="event-title">${event.title}</span>
|
||||
</div>`;
|
||||
});
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
if (tasks.length === 0 && events.length === 0) {
|
||||
html = '<div class="empty-message">На этот день расписания нет.</div>';
|
||||
}
|
||||
|
||||
container.innerHTML = html;
|
||||
function formatISODate(date) {
|
||||
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
function addDays(dateStr, days) {
|
||||
const date = parseISODate(dateStr);
|
||||
date.setDate(date.getDate() + days);
|
||||
return formatISODate(date);
|
||||
}
|
||||
|
||||
function formatDate(dateStr) {
|
||||
const date = parseISODate(dateStr);
|
||||
return `${WEEKDAYS[(date.getDay() + 6) % 7]}, ${date.getDate()} ${MONTHS[date.getMonth()]}`;
|
||||
}
|
||||
|
||||
function calculateEndTime(startTime, durationMin) {
|
||||
|
|
@ -93,49 +40,79 @@ function calculateEndTime(startTime, durationMin) {
|
|||
return `${String(endHour).padStart(2, '0')}:${String(endMinute).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
async function loadSchedule() {
|
||||
const today = getTodayInMoscow();
|
||||
const tomorrow = getTomorrowInLondon();
|
||||
|
||||
console.log('Loading schedule from', today, 'to', tomorrow);
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/schedule?from_date=${today}&to_date=${tomorrow}`);
|
||||
const data = await response.json();
|
||||
|
||||
console.log('Received items:', data.items);
|
||||
|
||||
const todayItems = data.items.filter(item => item.date === today);
|
||||
const tomorrowItems = data.items.filter(item => item.date === tomorrow);
|
||||
|
||||
console.log('Today items:', todayItems);
|
||||
console.log('Tomorrow items:', tomorrowItems);
|
||||
|
||||
renderDay(
|
||||
document.getElementById('today-content'),
|
||||
document.getElementById('today-title'),
|
||||
today,
|
||||
todayItems,
|
||||
true, // isToday
|
||||
false
|
||||
);
|
||||
|
||||
renderDay(
|
||||
document.getElementById('tomorrow-content'),
|
||||
document.getElementById('tomorrow-title'),
|
||||
tomorrow,
|
||||
tomorrowItems,
|
||||
false,
|
||||
true // isTomorrow
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('Error loading schedule:', error);
|
||||
function renderDay(container, titleEl, dateStr, items, options = {}) {
|
||||
let titleText = formatDate(dateStr);
|
||||
if (options.today) {
|
||||
titleText = `Сегодня, ${titleText.toLowerCase()}`;
|
||||
} else if (options.tomorrow) {
|
||||
titleText = `Завтра, ${titleText.toLowerCase()}`;
|
||||
}
|
||||
titleEl.textContent = titleText;
|
||||
|
||||
const tasks = items.filter((item) => item.kind === 'task');
|
||||
const events = items
|
||||
.filter((item) => item.kind === 'event')
|
||||
.sort((a, b) => a.start_time.localeCompare(b.start_time));
|
||||
|
||||
if (!tasks.length && !events.length) {
|
||||
container.innerHTML = '<div class="empty-message">На этот день расписания нет.</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
const tasksHtml = tasks.length ? `
|
||||
<div class="tasks-list">
|
||||
${tasks.map((task) => `<div class="task-item">${task.repeat_weekly ? 'Каждую неделю: ' : ''}${escapeHtml(task.title)}</div>`).join('')}
|
||||
</div>
|
||||
` : '';
|
||||
|
||||
const eventsHtml = events.length ? `
|
||||
<div class="events-list">
|
||||
${events.map((event) => `
|
||||
<div class="event-item">
|
||||
<span class="event-time">${event.start_time}-${calculateEndTime(event.start_time, event.duration_min)}</span>
|
||||
<span class="event-title">${escapeHtml(event.title)}</span>
|
||||
</div>
|
||||
`).join('')}
|
||||
</div>
|
||||
` : '';
|
||||
|
||||
container.innerHTML = `${tasksHtml}${eventsHtml}`;
|
||||
}
|
||||
|
||||
// Загружаем расписание при загрузке страницы
|
||||
loadSchedule();
|
||||
function escapeHtml(value) {
|
||||
return String(value)
|
||||
.replaceAll('&', '&')
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll("'", ''');
|
||||
}
|
||||
|
||||
// Автообновление каждые 5 минут
|
||||
setInterval(loadSchedule, 5 * 60 * 1000);
|
||||
async function loadSchedule() {
|
||||
const today = getMoscowDateString();
|
||||
const tomorrow = addDays(today, 1);
|
||||
|
||||
const response = await fetch(`/api/schedule?from_date=${today}&to_date=${tomorrow}`);
|
||||
if (!response.ok) {
|
||||
throw new Error('Не удалось загрузить расписание');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
renderDay(
|
||||
document.getElementById('today-content'),
|
||||
document.getElementById('today-title'),
|
||||
today,
|
||||
data.items.filter((item) => item.date === today),
|
||||
{ today: true }
|
||||
);
|
||||
renderDay(
|
||||
document.getElementById('tomorrow-content'),
|
||||
document.getElementById('tomorrow-title'),
|
||||
tomorrow,
|
||||
data.items.filter((item) => item.date === tomorrow),
|
||||
{ tomorrow: true }
|
||||
);
|
||||
}
|
||||
|
||||
loadSchedule().catch((error) => console.error(error));
|
||||
setInterval(() => loadSchedule().catch((error) => console.error(error)), 5 * 60 * 1000);
|
||||
|
|
|
|||
|
|
@ -1,100 +1,153 @@
|
|||
:root {
|
||||
--bg: #f4efe8;
|
||||
--panel: rgba(255, 251, 246, 0.9);
|
||||
--text: #1f2937;
|
||||
--muted: #6b7280;
|
||||
--task: #166534;
|
||||
--event: #0f766e;
|
||||
--line: rgba(123, 92, 62, 0.18);
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||
background: #f5f5f5;
|
||||
padding: 20px;
|
||||
font-size: 24px;
|
||||
line-height: 1.6;
|
||||
min-height: 100vh;
|
||||
font-family: Georgia, "Times New Roman", serif;
|
||||
color: var(--text);
|
||||
background:
|
||||
radial-gradient(circle at top left, rgba(245, 158, 11, 0.16), transparent 28%),
|
||||
radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.14), transparent 22%),
|
||||
linear-gradient(180deg, #faf4eb 0%, #efe4d2 100%);
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
.board {
|
||||
max-width: 1440px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.day-section {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 30px;
|
||||
margin-bottom: 30px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
.board-hero,
|
||||
.day-panel {
|
||||
background: var(--panel);
|
||||
border: 1px solid rgba(255, 255, 255, 0.6);
|
||||
box-shadow: 0 18px 45px rgba(101, 67, 33, 0.12);
|
||||
backdrop-filter: blur(14px);
|
||||
}
|
||||
|
||||
.board-hero {
|
||||
border-radius: 28px;
|
||||
padding: 28px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.board-label {
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.18em;
|
||||
font-size: 12px;
|
||||
color: #92400e;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.board-hero h1 {
|
||||
font-size: clamp(34px, 5vw, 62px);
|
||||
line-height: 0.95;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.board-copy {
|
||||
max-width: 780px;
|
||||
color: var(--muted);
|
||||
font-size: 22px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.days-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.day-panel {
|
||||
border-radius: 28px;
|
||||
padding: 28px;
|
||||
}
|
||||
|
||||
.panel-head {
|
||||
border-bottom: 1px solid var(--line);
|
||||
padding-bottom: 16px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.day-title {
|
||||
font-size: 36px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 15px;
|
||||
border-bottom: 3px solid #4CAF50;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.tasks-list,
|
||||
.events-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.tasks-list {
|
||||
margin-bottom: 30px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.task-item,
|
||||
.event-item,
|
||||
.empty-message {
|
||||
border-radius: 18px;
|
||||
padding: 16px 18px;
|
||||
}
|
||||
|
||||
.task-item {
|
||||
background: rgba(22, 101, 52, 0.08);
|
||||
border: 1px solid rgba(22, 101, 52, 0.14);
|
||||
font-size: 28px;
|
||||
padding: 15px 0;
|
||||
color: #555;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.task-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.events-list {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.event-item {
|
||||
display: grid;
|
||||
grid-template-columns: 160px 1fr;
|
||||
gap: 14px;
|
||||
background: rgba(15, 118, 110, 0.08);
|
||||
border: 1px solid rgba(15, 118, 110, 0.14);
|
||||
font-size: 28px;
|
||||
padding: 15px 0;
|
||||
color: #333;
|
||||
border-bottom: 1px solid #eee;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.event-item:last-child {
|
||||
border-bottom: none;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.event-time {
|
||||
font-weight: 600;
|
||||
color: #4CAF50;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.event-title {
|
||||
flex: 1;
|
||||
color: var(--event);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.empty-message {
|
||||
color: #999;
|
||||
font-style: italic;
|
||||
padding: 20px 0;
|
||||
color: var(--muted);
|
||||
border: 1px dashed var(--line);
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
body {
|
||||
font-size: 20px;
|
||||
padding: 15px;
|
||||
@media (max-width: 900px) {
|
||||
.days-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
|
||||
.day-title {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.task-item, .event-item {
|
||||
font-size: 22px;
|
||||
|
||||
.board-copy,
|
||||
.task-item,
|
||||
.event-item {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.event-item {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue