@php
    use LaraBB\Category\Models\Category;
    use LaraBB\Forum\Models\Forum;
    use LaraBB\Thread\Models\Thread;

    /** @var Category $category */
    /** @var Forum $forum */
    /** @var Thread $thread */
@endphp
@extends('layouts.master')
@section('content')
    @include('partials.messages')
    <div class="d-flex justify-content-between align-items-center mb-3">
        <nav>

        </nav>
        {!! button('Create Thread')->permission($currentUser->forumPermissions[$forum->uuid]->getAttribute('create_threads'))
                                   ->type('link')
                                   ->href(route('thread-create', [$forum->slug]))
                                   ->class('btn btn-purple text-uppercase')
                                   ->icon('fas fa-fw fa-plus')
                                   ->render() !!}
    </div>
    <x-atomic.card>
        <x-molecule.breadcrumb :items="[
            ['href' => 'index', 'parameters' => null, 'label' => null, 'icon' => 'home'],
            ['href' => 'category', 'parameters' => [$forum->category->slug], 'label' => $forum->category->title, 'mobile' => true],
            ['label' => $forum->title, 'mobile' => true],
    ]"/>
        <div class="card-body p-0">
            @forelse($forum->threads as $thread)
                <x-molecule.thread-or-forum :thread="$thread" :loop="$loop"/>
            @empty
                <div class="row hover align-items-center p-4 m-0">
                    <div class="col text-center">
                        @lang('There are no threads in this forum.')
                    </div>
                </div>
            @endforelse
        </div>
    </x-atomic.card>
    <div class="d-flex justify-content-between align-items-center mt-3">
        <nav>

        </nav>
        {!! button('Create Thread')->permission($currentUser->forumPermissions[$forum->uuid]->getAttribute('create_threads'))
                                   ->type('link')
                                   ->href(route('thread-create', [$forum->slug]))
                                   ->class('btn btn-purple text-uppercase')
                                   ->icon('fas fa-fw fa-plus')
                                   ->render() !!}
    </div>
@stop
