<?php

echo '<html>';
echo '<body>';

//Inline styles (only for printing)
echo
'<style type="text/css">
    body
    {
        font-family: "Arial", sans-serif;
        width:90%;
        margin: 0 auto;
    }
    .header-text
    {
        text-align:center;
        font-weight: bold;
        margin:0;
    }

    h1.header-text
    {
      margin: 15px auto;
      width:75%;
      font-size: 25px;
    }

    table
    {
        border-collapse: collapse;
        border: 1px solid black;
        width: 100%;
        margin: 30px auto;
        font-size:1.5vw;
    }
    td, th
    {
        border: 1px solid black;
        padding: 5px;
    }

    .activity-name-row
    {
      background:black;
      color:white;
    }

    .activity-headers-row
    {
      background:lightgrey;
      font-weight:bold;
    }

    .report-info
    {
      margin:5px 0;
      font-size: 16px;
    }

    .criterion-field
    {
      text-align:left;
    }

    .score-field, .total, .percentage
    {
      text-align:center;
    }

    .header
    {
      margin: 30px 0;
    }

    .content
    {
      font-size: 12px;
    }

    .logo
    {
      position:absolute;
      right:0;
      top: 30px;
      width: 100px;
    }

    ul{
      list-style-type:none;
    }

    @media print{@page {size: landscape}}
</style>';

echo '<style type="text/css" media="print">
  @page { size: landscape; }
</style>';

?>
<img class="logo" src="{{ asset('images/logo_uprrp_bw.png') }}" alt="UPRRP Logo">

<div class="header"><p class="header-text">University of Puerto Rico, Río Piedras Campus</p>
<p class="header-text">Online Learning Assessment System</p>
<p class="header-text">{{$course->program->name}} Program</p>
<p class="header-text">{{{ $course->code }}} {{{ $course->number }}} - {{$course->name}}</p>
<h1 class="header-text">Assessment Rubric </h1></div>

<span>Rubric: {{{ $rubric->name}}}</span><br>
<span>Activity: {{{ $activity->name}}} </span><br>
<span>Passing Criteria:
  <span id="expected_percentage">{{{ $rubric->expected_percentage }}}% of students must obtain at least </span>
  <span id="expected_points">{{{$rubric->expected_points}}}</span> points
</span><br><br>

<table class="table table-striped table-condensed">
  <thead>
    <tr>
      <th></th>
      <th>Criterion</th>
      <th>Beginning (1-2)</th>
      <th>In Progress (3-4)</th>
      <th>Good (5-6)</th>
      <th>Excellent (7-8)</th>
      <th>Learning Outcome</th>
      <th>Copyright</th>
      <th>Notes</th>
    </tr>
  </thead>
  <tbody>
  @foreach(json_decode($rubric->contents) as $index => $criterion)
    <tr>
      <td>{{ $index + 1 }}.</td>
      <td>
        {{{ $criterion->name }}}

        @if(property_exists($criterion, 'subcriteria'))
          <ul class="list-unstyled">
            @foreach($criterion->subcriteria as $subcriterion)
                <li>{{ $subcriterion }}</li>
            @endforeach
          </ul>
        @endif
      </td>
      <td>{{ nl2br($criterion->description12) }}</td>
      <td>{{ nl2br($criterion->description34) }}</td>
      <td>{{ nl2br($criterion->description56) }}</td>
      <td>{{ nl2br($criterion->description78) }}</td>
      <td>{{ Outcome::where('id', $criterion->outcome_id)->first()->name }}</td>
      <td>
      @if($criterion->copyright)
        {{{ $criterion->copyright }}}
      @endif
      </td>
      <td>
      @if($criterion->notes)
        {{{ $criterion->notes }}}
      @endif
      </td>
    </tr>
  @endforeach
  </tbody>
</table>


<?

echo '</body>';
echo '</html>';
?>

<script type="text/javascript">

window.print();

</script>