@extends('layouts.master')

@section('navigation')
    @if (Auth::user()->role == 1)
        @include('local.managers.admins._new_navigation')
    @elseif(Auth::user()->role == 2)
        @include('local.managers.sCoords._new_navigation')
    @elseif(Auth::user()->role == 3)
        @include('local.managers.pCoords._new_navigation')
    @else
        @include('local.professors._navigation')
    @endif
@stop

@section('main')

    <div class="row">
        <div class="col-md-12">
            <p>{{ $course->name }}</p>
        </div>
    </div>


    <div class="row">
        <div class="col-md-12">
            <h3>Activities</h3>

            @if (!$activities->isEmpty())

                @if ($is_active_semester)
                    <a href="{{ URL::action('ActivitiesController@newCreate', ['course_id' => $course->id]) }}"
                        class="btn btn-sm btn-default pull-right">New Activity</a>
                @endif

                <table class="table table-striped table-condensed">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Date</th>
                            <th>Updated</th>
                            <th>Assessed</th>
                            <th>Published</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($activities as $activity)
                            <tr>
                                <td>{{ link_to_action('ActivitiesController@show', $activity->name, $parameters = ['id' => $activity->id]) }}
                                </td>
                                <td>{{ date('M d, Y', strtotime($activity->date)) }}</td>
                                <td>{{ date('M d, Y', strtotime($activity->updated_at)) }}</td>
                                <td>
                                    @if ($activity->outcomes_attempted != null)
                                        <span class="glyphicon glyphicon-ok"></span>
                                    @endif
                                </td>
                                <td>
                                    @if ($activity->outcomes_attempted != null && !$activity->draft && !$activity->diagnostic)
                                        <span class="glyphicon glyphicon-ok"></span>
                                    @endif
                                </td>
                            </tr>
                        @endforeach

                        @if (!$is_active_semester)
                            <tr>
                                <td colspan="3">
                                    <div class="alert alert-info">The semester for this course is inactive. You cannot create
                                        any more activities.</div>
                                </td>
                            </tr>
                        @endif
                    </tbody>
                </table>

                <p>Unplublished activity results are <strong>not considered</strong> in the graph above.</p>
            @else
                <div class="alert alert-info">
                    @if ($is_active_semester)
                        <p>
                            No activities.
                            <a data-toggle="modal" data-target="#newActivityModal">
                                Create one.
                            </a>
                        </p>
                    @else
                        <p>The semester for this course is inactive. You cannot create any activities.</p>
                    @endif
                </div>
            @endif
        </div>
    </div>
@stop

@section('included-js')
    <!-- HighCharts -->
    <script src="{{ asset('vendor/highcharts/highcharts.js') }}"></script>
    <!--script src="http://code.highcharts.com/modules/exporting.js"></script -->

@stop

@section('javascript')


@stop
