{% extends "admin_base.html" %}
{% block extra_head %}
<link rel="stylesheet" href="{{ static_url('/static/css/admin.css') }}">
<link rel="stylesheet" href="{{ static_url('/static/css/sidebar.css') }}">
<link rel="stylesheet" href="{{ static_url('/static/css/planning.css') }}">
{% endblock %}
{% block admin_content %}
<div class="admin-header planning-header">
    <div>
        <h1>Ticket Planning</h1>
        <p class="planning-subtitle">Generate a grouped, ordered planning report of every open ticket.</p>
    </div>
    {% if configured %}
    <button type="button" class="btn btn-primary" data-planning-generate data-action="/issues/planning">
        <span class="btn-spinner" aria-hidden="true"></span> Generate planning
    </button>
    {% endif %}
</div>

{% if not configured %}
<div class="empty-state">The issue tracker is not configured yet. Configure Gitea in Services first.</div>
{% else %}
<div class="planning-status" data-planning-status hidden>
    <span class="planning-spinner" aria-hidden="true"></span>
    <span class="planning-status-text">Generating the planning report...</span>
</div>

<div class="planning-result" data-planning-result hidden>
    <div class="planning-actions">
        <a class="btn btn-secondary" data-planning-download href="#" download>Download markdown</a>
        <span class="planning-hint">Hover the report and use the Copy button to copy the markdown source.</span>
    </div>
    <dp-content class="planning-report" data-planning-report></dp-content>
</div>

<div class="planning-empty empty-state" data-planning-empty>
    No planning generated yet. Click "Generate planning" to build one from the open tickets.
</div>
{% endif %}
{% endblock %}
