@extends('layouts.adminpanel')

@section('title') Admin Panel - Classes @endsection

@section('admin_content')
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                @if ($classes->count() > 0)
                    <h5> All classes: ({{ $classes->count() }}) </h5>
                    <table>
                        <tr>
                            <th>ID</th>
                            <th> Subject id </th>
                            <th> Date </th>
                            <th> Creation date </th>
                        </tr>
                        @foreach ($classes as $classes_item)
                            <tr>
                                <td> {{ $classes_item->id }}</td>
                                <td> {{ $classes_item->subject_id }} </td>
                                <td> {{ $classes_item->created_at }} </td>
                                <td>
                                    <a href="{{ route('admin_delete_classes', ['classes_id' => $classes_item->id]) }}" name="delete-classes-btn"> Delete </a>
                                </td>
                            </tr>
                        @endforeach
                    </table>
                @else
                    <p> No classes yet. </p>
                @endif
            </div>
        </div>
    </div>
@endsection