@php /** @var LaraBB\Group\Models\Group $group */ @endphp
@extends('admin::Layouts.master')
@section('content')
<div class="container-fluid pt-4">
    @include('partials.messages')
    @include('partials.button', ['context' => 'primary', 'href' => 'admin.groups.create', 'parameters' => [], 'icon' => 'plus', 'label' => 'Neue Gruppe erstellen'])
    <div class="d-none d-lg-flex mt-4 py-2">
        <div class="col-12 col-lg-9 font-weight-bolder">Gruppe</div>
        <div class="col-12 col-lg-1 font-weight-bolder text-center">Farbe</div>
        <div class="col-12 col-lg-1 font-weight-bolder text-center">Priorität</div>
    </div>

    @forelse($groups as $group)
    <div class="d-flex hover align-items-center{{ $loop->last ? ' mb-3' : '' }}">
        <div class="col-12 col-lg-9">
            <a href="{{ route('admin.groups.edit', [$group->uuid]) }}" class="d-block">
                {{ $group->group }}
            </a>
        </div>
        <div class="col-12 col-lg-1 text-lg-center">
            <div class="small">
                <div class="badge badge-pill" style="background:{{ $group->color }}">&nbsp;</div>
            </div>
        </div>
        <div class="col-12 col-lg-1 text-lg-center">{{ $group->priority }}</div>
        <div class="col-12 col-lg-1 text-lg-end">
            <form action="{{ route('admin.groups.destroy') }}" enctype="multipart/form-data" method="post" class="delete" data-message="Wollen Sie diese Gruppe wirklich löschen?">
                @csrf
                <input type="hidden" name="uuid" value="{{ $group->uuid }}">
                <button class="btn">
                    <span class="far fa-trash-alt"></span>
                </button>
            </form>
        </div>
    </div>
    @if(!$loop->last) <hr class="my-0"> @endif
    @empty
    <div class="row mb-3">
        <div class="col-12 text-center">
            Es sind kein Gruppen in der Datenbank vorhanden.
        </div>
    </div>
    @endforelse
    @include('partials.button', ['context' => 'primary', 'href' => 'admin.groups.create', 'parameters' => [], 'icon' => 'plus', 'label' => 'Neue Gruppe erstellen'])
</div>
@stop
