123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907 |
- @extends('layouts.master-2')
-
- @section('navigation')
- @if (Auth::user()->role == 1)
- @include('local.managers.admins._navigation')
- @elseif(Auth::user()->role == 2)
- @include('local.managers.sCoords._navigation')
- @elseif(Auth::user()->role == 3)
- @include('local.managers.pCoords._navigation')
- @elseif(Auth::user()->role == 4)
- @include('local.professors._navigation')
- @endif
- @stop
- @section('main')
-
- {{-- TODO: look where to place this script.
- if placed inside .ready() or before it,
- an error that the function is not defined occurs. --}}
- {{-- TODO: no reconoce acentos --}}
-
-
- <div class="row">
- <div class="col-md-3">
- <a role="button" class="btn btn-secondary"
- href="{{ URL::action('AnnualPlansController@viewAllPlans', [$program->id]) }}">View Plans</a>
-
- <select class="form-control selectpicker" id="annual_plan" onchange="fetchInfo('annual_plan')">
- <option value='0'> Nothing Selected</option>
- @foreach ($annual_plans as $an_plan)
- <option value={{ $an_plan->id }}>Plan {{ $an_plan->academic_year }}</option>
-
- @endforeach
- </select>
- <br>
-
-
-
- <div id='allOutcomes'>
-
- </div>
- </div>
-
-
- <div class="col-md-9">
- <div id="expected-outcome" class="panel panel-default" data-semester-id="">
- <div class="panel-heading">
- <h3 class="panel-title">
- Expected Target Outcomes
- </h3>
- <input style="width: 150px;" min="0" class="form-control" type="number">
- </div>
- </div>
- <div id="outcome-display" class="panel panel-default">
- <div class="panel-heading">
- <h4 class=" panel-title">
- Primer Semestre 2019-2020
- </h4>
- </div>
- <div class="panel-body">
- <p class="outcome-definition "></p>
- <div class="table-responsive">
- <table class="table table-striped table-condensed datatable"
- style="table-layout: fixed ; width : 100%">
- <thead>
- <tr>
- <th>Objectives for courses</th>
- <th>Criteria per Course</th>
- <th>Transformative Actions to be Implemented</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
-
- </table>
-
- </div>
- <hr>
- <div id='transformative_actions_to_outcome'>
-
- </div>
- <hr>
- <button class='btn btn-md btn-secondary button-add-objective'
- onclick='addTransToPlan()'>
- <span class='glyphicon glyphicon-plus'>
-
- </span>
- Add another Transformative Action
- </button>
-
- </div>
- </div>
- </div>
-
-
- <div class="col-md-9">
- <div class="no-outcome alert alert-info">
- <p>Select a Learning Outcome to view its information</p>
- </div>
- </div>
-
- </div>
- <div class="modal fade" id="modal-view-objective">
- <div class="modal-dialog modal-lg">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
- <h3 class="modal-title"></h3>
- </div>
- <div class="modal-body">
-
- </div>
- </div><!-- /.modal-content -->
- </div><!-- /.modal-dialog -->
- </div><!-- /.modal -->
- <script>
- function nextChar(c) {
- return String.fromCharCode(c.charCodeAt(0) + 1);
- }
- changed = false;
-
- $(document).ready(function() {
- // --------------------------------------------------------------------------
- // Page load
- // --------------------------------------------------------------------------
-
- // Hide accordion panel contents by default
- // $('.panel-group .panel-body').hide();
-
- $('.panel-group .panel-body').hide();
-
- $('#outcome-display').parent().hide();
-
- // --------------------------------------------------------------------------
- // Functions
- // --------------------------------------------------------------------------
-
- // --------------------------------------------------------------------------
- // Events
- // --------------------------------------------------------------------------
-
- // When list item is clicked, load corresponding info
-
-
- });
- // function CreateOrEdit(id){
- // //send data to the database
- // console.log(id);
- // annual_id = $("#"+id);
- // console.log(console.log(annual_id));
- // }
-
- function fetchObjectiveInfo(objective_div){
- typ_objective_id = $(objective_div).data('typ-objective-id');
- objective = $(objective_div).html();
-
- $.ajax({
- type: 'POST',
- url: "{{ URL::action('AnnualPlansController@fetchObjectiveInfo') }}",
- data: {
- typ_objective_id: typ_objective_id
- },
- success: function(courses)
- {
-
- $('.modal-title').html(objective);
- descriptions = '';
- $('.modal-body').empty();
- $.each(courses, function(index, course){
-
- $('.modal-body').append('<h4>'+course.code+' '+course.number+': '+course.name+'</h4>')
- $('.modal-body').append('<br><p>The following course is tied to these criteria: </p>')
- $.each(course.criteria, function(index,criterion){
- criterion_html = '<h5 style ="text-indent: 15px;">'+(index+1)+'. '+criterion.name+'</h5>';
- table = $('<table>', {
- 'style':'margin-left:15px',
- //'id':'criteria-'+criterion.id,
- 'class':"table table-striped table-condensed table-bordered"
- });
- thead = $('<thead/>');
- tr = $('<tr/>');
- for(i=0; i<criterion.num_scales;i++){
- minimumScore = 1+(i*(criterion.max_score/criterion.num_scales));
- maximumScore = (1+i)*(criterion.max_score/criterion.num_scales);
- th = '<th>Scale '+(i+1)+'. ('+minimumScore+' - '+maximumScore+')</th>';
- tr.append(th);
- }
- thead.append(tr);
- table.append(thead);
- tbody = $('<tbody>')
- tr_for_body = $('<tr>', {
- 'id':'criterion_'+criterion.id
- })
- td_for_criteria = '';
- $.each(criterion.scales, function(index, scale){
-
- td_for_criteria += '<td>'+scale.description+'</td>';
- });
- tr_for_body.html(td_for_criteria);
- tbody.append(tr_for_body);
- table.append(tbody);
- $('.modal-body').append(criterion_html);
- $('.modal-body').append(table);
- })
-
- $('.modal-body').append('<hr>')
- });
-
-
-
- $('#modal-view-objective').modal();
-
- },
- async:true
- });
-
- }
-
- function fetchEverything(li) {
- var id = $(li).data('outcome-id');
- var name = $(li).data('outcome-name');
- var semester = $(li).data('semester-id');
- var annual_plan = $(li).data('annual-plan');
- var typ_semester_outcome_id = $(li).data('typ-semester-outcome-id');
- $('#expected-outcome').data('semester-id', semester);
-
-
-
- $('#theChange').data('annual-plan', annual_plan);
- $.post(
- "../annual-plan-fetchTYP/{{ $program->id }}", {
- id: id,
- semester: semester,
- typ_semester_outcome_id: typ_semester_outcome_id,
- },
-
- function(json) {
-
-
-
- var table = $('.datatable').DataTable();
-
- table.clear();
-
- var optionsForTADict = {};
-
-
-
-
- var objectives = json.objectives;
- var courses = json.courses;
- var criteria = json.criteria;
- var selected_criteria = json.selected_criteria;
- var nextLetter = "A";
- if (courses) {
- $('table').show();
- $('#outcome-display').parent().show();
- $('.no-outcome').parent().hide();
-
- //Display title and definition
- $('#outcome-display .panel-title').html(name);
-
-
- var expected_target = json.expected_target;
-
-
- //check the data type of the expected target
- //if the expected_target var is an empty array, set default value
-
- $('#expected-outcome .form-control').val(expected_target.expected_target);
-
-
-
-
-
-
-
-
- //Empty table
- table.clear();
- var annual_plan = json.annual_plan.id;
- for (objective in objectives) {
- var typ_objective_id = json.typ_objective_id[objectives[objective].id].id;
- var objectivesHTML = '<div class="criterion-field" data-typ-objective-id = "'+typ_objective_id+'" onclick = "fetchObjectiveInfo(this)">';
- var courseshtml = '';
- var courseTAhtml = '';
-
-
-
- var criteriaHTML = '';
- objectivesHTML += '<strong>' + nextLetter + '. ' + objectives[objective].text +
- '</strong></div>';
- // courseshtml += "<strong>Objective "+nextLetter+"</strong>";
- // courseshtml += '<ul>';
- criteriaHTML += "<strong>Objective " + nextLetter + "</strong>";
- //criteriaHTML+= '<ol>';
-
- //var typ_objective_id = json.typ_objective_id[objectives[objective].id].id;
- nextLetter = nextChar(nextLetter);
- for (course in courses[objectives[objective].id]) {
-
- courseshtml += ' • ' + courses[objectives[objective].id][course].code + ' ' +
- courses[objectives[objective].id][course].name + '<br>'
- courseTAhtml += ' • ' + courses[objectives[objective].id][course].code + ' ' +
- courses[objectives[objective].id][course].name + '<br>'
-
- $divForEach = $('<div/>', {
- 'id': 'objective-' + objectives[objective].id
- });
- $divForSelects = $('<div/>', {
- 'id': 'forObjective-' + objectives[objective].id + '-course-' + courses[
- objectives[objective].id][course].typ_course_id,
- 'data-amount-select': '0',
- 'class': 'form-group',
- 'data-annual-plan': json.annual_plan.id
- });
- options = "<option value = '0' >Nothing Selected</option>"
- for (criterion in criteria[objectives[objective].id]) {
- options += "<option value='" + criteria[objectives[objective].id][criterion].id +
- "'>" + criteria[objectives[objective].id][criterion].name + "</option>";
- }
- var $button = $('<button/>', {
- 'type': 'button',
- 'class': 'btn btn-secondary',
- 'onclick': 'addCriteriaTest("forObjective-' + objectives[objective].id +
- "-course-" + courses[objectives[objective].id][course].typ_course_id +
- '", "' + objectives[objective].id + "-course-" + courses[objectives[
- objective].id][course].typ_course_id + '", ' + courses[objectives[
- objective].id][course].typ_course_id + ', null, "' + options + '")'
- });
-
- $button.append("+ Add criteria");
-
- $divForEach.append($divForSelects);
- $divForEach.append("<br>")
- $divForEach.append($button);
- $divForTA = $('<div/>', {
- 'id': 'objectiveTA-' + objectives[objective].id
- });
- $divForTASelects = $('<div/>', {
- 'id': 'forTA-objective-' + objectives[objective].id + '-course-' + courses[
- objectives[objective].id][course].typ_course_id,
- 'class': 'form-group',
- 'data-amount-ta': '0'
- });
-
- var optionsForTa = "<option value = '0'>Nothing Selected</option>";
- transformativeDefault = json.transformative_actions;
- optionsForTa += "<optgroup label='Default'>";
- for (trans in transformativeDefault) {
- optionsForTa += "<option value='" + transformativeDefault[trans].id + "'>" +
- transformativeDefault[trans].at_text + "</option> ";
-
- }
- optionsForTa += '</optgroup>';
- course_id = courses[objectives[objective].id][course].id
- transformativeDefault = json.custom_transformative[objectives[objective].id][course_id];
- if (transformativeDefault != undefined) {
- optionsForTa += "<optgroup label = 'Custom'>";
- for (trans in transformativeDefault) {
- optionsForTa += "<option value='" + transformativeDefault[trans].ta_id + "'>" +
- transformativeDefault[trans].at_text + "</option> ";
-
- }
- }
- typ_course_id = courses[objectives[objective].id][course].typ_course_id
- var $buttonTA = $('<button/>', {
- 'type': 'button',
- 'class': 'btn btn-secondary',
-
- 'onclick': 'addTAselect("' + optionsForTa + '", "forTA-objective-' +
- objectives[objective].id + '-course-' + courses[objectives[objective]
- .id][course].typ_course_id + '", ' + annual_plan + ', ' +
- objectives[objective].id + ', ' + typ_course_id + ', 0)'
- });
-
- $buttonTA.append("+ Add TA");
- typ_course_id = courses[objectives[objective].id][course].typ_course_id
- optionsForTADict[typ_course_id] = optionsForTa;
-
-
-
-
-
-
- $divForTA.append($divForTASelects);
- $divForTA.append('<br>');
- $divForTA.append($buttonTA)
-
-
- courseshtml += $divForEach[0].innerHTML + "<br><br>";
- courseTAhtml += $divForTA[0].innerHTML + "<br><br>";
-
-
- }
-
-
-
-
-
-
-
-
-
- /*$divForTA = $('<div/>',{
- 'id':'objectiveTA-'+objectives[objective].id
- });
- $divForTASelects = $('<div/>', {
- 'id': 'forTA-objective-'+objectives[objective].id,
- 'class':'form-group',
- 'data-amount-ta':'0'
- });
-
- var optionsForTa = "<option value = '0'>Nothing Selected</option>";
- transformativeDefault = json.transformative_actions;
- optionsForTa+= "<optgroup label='Default'>";
- for(trans in transformativeDefault){
- optionsForTa+= "<option value='"+transformativeDefault[trans].id+"'>"+transformativeDefault[trans].at_text+"</option> ";
-
- }
- optionsForTa+='</optgroup>';
-
- transformativeDefault = json.custom_transformative[objectives[objective].id];
- if(transformativeDefault!= undefined){
- optionsForTa+="<optgroup label = 'Custom'>";
- for(trans in transformativeDefault){
- optionsForTa+= "<option value='"+transformativeDefault[trans].id+"'>"+transformativeDefault[trans].at_text+"</option> ";
-
- }
- }
- var $buttonTA = $('<button/>', {
- 'type': 'button',
- 'class': 'btn btn-secondary',
- 'onclick': 'addTAselect("'+optionsForTa+'", "forTA-objective-'+objectives[objective].id+'", '+annual_plan+', '+objectives[objective].id+', '+typ_objective_id+', 0)'
- });
-
- $buttonTA.append("+ Add TA");
-
-
-
-
-
-
-
-
- $divForTA.append($divForTASelects);
- $divForTA.append('<br>');
- $divForTA.append($buttonTA)
-
-
- */
- table.row.add([
- objectivesHTML,
- courseshtml,
-
- courseTAhtml
-
- ]);
- table.draw();
-
-
- for (course in courses[objectives[objective].id]) {
- typ_course_id = courses[objectives[objective].id][course].typ_course_id
- if (json.annual_plans_transformative[objectives[objective].id][typ_course_id].length) {
- for (i = 0; i < json.annual_plans_transformative[objectives[objective].id][
- typ_course_id
- ].length; i++) {
- selected_ta = json.annual_plans_transformative[objectives[objective].id][
- typ_course_id
- ][i].trans_id;
- addTAselect(optionsForTADict[typ_course_id], "forTA-objective-" + objectives[
- objective].id + '-course-' + typ_course_id, annual_plan, objectives[
- objective].id, typ_course_id, selected_ta);
-
- }
- } else {
- $('#')
- addTAselect(optionsForTADict[typ_course_id], "forTA-objective-" + objectives[
- objective].id + '-course-' + typ_course_id, annual_plan, objectives[
- objective].id, typ_course_id, 0);
- }
- if (json.selected_criteria[objectives[objective].id][typ_course_id].length) {
-
-
-
- for (i = 0; i < json.selected_criteria[objectives[objective].id][typ_course_id]
- .length; i++) {
- addCriteriaTest("forObjective-" + objectives[objective].id + "-course-" +
- typ_course_id, "" + objectives[objective].id + "-course-" +
- typ_course_id, "" + json.selected_criteria[objectives[objective].id][
- typ_course_id
- ][i].typ_course_id + "", i, options);
- $('#criteriaFor' + objectives[objective].id + "-course-" + typ_course_id + '_' +
- i).val(json.selected_criteria[objectives[objective].id][typ_course_id][
- i
- ].criteria_id);
- $('#criteriaFor' + objectives[objective].id + "-course-" + typ_course_id + '_' +
- i).data('old-criteria', json.selected_criteria[objectives[objective].id]
- [typ_course_id][i].criteria_id);
- $('#criteriaFor' + objectives[objective].id + "-course-" + typ_course_id + '_' +
- i).selectpicker('refresh');
-
- } // Update display
-
- } else {
-
- addCriteriaTest("forObjective-" + objectives[objective].id + "-course-" +
- typ_course_id, "" + objectives[objective].id + "-course-" + typ_course_id +
- "", "" + typ_course_id + "", 0, options);
- $('#criteriaFor' + objectives[objective].id + "-course-" + typ_course_id + '_0')
- .val(0);
- $('#criteriaFor' + objectives[objective].id + "-course-" + typ_course_id + '_0')
- .data('old-criteria', 0);
- $('#criteriaFor' + objectives[objective].id + "-course-" + typ_course_id + '_0')
- .selectpicker('refresh');
-
- }
- }
-
- }
- table.draw();
-
-
- //transformative actions in outcome
-
-
-
-
-
- } else {
- $('table').hide();
- }
- //transformative actions in outcome
- if(!json.transformative_actions_for_outcome.length){
- div_for_name = $('<div>',{
- 'class':'form-group',
-
- });
- input_name = $('<input>', {
- 'class':'form-control',
-
- 'name':'at_text[]'
- });
- div_for_name.html("<label> Name</label>");
- div_for_name.append(input_name);
- $('#transformative_actions_to_outcome').append(div_for_name);
-
- div_for_category=$('<div>',{
- 'class':'form-group'
- }).html('<label>Type of Transformative Action</label>');
-
- select_for_category = $('<select>',{
- 'name':'type_of_ta[]',
- 'class':'form-control selectpicker',
- 'onchange':'checkIfNew(this)'
- }).html(json.categories);
- GlobalTransCategories = json.categories;
- div_for_category.append(select_for_category);
- $('#transformative_actions_to_outcome').append(div_for_category);
- select_for_category.selectpicker('refresh');
-
-
-
- div_description = $('<div>',{
- 'class':'form-group',
-
- }).html('<label> Description</label>');
-
- textarea = $('<textarea>', {
- 'class':'form-control',
- 'name':'description[]',
- 'rows':'10'
- });
-
- div_description.append(textarea);
-
- $('#transformative_actions_to_outcome').append(div_description);
-
-
-
-
- }
-
-
-
-
-
-
-
-
- },
- 'json'
- );
-
- }
-
- GlobalTransCategories = '';
-
- function addTransToPlan(){
- div_for_name = $('<div>',{
- 'class':'form-group',
-
- });
- input_name = $('<input>', {
- 'class':'form-control',
-
- 'name':'at_text[]'
- });
- div_for_name.html("<label> Name</label>");
- div_for_name.append(input_name);
- $('#transformative_actions_to_outcome').append(div_for_name);
-
- div_for_category=$('<div>',{
- 'class':'form-group'
- }).html('<label>Type of Transformative Action</label>');
-
- select_for_category = $('<select>',{
- 'name':'type_of_ta[]',
- 'class':'form-control selectpicker',
- 'onchange':'checkIfNew(this)'
- }).html(GlobalTransCategories);
-
- div_for_category.append(select_for_category);
- $('#transformative_actions_to_outcome').append(div_for_category);
- select_for_category.selectpicker('refresh');
-
-
-
- div_description = $('<div>',{
- 'class':'form-group',
-
- }).html('<label> Description</label>');
-
- textarea = $('<textarea>', {
- 'class':'form-control',
- 'name':'description[]',
- 'rows':'10'
- });
-
- div_description.append(textarea);
-
- $('#transformative_actions_to_outcome').append(div_description);
-
-
-
-
- }
-
- function checkIfNew(select){
-
- if($(select).val()=="new"){
- var new_div = $('<div/>',{
- 'class':'form-group new_type'
- }).html("<label>New Type </label>");
-
- var input = $("<input/>", {
- 'type': 'text',
- 'name':"new_type",
- 'class':'form-control'
- });
- new_div.append(input);
-
- $(select).parent().parent().after(new_div)
-
- }
- else{
- $(select).parent().parent().next('.new_type').remove();
- }
-
-
- }
-
- function posttoTransAnnual(annual_id, selectTransId, typ_course_id) {
- ta = $("#" + selectTransId).val();
- old_ta = $("#" + selectTransId).data('old-TA');
- if (ta == "0") return;
- $.post("../annual-plan-postTA", {
- annual_id: annual_id,
- TA_id: ta,
- typ_course_id: typ_course_id,
- old_ta: old_ta
- },
- function(message) {
-
- $("#" + selectTransId).data('old-TA', ta);
-
- }
- )
- }
-
- function addTAselect(options, master_div, annual_plan_id, objective_id, typ_course_id, selected_ta) {
- var $div = $('<div/>', {
-
- 'class': 'form-group '
- });
- counter = parseInt($('#' + master_div).data('amount-ta'));
-
- var selectTA = $('<select/>', {
- 'class': "selectpicker form-control",
- 'data-live-search': 'true',
- 'data-old-TA': '0',
- 'data-width': '180px',
-
- 'id': 'transformativeForObjective' + master_div + '_' + counter,
- 'onchange': 'posttoTransAnnual(' + annual_plan_id + ', "transformativeForObjective' + master_div +
- '_' + counter + '", ' + typ_course_id + ')'
-
- });
- selectTA.append(options);
-
- selectTA.appendTo($div);
- selectTA.val(selected_ta);
- selectTA.data('old-TA', selected_ta);
- selectTA.selectpicker('refresh');
- $span = $('<span/>', {
- 'id': 'close',
- 'onclick': ' postDeleteTA(' + annual_plan_id + ', "transformativeForObjective' + master_div + '_' +
- counter + '", ' + typ_course_id +
- '); this.parentNode.parentNode.removeChild(this.parentNode);return false;'
- }).html('x');
- $span.appendTo($div);
- $div.append("<br><br>");
- $('#' + master_div).append("<br>");
-
- $div.appendTo($('#' + master_div));
- $('#' + master_div).data('amount-ta', counter + 1);
-
-
- }
-
- function postDeleteTA(annual_id, selectTransId, typ_course_id) {
- ta = $("#" + selectTransId).val();
-
-
- if (ta == "0") return;
- $.post("../annual-plan-deleteTA", {
- annual_id: annual_id,
- TA_id: ta,
- typ_id: typ_course_id,
-
- });
- parent = $("#" + selectTransId).parent().parent().parent();
- counter = parseInt(parent.data('amount-ta'));
- parent.data('amount-ta', counter - 1);
- }
-
- function postToAnnualPlans(typ_course_id, criteria_select) {
- var criteria = $('#' + criteria_select).val();
- var oldCriteria = $('#' + criteria_select).data('old-criteria');
- var criteriaNode = document.getElementById(criteria_select).parentNode.parentNode.parentNode;
-
- var annual = criteriaNode.dataset.annualPlan;
- $.post("../annual-plan-postOnChange", {
- criteria: criteria,
- typ_course_id: typ_course_id,
- annual_plan: annual,
- old_criteria: oldCriteria
- },
- function(message) {
- if (message == "Duplicate entry, please choose another criteria.") {
- alert(message)
- } else {
- $('#' + criteria_select).data('old-criteria', criteria);
- changed = true;
- }
-
- })
- }
-
-
- function addCriteriaTest(div, new_id_for_select, typ_course_id, i = null, options) {
-
- if (!i) amount_select = $('#' + div).data("amount-select");
- else amount_select = i;
- $select = $('<select/>', {
- 'class': "selectpicker form-control",
- 'data-live-search': 'true',
- 'data-old-criteria': '0',
- 'data-width': '180px',
-
- 'id': 'criteriaFor' + new_id_for_select + '_' + amount_select,
- 'onchange': 'postToAnnualPlans(' + typ_course_id + ', "criteriaFor' + new_id_for_select + '_' +
- amount_select + '")'
-
- })
-
- var $div = $('<div/>', {
- 'id': 'courseSelect_' + new_id_for_select + '_' + amount_select,
- 'class': 'form-group '
- });
-
- $select.append(options);
- $select.appendTo($div);
- $span = $('<span/>', {
- 'id': 'close',
- 'onclick': ' postDelete(' + typ_course_id + ', "criteriaFor' + new_id_for_select + '_' +
- amount_select + '"); this.parentNode.parentNode.removeChild(this.parentNode);return false;'
- }).html('x');
- $div.append($span);
- $div.append("<br><br>")
- $('#' + div).append("<br>");
- $div.appendTo($("#" + div));
-
-
-
- $select.selectpicker('refresh');
-
-
-
-
- $("#" + div).data("amount-select", amount_select + 1);
-
- }
- $('#allOutcomes').hide();
-
- function postDelete(typ_course_id, criteria_select) {
- var criteria = $('#' + criteria_select).val();
- var oldCriteria = $('#' + criteria_select).data('old-criteria');
- var criteriaNode = document.getElementById(criteria_select).parentNode.parentNode.parentNode;
-
- var annual = criteriaNode.dataset.annualPlan;
- $.post("../annual-plan-deleteCriteria", {
- criteria: criteria,
- typ_course_id: typ_course_id,
- annual_plan: annual,
- old_criteria: oldCriteria
- });
-
- }
-
- function fetchInfo(id) {
- annual_id = $("#" + id).val();
- program_id = {{ $program->id }};
- $.post("{{ URL::action('AnnualPlansController@fetchInfo') }}", {
- id: annual_id,
- program_id: program_id
-
-
- },
- function(json) {
-
- div = $('<div/>', {
- 'class': 'list-group',
- 'id': 'list'
- });
- if(json.outcomes.first){
- header5 = $('<h5/>', {
- 'style': "padding-left: 10px"
- }).html("First Semester");
- div.append(header5);
- list = '';
- for (outcome in json.outcomes.first) {
- list +=
- "<li style='padding-left: 25px' onclick = 'fetchEverything(this)' data-annual-plan = '" +
- json.annual_plans.id + "' data-typ-semester-outcome-id ='"+json.outcomes.first[outcome].typ_semester_outcome_id+"' data-semester-id = '" + json.allSemesterOrder.first.id +
- "' data-outcome-id='" + json.outcomes.first[outcome].id + "' data-outcome-name ='" + json
- .outcomes.first[outcome].name + "' class='list-group-item' >" + json.outcomes.first[outcome]
- .name + " </li>";
-
- }
- div.append(list);
- }
- if(json.outcomes.second){
- header4 = $('<h5/>', {
- 'style': "padding-left: 10px"
- }).html("Second Semester");
- div.append(header4);
- list = '';
- for (outcome in json.outcomes.second) {
- list +=
- "<li style='padding-left: 25px' onclick = 'fetchEverything(this)' data-annual-plan = '" +
- json.annual_plans.id + "' data-typ-semester-outcome-id ='"+json.outcomes.second[outcome].typ_semester_outcome_id+"'data-semester-id = '" + json.allSemesterOrder.second.id +
- "' data-outcome-id='" + json.outcomes.second[outcome].id + "' data-outcome-name ='" + json
- .outcomes.second[outcome].name + "' class='list-group-item' >" + json.outcomes.second[
- outcome].name + " </li>";
-
- }
- div.append(list);
- }
- html = div[0].innerHTML;
-
- $("#allOutcomes").html(div[0].innerHTML);
- $("#allOutcomes").show();
-
- },
- "json",
- );
-
- }
-
-
- function deleteObjective(objectiveSelectDiv, closeObj) {
-
- $('#' + objectiveSelectDiv).remove();
- $('#' + closeObj).remove();
- $('#' + div).data("amount-select", $('#' + div).data("amount-select") - 1);
-
- }
- </script>
-
-
-
-
- @stop
-
- @section('included-js')
- @include('global._datatables_js')
- @stop
|