<?php include("../Header/Session.php"); ?>
<?php include("../Header/Connection.php"); ?>

<!DOCTYPE html>
<html lang="en">
<?php include ("../Header/head.php"); ?>
<body class="skin-default fixed-layout">

<div id="main-wrapper">
<?php include ("../Header/header.php"); ?>
<?php include ("../Header/left_menu.php"); ?>
<?php include ("../Header/right_sidebar.php"); ?>

<div class="page-wrapper">
<div class="container-fluid">
<br><br>

<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">

<h4 class="card-title">List Of Promotions</h4>
<a href="add_promotion.php" class="btn btn-success" style="margin-bottom:15px;"><i class="fa fa-plus"></i> Add Promotion</a>

<div class="table-responsive m-t-40">
<table id="example23" class="display nowrap table table-hover table-striped table-bordered" cellspacing="0" width="100%">
    <thead>
        <tr>
            <th>Month</th>
            <th>Year</th>
            <th>Title</th>
            <th>Action</th>
        </tr>
    </thead>
    <tbody>
        <?php
        $q = "SELECT *
              FROM monthly_promotion
              WHERE status = '1'
              ORDER BY id DESC";
        $result = $mysqli->query($q);
        if ($result && $result->num_rows > 0)
        {
            while($record = $result->fetch_assoc())
            {
                $id = $record['id'];
                $promotion_month = $record['promotion_month'];
                $promotion_year = $record['promotion_year'];
                $promotion_title = $record['promotion_title'];
        ?>
        <tr>
            <td><?php echo $promotion_month; ?></td>
            <td><?php echo $promotion_year; ?></td>
            <td><?php echo $promotion_title; ?></td>
            <td>
                <a href="update_promotion.php?id=<?php echo $id; ?>" class="btn btn-success"><i class="fa fa-check"></i> Update</a>
                <a href="../Controller/Database_sql.php?form_name_Delete_Promotion=Delete_Promotion&promotion_id=<?php echo $id; ?>"
                   class="btn btn-danger"
                   onclick="return confirm('Do you want to proceed?');">
                    <i class="fa fa-trash"></i>&nbsp; Delete
                </a>
            </td>
        </tr>
        <?php
            }
        }
        ?>
    </tbody>
</table>
</div>

</div>
</div>
</div>
</div>

</div>
</div>

<?php include ("../Footer/footer.php"); ?>
</div>

<?php include ("../Header/all_jquery.php"); ?>
</body>
</html>