@section('content')
{{Breadcrumb::withLinks($breadcrumbs)}}
@if (Sentry::getUser()->hasAccess('admin.discount.create')) {{Button::success(trans('admin.buttons.add-discount'))->prependIcon(Icon::plus_sign())->asLinkTo(route('admin.discount.create'))->withAttributes(['class' => 'pull-right'])}} @endif
{{Navigation::tabs($tabs)->withAttributes(['role' => 'tablist', 'class' => 'flags'])}}
@foreach($tabs as $tab)
@if (Sentry::getUser()->hasAccess('admin.discount.edit')) @else @endif @if (Sentry::getUser()->hasAccess('admin.discount.destroy')) @endif @forelse($discounts[$tab['route']] as $discount) @if (Sentry::getUser()->hasAccess('admin.discount.edit')) @else @endif @if (Sentry::getUser()->hasAccess('admin.discount.destroy')) @endif @empty @endforelse
{{trans('admin.labels.title')}} {{trans('admin.labels.discount')}}{{trans('admin.labels.edit')}}{{trans('admin.labels.show')}}{{trans('admin.labels.delete')}}
{{$discount['title']}} {{$discount['discount']}} % {{Button::normal(trans('admin.buttons.edit'))->asLinkTo(route('admin.discount.edit', [$discount['id']]))->extraSmall()->prependIcon(Icon::pencil())->withAttributes(['class' => 'edit'])}} {{Button::normal(trans('admin.buttons.details'))->asLinkTo(route('admin.discount.show', [$discount['id']]))->extraSmall()->prependIcon(Icon::search())}} {{Button::normal(trans('admin.buttons.delete'))->extraSmall()->prependIcon(Icon::trash())->withAttributes(['data-toggle' => 'modal', 'data-target' => '#confirmDelete', 'data-route' => route('admin.discount.destroy', [$discount['id']]), 'data-item' => $discount['title']])}}
{{trans('admin.messages.empty-list-of-discounts')}}
@endforeach
@stop @section('modals') @stop @section('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.discount').text(item); }); @if (Sentry::getUser()->hasAccess('admin.discount.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('{{trans('admin.buttons.edit')}}', '{{trans('admin.buttons.revisions')}}')); $('table thead').html($('table thead').html().replace('{{trans('admin.buttons.edit')}}', '{{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('{{trans('admin.buttons.revisions')}}', '{{trans('admin.buttons.edit')}}')); $('table thead').html($('table thead').html().replace('{{trans('admin.buttons.revisions')}}', '{{trans('admin.buttons.edit')}}')); } }); } }); @endif @stop