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

<div class="page-content-wrapper ">
  <div class="container">
    <div class="row">
      <div class="col-md-12" style="
    width: 100%;
">
        <div class="panel panel-primary">
          <div class="panel-body">

            <div class="tabs-vertical-env m-b-0">

              <ul class="nav tabs-vertical">

              <?php for ($i = 1; $i <= $this->config['ref_lvls']; $i++) : ?>

                <li class="<?php if ($lvl == $i) echo 'active';?>"><a href="/referals/<?=$i; ?>"><?=$i; ?> уровень</a></li>

              <?php endfor; ?>

              </ul>

              <div class="tab-content" style="width: 100%">
                <h4 class="m-b-30 m-t-0">Список рефералов:</h4>
                <div id="datatable-responsive_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                  <div class="row">
                    <div class="col-sm-12">
                      <table id="datatable-responsive" class="table table-striped table-bordered dt-responsive nowrap text-center  dataTable no-footer dtr-inline" cellspacing="0" width="100%" role="grid" aria-describedby="datatable-responsive_info" style="width: 100%;">
                        <thead>
                          <tr role="row">
                            <th class="text-center">Логин реферала</th>
                            <th class="text-center">Доход с реферала</th>
                            <th class="text-center">Дата регистрации</th>
                          </tr>
                        </thead>
                        <tbody>

                        <?php if(count($referals) > 0) : ?>

                          <?php foreach($referals as $referal) : ?>

                          <tr role="row">
                            <td class="sorting_1"><?=$referal['user']; ?></td>
                            <td><?=sprintf("%.2f", $referal["to_referer".$lvl]); ?> руб.</td>
                            <td><?=date("d.m.Y H:i", $referal['date_reg']); ?></td>
                          </tr>

                          <?php endforeach; ?>

                        <?php else : ?>

                          <tr role="row">
                            <td colspan="3">У вас нет рефералов <?=$lvl; ?> уровня</td>
                          </tr>

                        <?php endif; ?>

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

          </div>
        </div>
      </div>
    </div> <!-- End Row -->
  </div><!-- container -->
</div> <!-- Page content Wrapper -->

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