@extends('layouts.master') @section('navigation') @if(Auth::user()->role==2) @include('local.managers.sCoords._navigation') @elseif(Auth::user()->role==3) @include('local.managers.pCoords._navigation') @endif @stop @section('main')
@foreach ($typs as $typ)
  • {{$typ->year_start}}-{{$typ->year_end}}
  • @endforeach

    Select two or more Semesters that will be evaluated by an Outcome.

    {{-- --}}
    @foreach ($outcomes as $outcome) @endforeach
    Learning Outcomes
    1er sem 2do sem 1er sem 2do sem 1er sem 2do sem
    {{$outcome->name}}

    Select one or more Objectives that will be evaluated in a given Semester.


    Select one or more Courses that will be evaluated by an Objective in a given Semester.


    Select a Three year cycle to start

    @stop @section('included-js') @include('global._datatables_js') @stop @section('javascript') $(document).ready(function() { // -------------------------------------------------------------------------- // Page load // -------------------------------------------------------------------------- // Hide accordion panel contents by default var outcomes = {{json_encode($outcomes)}}; $('.panel-group .panel-body').hide(); $('#cycle-display').parent().hide(); $("#clonedOutcome0").hide();; $('.show-course-selection').hide(); // -------------------------------------------------------------------------- // Functions // -------------------------------------------------------------------------- (function () { var previous; $("select").on('focus', function () { // Store the current value on focus and on change previous = this.value; }).change(function() { //comienzo var options_values = $(this).parent().find('select').val().split('-'); //ifs if (options_values.length == 3){ var typ_id = $('#table-cycles').data('typ-id'); var previous_objective_id = previous.split('-')[2]; var options_values =this.value.split('-'); var outcome_id = options_values[0]; var semester_id = options_values[1]; var new_objective_id = options_values[2]; if (new_objective_id == 'n'){ new_objective_id = 'nothing_selected'; } if (previous_objective_id == 'n'){ previous_objective_id = 'nothing_selected'; } $.post( "{{ URL::action('ThreeYearPlanController@section2_on_change') }}", { typ_id: (typ_id), previous_objective_id: (previous_objective_id), outcome_id: (outcome_id), semester_id: (semester_id), new_objective_id: (new_objective_id), program_id: {{$program_id}} }, function(data) { // } ); previous = this.value; } else if (options_values.length == 4){ var typ_id = $('#table-cycles').data('typ-id'); var previous_course_id = previous.split('-')[3]; var options_values =this.value.split('-'); var outcome_id = options_values[0]; var semester_id = options_values[1]; var objective_id = options_values[2]; var new_course_id = options_values[3]; if (new_course_id == 'n'){ new_course_id = 'nothing_selected'; } if (previous_course_id == 'n'){ previous_course_id = 'nothing_selected'; } $.post( "{{ URL::action('ThreeYearPlanController@section3_on_change') }}", { typ_id: (typ_id), previous_course_id: (previous_course_id), outcome_id: (outcome_id), semester_id: (semester_id), objective_id: (objective_id), new_course_id: (new_course_id), program_id: {{$program_id}} }, function(data) { // } ); previous = this.value; } }); })(); // -------------------------------------------------------------------------- // Events // -------------------------------------------------------------------------- $('.go-to-temp').on('click', function(){ $.post( "{{ URL::action('ThreeYearPlanController@createAnnualPlan', array($program_id))}}", { typ_id: $('#table-cycles').data('typ-id') }); window.location.href = "{{URL::action('AnnualPlansController@showPlan',array($program_id))}}"; }); // When list item is clicked, load corresponding info //section 1 $('.list-group-item').on('click', function() { $('#three_year_button').hide(); var id = $(this).data('cycle-id'); $('#table-cycles').data('typ-id',id); $('#print_button').show(); $('#print_button').attr("href", "{{URL::action('ThreeYearPlanController@printPlan', [$program_id])}}"+ '/'+ $(this).data('cycle-id')); $('#section1').show(); $('#section2').hide(); $('#section3').hide(); var outcome_id_semester_code_program_id_box_id_typ_id = new Object(); var outcome_id_semester_code_program_id_box_id_typ_id = Array(); $.post( "{{ URL::action('ThreeYearPlanController@fetchThreeYears') }}", { id: id }, function(json) { // Retrieve datatable instance var table = $('#table-cycles'); var typ = json.typ; var year_start = json.typ.year_start; var year_end = json.typ.year_end; var semesters = json.typ.semesters; var program_id = {{$program_id}}; // var outcomes = already defined $('#cycle-display').parent().show(); $('.no-cycle').parent().hide(); //Display title and definition $('#cycle-display .panel-title').html('Planning for the years of ' + year_start + '-' + year_end); $('#cycle-display .cycle-definition').html("Select the semesters which you would like to review an outcome in the three year plan of " + year_start + '-' + year_end+"."); //Empty table //table.clear(); // Add new semesters //if(typ.length>0) //{ $('table').show(); $('#cycle1').html((parseInt(year_start))+"-"+(parseInt(year_start)+1)); $('#cycle2').html((parseInt(year_start)+1)+"-"+(parseInt(year_end)-1)); $('#cycle3').html((parseInt(year_end)-1)+"-"+(parseInt(year_end))); $('#cycle_id').val(typ.id); //resets the checkboxes' name, clears marked, and disables them by default. $.each(outcomes, function(index, outcome) { $.each([1,2,3,4,5,6], function(index, semester) { var id = outcome.id+"-sem"+semester; var new_name = id; document.getElementById(id).setAttribute("name", new_name); $("#"+id).attr("disabled", true); $("#"+id).prop("checked", false); }); }); var i = 1; $.each(outcomes, function(index, outcome) { $.each(semesters, function(index, semester) { var id = outcome.id+"-sem"+i; var new_name = outcome.id+"-sem"+semester.code; var checkbox = document.getElementById(id); checkbox.setAttribute("name", new_name); //enable the check box $("#"+id).removeAttr("disabled"); //store checkboxes info in an array to later lookup which are marked var temp = Array(outcome.id,semester.code,program_id, id, typ.id); outcome_id_semester_code_program_id_box_id_typ_id.push(temp); i++; }); i = 1; }); //search which boxes are marked in the data-base $.post( "{{ URL::action('ThreeYearPlanController@lookup_typ_semester_outcome' ) }}", { info : (outcome_id_semester_code_program_id_box_id_typ_id) }, function(data) { $.each(data.box_value, function(index, box_id_value) { var box_id = box_id_value[0]; var value = box_id_value[1]; if (1 == value) { $("#"+box_id).prop("checked", true); } }); } ); }, 'json' ); }); }); // go back to section 1 $('.back-to-1').on('click', function(e) { window.scrollTo(0, 0); $(".panel-body").hide(); $("#section1").show(); }); // go back to section 2 $('.back-to-2').on('click', function(e) { window.scrollTo(0, 0); $(".panel-body").hide(); $("#section2").show(); }); // go to section 2 $('.go-to-2').on('click', function(e) { var not_enough = false; var i = 0; $('#table-cycles tbody tr').each(function() { $(this).find('th').each(function() { if ($(this).find('input').is(':checked')){ i = i + 1; } }); if (i < 2){ not_enough = true; } i = 0; }); if (not_enough == true){ alert("Each Outcome must be evaluated in at least 2 semesters."); return true; } $(".panel-body").hide();; $("#section2").show();; var typ_id = $('#table-cycles').data('typ-id'); $.post( "{{ URL::action('ThreeYearPlanController@section2_arrive') }}", { typ_id: (typ_id), program_id: {{$program_id}} }, function(data) { $('.objectives-section').empty(); $.each(data, function(index, outcome) { var outcome_name = outcome.name; var outcome_id = outcome.id; $('.objectives-section').append('
    '); var area = $('.courses-section-0').clone(true); area.attr('class',''); var title = 'Outcome: ' + outcome_name; var title_area = $('.title-course-selection-0').clone(true); title_area.attr('class','title-course-selection h3'); title_area.find('p').html(title); area.append(title_area); $.each(outcome.selected_semesters, function(index, semester) { var semester_name = semester.name; var semester_id = semester.semester_id; var select_area = $('.semester-course-selection-0').clone(true); select_area.attr('class','semester-course-selection'); select_area.attr('style',' '); select_area.find('.semester-label-course-selection-0').html(semester_name+"'s Objectives"); var no_option = outcome_id+'-'+semester_id+'-n'; select_area.find('option').val(no_option).html('Select an Objective'); select_area.find('.add-objective-course').html(' Choose more Objectives'); if (semester.available_objectives.length != 0){ select_area.find('.objective-selector-0 label').hide(); $.each(semester.available_objectives, function(index, objective) { var objective_id = objective.id; var option_value = outcome_id+'-'+semester_id+'-'+objective_id; var option_name = objective.text; var new_option = select_area.find('.default-option').clone(true); new_option.html(option_name); new_option.val(option_value); new_option.attr('class','select_objective'); select_area.find('select').append(new_option); }); } if (semester.available_objectives.length == 0){ select_area.find('select').prop('disabled', 'disabled'); select_area.find('.objective-selector-0 label').html('There are no Objectives available for this Outcome and Semester combination'); select_area.find('.objective-selector-0 select').hide(); select_area.find('button').prop('disabled', 'disabled'); } $.each(semester.selected_objectives, function(index, objective) { select_area.find('.objective-selector-0').hide(); //si hay objetivos previamente seleccionados, escribirlos var objective_id = objective.id; var option_value = outcome_id+'-'+semester_id+'-'+objective_id; var new_select = select_area.find('.objective-selector-0').clone(true); new_select.attr('class','objective-selector'); new_select.find('select').val(option_value); select_area.find('.clone-objective-course-select-0').before(new_select); select_area.find('.objective-selector').show(); }); area.append(select_area); }); var footer = $('.footer-course-selection-0').clone(true); footer.attr('class','footer-course-selection'); footer.find('p').html('Objective selection for this Outcome is currently hidden.'); area.append(footer); area.append('
    '); area.show(true); $('.objectives-section').append(area); }); } ); }); // hide the options of an outcome in section 2 and 3 $('.hide-course-selection').on('click', function(e) { $(this).parent().find('.show-course-selection').show();; $(this).hide();; $(this).parent().parent().find('.semester-course-selection').hide(333); $(this).parent().parent().find('.footer-course-selection').show(333); }); // show the options of an outcome in section 2 and 3 $('.show-course-selection').on('click', function(e) { $(this).parent().find('.hide-course-selection').show(); $(this).hide(); $(this).parent().parent().find('.semester-course-selection').show(333); $(this).parent().parent().find('.footer-course-selection').hide(333); }); // in section 2 and 3, add selects for choosing more objectives and courses, respectively $('.add-objective-course').on('click', function(e) { var new_select = $(this).parent().parent().find('.objective-selector-0').clone(true); new_select.attr('class','objective-selector'); new_select.show(); $(this).parent().before(new_select); }); // go to section 3 $('.go-to-3').on('click', function(e) { window.scrollTo(0, 0); $(".panel-body").hide();; $("#section3").show();; var typ_id = $('#table-cycles').data('typ-id'); $.post( "{{ URL::action('ThreeYearPlanController@section3_arrive') }}", { typ_id: (typ_id), program_id : {{$program_id}} }, function(data) { $('.courses-section').empty(); $.each(data, function(index, outcome) { var outcome_name = outcome.name; var outcome_id = outcome.id; $('.courses-section').append('
    '); var area = $('.courses-section-0').clone(true); area.attr('class',''); var title = 'Outcome: ' + outcome_name; var title_area = $('.title-course-selection-0').clone(true); title_area.attr('class','title-course-selection h3'); title_area.find('p').html(title); area.append(title_area); $.each(outcome.selected_semesters, function(index, semester) { var semester_name = semester.name; var semester_id = semester.semester_id; var select_area = $('.semester-course-selection-0').clone(true); select_area.attr('class','semester-course-selection'); select_area.attr('style',' '); select_area.find('.semester-label-course-selection-0').html(semester_name); $.each(semester.selected_objectives, function(index, objective) { var objective_id = objective.objective_id; var objective_text = objective.text; var new_select = select_area.find('.select-course-selection-0').clone(true); new_select.attr('class','select-course-selection'); new_select.find('label').html(''); new_select.find('.objective-selector-0').before('

    Objective: '+objective_text+'

    '); {{-- new_select.find('.objective-selector-0 select').attr('style','width:100%;max-width:25%;'); --}} $.each(objective.available_courses, function(index, course) { var course_id = course.course_id; var option_value = outcome_id+'-'+semester_id+'-'+objective_id+'-'+course_id; var option_name = '['+course.code+'] '+course.name; var new_option = new_select.find('.default-option').clone(true); new_option.html(option_name); new_option.val(option_value); new_option.attr('class','select_course'); new_select.find('select').append(new_option); }); if (objective.available_courses.length == 0){ new_select.find('.select-course-selection-0').hide(); new_select.find('select').prop('disabled', 'disabled'); new_select.find('select label').html(' Objective "'+objective_text+'" has no courses available for selection'); new_select.find('button').prop('disabled', 'disabled'); } $.each(objective.selected_courses, function(index, course) { new_select.find('.objective-selector-0').hide(); //si hay objetivos previamente seleccionados, escribirlos var course_id = course.course_id; var option_value = outcome_id+'-'+semester_id+'-'+objective_id+'-'+course_id; var new_selected_course = new_select.find('.objective-selector-0').clone(true); new_selected_course.attr('class','objective-selector'); new_selected_course.find('select').val(option_value); {{-- new_selected_course.find('label').html(''); --}} new_selected_course.show(); new_select.find('.clone-objective-course-select-0').before(new_selected_course); }); select_area.find('.select-course-selection-0').after(new_select); }); if (semester.selected_objectives.length != 0){ select_area.find('.select-course-selection-0').hide(); } else{ select_area.find('select').prop('disabled', 'disabled'); select_area.find('.objective-selector-0').html('There are no objectives selected for this semester'); select_area.find('button').prop('disabled', 'disabled'); } area.append(select_area); }); var footer = $('.footer-course-selection-0').clone(true); footer.attr('class','footer-course-selection'); area.append(footer); area.append('
    '); area.show(true); $('.courses-section').append(area); }); } ); }); // remove an // remove an $('.delete-selection-0').on('click', function(e) { var options_values = $(this).parent().find('select').val().split('-'); //if == 3 then we are in the objective selector if (options_values.length == 3){ //get count of all objective-selectors in the same semester, plus objective-selector-0 var count_objective_selectors = $(this).parent().parent().find('.objective-selector').length; var count_objective_selectors_0 = $(this).parent().parent().find('.objective-selector-0').length; var count_objective_selectors_total = count_objective_selectors + count_objective_selectors_0; //view count of all objective-selectors in the same semester, plus objective-selector-0 console.log(count_objective_selectors_total); //variable that holds value of wether the objective-selector-0 is hidden or not var objective_selector_0_hidden = $(this).parent().parent().find('.objective-selector-0').is(':hidden'); if (count_objective_selectors_total == 1 || (count_objective_selectors_total == 2 && objective_selector_0_hidden)){ //if there is only one objective-selector,throw an alert and do nothing //html alert with dismiss button in the alert_placeholder div $('#alert_placeholder').html(''); return true; } //subtract 1 from count_objective_selectors_total var typ_id = $('#table-cycles').data('typ-id'); var outcome_id = options_values[0]; var semester_id = options_values[1]; var new_objective_id = "nothing_selected"; var previous_objective_id = options_values[2]; if (previous_objective_id == 'n'){ previous_objective_id = "nothing_selected"; // with the next return, the post shouldnt excecute. // im leaving the assignment in the line before this one just in case. //check to see if parent is objective-selector-0 var x = $(this).parent().parent().attr('class'); if ($(this).parent().attr('class') == 'objective-selector-0'){ // if it is then hide it $(this).parent().parent().hide(); return true; } $(this).parent().remove();; return true; } $.post( "{{ URL::action('ThreeYearPlanController@section2_on_change') }}", { typ_id: (typ_id), previous_objective_id: (previous_objective_id), outcome_id: (outcome_id), semester_id: (semester_id), new_objective_id: (new_objective_id) }, function(data) { // } ); } //if == 4 then we are in the course selector else if (options_values.length == 4 || options_values == "nothing_selected"){ //get count of all objective-selectors in the same semester, plus objective-selector-0 var count_objective_selectors = $(this).parent().parent().find('.objective-selector').length; var count_objective_selectors_0 = $(this).parent().parent().find('.objective-selector-0').length; var count_objective_selectors_total = count_objective_selectors + count_objective_selectors_0; //view count of all objective-selectors in the same semester, plus objective-selector-0 console.log(count_objective_selectors_total); //variable that holds value of wether the objective-selector-0 is hidden or not var objective_selector_0_hidden = $(this).parent().parent().find('.objective-selector-0').is(':hidden'); if (count_objective_selectors_total == 1 || (count_objective_selectors_total == 2 && objective_selector_0_hidden)){ //if there is only one objective-selector,throw an alert and do nothing //html alert with dismiss button in the alert-placeholder div $('#alert_placeholder').html(''); return true; } //subtract 1 from count_objective_selectors_total var typ_id = $('#table-cycles').data('typ-id'); var outcome_id = options_values[0]; var semester_id = options_values[1]; var objective_id = options_values[2]; var previous_course_id = options_values[3]; var new_course_id = 'nothing_selected'; $.post( "{{ URL::action('ThreeYearPlanController@section3_on_change') }}", { typ_id: (typ_id), previous_course_id: (previous_course_id), outcome_id: (outcome_id), semester_id: (semester_id), objective_id: (objective_id), new_course_id: (new_course_id) }, function(data) { // } ); } var x = $(this).parent().attr('class'); if ($(this).parent().attr('class') == 'objective-selector-0'){ // if it is then hide it $(this).parent().parent().hide(); return; } //remove the select $(this).parent().remove();; }); @stop @stop