<?php 

include("inc/header.php"); 
include("config.php"); 
include("functions.php");

$all_feedbacks = get_all_feedbacks("all");
$total_feeds = $all_feedbacks->num_rows;




?>

    <!--== BODY CONTNAINER ==-->
    <div class="container-fluid sb2">
        <div class="row">
            <?php include 'inc/sidebar.php';?>

            <!--== BODY INNER CONTAINER ==-->
            <div class="sb2-2">
                <!--== breadcrumbs ==-->
                <div class="sb2-2-2">
                    <ul>
                        <li><a href="dashboard.php"><i class="fa fa-home" aria-hidden="true"></i> Home</a>
                        </li>
                        <li class="active-bre"><a href="#"> Dashboard</a>
                        </li>
                    </ul>
                </div>
                <!--== DASHBOARD INFO ==-->
                <div class="ad-v2-hom-info">
                    <div class="ad-v2-hom-info-inn">
                        <ul>
                            <li>
                                <div class="ad-hom-box ad-hom-box-1">
                                    <span class="ad-hom-col-com ad-hom-col-1"><i class="fa fa-bar-chart"></i></span>
                                    <div class="ad-hom-view-com">
                                    <p><i class="fa  fa-arrow-up up"></i> Total Feedbacks</p>
                                    <h3><?=$total_feeds?></h3>
                                    </div>
                                </div>
                            </li>
                            <!-- <li>
                                <div class="ad-hom-box ad-hom-box-2">
                                    <span class="ad-hom-col-com ad-hom-col-2"><i class="fa fa-usd"></i></span>
                                    <div class="ad-hom-view-com">
                                    <p><i class="fa  fa-arrow-up up"></i> Earnings</p>
                                    <h3>22,520</h3>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="ad-hom-box ad-hom-box-3">
                                    <span class="ad-hom-col-com ad-hom-col-3"><i class="fa fa-address-card-o"></i></span>
                                    <div class="ad-hom-view-com">
                                    <p><i class="fa  fa-arrow-up up"></i> Total Users</p>
                                    <h3>22,520</h3>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="ad-hom-box ad-hom-box-4">
                                    <span class="ad-hom-col-com ad-hom-col-4"><i class="fa fa-envelope-open-o"></i></span>
                                    <div class="ad-hom-view-com">
                                    <p><i class="fa  fa-arrow-up up"></i> Total Enquiry</p>
                                    <h3>22,520</h3>
                                    </div>
                                </div>
                            </li> -->
                        </ul>
                    </div>
                </div>
                
                <!--== User Details ==-->
                <div class="sb2-2-3">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="box-inn-sp">
                                <div class="inn-title">
                                    <h4>Top Feedbacks</h4>
                                    <p>These are recent feedbacks from your customers.</p>
                                    <a class="dropdown-button drop-down-meta" href="#" data-activates="dr-users"><i class="material-icons">more_vert</i></a>
                                    <ul id="dr-users" class="dropdown-content">
                                        <li><a href="#!">Add New</a>
                                        </li>
                                        <li><a href="#!">Edit</a>
                                        </li>
                                        <li><a href="#!">Update</a>
                                        </li>
                                        <li class="divider"></li>
                                        <li><a href="#!"><i class="material-icons">delete</i>Delete</a>
                                        </li>
                                        <li><a href="#!"><i class="material-icons">subject</i>View All</a>
                                        </li>
                                        <li><a href="#!"><i class="material-icons">play_for_work</i>Download</a>
                                        </li>
                                    </ul>
                                    <!-- Dropdown Structure -->

                                </div>
                                <div class="tab-inn">
                                    <div class="table-responsive table-desi">
                                        <table class="table table-hover">
                                            <thead>
                                                <tr>
                                                    <th>ID</th>
                                                    <th>Name</th>
                                                    <th>Phone</th>
                                                    <th>From</th>
                                                    <th>Branch</th>
                                                    <th>Feedback</th>
                                                    <th>View</th>
                                                    <th>Delete</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                     $ccc=1;
                                                     while($row=mysqli_fetch_assoc($all_feedbacks)){
                                                  ?>
                                                <tr>
                                                    <td><?=$ccc;?></td>
                                                    <td><?=$row['name'];?></td>
                                                    <td><?=$row['number'];?></td>
                                                    <td><?= isset($row['branch_name']) ? $row['branch_name'] : '' ?></td>
                                                    <td><?= get_single_branch($row['branch_id'])['name'];?></td>
                                                    <td><?=$row['message'];?></td>
                                                    <td>
                                                        <a href="feedback-details.php?userId=<?=$row['id'];?>"><i class="fa fa-eye" aria-hidden="true"></i></a>
                                                    </td>
                                                    <td>
                                                        <a href="ajax-request.php?feedback-delete-request=1&feedback_id=<?=$row['id'];?>"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
                                                    </td>
                                                </tr>
                                                <?php
                                                 $ccc++;
                                                 }
                                                ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>

        </div>
    </div>

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/2.0.3/css/dataTables.dataTables.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/3.0.1/css/buttons.dataTables.css">

<script
  src="https://code.jquery.com/jquery-3.7.1.min.js"
  integrity="sha256-3gJwYp4gkFh9vZ1p4E4H6Bq9VHtVHCnQWmvMRd/Dr4c="
  crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/2.0.3/js/dataTables.js"></script>
<script src="https://cdn.datatables.net/buttons/3.0.1/js/dataTables.buttons.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/3.0.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/3.0.1/js/buttons.print.min.js"></script>
<script>
  $(document).ready(function() {


      // FOR PDF EXCEL
      new DataTable('#datatables', {
          layout: {
              topStart: {
                  buttons: ['copy', 'csv', 'pdf', 'print']
              }
          }
      });
    });

</script>
<?php include 'inc/footer.php';?>