aboutsummaryrefslogtreecommitdiffstats
path: root/resources/views/teachers/index.blade.php
blob: 83c4bb8a3f13ec981e1f92ff6d572d937c880e3f (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
@extends('layouts.app')

@section('title', 'Teachers - Teacher Journal')

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

@section('content')
<h1>Teachers</h1>
<a href="{{ route('teachers.create') }}">Add Teacher</a>

@if($teachers->isEmpty())
    <p>No teachers found.</p>
    <a href="{{ route('teachers.create') }}">Add your first teacher</a>
@else
    <table>
        <thead>
            <tr>
                <th>Name</th>
                <th>Email</th>
                <th>Groups</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            @foreach($teachers as $teacher)
                <tr>
                    <td><strong>{{ $teacher->name }} {{ $teacher->last_name }}</strong></td>
                    <td>{{ $teacher->email }}</td>
                    <td>{{ $teacher->groups->count() }}</td>
                    <td>
                        <a href="{{ route('teachers.show', $teacher) }}">View</a>
                        <a href="{{ route('teachers.edit', $teacher) }}">Edit</a>
                        <form action="{{ route('teachers.destroy', $teacher) }}" 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