Files
pdga-rating/views/partials/course-table.ejs
2026-05-22 21:07:00 +02:00

48 lines
2.1 KiB
Plaintext

<div id="search-results-info" class="search-results-info">
<% if (typeof query !== 'undefined' && query) { %>
Showing <%= courses.length %> of <%= total %> courses
<% } else { %>
Showing all <%= courses.length %> courses
<% } %>
</div>
<% if (courses.length === 0) { %>
<p>No courses found. Click "Scrape Courses" to load Swedish courses from PDGA.</p>
<% } else { %>
<table>
<thead>
<tr>
<th>Course Name</th>
<th class="mobile-hide">City</th>
<th class="mobile-hide">Last Updated</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% courses.forEach(function(course) {
var lastUpdated = new Date(course.last_updated).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' });
%>
<tr id="row-<%= course.id %>" class="expandable-row" onclick="toggleCourseLayouts(<%= course.id %>)">
<td>
<a href="<%= course.link %>" target="_blank" onclick="event.stopPropagation()"><%= course.name %></a>
<div class="mobile-only" style="font-size: 11px; color: #999; margin-top: 2px;"><%= course.city %></div>
</td>
<td class="mobile-hide"><%= course.city %></td>
<td class="mobile-hide"><%= lastUpdated %></td>
<td>
<i class="fas fa-sync-alt refresh-icon" onclick="scrapeLayouts(<%= course.id %>, '<%= course.name.replace(/'/g, "\\'") %>'); event.stopPropagation();" title="Scrape layouts for this course"></i>
</td>
</tr>
<tr id="layouts-<%= course.id %>" class="expanded-content">
<td colspan="4">
<div class="layouts-container" id="layouts-container-<%= course.id %>">
<div class="no-layouts">Click to load layouts...</div>
</div>
</td>
</tr>
<% }); %>
</tbody>
</table>
<%- include('course-cards', { courses: courses, query: locals.query, total: locals.total }) %>
<% } %>