No Description

annual-plans.blade.php 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. @extends('layouts.master-2')
  2. @section('navigation')
  3. @if (Auth::user()->role == 1)
  4. @include('local.managers.admins._navigation')
  5. @elseif(Auth::user()->role == 2)
  6. @include('local.managers.sCoords._navigation')
  7. @elseif(Auth::user()->role == 3)
  8. @include('local.managers.pCoords._navigation')
  9. @elseif(Auth::user()->role == 4)
  10. @include('local.professors._navigation')
  11. @endif
  12. @stop
  13. @section('main')
  14. {{-- TODO: look where to place this script.
  15. if placed inside .ready() or before it,
  16. an error that the function is not defined occurs. --}}
  17. {{-- TODO: no reconoce acentos --}}
  18. <div class="row">
  19. <div class="col-md-3">
  20. <a role="button" class="btn btn-secondary"
  21. href="{{ URL::action('AnnualPlansController@viewAllPlans', [$program->id]) }}">View Plans</a>
  22. <select class="form-control selectpicker" id="annual_plan" onchange="fetchInfo('annual_plan')">
  23. <option value='0'> Nothing Selected</option>
  24. @foreach ($annual_plans as $an_plan)
  25. <option value={{ $an_plan->id }}>Plan {{ $an_plan->academic_year }}</option>
  26. @endforeach
  27. </select>
  28. <br>
  29. <div id='allOutcomes'>
  30. </div>
  31. </div>
  32. <div class="col-md-9">
  33. <div id="expected-outcome" class="panel panel-default" data-semester-id="">
  34. <div class="panel-heading">
  35. <h3 class="panel-title">
  36. Expected Target Outcomes
  37. </h3>
  38. <input style="width: 150px;" min="0" class="form-control" type="number">
  39. </div>
  40. </div>
  41. <div id="outcome-display" class="panel panel-default">
  42. <div class="panel-heading">
  43. <h4 class=" panel-title">
  44. Primer Semestre 2019-2020
  45. </h4>
  46. </div>
  47. <div class="panel-body">
  48. <p class="outcome-definition "></p>
  49. <div class="table-responsive">
  50. <table class="table table-striped table-condensed datatable"
  51. style="table-layout: fixed ; width : 100%">
  52. <thead>
  53. <tr>
  54. <th>Objectives for courses</th>
  55. <th>Criteria per Course</th>
  56. <th>Transformative Actions</th>
  57. </tr>
  58. </thead>
  59. <tbody>
  60. </tbody>
  61. </table>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. <div class="col-md-9">
  67. <div class="no-outcome alert alert-info">
  68. <p>Select a Learning Outcome to view its information</p>
  69. </div>
  70. </div>
  71. </div>
  72. <div class="modal fade" id="modal-view-objective">
  73. <div class="modal-dialog modal-lg">
  74. <div class="modal-content">
  75. <div class="modal-header">
  76. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  77. <h3 class="modal-title"></h3>
  78. </div>
  79. <div class="modal-body">
  80. </div>
  81. </div><!-- /.modal-content -->
  82. </div><!-- /.modal-dialog -->
  83. </div><!-- /.modal -->
  84. <script>
  85. function nextChar(c) {
  86. return String.fromCharCode(c.charCodeAt(0) + 1);
  87. }
  88. changed = false;
  89. $(document).ready(function() {
  90. // --------------------------------------------------------------------------
  91. // Page load
  92. // --------------------------------------------------------------------------
  93. // Hide accordion panel contents by default
  94. // $('.panel-group .panel-body').hide();
  95. $('.panel-group .panel-body').hide();
  96. $('#outcome-display').parent().hide();
  97. // --------------------------------------------------------------------------
  98. // Functions
  99. // --------------------------------------------------------------------------
  100. // --------------------------------------------------------------------------
  101. // Events
  102. // --------------------------------------------------------------------------
  103. // When list item is clicked, load corresponding info
  104. });
  105. // function CreateOrEdit(id){
  106. // //send data to the database
  107. // console.log(id);
  108. // annual_id = $("#"+id);
  109. // console.log(console.log(annual_id));
  110. // }
  111. function fetchObjectiveInfo(objective_div){
  112. typ_objective_id = $(objective_div).data('typ-objective-id');
  113. objective = $(objective_div).html();
  114. $.ajax({
  115. type: 'POST',
  116. url: "{{ URL::action('AnnualPlansController@fetchObjectiveInfo') }}",
  117. data: {
  118. typ_objective_id: typ_objective_id
  119. },
  120. success: function(courses)
  121. {
  122. $('.modal-title').html(objective);
  123. descriptions = '';
  124. $('.modal-body').empty();
  125. $.each(courses, function(index, course){
  126. $('.modal-body').append('<h4>'+course.code+' '+course.number+': '+course.name+'</h4>')
  127. $('.modal-body').append('<br><p>The following course is tied to these criteria: </p>')
  128. $.each(course.criteria, function(index,criterion){
  129. criterion_html = '<h5 style ="text-indent: 15px;">'+(index+1)+'. '+criterion.name+'</h5>';
  130. table = $('<table>', {
  131. 'style':'margin-left:15px',
  132. //'id':'criteria-'+criterion.id,
  133. 'class':"table table-striped table-condensed table-bordered"
  134. });
  135. thead = $('<thead/>');
  136. tr = $('<tr/>');
  137. for(i=0; i<criterion.num_scales;i++){
  138. minimumScore = 1+(i*(criterion.max_score/criterion.num_scales));
  139. maximumScore = (1+i)*(criterion.max_score/criterion.num_scales);
  140. th = '<th>Scale '+(i+1)+'. ('+minimumScore+' - '+maximumScore+')</th>';
  141. tr.append(th);
  142. }
  143. thead.append(tr);
  144. table.append(thead);
  145. tbody = $('<tbody>')
  146. tr_for_body = $('<tr>', {
  147. 'id':'criterion_'+criterion.id
  148. })
  149. td_for_criteria = '';
  150. $.each(criterion.scales, function(index, scale){
  151. td_for_criteria += '<td>'+scale.description+'</td>';
  152. });
  153. tr_for_body.html(td_for_criteria);
  154. tbody.append(tr_for_body);
  155. table.append(tbody);
  156. $('.modal-body').append(criterion_html);
  157. $('.modal-body').append(table);
  158. })
  159. $('.modal-body').append('<hr>')
  160. });
  161. $('#modal-view-objective').modal();
  162. },
  163. async:true
  164. });
  165. }
  166. function fetchEverything(li) {
  167. var id = $(li).data('outcome-id');
  168. var name = $(li).data('outcome-name');
  169. var semester = $(li).data('semester-id');
  170. var annual_plan = $(li).data('annual-plan');
  171. $('#expected-outcome').data('semester-id', semester);
  172. $('#theChange').data('annual-plan', annual_plan);
  173. $.post(
  174. "../annual-plan-fetchTYP/{{ $program->id }}", {
  175. id: id,
  176. semester: semester
  177. },
  178. function(json) {
  179. var table = $('.datatable').DataTable();
  180. table.clear();
  181. var optionsForTADict = {};
  182. var objectives = json.objectives;
  183. var courses = json.courses;
  184. var criteria = json.criteria;
  185. var selected_criteria = json.selected_criteria;
  186. var nextLetter = "A";
  187. if (courses) {
  188. $('table').show();
  189. $('#outcome-display').parent().show();
  190. $('.no-outcome').parent().hide();
  191. //Display title and definition
  192. $('#outcome-display .panel-title').html(name);
  193. var expected_target = json.expected_target;
  194. //check the data type of the expected target
  195. //if the expected_target var is an empty array, set default value
  196. $('#expected-outcome .form-control').val(expected_target.expected_target);
  197. //Empty table
  198. table.clear();
  199. var annual_plan = json.annual_plan.id;
  200. for (objective in objectives) {
  201. var typ_objective_id = json.typ_objective_id[objectives[objective].id].id;
  202. var objectivesHTML = '<div class="criterion-field" data-typ-objective-id = "'+typ_objective_id+'" onclick = "fetchObjectiveInfo(this)">';
  203. var courseshtml = '';
  204. var courseTAhtml = '';
  205. var criteriaHTML = '';
  206. objectivesHTML += '<strong>' + nextLetter + '. ' + objectives[objective].text +
  207. '</strong></div>';
  208. // courseshtml += "<strong>Objective "+nextLetter+"</strong>";
  209. // courseshtml += '<ul>';
  210. criteriaHTML += "<strong>Objective " + nextLetter + "</strong>";
  211. //criteriaHTML+= '<ol>';
  212. //var typ_objective_id = json.typ_objective_id[objectives[objective].id].id;
  213. nextLetter = nextChar(nextLetter);
  214. for (course in courses[objectives[objective].id]) {
  215. courseshtml += ' &#8226; ' + courses[objectives[objective].id][course].code + ' ' +
  216. courses[objectives[objective].id][course].name + '<br>'
  217. courseTAhtml += ' &#8226; ' + courses[objectives[objective].id][course].code + ' ' +
  218. courses[objectives[objective].id][course].name + '<br>'
  219. $divForEach = $('<div/>', {
  220. 'id': 'objective-' + objectives[objective].id
  221. });
  222. $divForSelects = $('<div/>', {
  223. 'id': 'forObjective-' + objectives[objective].id + '-course-' + courses[
  224. objectives[objective].id][course].typ_course_id,
  225. 'data-amount-select': '0',
  226. 'class': 'form-group',
  227. 'data-annual-plan': json.annual_plan.id
  228. });
  229. options = "<option value = '0' >Nothing Selected</option>"
  230. for (criterion in criteria[objectives[objective].id]) {
  231. options += "<option value='" + criteria[objectives[objective].id][criterion].id +
  232. "'>" + criteria[objectives[objective].id][criterion].name + "</option>";
  233. }
  234. var $button = $('<button/>', {
  235. 'type': 'button',
  236. 'class': 'btn btn-secondary',
  237. 'onclick': 'addCriteriaTest("forObjective-' + objectives[objective].id +
  238. "-course-" + courses[objectives[objective].id][course].typ_course_id +
  239. '", "' + objectives[objective].id + "-course-" + courses[objectives[
  240. objective].id][course].typ_course_id + '", ' + courses[objectives[
  241. objective].id][course].typ_course_id + ', null, "' + options + '")'
  242. });
  243. $button.append("+ Add criteria");
  244. $divForEach.append($divForSelects);
  245. $divForEach.append("<br>")
  246. $divForEach.append($button);
  247. $divForTA = $('<div/>', {
  248. 'id': 'objectiveTA-' + objectives[objective].id
  249. });
  250. $divForTASelects = $('<div/>', {
  251. 'id': 'forTA-objective-' + objectives[objective].id + '-course-' + courses[
  252. objectives[objective].id][course].typ_course_id,
  253. 'class': 'form-group',
  254. 'data-amount-ta': '0'
  255. });
  256. var optionsForTa = "<option value = '0'>Nothing Selected</option>";
  257. transformativeDefault = json.transformative_actions;
  258. optionsForTa += "<optgroup label='Default'>";
  259. for (trans in transformativeDefault) {
  260. optionsForTa += "<option value='" + transformativeDefault[trans].id + "'>" +
  261. transformativeDefault[trans].at_text + "</option> ";
  262. }
  263. optionsForTa += '</optgroup>';
  264. course_id = courses[objectives[objective].id][course].id
  265. transformativeDefault = json.custom_transformative[objectives[objective].id][course_id];
  266. if (transformativeDefault != undefined) {
  267. optionsForTa += "<optgroup label = 'Custom'>";
  268. for (trans in transformativeDefault) {
  269. optionsForTa += "<option value='" + transformativeDefault[trans].ta_id + "'>" +
  270. transformativeDefault[trans].at_text + "</option> ";
  271. }
  272. }
  273. typ_course_id = courses[objectives[objective].id][course].typ_course_id
  274. var $buttonTA = $('<button/>', {
  275. 'type': 'button',
  276. 'class': 'btn btn-secondary',
  277. 'onclick': 'addTAselect("' + optionsForTa + '", "forTA-objective-' +
  278. objectives[objective].id + '-course-' + courses[objectives[objective]
  279. .id][course].typ_course_id + '", ' + annual_plan + ', ' +
  280. objectives[objective].id + ', ' + typ_course_id + ', 0)'
  281. });
  282. $buttonTA.append("+ Add TA");
  283. typ_course_id = courses[objectives[objective].id][course].typ_course_id
  284. optionsForTADict[typ_course_id] = optionsForTa;
  285. $divForTA.append($divForTASelects);
  286. $divForTA.append('<br>');
  287. $divForTA.append($buttonTA)
  288. courseshtml += $divForEach[0].innerHTML + "<br><br>";
  289. courseTAhtml += $divForTA[0].innerHTML + "<br><br>";
  290. }
  291. /*$divForTA = $('<div/>',{
  292. 'id':'objectiveTA-'+objectives[objective].id
  293. });
  294. $divForTASelects = $('<div/>', {
  295. 'id': 'forTA-objective-'+objectives[objective].id,
  296. 'class':'form-group',
  297. 'data-amount-ta':'0'
  298. });
  299. var optionsForTa = "<option value = '0'>Nothing Selected</option>";
  300. transformativeDefault = json.transformative_actions;
  301. optionsForTa+= "<optgroup label='Default'>";
  302. for(trans in transformativeDefault){
  303. optionsForTa+= "<option value='"+transformativeDefault[trans].id+"'>"+transformativeDefault[trans].at_text+"</option> ";
  304. }
  305. optionsForTa+='</optgroup>';
  306. transformativeDefault = json.custom_transformative[objectives[objective].id];
  307. if(transformativeDefault!= undefined){
  308. optionsForTa+="<optgroup label = 'Custom'>";
  309. for(trans in transformativeDefault){
  310. optionsForTa+= "<option value='"+transformativeDefault[trans].id+"'>"+transformativeDefault[trans].at_text+"</option> ";
  311. }
  312. }
  313. var $buttonTA = $('<button/>', {
  314. 'type': 'button',
  315. 'class': 'btn btn-secondary',
  316. 'onclick': 'addTAselect("'+optionsForTa+'", "forTA-objective-'+objectives[objective].id+'", '+annual_plan+', '+objectives[objective].id+', '+typ_objective_id+', 0)'
  317. });
  318. $buttonTA.append("+ Add TA");
  319. $divForTA.append($divForTASelects);
  320. $divForTA.append('<br>');
  321. $divForTA.append($buttonTA)
  322. */
  323. table.row.add([
  324. objectivesHTML,
  325. courseshtml,
  326. courseTAhtml
  327. ]);
  328. table.draw();
  329. for (course in courses[objectives[objective].id]) {
  330. typ_course_id = courses[objectives[objective].id][course].typ_course_id
  331. if (json.annual_plans_transformative[objectives[objective].id][typ_course_id].length) {
  332. for (i = 0; i < json.annual_plans_transformative[objectives[objective].id][
  333. typ_course_id
  334. ].length; i++) {
  335. selected_ta = json.annual_plans_transformative[objectives[objective].id][
  336. typ_course_id
  337. ][i].trans_id;
  338. addTAselect(optionsForTADict[typ_course_id], "forTA-objective-" + objectives[
  339. objective].id + '-course-' + typ_course_id, annual_plan, objectives[
  340. objective].id, typ_course_id, selected_ta);
  341. }
  342. } else {
  343. $('#')
  344. addTAselect(optionsForTADict[typ_course_id], "forTA-objective-" + objectives[
  345. objective].id + '-course-' + typ_course_id, annual_plan, objectives[
  346. objective].id, typ_course_id, 0);
  347. }
  348. if (json.selected_criteria[objectives[objective].id][typ_course_id].length) {
  349. for (i = 0; i < json.selected_criteria[objectives[objective].id][typ_course_id]
  350. .length; i++) {
  351. addCriteriaTest("forObjective-" + objectives[objective].id + "-course-" +
  352. typ_course_id, "" + objectives[objective].id + "-course-" +
  353. typ_course_id, "" + json.selected_criteria[objectives[objective].id][
  354. typ_course_id
  355. ][i].typ_course_id + "", i, options);
  356. $('#criteriaFor' + objectives[objective].id + "-course-" + typ_course_id + '_' +
  357. i).val(json.selected_criteria[objectives[objective].id][typ_course_id][
  358. i
  359. ].criteria_id);
  360. $('#criteriaFor' + objectives[objective].id + "-course-" + typ_course_id + '_' +
  361. i).data('old-criteria', json.selected_criteria[objectives[objective].id]
  362. [typ_course_id][i].criteria_id);
  363. $('#criteriaFor' + objectives[objective].id + "-course-" + typ_course_id + '_' +
  364. i).selectpicker('refresh');
  365. } // Update display
  366. } else {
  367. addCriteriaTest("forObjective-" + objectives[objective].id + "-course-" +
  368. typ_course_id, "" + objectives[objective].id + "-course-" + typ_course_id +
  369. "", "" + typ_course_id + "", 0, options);
  370. $('#criteriaFor' + objectives[objective].id + "-course-" + typ_course_id + '_0')
  371. .val(0);
  372. $('#criteriaFor' + objectives[objective].id + "-course-" + typ_course_id + '_0')
  373. .data('old-criteria', 0);
  374. $('#criteriaFor' + objectives[objective].id + "-course-" + typ_course_id + '_0')
  375. .selectpicker('refresh');
  376. }
  377. }
  378. }
  379. table.draw();
  380. } else {
  381. $('table').hide();
  382. }
  383. },
  384. 'json'
  385. );
  386. }
  387. function posttoTransAnnual(annual_id, selectTransId, typ_course_id) {
  388. ta = $("#" + selectTransId).val();
  389. old_ta = $("#" + selectTransId).data('old-TA');
  390. if (ta == "0") return;
  391. $.post("../annual-plan-postTA", {
  392. annual_id: annual_id,
  393. TA_id: ta,
  394. typ_course_id: typ_course_id,
  395. old_ta: old_ta
  396. },
  397. function(message) {
  398. $("#" + selectTransId).data('old-TA', ta);
  399. }
  400. )
  401. }
  402. function addTAselect(options, master_div, annual_plan_id, objective_id, typ_course_id, selected_ta) {
  403. var $div = $('<div/>', {
  404. 'class': 'form-group '
  405. });
  406. counter = parseInt($('#' + master_div).data('amount-ta'));
  407. var selectTA = $('<select/>', {
  408. 'class': "selectpicker form-control",
  409. 'data-live-search': 'true',
  410. 'data-old-TA': '0',
  411. 'data-width': '180px',
  412. 'id': 'transformativeForObjective' + master_div + '_' + counter,
  413. 'onchange': 'posttoTransAnnual(' + annual_plan_id + ', "transformativeForObjective' + master_div +
  414. '_' + counter + '", ' + typ_course_id + ')'
  415. });
  416. selectTA.append(options);
  417. selectTA.appendTo($div);
  418. selectTA.val(selected_ta);
  419. selectTA.data('old-TA', selected_ta);
  420. selectTA.selectpicker('refresh');
  421. $span = $('<span/>', {
  422. 'id': 'close',
  423. 'onclick': ' postDeleteTA(' + annual_plan_id + ', "transformativeForObjective' + master_div + '_' +
  424. counter + '", ' + typ_course_id +
  425. '); this.parentNode.parentNode.removeChild(this.parentNode);return false;'
  426. }).html('x');
  427. $span.appendTo($div);
  428. $div.append("<br><br>");
  429. $('#' + master_div).append("<br>");
  430. $div.appendTo($('#' + master_div));
  431. $('#' + master_div).data('amount-ta', counter + 1);
  432. }
  433. function postDeleteTA(annual_id, selectTransId, typ_course_id) {
  434. ta = $("#" + selectTransId).val();
  435. if (ta == "0") return;
  436. $.post("../annual-plan-deleteTA", {
  437. annual_id: annual_id,
  438. TA_id: ta,
  439. typ_id: typ_course_id,
  440. });
  441. parent = $("#" + selectTransId).parent().parent().parent();
  442. counter = parseInt(parent.data('amount-ta'));
  443. parent.data('amount-ta', counter - 1);
  444. }
  445. function postToAnnualPlans(typ_course_id, criteria_select) {
  446. var criteria = $('#' + criteria_select).val();
  447. var oldCriteria = $('#' + criteria_select).data('old-criteria');
  448. var criteriaNode = document.getElementById(criteria_select).parentNode.parentNode.parentNode;
  449. var annual = criteriaNode.dataset.annualPlan;
  450. $.post("../annual-plan-postOnChange", {
  451. criteria: criteria,
  452. typ_course_id: typ_course_id,
  453. annual_plan: annual,
  454. old_criteria: oldCriteria
  455. },
  456. function(message) {
  457. if (message == "Duplicate entry, please choose another criteria.") {
  458. alert(message)
  459. } else {
  460. $('#' + criteria_select).data('old-criteria', criteria);
  461. changed = true;
  462. }
  463. })
  464. }
  465. function addCriteriaTest(div, new_id_for_select, typ_course_id, i = null, options) {
  466. if (!i) amount_select = $('#' + div).data("amount-select");
  467. else amount_select = i;
  468. $select = $('<select/>', {
  469. 'class': "selectpicker form-control",
  470. 'data-live-search': 'true',
  471. 'data-old-criteria': '0',
  472. 'data-width': '180px',
  473. 'id': 'criteriaFor' + new_id_for_select + '_' + amount_select,
  474. 'onchange': 'postToAnnualPlans(' + typ_course_id + ', "criteriaFor' + new_id_for_select + '_' +
  475. amount_select + '")'
  476. })
  477. var $div = $('<div/>', {
  478. 'id': 'courseSelect_' + new_id_for_select + '_' + amount_select,
  479. 'class': 'form-group '
  480. });
  481. $select.append(options);
  482. $select.appendTo($div);
  483. $span = $('<span/>', {
  484. 'id': 'close',
  485. 'onclick': ' postDelete(' + typ_course_id + ', "criteriaFor' + new_id_for_select + '_' +
  486. amount_select + '"); this.parentNode.parentNode.removeChild(this.parentNode);return false;'
  487. }).html('x');
  488. $div.append($span);
  489. $div.append("<br><br>")
  490. $('#' + div).append("<br>");
  491. $div.appendTo($("#" + div));
  492. $select.selectpicker('refresh');
  493. $("#" + div).data("amount-select", amount_select + 1);
  494. }
  495. $('#allOutcomes').hide();
  496. function postDelete(typ_course_id, criteria_select) {
  497. var criteria = $('#' + criteria_select).val();
  498. var oldCriteria = $('#' + criteria_select).data('old-criteria');
  499. var criteriaNode = document.getElementById(criteria_select).parentNode.parentNode.parentNode;
  500. var annual = criteriaNode.dataset.annualPlan;
  501. $.post("../annual-plan-deleteCriteria", {
  502. criteria: criteria,
  503. typ_course_id: typ_course_id,
  504. annual_plan: annual,
  505. old_criteria: oldCriteria
  506. });
  507. }
  508. function fetchInfo(id) {
  509. annual_id = $("#" + id).val();
  510. program_id = {{ $program->id }};
  511. $.post("{{ URL::action('AnnualPlansController@fetchInfo') }}", {
  512. id: annual_id,
  513. program_id: program_id
  514. },
  515. function(json) {
  516. div = $('<div/>', {
  517. 'class': 'list-group',
  518. 'id': 'list'
  519. });
  520. header5 = $('<h5/>', {
  521. 'style': "padding-left: 10px"
  522. }).html("First Semester");
  523. div.append(header5);
  524. list = '';
  525. for (outcome in json.outcomes.first) {
  526. list +=
  527. "<li style='padding-left: 25px' onclick = 'fetchEverything(this)' data-annual-plan = '" +
  528. json.annual_plans.id + "' data-semester-id = '" + json.allSemesterOrder.first.id +
  529. "' data-outcome-id='" + json.outcomes.first[outcome].id + "' data-outcome-name ='" + json
  530. .outcomes.first[outcome].name + "' class='list-group-item' >" + json.outcomes.first[outcome]
  531. .name + " </li>";
  532. }
  533. div.append(list);
  534. header4 = $('<h5/>', {
  535. 'style': "padding-left: 10px"
  536. }).html("Second Semester");
  537. div.append(header4);
  538. list = '';
  539. for (outcome in json.outcomes.second) {
  540. list +=
  541. "<li style='padding-left: 25px' onclick = 'fetchEverything(this)' data-annual-plan = '" +
  542. json.annual_plans.id + "' data-semester-id = '" + json.allSemesterOrder.second.id +
  543. "' data-outcome-id='" + json.outcomes.second[outcome].id + "' data-outcome-name ='" + json
  544. .outcomes.second[outcome].name + "' class='list-group-item' >" + json.outcomes.second[
  545. outcome].name + " </li>";
  546. }
  547. div.append(list);
  548. html = div[0].innerHTML;
  549. $("#allOutcomes").html(div[0].innerHTML);
  550. $("#allOutcomes").show();
  551. },
  552. "json",
  553. );
  554. }
  555. function deleteObjective(objectiveSelectDiv, closeObj) {
  556. $('#' + objectiveSelectDiv).remove();
  557. $('#' + closeObj).remove();
  558. $('#' + div).data("amount-select", $('#' + div).data("amount-select") - 1);
  559. }
  560. </script>
  561. @stop
  562. @section('included-js')
  563. @include('global._datatables_js')
  564. @stop