@extends('base') @section('content')
@if(userCan('page-create', $chapter)) New Page @endif @if(userCan('chapter-update', $chapter)) Edit @endif @if(userCan('chapter-update', $chapter) || userCan('restrictions-manage', $chapter) || userCan('chapter-delete', $chapter)) @endif

{{ $chapter->name }}

{{ $chapter->description }}

@if(count($pages) > 0)

@foreach($pages as $page) @include('pages/list-item', ['page' => $page])
@endforeach
@else

No pages are currently in this chapter.

@if(userCan('page-create', $chapter)) Create a new page @endif @if(userCan('page-create', $chapter) && userCan('book-update', $book))   -or-    @endif @if(userCan('book-update', $book)) Sort the current book @endif


@endif

Created {{$chapter->created_at->diffForHumans()}} @if($chapter->createdBy) by {{ $chapter->createdBy->name}} @endif
Last Updated {{$chapter->updated_at->diffForHumans()}} @if($chapter->updatedBy) by {{ $chapter->updatedBy->name}} @endif

@if($book->restricted || $chapter->restricted)
@if($book->restricted) @if(userCan('restrictions-manage', $book)) Book Permissions Active @else Book Permissions Active @endif
@endif @if($chapter->restricted) @if(userCan('restrictions-manage', $chapter)) Chapter Permissions Active @else Chapter Permissions Active @endif @endif
@endif @include('pages/sidebar-tree-list', ['book' => $book, 'sidebarTree' => $sidebarTree])
@stop