<div class="workplace">
	<div class="page-header">
		<h1>Admin <small>: All Players</small></h1>
    </div>
    
    <div class="row-fluid">
    <div class="pull-left" style="margin-right:10px">
									Select filters<br/>
									<select id="getOrganisation">
										<option value="0">All Organizations</option>
										  <?php
										 $GrantsDB = new Model_Unions;
										 $years = $GrantsDB->getAll();
										 foreach($years as $year){
										 	echo '<option value="'.$year["un_id"].'"' ;
											 	if($this->unionID == $year["un_id"]){ echo "selected"; }
											 
										 	echo '>'.$year["un_name"].'</option>';
										 }
                    ?> 
									</select>
		</div>
		
		 
		 
		</div>							
    
    
    <div class="row-fluid">
    	
    	
    	
    	<div class="head clearfix">
		 	<div class="isw-grid"></div>
		 	<h1>Players</h1>
		 		<ul class="buttons">
					<li><a href="/members/add/" class="isw-plus"></a></li>
				</ul>
				
				
		</div>
		
		
		
		<div class="block-fluid table-sorting clearfix">
			
	<table id="ajaxLoadingTable" class="display table"  width="100%" cellspacing="0">
        <thead>
            <tr>
            	<th style="width:20px" class="sorting_disabled">#</th>
                                        <th width="20%" class="fnosort">Full Name</th>
                                        <th width="10%">Organization</th>
                                        <th width="10%">E-mail</th>
                                        <th width="10%">Title</th>
                                        <th width="10%">Mobile</th> 
                                        <th width="10%" class="nosort">Last Login</th> 
                                        <th class="nosort"></th> 
                                        <th  class="nosort">Actions</th>                                     
                                    </tr>
        </thead>
 
        <tfoot>
          
        </tfoot>
    </table>
		</div>
	</div>                
              
</div>





<div id="DeleteRowConfirm" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-header">
		<button type="button" class="close DoNotCraeteGrant"   data-dismiss="modal"   aria-hidden="true">×</button>
		<h3 id="myModalLabel">Confirm Delete</h3>
	</div>
							<div class="modal-body">
								 <p style="margin: 30px;">Are you sure you want to delete this account</p>
								 <input type="hidden" id="id_input" />
							</div>
	<div class="modal-footer">
		<button class="btn btn-danger DoNotCraeteGrant"  data-dismiss="modal"  aria-hidden="true">Cancel</button>
		<button class="btn " type="submit" onclick="RemoveUser()" >Confirm</button>
	</div>
</div>  

<div id="QuickView" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-header">
		<button type="button" class="close DoNotCraeteGrant"   data-dismiss="modal"   aria-hidden="true">×</button>
		<h3 id="myModalLabel">Profile</h3>
	</div>
							<div class="modal-body">
								<div  style="height: 200px; color:#ccc; line-height: 200px; font-size: 20px; text-align: center">
									Processing ....
								</div>
								
							</div>
	<div class="modal-footer">
		<button class="btn btn-danger DoNotCraeteGrant"  data-dismiss="modal"  aria-hidden="true"  onclick="deleteUser()" >Delete</button>
		<button class="btn " type="submit" onclick="gotoProfile()" >Full Profile</button>
	</div>
</div>

<script>

$(document).ready(function() {
	
	$("#getOrganisation").change(function(){
		var u = $(this).val();
		window.location.href="/members/players/union/"+u;
		
	});
	
	
	var u = $("#getOrganisation").val();
    $('#ajaxLoadingTable').dataTable( {
    	"processing": true,
        "serverSide": true,
        "ajax": "/members/getplayers/unionid/"+u,
        
        "aoColumns": [ 
                   { "bSortable": false },
                   { "bSortable": true },
                   { "bSortable": true },
                   { "bSortable": true },
                   { "bSortable": true },
                   { "bSortable": true },
                   { "bSortable": true },
                   { "bSortable": false },
                   { "bSortable": false } ]
    } );
    
    
    
} );

function delete_acc(e){
	var id = $(e).attr("id");
	$("#id_input").val(id);
	$("#DeleteRowConfirm").modal('show');
	
}
 function RemoveUser(){
 	var id =$("#id_input").val();
 	location.href ="/members/delete/id/"+id;
 	
 }
 function Quickview(e){
 	var id = $(e).attr("id");
	$("#id_input").val(id);
	$("#QuickView").modal('show');
	$("#QuickView .modal-body").html('<div  style="height: 250px; color:#ccc; line-height: 200px; font-size: 20px; text-align: center">Processing ....</div>');
	$.post("/members/getmember/id/"+id,function(r){
		$("#QuickView .modal-body").html(r);
	
	});
 }
 
 function gotoProfile(){
 	var id = $("#QuickView #getUserID").val();
 	window.location.href ="http://ef.cuesign.co.za/members/profile/id/"+id;
 	
 }
 function deleteUser(){
		var id = $("#QuickView #getUserID").val();
	$("#id_input").val(id);
	$("#QuickView").modal('hide');
	$("#DeleteRowConfirm").modal('show');
	
}
</script>