<?php include 'includes/header.php';?>
<title><?=$seo['waiter_title'];?></title>
<meta name="description" content="<?=$seo['waiter_description'];?>">
<meta name="keywords" content="<?=$seo['waiter_keywords'];?>">
<meta name="author" content="ParsTech">
<script type="text/javascript" src="js/sweetalert2.all.min.js"></script>
<?php
if ($_POST) {  
  $masa = $_SESSION["masa_no"];
  $isim_soyisim = strip_tags($_POST['adisoyadi']);
  $not = strip_tags($_POST['note']);



  $insert =   $dbh->prepare("INSERT INTO waiter SET  masa=?, uye=?, name=?, note=?");
  $insert-> execute(array($masa,$uye->id,$isim_soyisim,$not));


  if ($insert) {
    $sonId = $dbh->lastInsertId();
    $durum=' <script>Swal.fire("' . $dil['149'] . '", "' . $dil['150'] . '", "success"); </script> ';
  }

}




?>

<body class="mobile_panel black_theme">
  <!-- Sepet_Urunler_Wrapper -->
  <div class="cart_product_wrapper">
    <div class="container">
      <form action="" method="post">
        
        <div class="cart_product_list flex justify-start items-start text-center flex-col pt-8">
          
          <div class="product_detail_title "><?php echo $dil['022'];?></div>
          <h4 class="product_detail_title"><?= $durum; ?></h4>    
          


          <div class="flex flex-row justify-between items-center w-full mb-0">

            <label class="standart_label text-left mb-1 font-semibold" for="adisoyadi"><?php echo $dil['023'];?>: <span id="table_no"> <? if(!isset($_SESSION["masa_no"])){ ?>
              <label class="text-danger text-left mb-1 font-semibold -mt-2 mb-4" for="qrkod"><?php echo $dil['024'];?></label>
            <?php }else{

             $masa  = $dbh->prepare("SELECT * FROM masa_no where id=? ");
             $masa-> execute(array( $_SESSION["masa_no"]));
             $masa  = $masa->fetch(PDO::FETCH_ASSOC);
             echo $masa['masa_adi'];

           } ?>
         </span></label>
         <? if(!isset($_SESSION["masa_no"])){ ?>
          <a href="qrsayfa.php" class="qrcode_button btn btn-secondary">
            <img class="" src="images/icons/black/qr-code.svg">
            <span><h6><?php echo $dil['025'];?></h6></span>
          </a>
        <?php } ?>
      </div>

      <div class="form-group flex flex-col justify-start w-full mb-4">
        <label class="text-left mb-1 font-semibold standart_label" for="adisoyadi"><?php echo $dil['026'];?>*</label>
        <input type="text" name="adisoyadi" placeholder="<?php echo $dil['026'];?>" id="adisoyadi" value="" class="form_input required w-full text-sm py-2  pl-2 rounded-lg" required="">
      </div>
      <div class="form-group flex flex-col justify-start w-full mb-4">
        <label class="text-left mb-1 font-semibold standart_label" for="adisoyadi"><?php echo $dil['027'];?>*</label>
        <input type="text" name="note" placeholder="<?php echo $dil['027'];?>" id="adisoyadi" value="" class="form_input required w-full text-sm py-2  pl-2 rounded-lg" >
      </div>
      <? if(isset($_SESSION["masa_no"])){ ?>
        <button name="form1" type="submit" class=" btn btn-lg btn-default default-shadow btn-block"><?php echo $dil['028'];?> <span class="ml-2 icon arrow_right"></span></button>
      <?php } ?>
      <br>
      <div class="alert alert-warning mb-12" role="alert">
        <?php echo $dil['029'];?>  
      </div> 

    </div>
  </form>


</div>
</div>
<?php include 'includes/modal.php';?>
<?php include 'includes/footer.php';?>