²é¿´/±à¼ ´úÂë
ÄÚÈÝ
<?php $__env->startSection('title', 'Blog'); ?> <?php $__env->startSection('content'); ?> <div class="content-wrapper"> <div class="content-header"> <div class="container-fluid"> <div class="mb-2 row"> <div class="col-sm-12"> <h1 class="m-0 text-dark">Blog</h1> </div> <div class="col-sm-12"> <ol class="breadcrumb"> <li class="breadcrumb-item text-warning"> <a href="<?php echo e(url('/home')); ?>">Dashboard</a> </li> <li class="breadcrumb-item active">Blog</li> </ol> </div> </div> </div> </div> <section class="content"> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-body"> <?php if(count($errors) > 0): ?> <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <div class="alert alert-danger alert-dismissible fade show" role="alert"> <strong><?php echo e($error); ?>!</strong> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endif; ?> <div class="mb-2"> <a href="<?php echo e(url('/posts/create')); ?>" class="btn btn-primary btn-sm"> Add Post </a> </div> <table class="table table-bordered" id="example1"> <thead> <th></th> <th>Featured Image</th> <th>Title</th> <th>Category</th> <th>Status</th> <th>Action</th> </thead> <tbody> <?php $__currentLoopData = $posts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $post): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <tr class="item" data-id="<?php echo e($post->id); ?>" id="row-<?php echo e($post->id); ?>"> <td></td> <td> <img style="max-height: 55px" src="assets/images/thumbs/<?php echo e($post->featured_img); ?>" alt="<?php echo e($post->title); ?>" srcset=""> </td> <td> <a class="text-muted" href=""> <?php echo e($post->title); ?> </a> </td> <td><?php echo e($post->category->name); ?></td> <td> <span class="badge badge-info"><?php echo e($post->status); ?></span> </td> <td> <div class="btn-group"> <button type="button" class="btn btn-outline-success">Action</button> <button type="button" class="btn btn-outline-success dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> <span class="sr-only">Toggle Dropdown</span> </button> <div class="dropdown-menu" role="menu" style=""> <a class="dropdown-item" href="/post/<?php echo e($post->slug); ?>/edit">Edit</a> <a data-id="<?php echo e($post->id); ?>" class="dropdown-item delete-item" href="#">Move to trash</a> </div> </div> </td> </tr> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </tbody> </table> </div> </div> </div> </div> </div> </section> </div> <?php $__env->stopSection(); ?> <?php $__env->startSection('js'); ?> <script> $('.delete-item').on('click', function() { let $id = $(this).data('id') Swal.fire({ title: 'Are you sure you want to delete post ?', icon: 'warning', showCloseButton: true, showCancelButton: true, focusConfirm: false, confirmButtonText: 'Delete', confirmButtonAriaLabel: 'Thumbs up, great!', cancelButtonText: 'Cancel', cancelButtonAriaLabel: 'Thumbs down' }).then((result) => { /* Read more about isConfirmed, isDenied below */ if (result.isConfirmed) { $(`#row-${$id}`).fadeOut(); $.ajax({ method: 'GET', url: `/post/delete/${$id}`, success: function() {}, error: function(err) { Swal.fire('Changes are not saved', '', 'info') }, }) } }) }) </script> <?php $__env->stopSection(); ?> <?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/dustyhe2/public_html/resources/views/blog/posts/index.blade.php ENDPATH**/ ?>