<?php require_once(ROOT . "/views/" . LANG . "/layouts/_header.php"); ?>

<style>
@media (min-width:1600px) {
.card__period {
    font-size: 12px;
    letter-spacing: 1px;
}
}
</style>
<div class="head-page">
  <div class="container">
    <div class="row" style="width: 100%;background-image: url(/assets/images/bgtit.png);-o-background-size: 100% 100%;background-size: 100% 100%;background-position: right inherit;position: relative;">
      <div class="col-md-12" style="margin-left: 143px;">
        <h1 class="title-page">Статистика</h1>
        <div class="breadcrumbs">
          <ul class="breadcrumbs__list">
            <li class="breadcrumbs__item">
              <a href="/" class="breadcrumbs__link">Главная</a>
            </li>
            <li class="breadcrumbs__item">Статистика</li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="content" style="padding-bottom:50px;">
        <div class="container" style="
    color: white;    box-shadow: 0 0 17px 0px #00000087;
    background-color: #23213ed9;
    border-radius: 13px;    padding-bottom: 20px;
">
      <div class="col-md-6">
      <div class="course__price" style="margin-bottom:15px;">
        <div class="course__price-item">
          <div class="course__price-kind">Всего пополнено:</div>
          <div class="course__price-value"><?=sprintf("%.2f", $stats['all_insert']+0); ?> руб.</div>
        </div>
        <div class="course__price-item">
          <div class="course__price-kind">Всего выплачено:</div>
          <div class="course__price-value"><?=sprintf("%.2f", $stats['all_payment']+0); ?> руб.</div>
        </div>
      </div>
    </div>
      <div class="col-md-6">
      <div class="course__price" style="margin-bottom:15px;">
        <div class="course__price-item">
          <div class="course__price-kind">Всего участников:</div>
          <div class="course__price-value"><?=$stats['all_users']; ?> чел.</div>
        </div>
        <div class="course__price-item">
          <div class="course__price-kind">Новых за 24 часа:</div>
          <div class="course__price-value"><?=$stats['new_users']; ?> чел.</div>
        </div>
      </div>
    </div>



    <div class="col-md-6">
      <div class="popup_protect__def__img col" style="display: block;">
      <img src="/assets/images/ico/stats_5.png">
      </div>
      <div class="card__head">
        <h3 class="card__name">Последние 20 выплат участникам</h3>
        <div class="card__period">За последние 7 дней: <?=sprintf("%.2f", $periodsum['payment_sum']+0); ?> руб.</div>
      </div>
        <table class="bordered" style="width:100%;">
          <thead>
            <tr>
              <th>Логин</th>
              <th>Платежная система</th>
              <th>Сумма</th>
            </tr>
          </thead>

        <?php foreach ($pays as $pay) : ?>

          <tr>
            <td><?=$pay['user']; ?></td>
            <td><?=$pay['fullname']; ?></td>
            <td><?=sprintf("%.2f", $pay['sum']); ?> руб.</td>
          </tr>

        <?php endforeach; ?>

        </table>
      </div>

    <div class="col-md-6">
      <div class="popup_protect__def__img col" style="display: block;">
       <img src="/assets/images/ico/stats_6.png">
      </div>
      <div class="card__head">
        <h3 class="card__name">Последние 20 пополнений баланса</h3>
        <div class="card__period">За последние 7 дней: <?=sprintf("%.2f", $periodsum['insert_sum']+0); ?> руб.</div>
      </div>
        <table class="bordered" style="width:100%;">
          <thead>
            <tr>
              <th>Логин</th>
              <th>Платежная система</th>
              <th>Сумма</th>
            </tr>
          </thead>

        <?php foreach ($inserts as $insert) : ?>

          <tr>
            <td><?=$insert['user']; ?></td>
            <td><?=$insert['fullname']; ?></td>
            <td><?=sprintf("%.2f", $insert['sum']); ?> руб.</td>
          </tr>

        <?php endforeach; ?>

      </table>
    </div>
  </div>
</div>

<?php require_once(ROOT . "/views/" . LANG . "/layouts/_footer.php"); ?>