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

<!DOCTYPE html>
<html lang="en">
<?php include ("../Header/head.php"); ?>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.js"></script>

<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>

<?php
$q = "SELECT *
      FROM monthly_promotion
      WHERE status='1'
      ORDER BY id DESC";
$result = $mysqli->query($q);

if ($result->num_rows > 0)
{
    $i = 1;
    while($record = $result->fetch_assoc())
    {
        $summernote_id = "summernote".$i;

        $id = $record['id'];
        $promotion_month = $record['promotion_month'];
        $promotion_year = $record['promotion_year'];
        $promotion_title = $record['promotion_title'];
        $promotion_image = $record['promotion_image'];
        $promotion_content = $record['promotion_content'];
?>
<div class="row">
    <div class="col-12">
    <div class="card">
    <div class="card-body">
        <div class="table-responsive m-t-40">

            <h2><?php echo $promotion_title; ?></h2>
            <h6><?php echo $promotion_month; ?> <?php echo $promotion_year; ?></h6>
            <br>

            <?php if ($promotion_image != "") { ?>
                <img src="../Controller/uploads/<?php echo $promotion_image; ?>" width="30%"><br><br>
            <?php } ?>

            <textarea class="form-control" id="<?php echo $summernote_id; ?>" rows="10"><?php echo $promotion_content; ?></textarea>

        </div>
    </div>
    </div>
    </div>
</div>
<?php
        $i++;
    }
}
?>

</div>
</div>

<script type="text/javascript">
$(document).ready(function () {
    $('[id^="summernote"]').each(function () {
        $(this).summernote({ airMode: true });
        $(this).summernote('disable');
    });
});
</script>

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

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

</body>
</html>