<div class="right_col" role="main">
	<div class="">
		<div class="page-title">
			<div class="title_left">
				<h3>Team list <a href="index.php?pagecontent=team_add"><button type="button" class="btn btn-dark">Add new team</button></a></h3>
				
			</div>
		</div>
		<div class="clearfix"></div>
		<div class="row">
			<div class="col-md-12 col-sm-12 col-xs-12">
				<div class="x_panel">
					<div class="x_content">
						<table id="datatable" class="table table-striped table-bordered">
							<thead>
								<tr>
									<th>Name</th>
									<th>Telegram Group Id</th>
									<th>Action</th>
								</tr>
							</thead>
							<tbody>
								<?php
									$result=mysqli_query($conn, "SELECT * FROM teams");
									while($row = mysqli_fetch_array($result))
									{
										$sId=$row['s_id'];
								?>
								<tr>
									<td><?php echo $row['title'];?></a></td>
									<td><?php echo $row['telegram_group_id'];?></a></td>
						
									<td>
										<a href="?pagecontent=team_admin&id=<?php echo $row['id']; ?>"><button class="btn btn-xs btn-warning">Member</button></a>
										<a href="?pagecontent=teams&id=<?php echo $row['id']; ?>"><button class="btn btn-xs btn-primary">Update</button></a>
										<a href="?pagecontent=teams&remove=<?php echo $row['id']; ?>"><button class="btn btn-xs btn-danger">Remove</button></a>
									</td>
								</tr>
								<?php
									}
								?>
						</table>
					</div>
				</div>
			</div>
        </div>
    </div>
</div>


<?php
	if(isset($_REQUEST['remove'])){
		$id = $_REQUEST['remove'];
		mysqli_query($conn,"DELETE FROM teams WHERE id=$id");
		header('Location: ?pagecontent=teams');  
	}
?>