<?php if(!defined("Hacking")){die("404 Not Found"); } ?>

<div id="tour-11" class="header-content">
  <h2><i class="fa fa-shopping-cart"></i>Ürün Listesi</h2>
</div>
<div class="body-content animated fadeIn">
  <div class="panel rounded shadow">
    <div class="panel-body">
      <table  class="table table-striped">
        <thead>
          <tr>
            <th data-class="expand" class="text-center">Ürün Resmi</th>
            <th data-hide="phone">Ürün Adı</th>
            <th data-hide="phone" class="text-center">Fiyatı</th>
            <th data-hide="phone,tablet" class="text-center">Görüntülenme</th>
            <th data-hide="phone,tablet">Son İşlem Tarihi</th>
            <th>Gizle/Göster</th>
           <th>Sıralama</th>
            <th data-hide="phone,tablet" style="min-width: 200px" class="text-center">İşlem</th>
          </tr>
        </thead>
        <tbody>
          <?php
          if(@$_GET["islev"] != ""){
              $db->query("UPDATE urunler SET sira='0' WHERE urun_id='".$_GET["id"]."'");
              if($_GET["islev"] == "asagi"){
               $yeni_sira = $_GET["sira"] + 1;
              }elseif($_GET["islev"] == "yukari"){
                $yeni_sira = $_GET["sira"] - 1;
              }
              $db->query("UPDATE urunler SET sira='".$_GET["sira"]."' WHERE sira='".$yeni_sira."'");
              $db->query("UPDATE urunler SET sira='".$yeni_sira."' WHERE sira='0'");
          }
                    //$urunler = $urun->urun_listele();
                    $urunler = $Modul->sayfalamastart($kayitsayisi,'urunler');
                    foreach ($urunler as $key => $value){
                ?>
          <tr>
            <td class="text-center" style="width: 1%"><img src="../upload/images/<?php echo $value['anasayfa_resim']; ?>"  width="160" class="mt-5 mb-5"/></td>
            <td><?php echo $value['urun_baslik']; ?></td>
            <td class="text-center"><?php echo $value['urun_fiyat']; ?> <i class="fa fa-try"></i></td>
            <td class="text-center"><span class="label label-info"><?php echo $value['urun_okunma']; ?></span></td>
            <td><?php echo $value['urun_tarih']; ?></td>
        <!--    <td class="text-center"><a href="index.php?do=urun&duzenle=<?php //echo $value['urun_id']; ?>" class="btn btn-sm btn-primary btn-s btn-push"><i class="fa fa-edit"></i> Ürünü Düzenle</a> <a href="index.php?do=urun&sil=<?php //echo $value['urun_id'].'&urun&katid='.$value['kategori_id']; ?>" class="btn btn-sm btn-danger btn-s btn-push"><i class="fa fa-trash"></i> Sil</a></td>
-->
        <td>
          <label class="switch">

            <input type="checkbox" id="toggle[<?=$value['urun_id']?>]" name="toggle" <?php if($value['aktifkontrol']=="aktif"){ print "checked"; } ?> onclick="aktifkontrol(<?=$value['urun_id']?>,'urunler');">
            <span class="slider round"></span>
          </label>
        </td>
        <td align="center">
          <?php if($value["sira"] != "1"){?><a href="index.php?do=urun&islev=yukari&id=<?=$value["urun_id"]?>&sira=<?=$value["sira"]?>"><i class="fa fa-arrow-up fa-2x" style="color:green;"></i></a> <?php } ?>
&nbsp;  &nbsp; <?php if($value["sira"] != Count($urunler)){?><a href="index.php?do=urun&islev=asagi&id=<?=$value["urun_id"]?>&sira=<?=$value["sira"]?>"><i class="fa fa-arrow-down fa-2x" style="color:red;"></i></a><?php } ?>
        </td>
<td class="text-center"><a href="index.php?do=urun&duzenle=<?php echo $value['urun_id']; ?>" class="btn btn-sm btn-primary btn-s btn-push"><i class="fa fa-edit"></i> Ürünü Düzenle</a>
                        <a href="#" onclick="itemsil(<?php echo $value['urun_id']?>,<?php echo $value['kategori_id']?>,'<?php echo $value['urun_baslik']?>','urun');" class="btn btn-sm btn-danger btn-s btn-push"><i class="fa fa-trash"></i> Sil</a></td>
          </tr>
        <?php } ?>
        </tbody>
        <br>
      </table>
    </div>
  </div>
  <?php
    $Modul->sayfalama("urun","urunler",$kayitsayisi);    //sayfa do , tablo adı , limit , sayfa_type (tablo sayfa değilse girme)
  ?>
</div>
