<?php
session_start();
include_once 'functions/fungsi.php';
include_once 'connection/koneksi.php';

$id = $_GET['kd'];
?> 
<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title>Cafe Bunga Toba</title>
        <link rel="stylesheet" href="css/normalize.css">
        <link rel="stylesheet" href="css/main.css" media="screen" type="text/css">
        <link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>
        <link href='http://fonts.googleapis.com/css?family=Playball' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="css/bootstrap.css">
        <link rel="stylesheet" href="css/animate.css">
        <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">

        <link rel="stylesheet" href="css/style-portfolio.css">
        <link rel="stylesheet" href="css/picto-foundry-food.css" />
        <link rel="stylesheet" href="css/jquery-ui.css">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href="css/font-awesome.min.css" rel="stylesheet">
        <link rel="icon" href="favicon-1.ico" type="image/x-icon">
    </head>

    <body>

        <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
            <div class="container">
                <ul class="tp-hd-lft wow fadeInDown animated" data-wow-delay="0.5s"></ul>
                <div class="row">
                    <!-- Brand and toggle get grouped for better mobile display -->
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="index.php">Cafe BUNGA TOBA</a>
                    </div>

                    <!-- Collect the nav links, forms, and other content for toggling -->
                    <ul class="tp-hd-lft wow fadeInDown animated" data-wow-delay="0.5s">
                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                        <ul class="nav navbar-nav main-nav  clear navbar-right ">
                            <li><a class="navactive color_animation" href="index.php">WELCOME</a></li>
                            <?php
                            if (isset($_SESSION['isLogin']) && (get_session('role') == "member")) {
                                echo('<li><a class="color_animation" href="profil.php">PROFIL</a></li>');
                                echo('<li><a class="color_animation" href="index.php #menu">MENU</a></li>');
                                echo('<li><a class="color_animation" href="pesanan.php">PESANAN</a></li>');
                                echo('<li><a class="color_animation" href="upload_bukti.php">PEMBAYARAN</a></li>');
                                echo('<li><a class="color_animation" href="logout.php">LOGOUT (' . get_session('first_name') . ')</a></li>');
                            }
                            if (isset($_SESSION['isLogin']) && (get_session('role') == "karyawan" || get_session('role') == "admin")) {
                                echo('<li><a class="color_animation" href="tambah_menu.php">OLAH MENU</a></li>');
                                echo('<li><a class="color_animation" href="daftar_pesanan.php">DAFTAR PESANAN</a></li>');
                                echo('<li><a class="color_animation" href="list_komentar.php">DAFTAR KOMENTAR</a></li>');
                                echo('<li><a class="color_animation" href="logout.php">LOGOUT (' . get_session('first_name') . ')</a></li>');
                            }
                            if (!isset($_SESSION['isLogin'])) {
                                echo('<li><a class="color_animation" href="profil.php">PROFIL</a></li>');
                                echo('<li><a class="color_animation" href="#menu">MENU</a></li>');
                                echo('<li><a class="color_animation" href="login.php">LOGIN</a></li>');
                                echo('<li><a class="color_animation" href="signup.php">SIGN UP</a></li>');
                            }
                            ?> 



                        </ul>
                    </div><!-- /.navbar-collapse -->
                </div>
            </div><!-- /.container-fluid -->
        </nav>

        <div id="top" class="starter_container bg">
            <div class="follow_container">
                <div class="col-md-6 col-md-offset-3">
                    <h2 class="top-title">CAFE BUNGA TOBA</h2>
                    <h2 class="white second-title">" Best in BALIGE "</h2>
                    <hr>
                </div>
            </div>
        </div>
      
        <!-- ============ Menu  ============= -->

<?php
$per_hal = 8;
$jumlah_record = mysqli_query($conn, "SELECT * from menu");
$jum = mysqli_num_rows($jumlah_record);
$halaman = ceil($jum / $per_hal);
$page = (isset($_GET['page'])) ? (int) $_GET['page'] : 1;
$start = ($page - 1) * $per_hal;
?>

        
        <section id ="menu" class="description_content">
            <div class="pricing background_content">
                <h1>Daftar Menu</h1>
            </div>
            <div class="text-content container"> 
                <div class="container">
                <ul class="tp-hd-lft wow fadeInDown animated" data-wow-delay="0.5s"></ul>
                    <div class="row">
                        <div id="w">
        <?php 
                    if(isset($_POST['cari'])) {
                        $cari = $_POST['search'];
                        $sql  = mysqli_query($conn, "SELECT * FROM menu WHERE nama LIKE '%$cari%' ORDER BY kategori");
                    }
        ?>
                    <div class="col-lg-12">
                        <form action="" method="get">
                            <div class="input-group col-md-5 col-md-offset-7">
                                <span class="input-group-addon" id="basic-addon1"><span class="glyphicon glyphicon-search"></span></span>
                                <input type="text" class="form-control" placeholder="Cari menu di sini .." aria-describedby="basic-addon1" name="search">   
                         
                        </form>
                    </div>
 
 <div class="top-brands">
            <div class="container">
                <div class="grid_3 grid_5">
                    <div class="bs-example bs-example-tabs" role="tabpanel" data-example-id="togglable-tabs">
                        <ul id="myTab" class="nav nav-tabs" role="tablist">
                            <li role="presentation" class="active"><a href="#expeditions" id="expeditions-tab" role="tab" data-toggle="tab" aria-controls="expeditions" aria-expanded="true">Makanan</a></li>
                            <li role="presentation"><a href="#tours" role="tab" id="tours-tab" data-toggle="tab" aria-controls="tours">Minuman</a></li>
                        </ul>
                        <div id="myTabContent" class="tab-content">
                            <div role="tabpanel" class="tab-pane fade in active" id="expeditions" aria-labelledby="expeditions-tab">
                                <div class="agile-tp">

                                    <h2>Berikut daftar buku makanan pada cafe ini</h2>
                                </div>
                                <div class="agile_top_brands_grids">
                                    <?php
                                        $query = "SELECT * FROM menu WHERE id_kategori=1 limit $start, $per_hal";
                                        $result_set = $conn->query($query);
                                        while ($row = $result_set->fetch_assoc()) {
                                    ?>
                                    <div class="col-md-3 top_brand_left">   
                                        <div class="hover14 column">
                                            <div class="agile_top_brand_left_grid">
                                                <div class="agile_top_brand_left_grid_pos">
                                                    <img src="images/offer.png" alt=" " class="img-responsive">
                                                </div>
                                                <div class="agile_top_brand_left_grid1">
                                                    <figure>
                                                        <div class="snipcart-item block" >
                                                            <div class="snipcart-thumb">
                                                            <li class="item breakfast">
                                                <?php echo $row['nama']?><br>
                                                <img src="foto/<?php echo $row['gambar'] ?>" class="img-rounded" height="250" width="220" class="col-md-12 img-responsive">
                                                <h2 class="white">Rp. <?php echo $row['harga']; ?></h2>
                                               <a href="pesan_barang.php?id=<?= $row['id'] ?>">
                                                    <button class="text-center btn-block form-btn">Pesan</button>
                                                </a>   
                                                <?php echo $row['deskripsi']?>
                                            </li>
                                            <br>    
                                                        </div>
                                                    </figure>
                                                </div>
                                            </div>
                                        </div>
                                        <br>
                                    </div>
                                    <?php   
                                        }
                                    ?>
                                    <div class="clearfix"> </div>   
                                </div>
                            </div>
                            <div role="tabpanel" class="tab-pane fade" id="tours" aria-labelledby="tours-tab">
                                <div class="agile-tp">
                                    <h2>Berikut daftar buku minuman pada cafe ini</h2>
                                </div>
                                <div class="agile_top_brands_grids">
                                    <?php
                                        $query = "SELECT * FROM menu WHERE id_kategori=2 limit $start, $per_hal";
                                        $result_set = $conn->query($query);
                                        while ($row = $result_set->fetch_assoc()) {
                                    ?>
                                    <div class="col-md-3 top_brand_left">   
                                        <div class="hover14 column">
                                            <div class="agile_top_brand_left_grid">
                                                <div class="agile_top_brand_left_grid_pos">
                                                    <img src="images/offer.png" alt=" " class="img-responsive">
                                                </div>
                                                <div class="agile_top_brand_left_grid1">
                                                    <figure>
                                                        <div class="snipcart-item block" >
                                                            <div class="snipcart-thumb">
                                                            <li class="item breakfast">
                                                <?php echo $row['nama']?><br>
                                                <img src="foto/<?php echo $row['gambar'] ?>" class="img-rounded" height="250" width="220" class="col-md-12 img-responsive">
                                                <h2 class="white">Rp. <?php echo $row['harga']; ?></h2>
                                               <a href="pesan_barang.php?id=<?= $row['id'] ?>">
                                                    <button class="text-center btn-block form-btn">Pesan</button>
                                                </a>   
                                                <?php echo $row['deskripsi']?>
                                            </li>
                                            <br>    
                                                        </div>
                                                    </figure>
                                                </div>
                                            </div>
                                        </div>
                                        <br>
                                    </div>
                                    <?php   
                                        }
                                    ?>
                                    <div class="clearfix"> </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <!-- //top-brands -->
                
<div class="col-md-12">
  <ul class="pagination">           
    <?php
    for ($x = 1; $x <= $halaman; $x++) {
        ?>
        <li><a href="?page=<?php echo $x ?>"><?php echo $x ?></a></li>
        <?php
    }
    ?>                      
</ul>

                                </div>
                            </ul>

                        </div><!-- @end #w -->
                    </div>
                </div>
            </div>  
        </section>
        <br><br><br><br><br><br><br><br><br><br><br><br>

        <!-- ============ Komentar  ============= -->

        <section  id="komentar"  class="description_content">
            <div class="bread background_content">
                <h1>Beri Saran/Pertanyaan</h1>
                <h2 class="white second-title">"Jika anda memiliki saran ataupun pertanyaan,anda dapat mengisi formulir dibawah ini"</h2>
            </div>
            <div class="text-content container"> 
                <div class="inner contact">
                    <!-- Form Area -->
                    <center>
                        <div class="contact-form">
                            <!-- Form -->
                            <form id="contact-us" method="post" action="komentar_process.php">
                                <!-- Left Inputs -->
                                <div class="container">
                                    <div class="row">
                                        <div class="col-lg-8 col-md-6 col-xs-12">
                                            <div class="row">
                                                <div class="col-lg-12 col-md-6 col-xs-6">
                                                    <!-- Name -->
                                                    <input type="text" name="name" id="first_name" required="required" class="form" placeholder="Name" />
                                                    <input type="email" name="email" id="email" required="required" class="form" placeholder="Email" />
                                                    <textarea name="message" id="message" class="form textarea"  placeholder="Message"></textarea>

                                                </div>

                                                <div class="col-xs-6 ">
                                                    <!-- Send Button -->
                                                    <button type="submit" id="submit" name="submit" class="text-center form-btn form-btn">Send</button> 
                                                </div>

                                            </div>
                                        </div>


                                    </div>
                                </div>
                                <!-- Clear -->
                                <div class="clear"></div>
                            </form>
                        </div><!-- End Contact Form Area -->
                    </center>
                </div><!-- End Inner -->
            </div>
        </section>

        <!-- ============ Tampilan Komentar =========== -->
         <div class="text-content container"> 
                <div class="inner contact">
                    <div class="container">
                    <div class="col-lg-8 col-md-6 col-xs-12">
                    <div class="row">
                        <div class="col-lg-12 col-md-6 col-xs-6">
                        <h2>Komentar:</h2><br>
                        </div>      
                        <br><br><br><br>
                        <div class="col-lg-12">
                            <?php
                            $query = "SELECT * FROM komentar";
                            $result_set = $conn->query($query);

                            while ($row = $result_set->fetch_assoc()) {
                                ?>
                                <div class="alert alert-success" role="alert"> <strong><?= $row['name'] ?></strong>
                                    <p> <?= $row['komentar'] ?></p></div>

                            <?php }
                            ?> 
                        </div>
                        </div>
                    </div>
                </div>
            </div>
        </div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>


        <!-- ============ Footer Section  ============= -->
        <br>
        <footer class="sub_footer">
            <div class="container">
                <div class="col-md-4"><p class="sub-footer-text text-center">&copy; Cafe Bunga Toba, Design by <a href="https://themewagon.com/">PA1-1617-D3TI05</a></p></div>
                <div class="col-md-4"><p class="sub-footer-text text-center">Back to <a href="#top">TOP</a></p>
                </div>
                <div class="col-md-4"><p class="sub-footer-text text-center">Built With Care By <a href="#" target="_blank">Us</a></p></div>
            </div>
        </footer>


        <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
        <script type="text/javascript" src="js/bootstrap.min.js" ></script>
        <script type="text/javascript" src="js/jquery-1.10.2.js"></script>     
        <script type="text/javascript" src="js/jquery.mixitup.min.js" ></script>
        <script type="text/javascript" src="js/main.js" ></script>

    </body>
</html>