No Description

annual_report.blade.php 17KB

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