暫無描述

index_annual_plans.blade.php 3.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. @extends('layouts.master')
  2. @section('navigation')
  3. @if(Auth::user()->role==1)
  4. @include('local.managers.admins._navigation')
  5. @elseif(Auth::user()->role==2)
  6. @include('local.managers.sCoords._navigation')
  7. @elseif(Auth::user()->role==3)
  8. @include('local.managers.pCoords._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)->where('quinquennium_id', $quinquennium->id)->where('year_start', $year)->first(); ?>
  34. @if($annual_plan)
  35. <a class="btn btn-sm btn-default" href="{{ URL::action('AnnualPlansController@show', array($program->id, $annual_plan->id)) }}">
  36. <span class="glyphicon glyphicon-eye-open"></span>
  37. View
  38. </a>
  39. @if($quinquennium->id == $current_quinquennium->id // Quinquennium is running
  40. && date('Y') == $year // Current year is the same as year
  41. && 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)
  42. && date('d') <= date('d', strtotime($current_quinquennium->annual_plan_due_date)))
  43. <a class="btn btn-sm btn-default" href="{{ URL::action('AnnualPlansController@edit', array($program->id, $annual_plan->id)) }}">
  44. <span class="glyphicon glyphicon-pencil"></span>
  45. Edit
  46. </a>
  47. @endif
  48. @elseif(
  49. $quinquennium->id == $current_quinquennium->id // Quinquennium is running
  50. && date('Y') == $year // Current year is the same as year
  51. && 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)
  52. && date('d') <= date('d', strtotime($current_quinquennium->annual_plan_due_date)))
  53. <a class="btn btn-sm btn-default" href="{{ URL::action('AnnualPlansController@create', array($program->id)) }}">
  54. <span class="glyphicon glyphicon-plus"></span>
  55. Create
  56. </a>
  57. @else
  58. Plan unavailable
  59. @endif
  60. </td>
  61. @endfor
  62. @endforeach
  63. </tr>
  64. @endforeach
  65. </table>
  66. </div>
  67. </div>
  68. @stop
  69. @section('included-js')
  70. @stop
  71. @section('javascript')
  72. table = $('.datatable').dataTable({
  73. "columnDefs": [
  74. { "searchable": true, "sortable": true, "targets": [0, 1]},
  75. ]
  76. });
  77. $('a.toggle-vis').on('click', function (e) {
  78. e.preventDefault();
  79. // Get the column API object
  80. var column = table.column( $(this).attr('data-column') );
  81. // Toggle the visibility
  82. column.visible( ! column.visible() );
  83. } );
  84. @stop