<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html>
  <head>
    <title>Admin &gt; Transaksi Via SMS</title>
    <?php include_once(VIEWPATH.'includes/head.php'); ?>
  </head>
  <body>
    <?php include_once(VIEWPATH. 'admin/_navbar.php'); ?>
    <div class="container">
      <ul class="breadcrumb">
        <li><a href="<?php echo site_url();?>"><i class="fa fa-home"></i></a></li>
        <li><a href="<?php echo site_url('admin');?>">Admin Panel</a></li>
        <li class="active"><span>Transaksi Via SMS</span></li>
      </ul>
      <div class="row">
        <div class="col-sm-4 col-md-3">
          <?php include(dirname(__file__).'/_sidebar.php');?>
        </div>
        <div class="col-sm-8 col-md-9">
          <div class="panel panel-default">
            <div class="panel-heading">
              <h3><i class="fa fa-users"></i> Pengguna</h3>
            </div>
            <div class="panel-body">
              <?php if (!$results):?>
              <div class="alert alert-warning">Belum ada member yang menggunakan Transaksi Via SMS</div>
              <?php else:?>
              <div class="dropdown pull-right" style="margin-bottom: 15px;">
                <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"><i class="fa fa-sort"></i> <?php echo ucfirst(str_replace('_',' ', $sort));?></button>
                <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
                  <li class="<?php echo $sort == 'nama_user' ? 'active' : '';?>"><a href="<?php echo site_url('admin/modules/smstrx/pengguna/nama-user/1');?>">Nama User</a></li>
                  <li class="<?php echo $sort == 'total_sms' ? 'active' : '';?>"><a href="<?php echo site_url('admin/modules/smstrx/pengguna/total-sms/1');?>">Total SMS</a></li>
                  <li class="<?php echo $sort == 'total_transaksi' ? 'active' : '';?>"><a href="<?php echo site_url('admin/modules/smstrx/pengguna/total-transaksi/1');?>">Total Transaksi</a></li>
                </ul>
              </div>
              <div class="clearfix"></div><div class="table-responsive">
                <table class="table table-striped">
                  <thead>
                    <tr>
                      <th>User</th>
                      <th>Total SMS</th>
                      <th>Total Transaksi</th>
                    </tr>
                  </thead>
                  <tbody>
                    <?php foreach ($results as $user):?>
                    <tr id="user-<?php echo $user->us_id;?>">
                      <td><a href="<?php echo site_url('admin/users/profil/'.$user->us_id);?>"><?php echo ($user->us_verified ? '<span class="text-success" data-toggle="tooltip" data-title="Terverifikasi"><i class="fa fa-check-circle"></i></span> ' : '') . html_escape($user->us_name);?></a></td>
                      <td><?php echo @$user->us_smstrx;?></td>
                      <td><?php echo @$user->total_trx;?></td>
                    </tr>
                    <?php endforeach;?>
                  </tbody>
                </table>
              </div>
              <?php echo pagination(site_url('admin/modules/smstrx/pengguna'),$start,$total,$this->system->set['list_per_page'],'/'.str_replace('_', '-', $sort).'/%d');?>
              <?php endif;?>
            </div>
          </div>
        </div>
      </div>
    </div>
    <?php include_once(VIEWPATH.'includes/foot.php'); ?>
  </body>
</html>