

<?php $__env->startSection('title','Gallery'); ?>

<?php $__env->startSection('content'); ?>
<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading">Gallery</div>
            <div class="panel-body">
                <?php if(count($gallery)>0): ?>
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>Title</th>
                            <th>File</th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__currentLoopData = $gallery; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $galleryData): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td><?php echo e($galleryData->title); ?></td>
                            <td>
                                <?php if($galleryData->data_type=="image"): ?>
                                <img src="<?php echo e(asset('julian_gallery/images/'.$galleryData->filename)); ?>" class="img-thumbnail" height="320px" width="240px" alt="<?php echo e($galleryData->title); ?>">
                                <?php else: ?>
                                <iframe src="https://youtube.com/embed/<?php echo e($galleryData->filename); ?>" height="240" width="280"></iframe>
                                <?php endif; ?>
                            </td>
                            <td class="text-center"><p><a id="deleteFile" data-id="<?php echo e($galleryData->id); ?>" href="#" class="btn btn-danger" data-toggle="modal" data-target="#deleteModal">Delete</a> </p>
                            </td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>                                        
                </table>
                <?php echo e($gallery->links()); ?>

                <?php else: ?>
                Gallery is empty!
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>

<div id="deleteModal" class="modal fade" role="dialog">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Delete File</h4>
            </div>
            <div class="modal-body">
                <p>Are you sure you want to delete this file from gallery?</p>
                <form id="deleteFileForm" method="POST" action="<?php echo e(url('/admin/gallery')); ?>">
                    <?php echo e(csrf_field()); ?>

                    <input id="file_id" type="hidden" name="file_id" value="">
                    <input type="hidden" name="_method" value="DELETE">
                    <input type="submit" name="submit" value="Yes" class="btn btn-success">
                    <button type="button" class="btn btn-danger" data-dismiss="modal">No</button>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('footer'); ?>

<script type="text/javascript">
  $(document).on('click','#deleteFile',function(){
    var file = $(this).data('id');
    $("#deleteFileForm #file_id").val(file);
});
</script>

<?php $__env->stopSection(); ?>


<?php echo $__env->make('layouts.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>