No Description

show_five_year_plan.blade.php 15KB

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