@extends("layouts.members")
@section('page_title')
    All Categories
@endsection
@section('page_category')
    Content
@endsection
<!-- HEADER -->
@section('page_action')
    <!-- Button -->
    <a href="{{ route('binshopsblog.admin.categories.create_category') }}" class="btn btn-primary lift">
        New Category
    </a>
@endsection
@section("content")
    <div class="container-fluid">
        <div class="row">

            @forelse ($categories as $category)

                <div class="card m-6" style="margin:1rem!important">
                    <div class="card-body">
                        <h5 class='card-title'><a class="a-link-cart-color"
                                                  href='{{$category->url(app('request')->get('locale'))}}'>{{$category->category_name}}</a>
                        </h5>


                        <a href="{{$category->url(app('request')->get('locale'))}}"
                           class="card-link btn btn-outline-secondary">View Posts in this category</a>
                        <a href="{{$category->edit_url()}}" class="card-link btn btn-primary btn-sm">Edit Category</a>
                        <form

                                onsubmit="return confirm('Are you sure you want to delete this blog post category?\n You cannot undo this action!');"

                                method='post'
                                action='{{route("binshopsblog.admin.categories.destroy_category", $category->category_id)}}'
                                class='float-right'>
                            @csrf
                            @method("DELETE")
                            <input type='submit' class='btn btn-danger btn-sm' value='Delete'/>
                        </form>
                    </div>
                </div>


            @empty
                <div class='alert alert-danger'>None found, why don't you add one?</div>
            @endforelse


            <div class='text-center'>
                {{$categories->appends( [] )->links()}}
            </div>
        </div>
    </div>


@endsection
