No Description

annual_report.blade.php 81KB

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