No Description

annual_report.blade.php 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  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. var typ_semester_outcome_id = $(li).data('typ-semester-outcome-id');
  88. $('#theChange').data('annual-plan', annual_plan);
  89. $.post(
  90. "{{ URL::action('AnnualPlansController@fetchReportWithOutcome') }}", {
  91. semester_id: semester_id,
  92. outcome_id: outcome_id,
  93. program_id: {{ $program->id }},
  94. annual_plan_id: annual_plan_id,
  95. typ_semester_outcome_id: typ_semester_outcome_id
  96. },
  97. function(outcome) {
  98. if (outcome.objectives) {
  99. $('table').show();
  100. $('#outcome-display').parent().show();
  101. $('#outcome-display .panel-title').html(name);
  102. $('#allLists').empty();
  103. $('#levelTabs').empty();
  104. $('.no-outcome').hide();
  105. if(outcome.outcome_program_goal){
  106. outcome.outcome_program_goal = outcome.outcome_program_goal.expected_target;
  107. }
  108. else{
  109. outcome.outcome_program_goal ='It has not been defined';
  110. }
  111. var outcomeHTML = "<h4>Performance of Students by Learning Outcome</h4>" +
  112. '<h5 style = "display: inline; margin:30px;">Target learning by learning outcome: </h5>' +
  113. '<p style = "display: inline;"> <i>>= ' + outcome.expected_outcome +
  114. ' of the attempts</i>' + '</p>' +
  115. '<br><h5 style = "display: inline; margin:30px;">Expected percent of students achieving the target by learning outcome: </h5>' +
  116. '<p style = "display: inline;"> <i>' + outcome.outcome_program_goal + '</i></p>';
  117. $('#outcomeInfo').html('<p class="outcome-definition">' + outcome.definition + '</p>' +
  118. outcomeHTML);
  119. //theStudentOutcomeTable = $("<table/>");
  120. //theStudentOutcomeTable.hide();
  121. ///$('#outcomeInfo').append(theStudentOutcomeTable);
  122. wholeDict = {};
  123. tableStudent = $('<table/>', {
  124. 'class': 'table table-striped table-condensed datatable'
  125. });
  126. tableStudent.html('<thead><tr>' +
  127. '<th>Student</th>' +
  128. '<th>Criteria Attempted</th>' +
  129. '<th>Criteria Achieved</th>' +
  130. '<th>Percentage</th>' +
  131. '<th>Outcome Achieved</th>' +
  132. '</tr></thead><tbody></tbody>');
  133. $.each(outcome.objectives, function(index, objective) {
  134. li = $('<li/>', {
  135. 'role': 'presentation'
  136. });
  137. a = $('<a/>', {
  138. 'data-toggle': 'tab',
  139. 'href': '#' + objective.id,
  140. 'role': 'tab'
  141. }).html('Objective ' + (index + 1));
  142. li.append(a);
  143. $('#levelTabs').append(li);
  144. objective_title = "<h3>" + objective.text + '</h3>';
  145. div = $('<div/>', {
  146. 'role': 'tabpanel',
  147. 'class': 'tab-pane',
  148. 'id': objective.id
  149. }).html(objective_title);
  150. div.appendTo($('#allLists'))
  151. if (objective.courses) {
  152. $.each(objective.courses, function(index, course_code) {
  153. if (course_code.criteria.length) {
  154. $.each(course_code.students, function(index, student) {
  155. if (wholeDict[student.student_id] === undefined) {
  156. wholeDict[student.student_id] = {
  157. 'student': student.student_id,
  158. 'criteria_attempted': 0,
  159. 'criteria_achieved': 0
  160. }
  161. }
  162. wholeDict[student.student_id][
  163. "criteria_attempted"] += student
  164. .criteria_attempted;
  165. wholeDict[student.student_id][
  166. "criteria_achieved"] += student
  167. .criteria_achieved;
  168. });
  169. div.append(
  170. '<p>The following results are from the courses in the selected semester with the focused criteria in the selected annual plan</p>'
  171. );
  172. table = $('<table/>', {
  173. 'class': 'table table-striped table-condensed datatable'
  174. }).html('<thead><th>Criterion</th><th>' +
  175. 'Number of Students Assessed </th>' +
  176. '<th>Number of students that achieved the target</th></thead>'
  177. );
  178. tbody = $('<tbody/>')
  179. $.each(course_code.criteria, function(index, criterion) {
  180. tr = $('<tr/>').append(
  181. "<td>" + criterion.name + "</td>" +
  182. "<td>" + criterion.criteria_attempted +
  183. "</td>" +
  184. "<td>" + criterion.criteria_achieved +
  185. "</td>"
  186. );
  187. tbody.append(tr);
  188. });
  189. table.append(tbody);
  190. Course_and_transformative = '<h3>' + course_code.code + ' ' +
  191. course_code.number + '</h3><hr>';
  192. if (course_code.transforming_actions.length) {
  193. Course_and_transformative +=
  194. '<h5> This course was tied to the following transformative actions</h5>';
  195. Course_and_transformative += '<ol>';
  196. $.each(course_code.transforming_actions, function(index,
  197. transformative_action) {
  198. Course_and_transformative += '<li><p><strong>' +
  199. transformative_action.at_text +
  200. '</strong>: ' + transformative_action
  201. .description + '</p></li>'
  202. })
  203. }
  204. div.append(Course_and_transformative)
  205. div.append(table);
  206. table.DataTable();
  207. }
  208. })
  209. } else {
  210. div.append('<div class="no-outcome alert alert-info"' +
  211. '<p>No Course in plan has assessed yet</p>' +
  212. '</div>')
  213. }
  214. })
  215. theArray = [];
  216. $('#tableOutcome').html(tableStudent);
  217. //tableStudent.appendTo($('#outcomeInfo'));
  218. tableStudent = tableStudent.DataTable({
  219. dom: 'Bfrtip',
  220. buttons: [
  221. 'csv', 'excel', 'pdf', 'print'
  222. ]
  223. });
  224. students_attempted = 0;
  225. students_achieved = 0;
  226. $.each(wholeDict, function(key, dict) {
  227. if (dict.criteria_attempted) {
  228. students_attempted += 1;
  229. percentage = ((dict.criteria_achieved / dict.criteria_attempted) * 100).toFixed(
  230. 2);
  231. if (parseFloat(percentage) >= parseFloat(outcome.expected_outcome)) {
  232. achieved = "Yes"
  233. students_achieved += 1;
  234. } else achieved = "No"
  235. } else {
  236. percentage = "N/A"
  237. achieved = "N/A"
  238. }
  239. tableStudent.row.add([
  240. dict.student,
  241. dict.criteria_attempted,
  242. dict.criteria_achieved,
  243. percentage,
  244. achieved
  245. ]);
  246. })
  247. tableStudent.draw();
  248. if (students_attempted) {
  249. studentPercentage = ((students_achieved / students_attempted) * 100).toFixed(2);
  250. if (parseFloat(studentPercentage) >= parseFloat(outcome.outcome_program_goal)) {
  251. FinalReport = "<br><p><strong>The students achieved the Learning Outcome with " +
  252. studentPercentage + "% of students achieving.</strong></p>";
  253. } else {
  254. FinalReport = "<br><p><strong>The students did not achieve the Learning Outcome with " +
  255. studentPercentage + "% of students achieving.</strong></p>";
  256. }
  257. }
  258. $("#outcomeInfo").append(FinalReport)
  259. /* table.row.add([
  260. objectivesHTML,
  261. courseshtml,
  262. courseTAhtml
  263. ]);
  264. table.draw();
  265. */
  266. } else {
  267. $('table').hide();
  268. }
  269. }
  270. );
  271. }
  272. function posttoTransAnnual(annual_id, selectTransId, typ_course_id) {
  273. ta = $("#" + selectTransId).val();
  274. old_ta = $("#" + selectTransId).data('old-TA');
  275. if (ta == "0") return;
  276. $.post("../annual-plan-postTA", {
  277. annual_id: annual_id,
  278. TA_id: ta,
  279. typ_course_id: typ_course_id,
  280. old_ta: old_ta
  281. },
  282. function(message) {
  283. $("#" + selectTransId).data('old-TA', ta);
  284. }
  285. )
  286. }
  287. function addTAselect(options, master_div, annual_plan_id, objective_id, typ_course_id, selected_ta) {
  288. var $div = $('<div/>', {
  289. 'class': 'form-group '
  290. });
  291. counter = parseInt($('#' + master_div).data('amount-ta'));
  292. var selectTA = $('<select/>', {
  293. 'class': "selectpicker form-control",
  294. 'data-live-search': 'true',
  295. 'data-old-TA': '0',
  296. 'data-width': '180px',
  297. 'id': 'transformativeForObjective' + master_div + '_' + counter,
  298. 'onchange': 'posttoTransAnnual(' + annual_plan_id + ', "transformativeForObjective' + master_div +
  299. '_' + counter + '", ' + typ_course_id + ')'
  300. });
  301. selectTA.append(options);
  302. selectTA.appendTo($div);
  303. selectTA.val(selected_ta);
  304. selectTA.data('old-TA', selected_ta);
  305. selectTA.selectpicker('refresh');
  306. $span = $('<span/>', {
  307. 'id': 'close',
  308. 'onclick': ' postDeleteTA(' + annual_plan_id + ', "transformativeForObjective' + master_div + '_' +
  309. counter + '", ' + typ_course_id +
  310. '); this.parentNode.parentNode.removeChild(this.parentNode);return false;'
  311. }).html('x');
  312. $span.appendTo($div);
  313. $div.append("<br><br>");
  314. $('#' + master_div).append("<br>");
  315. $div.appendTo($('#' + master_div));
  316. $('#' + master_div).data('amount-ta', counter + 1);
  317. }
  318. function postDeleteTA(annual_id, selectTransId, typ_course_id) {
  319. ta = $("#" + selectTransId).val();
  320. if (ta == "0") return;
  321. $.post("../annual-plan-deleteTA", {
  322. annual_id: annual_id,
  323. TA_id: ta,
  324. typ_id: typ_course_id,
  325. });
  326. parent = $("#" + selectTransId).parent().parent().parent();
  327. counter = parseInt(parent.data('amount-ta'));
  328. parent.data('amount-ta', counter - 1);
  329. }
  330. function postToAnnualPlans(typ_course_id, criteria_select) {
  331. var criteria = $('#' + criteria_select).val();
  332. var oldCriteria = $('#' + criteria_select).data('old-criteria');
  333. var criteriaNode = document.getElementById(criteria_select).parentNode.parentNode.parentNode;
  334. var annual = criteriaNode.dataset.annualPlan;
  335. $.post("../annual-plan-postOnChange", {
  336. criteria: criteria,
  337. typ_course_id: typ_course_id,
  338. annual_plan: annual,
  339. old_criteria: oldCriteria
  340. },
  341. function(message) {
  342. if (message == "Duplicate entry, please choose another criteria.") {
  343. alert(message)
  344. } else {
  345. $('#' + criteria_select).data('old-criteria', criteria);
  346. changed = true;
  347. }
  348. })
  349. }
  350. function addCriteriaTest(div, new_id_for_select, typ_course_id, i = null, options) {
  351. if (!i) amount_select = $('#' + div).data("amount-select");
  352. else amount_select = i;
  353. $select = $('<select/>', {
  354. 'class': "selectpicker form-control",
  355. 'data-live-search': 'true',
  356. 'data-old-criteria': '0',
  357. 'data-width': '180px',
  358. 'id': 'criteriaFor' + new_id_for_select + '_' + amount_select,
  359. 'onchange': 'postToAnnualPlans(' + typ_course_id + ', "criteriaFor' + new_id_for_select + '_' +
  360. amount_select + '")'
  361. })
  362. var $div = $('<div/>', {
  363. 'id': 'courseSelect_' + new_id_for_select + '_' + amount_select,
  364. 'class': 'form-group '
  365. });
  366. $select.append(options);
  367. $select.appendTo($div);
  368. $span = $('<span/>', {
  369. 'id': 'close',
  370. 'onclick': ' postDelete(' + typ_course_id + ', "criteriaFor' + new_id_for_select + '_' +
  371. amount_select + '"); this.parentNode.parentNode.removeChild(this.parentNode);return false;'
  372. }).html('x');
  373. $div.append($span);
  374. $div.append("<br><br>")
  375. $('#' + div).append("<br>");
  376. $div.appendTo($("#" + div));
  377. $select.selectpicker('refresh');
  378. $("#" + div).data("amount-select", amount_select + 1);
  379. }
  380. $('#allOutcomes').hide();
  381. function postDelete(typ_course_id, criteria_select) {
  382. var criteria = $('#' + criteria_select).val();
  383. var oldCriteria = $('#' + criteria_select).data('old-criteria');
  384. var criteriaNode = document.getElementById(criteria_select).parentNode.parentNode.parentNode;
  385. var annual = criteriaNode.dataset.annualPlan;
  386. $.post("../annual-plan-deleteCriteria", {
  387. criteria: criteria,
  388. typ_course_id: typ_course_id,
  389. annual_plan: annual,
  390. old_criteria: oldCriteria
  391. });
  392. }
  393. function fetchInfo(id) {
  394. annual_id = $("#" + id).val();
  395. program_id = {{ $program->id }};
  396. $.post("{{ URL::action('AnnualPlansController@fetchInfo') }}", {
  397. id: annual_id,
  398. program_id: program_id
  399. },
  400. function(json) {
  401. div = $('<div/>', {
  402. 'class': 'list-group',
  403. 'id': 'list'
  404. });
  405. if(json.outcomes.first){
  406. header5 = $('<h5/>', {
  407. 'style': "padding-left: 10px"
  408. }).html("First Semester");
  409. div.append(header5);
  410. list = '';
  411. for (outcome in json.outcomes.first) {
  412. list +=
  413. "<li style='padding-left: 25px' onclick = 'fetchEverything(this)' data-annual-plan = '" +
  414. json.annual_plans.id + "' data-typ-semester-outcome-id ='"+json.outcomes.first[outcome].typ_semester_outcome_id+"' data-semester-id = '" + json.allSemesterOrder.first.id +
  415. "' data-outcome-id='" + json.outcomes.first[outcome].id + "' data-outcome-name ='" + json
  416. .outcomes.first[outcome].name + "' class='list-group-item' >" + json.outcomes.first[outcome]
  417. .name + " </li>";
  418. }
  419. div.append(list);
  420. }
  421. if(json.outcomes.second){
  422. header4 = $('<h5/>', {
  423. 'style': "padding-left: 10px"
  424. }).html("Second Semester");
  425. div.append(header4);
  426. list = '';
  427. for (outcome in json.outcomes.second) {
  428. list +=
  429. "<li style='padding-left: 25px' onclick = 'fetchEverything(this)' data-annual-plan = '" +
  430. json.annual_plans.id + "' data-typ-semester-outcome-id ='"+json.outcomes.first[outcome].typ_semester_outcome_id+"'data-semester-id = '" + json.allSemesterOrder.second.id +
  431. "' data-outcome-id='" + json.outcomes.second[outcome].id + "' data-outcome-name ='" + json
  432. .outcomes.second[outcome].name + "' class='list-group-item' >" + json.outcomes.second[
  433. outcome].name + " </li>";
  434. }
  435. div.append(list);}
  436. html = div[0].innerHTML;
  437. $("#allOutcomes").html(div[0].innerHTML);
  438. $("#allOutcomes").show();
  439. },
  440. "json",
  441. );
  442. }
  443. function deleteObjective(objectiveSelectDiv, closeObj) {
  444. $('#' + objectiveSelectDiv).remove();
  445. $('#' + closeObj).remove();
  446. $('#' + div).data("amount-select", $('#' + div).data("amount-select") - 1);
  447. }
  448. </script>
  449. @stop
  450. @section('included-js')
  451. @include('global._datatables_js')
  452. @stop