<?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;
    }
    .outcome-text
    {
        text-align:left;
        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}}

    .outcome-header{
        text-align:left
    }
    hr{
        border-block-color: black
    }

    .course-title {
      text-align:center;
      font-weight:bold;
    }
</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">{{ $annualPlan->program->name }} Program Report</p>

    <h1 class="header-text">Academic Year {{ $annualPlan->annual_cycle->academic_year }} </h1>
</div>

@foreach ($annualPlan->outcomes as $outcome)
    <h1 class="outcome-header">{{ $outcome->name }} <sub>(Semester
            {{ Semester::find($outcome->semester_id)->code }})</sub></h1>
    <hr>
    <p class="outcome-text">Target to achieve the learning outcome: {{ $outcome->expected_outcome }} or more of
        the
        attempts</p>
    <p class="outcome-text">Expected percent of students achieving the target by learning outcome:
        {{ $outcome->expected_target }}%

        <hr>
    <table class="table table-striped table-condensed">
        <thead>
            <tr>
                <th>
                    Objectives for Courses
                </th>

                <th>
                    Courses and Criteria
                </th>
                <th>
                    Transformative Actions to be Implemented
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach ($outcome->annual_objectives as $index => $objective)
                <tr>
                    <td>
                        {{ $alphabet[$index] }}. {{ $objective->text }}
                    </td>

                    <td>
                        <ol type="1">


                            @foreach ($objective->grouped_annual_course as $index2 => $course_code)
                                <li>
                                    <p>{{ $course_code->code }}-{{ $course_code->number }}</p>

                                    <ol type="a">
                                        @foreach ($course_code->paired_criteria as $index3 => $criterion)
                                            <li>
                                                {{ $criterion->name }}
                                            </li>
                                        @endforeach
                                    </ol>

                                    @if (count($objective->grouped_annual_course) > $index2 + 1)
                                        <hr style="margin-left:-40px">
                                    @endif


                                </li>
                            @endforeach
                        </ol>
                    </td>
                    <td>
                        <ol type="1">
                            @foreach ($objective->grouped_annual_course as $index2 => $course_code)
                                @if (count($course_code->proposed_transformative_actions) > 0)
                                    <li>
                                        <p>{{ $course_code->code }}-{{ $course_code->number }}</p>

                                        <ol type="a">
                                            @foreach ($course_code->proposed_transformative_actions as $index3 => $trans)
                                                <li>
                                                    <p><strong>{{ $trans->at_text }}:
                                                        </strong>{{ $trans->description }}</p>

                                                </li>
                                            @endforeach
                                        </ol>
                                        <hr style="margin-left:-40px">

                                        @if (count($objective->grouped_annual_course) != $index2 + 1)
                                            <hr style="margin-left:-40px">
                                        @endif
                                @endif
                            @endforeach
                        </ol>


                    </td>


                </tr>
            @endforeach

        </tbody>

    </table>

    @if (count($outcome->program_transformative_actions) > 0)
        <li>
            <h2>Program Transformative Actions</h2>
            <hr>

            <table class="table table-striped table-condensed">
                <thead>
                    <tr>
                        <th></th>
                        <th>Transformative Action</th>
                        <th>Category</th>


                    </tr>
                </thead>
                <tbody>
                    @foreach ($outcome->program_transformative_actions as $index => $ta)
                        <tr>
                            <td>{{ $index + 1 }}.</td>
                            <td>
                                <strong>{{ $ta->at_text }}: </strong>{{ $ta->description }}


                            </td>
                            <td>
                                {{ $ta->type_of_TA }}
                            </td>




                        </tr>
                    @endforeach

                </tbody>
            </table>
            <hr>
        </li>
    @endif
@endforeach

{{-- @foreach ($outcome->program_transformative_actions as $trans)
                                <li>
                                    <h2><strong>{{ $trans->at_text }}: {{ $trans->description }}</strong></h2>

                                    @if (isset($trans->status))
                                        <p><strong>Results: </strong>{{ $trans->status->results }}</p>
                                        <p><strong>Was this helpful to achieve the learning expectation? </strong>
                                            @if ($trans->status->it_was_useful == 1)
                                                Yes
                                            @else
                                                No
                                            @endif
                                        </p>
                                        <p><strong>Explain briefly details about the implementation: </strong>
                                            {{ $trans->status->comments }}
                                        </p>
                                    @else
                                        <p><strong>Please submit the results </strong>
                                    @endif

                                </li>
                            @endforeach
                        </ol> --}}

<?php

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

<script type="text/javascript">
    window.print();
</script>