<?php include 'inc/header.php';?>
<?php include 'inc/sidebar.php';?>
<?php include 'inc/navbar.php';?>
<?php
if ($_POST) {  
	$portion = $_POST['portion']; 

	if ($portion <> "" ) {

		$satir = [
			'portion' => $portion, 
		];

		$sql = "INSERT INTO product_portion SET portion=:portion;";
		$durum = $dbh->prepare($sql)->execute($satir);
		if ($durum) {
			$sonId = $dbh->lastInsertId();
       foreach ($_POST["en"] as $key => $value) {
           dilguncelle("en","product_portion",$sonId,$key,$value);
         } 
			echo "<script>
         const Toast = Swal.mixin({
          toast: true,
          position: 'top-end',
          showConfirmButton: false,
          timer: 6000,
          timerProgressBar: true,
          didOpen: (toast) => {
            toast.addEventListener('mouseenter', Swal.stopTimer)
            toast.addEventListener('mouseleave', Swal.resumeTimer)
          }
          })

          Toast.fire({
            icon: 'success',
            title: 'Başarı ile kayıt edildi.'
            })
            </script>";
		}
	}else{
		echo "Tüm alanları doldurunuz";

	}
}
?>
    <!-- Page Content-->
    <div class="page-content">
      <div class="container-fluid">
        <!-- Page-Title -->

        <form method="post" action="" enctype="multipart/form-data">

          <div class="row">
            <div class="col-sm-12">
              <div class="page-title-box">
                <div class="row">
                  <div class="col">
                    <h4 class="page-title">Porsiyon Ekle</h4>
                    <ol class="breadcrumb">
                      <li class="breadcrumb-item"><a href="index.php">Anasayfa</a></li>
                      <li class="breadcrumb-item"><a href="porsiyon-liste.php">Porsiyon Listesi</a></li>
                      <li class="breadcrumb-item active">Porsiyon Ekle</li>
                    </ol>
                  </div><!--end col-->
                  <div class="col-auto align-self-center">
                    <button class="btn btn-success" type="submit">
                      <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
                      KAYDET
                    </button> 
                  </div><!--end col-->  
                </div><!--end row-->                                                              
              </div><!--end page-title-box-->
            </div><!--end col-->
          </div><!--end row-->
          <!-- end page title end breadcrumb -->


          <div class="row">
            <div class="col-lg-12">
              <div class="card">
                <div class="card-header">
                  <h4 class="card-title"> Porsiyon Ekle</h4>
                  <p class="text-muted mb-0">Değerli kullanıcı, bu alan sayesinde yeni bir porsiyon oluşturabilirsiniz. Porsiyon fiyatını ise eklemek istediğiniz ürün alanından fiyatını belirleyebilirsiniz.</p> 
                </div><!--end card-header-->
                <div class="card-body">

                   <div class="row">

                    <div class="col-xl-12"> 
                  <div class="form-group">
                    <label for="exampleInputEmail1">Porsiyon Adı * </label>
                    <input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Lütfen bir porsiyon adı giriniz" name="portion" required=""> 
                  </div>
                </div>
 
              </div>


 
                  <!-- dil başlangıçı -->

                   <div class="row"> 
                    <div class="col-lg-12 col-xl-12">  
                      <div class="accordion" id="accordionExample">
                         
                  <div class="card mb-1 border shadow-none">
                    <div class="card-header  rounded-0" id="headingTwo">
                      <a href="" class="collapsed text-dark" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
                        <i data-feather="sliders"></i> İngilizce Dil Ayarları
                      </a>
                    </div>
                    <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample">
                      <div class="card-body">

                        <div class="form-group">
                          <label for="exampleInputEmail1">Porsiyon Adı * </label>
                        <input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Lütfen bir porsiyon adı giriniz" name="en[portion]">
                        </div>
 

                        
                      </div>
                    </div>
                  </div> 
                </div>      
              </div><!--end col-->
            </div><!--end row-->
               

            <!-- dil bitişi --> 

            <br>    
            <button class="btn btn-success btn-block" type="submit">
              <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
              KAYDET
            </button>
          </form>                                           
        </div><!--end card-body-->
      </div><!--end card-->
    </div><!--end col-->


  </div><!--end row-->



</div><!-- container -->

<?php include 'inc/footer.php';?>

