<?php 

ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);

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

$all_feedbacks = get_all_feedbacks("all");

$total_customers = $all_feedbacks->num_rows;
$sad = get_rating_by_category('FoodQualityrating', 5);
var_dump($sad);

?>
   <style type="text/css">
     .card{
        padding: 24px 130px;
        border-radius: 11px;
     }
     .display-5{
        font-size: 100px;
     }
    .card h6{
        font-size: 20px;
     }
     .bg-label-primary{
        background-color: #e8e9ff !important;
        color: #666cff !important;
     }
     .rounded-pill {
        border-radius: 50rem !important;
    }
    .rounded {
        border-radius: .5rem !important;
    }
    .progress{
        --bs-progress-height: 0.75rem;
        --bs-progress-font-size: 0.625rem;
        --bs-progress-bg: #ededff;
        --bs-progress-border-radius: 0;
        --bs-progress-box-shadow: inset 0 1px 2px rgba(76, 78, 100, 0.075);
        --bs-progress-bar-color: #fff;
        --bs-progress-bar-bg: #666cff;
        --bs-progress-bar-transition: width 0.6s ease;
        display: flex;
        height: var(--bs-progress-height);
        overflow: hidden;
        font-size: var(--bs-progress-font-size);
        background-color: var(--bs-progress-bg);
        border-radius: var(--bs-progress-border-radius);
    }
    /*.progress-bar{
        width: 100%;
    }*/
    .gap-3 {
        gap: 1rem !important;
    }
    .d-flex {
        display: flex !important;
    }
    .w-100 {
    width: 100% !important;
}
.text-nowrap {
    white-space: nowrap !important;
}
.px-4 {
    padding-right: 1.5rem !important;
    padding-left: 1.5rem !important;
}
.justify-content-between {
    justify-content: space-between !important;
}
.flex-column {
    flex-direction: column !important;
}
small{
    font-size: 88% !important;
    font-weight: 500;
    color: black;
}
div.dt-container .dt-search input {
    width: 250px;
    height: 22px;
    }
   </style>

    <!--== BODY CONTNAINER ==-->
    <div class="container-fluid sb2">

        <div class="row">
            <?php include 'inc/sidebar.php';?>
            <div class="sb2-2">
                <div class="sb2-2-2">
                    <ul>
                        <li><a href="#"><i class="fa fa-home" aria-hidden="true"></i> Home</a>
                        </li>
                        <li class="active-bre"><a href="#"> All Reviews</a>
                        </li>
                    </ul>
                </div>
                <div class="sb2-2-3">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="box-inn-sp">
                                <div class="inn-title">
                                    <h4>All Feedbacks</h4>
                                    <!--<p>These are customers who given feedbacks.</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>
                                    </ul>

                                    <!-- Dropdown Structure -->

                                </div>
                                <div class="tab-inn">
                                    <div class="table-responsive table-desi">
            <table id="datatables" class="table table-bordered table-hover table-striped">
                                        <!-- <table class="table table-hover"> -->
                                            <thead>
                                                <tr>
                                                    <th>ID</th>
                                                    <th>Name</th>
                                                    <th>Phone</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><?= 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';?>