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


?> 
<!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 = 10;
$jumlah_record = mysql_query("SELECT COUNT(*) from menu");
$jum = mysql_result($jumlah_record, 0);
$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">
                            <ul>

                                <div class="col-lg-12">
                                    <?php
                                    $query = "SELECT * FROM menu";
                                    $result_set = $database->query($query);

                                    while ($row = $result_set->fetch_assoc()) {
                                        ?>
                                        <div class="col-lg-3">

                                            <li class="item breakfast">
                                                <?php echo $row['nama']?>
                                                <img src="foto/<?php echo $row['gambar'] ?>" class="img-rounded" height="200" width="200" 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>
                                    <?php }
                                    ?> 

<div class="col-md-12">
        <ul class="pagination">          
    <?php
    for ($x = 1; $x <= $halaman; $x++) {
        ?>
        <li><a href="?page=i<?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 Komentar</h1>
            </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="row">

                        <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">
                        <h2>Komentar:</h2><br>
                        </div>
                        <br><br><br><br>
                        <div class="col-lg-12">
                            <?php
                            $query = "SELECT * FROM Komentar";
                            $result_set = $database->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><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
        </section>


        <!-- ============ 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="#">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>