<?php require admin_view('include/header'); ?>
<!-- summernote -->
<link rel="stylesheet" href="<?= admin_public_url(); ?>plugins/summernote/summernote-bs4.css">
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
  <!-- Content Header (Page header) -->
  <section class="content-header">
    <div class="container-fluid">
      <div class="row mb-2">
        <div class="col-sm-6">
          <h1>Haber Düzenle</h1>
        </div>
        <div class="col-sm-6">
          <ol class="breadcrumb float-sm-right">
            <li class="breadcrumb-item"><a href="index">Görsel Panel</a></li>
            <li class="breadcrumb-item"><a href="haber-listele">Haberler</a></li>
            <li class="breadcrumb-item active">Haber Düzenle</li>
          </ol>
        </div>
      </div>
    </div><!-- /.container-fluid -->
  </section> 
  <!-- Main content -->
  <section class="content"> 
    <!-- Default box -->
    <div class="card card-info">
      <div class="card-header">
        <h3 class="card-title">Haber Düzenle</h3>
      </div>
      <!-- /.card-header -->
      <!-- form start -->
      <form action="" method="POST" enctype="multipart/form-data">
        <div class="card-body">  
          <div class="form-group row">
            <label for="inputEmail3" class="col-sm-2 col-form-label">Başlık</label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="haber" value="<?= $row['haber'] ?>" placeholder="Haber Başlık" required="">
            </div>
          </div>  
          <div class="form-group row">
            <label for="inputEmail3" class="col-sm-2 col-form-label">Açıklama</label>
            <div class="col-sm-8"> 
             <textarea class="textarea" name="aciklama" required=""><?= $row['aciklama'] ?></textarea>
           </div>
         </div>   
          <div class="form-group row">
            <label for="inputEmail3" class="col-sm-2 col-form-label">Seo Başlık</label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="seo_title" value="<?= $row['seo_title'] ?>" placeholder="seo Başlık">
            </div>
          </div> 
          <div class="form-group row">
            <label for="inputEmail3" class="col-sm-2 col-form-label">Seo keywords</label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="seo_keywords" value="<?= $row['seo_keywords'] ?>" placeholder="seo keywords">
            </div>
          </div> 
          <div class="form-group row">
            <label for="inputEmail3" class="col-sm-2 col-form-label">Seo Description</label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="seo_description" value="<?= $row['seo_description'] ?>" placeholder="seo description">
            </div>
          </div>   
          <div class="form-group row">
            <label for="inputEmail3" class="col-sm-2 col-form-label">Durumu</label>
            <div class="col-sm-2">
              <select name="durum" class="form-control" required="">
               <option <?php if ($row['durum']=="yes") {echo 'selected=""';} ?> value="yes">Durum Aktif</option>
               <option <?php if ($row['durum']=="no") {echo 'selected=""';} ?> value="no">Durum Pasif</option>
             </select>
           </div>
         </div>
         <div class="form-group row">
          <label for="image" class="col-sm-2 col-form-label">Resim</label>
          <div class="col-sm-8"> 
            <input type="file" class="form-control" name="image">  
            <p style="margin-left:10px;font-size:13px;margin-top:5px;">Tavsiye edilen görselin boyutları 400x400 px olmalıdır.</p>
          </div> 
        </div> 
      </div>
      <!-- /.card-body --> 
      <div class="card-footer">
       <?php if ($row['edit_date']>"0000-00-00 00:00:00") { ?>
        <div class="col-lg-6">
          <p>Haber Güncelleme Tarihi: <?= tarih('j F Y - H:i:s',$row['edit_date']); ?></p>
        </div>
        <div class="col-lg-6">
        <?php } else { ?>
          <div class="col-lg-12">
          <?php } ?>

          <button type="submit" name="haberedit" class="btn btn-info"><i class="fas fa-save"></i> Güncelle</button> 
        </div>
        <!-- /.card-footer -->
      </form>
    </div>
    <!-- /.card -->

  </section>
  <!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php require admin_view('include/footer'); ?>
<!-- Summernote -->
<script src="<?= admin_public_url(); ?>plugins/summernote/summernote-bs4.min.js"></script>
<script>
  $(function () {
    // Summernote
    $('.textarea').summernote()
  })
</script>