No Description

annual_report.blade.php 66KB

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