aboutsummaryrefslogtreecommitdiffstats
path: root/resources/views/sub-groups/index.blade.php
blob: 1a2767aa2209375f83a1200c585cb34d78052845 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@extends('layouts.app')

@section('title', 'Sub Groups - Teacher Journal')

@push('styles')
<link rel="stylesheet" href="{{ asset('css/sub-groups.css') }}">
@endpush

@section('content')
<h1>Sub Groups</h1>
<a href="{{ route('sub-groups.create') }}">Add Sub Group</a>

@if($subGroups->isEmpty())
    <p>No sub groups found.</p>
    <a href="{{ route('sub-groups.create') }}">Add your first sub group</a>
@else
    <table>
        <thead>
            <tr>
                <th>Name</th>
                <th>Parent Group</th>
                <th>Students</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            @foreach($subGroups as $subGroup)
                <tr>
                    <td><strong>{{ $subGroup->name }}</strong></td>
                    <td>
                        @if($subGroup->group)
                            <a href="{{ route('groups.show', $subGroup->group) }}">{{ $subGroup->group->name }}</a>
                        @else
                            -
                        @endif
                    </td>
                    <td>{{ $subGroup->students->count() }}</td>
                    <td>
                        <a href="{{ route('sub-groups.show', $subGroup) }}">View</a>
                        <a href="{{ route('sub-groups.edit', $subGroup) }}">Edit</a>
                        <form action="{{ route('sub-groups.destroy', $subGroup) }}" method="POST" style="display:inline;">
                            @csrf
                            @method('DELETE')
                            <button type="submit" onclick="return confirm('Are you sure?')">Delete</button>
                        </form>
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
@endif
@endsection