<!DOCTYPE html>
<html>
<head>
  <title>Match Live TV Admin</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="robots" content="noindex, nofollow">
  <link rel="stylesheet" href="/admin.css?v=2">
  <% if controller_name == "dashboard" %>
    <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.min.js" crossorigin="anonymous"></script>
    <script src="/admin-dashboard.js?v=1" defer></script>
  <% end %>
</head>
<body class="<%= content_for?(:body_class) ? yield(:body_class) : 'admin-body' %>">
  <header class="admin-header">
    <h1>MATCH <span>LIVE</span> TV — Admin</h1>
    <nav class="admin-nav">
      <% if admin_logged_in? %>
        <%= link_to "Dashboard", admin_root_path, class: ("active" if controller_name == "dashboard") %>
        <%= link_to "Teams", admin_teams_path, class: ("active" if controller_name == "teams") %>
        <%= link_to "Fatturazione", admin_billing_path, class: ("active" if controller_name.in?(%w[billing billing_invoices])) %>
        <%= link_to "Sessions", admin_sessions_path, class: ("active" if controller_name == "sessions") %>
        <%= link_to "Password", edit_admin_password_path %>
        <%= button_to "Esci", admin_logout_path, method: :delete %>
      <% end %>
    </nav>
  </header>

  <main class="admin-main">
    <% if flash[:notice] %><div class="admin-flash"><%= flash[:notice] %></div><% end %>
    <% if flash[:alert] %><div class="admin-flash"><%= flash[:alert] %></div><% end %>
    <%= yield %>
  </main>
</body>
</html>
