No Description

annual_report.blade.php 80KB

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