<?php
error_reporting(E_ALL);
ini_set("display_errors", 0);
session_start();
include 'header.php';


     $urunsor=$db->prepare("SELECT * FROM urun where urun_id=:id");
     $urunsor->execute(array(
         'id' => $_GET['urun_id']
         ));
     $say=$urunsor->rowCount();
     $uruncek=$urunsor->fetch(PDO::FETCH_ASSOC);
?>
<script src="https://cdn.ckeditor.com/4.15.1/standard/ckeditor.js"></script>
	<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
		<div class="row">
			<ol class="breadcrumb">
				<li><a href="#">
					<em class="fa fa-home"></em>
				</a></li>
				<li class="active">Ürün Ayarlar</li>
			</ol>
		</div><!--/.row-->
		
		<div class="row">
			<div class="col-lg-12">
				<h1 class="page-header">Ürün Ayarlar</h1>
			</div>
		</div><!--/.row-->

		<div class="row">
			<div class="col-md-15">
				<div class="panel panel-default articles">

				<div class="panel panel-default">
					<div class="panel-heading">
						Ürün Ekle
						<?php
if (isset($_GET['durum'])) {
    $durum = $_GET['durum'];

    if ($durum == "ok") {
        echo '<b style="color:green;">İşlem Başarılı</b>';
    } elseif ($durum == "no") {
        echo '<b style="color:red;">İşlem Başarısız</b>';
    } else {
        echo '<b style="color:orange;">Geçersiz durum</b>';
    }
}  
?>
						
						</div>
						
						
					 <div class="panel-body">
						 <form action="../kariyersoft/control.php" method="POST" enctype="multipart/form-data"  data-parsley-validate class="form-horizontal form-label-left">
						     
						 <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">Kategori Seç<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-6">
                                    <?php
                                    $kategorisor = $db->prepare("SELECT * FROM kategori WHERE kategori_ust = :kategori_ust ORDER BY kategori_sira");
                                    $kategorisor->execute(array('kategori_ust' => 0));
                                    ?>
                                    <select class="select2_multiple form-control" required="" name="kategori_id">
                                        <?php
                                        while ($kategoricek = $kategorisor->fetch(PDO::FETCH_ASSOC)) {
                                            $kategori_id = $kategoricek['kategori_id'];
                                            $selected = ($kategori_id == $uruncek['kategori_id']) ? "selected" : "";
                                        ?>
                                            <option value="<?php echo $kategori_id; ?>" <?php echo $selected; ?>><?php echo $kategoricek['kategori_ad']; ?></option>
                                        <?php } ?>
                                    </select>
                                </div>
                            </div>
							<div class="form-group">
    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">Firma Seç<span class="required">*</span>
    </label>
    <div class="col-md-6 col-sm-6 col-xs-6">
        <?php
        $firmasor = $db->prepare("SELECT * FROM firma ORDER BY firma_ad");
        $firmasor->execute();
        ?>
        <select class="select2_multiple form-control" name="firma_id" required>
            <option value="0" <?php echo ($uruncek['firma_id'] == 0) ? 'selected' : ''; ?>>Firma Yok</option>
            <?php
            while ($firmacek = $firmasor->fetch(PDO::FETCH_ASSOC)) {
                $firma_id = $firmacek['firma_id'];
                $selected = ($firma_id == $uruncek['firma_id']) ? "selected" : "";
            ?>
                <option value="<?php echo $firma_id; ?>" <?php echo $selected; ?>><?php echo $firmacek['firma_ad']; ?></option>
            <?php } ?>
        </select>
    </div>
</div>

							<fieldset>
								<!-- Name input-->
								<div class="form-group">
									<label class="col-md-3 control-label" for="name">Ürün İsmi *</label>
									<div class="col-md-9">
										<input id="name" name="urun_ad" value="<?php echo $uruncek['urun_ad'] ?>" type="text" placeholder="Başlık" class="form-control">
									</div>
								</div>
								<!-- Email input-->
							<div class="form-group">
									<label class="col-md-3 control-label" for="message">Ürün Bilgisi *</label>
									<div class="col-md-9">
                                       <textarea  class="ckeditor" id="editor1" name="urun_detay"><?php echo $uruncek['urun_detay']; ?></textarea>
									</div>
								</div>
								 <script type="text/javascript">

               CKEDITOR.replace( 'editor1',

               {

                filebrowserBrowseUrl : 'ckfinder/ckfinder.html',

                filebrowserImageBrowseUrl : 'ckfinder/ckfinder.html?type=Images',

                filebrowserFlashBrowseUrl : 'ckfinder/ckfinder.html?type=Flash',

                filebrowserUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',

                filebrowserImageUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',

                filebrowserFlashUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash',

                forcePasteAsPlainText: true

              } 

              );

            </script>
							
							<div class="form-group">
									<label class="col-md-3 control-label" for="email">Ürün Seri No *</label>
									<div class="col-md-9">
										<input id="name" name="urun_serino" value="<?php echo $uruncek['urun_serino'] ?>" type="text" placeholder="Seri Numarası" class="form-control">
									</div>
								</div>	
								
								<div class="form-group">
									<label class="col-md-3 control-label" for="email">Ürün Stok *</label>
									<div class="col-md-9">
										<input id="name" name="urun_stok" value="<?php echo $uruncek['urun_stok'] ?>" type="text" placeholder="Sırası" class="form-control">
									</div>
								</div>
							
								
								                 
                      </select>
                  <!-- En Çok Satılan Bitiş -->
                  
              
								
				  <div class="form-group">
    <label class="col-md-3 control-label" for="email">Ürün Durum *</label>
    <div class="col-md-9">
        <select id="text" class="form-control" name="urun_durum" required>
            <option value="1" <?php echo $uruncek['urun_durum'] == '1' ? 'selected' : ''; ?>>Aktif</option>
            <option value="0" <?php echo $uruncek['urun_durum'] == '0' ? 'selected' : ''; ?>>Pasif</option>
        </select>
    </div>
</div>
<input type="hidden" name="urun_id" value="<?php echo $uruncek['urun_id'] ?>">
<!-- Form actions -->
<div class="form-group">
    <div class="col-md-12 widget-right">
        <button type="submit" name="urunduzenleme" class="btn btn-default btn-md pull-right">Güncelle</button>
    </div>
</div>
							</fieldset>
						</form>
					</div>
				</div>
			</div><!--/.col-->
			
		</div><!--/.row-->
	</div>	<!--/.main-->
	 <?php include 'footer.php'; ?>
	
</body>
</html>
