<?php $__env->startSection('subtitle'); ?>
    Kelola Berita
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <h4> Tambah Berita </h4>
    
    <div class="form-tambah">
        <form method="POST" action="<?php echo e(url('kelola/berita/tambah')); ?>" enctype="multipart/form-data">
            <?php echo e(csrf_field()); ?>

            <div class="input-group">
                <input type="text" name="judul" placeholder="Judul Berita"></input>
            </div>
            
            <div class="input-group">
                <textarea name="isi" style="min-width: 100px; min-height: 100px" placeholder="Tulis Artikel..."></textarea>                
            </div>
            
            <div class="input-group">
                <label for="cover" id="cover-label">
                    <span>
                        <img src="<?php echo e(asset('img/upload.png')); ?>" alt="">
                    </span>
                    <p id="label-text">Pilih Cover Berita</p>
                </label>
                <input hidden name="cover" type="file" id="cover">
            </div>
            
            <div class="input-group">
                <input type="text" name="penulis" placeholder="Penulis Berita"></input>
            </div>
            
            <div class="input-group">
                <input type="submit" value="Tambah">
            </div>
        </form>    
    </div>
    
    <hr>
    
    <h4> Daftar Berita </h4>
    <table class="table">
      <thead class="thead-dark">
        <tr>
            <th scope="col">Judul</th>
            <th scope="col">Isi</th>
            <th scope="col">Cover Image</th>
            <th scope="col">Action</th>
        </tr>
      </thead>
      <tbody>
        <?php $__currentLoopData = $beritas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $berita): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr>
                <td><?php echo e($berita->judul); ?></td>
                <td><?php echo e(str_limit($berita->isi,30)); ?></td>
                <td><img src="<?php echo e(asset($berita->image)); ?>" style="width: 100px"></td>
                <td>
                    <a href="<?php echo e(url('kelola/berita/'.$berita->id.'/edit')); ?>" class="btn button btn-warning">Edit</a>
                    <a href="<?php echo e(url('kelola/berita/'.$berita->id.'/delete')); ?>" class="btn button btn-danger">Delete</a>
                </td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
      </tbody>
    </table>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('index', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>