No Description

annual_report.blade.php 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  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. Course_and_transformative = '<h3>'+course_code.code + ' '+ course_code.number+'</h3><hr>';
  173. if(course_code.transforming_actions.length){
  174. Course_and_transformative += '<h5> This course was tied to the following transformative actions</h5>';
  175. Course_and_transformative += '<ol>';
  176. $.each(course_code.transforming_actions, function(index, transformative_action){
  177. Course_and_transformative += '<li><p><strong>'+transformative_action.at_text+'</strong>: '+transformative_action.description+'</p></li>'
  178. })
  179. }
  180. div.append(Course_and_transformative)
  181. div.append(table);
  182. table.DataTable();
  183. }
  184. })
  185. }
  186. else{
  187. div.append('<div class="no-outcome alert alert-info"'+
  188. '<p>No Course in plan has assessed yet</p>'+
  189. '</div>')
  190. }
  191. })
  192. theArray =[];
  193. $('#tableOutcome').html(tableStudent);
  194. //tableStudent.appendTo($('#outcomeInfo'));
  195. tableStudent = tableStudent.DataTable({
  196. dom: 'Bfrtip',
  197. buttons: [
  198. 'csv', 'excel', 'pdf', 'print'
  199. ]
  200. });
  201. students_attempted =0;
  202. students_achieved = 0;
  203. $.each(wholeDict, function(key, dict){
  204. if(dict.criteria_attempted){
  205. students_attempted +=1;
  206. percentage = ((dict.criteria_achieved/dict.criteria_attempted)*100).toFixed(2);
  207. if(parseFloat(percentage)>= parseFloat(outcome.expected_outcome)){
  208. achieved = "Yes"
  209. students_achieved +=1;
  210. }
  211. else achieved = "No"
  212. }
  213. else{
  214. percentage = "N/A"
  215. achieved = "N/A"
  216. }
  217. tableStudent.row.add([
  218. dict.student,
  219. dict.criteria_attempted,
  220. dict.criteria_achieved,
  221. percentage,
  222. achieved
  223. ]);
  224. })
  225. tableStudent.draw();
  226. if(students_attempted){
  227. studentPercentage = ((students_achieved/students_attempted) *100).toFixed(2);
  228. if(studentPercentage >= outcome.outcome_program_goal){
  229. FinalReport= "<br><p><strong>The students achieved the Learning Outcome with " +studentPercentage+"% of students achieving.</strong></p>";
  230. }
  231. else{
  232. FinalReport = "<br><p><strong>The students did not achieve the Learning Outcome with " +studentPercentage+"% of students achieving.</strong></p>";
  233. }
  234. }
  235. $("#outcomeInfo").append(FinalReport)
  236. /* table.row.add([
  237. objectivesHTML,
  238. courseshtml,
  239. courseTAhtml
  240. ]);
  241. table.draw();
  242. */
  243. }
  244. else
  245. {
  246. $('table').hide();
  247. }
  248. }
  249. );
  250. }
  251. function posttoTransAnnual(annual_id, selectTransId, typ_course_id){
  252. ta = $("#"+selectTransId).val();
  253. old_ta = $("#"+selectTransId).data('old-TA');
  254. if(ta == "0")return;
  255. $.post("../annual-plan-postTA",
  256. {annual_id : annual_id,
  257. TA_id:ta,
  258. typ_course_id : typ_course_id,
  259. old_ta:old_ta
  260. },
  261. function(message){
  262. $("#"+selectTransId).data('old-TA', ta);
  263. }
  264. )
  265. }
  266. function addTAselect(options, master_div, annual_plan_id, objective_id, typ_course_id, selected_ta){
  267. var $div = $('<div/>', {
  268. 'class': 'form-group '
  269. });
  270. counter = parseInt($('#'+master_div).data('amount-ta'));
  271. var selectTA = $('<select/>',{
  272. 'class': "selectpicker form-control",
  273. 'data-live-search':'true',
  274. 'data-old-TA' :'0',
  275. 'data-width': '180px',
  276. 'id': 'transformativeForObjective'+master_div+'_'+counter,
  277. 'onchange':'posttoTransAnnual('+annual_plan_id+', "transformativeForObjective'+master_div+'_'+counter+'", '+typ_course_id+')'
  278. });
  279. selectTA.append(options);
  280. selectTA.appendTo($div);
  281. selectTA.val(selected_ta);
  282. selectTA.data('old-TA', selected_ta);
  283. selectTA.selectpicker('refresh');
  284. $span = $('<span/>', {
  285. 'id':'close',
  286. 'onclick':' postDeleteTA('+annual_plan_id+', "transformativeForObjective'+master_div+'_'+counter+'", '+typ_course_id+'); this.parentNode.parentNode.removeChild(this.parentNode);return false;'
  287. }).html('x');
  288. $span.appendTo($div);
  289. $div.append("<br><br>");
  290. $('#'+master_div).append("<br>");
  291. $div.appendTo($('#'+master_div));
  292. $('#'+master_div).data('amount-ta', counter+1);
  293. }
  294. function postDeleteTA(annual_id, selectTransId, typ_course_id){
  295. ta = $("#"+selectTransId).val();
  296. if(ta == "0")return;
  297. $.post("../annual-plan-deleteTA",
  298. {annual_id : annual_id,
  299. TA_id:ta,
  300. typ_id : typ_course_id,
  301. }
  302. );
  303. parent = $("#"+selectTransId).parent().parent().parent();
  304. counter = parseInt(parent.data('amount-ta'));
  305. parent.data('amount-ta', counter-1);
  306. }
  307. function postToAnnualPlans(typ_course_id, criteria_select){
  308. var criteria = $('#'+criteria_select).val();
  309. var oldCriteria = $('#'+criteria_select).data('old-criteria');
  310. var criteriaNode = document.getElementById(criteria_select).parentNode.parentNode.parentNode;
  311. var annual = criteriaNode.dataset.annualPlan;
  312. $.post("../annual-plan-postOnChange",
  313. {criteria : criteria,
  314. typ_course_id : typ_course_id,
  315. annual_plan : annual,
  316. old_criteria :oldCriteria
  317. },
  318. function(message){
  319. if(message =="Duplicate entry, please choose another criteria."){
  320. alert(message)
  321. }
  322. else{
  323. $('#'+criteria_select).data('old-criteria', criteria);
  324. changed = true;
  325. }
  326. })
  327. }
  328. function addCriteriaTest(div, new_id_for_select, typ_course_id, i=null, options) {
  329. if(!i) amount_select = $('#'+div).data("amount-select");
  330. else amount_select = i;
  331. $select = $('<select/>',{
  332. 'class': "selectpicker form-control",
  333. 'data-live-search':'true',
  334. 'data-old-criteria' :'0',
  335. 'data-width': '180px',
  336. 'id': 'criteriaFor'+new_id_for_select+'_'+amount_select,
  337. 'onchange':'postToAnnualPlans('+typ_course_id+', "criteriaFor'+new_id_for_select+'_'+amount_select+'")'
  338. })
  339. var $div = $('<div/>', {
  340. 'id': 'courseSelect_' + new_id_for_select +'_'+amount_select,
  341. 'class': 'form-group '
  342. });
  343. $select.append(options);
  344. $select.appendTo($div);
  345. $span = $('<span/>', {
  346. 'id':'close',
  347. 'onclick':' postDelete('+typ_course_id+', "criteriaFor'+new_id_for_select+'_'+amount_select+'"); this.parentNode.parentNode.removeChild(this.parentNode);return false;'
  348. }).html('x');
  349. $div.append($span);
  350. $div.append("<br><br>")
  351. $('#'+div).append("<br>");
  352. $div.appendTo($("#"+div));
  353. $select.selectpicker('refresh');
  354. $("#"+div).data("amount-select", amount_select+1);
  355. }
  356. $('#allOutcomes').hide();
  357. function postDelete(typ_course_id, criteria_select){
  358. var criteria = $('#'+criteria_select).val();
  359. var oldCriteria = $('#'+criteria_select).data('old-criteria');
  360. var criteriaNode = document.getElementById(criteria_select).parentNode.parentNode.parentNode;
  361. var annual = criteriaNode.dataset.annualPlan;
  362. $.post("../annual-plan-deleteCriteria",
  363. {criteria : criteria,
  364. typ_course_id : typ_course_id,
  365. annual_plan : annual,
  366. old_criteria :oldCriteria
  367. });
  368. }
  369. function fetchInfo(id){
  370. annual_id = $("#"+id).val();
  371. program_id = {{$program->id}};
  372. $.post("{{URL::action('AnnualPlansController@fetchInfo')}}",
  373. {
  374. id:annual_id,
  375. program_id:program_id
  376. },
  377. function(json){
  378. div = $('<div/>', {
  379. 'class':'list-group',
  380. 'id':'list'
  381. });
  382. header5 = $('<h5/>', {
  383. 'style':"padding-left: 10px"
  384. }).html("First Semester");
  385. div.append(header5);
  386. list = '';
  387. for(outcome in json.outcomes.first){
  388. 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>";
  389. }
  390. div.append(list);
  391. header4 = $('<h5/>', {
  392. 'style':"padding-left: 10px"
  393. }).html("Second Semester");
  394. div.append(header4);
  395. list = '';
  396. for(outcome in json.outcomes.second){
  397. 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>";
  398. }
  399. div.append(list);
  400. html = div[0].innerHTML;
  401. $("#allOutcomes").html(div[0].innerHTML);
  402. $("#allOutcomes").show();
  403. },
  404. "json",
  405. );
  406. }
  407. function deleteObjective(objectiveSelectDiv, closeObj){
  408. $('#'+objectiveSelectDiv).remove();
  409. $('#'+closeObj).remove();
  410. $('#'+div).data("amount-select", $('#'+div).data("amount-select")-1);
  411. }
  412. </script>
  413. @stop
  414. @section('included-js')
  415. @include('global._datatables_js')
  416. @stop