<?php
session_start();

  if(!isset($_SESSION['loggedin_id'])){
    header("location:login.php");
  }
   // include("functions.php");
    ini_set('display_errors', '1');
    ini_set('display_startup_errors', '1');
    error_reporting(E_ALL);
    $imgLink = "";

    function get_company_datas($id=0){
      ini_set('display_errors', '1');
      ini_set('display_startup_errors', '1');
      error_reporting(E_ALL);
      include("config.php");
      $query = "SELECT * from company where id <> 0 LIMIT 1";
      $run   = mysqli_query($conn, $query);
      if($run && mysqli_num_rows($run) > 0){
          return mysqli_fetch_assoc($run);
      }
      return [];
    }

    $company_data = get_company_datas();
    if (is_array($company_data) && !empty($company_data['location']) && !empty($company_data['logo'])) {
        $location = "../".$company_data['location'];
        $img      = explode(',', (string)$company_data['logo']);
        if (!empty($img[0])) {
            $imgLink = 'feedback/'.$location.'/'.$img[0];
        }
    }
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <title>Resturaunt - Feedback Form</title>
    <!--== META TAGS ==-->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <!--== FAV ICON ==-->
    <link rel="shortcut icon" href="images/fav.ico">

    <!-- GOOGLE FONTS -->
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Quicksand:300,400,500" rel="stylesheet">

    

    <!-- FONT-AWESOME ICON CSS -->
    <link rel="stylesheet" href="css/font-awesome.min.css">

    <!--== ALL CSS FILES ==-->
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/mob.css">
    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/materialize.css" />

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
  <script src="js/html5shiv.js"></script>
  <script src="js/respond.min.js"></script>
  <![endif]-->
  
  <style type="text/css">

      /* MODAL STYLING */
      #errorMsgModal, #successrMsgModal {
         display: none; /* Hidden by default */
         position: fixed; /* Stay in place */
         z-index: 1; /* Sit on top */
        padding-bottom: 100px;
        padding-top: 100px;
         left: 0;
         top: 0;
         width: 100%; /* Full width */
         height: 100%; /* Full height */
         overflow: auto; /* Enable scroll if needed */
         background-color: rgb(0,0,0); /* Fallback color */
         background-color: #00000000; /* Black w/ opacity */
         text-align: center;
         z-index: 99999999;
       }
       
      #errorMsgModal .modal-content {
         background-color: #f443367a;
         padding: 30px;
         border: 1px solid #888;
         color: white;
         width: auto;
         font-size: 20px;
         font-weight: 600;
         height: auto;
         top: 10px;
         position: absolute;
         right: 10px;
       }
       #successrMsgModal .modal-content {
         background-color: #aab555d4;
         padding: 30px;
         border: 1px solid #888;
         color: white;
         width: auto;
         font-size: 20px;
         font-weight: 600;
         height: auto;
         top: 10px;
         position: absolute;
         right: 10px;
      }


       /* The Close Button */
       .close {
         color: #aaaaaa;
         float: right;
         font-size: 28px;
         font-weight: bold;
       }

       .close:hover,
       .close:focus {
         color: #000;
         text-decoration: none;
         cursor: pointer;
       }
      /* MODAL STYLING */

   </style>
   <script type="text/javascript">
      function promptMsg(type = 0, msg=""){
            console.log('here');
            if(type == 1)
            {
               $("#successrMsgModal").show();
               $("#successrMsgModal").find('span').html(msg);
            }
            else if(type == 0)
            {
               $("#errorMsgModal").show();
               $("#errorMsgModal").find('span').html(msg);
            }
         setTimeout(function() { 
               $("#errorMsgModal").hide();
               $("#successrMsgModal").hide();
         }, 1500);

      }
   </script>
</head>

<body>
    <!-- ERROR MSG MODAL -->
      <div id="errorMsgModal">
          <div class="modal-content">
              <span></span>
          </div>
      </div>
      <!-- SUCCESS MSG MODAL -->
      <div id="successrMsgModal">
          <div class="modal-content">
              <span></span>
          </div>
      </div>
    <!--== MAIN CONTRAINER ==-->
    <div class="container-fluid sb1">
        <div class="row">
            <!--== LOGO ==-->
            <div class="col-md-2 col-sm-3 col-xs-6 sb1-1">
                <a href="#" class="btn-close-menu"><i class="fa fa-times" aria-hidden="true"></i></a>
                <a href="#" class="atab-menu"><i class="fa fa-bars tab-menu" aria-hidden="true" style=""></i></a>
                <a href="dashboard.php" class=""><img src="<?=$imgLink?>" alt="" height='100' style="padding:8px;" />
                </a>
            </div>
            <!--== SEARCH ==-->
            <div class="col-md-6 col-sm-6 mob-hide">
                <!--<form class="app-search">-->
                <!--    <input type="text" placeholder="Search..." class="form-control">-->
                <!--    <a href=""><i class="fa fa-search"></i></a>-->
                <!--</form>-->
            </div>
            <!--== MY ACCCOUNT ==-->
            <div class="col-md-2 col-sm-3 col-xs-6">
                <!-- Dropdown Trigger -->
                <a class='waves-effect dropdown-button top-user-pro' href='#' data-activates='top-menu'>My Account <i class="fa fa-angle-down" aria-hidden="true"></i>
                </a>

                <!-- Dropdown Structure -->
                <ul id='top-menu' class='dropdown-content top-menu-sty'>
                    <!--<li><span><?= $userDetail['name']; ?></span></li>-->
                    <li><span><?= $_SESSION['loggedin_name'];?></span></li>
                    <li><span><?= $_SESSION['loggedin_email'];?></span></li>
                    <li class="divider"></li>
                    <li><a onclick="return confirm('Are You Sure ?')" href="logout.php" class="ho-dr-con-last waves-effect"><i class="fa fa-sign-in" aria-hidden="true"></i> Logout</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>