Add Syllabus (Ders Programı) with station filtering and weekly auto-refresh
This commit is contained in:
parent
8acc77e441
commit
d0fd394fbd
10 changed files with 1196 additions and 3 deletions
189
views/syllabus.ejs
Normal file
189
views/syllabus.ejs
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
<%- include('partials/header') %>
|
||||
|
||||
<div class="syllabus-wrapper">
|
||||
<!-- Top Bar -->
|
||||
<div class="dashboard-topbar">
|
||||
<div class="dashboard-title-area">
|
||||
<h1 class="dashboard-title">Syllabus</h1>
|
||||
<p class="dashboard-subtitle">
|
||||
Week: <strong><%= weekRange %></strong> (<%= weekId %>)
|
||||
<span class="dot-separator">•</span>
|
||||
<span id="syllabusSyncStatus">
|
||||
<% if (lastSynced) { %>
|
||||
Synced: <%= new Date(lastSynced).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) %>
|
||||
<% } else { %>
|
||||
Not synced
|
||||
<% } %>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="sync-actions">
|
||||
<button type="button" class="btn btn-primary btn-sm" id="btnSyncSyllabus">
|
||||
Sync Syllabus
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="syllabusAlert" class="alert alert-info hidden"></div>
|
||||
|
||||
<!-- Real-Time Lesson Status -->
|
||||
<% if (currentStatus && currentStatus.statusText) { %>
|
||||
<div class="live-period-banner">
|
||||
<span class="live-dot">●</span>
|
||||
<span><%= currentStatus.statusText %></span>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<!-- Controls Card: Station Selector & View Toggle -->
|
||||
<div class="toolbar-card">
|
||||
<div class="station-select-row">
|
||||
<span class="toolbar-label">Station:</span>
|
||||
<div class="station-pills" id="stationPills">
|
||||
<button type="button" class="station-btn <%= selectedStation === 'İst-1' ? 'active' : '' %>" data-station="İst-1">İst-1</button>
|
||||
<button type="button" class="station-btn <%= selectedStation === 'İst-2' ? 'active' : '' %>" data-station="İst-2">İst-2</button>
|
||||
<button type="button" class="station-btn <%= selectedStation === 'İst-3' ? 'active' : '' %>" data-station="İst-3">İst-3</button>
|
||||
<button type="button" class="station-btn <%= selectedStation === 'İst-4' || !selectedStation ? 'active' : '' %>" data-station="İst-4">İst-4</button>
|
||||
<button type="button" class="station-btn <%= selectedStation === 'İst-5' ? 'active' : '' %>" data-station="İst-5">İst-5</button>
|
||||
<button type="button" class="station-btn <%= selectedStation === 'all' ? 'active' : '' %>" data-station="all">All Stations</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="view-toggle-row">
|
||||
<span class="toolbar-label">View:</span>
|
||||
<div class="view-toggle-pills" id="viewTogglePills">
|
||||
<button type="button" class="view-btn active" data-view="day">Day View</button>
|
||||
<button type="button" class="view-btn" data-view="week">Full Week Grid</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Day View Container -->
|
||||
<div id="dayViewContainer" class="schedule-view-section">
|
||||
<!-- Day Tabs -->
|
||||
<div class="day-tabs" id="dayTabs">
|
||||
<% [1, 2, 3, 4, 5].forEach(function(d) { %>
|
||||
<% const isToday = (new Date().getDay() === d); %>
|
||||
<button
|
||||
type="button"
|
||||
class="day-tab-btn <%= activeDay === d ? 'active' : '' %>"
|
||||
data-day="<%= d %>"
|
||||
>
|
||||
<span><%= DAY_NAMES[d] %></span>
|
||||
<% if (isToday) { %>
|
||||
<span class="today-badge">Today</span>
|
||||
<% } %>
|
||||
<span class="day-count-badge"><%= (filteredSchedule[d] || []).length %></span>
|
||||
</button>
|
||||
<% }); %>
|
||||
</div>
|
||||
|
||||
<!-- Day Lessons List -->
|
||||
<% [1, 2, 3, 4, 5].forEach(function(d) { %>
|
||||
<div class="day-schedule-panel <%= activeDay === d ? '' : 'hidden' %>" id="panelDay<%= d %>">
|
||||
<% const lessons = filteredSchedule[d] || []; %>
|
||||
<% if (lessons.length === 0) { %>
|
||||
<div class="empty-state">
|
||||
<p>No lessons found for <%= DAY_NAMES[d] %>. Click "Sync Syllabus" to fetch from portal.</p>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<div class="timetable-list">
|
||||
<% lessons.forEach(function(l) { %>
|
||||
<div class="timetable-row">
|
||||
<div class="period-col">
|
||||
<span class="period-num"><%= l.period %></span>
|
||||
<span class="period-time"><%= l.time %></span>
|
||||
</div>
|
||||
|
||||
<div class="subject-col">
|
||||
<div class="subject-title"><%= l.subject %></div>
|
||||
<div class="teacher-info">
|
||||
<% if (l.teacherPhoto) { %>
|
||||
<img src="<%= l.teacherPhoto %>" class="teacher-thumb" alt="<%= l.teacher %>" onerror="this.style.display='none'">
|
||||
<% } %>
|
||||
<span class="teacher-name"><%= l.teacher %></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="station-col">
|
||||
<% if (l.station) { %>
|
||||
<span class="station-badge"><%= l.station %></span>
|
||||
<% } else { %>
|
||||
<span class="class-badge">Class</span>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
<% }); %>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
<% }); %>
|
||||
</div>
|
||||
|
||||
<!-- Full Week Grid View Container -->
|
||||
<div id="weekViewContainer" class="schedule-view-section hidden">
|
||||
<div class="table-responsive">
|
||||
<table class="week-grid-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="grid-time-th">Period</th>
|
||||
<% [1, 2, 3, 4, 5].forEach(function(d) { %>
|
||||
<% const isToday = (new Date().getDay() === d); %>
|
||||
<th class="<%= isToday ? 'grid-today-th' : '' %>">
|
||||
<%= DAY_NAMES[d] %>
|
||||
<% if (isToday) { %><span class="grid-today-pill">Today</span><% } %>
|
||||
</th>
|
||||
<% }); %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
// Discover max periods across all days
|
||||
let maxPeriod = 1;
|
||||
[1, 2, 3, 4, 5].forEach(d => {
|
||||
(filteredSchedule[d] || []).forEach(l => {
|
||||
if (l.periodNumber > maxPeriod) maxPeriod = l.periodNumber;
|
||||
});
|
||||
});
|
||||
%>
|
||||
<% for (let p = 1; p <= maxPeriod; p++) { %>
|
||||
<tr>
|
||||
<td class="grid-period-cell">
|
||||
<div class="grid-period-title"><%= p %>. Ders</div>
|
||||
<%
|
||||
// Find sample time
|
||||
let sampleTime = '';
|
||||
for (let d = 1; d <= 5; d++) {
|
||||
const match = (filteredSchedule[d] || []).find(l => l.periodNumber === p);
|
||||
if (match && match.time) { sampleTime = match.time; break; }
|
||||
}
|
||||
%>
|
||||
<% if (sampleTime) { %>
|
||||
<div class="grid-period-time"><%= sampleTime %></div>
|
||||
<% } %>
|
||||
</td>
|
||||
|
||||
<% [1, 2, 3, 4, 5].forEach(function(d) { %>
|
||||
<% const lesson = (filteredSchedule[d] || []).find(l => l.periodNumber === p); %>
|
||||
<td class="grid-lesson-cell <%= lesson ? 'has-lesson' : '' %>">
|
||||
<% if (lesson) { %>
|
||||
<div class="grid-lesson-subject"><%= lesson.subject %></div>
|
||||
<div class="grid-lesson-teacher"><%= lesson.teacher %></div>
|
||||
<% if (lesson.station) { %>
|
||||
<span class="grid-station-tag"><%= lesson.station %></span>
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
<span class="grid-empty-cell">—</span>
|
||||
<% } %>
|
||||
</td>
|
||||
<% }); %>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/js/syllabus.js"></script>
|
||||
<%- include('partials/footer') %>
|
||||
Loading…
Add table
Add a link
Reference in a new issue