<?php 
	require_once('Connections/conn_ama.php');
	
	if(!isset($_SESSION)){
        session_start();
    }
    if(isset($_POST['deptid'])){
		$colname = $_POST['deptid'];
	}
	//echo "deptsubID: ".$colname;

    	//Retrieve Officers
    	$query_rsOfficers = "CALL department_officers('".$colname."')";//"SELECT deptID, `deptname`, subdeptdetailsID, dateadded  FROM v_depts ORDER BY dateadded DESC";
	    $rsOfficers = mysqli_query($conn_ama, $query_rsOfficers ) or die(mysqli_error($conn_ama));
	    $row_rsOfficers = mysqli_fetch_assoc($rsOfficers);
		$totalRows_rsOfficers = mysqli_num_rows($rsOfficers);/**/
		
		echo $row_rsOfficers['subdeptdetailsID'];
 ?>
<!-- <div class="col-md-9 data-area"> -->
	<div class="mreport-steps">
		<?php //include("mreport-steps.inc.php"); ?>
	</div><!-- End .mreport-step-->
	<div class="data-area-wrap">
        <h3><?php echo $row_rsOfficers['department']; ?></h3>
		<div class="form-wrapper">
			<h4><a class="btn btn-primary listsubunits" href="#" data-dept="<?php echo $row_rsOfficers['department']; ?>" data-deptid="<?php echo $row_rsOfficers['subdeptdetailsID']; ?>">List Sub Units</a></h4>
            <h4><a href="#" class="addsubunit" data-dept="<?php echo $row_rsOfficers['department']; ?>" data-deptid="<?php echo $row_rsOfficers['subdeptdetailsID']; ?>">Add Sub unit</a></h4>
            <h4><a href="#" class="addofficer" data-deptid="<?php echo $colname; ?>">Add Officer</a></h4>
			<table id="example" class="table" cellspacing="0" width="100%">
		        <thead>
		            <tr>
		                <th>Officer</th>
		                <!-- <th>Category</th> -->
		                <!-- <th>Postion</th> -->
		                <!-- <th nowrap="nowrap">Date Added</th> -->
		                <!-- <th>Country</th> -->
		                <th>Edit</th>
		                <th>Delete</th>
		            </tr>
		        </thead>
		        <!-- <tfoot>
		            <tr>
		                <th>Player</th>
		                <th>Image</th>
		                <th>Postion</th>
		                <th>Jersey Number</th>
		                <th>Country</th>
		                <th>Edit</th>
		                <th>Delete</th>
		            </tr>
		        </tfoot> -->
		        <tbody>
		        <?php do { ?>
		            <tr>
		                <td><a href="#" ><?php echo $row_rsOfficers['officername']; ?></a></td>
		                <!-- <td align="center"><?php// echo ucwords($row_rsOfficers['category']); ?></td> -->
	                  	<!-- <td align="center"><?php// echo $row_rsOfficers['dateadded']; ?></td> -->
	                    <td align="center"><a href="#">Edit</a></td>
		                <td align="center"><a href="#">Delete</a></td>
		            </tr>
		        <?php } while($row_rsOfficers = mysqli_fetch_assoc($rsOfficers));?>
		            
		    	</tbody>
		    </table>
		</div><!-- End .form-wrapper-->
	</div><!-- End .data-area-wrap-->	
<!-- </div> -->

<script>

    $(document).ready( function() {
        $('#example').dataTable({
        	"pageLength": 10,
        	"order": []
        });
    });
</script>