Files
SkinsPins/app/templates/admin/course_search.html
T
Rolf 06995c5668 Remove manual course creation; import-only with per-tee stroke indices
Courses can now only be added via Golf Course API import, which
provides the full data model: per-tee slope/rating/gender/SI
(stroke_indices JSON) and front/back split ratings. Manual creation
required admins to enter SI by hand and didn't match the API model.

Changes:
- Remove GET/POST /admin/courses/new routes and new_course.html
- Remove _parse_hole_form helper (no longer needed)
- Edit course: par-only editing; stroke_index preserved from import,
  not exposed or overwritten in the admin form
- courses.html: replace "+ New course" with "+ Import course" button
- course_search.html: remove "+ Manual" shortcut
- edit_course.html: remove SI column from hole grid

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 20:03:19 +01:00

86 lines
3.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% block title %}Search Courses Skins &amp; Pins{% endblock %}
{% block content %}
<div class="page">
<div class="page-header">
<h1>⚙️ Admin</h1>
</div>
<div class="admin-subnav">
<a href="/admin" class="admin-subnav-item">Users</a>
<a href="/admin/courses" class="admin-subnav-item active">Courses</a>
<a href="/admin/games" class="admin-subnav-item">Games</a>
</div>
<div style="display:flex; gap:0.5rem; justify-content:flex-end; margin-bottom:1rem;">
<a href="/admin/courses" class="btn" style="width:auto; padding:0.5rem 1rem; background:var(--surface2); color:var(--text);">← Courses</a>
</div>
{% if not api_configured %}
<div class="alert alert-error">
<strong>GOLF_COURSE_API_KEY is not configured.</strong>
Add it to your <code>.env</code> file to enable course search.
Get a key at <a href="https://www.golfcourseapi.com" target="_blank" style="color:inherit;">golfcourseapi.com</a>.
</div>
{% endif %}
<div class="card">
<form method="get" action="/admin/courses/search" style="display:flex; gap:0.5rem;">
<input type="text" name="q" value="{{ q }}" placeholder="Search by course or club name…"
style="flex:1;" {% if not api_configured %}disabled{% endif %} autofocus>
<button type="submit" class="btn btn-primary" style="width:auto; padding:0.65rem 1.25rem;"
{% if not api_configured %}disabled{% endif %}>Search</button>
</form>
</div>
{% if error %}
<div class="alert alert-error" style="margin-top:0.75rem;">{{ error }}</div>
{% endif %}
{% if q and results is not none %}
{% if results %}
<p style="font-size:0.85rem; color:var(--text-muted); margin:0.75rem 0 0.4rem;">
{{ results | length }} result{{ 's' if results | length != 1 else '' }} for "<strong>{{ q }}</strong>"
</p>
<div class="card" style="padding:0;">
<table class="data-table" style="margin:0;">
<thead>
<tr><th>Club</th><th>Course</th><th>Location</th><th></th></tr>
</thead>
<tbody>
{% for c in results %}
{% set loc = c.location or {} %}
{% if loc.state and loc.country == 'United States' %}
{% set location_str = (loc.city or '') + ', ' + loc.state %}
{% elif loc.city and loc.country %}
{% set location_str = loc.city + ', ' + loc.country %}
{% else %}
{% set location_str = '' %}
{% endif %}
<tr>
<td style="font-weight:500;">{{ c.club_name or '—' }}</td>
<td style="color:var(--text-muted);">
{% if c.course_name and c.course_name != c.club_name %}{{ c.course_name }}{% else %}—{% endif %}
</td>
<td style="color:var(--text-muted);">{{ location_str or '—' }}</td>
<td>
<form method="post" action="/admin/courses/import/{{ c.id }}">
<button type="submit" class="btn-table-action">Import</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="empty-state" style="padding:2rem 0;">
<div class="empty-icon">🔍</div>
<p>No courses found for "<strong>{{ q }}</strong>".</p>
</div>
{% endif %}
{% endif %}
</div>
{% endblock %}