<?php
session_start();

if (isset($_SESSION['username']) == true) {
	include 'master.php';
	$username = $_SESSION['username'];
}else{
	header("location:login");
}
?>
		<!--page-wrapper-->
		<div class="page-wrapper">
			<!--page-content-wrapper-->
			<div class="page-content-wrapper">
				<div class="page-content">
					<!--breadcrumb-->
					<div class="page-breadcrumb d-none d-md-flex align-items-center mb-3">
						<div class="breadcrumb-title pr-3">Expired Swift Code</div>
						<div class="pl-3">
							<nav aria-label="breadcrumb">
								<ol class="breadcrumb mb-0 p-0">
									<li class="breadcrumb-item"><a href="javascript:;"><i class='bx bx-home-alt'></i></a>
									</li>
									<li class="breadcrumb-item active" aria-current="page">Swift Code's Data</li>
								</ol>
							</nav>
						</div>
						<div class="ml-auto">
							<div class="btn-group">
								<button type="button" class="btn btn-primary">Active</button>
							</div>
						</div>
					</div><br><br>
					<div class="card">
						<div class="card-body">
							<div class="card-title">
								<h4 class="mb-0">Active Swift Code</h4>
							</div>
							<hr/>
							<div class="table-responsive">
								<table id="example" class="table table-striped table-bordered" style="width:100%">
									<thead>
										<tr>
											<th>S/N</th>
											<th>Added By</th>
											<th>Swift Code</th>
											<th>Used By</th>
											<th>Status</th>
											<th>Stat</th>
											<th>Dated Added</th>
											<!-- <th>Action</th> -->
										</tr>
									</thead>
									<tbody>
										<tr>
										<?php
											$selcoupon_code = $conn->query("SELECT * FROM swift_codes WHERE status = 'Expired' ORDER BY id DESC ");
											$i=1;
											if ($selcoupon_code->num_rows == 0) {
												echo "
												<td style='color:red; text-align:center;'>No Expired Swift codes added Yet</td>";
											}
											foreach ($selcoupon_code as $key) {
												$id = $key['id'];
										?>
											<td><?php echo $i;?></td>
											<td><?php echo $key['added_by'];?></td>
											<td><?php echo $key['swift_code'];?></td>
											<td><?php echo $key['used_by'];?></td>
											<td><?php echo $key['status'];?></td>
											<td><?php echo $key['stat'];?></td>
											<td><?php echo $key['date_added'];?></td>
											<!-- <td><a href="delete-coupon-code?id=<?php echo $id; ?>" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete?')">Delete</a></td> -->
										</tr>
										<?php $i++;
										}	?>
									</tbody>
									<tfoot>
										<tr>
											<tr>
											<th>S/N</th>
											<th>Added By</th>
											<th>Swift Code</th>
											<th>Used By</th>
											<th>Status</th>
											<th>Stat</th>
											<th>Dated Added</th>
											<!-- <th>Action</th> -->
										</tr>
										</tr>
									</tfoot>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!--end page-content-wrapper-->
		</div>
		<!--end page-wrapper-->
		<!--start overlay-->
		<div class="overlay toggle-btn-mobile"></div>
		<!--end overlay-->
		<!--Start Back To Top Button-->
		<a href="javaScript:;" class="back-to-top"><i class='bx bxs-up-arrow-alt'></i></a>
		<!--End Back To Top Button-->

<script>
		$(document).ready(function () {
			//Default data table
			$('#example').DataTable();
			// var table = $('#example2').DataTable({
			// 	lengthChange: false,
			// 	buttons: ['copy', 'excel', 'pdf', 'print', 'colvis']
			// });
			// table.buttons().container().appendTo('#example2_wrapper .col-md-6:eq(0)');
		});
	</script>
<?php
include 'footer.php';