<?php 

function our_admin_staff_cb() {
	$user = new user;
	$staff = $user->get_user_by_meta_data(['role' => 'super_admin', 'status' => 'active']);
	$staff = array_merge($staff, $user->get_user_by_meta_data(['role' => 'admin', 'status' => 'active']));

	$sorting = new sorting;
	$sort = (isset($_GET['s'])) ? $_GET['s'] : 'id';
	$page = (isset($_GET['page'])) ? $_GET['page'] : 1;
	$order = (isset($_GET['o'])) ? $_GET['o'] : 'desc';

	$output = $sorting->sort_by_meta_value($staff, $sort, $order);
	// $output =  $sorting->paginate($sorted, 100, $page);
	// $total_pages = $sorting->total_pages;
	// var_dump($output);
	?>

	<div class="row">
		<div class="col-md-12">
            <div class="card">
                <div class="card-header">
                    <strong class="card-title">Our Admin Staff</strong>
                </div>
                <div class="card-body">
          <table id="bootstrap-data-table" class="table table-striped table-bordered">
            <thead>
              <tr>
                <th>SN</th>
				<th>Name</th>
				<th>Staff Number</th>
				<th>Image</th>
				<th>Gender</th>
				<th>Phone Number</th>
              </tr>
            </thead>
            <tbody>
<?php
$i = 1;
if(_count($output) > 0) : 
	foreach ($output as $key => $value) {
		// var_dump($value);
	 ?>
	 			<tr>
	 				<td><?=$i ?></td>
	 				<td><?=$value['surname'].' '.$value['other_names']; 
	 					action(['profile' => 'profile?id='.$value['id'].'&token='.$token], ['staff_profile'], [false]);
	 					?>
	 				</td>
	 				<td><i class="fas fa-user"></i>&nbsp;<?=strtoupper($value['username']);?></td>
	 				<td><img class="img img-72" src="<?php echo get_user_image($value['id']); ?>"></td>
	 				<td><?=$value['gender'];?></td>
	 				<td><?=$value['phone'];?></td>
	 			</tr>

	<?php $i++; } 
endif;
			?>
            </tbody>
          </table>
                </div>
            </div>
        </div>
    </div>
	<?php
}