{% extends "base.html" %}

{% block content %}

<div class="space-y-8 max-w-6xl mx-auto px-4">

  <h1 class="text-3xl font-semibold mb-6">Details voor {{ board.name }}</h1>

  <!-- You can add more board settings above here as needed -->

  <h2 class="text-2xl font-semibold mb-4">Schedules for this display</h2>

  <div class="overflow-x-auto rounded-lg border border-gray-300">

    <table class="min-w-full divide-y divide-gray-200 bg-white">
      <thead class="bg-gray-100">
        <tr>
          <th class="px-6 py-3 text-left text-sm font-semibold text-gray-700">Days</th>
          <th class="px-6 py-3 text-center text-sm font-semibold text-gray-700">Start Time</th>
          <th class="px-6 py-3 text-center text-sm font-semibold text-gray-700">End Time</th>
          <th class="px-6 py-3 text-left text-sm font-semibold text-gray-700">Content</th>
          <th class="px-6 py-3 text-center text-sm font-semibold text-gray-700">Actions</th>
        </tr>
      </thead>
      <tbody class="divide-y divide-gray-200">
        {% for s in schedules %}
        <tr>
          <td class="whitespace-nowrap px-6 py-4 text-sm text-gray-900">{{ s.days_of_week }}</td>
          <td class="text-center px-6 py-4 text-sm text-gray-900">{{ s.start_time.strftime('%H:%M') }}</td>
          <td class="text-center px-6 py-4 text-sm text-gray-900">{{ s.end_time.strftime('%H:%M') }}</td>
          <td class="px-6 py-4 text-sm text-gray-900">{{ s.content[:50] }}{% if s.content|length > 50 %}...{% endif %}</td>
          <td class="text-center px-6 py-4">
            <a href="{{ url_for('edit_schedule', board_id=board.id, schedule_id=s.id) }}" class="bg-[#f7d91a] text-black text-xs px-6 py-3 rounded font-semibold hover:bg-yellow-300 transition">Edit</a>
            <form method="post" action="{{ url_for('delete_schedule', board_id=board.id, schedule_id=s.id) }}" style="display:inline;">
              <button type="submit" class="bg-red-600 text-white text-xs px-6 py-3 rounded font-semibold hover:bg-red-700 transition">Delete</button>
            </form>
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>

  <a href="{{ url_for('add_schedule', board_id=board.id) }}" class="bg-[#f7d91a] text-black px-6 py-3 rounded-md font-semibold shadow hover:bg-yellow-300 transition inline-block">Add Schedule</a>

</div>

{% endblock %}
