<%- include("../partials/head") %>
<%- include("../partials/header") %>
<main class="container section">
  <div class="grid-four">
    <div class="panel"><span>کل کاربران</span><strong><%= stats.totalUsers %></strong></div>
    <div class="panel"><span>در انتظار</span><strong><%= stats.pendingUsers %></strong></div>
    <div class="panel"><span>تأیید شده</span><strong><%= stats.approvedUsers %></strong></div>
    <div class="panel"><span>اتصال Paper</span><strong><%= stats.totalSyncLogs %></strong></div>
  </div>
  <div class="dashboard-grid admin-grid">
    <section class="panel">
      <h2>آخرین کاربران</h2>
      <ul class="simple-list">
        <% users.forEach((user) => { %>
          <li><%= user.username %> - <%= helpers.statusBadge(user.status) %> - <%= user.role.name %></li>
        <% }) %>
      </ul>
    </section>
    <section class="panel">
      <h2>پلن‌ها</h2>
      <ul class="simple-list">
        <% plans.forEach((plan) => { %>
          <li><%= plan.title %> - <%= helpers.formatCurrency(plan.price) %></li>
        <% }) %>
      </ul>
    </section>
    <section class="panel">
      <h2>سفارش‌های اخیر</h2>
      <ul class="simple-list">
        <% orders.forEach((order) => { %>
          <li><%= order.user.username %> - <%= order.plan.title %> - <%= helpers.statusBadge(order.status) %></li>
        <% }) %>
      </ul>
    </section>
    <section class="panel">
      <h2>لاگ‌های Paper</h2>
      <ul class="simple-list">
        <% logs.forEach((log) => { %>
          <li><%= log.action %> - <%= log.serverConfig?.name || "unknown" %> - <%= log.success ? "OK" : "Fail" %></li>
        <% }) %>
      </ul>
    </section>
  </div>
</main>
<%- include("../partials/footer") %>
