<?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.create')): ?> <?php echo Button::success(trans('admin.buttons.add-book'))->prependIcon(Icon::plus_sign())->asLinkTo(route('admin.book.create'))->withAttributes(['class' => 'pull-right']); ?> <?php endif; ?> </div> </div> <div class="row"> <div class="col-xs-12"> <div class="well"> <?php echo Form::open(['id' => 'search', 'route' => ['admin.book.index'], 'method' => 'GET', 'secure' => true]); ?> <div class="row"> <div class="col-xs-12"> <?php echo ControlGroup::generate( Form::label('query', trans('admin.fields.search').":"), Form::text('query', isset($query) ? e($query) : null) ); ?> </div> </div> <div class="row"> <div class="col-xs-12"> <div class="form-group"> <div class="row"> <div class="col-xs-2"> <?php echo Form::checkbox('stock[]', 'in', in_array('in', $stock), ['class' => 'inline']); ?> <?php echo trans('admin.labels.book-stock-in'); ?> </div> <div class="col-xs-4"> <?php echo Form::checkbox('stock[]', 'min', in_array('min', $stock), ['class' => 'inline']); ?> <?php echo trans('admin.labels.book-stock-min'); ?> </div> <div class="col-xs-6"> <?php echo Form::checkbox('stock[]', 'out', in_array('out', $stock), ['class' => 'inline']); ?> <?php echo trans('admin.labels.book-stock-out'); ?> </div> </div> </div> </div> </div> <div class="row"> <div class="col-xs-12"> <?php echo Button::dark(trans('admin.buttons.search'))->prependIcon(Icon::search())->submit(); ?> <?php echo Button::danger(trans('admin.buttons.reset-filter'))->prependIcon(Icon::remove())->reset(); ?> </div> </div> <?php echo Form::close(); ?> </div> </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 books"> <thead> <tr> <th class="col-xs-1"><?php echo trans('admin.labels.image'); ?></th> <th class="col-xs-9"><?php echo trans('admin.labels.description'); ?></th> <?php if(Sentry::getUser()->hasAccess('admin.book.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.destroy')): ?> <th class="col-xs-1"><?php echo trans('admin.labels.delete'); ?></th> <?php endif; ?> </tr> </thead> <tbody> <?php $__empty_1 = true; foreach($books as $book): $__empty_1 = false; ?> <tr class="<?php echo !$book->active ? 'disabled' : ''; ?> <?php echo $book->only_for_one_euro ? 'only-for-one-euro' : ($book->bookDiscounts->count() ? 'discount' : ''); ?>"> <td class="col-xs-1"> <?php echo HTML::image($book->image->url('small'), $book->title, ['class' => 'image']); ?> </td> <td class="col-xs-9"> <h3 class="book"><?php echo $book->title; ?></h3> <h4 class="author"><?php echo $book->author; ?></h4> <span class="stock"> <?php echo trans('admin.labels.accessibility'); ?>: <span class="<?php echo ($book->stock<=Config::get('website.eshop.stock')) ? 'out' : (($book->stock<=(Config::get('website.eshop.stock')+5)) ? 'min' : 'in'); ?>"> <?php echo ($book->stock<=Config::get('website.eshop.stock')) ? trans('admin.labels.out-of-stock') : trans('admin.labels.in-stock'); ?> <?php if($book->stock>Config::get('website.eshop.stock')): ?> <?php echo trans('admin.labels.stock-amount', ['stock' => $book->stock]); ?> <?php endif; ?> </span> </span><br> <span class="price"> <?php echo trans('admin.labels.price-with-vat'); ?>: <?php if($book->only_for_one_euro): ?> <strike><?php echo number_format($book->price, 2, ',', ' '); ?> &euro;</strike> <strong><?php echo number_format(1, 2, ',', ' '); ?> &euro;</strong> <?php elseif($book->bookDiscounts->count()): ?> <strike><?php echo number_format($book->price, 2, ',', ' '); ?> &euro;</strike> <strong><?php echo number_format($book->bookDiscounts->first()->discount, 2, ',', ' '); ?> &euro;</strong> <?php else: ?> <strong><?php echo number_format($book->price, 2, ',', ' '); ?> &euro;</strong> <?php endif; ?> </span> </td> <?php if(Sentry::getUser()->hasAccess('admin.book.edit')): ?> <td class="col-xs-1"> <?php echo Button::normal(trans('admin.buttons.edit'))->asLinkTo(route('admin.book.edit', [$book['id']]))->extraSmall()->prependIcon(Icon::pencil()); ?> </td> <?php else: ?> <td class="col-xs-2 text-center"> <?php echo Button::normal(trans('admin.buttons.details'))->asLinkTo(route('admin.book.show', [$book['id']]))->extraSmall()->prependIcon(Icon::search()); ?> </td> <?php endif; ?> <?php if(Sentry::getUser()->hasAccess('admin.book.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.destroy', [$book['id']]), 'data-item' => $book['title']]); ?> </td> <?php endif; ?> </tr> <?php endforeach; if ($__empty_1): ?> <tr> <td colspan="4" class="text-center"> <?php echo trans('admin.messages.empty-list-of-books'); ?> </td> </tr> <?php endif; ?> </tbody> </table> </div> <?php endforeach; ?> </div> <div class="row"> <div class="col-xs-12 text-center"> <?php echo $books->appends(isset($query) ? array('query' => e($query)) : null)->links(); ?> </div> </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-book', ['book' => '<span class="book"></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.book').text(item); }); $('form#search').on('reset', function (event) { $(this).find('input[name=query]').val(''); $(this).submit(); }); <?php $__env->stopSection(); ?>