No Description

annual_report.blade.php 54KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294
  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. <li role = "presentation" id = 'transformative_for_outcome'>
  44. <a data-toggle="tab" id="a_for_ta_outcome" href="#transformative_actions" role="tab" aria-expanded="true">Transformative Actions</a>
  45. </li>
  46. </ul>
  47. <div id="allLists" class="tab-content">
  48. <div role="tabpanel" class="tab-pane active" id="transformative_actions">
  49. </div>
  50. </div>
  51. <!-- <div class="table-responsive">
  52. <table class="table table-striped table-condensed datatable" style="table-layout: fixed ; width : 100%">
  53. <thead><tr><th>Objectives for courses</th><th>Criteria per Course</th><th>Transformative Actions</th></tr></thead>
  54. <tbody>
  55. </tbody>
  56. </table>
  57. </div>-->
  58. </div>
  59. </div>
  60. </div>
  61. <div class="col-md-9">
  62. <div class="no-outcome alert alert-info">
  63. <p>Select a Learning Outcome to view its information</p>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="modal fade" id="modal-status-trans">
  68. <div class="modal-dialog modal-lg">
  69. <div class="modal-content">
  70. <div class="modal-header">
  71. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
  72. aria-hidden="true">&times;</span></button>
  73. <h3 id ='transformative_modal_title' class="modal-title"></h3>
  74. </div>
  75. <div class="modal-body">
  76. <h5 id="was_it_implemented"> </h5>
  77. <label class="radio-inline">
  78. <input type="radio" name="implemented" value = "1">Yes</label>
  79. <label class="radio-inline">
  80. <input type="radio" name="implemented" value = "0">No</label>
  81. <br>
  82. <div id='useful_radio_div'>
  83. <h5>Was this transformative action helpful to achieve the learning expectation?</h5>
  84. <label class="radio-inline">
  85. <input type="radio" name="useful" value = "1">Yes</label>
  86. <label class="radio-inline">
  87. <input type="radio" name="useful" value = "0">No</label>
  88. </div>
  89. <br>
  90. <div id='comment_div'>
  91. <label id="implement_textarea" for='comments'></label>
  92. <textarea class="form-control" id='comments'>
  93. </textarea>
  94. </div>
  95. </div>
  96. <div class='modal-footer'>
  97. <button type="button" class="btn btn-secondary" data-dismiss="modal" >Cancel</button>
  98. <button type="button" class="btn btn-primary" id ="save_transformative_info" onclick ='saveTransReport()'>Save</button>
  99. </div><!-- /.modal-content -->
  100. </div><!-- /.modal-dialog -->
  101. </div><!-- /.modal -->
  102. <div class="modal fade" id="modal-future-trans-course">
  103. <div class="modal-dialog modal-lg">
  104. <div class="modal-content">
  105. <div class="modal-header">
  106. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
  107. aria-hidden="true">&times;</span></button>
  108. <h3 class="modal-title"></h3>
  109. </div>
  110. <div class="modal-body">
  111. </div>
  112. <div class='modal-footer'>
  113. <button type="button" class="btn btn-secondary" data-dismiss="modal" >Cancel</button>
  114. <button type="button" class="btn btn-primary" id ="save_transformative_info" onclick ='saveTransReport()'>Save</button>
  115. </div>
  116. </div><!-- /.modal-content -->
  117. </div><!-- /.modal-dialog -->
  118. </div><!-- /.modal -->
  119. <script>
  120. function nextChar(c) {
  121. return String.fromCharCode(c.charCodeAt(0) + 1);
  122. }
  123. changed = false;
  124. $(document).ready(function() {
  125. // --------------------------------------------------------------------------
  126. // Page load
  127. // --------------------------------------------------------------------------
  128. $('#comment_div').hide();
  129. $('input[name="implemented"]').change(function(){
  130. //was implemented
  131. if(!parseInt($(this).val())){
  132. $('#useful_radio_div').hide();
  133. $('#comment_div').show();
  134. $('#comments').val(' ');
  135. $('#implement_textarea').html("Explain briefly why this transformative action was not implemented");
  136. }
  137. else{
  138. $('#useful_radio_div').show();
  139. $('#comment_div').show();
  140. $('#implement_textarea').html("Explain briefly details about the implementation of this transformative action");
  141. }
  142. })
  143. // Hide accordion panel contents by default
  144. $('.panel-group .panel-body').hide();
  145. $('#outcome-display').parent().hide();
  146. });
  147. function draw_comment_section(typ_semester_outcome_id, outcome_comments){
  148. $('#levelTabs').append('<li role = "presentation" id = "comments_for_outcome">'+
  149. '<a data-toggle="tab" id="a_for_ta_outcome" href="#comments_outcome" role="tab" >Comments for Outcome</a>'+
  150. '</li>');
  151. $('#allLists').append('<div role="tabpanel" class="tab-pane" data-typ-semester-outcome-id = "'+typ_semester_outcome_id+'" id="comments_outcome"></div>');
  152. button_for_adding_comments = $('<button>', {
  153. 'class':'btn btn-secondary',
  154. 'id':'add_comments_button',
  155. 'style':'float: right',
  156. 'onclick': 'add_comments_to_plan()'
  157. }).html("<span class='glyphicon glyphicon-plus'></span> Add Comments");
  158. $('#comments_outcome').append('<h3>Comments</h3>')
  159. if(outcome_comments.length){
  160. table_for_comments = $('<table>',{
  161. 'class':'table table-striped table-condensed datatable',
  162. 'id':'table_for_comments'
  163. }).html('<thead><th>Comments</th><th>Edit or Delete</th></thead><tbody></tbody>');
  164. table_for_comments.appendTo('#comments_outcome');
  165. table_for_comments = table_for_comments.DataTable();
  166. $.each(outcome_comments, function(index, comment){
  167. comment_td = '<div id="comments_id_'+comment.id+'">'+comment.comments+'</div>';
  168. inputEdit = $('<input>', {
  169. 'type': 'button',
  170. 'class': 'btn btn-secondary',
  171. 'onclick': 'add_comments_to_plan('+comment.id+')',
  172. 'id': 'edit_button_comment_' + comment.id,
  173. 'value': 'Edit'
  174. }).html('Edit');
  175. inputDelete = $('<input>', {
  176. 'type': 'button',
  177. 'class': 'btn btn-primary',
  178. 'style': 'display: inline',
  179. 'onclick': 'deleteCommentsFromOutcome('+comment.id+')',
  180. 'value': 'Delete'
  181. })
  182. div = $('<div>');
  183. div.append(inputEdit);
  184. div.append(inputDelete);
  185. table_for_comments.row.add([
  186. comment_td,
  187. div.html()
  188. ]).draw();
  189. });
  190. }
  191. $('#comments_outcome').append('<hr>');
  192. $('#comments_outcome').append(button_for_adding_comments);
  193. }
  194. function add_comments_to_plan(edit_id = null){
  195. $('#add_comments_button').hide();
  196. div_for_inputs = $('<div>', {
  197. 'id':'add_comment_div'
  198. });
  199. textarea = $('<textarea>',{
  200. 'class':'form-control',
  201. 'data-comment-id':edit_id,
  202. 'id':'comment_textbox'
  203. });
  204. if(edit_id){
  205. textarea.val($("#comments_id_"+edit_id).html());
  206. }
  207. save_button = $('<button>', {
  208. 'class':'btn btn-primary',
  209. 'onclick':'saveComment()',
  210. 'style':'float: right'
  211. }).html('Save');
  212. $('#comments_outcome').append(div_for_inputs);
  213. div_for_inputs.append('<h5>Add new comment</h5>');
  214. div_for_inputs.append(textarea);
  215. div_for_inputs.append(save_button);
  216. }
  217. function saveComment(){
  218. typ_outcome_semester_id = $("#comments_outcome").data('typ-semester-outcome-id');
  219. comment_area = $('#comment_textbox');
  220. $.post(
  221. "{{URL::action('AnnualPlansController@addCommentsToOutcome')}}",
  222. {
  223. typ_outcome_semester_id:typ_outcome_semester_id,
  224. comments:comment_area.val(),
  225. edit_id:comment_area.data('comment-id')
  226. },
  227. function(edit_id){
  228. $('#add_comment_div').remove();
  229. $('#add_comments_button').show();
  230. if($('#comments_id_'+edit_id).length){
  231. $('#comments_id_'+edit_id).html(comment_area.val());
  232. }
  233. else{
  234. table_for_comments = $('#table_for_comments').DataTable();
  235. comment_td = '<div id="comments_id_'+edit_id+'">'+comment_area.val()+'</div>';
  236. inputEdit = $('<input>', {
  237. 'type': 'button',
  238. 'class': 'btn btn-secondary',
  239. 'onclick': 'add_comments_to_plan('+edit_id+')',
  240. 'id': 'edit_button_comment_' + edit_id,
  241. 'value': 'Edit'
  242. }).html('Edit');
  243. inputDelete = $('<input>', {
  244. 'type': 'button',
  245. 'class': 'btn btn-primary',
  246. 'style': 'display: inline',
  247. 'onclick': 'deleteCommentsFromOutcome('+edit_id+')',
  248. 'value': 'Delete'
  249. })
  250. div = $('<div>');
  251. div.append(inputEdit);
  252. div.append(inputDelete);
  253. table_for_comments.row.add([
  254. comment_td,
  255. div.html()
  256. ]).draw();
  257. }
  258. }
  259. )
  260. }
  261. function deleteCommentsFromOutcome(id){
  262. $.post(
  263. "{{URL::action('AnnualPlansController@deleteCommentsFromOutcome')}}",
  264. {id:id},
  265. function(){
  266. $('#comments_id_'+id).parent().parent().remove();
  267. }
  268. )
  269. }
  270. // Create everything
  271. function draw_transformative_actions(transforming_actions, semester_id){
  272. if(!transforming_actions.length){
  273. $("#transformative_for_outcome").hide();
  274. }
  275. else{
  276. $('#levelTabs').prepend('<li role = "presentation" id = "transformative_for_outcome">'+
  277. '<a data-toggle="tab" id="a_for_ta_outcome" href="#transformative_actions" role="tab" >Transformative Actions to Outcome</a>'+
  278. '</li>');
  279. $('#allLists').prepend('<div role="tabpanel" class="tab-pane" id="transformative_actions"></div>');
  280. $('#transformative_actions').html('<h3>Tranformative actions for Learning Outcome')
  281. $.each(transforming_actions, function(index, trans_action){
  282. div = $("<div>", {
  283. 'id':'div_trans_id_'+trans_action.trans_id
  284. }).html('<p><strong>'+(index+1)+'. '+trans_action.at_text+': </strong>'+trans_action.description+'</p>'+
  285. '<p><strong>Category: </strong> '+trans_action.type_of_TA+'</p>');
  286. div.append('<label>Results: </label>')
  287. input_results = $("<textarea>", {
  288. 'class':'form-control',
  289. 'id':'results_for_'+trans_action.trans_id
  290. });
  291. div.append(input_results)
  292. div.append('<h5>Was this transformative action helpful to achieve the learning expectation?</h5>'+
  293. '<label class="radio-inline">'+
  294. '<input type="radio" name="useful_for_'+trans_action.trans_id+'" value = "1">Yes</label>'+
  295. '<label class="radio-inline">'+
  296. '<input type="radio" name="useful_for_'+trans_action.trans_id+'" value = "0">No</label>');
  297. comments = $('<textarea>',{
  298. 'id':'comments_for_'+trans_action.trans_id,
  299. 'class':'form-control'
  300. });
  301. div.append('<br><label>Explain briefly details about the implementation</label>');
  302. div.append(comments);
  303. button = $('<button>',{
  304. "type":"button",
  305. "class":"btn btn-primary",
  306. "onclick":'saveTransReport('+trans_action.trans_id+', '+semester_id+')',
  307. 'style':'float: right'
  308. }).html('Save');
  309. div.append('<br>');
  310. div.append(button);
  311. div.append('<br>');
  312. div.append('<hr>');
  313. $('#transformative_actions').append(div);
  314. $('#results_for_'+trans_action.trans_id).val(trans_action.results);
  315. $('#comments_for_'+trans_action.trans_id).val(trans_action.comments);
  316. $('input[name="useful_for_'+trans_action.trans_id+'"][value="'+trans_action.it_was_useful + '"]').prop('checked', true);
  317. })
  318. }
  319. }
  320. function draw_transformative_future_course(course_code){
  321. /* This is the modal
  322. <div class="modal fade" id="modal-future-trans-course">
  323. <div class="modal-dialog modal-lg">
  324. <div class="modal-content">
  325. <div class="modal-header">
  326. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
  327. aria-hidden="true">&times;</span></button>
  328. <h3 class="modal-title"></h3>
  329. </div>
  330. <div class="modal-body">
  331. </div>
  332. <div class='modal-footer'>
  333. <button type="button" class="btn btn-secondary" data-dismiss="modal" >Cancel</button>
  334. <button type="button" class="btn btn-primary" id ="save_transformative_info" onclick ='saveTransReport()'>Save</button>
  335. </div>
  336. </div><!-- /.modal-content -->
  337. </div><!-- /.modal-dialog -->
  338. </div><!-- /.modal --> */
  339. return_complete_div = $('<div>');
  340. typ_semester_course_id = course_code.typ_semester_course_id;
  341. modalComplete = $('<div>',{
  342. 'class':'modal fade',
  343. 'id':'modal_for_future_trans_on_'+typ_semester_course_id
  344. });
  345. modalDialog = $('<div>',{
  346. 'class':'modal-dialog modal-lg'
  347. });
  348. modalComplete.append(modalDialog);
  349. modalContent = $('<div>',{
  350. 'class':'modal-content'
  351. });
  352. modalDialog.append(modalContent);
  353. modalHeader = $('<div>', {
  354. 'class':'modal-header'
  355. }).html('<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+
  356. '<h3 class="modal-title">Future Transformative Actions for '+course_code.code+' '+course_code.number+'</h3>');
  357. modalContent.append(modalHeader);
  358. modalBody = $('<div>', {
  359. 'class':'modal-body'
  360. });
  361. modalContent.append(modalBody);
  362. div_for_name = $('<div>', {
  363. 'class': 'form-group',
  364. });
  365. input_name = $('<input>', {
  366. 'class': 'form-control',
  367. 'name': 'at_text',
  368. 'id': 'at_text_for_'+typ_semester_course_id
  369. });
  370. div_for_name.html("<label> Name</label>");
  371. div_for_name.append(input_name);
  372. modalBody.append(div_for_name);
  373. div_for_category = $('<div>', {
  374. 'class': 'form-group'
  375. }).html('<label>Type of Transformative Action</label>');
  376. select_for_category = $('<select>', {
  377. 'name': 'type_of_ta',
  378. 'id': 'type_of_ta_of_'+typ_semester_course_id,
  379. 'class': 'form-control selectpicker',
  380. 'onchange': 'checkIfNew(this)'
  381. }).html(GlobalTransCategories);
  382. div_for_category.append(select_for_category);
  383. modalBody.append(select_for_category);
  384. div_description = $('<div>', {
  385. 'class': 'form-group',
  386. }).html('<label> Description</label>');
  387. textarea = $('<textarea>', {
  388. 'class': 'form-control',
  389. 'id': 'description_for_'+typ_semester_course_id,
  390. 'name': 'description',
  391. 'rows': '10'
  392. });
  393. div_description.append(textarea);
  394. modalBody.append(div_description);
  395. modalBody.append('<hr><label>Select when will this transformative action will be implemeneted</label>');
  396. selectpicker_for_semesters = $('<select>',{
  397. 'name':'selected_semesters_for_'+typ_semester_course_id+'_[]',
  398. 'id':'selected_semester_first_for_'+typ_semester_course_id,
  399. 'class':'form-control selectpicker'
  400. });
  401. options_for_semesters='<option value = "0">Nothing Selected</option>';
  402. $.each(course_code.future_typ_course_id, function(index, typ_future){
  403. options_for_semesters +='<option value="'+typ_future.typ_future_course_id+'" data-semester-id ="'+typ_future.semester_id+'" data-objective-id = "'+typ_future.objective_id+'" >'+typ_future.semester_name+' ['+typ_future.semester_code+'] '+'</option>';
  404. });
  405. selectpicker_for_semesters.html(options_for_semesters);
  406. modalBody.append(selectpicker_for_semesters);
  407. modalBody.append('<br><br>');
  408. button_for_more = $('<button>', {
  409. 'class':'btn btn-secondary',
  410. 'onclick':'addMoreSemesters('+typ_semester_course_id+', this)',
  411. 'style':'float:right'
  412. }).html('<span class="glyphicon glyphicon-plus">'+
  413. '</span>Add another semester');
  414. modalBody.append(button_for_more);
  415. modalBody.append('<br><br>');
  416. modalFooter = $('<div>',{
  417. 'class':'modal-footer'
  418. });
  419. modalContent.append(modalFooter);
  420. close_button = $('<button>',{
  421. 'type':'button',
  422. 'class':'btn btn-secondary',
  423. 'data-dismiss':'modal'
  424. }).html('Cancel');
  425. save_button = $('<button>',{
  426. 'class':'btn btn-primary',
  427. 'onclick':'saveFutureTrans('+typ_semester_course_id+', "'+course_code.code+'", "'+course_code.number+'")'
  428. }).html('Save');
  429. modalFooter.append(close_button);
  430. modalFooter.append(save_button);
  431. return_complete_div.append(modalComplete);
  432. return_complete_div.append('<h3>Future Transformative Actions for '+course_code.code+' '+course_code.number);
  433. return_complete_div.append('<hr><button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#modal_for_future_trans_on_'+typ_semester_course_id+'">' +
  434. 'Add Transformative Actions' +
  435. '</button><hr>')
  436. return return_complete_div;
  437. }
  438. function saveFutureTrans(typ_semester_course_id, course_code, course_number){
  439. annual_plan_id = $('#annual_plan').val()
  440. at_text = $('#at_text_for_'+typ_semester_course_id).val();
  441. type_of_TA = $('#type_of_ta_of_'+typ_semester_course_id).val();
  442. is_custom = $('#type_of_ta_of_'+typ_semester_course_id).find('option:selected').data('is-custom');
  443. if(type_of_TA == "new"){
  444. type_of_TA = $('#new_type_type_of_ta_of_'+typ_semester_course_id).val();
  445. is_custom = 1;
  446. }
  447. description = $('#description_for_'+typ_semester_course_id).val();
  448. future_typ_course_id =[];
  449. future_semesters = [];
  450. objective_id =0
  451. $.each($('select[name="selected_semesters_for_'+typ_semester_course_id+'_[]"]'), function(index, select){
  452. objective_id = $(select).find('option:selected').data('objective-id');
  453. future_semesters.push($(select).find('option:selected').data('semester-id'));
  454. future_typ_course_id.push($(select).val());
  455. });
  456. $.post(
  457. "{{URL::action('AnnualPlansController@futureTransformative')}}",
  458. {
  459. at_text:at_text,
  460. type_of_TA:type_of_TA,
  461. description:description,
  462. future_semesters:future_semesters,
  463. future_typ_course_id:future_typ_course_id,
  464. is_custom:is_custom,
  465. program_id:{{$program->id}},
  466. annual_plan_id:annual_plan_id,
  467. course_code:course_code,
  468. course_number:course_number,
  469. objective_id:objective_id
  470. },
  471. function(data){
  472. alert('estamos');
  473. }
  474. )
  475. }
  476. function addMoreSemesters(typ_semester_course_id, button_add_new_semester){
  477. first_select_options = $('#selected_semester_first_for_'+typ_semester_course_id).html();
  478. /*<div class="input-group">
  479. <select class="form-control">
  480. <option>Select option..</option>
  481. <option>Option 1</option>
  482. <option>Option 2</option>
  483. </select>
  484. <span class="input-group-btn">
  485. <button class="btn btn-default" type="button" tabindex="-1"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
  486. </span>
  487. </div> */
  488. input_group = $('<div>', {
  489. 'class':'input-group'
  490. });
  491. newselect = $('<select>',{
  492. 'name':'selected_semesters_for_'+typ_semester_course_id+'_[]',
  493. //'id':'selected_semester_first_for_'+typ_semester_course_id,
  494. 'class':'form-control selectpicker'
  495. }).html(first_select_options);
  496. span_group = $("<span>",{
  497. 'class':'input-group-btn',
  498. });
  499. button_for_close = $('<button>',{
  500. 'class':'btn btn-primary',
  501. 'type':'button',
  502. 'onclick': '$(this).parent().parent().remove()'
  503. }).html('<span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>');
  504. span_group.append(button_for_close);
  505. input_group.append(newselect);
  506. input_group.append(span_group);
  507. input_group.insertBefore($(button_add_new_semester));
  508. //input_group.prepend('<hr>');
  509. $('.selectpicker').selectpicker('refresh');
  510. }
  511. function checkIfNew(select) {
  512. id =$(select).attr('id');
  513. if ($(select).val() == "new") {
  514. var new_div = $('<div/>', {
  515. 'class': 'form-group new_type'
  516. }).html("<label>New Type </label>");
  517. var input = $("<input/>", {
  518. 'type': 'text',
  519. 'id': 'new_type_'+id,
  520. 'name': "new_type",
  521. 'class': 'form-control'
  522. });
  523. new_div.append(input);
  524. $(select).parent().after(new_div)
  525. } else {
  526. $(select).parent().next('.new_type').remove();
  527. }
  528. }
  529. GlobalTransCategories= '';
  530. function fetchEverything(li) {
  531. var outcome_id = $(li).data('outcome-id');
  532. var name = $(li).data('outcome-name');
  533. var semester_id = $(li).data('semester-id');
  534. var annual_plan_id = $(li).data('annual-plan');
  535. var typ_semester_outcome_id = $(li).data('typ-semester-outcome-id');
  536. $('#theChange').data('annual-plan', annual_plan);
  537. $.post(
  538. "{{ URL::action('AnnualPlansController@fetchReportWithOutcome') }}", {
  539. semester_id: semester_id,
  540. outcome_id: outcome_id,
  541. program_id: {{ $program->id }},
  542. annual_plan_id: annual_plan_id,
  543. typ_semester_outcome_id: typ_semester_outcome_id
  544. },
  545. function(outcome) {
  546. if (outcome.objectives) {
  547. $('table').show();
  548. $('#outcome-display').parent().show();
  549. $('#outcome-display .panel-title').html(name);
  550. $('#allLists').empty();
  551. $('#levelTabs').empty();
  552. $('.no-outcome').hide();
  553. if (outcome.outcome_program_goal) {
  554. outcome.outcome_program_goal = outcome.outcome_program_goal.expected_target;
  555. } else {
  556. outcome.outcome_program_goal = 'It has not been defined';
  557. }
  558. GlobalTransCategories = outcome.transformative_actions_categories_html;
  559. var outcomeHTML = "<h4>Performance of Students by Learning Outcome</h4>" +
  560. '<h5 style = "display: inline; margin:30px;">Target learning by learning outcome: </h5>' +
  561. '<p style = "display: inline;"> <i>>= ' + outcome.expected_outcome +
  562. ' of the attempts</i>' + '</p>' +
  563. '<br><h5 style = "display: inline; margin:30px;">Expected percent of students achieving the target by learning outcome: </h5>' +
  564. '<p style = "display: inline;"> <i>' + outcome.outcome_program_goal + '</i></p>';
  565. $('#outcomeInfo').html('<p class="outcome-definition">' + outcome.definition + '</p>' +
  566. outcomeHTML);
  567. //theStudentOutcomeTable = $("<table/>");
  568. //theStudentOutcomeTable.hide();
  569. ///$('#outcomeInfo').append(theStudentOutcomeTable);
  570. wholeDict = {};
  571. tableStudent = $('<table/>', {
  572. 'class': 'table table-striped table-condensed datatable'
  573. });
  574. tableStudent.html('<thead><tr>' +
  575. '<th>Student</th>' +
  576. '<th>Criteria Attempted</th>' +
  577. '<th>Criteria Achieved</th>' +
  578. '<th>Percentage</th>' +
  579. '<th>Outcome Achieved</th>' +
  580. '</tr></thead><tbody></tbody>');
  581. first_objective_id = outcome.objectives[0].id;
  582. $.each(outcome.objectives, function(index, objective) {
  583. li = $('<li/>', {
  584. 'role': 'presentation',
  585. 'id':'li_for_'+objective.id
  586. });
  587. a = $('<a/>', {
  588. 'data-toggle': 'tab',
  589. 'id': 'a_for_'+objective.id,
  590. 'href': '#' + objective.id,
  591. 'role': 'tab'
  592. }).html('Objective ' + (index + 1));
  593. li.append(a);
  594. $('#levelTabs').append(li);
  595. objective_title = "<h3>" + objective.text + '</h3>';
  596. div = $('<div/>', {
  597. 'role': 'tabpanel',
  598. 'class': 'tab-pane',
  599. 'id': objective.id
  600. }).html(objective_title);
  601. div.appendTo($('#allLists'))
  602. div.append(
  603. '<p>The following results are from the courses in the selected semester with the focused criteria in the selected annual plan</p>'
  604. );
  605. if (objective.courses) {
  606. $.each(objective.courses, function(index, course_code) {
  607. if (course_code.criteria.length) {
  608. $.each(course_code.students, function(index, student) {
  609. if (wholeDict[student.student_id] === undefined) {
  610. wholeDict[student.student_id] = {
  611. 'student': student.student_id,
  612. 'criteria_attempted': 0,
  613. 'criteria_achieved': 0
  614. }
  615. }
  616. wholeDict[student.student_id][
  617. "criteria_attempted"
  618. ] += student
  619. .criteria_attempted;
  620. wholeDict[student.student_id][
  621. "criteria_achieved"
  622. ] += student
  623. .criteria_achieved;
  624. });
  625. /*div.append(
  626. '<p>The following results are from the courses in the selected semester with the focused criteria in the selected annual plan</p>'
  627. );*/
  628. table = $('<table/>', {
  629. 'class': 'table table-striped table-condensed datatable'
  630. }).html('<thead><th>Criterion</th><th>' +
  631. 'Number of Students Assessed </th>' +
  632. '<th>Number of students that achieved the target</th></thead>'
  633. );
  634. tbody = $('<tbody/>')
  635. $.each(course_code.criteria, function(index, criterion) {
  636. tr = $('<tr/>').append(
  637. "<td>" + criterion.name + "</td>" +
  638. "<td>" + criterion.criteria_attempted +
  639. "</td>" +
  640. "<td>" + criterion.criteria_achieved +
  641. "</td>"
  642. );
  643. tbody.append(tr);
  644. });
  645. table.append(tbody);
  646. Course_section = '<h3>' + course_code.code + ' ' +
  647. course_code.number + '</h3><hr>';
  648. div.append(Course_section)
  649. div.append('<h4> Criteria Assessed in '+course_code.code+' '+course_code.number+'</h4>')
  650. div.append(table);
  651. if (course_code.transforming_actions.length) {
  652. table_for_transformative_actions = $('<table>',{
  653. 'class': 'table table-striped table-condensed datatable'
  654. }).html('<thead><th>Transformative Actions Proposed in Annual Plan</th>' +
  655. '<th>Follow up </th>' +
  656. '</thead>'
  657. );
  658. tbody_for_transformative_actions = $('<tbody>');
  659. $.each(course_code.transforming_actions, function(index,
  660. transformative_action) {
  661. button_for_followup = $('<button>',{
  662. 'class':'btn btn-secondary',
  663. 'onclick':'give_follow_up_questions('+transformative_action.id+', "'+outcome.semester_info.code+'", '+outcome.semester_info.id+')'
  664. }).html('Follow Up Questions');
  665. table_row = "<tr>"+
  666. '<td><p><strong>'+transformative_action.at_text +': </strong>'+
  667. transformative_action.description+'</p></td>'+
  668. '<td>'+button_for_followup.prop('outerHTML')+'</td></tr>';
  669. tbody_for_transformative_actions.append(table_row)
  670. })
  671. table_for_transformative_actions.append(tbody_for_transformative_actions);
  672. div.append('<hr><h4>Transformative actions for '+course_code.code+' '+course_code.number+'</h4>')
  673. div.append(table_for_transformative_actions);
  674. div.append('<hr>');
  675. //table_for_transformative_actions.DataTable();
  676. }
  677. the_drawn_transformative_future_html = draw_transformative_future_course(course_code, outcome.transformative_actions_categories_html);
  678. div.append(the_drawn_transformative_future_html);
  679. $('.selectpicker').selectpicker('refresh');
  680. table.DataTable();
  681. }
  682. })
  683. } else {
  684. div.append('<div class="no-outcome alert alert-info"' +
  685. '<p>No Course in plan has assessed yet</p>' +
  686. '</div>')
  687. }
  688. })
  689. draw_transformative_actions(outcome.transforming_actions, outcome.semester_info.id)
  690. draw_comment_section(typ_semester_outcome_id, outcome.comments);
  691. //$('#a_for_'+first_objective_id).click();
  692. theArray = [];
  693. $('#tableOutcome').html(tableStudent);
  694. //tableStudent.appendTo($('#outcomeInfo'));
  695. tableStudent = tableStudent.DataTable({
  696. dom: 'Bfrtip',
  697. buttons: [
  698. 'csv', 'excel', 'pdf', 'print'
  699. ]
  700. });
  701. students_attempted = 0;
  702. students_achieved = 0;
  703. $.each(wholeDict, function(key, dict) {
  704. if (dict.criteria_attempted) {
  705. students_attempted += 1;
  706. percentage = ((dict.criteria_achieved / dict.criteria_attempted) * 100).toFixed(
  707. 2);
  708. if (parseFloat(percentage) >= parseFloat(outcome.expected_outcome)) {
  709. achieved = "Yes"
  710. students_achieved += 1;
  711. } else achieved = "No"
  712. } else {
  713. percentage = "N/A"
  714. achieved = "N/A"
  715. }
  716. tableStudent.row.add([
  717. dict.student,
  718. dict.criteria_attempted,
  719. dict.criteria_achieved,
  720. percentage,
  721. achieved
  722. ]);
  723. })
  724. tableStudent.draw();
  725. if (students_attempted) {
  726. studentPercentage = ((students_achieved / students_attempted) * 100).toFixed(2);
  727. if (parseFloat(studentPercentage) >= parseFloat(outcome.outcome_program_goal)) {
  728. FinalReport = "<br><p><strong>The students achieved the Learning Outcome with " +
  729. studentPercentage + "% of students achieving.</strong></p>";
  730. } else {
  731. FinalReport = "<br><p><strong>The students did not achieve the Learning Outcome with " +
  732. studentPercentage + "% of students achieving.</strong></p>";
  733. }
  734. }
  735. $("#outcomeInfo").append(FinalReport)
  736. /* table.row.add([
  737. objectivesHTML,
  738. courseshtml,
  739. courseTAhtml
  740. ]);
  741. table.draw();
  742. */
  743. } else {
  744. $('table').hide();
  745. }
  746. }
  747. );
  748. }
  749. function give_follow_up_questions(trans_id, semester_code, semester_id){
  750. $.ajax({
  751. type: 'POST',
  752. url: "{{ URL::action('TransformativeActionsController@fetchStatus') }}",
  753. data: {
  754. trans_id:trans_id,
  755. semester_id:semester_id
  756. },
  757. success: function(transformative_action_with_status) {
  758. transformative_action = transformative_action_with_status[0];
  759. $('#transformative_modal_title').html('<strong>'+transformative_action.at_text+'</strong>: '+transformative_action.description);
  760. $('input[name="implemented"]').prop('checked',false);
  761. $('input[name="useful"]').prop('checked',false);
  762. $('#comments').val(' ');
  763. $('#useful_radio_div').hide();
  764. $('#comment_div').hide();
  765. if(transformative_action['status']){
  766. transformative_action['status'].accomplished;
  767. $('input[name="implemented"][value="'+ transformative_action['status'].accomplished + '"]').prop('checked', true);
  768. if(transformative_action['status'].accomplished){
  769. $('#useful_radio_div').show();
  770. $('input[name="useful"][value="'+ transformative_action['status'].it_was_useful + '"]').prop('checked', true);
  771. }
  772. $('#comment_div').show();
  773. $('#comments').val(transformative_action['status'].comments);
  774. }
  775. $('#was_it_implemented').html('Was this transformative action implemented during Semester '+semester_code);
  776. $('#modal-status-trans').modal();
  777. $('#save_transformative_info').attr('onclick', 'saveTransReport('+trans_id+','+semester_id+',"modal")');
  778. },
  779. async: true
  780. });
  781. }
  782. function saveTransReport(trans_id, semester_id, type_of_input){
  783. if(type_of_input=='modal'){
  784. comments = $('#comments').val();
  785. accomplished = parseInt($('input[name="implemented"]:checked').val());
  786. if(accomplished)
  787. was_it_useful = $('input[name="useful"]:checked').val();
  788. else was_it_useful =0;
  789. results = "";
  790. }
  791. else{
  792. comments = $('#comments_for_'+trans_id).val();
  793. accomplished = 1;
  794. was_it_useful = $('input[name="useful_for_'+trans_id+'"]:checked').val();
  795. results = $('#results_for_'+trans_id).val();
  796. }
  797. $.post(
  798. "{{URL::action('TransformativeActionsController@saveTransStatus')}}",
  799. {
  800. semester_id:semester_id,
  801. trans_id:trans_id,
  802. results:results,
  803. comments:comments,
  804. accomplished:accomplished,
  805. was_it_useful:was_it_useful,
  806. },
  807. function(message){
  808. alert(message);
  809. }
  810. )
  811. }
  812. function posttoTransAnnual(annual_id, selectTransId, typ_course_id) {
  813. ta = $("#" + selectTransId).val();
  814. old_ta = $("#" + selectTransId).data('old-TA');
  815. if (ta == "0") return;
  816. $.post("../annual-plan-postTA", {
  817. annual_id: annual_id,
  818. TA_id: ta,
  819. typ_course_id: typ_course_id,
  820. old_ta: old_ta
  821. },
  822. function(message) {
  823. $("#" + selectTransId).data('old-TA', ta);
  824. }
  825. )
  826. }
  827. function addTAselect(options, master_div, annual_plan_id, objective_id, typ_course_id, selected_ta) {
  828. var $div = $('<div/>', {
  829. 'class': 'form-group '
  830. });
  831. counter = parseInt($('#' + master_div).data('amount-ta'));
  832. var selectTA = $('<select/>', {
  833. 'class': "selectpicker form-control",
  834. 'data-live-search': 'true',
  835. 'data-old-TA': '0',
  836. 'data-width': '180px',
  837. 'id': 'transformativeForObjective' + master_div + '_' + counter,
  838. 'onchange': 'posttoTransAnnual(' + annual_plan_id + ', "transformativeForObjective' + master_div +
  839. '_' + counter + '", ' + typ_course_id + ')'
  840. });
  841. selectTA.append(options);
  842. selectTA.appendTo($div);
  843. selectTA.val(selected_ta);
  844. selectTA.data('old-TA', selected_ta);
  845. selectTA.selectpicker('refresh');
  846. $span = $('<span/>', {
  847. 'id': 'close',
  848. 'onclick': ' postDeleteTA(' + annual_plan_id + ', "transformativeForObjective' + master_div + '_' +
  849. counter + '", ' + typ_course_id +
  850. '); this.parentNode.parentNode.removeChild(this.parentNode);return false;'
  851. }).html('x');
  852. $span.appendTo($div);
  853. $div.append("<br><br>");
  854. $('#' + master_div).append("<br>");
  855. $div.appendTo($('#' + master_div));
  856. $('#' + master_div).data('amount-ta', counter + 1);
  857. }
  858. function postDeleteTA(annual_id, selectTransId, typ_course_id) {
  859. ta = $("#" + selectTransId).val();
  860. if (ta == "0") return;
  861. $.post("../annual-plan-deleteTA", {
  862. annual_id: annual_id,
  863. TA_id: ta,
  864. typ_id: typ_course_id,
  865. });
  866. parent = $("#" + selectTransId).parent().parent().parent();
  867. counter = parseInt(parent.data('amount-ta'));
  868. parent.data('amount-ta', counter - 1);
  869. }
  870. function postToAnnualPlans(typ_course_id, criteria_select) {
  871. var criteria = $('#' + criteria_select).val();
  872. var oldCriteria = $('#' + criteria_select).data('old-criteria');
  873. var criteriaNode = document.getElementById(criteria_select).parentNode.parentNode.parentNode;
  874. var annual = criteriaNode.dataset.annualPlan;
  875. $.post("../annual-plan-postOnChange", {
  876. criteria: criteria,
  877. typ_course_id: typ_course_id,
  878. annual_plan: annual,
  879. old_criteria: oldCriteria
  880. },
  881. function(message) {
  882. if (message == "Duplicate entry, please choose another criteria.") {
  883. alert(message)
  884. } else {
  885. $('#' + criteria_select).data('old-criteria', criteria);
  886. changed = true;
  887. }
  888. })
  889. }
  890. function addCriteriaTest(div, new_id_for_select, typ_course_id, i = null, options) {
  891. if (!i) amount_select = $('#' + div).data("amount-select");
  892. else amount_select = i;
  893. $select = $('<select/>', {
  894. 'class': "selectpicker form-control",
  895. 'data-live-search': 'true',
  896. 'data-old-criteria': '0',
  897. 'data-width': '180px',
  898. 'id': 'criteriaFor' + new_id_for_select + '_' + amount_select,
  899. 'onchange': 'postToAnnualPlans(' + typ_course_id + ', "criteriaFor' + new_id_for_select + '_' +
  900. amount_select + '")'
  901. })
  902. var $div = $('<div/>', {
  903. 'id': 'courseSelect_' + new_id_for_select + '_' + amount_select,
  904. 'class': 'form-group '
  905. });
  906. $select.append(options);
  907. $select.appendTo($div);
  908. $span = $('<span/>', {
  909. 'id': 'close',
  910. 'onclick': ' postDelete(' + typ_course_id + ', "criteriaFor' + new_id_for_select + '_' +
  911. amount_select + '"); this.parentNode.parentNode.removeChild(this.parentNode);return false;'
  912. }).html('x');
  913. $div.append($span);
  914. $div.append("<br><br>")
  915. $('#' + div).append("<br>");
  916. $div.appendTo($("#" + div));
  917. $select.selectpicker('refresh');
  918. $("#" + div).data("amount-select", amount_select + 1);
  919. }
  920. $('#allOutcomes').hide();
  921. function postDelete(typ_course_id, criteria_select) {
  922. var criteria = $('#' + criteria_select).val();
  923. var oldCriteria = $('#' + criteria_select).data('old-criteria');
  924. var criteriaNode = document.getElementById(criteria_select).parentNode.parentNode.parentNode;
  925. var annual = criteriaNode.dataset.annualPlan;
  926. $.post("../annual-plan-deleteCriteria", {
  927. criteria: criteria,
  928. typ_course_id: typ_course_id,
  929. annual_plan: annual,
  930. old_criteria: oldCriteria
  931. });
  932. }
  933. function fetchInfo(id) {
  934. annual_id = $("#" + id).val();
  935. program_id = {{ $program->id }};
  936. $.post("{{ URL::action('AnnualPlansController@fetchInfo') }}", {
  937. id: annual_id,
  938. program_id: program_id
  939. },
  940. function(json) {
  941. div = $('<div/>', {
  942. 'class': 'list-group',
  943. 'id': 'list'
  944. });
  945. if (json.outcomes.first) {
  946. header5 = $('<h5/>', {
  947. 'style': "padding-left: 10px"
  948. }).html("First Semester");
  949. div.append(header5);
  950. list = '';
  951. for (outcome in json.outcomes.first) {
  952. list +=
  953. "<li style='padding-left: 25px' onclick = 'fetchEverything(this)' data-annual-plan = '" +
  954. json.annual_plans.id + "' data-typ-semester-outcome-id ='" + json.outcomes.first[
  955. outcome].typ_semester_outcome_id + "' data-semester-id = '" + json.allSemesterOrder
  956. .first.id +
  957. "' data-outcome-id='" + json.outcomes.first[outcome].id + "' data-outcome-name ='" +
  958. json
  959. .outcomes.first[outcome].name + "' class='list-group-item' >" + json.outcomes.first[
  960. outcome]
  961. .name + " </li>";
  962. }
  963. div.append(list);
  964. }
  965. if (json.outcomes.second) {
  966. header4 = $('<h5/>', {
  967. 'style': "padding-left: 10px"
  968. }).html("Second Semester");
  969. div.append(header4);
  970. list = '';
  971. for (outcome in json.outcomes.second) {
  972. list +=
  973. "<li style='padding-left: 25px' onclick = 'fetchEverything(this)' data-annual-plan = '" +
  974. json.annual_plans.id + "' data-typ-semester-outcome-id ='" + json.outcomes.second[
  975. outcome].typ_semester_outcome_id + "'data-semester-id = '" + json.allSemesterOrder
  976. .second.id +
  977. "' data-outcome-id='" + json.outcomes.second[outcome].id + "' data-outcome-name ='" +
  978. json
  979. .outcomes.second[outcome].name + "' class='list-group-item' >" + json.outcomes.second[
  980. outcome].name + " </li>";
  981. }
  982. div.append(list);
  983. }
  984. html = div[0].innerHTML;
  985. $("#allOutcomes").html(div[0].innerHTML);
  986. $("#allOutcomes").show();
  987. },
  988. "json",
  989. );
  990. }
  991. function deleteObjective(objectiveSelectDiv, closeObj) {
  992. $('#' + objectiveSelectDiv).remove();
  993. $('#' + closeObj).remove();
  994. $('#' + div).data("amount-select", $('#' + div).data("amount-select") - 1);
  995. }
  996. </script>
  997. @stop
  998. @section('included-js')
  999. @include('global._datatables_js')
  1000. @stop