<?php
	include("includes/dbconfig.php");
	include('eaglesdb.php');
	$pagetitle = "Eagles Rugby club tickets ";
	require('includes/applicationtop.php');
	require('includes/applicationmenu.php');
	
	
?>
			<!-- Content Wrapper. Contains page content -->
			<div class="content-wrapper">
				<!-- Content Header (Page header) -->
				<section class="content-header">
					<h1>Eagles Rugby club tickets Manager</h1>
					<ol class="breadcrumb">
					</ol>
				</section>

				<!-- Main content -->
				<section class="content">
					<div class="card card-primary" id  ="Load_here">
						<?php
							if($_SESSION["connectedusergroup"] == 1)
							{
						?> 
						 
													 
													
						
						
						<div class="card-body">
							 
							
							<div class="card-body table-responsive  " id  ="Load_here">	
						 
								 
								 
							 
							</div>
							
							<?php
							
							  $sql = "SELECT *from tickets ";
							$result_eagles = $eagles->query($sql);

							  
							 
							 
							 
							  $sql = "SELECT *from partners ";
							$result_partners = $eagles->query($sql);

							
							?>
							
							
							<div class='row'>
							
							<div class="col-12   col-md-6">
						<div class="info-box mb-3">
						  <span class="info-box-icon bg-danger elevation-1"><i class="fas fa-thumbs-up"></i></span>

						  <div class="info-box-content">
							<span class="info-box-text">  Partners <a href="<?php echo $base_url; ?>addnewpartner.php"> Add New</a>  </span>
							<span class="info-box-number">
							 <?= $result_partners->num_rows ?>
															
							
							</span>
						  </div>
						  <!-- /.info-box-content -->
						</div>
						<!-- /.info-box -->
					  </div>
					  <!-- /.col -->
							<div class="col-12   col-md-6">
							<div class="info-box mb-3">
							  <span class="info-box-icon bg-info elevation-1"><i class="fas fa-file"></i></span>

							  <div class="info-box-content">
								<span class="info-box-text">Tickets <a href="<?php echo $base_url; ?>addtickets.php"> Add New</a> </span>
								<span class="info-box-number">
								<?= $result_eagles->num_rows ?>
								
									</span>
							  </div>
							  <!-- /.info-box-content -->
							</div>
							<!-- /.info-box -->
						  </div>
						  <!-- /.col -->


					  
					  </div>
					  
					  
					  
					  
					  
					  
					  
					  
					  
					  
					  
					  
					  
					  <div class='row'>
					  
					    <div class="col-12   col-md-6">
					  <table class="table table-bordered border-secondary    table-nowrap mt-2" style="text-align: left">
							<thead>
							<th># </th><th>Edit </th><th>Name </th><th>Rate </th> 
							</thead>
							<tbody>
					  
					  <?php
							if ($result_partners->num_rows > 0) {
							  // output data of each row
							   while($row = $result_partners->fetch_assoc()) { 
							    $action = '<a href="javascript:void(0);" onclick="gendawano(\''.$base_url.'addnewpartner\', \'shopfocus\', '.$row['img'].')" data-toggle="tooltip" title="Edit Shop" class="tooltips"><span class="label label-primary" ><i class="fa fa-edit"></i></span>Edit</a>';
							
							 
							   
								 echo '<tr>
								 
								<td>'.$row['img'].' </td>
								<td> '.$action.' </td>
								
								<td>'.$row['pname'].' </td>
								<td>'.$row['rate'].' </td>  
								</tr>';
							  }  
							}
							?>
							</tbody>
							</table>
						 
						<!-- /.info-box -->
					  </div>
							<div class="col-12 col-sm-6 col-md-6">
							<table class="table table-bordered border-secondary    table-nowrap mt-2" style="text-align: left">
							<thead>
							<th># </th><th>Edit </th><th>Owner </th><th>Custoimer ID </th><th>Phone </th><th>Expiry </th>
							</thead>
							<tbody>
									
							
							<?php
							if ($result_eagles->num_rows > 0) {
							  // output data of each row
							   while($row = $result_eagles->fetch_assoc()) { 
							   $action = '<a href="javascript:void(0);" onclick="gendawano(\''.$base_url.'addtickets\', \'shopfocus\', '.$row['id'].')" data-toggle="tooltip" title="Edit Shop" class="tooltips"><span class="label label-primary" ><i class="fa fa-edit"></i></span></a>';
							
							   
								echo '<tr>
								<td>'.$row['id'].'  </td>
								<td> '.$action.' </td>
								
								<td>'.$row['name'].' </td>
								<td>'.$row['card'].' </td>
								<td>'.$row['phone'].' </td> 
								<td>'.$row['expiry'].' </td> 
								</tr>';
							   
								 //new_item_category($conn_sys, $row["cat_name"], $row["cat_name"] , $row["cat_id"]);
							  }  
							}
							?>
							</table>
							 
						  </div>
						  <!-- /.col -->


					
					  <!-- /.col -->
					  </div>
						</div>
						<?php
							}
							else
							{
						?>
						<div class="alert alert-danger alert-dismissable">
							<i class="fa fa-ban-circle"></i><br>
							Limited Access
						</div>
						<?php
							}
						?>
					</div>
				</section><!-- /.content -->
			</div><!-- /.content-wrapper -->

			<footer class="main-footer text-center">
				<strong>Copyright &copy; <?php echo date("Y"); ?> BSMPOS.</strong> All rights reserved.
			</footer>
		</div><!-- ./wrapper -->
		
		<div class="modal" id="waitdialogmodal"  data-backdrop="static">
            <div class="modal-dialog modal-sm">
              <div class="modal-content">
                  <div class="modal-body">
					<div class="text-center">
						<img src="<?php echo $base_url . $ajax_loading_image; ?>" />
					</div>
				  </div>
              </div>
            </div>
        </div>

	 <?php include ('includes/general_footer.php')?>
		<script src="<?= $base_url?>plugins/bert/storepos.js" type="text/javascript"></script>
		<script src="<?= $base_url?>pplugins/bert/systemusers.js" type="text/javascript"></script>
			<!-- bootstrap datepicker -->
<script src="<?php echo $base_url; ?>plugins/datepicker/bootstrap-datepicker.js"></script>
		
		<script type="text/javascript">
		v1 = []; 
function detailed_report(){
	 
	   var add =$('[name="detailed_report"]:checked').map( function(){ return $(this).val(); }).toArray();//trm
	  
	   BetaCustom('detailed_performance.php' ,  4 , add[0] , '#Load_here' );
	  
	return false;
}

function BetaCustom(scrpt ,  com , d , loadHere ){
	 
	 
	
	 var request = $.ajax({ url: scrpt, type: "POST", data: { comand : com , dataSend:d },  dataType: "html"               });

               request.done(function(reply ) {      $(loadHere).html(reply);    });
			  
			   
			   return false;
 
	
}
		//Date picker
    $('#start_date').datepicker({
      autoclose: true, 
	  format: 'yyyy-mm-dd'
    });
	
	$('#end_date').datepicker({
      autoclose: true, 
	  format: 'yyyy-mm-dd'
    });
		</script>
		 
	</body>
</html>