@extends('layouts.app') @section('title', $course->title, 'Curso') @section('content') <div class="mdc-layout-grid__inner"> <h1 class="mdc-layout-grid__cell mdc-typography--heading1">{{ $course->code }}</h1> </div> <div class="mdc-layout-grid__inner"> <h3 class="mdc-layout-grid__cell--span-8 mdc-typography--heading3">{{ $course->title }}</h3> </div> <br> <div class="mdc-layout-grid__inner"> <div class="mdc-layout-grid__cell"> <h5 class="mdc-typography--heading5"> Prontuario: @if (!is_null($course->syllabus)) <a href="{{ $course->syllabus }}">PDF</a> @else @auth {{-- TODO: Button for adding syllabus --}} @else n/a @endauth @endif </h5> </div> </div> <hr> <div class="mdc-layout-grid__inner"> <div class="mdc-layout-grid__cell"> <h2 class="mdc-typography--heading2">Semestres</h2> </div> </div> {{-- TODO: Add button for new section if admin --}} <div class="mdc-layout-grid__inner"> <div class="mdc-layout-grid__cell--span-12"> @foreach ($course->semesters->unique()->sort() as $semester) {{-- @dd($semester_code) --}} <div class="mdc-layout-grid__inner"> <div class="mdc-layout-grid__cell"> <h4 class="mdc-typography--heading4">{{ $semester->alpha }}</h4> </div> </div> <div class="mdc-layout-grid__inner"> <div class="mdc-data-table mdc-layout-grid__cell--span-6 course-sections-table"> <table class="mdc-data-table__table"> <thead class="thead-light"> <tr class="mdc-data-table__header-row"> <th scope="col" class="mdc-data-table__header-cell" @guest style="display:none;" @endguest>Edit</th> <th scope="col" class="mdc-data-table__header-cell">Sección</th> <th scope="col" class="mdc-data-table__header-cell">Profesor</th> <th scope="col" class="mdc-data-table__header-cell">Prontuario</th> <th scope="col" class="mdc-data-table__header-cell">Creditos</th> <th scope="col" class="mdc-data-table__header-cell"># de Estudiantes</th> </tr> </thead> <tbody class="mdc-data-table__content"> @foreach ($semester->sections->where('course_id', '=', $course->id) as $section) <tr class="mdc-data-table__row"> <td class="mdc-data-table__cell" @guest style="display:none;" @endguest> <button class="mdc-icon-button material-icons" data-toggle="modal" data-target="#modal-section-edit" data-section-id="{{ $section->id }}">edit</button> </td> <td class="mdc-data-table__cell">{{ $section->code }}</td> <td class="mdc-data-table__cell"> @foreach ($section->professors->sortBy('last_name') as $professor) <a href="{{ route('professor.show', ['id' => $professor->id]) }}">{{ $professor->first_name . ' ' . $professor->last_name }}</a> @if (!$loop->last) <br> @endif @endforeach </td> <td class="mdc-data-table__cell"> {{-- TODO: Add buton for uploading syllabus if admin --}} <a href="{{ $section->syllabus }}">PDF</a> </td> <td class="mdc-data-table__cell mdc-data-table__cell--numeric"> @if (!is_null($section->credits)) {{ $section->credits }} @else n/a @endif </td> <td class="mdc-data-table__cell mdc-data-table__cell--numeric"> @if (!is_null($section->student_count)) {{ $section->student_count }} @else n/a @endif </td> </tr> @endforeach </tbody> </table> </div> </div> @if (!$loop->last) <br> @endif @endforeach </div> </div> @endsection @section('modals') @include('modal.course.edit') @include('modal.section.edit') @include('modal.syllabus') @endsection @section('scripts') <script src="/js/course.js"></script> @endsection