<?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_branches = get_all_branches("all");

?>


    <!--== 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="dashboard.php"><i class="fa fa-home" aria-hidden="true"></i> Home</a>
                        </li>
                        <li> All Branches</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 Branches</h4>
                                    <p>Different branches of your restaurant</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="all-branches.php">All Branches</a></li>
                                        <li><a href="add-branch.php">Add Branch</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>Get Feedback</th>
                                                    <th>Edit</th>
                                                    <th>Delete</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                     $ccc=1;
                                                     while($row=mysqli_fetch_assoc($all_branches)){
                                                  ?>
                                                <tr>
                                                    <td><?=$ccc;?></td>
                                                    <td><?=$row['name'];?></td>
                                                    <td><a href="index.php?branch_id=<?=$row['id'];?>"><i class="fa fa-envelope" aria-hidden="true" target="_blank"></i></a></td>
                                                    <td>
                                                        <a href="add-branch.php?branch_id=<?=$row['id'];?>"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
                                                    </td>
                                                    <td>
                                                        <a href="ajax-request.php?branch-delete-request=1&branch_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>
<?php include 'inc/footer.php';?>