<?php
    
    include("../include/header.php");
?>


<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li><a href="<?php echo $admin_baseurl . 'dashboard.php';?>">Dashboard</a></li>
                    <li class="active">
                        <span>Slider</span>
                    </li>
                </ol>
            </div>
            <h2 class="font-light m-b-xs">
                Website Slider
            </h2>
        </div>
    </div>
</div>


<div class="content">
    <div class="hpanel">
        <div class="hpanel">
            <div class="panel-heading hbuilt">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                    <a class="fullscreen"><i class="fa fa-expand"></i></a>
                </div>
                Add Website Slider
            </div>
            <div class="panel-body">
                <form class="form-horizontal" action="execute.php" method="post" enctype="multipart/form-data">
                    <div class="form-group">
                        <div class="col-md-12">
                            <label class="control-label">Add Slider Image <small style="color:#eb6a4e"> (Image size must be 1920 x 550 )</small></label>
                            <input required class="form-control" type="file" id="file" name="image_a" multiple="multiple" accept="image/*" />
                        </div>

                        <div class="col-md-12">
                            <br>
                            <div class=" text-right">
                                <button type="reset" class="btn btn-default">Cancel</button>
                                <button type="submit" name="add_slider_img" class="btn btn-primary">Submit</button>
                            </div>

                        </div>

                    </div>

                </form>
            </div>

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

  
<div class="content">
    <div class="hpanel">
        <div class="panel-heading hbuilt">
            <div class="panel-tools">
                <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                <a class="fullscreen"><i class="fa fa-expand"></i></a>
            </div>
            View All Slider images
        </div>
        <div class="panel-body">
            <div class="table-responsive">
                <table id="userPermission_dataTable" class="table table-striped table-bordered table-hover">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Slider Image</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>

                        <?php
        $srno = 0;
        $sqlAssign1 = "SELECT * FROM `slider` ORDER BY `slider`.`id` DESC";										
        $resultAssign1 = mysqli_query($conn, $sqlAssign1);											
        if (mysqli_num_rows($resultAssign1) > 0) {
            while($rows = mysqli_fetch_assoc($resultAssign1)) { 
                
                $id = $rows['id'];
                $slider_img = $rows['slider_img'];
                $slider_status = $rows['status'];
                
         
                
?>
                        <tr>
                            <th scope="row"><?php echo $srno += 1;?></th>

                            <td><img src="<?php echo $admin_baseurl . 'slider/slider-images/' .$slider_img;?>" style="width:250px; height:100px;"></td>


                            <td>
                                <div class="action_btns">

                                    

                                    <form method="post" action="execute.php?id=<?php echo $id;?>">
                                        <button type="submit" name="Delete_slider" class="actionbtn" onclick="return confirm('Do you want to delete this data?')"><i class="fa fa-trash text-danger" aria-hidden="true"></i></button>
                                    </form>


                                    <?php if($slider_status == 'active'){?>
                                    <form method="post" action="execute.php?id=<?php echo $id;?>">
                                        <button type="submit" name="status_deactive_slider" class="actionbtn"><i class="fa fa-toggle-on text-success" aria-hidden="true"></i></button>
                                    </form>
                                    <?php }else{?>
                                    <form method="post" action="execute.php?id=<?php echo $id;?>">
                                        <button type="submit" name="status_active_slider" class="actionbtn"><i class="fa fa-toggle-off text-danger" aria-hidden="true"></i></button>
                                    </form>
                                    <?php }?>
                                </div>
                            </td>


                        </tr>
                        <?php }}?>

                    </tbody>
                </table>
            </div>
        </div>

    </div>
</div>

<br>
<?php 
    include('../include/footer.php');
?>
