No Description

show_five_year_plan.blade.php 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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="col-md-12">
  14. <div id="quinquennium" data-quinquennium-id="{{ $plan->quinquennium->id }}"></div>
  15. <div id="program" data-program-id="{{ $program->id }}"></div>
  16. @if(!$plan->is_submitted)
  17. @if(date('Y-m-d') <= $plan->quinquennium->five_year_plan_due_date)
  18. <span class="glyphicon glyphicon-info-sign"></span>
  19. <strong>Note:</strong> This plan is saved as a <strong>draft.</strong> Remember to submit it by <strong>{{ date('F d', strtotime($plan->quinquennium->five_year_plan_due_date)) }}</strong>. After the due date, unsubmitted drafts will not be considered.</strong>
  20. <div class="text-right">
  21. <br>
  22. {{ Form::open(array('action'=>'FiveYearPlansController@update', 'class'=>"form-inline")) }}
  23. <a href="{{ URL::action('FiveYearPlansController@edit', array('program'=>$program->id, 'plan'=>$plan->id) )}}" class="btn btn-primary edit">
  24. <span class="glyphicon glyphicon-pencil"></span>
  25. Edit
  26. </a>
  27. <button class="btn btn-primary pdf">
  28. <span class="glyphicon glyphicon-arrow-left"></span>
  29. PDF
  30. </button>
  31. <a href="{{ URL::action('FiveYearPlansController@msWord', array('plan'=>$plan->id))}}" class="btn btn-primary">
  32. <span class="glyphicon glyphicon-download-alt"></span>
  33. MS Word
  34. </a>
  35. <button type="submit" class="btn btn-primary">
  36. <span class="glyphicon glyphicon-send"></span>
  37. Submit
  38. </button>
  39. <a href="{{ URL::action('FiveYearPlansController@index')}}" class="btn btn-primary submit">
  40. <span class="glyphicon glyphicon-arrow-left"></span>
  41. Back to Five Year Plans
  42. </a>
  43. {{ Form::close() }}
  44. <br>
  45. </div>
  46. @else
  47. <span class="glyphicon glyphicon-info-sign"></span>
  48. <strong>Note:</strong> This plan was not submitted on time.</strong>
  49. @endif
  50. @else
  51. <span class="glyphicon glyphicon-ok-sign"></span>
  52. <strong>Note:</strong> This plan was submitted on {{ date('F j, Y', strtotime($plan->submitted_on)) }}
  53. <div class="text-right">
  54. @if(date('Y-m-d') < $plan->quinquennium->five_year_plan_due_date)
  55. <br>
  56. <a href="{{ URL::action('FiveYearPlansController@edit', array('program'=>$program->id, 'plan'=>$plan->id) )}}" class="btn btn-primary revert">
  57. <span class="glyphicon glyphicon-backward"></span>
  58. Revert Submission
  59. </a>
  60. @endif
  61. <br><br>
  62. </div>
  63. @endif
  64. <!-- Nav tabs -->
  65. <ul class="nav nav-tabs" role="tablist">
  66. <li role="presentation" class="active"><a href="#full-plan" aria-controls="full-plan" role="tab" data-toggle="tab"><h4>Full Plan</h4></a></li>
  67. <li role="presentation"><a href="#summary" aria-controls="summary" role="tab" data-toggle="tab"><h4>Summary</h4></a></li>
  68. </ul>
  69. <br>
  70. <!-- Tab panes -->
  71. <div class="tab-content">
  72. <div role="tabpanel" class="tab-pane active" id="full-plan">
  73. @foreach($plan->fypParts as $mini_plan)
  74. <div class="mini-plan">
  75. <table class="table table-bordered" id="table">
  76. <thead>
  77. <tr class="bg-warning text-center">
  78. <th class="text-center col-md-1">Academic Year</th>
  79. <th class="text-center col-md-3">Learning Outcome to be assessed</th>
  80. <th class="text-center col-md-4">Learning Objectives</th>
  81. <th class="text-center col-md-4">Courses to use for assessment</th>
  82. </tr>
  83. </thead>
  84. <tbody>
  85. @foreach($mini_plan->fypPartOutcomes as $index => $outcome)
  86. <tr>
  87. <!-- If outcome is the first, include multi-row year column -->
  88. @if($index == 0)
  89. <th class="active academic-year text-center" rowspan ="{{ count($mini_plan->fypPartOutcomes) }}">{{ $mini_plan->year_start }}-{{ $mini_plan->year_end }}</th>
  90. @else
  91. <th class="hidden">{{ $mini_plan->year_start }}-{{ $mini_plan->year_end }}</th>
  92. @endif
  93. <td class="outcome-cell">
  94. {{ $outcome->outcome->name }}
  95. </td>
  96. <td class="objectives-cell">
  97. <ul>
  98. @foreach(json_decode($outcome->objectives) as $objective)
  99. <li class="objective">{{ $objective->text }}</li>
  100. @endforeach
  101. </ul>
  102. </td>
  103. <td>
  104. <ul>
  105. @foreach(json_decode($outcome->courses) as $course)
  106. <li class="course">{{ $course->code }}{{ $course->number }}: {{ $course->name }}</li>
  107. @endforeach
  108. </ul>
  109. </td>
  110. </tr>
  111. @endforeach
  112. </tbody>
  113. </table>
  114. </div>
  115. <br>
  116. @endforeach
  117. </div>
  118. <div role="tabpanel" class="tab-pane" id="summary">
  119. <p>This summary is automatically generated using the information from the Full Plan. Any changes to the plan will be reflected here.</p>
  120. <table class="table table-bordered text-center">
  121. <thead>
  122. <tr class="bg-warning">
  123. <th class="col-md-4">Learning Outcome</th>
  124. @foreach($plan->fypParts as $mini_plan)
  125. <th class="academic-year text-center">{{ $mini_plan->year_start }}-{{ $mini_plan->year_end }}</th>
  126. @endforeach
  127. </tr>
  128. </thead>
  129. <tbody>
  130. @foreach($outcomes as $outcome)
  131. <tr>
  132. <th class="active">{{ $outcome->name }}</th>
  133. @foreach($plan->fypParts as $mini_plan)
  134. @if($mini_plan->willAssessOutcome($outcome->id))
  135. <td><span class="glyphicon glyphicon-ok"></span></td>
  136. @else
  137. <td></td>
  138. @endif
  139. @endforeach
  140. </tr>
  141. @endforeach
  142. </tbody>
  143. </table>
  144. </div>
  145. </div>
  146. @if(!$plan->is_submitted)
  147. @if(date('Y-m-d') <= $plan->quinquennium->five_year_plan_due_date)
  148. <div class="text-right">
  149. <br>
  150. {{ Form::open(array('action'=>'FiveYearPlansController@update', 'class'=>"form-inline")) }}
  151. <a href="{{ URL::action('FiveYearPlansController@edit', array('program'=>$program->id, 'plan'=>$plan->id) )}}" class="btn btn-primary edit">
  152. <span class="glyphicon glyphicon-pencil"></span>
  153. Edit
  154. </a>
  155. <button class="btn btn-primary pdf">
  156. <span class="glyphicon glyphicon-arrow-left"></span>
  157. PDF
  158. </button>
  159. <a href="{{ URL::action('FiveYearPlansController@msWord', array('plan'=>$plan->id))}}" class="btn btn-primary">
  160. <span class="glyphicon glyphicon-download-alt"></span>
  161. MS Word
  162. </a>
  163. <button type="submit" class="btn btn-primary">
  164. <span class="glyphicon glyphicon-send"></span>
  165. Submit
  166. </button>
  167. <a href="{{ URL::action('FiveYearPlansController@index')}}" class="btn btn-primary submit">
  168. <span class="glyphicon glyphicon-arrow-left"></span>
  169. Back to Five Year Plans
  170. </a>
  171. {{ Form::close() }}
  172. <br>
  173. </div>
  174. @else
  175. <span class="glyphicon glyphicon-info-sign"></span>
  176. <strong>Note:</strong> This plan was not submitted on time.</strong>
  177. @endif
  178. @else
  179. <span class="glyphicon glyphicon-ok-sign"></span>
  180. <strong>Note:</strong> This plan was submitted on {{ date('F j, Y', strtotime($plan->submitted_on)) }}
  181. <div class="text-right">
  182. @if(date('Y-m-d') < $plan->quinquennium->five_year_plan_due_date)
  183. <br>
  184. <a href="{{ URL::action('FiveYearPlansController@edit', array('program'=>$program->id, 'plan'=>$plan->id) )}}" class="btn btn-primary revert">
  185. <span class="glyphicon glyphicon-backward"></span>
  186. Revert Submission
  187. </a>
  188. @endif
  189. <br><br>
  190. </div>
  191. @endif
  192. </div>
  193. </div>
  194. @stop
  195. @section('included-js')
  196. <script src="{{ asset('vendor/jsPDF-master/dist/jspdf.min.js') }}"></script>
  197. <script src="{{ asset('vendor/jsPDF-AutoTable-master/dist/jspdf.plugin.autotable.js') }}"></script>
  198. @stop
  199. @section('javascript')
  200. // --------------------------------------------------------------------------
  201. // Page Load
  202. // --------------------------------------------------------------------------
  203. $('.datatable').DataTable(
  204. {
  205. "searching": false,
  206. "paging": false,
  207. "ordering": false,
  208. "info": false
  209. });
  210. // --------------------------------------------------------------------------
  211. // Events
  212. // --------------------------------------------------------------------------
  213. $('.pdf').on('click', function(e)
  214. {
  215. e.preventDefault();
  216. console.log('start');
  217. var doc = new jsPDF('l', 'pt');
  218. doc.setFontSize(10);
  219. doc.text("From HTML", 40, 50);
  220. var columns = ['Academic Year', 'Learning Outcome to be assessed', 'Learning Objectives', 'Courses to use for assessment'];
  221. $('table').each(function(index, value)
  222. {
  223. if(index != 0 )
  224. {
  225. doc.addPage();
  226. }
  227. console.log('start table');
  228. var rows = new Array();
  229. var table = $(this);
  230. var disp_table = new Object();
  231. disp_table.columns = columns;
  232. // Iterate tables
  233. table.find('tbody tr').each(function(index, value)
  234. {
  235. console.log('row: '+(index+1));
  236. var tr = $(this);
  237. var row = new Array();
  238. var academic_year = tr.find(':nth-child(1)').html();
  239. var outcome = $.trim(tr.find(':nth-child(2)').html());
  240. var objectives_dom = tr.find(':nth-child(3)');
  241. var courses_dom = tr.find(':nth-child(4)');
  242. var objectives = new Array();
  243. var courses = new Array();
  244. objectives_dom.find('.objective').each(function()
  245. {
  246. objectives.push('• '+$.trim($(this).text()));
  247. });
  248. courses_dom.find('.course').each(function()
  249. {
  250. courses.push('• '+$.trim($(this).text()));
  251. });
  252. console.log(academic_year);
  253. console.log(outcome);
  254. console.log(objectives);
  255. console.log(courses);
  256. row.push(academic_year);
  257. row.push(outcome);
  258. row.push(jQuery.extend([], objectives));
  259. row.push(jQuery.extend([], courses));
  260. rows.push(jQuery.extend([], row));
  261. disp_table.rows = jQuery.extend([], rows);
  262. console.log('end row: '+(index+1));
  263. });
  264. console.log(disp_table);
  265. doc.autoTable(columns, rows,
  266. {
  267. theme: "grid",
  268. styles: {
  269. overflow: 'linebreak'
  270. },
  271. drawCell: function (cell, data) {
  272. console.log('CELL DRAW START');
  273. console.log(cell);
  274. if (data.column.index == 2 || data.column.index == 3)
  275. {
  276. doc.rect(cell.x, cell.y, cell.width, cell.height, 'S');
  277. doc.text(cell.raw, cell.x + 5, cell.y + 12);
  278. console.log('CELL DRAW END');
  279. return false;
  280. }
  281. console.log('CELL DRAW END');
  282. return true;
  283. }
  284. });
  285. console.log('end table');
  286. });
  287. //doc.save();
  288. return;
  289. });
  290. // --------------------------------------------------------------------------
  291. // Functions
  292. // --------------------------------------------------------------------------
  293. @stop