<?php $__env->startSection('content'); ?> <div class="row"> <div class="col-xs-8"> <?php echo Breadcrumb::withLinks($breadcrumbs); ?> </div> <div class="col-xs-4"> <?php if(Sentry::getUser()->hasAccess('admin.banner.create')): ?> <?php echo Button::success(trans('admin.buttons.add-banner'))->prependIcon(Icon::plus_sign())->asLinkTo(route('admin.banner.create'))->withAttributes(['class' => 'pull-right']); ?> <?php endif; ?> </div> </div> <div class="row"> <div class="col-xs-12"> <div role="tabpanel"> <?php echo Navigation::tabs($tabs)->withAttributes(['role' => 'tablist', 'class' => 'flags']); ?> <div class="tab-content"> <?php foreach($tabs as $tab): ?> <div role="tabpanel" class="tab-pane <?php echo $tab['active'] ? 'active' : ''; ?>" id="<?php echo $tab['route']; ?>"> <ul class="list-group sortable"> <?php $__empty_1 = true; foreach($banners as $banner): $__empty_1 = false; ?> <li class="list-group-item" data-banner-id="<?php echo $banner->id; ?>"> <div class="panel panel-default"> <div class="panel-heading"> <div class="row"> <div class="col-xs-6"> <?php echo Form::open(['route' => ['admin.banner.update', $banner->id], 'method' => 'PATCH', 'secure' => true]); ?> <i class="glyphicon glyphicon-resize-vertical"></i> <?php echo $banner->id; ?> <?php echo Form::hidden('order', $banner->order); ?> <?php echo Form::close(); ?> </div> <div class="col-xs-6 text-right"> <?php if(Sentry::getUser()->hasAccess('admin.banner.edit')): ?> <?php echo Button::normal(trans('admin.buttons.edit'))->asLinkTo(route('admin.banner.edit', [$banner->id]))->extraSmall()->prependIcon(Icon::pencil())->withAttributes(['class' => 'edit']); ?> <?php endif; ?> <?php if(Sentry::getUser()->hasAccess('admin.banner.destroy')): ?> <?php echo Button::normal(trans('admin.buttons.delete'))->extraSmall()->prependIcon(Icon::trash())->withAttributes(['data-toggle' => 'modal', 'data-target' => '#confirmDelete', 'data-route' => route('admin.banner.destroy', [$banner->id]), 'data-item' => $banner->id]); ?> <?php endif; ?> </div> </div> </div> <div class="panel-body no-padding"> <?php echo HTML::image($banner->banner_translations->keyBy('language_id')->get($tab['id'])->image->url('thumb')); ?> </div> </div> </li> <?php endforeach; if ($__empty_1): ?> <li class="list-group-item text-center"> <?php echo trans('admin.messages.empty-list-of-banners'); ?> </li> <?php endif; ?> </ul> </div> <?php endforeach; ?> </div> </div> </div> </div> <?php $__env->stopSection(); ?> <?php $__env->startSection('modals'); ?> <div id="confirmDelete" class="modal fade" role="dialog" aria-labelledby="" aria-hidden="true"> <div class="modal-dialog modal-md"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title"><?php echo trans('admin.labels.confirm-delete'); ?></h4> </div> <div class="modal-body"> <?php echo trans('admin.messages.realy-delete-banner', ['banner' => '<span class="banner"></span>']); ?> </div> <div class="modal-footer"> <?php echo Form::open(['method' => 'DELETE', 'secure' => true]); ?> <?php echo Button::danger(trans('admin.buttons.delete'))->prependIcon(Icon::trash())->submit(); ?> <?php echo Button::normal(trans('admin.buttons.close'))->withAttributes(['data-dismiss' => 'modal']); ?> <?php echo Form::close(); ?> </div> </div> </div> </div> <?php $__env->stopSection(); ?> <?php $__env->startSection('scripts'); ?> $('#confirmDelete').on('show.bs.modal', function (event) { var modal = $(this); var button = $(event.relatedTarget); var route = button.data('route'); var item = button.data('item'); modal.find('form').attr('action', route); modal.find('span.banner').text(item); }); <?php if(Sentry::getUser()->hasAccess('admin.banner.update')): ?> $('ul.sortable').sortable( { placeholder: "list-group-item placeholder", items: "> li[data-banner-id]", update: function(event, ui) { var $form = $(ui.item).find('form'); var url = $form.prop('action'); var type = $form.prop('method'); var order = $(ui.item).next().find('form input[name=order]').val(); $form.find('input[name=order]').val(order); $.ajax( { url: url, type: type, data: new FormData($form.get(0)), processData: false, contentType: false, success: function(response) { if (response.banners) { $('ul.sortable li[data-banner-id]').each(function() { var id = $(this).data('banner-id'); $(this).find('form input[name=order]').val(response.banners[id].order); }); } } }); } }); $('tbody.sortable').disableSelection(); <?php endif; ?> <?php if(Sentry::getUser()->hasAccess('admin.banner.revision')): ?> $(document).keyup(function (event) { var code = event.keyCode || event.which; if (code == 20) { $('a.edit').each(function() { var href = $(this).attr('href'); if (href.match(/edit$/)) { $(this).attr('href', href.replace(/(edit)$/, 'revision')); $(this).removeClass('btn-default').addClass('btn-dark'); $(this).html($(this).html().replace('pencil', 'hourglass')); $(this).html($(this).html().replace('<?php echo trans('admin.buttons.edit'); ?>', '<?php echo trans('admin.buttons.revisions'); ?>')); } else { $(this).attr('href', href.replace(/(revision)$/, 'edit')); $(this).removeClass('btn-dark').addClass('btn-default'); $(this).html($(this).html().replace('hourglass', 'pencil')); $(this).html($(this).html().replace('<?php echo trans('admin.buttons.revisions'); ?>', '<?php echo trans('admin.buttons.edit'); ?>')); } }); } }); <?php endif; ?> <?php $__env->stopSection(); ?>