<?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.book-category.create')): ?> <?php echo Button::success(trans('admin.buttons.add-category'))->prependIcon(Icon::plus_sign())->asLinkTo(route('admin.book-category.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']; ?>"> <table class="table table-striped"> <thead> <tr> <th class="col-xs-10"><?php echo trans('admin.labels.title'); ?></th> <?php if(Sentry::getUser()->hasAccess('admin.book-category.edit')): ?> <th class="col-xs-1"><?php echo trans('admin.labels.edit'); ?></th> <?php else: ?> <th class="col-xs-2 text-center"><?php echo trans('admin.labels.show'); ?></th> <?php endif; ?> <?php if(Sentry::getUser()->hasAccess('admin.book-category.destroy')): ?> <th class="col-xs-1"><?php echo trans('admin.labels.delete'); ?></th> <?php endif; ?> </tr> </thead> <tbody> <?php $__empty_1 = true; foreach($book_categories[$tab['route']] as $book_category): $__empty_1 = false; ?> <tr> <td class="col-xs-10"> <?php echo $book_category['title']; ?> </td> <?php if(Sentry::getUser()->hasAccess('admin.book-category.edit')): ?> <td class="col-xs-1"> <?php echo Button::normal(trans('admin.buttons.edit'))->asLinkTo(route('admin.book-category.edit', [$book_category['id']]))->extraSmall()->prependIcon(Icon::pencil())->withAttributes(['class' => 'edit']); ?> </td> <?php else: ?> <td class="col-xs-2 text-center"> <?php echo Button::normal(trans('admin.buttons.details'))->asLinkTo(route('admin.book-category.show', [$book_category['id']]))->extraSmall()->prependIcon(Icon::search()); ?> </td> <?php endif; ?> <?php if(Sentry::getUser()->hasAccess('admin.book-category.destroy')): ?> <td class="col-xs-1"> <?php echo Button::normal(trans('admin.buttons.delete'))->extraSmall()->prependIcon(Icon::trash())->withAttributes(['data-toggle' => 'modal', 'data-target' => '#confirmDelete', 'data-route' => route('admin.book-category.destroy', [$book_category['id']]), 'data-item' => $book_category['title']]); ?> </td> <?php endif; ?> </tr> <?php endforeach; if ($__empty_1): ?> <tr> <td colspan="3" class="text-center"> <?php echo trans('admin.messages.empty-list-of-categories'); ?> </td> </tr> <?php endif; ?> </tbody> </table> </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-category', ['category' => '<span class="category"></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.category').text(item); }); <?php if(Sentry::getUser()->hasAccess('admin.book-category.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'); ?>')); $('table thead').html($('table thead').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'); ?>')); $('table thead').html($('table thead').html().replace('<?php echo trans('admin.buttons.revisions'); ?>', '<?php echo trans('admin.buttons.edit'); ?>')); } }); } }); <?php endif; ?> <?php $__env->stopSection(); ?>