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


<style>
    #testimonials ul li:nth-child(2) {
        background-color: #eb6a4e;
    }

    #testimonials ul li:nth-child(2) a {
        color: #fff;
    }

    #testimonials ul li:nth-child(2) a:hover {
        background-color: #eb6a4e;
    }

    td:nth-child(2) {
        width: 60%;
    }

</style>
<script>
    window.onload = function() {
        document.getElementById('testimonials').classList.add("active");
        document.getElementById('testimonials1').classList.add("in");
    };

</script>

<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>Testimonials</span>
                    </li>
                </ol>
            </div>
            <h2 class="font-light m-b-xs">
                View Testimonials
            </h2>

        </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 Testimonials Details
        </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>Testimonials Details</th>
                            <th>Preview File</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>

                        <?php
        $srno = 0;
        $sqlAssign1 = "SELECT * FROM `testimonials` ORDER BY `testimonials`.`id` DESC";										
        $resultAssign1 = mysqli_query($conn, $sqlAssign1);											
        if (mysqli_num_rows($resultAssign1) > 0) {
            while($rows = mysqli_fetch_assoc($resultAssign1)) { 
                
                $testi_id = $rows['id'];
                $testi_name = $rows['name'];
                $testi_photo = $rows['photo'];
                $testi_comment = $rows['feedback'];
                $testi_status = $rows['status'];
                
?>
                        <tr>
                            <th scope="row"><?php echo $srno += 1;?></th>

                            <td style="text-align:left">
                                <p><b>Name : </b> <?php echo $testi_name; ?></p>
                                <p><b>Testimonials : </b> <?php echo $testi_comment; ?></p>
                               
                            </td>
                            <td>
                                <img src="<?php echo $admin_baseurl . 'testimonials/upload-files/'. $testi_photo; ?>" style="width:110px; height:80px;">
                                
                                     
                            </td>



                            <td>
                                <div class="action_btns">

                                    <form method="post" action="update-testimonials.php?id=<?php echo $testi_id;?>">
                                        <button type="submit" class="actionbtn"><i class="fa fa-pencil-square-o text-success" aria-hidden="true"></i></button>
                                    </form>

                                    <form method="post" action="execute.php?id=<?php echo $testi_id;?>">
                                        <button type="submit" name="Delete_testimonial" 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($testi_status == 'active'){?>
                                    <form method="post" action="execute.php?id=<?php echo $testi_id;?>">
                                        <button type="submit" name="status_deactive_testimonial" 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 $testi_id;?>">
                                        <button type="submit" name="status_active_testimoniale" 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');
?>
