{% extends "base.html" %}
{% load static %}

{% block title %}板块轮动 - AgomTradePro{% endblock %}

{% block extra_css %}
<link rel="stylesheet" href="{% static 'css/rotation.css' %}">
{% endblock %}

{% block content %}
<div class="rotation-container">
    <!-- Navigation Tabs -->
    <div class="rotation-nav">
        <a href="{% url 'rotation:assets' %}" class="nav-tab {% if request.resolver_match.url_name == 'assets' %}active{% endif %}">
            <span class="nav-icon">📊</span>
            <span class="nav-text">资产类别</span>
        </a>
        <a href="{% url 'rotation:configs' %}" class="nav-tab {% if request.resolver_match.url_name == 'configs' %}active{% endif %}">
            <span class="nav-icon">⚙️</span>
            <span class="nav-text">策略配置</span>
        </a>
        <a href="{% url 'rotation:signals' %}" class="nav-tab {% if request.resolver_match.url_name == 'signals' %}active{% endif %}">
            <span class="nav-icon">📈</span>
            <span class="nav-text">轮动信号</span>
        </a>
        <a href="{% url 'rotation:account_configs' %}" class="nav-tab {% if request.resolver_match.url_name == 'account_configs' %}active{% endif %}">
            <span class="nav-icon">🎛️</span>
            <span class="nav-text">账户配置</span>
        </a>
    </div>

    <!-- 投资免责声明 -->
    {% include 'components/investment_disclaimer.html' with compact=true %}

    <!-- Page Content -->
    {% block rotation_content %}{% endblock %}
</div>

<!-- Toast Notification -->
<div id="toast" class="toast"></div>

<script>
// Get CSRF Token
function getCookie(name) {
    let cookieValue = null;
    if (document.cookie && document.cookie !== '') {
        const cookies = document.cookie.split(';');
        for (let i = 0; i < cookies.length; i++) {
            const cookie = cookies[i].trim();
            if (cookie.substring(0, name.length + 1) === (name + '=')) {
                cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                break;
            }
        }
    }
    return cookieValue;
}

window.csrfToken = getCookie('csrftoken');

// Toast notification
function showToast(message, type = 'info') {
    const toast = document.getElementById('toast');
    toast.textContent = message;
    toast.className = `toast ${type} show`;
    setTimeout(() => toast.classList.remove('show'), 3000);
}

// Confirm dialog wrapper
async function confirmAction(message, options = {}) {
    return window.uiConfirm ? window.uiConfirm(message, options) : confirm(message);
}

// Prompt dialog wrapper
async function promptAction(message, defaultValue = '', options = {}) {
    if (window.uiPrompt) {
        return window.uiPrompt(message, defaultValue, options);
    }
    return prompt(message, defaultValue);
}
</script>
{% endblock %}
