No Description

annual_report.blade.php 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. @extends('layouts.master-2')
  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. @elseif(Auth::user()->role == 4)
  10. @include('local.professors._navigation')
  11. @endif
  12. @stop
  13. @section('main')
  14. {{-- TODO: look where to place this script.
  15. if placed inside .ready() or before it,
  16. an error that the function is not defined occurs. --}}
  17. {{-- TODO: no reconoce acentos --}}
  18. <div class="row">
  19. <div class="col-md-3">
  20. <select class="form-control selectpicker" id="annual_plan" onchange="fetchInfo('annual_plan')">
  21. <option value='0'> Nothing Selected</option>
  22. @foreach ($annual_plans as $an_plan)
  23. <option value={{ $an_plan->annual_id }}>Plan {{ $an_plan->academic_year }}</option>
  24. @endforeach
  25. </select>
  26. <br>
  27. <div id='allOutcomes'>
  28. </div>
  29. </div>
  30. <div class="col-md-9">
  31. <div id="outcome-display" class="panel panel-default">
  32. <div class="panel-heading">
  33. <h4 class=" panel-title" style="cursor:auto!important;">
  34. Primer Semestre 2019-2020
  35. </h4>
  36. </div>
  37. <div class="panel-body">
  38. <div id='outcomeInfo'>
  39. </div>
  40. <div id="tableOutcome">
  41. </div>
  42. <ul id="levelTabs" class="nav nav-tabs" role="tablist">
  43. </ul>
  44. <div id="allLists" class="tab-content">
  45. </div>
  46. <!-- <div class="table-responsive">
  47. <table class="table table-striped table-condensed datatable" style="table-layout: fixed ; width : 100%">
  48. <thead><tr><th>Objectives for courses</th><th>Criteria per Course</th><th>Transformative Actions</th></tr></thead>
  49. <tbody>
  50. </tbody>
  51. </table>
  52. </div>-->
  53. </div>
  54. </div>
  55. </div>
  56. <div class="col-md-9">
  57. <div class="no-outcome alert alert-info">
  58. <p>Select a Learning Outcome to view its information</p>
  59. </div>
  60. </div>
  61. </div>
  62. <script>
  63. function nextChar(c) {
  64. return String.fromCharCode(c.charCodeAt(0) + 1);
  65. }
  66. changed = false;
  67. $(document).ready(function() {
  68. // --------------------------------------------------------------------------
  69. // Page load
  70. // --------------------------------------------------------------------------
  71. // Hide accordion panel contents by default
  72. $('.panel-group .panel-body').hide();
  73. $('#outcome-display').parent().hide();
  74. // --------------------------------------------------------------------------
  75. // Functions
  76. // --------------------------------------------------------------------------
  77. // --------------------------------------------------------------------------
  78. // Events
  79. // --------------------------------------------------------------------------
  80. // When list item is clicked, load corresponding info
  81. });
  82. function fetchEverything(li) {
  83. var outcome_id = $(li).data('outcome-id');
  84. var name = $(li).data('outcome-name');
  85. var semester_id = $(li).data('semester-id');
  86. var annual_plan_id = $(li).data('annual-plan');
  87. $('#theChange').data('annual-plan', annual_plan);
  88. $.post(
  89. "{{ URL::action('AnnualPlansController@fetchReportWithOutcome') }}", {
  90. semester_id: semester_id,
  91. outcome_id: outcome_id,
  92. program_id: {{ $program->id }},
  93. annual_plan_id: annual_plan_id
  94. },
  95. function(outcome) {
  96. if (outcome.objectives) {
  97. $('table').show();
  98. $('#outcome-display').parent().show();
  99. $('#outcome-display .panel-title').html(name);
  100. $('#allLists').empty();
  101. $('#levelTabs').empty();
  102. $('.no-outcome').hide();
  103. var outcomeHTML = "<h4>Performance of Students by Learning Outcome</h4>" +
  104. '<h5 style = "display: inline; margin:30px;">Target by outcome: </h5>' +
  105. '<p style = "display: inline;"> <i>>= ' + outcome.expected_outcome +
  106. ' of the attempts</i>' + '</p>' +
  107. '<br><h5 style = "display: inline; margin:30px;">Expected percent of students achieving the target by outcome: </h5>' +
  108. '<p style = "display: inline;"> <i>' + outcome.outcome_program_goal + '</i></p>';
  109. $('#outcomeInfo').html('<p class="outcome-definition">' + outcome.definition + '</p>' +
  110. outcomeHTML);
  111. //theStudentOutcomeTable = $("<table/>");
  112. //theStudentOutcomeTable.hide();
  113. ///$('#outcomeInfo').append(theStudentOutcomeTable);
  114. wholeDict = {};
  115. tableStudent = $('<table/>', {
  116. 'class': 'table table-striped table-condensed datatable'
  117. });
  118. tableStudent.html('<thead><tr>' +
  119. '<th>Student</th>' +
  120. '<th>Criteria Attempted</th>' +
  121. '<th>Criteria Achieved</th>' +
  122. '<th>Percentage</th>' +
  123. '<th>Outcome Achieved</th>' +
  124. '</tr></thead><tbody></tbody>');
  125. $.each(outcome.objectives, function(index, objective) {
  126. li = $('<li/>', {
  127. 'role': 'presentation'
  128. });
  129. a = $('<a/>', {
  130. 'data-toggle': 'tab',
  131. 'href': '#' + objective.id,
  132. 'role': 'tab'
  133. }).html('Objective ' + (index + 1));
  134. li.append(a);
  135. $('#levelTabs').append(li);
  136. objective_title = "<h3>" + objective.text + '</h3>';
  137. div = $('<div/>', {
  138. 'role': 'tabpanel',
  139. 'class': 'tab-pane',
  140. 'id': objective.id
  141. }).html(objective_title);
  142. div.appendTo($('#allLists'))
  143. if (objective.courses) {
  144. $.each(objective.courses, function(index, course_code) {
  145. if (course_code.criteria.length) {
  146. $.each(course_code.students, function(index, student) {
  147. if (wholeDict[student.student_id] === undefined) {
  148. wholeDict[student.student_id] = {
  149. 'student': student.student_id,
  150. 'criteria_attempted': 0,
  151. 'criteria_achieved': 0
  152. }
  153. }
  154. wholeDict[student.student_id][
  155. "criteria_attempted"] += student
  156. .criteria_attempted;
  157. wholeDict[student.student_id][
  158. "criteria_achieved"] += student
  159. .criteria_achieved;
  160. });
  161. div.append(
  162. '<p>The following results are from the courses in the selected semester with the focused criteria in the selected annual plan</p>'
  163. );
  164. table = $('<table/>', {
  165. 'class': 'table table-striped table-condensed datatable'
  166. }).html('<thead><th>Criterion</th><th>' +
  167. 'Number of Students Assessed </th>' +
  168. '<th>Number of students that achieved the target</th></thead>'
  169. );
  170. tbody = $('<tbody/>')
  171. $.each(course_code.criteria, function(index, criterion) {
  172. tr = $('<tr/>').append(
  173. "<td>" + criterion.name + "</td>" +
  174. "<td>" + criterion.criteria_attempted +
  175. "</td>" +
  176. "<td>" + criterion.criteria_achieved +
  177. "</td>"
  178. );
  179. tbody.append(tr);
  180. });
  181. table.append(tbody);
  182. Course_and_transformative = '<h3>' + course_code.code + ' ' +
  183. course_code.number + '</h3><hr>';
  184. if (course_code.transforming_actions.length) {
  185. Course_and_transformative +=
  186. '<h5> This course was tied to the following transformative actions</h5>';
  187. Course_and_transformative += '<ol>';
  188. $.each(course_code.transforming_actions, function(index,
  189. transformative_action) {
  190. Course_and_transformative += '<li><p><strong>' +
  191. transformative_action.at_text +
  192. '</strong>: ' + transformative_action
  193. .description + '</p></li>'
  194. })
  195. }
  196. div.append(Course_and_transformative)
  197. div.append(table);
  198. table.DataTable();
  199. }
  200. })
  201. } else {
  202. div.append('<div class="no-outcome alert alert-info"' +
  203. '<p>No Course in plan has assessed yet</p>' +
  204. '</div>')
  205. }
  206. })
  207. theArray = [];
  208. $('#tableOutcome').html(tableStudent);
  209. //tableStudent.appendTo($('#outcomeInfo'));
  210. tableStudent = tableStudent.DataTable({
  211. dom: 'Bfrtip',
  212. buttons: [
  213. 'csv', 'excel', 'pdf', 'print'
  214. ]
  215. });
  216. students_attempted = 0;
  217. students_achieved = 0;
  218. $.each(wholeDict, function(key, dict) {
  219. if (dict.criteria_attempted) {
  220. students_attempted += 1;
  221. percentage = ((dict.criteria_achieved / dict.criteria_attempted) * 100).toFixed(
  222. 2);
  223. if (parseFloat(percentage) >= parseFloat(outcome.expected_outcome)) {
  224. achieved = "Yes"
  225. students_achieved += 1;
  226. } else achieved = "No"
  227. } else {
  228. percentage = "N/A"
  229. achieved = "N/A"
  230. }
  231. tableStudent.row.add([
  232. dict.student,
  233. dict.criteria_attempted,
  234. dict.criteria_achieved,
  235. percentage,
  236. achieved
  237. ]);
  238. })
  239. tableStudent.draw();
  240. if (students_attempted) {
  241. studentPercentage = ((students_achieved / students_attempted) * 100).toFixed(2);
  242. if (studentPercentage >= outcome.outcome_program_goal) {
  243. FinalReport = "<br><p><strong>The students achieved the Learning Outcome with " +
  244. studentPercentage + "% of students achieving.</strong></p>";
  245. } else {
  246. FinalReport = "<br><p><strong>The students did not achieve the Learning Outcome with " +
  247. studentPercentage + "% of students achieving.</strong></p>";
  248. }
  249. }
  250. $("#outcomeInfo").append(FinalReport)
  251. /* table.row.add([
  252. objectivesHTML,
  253. courseshtml,
  254. courseTAhtml
  255. ]);
  256. table.draw();
  257. */
  258. } else {
  259. $('table').hide();
  260. }
  261. }
  262. );
  263. }
  264. function posttoTransAnnual(annual_id, selectTransId, typ_course_id) {
  265. ta = $("#" + selectTransId).val();
  266. old_ta = $("#" + selectTransId).data('old-TA');
  267. if (ta == "0") return;
  268. $.post("../annual-plan-postTA", {
  269. annual_id: annual_id,
  270. TA_id: ta,
  271. typ_course_id: typ_course_id,
  272. old_ta: old_ta
  273. },
  274. function(message) {
  275. $("#" + selectTransId).data('old-TA', ta);
  276. }
  277. )
  278. }
  279. function addTAselect(options, master_div, annual_plan_id, objective_id, typ_course_id, selected_ta) {
  280. var $div = $('<div/>', {
  281. 'class': 'form-group '
  282. });
  283. counter = parseInt($('#' + master_div).data('amount-ta'));
  284. var selectTA = $('<select/>', {
  285. 'class': "selectpicker form-control",
  286. 'data-live-search': 'true',
  287. 'data-old-TA': '0',
  288. 'data-width': '180px',
  289. 'id': 'transformativeForObjective' + master_div + '_' + counter,
  290. 'onchange': 'posttoTransAnnual(' + annual_plan_id + ', "transformativeForObjective' + master_div +
  291. '_' + counter + '", ' + typ_course_id + ')'
  292. });
  293. selectTA.append(options);
  294. selectTA.appendTo($div);
  295. selectTA.val(selected_ta);
  296. selectTA.data('old-TA', selected_ta);
  297. selectTA.selectpicker('refresh');
  298. $span = $('<span/>', {
  299. 'id': 'close',
  300. 'onclick': ' postDeleteTA(' + annual_plan_id + ', "transformativeForObjective' + master_div + '_' +
  301. counter + '", ' + typ_course_id +
  302. '); this.parentNode.parentNode.removeChild(this.parentNode);return false;'
  303. }).html('x');
  304. $span.appendTo($div);
  305. $div.append("<br><br>");
  306. $('#' + master_div).append("<br>");
  307. $div.appendTo($('#' + master_div));
  308. $('#' + master_div).data('amount-ta', counter + 1);
  309. }
  310. function postDeleteTA(annual_id, selectTransId, typ_course_id) {
  311. ta = $("#" + selectTransId).val();
  312. if (ta == "0") return;
  313. $.post("../annual-plan-deleteTA", {
  314. annual_id: annual_id,
  315. TA_id: ta,
  316. typ_id: typ_course_id,
  317. });
  318. parent = $("#" + selectTransId).parent().parent().parent();
  319. counter = parseInt(parent.data('amount-ta'));
  320. parent.data('amount-ta', counter - 1);
  321. }
  322. function postToAnnualPlans(typ_course_id, criteria_select) {
  323. var criteria = $('#' + criteria_select).val();
  324. var oldCriteria = $('#' + criteria_select).data('old-criteria');
  325. var criteriaNode = document.getElementById(criteria_select).parentNode.parentNode.parentNode;
  326. var annual = criteriaNode.dataset.annualPlan;
  327. $.post("../annual-plan-postOnChange", {
  328. criteria: criteria,
  329. typ_course_id: typ_course_id,
  330. annual_plan: annual,
  331. old_criteria: oldCriteria
  332. },
  333. function(message) {
  334. if (message == "Duplicate entry, please choose another criteria.") {
  335. alert(message)
  336. } else {
  337. $('#' + criteria_select).data('old-criteria', criteria);
  338. changed = true;
  339. }
  340. })
  341. }
  342. function addCriteriaTest(div, new_id_for_select, typ_course_id, i = null, options) {
  343. if (!i) amount_select = $('#' + div).data("amount-select");
  344. else amount_select = i;
  345. $select = $('<select/>', {
  346. 'class': "selectpicker form-control",
  347. 'data-live-search': 'true',
  348. 'data-old-criteria': '0',
  349. 'data-width': '180px',
  350. 'id': 'criteriaFor' + new_id_for_select + '_' + amount_select,
  351. 'onchange': 'postToAnnualPlans(' + typ_course_id + ', "criteriaFor' + new_id_for_select + '_' +
  352. amount_select + '")'
  353. })
  354. var $div = $('<div/>', {
  355. 'id': 'courseSelect_' + new_id_for_select + '_' + amount_select,
  356. 'class': 'form-group '
  357. });
  358. $select.append(options);
  359. $select.appendTo($div);
  360. $span = $('<span/>', {
  361. 'id': 'close',
  362. 'onclick': ' postDelete(' + typ_course_id + ', "criteriaFor' + new_id_for_select + '_' +
  363. amount_select + '"); this.parentNode.parentNode.removeChild(this.parentNode);return false;'
  364. }).html('x');
  365. $div.append($span);
  366. $div.append("<br><br>")
  367. $('#' + div).append("<br>");
  368. $div.appendTo($("#" + div));
  369. $select.selectpicker('refresh');
  370. $("#" + div).data("amount-select", amount_select + 1);
  371. }
  372. $('#allOutcomes').hide();
  373. function postDelete(typ_course_id, criteria_select) {
  374. var criteria = $('#' + criteria_select).val();
  375. var oldCriteria = $('#' + criteria_select).data('old-criteria');
  376. var criteriaNode = document.getElementById(criteria_select).parentNode.parentNode.parentNode;
  377. var annual = criteriaNode.dataset.annualPlan;
  378. $.post("../annual-plan-deleteCriteria", {
  379. criteria: criteria,
  380. typ_course_id: typ_course_id,
  381. annual_plan: annual,
  382. old_criteria: oldCriteria
  383. });
  384. }
  385. function fetchInfo(id) {
  386. annual_id = $("#" + id).val();
  387. program_id = {{ $program->id }};
  388. $.post("{{ URL::action('AnnualPlansController@fetchInfo') }}", {
  389. id: annual_id,
  390. program_id: program_id
  391. },
  392. function(json) {
  393. div = $('<div/>', {
  394. 'class': 'list-group',
  395. 'id': 'list'
  396. });
  397. header5 = $('<h5/>', {
  398. 'style': "padding-left: 10px"
  399. }).html("First Semester");
  400. div.append(header5);
  401. list = '';
  402. for (outcome in json.outcomes.first) {
  403. list +=
  404. "<li style='padding-left: 25px' onclick = 'fetchEverything(this)' data-annual-plan = '" +
  405. json.annual_plans.id + "' data-semester-id = '" + json.allSemesterOrder.first.id +
  406. "' data-outcome-id='" + json.outcomes.first[outcome].id + "' data-outcome-name ='" + json
  407. .outcomes.first[outcome].name + "' class='list-group-item' >" + json.outcomes.first[outcome]
  408. .name + " </li>";
  409. }
  410. div.append(list);
  411. header4 = $('<h5/>', {
  412. 'style': "padding-left: 10px"
  413. }).html("Second Semester");
  414. div.append(header4);
  415. list = '';
  416. for (outcome in json.outcomes.second) {
  417. list +=
  418. "<li style='padding-left: 25px' onclick = 'fetchEverything(this)' data-annual-plan = '" +
  419. json.annual_plans.id + "' data-semester-id = '" + json.allSemesterOrder.second.id +
  420. "' data-outcome-id='" + json.outcomes.second[outcome].id + "' data-outcome-name ='" + json
  421. .outcomes.second[outcome].name + "' class='list-group-item' >" + json.outcomes.second[
  422. outcome].name + " </li>";
  423. }
  424. div.append(list);
  425. html = div[0].innerHTML;
  426. $("#allOutcomes").html(div[0].innerHTML);
  427. $("#allOutcomes").show();
  428. },
  429. "json",
  430. );
  431. }
  432. function deleteObjective(objectiveSelectDiv, closeObj) {
  433. $('#' + objectiveSelectDiv).remove();
  434. $('#' + closeObj).remove();
  435. $('#' + div).data("amount-select", $('#' + div).data("amount-select") - 1);
  436. }
  437. </script>
  438. @stop
  439. @section('included-js')
  440. @include('global._datatables_js')
  441. @stop