No Description

index_annual_plans.blade.php 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. @extends('layouts.master')
  2. @section('navigation')
  3. @if (Auth::user()->role == 1)
  4. @include('local.managers.admins._new_navigation')
  5. @elseif(Auth::user()->role == 2)
  6. @include('local.managers.sCoords._new_navigation')
  7. @elseif(Auth::user()->role == 3)
  8. @include('local.managers.pCoords._new_navigation')
  9. @endif
  10. @stop
  11. @section('main')
  12. <div class="row">
  13. <div class="table-responsive">
  14. <table class="table table-bordered datatable">
  15. <thead>
  16. <tr>
  17. <th class="active col-sm-2 col-md-2">Program</th>
  18. <th class="active col-sm-2 col-md-2">School</th>
  19. @foreach ($quinquenniums as $quinquennium)
  20. @for ($year = date('Y', strtotime($quinquennium->start_date)); $year < date('Y', strtotime($quinquennium->end_date)); $year++)
  21. <th class="active">{{ $year }} - {{ $year + 1 }}</th>
  22. @endfor
  23. @endforeach
  24. </tr>
  25. </thead>
  26. @foreach ($programs as $program)
  27. <tr>
  28. <th class="active col-sm-2 col-md-2"> {{ $program->name }} </th>
  29. <td class="col-sm-2 col-md-2"> {{ $program->school->name }} </td>
  30. @foreach ($quinquenniums as $quinquennium)
  31. @for ($year = date('Y', strtotime($quinquennium->start_date)); $year < date('Y', strtotime($quinquennium->end_date)); $year++)
  32. <td>
  33. <?php $annual_plan = AnnualPlan::where('program_id', $program->id)
  34. ->where('quinquennium_id', $quinquennium->id)
  35. ->where('year_start', $year)
  36. ->first(); ?>
  37. @if ($annual_plan)
  38. <a class="btn btn-sm btn-default"
  39. href="{{ URL::action('AnnualPlansController@show', [$program->id, $annual_plan->id]) }}">
  40. <span class="glyphicon glyphicon-eye-open"></span>
  41. View
  42. </a>
  43. @if ($quinquennium->id == $current_quinquennium->id && // Quinquennium is running
  44. date('Y') == $year && // Current year is the same as year
  45. date('m') <= date('m', strtotime($current_quinquennium->annual_plan_due_date)) && // Current month (and day, below) is the same or before the due month (and day)
  46. date('d') <= date('d', strtotime($current_quinquennium->annual_plan_due_date)))
  47. <a class="btn btn-sm btn-default"
  48. href="{{ URL::action('AnnualPlansController@edit', [$program->id, $annual_plan->id]) }}">
  49. <span class="glyphicon glyphicon-pencil"></span>
  50. Edit
  51. </a>
  52. @endif
  53. @elseif($quinquennium->id == $current_quinquennium->id && // Quinquennium is running
  54. date('Y') == $year && // Current year is the same as year
  55. date('m') <= date('m', strtotime($current_quinquennium->annual_plan_due_date)) && // Current month (and day, below) is the same or before the due month (and day)
  56. date('d') <= date('d', strtotime($current_quinquennium->annual_plan_due_date)))
  57. <a class="btn btn-sm btn-default"
  58. href="{{ URL::action('AnnualPlansController@create', [$program->id]) }}">
  59. <span class="glyphicon glyphicon-plus"></span>
  60. Create
  61. </a>
  62. @else
  63. Plan unavailable
  64. @endif
  65. </td>
  66. @endfor
  67. @endforeach
  68. </tr>
  69. @endforeach
  70. </table>
  71. </div>
  72. </div>
  73. @stop
  74. @section('included-js')
  75. @stop
  76. @section('javascript')
  77. table = $('.datatable').dataTable({
  78. "columnDefs": [
  79. { "searchable": true, "sortable": true, "targets": [0, 1]},
  80. ]
  81. });
  82. $('a.toggle-vis').on('click', function (e) {
  83. e.preventDefault();
  84. // Get the column API object
  85. var column = table.column( $(this).attr('data-column') );
  86. // Toggle the visibility
  87. column.visible( ! column.visible() );
  88. } );
  89. @stop