12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310 |
- @extends('layouts.master')
-
- @section('navigation')
- @if (Auth::user()->role == 2)
- @include('local.managers.sCoords._new_navigation')
- @elseif(Auth::user()->role == 3)
- @include('local.managers.pCoords._new_navigation')
- @endif
- @stop
-
- @section('main')
- <script type="text/javascript">
- function filterCycles() {
- // Declare variables
- var input, filter, div, li, i, cycleText;
- input = document.getElementById('userInput');
- filter = input.value.toUpperCase();
- div = document.getElementById("list");
- li = div.getElementsByTagName('li');
-
- // Loop through all list items, and hide those who don't match the search query
- for (i = 0; i < li.length; i++) {
- cycleText = li[i].textContent;
- if (cycleText.toUpperCase().indexOf(filter) > -1) {
- li[i].style.display = "";
- } else {
- li[i].style.display = "none";
- }
- }
- }
-
- // onChange, update selected outcomes-semesters
- function update_outcome_semesters() {
- var outcomeSemesterArray = new Array();
- // For each learning outcome, get selected boxes and put it into an array
- $('#outcome-semesters-body tr').each(function(index) {
- var outcomeObject = new Object();
- outcomeObject.id = $(this).data('id');
- var semesters = new Array();
- var temp = new Array();
- temp.push($(this).children(".sem1-box").find("input").attr('name'));
- temp.push($(this).children(".sem1-box").find("input").prop("checked"));
- semesters.push(temp);
-
- temp = new Array();
- temp.push($(this).children(".sem2-box").find("input").attr('name'));
- temp.push($(this).children(".sem2-box").find("input").prop("checked"));
- semesters.push(temp);
-
- temp = new Array();
- temp.push($(this).children(".sem3-box").find("input").attr('name'));
- temp.push($(this).children(".sem3-box").find("input").prop("checked"));
- semesters.push(temp);
-
- temp = new Array();
- temp.push($(this).children(".sem4-box").find("input").attr('name'));
- temp.push($(this).children(".sem4-box").find("input").prop("checked"));
- semesters.push(temp);
-
- temp = new Array();
- temp.push($(this).children(".sem5-box").find("input").attr('name'));
- temp.push($(this).children(".sem5-box").find("input").prop("checked"));
- semesters.push(temp);
-
- temp = new Array();
- temp.push($(this).children(".sem6-box").find("input").attr('name'));
- temp.push($(this).children(".sem6-box").find("input").prop("checked"));
- semesters.push(temp);
-
- outcomeObject.semesters = semesters;
-
- var clone = jQuery.extend({}, outcomeObject);
- outcomeSemesterArray.push(clone);
- });
-
- var id = $('#table-cycles').data('typ-id');
-
- $.post(
- "{{ URL::action('ThreeYearPlanController@update_typ_outcomes_semesters') }}", {
- outcomeSemesterArray: JSON.stringify(outcomeSemesterArray),
- typ_id: (id),
- program_id: {{ $program_id }}
- },
- function(data) {
- //;
- }
- );
- }
- </script>
-
- <div class="row">
- <div id="alert_placeholder">
-
- </div>
- <div class="col-md-3">
- <input class="form-control" type="text" id="userInput" onkeyup="filterCycles()"
- placeholder="Search for Cycles..">
- <div class="list-group" id='list'>
- @foreach ($typs as $typ)
- <li data-cycle-id="{{ $typ->id }}" class="list-group-item">
- {{ $typ->year_start }}-{{ $typ->year_end }}</li>
- @endforeach
- </div>
- <br>
- <!--<button type="button" class="btn btn-secondary" id = "three_year_button" data-toggle="modal" data-target="#three_year">Create Three Year Cycle</button>
- -->
- </div>
-
- <!-- Modal -->
- <div id="three_year_modal" class="modal fade" role="dialog">
- <div class="modal-dialog">
- <!-- Modal content-->
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">×</button>
- <h4 class="modal-title">Create New Cycle</h4>
- </div>
- <div class="modal-body">
- {{ Form::open(['action' => 'ThreeYearPlanController@create']) }}
- <p>Select a new cycle. You cannot choose a cycle that has been created before</p>
- <input type='hidden' name='program_id' value='{{ $program_id }}'>
- <select name='years' class="form-control selectpicker">
-
-
- <option value='{{ $last_year }}'>{{ $last_year }} - {{ $last_year + 3 }} </option>
- <option value='{{ $last_year + 3 }}'>{{ $last_year + 3 }} - {{ $last_year + 6 }}
- </option>
-
-
- </select>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
- {{ Form::submit('Create Cycle', ['class' => 'btn btn-primary']) }}
- {{ Form::close() }}
- </div>
- </div>
-
- </div>
- </div>
-
-
-
- <div class="col-md-9">
- <div class="btn-group pull-right">
- <a href="" id="view_button" class="btn btn-default" target="_blank" rel="noopener noreferrer">View</a>
- <a href="" id="print_button" class="btn btn-default" target="_blank" rel="noopener noreferrer">Print</a>
- </div>
- <div id="cycle-display" class="panel panel-default">
- <div class="panel-heading">
- <h4 class=" panel-title" style="cursor:auto!important;">
- </h4>
- </div>
- <div class="panel-body" id="section1">
- <p class="section1-description">Select two or more Semesters that will be evaluated by a Learning
- Outcome.</p>
- <div class="table-responsive">
- {{-- <table class="table table-striped table-condensed datatable"> --}}
- <table data-typ-id="0" class="table table-striped table-condensed" id="table-cycles">
- <style media="screen">
- input[type=checkbox] {
- transform: scale(2);
- }
-
- </style>
- <thead>
- <tr style="background-color:#FDD8B5;">
- <th rowspan="0" style="background-color:#F5DEDD;" class="text-center">Learning
- Outcomes</th>
- <th colspan="2" class="text-center" id="cycle1"></th>
- <th colspan="2" class="text-center" id="cycle2"></th>
- <th colspan="2" class="text-center" id="cycle3"></th>
- </tr>
- <tr class="">
- <th class="text-center">1er sem</th>
- <th class="text-center">2do sem</th>
- <th class="text-center">1er sem</th>
- <th class="text-center">2do sem</th>
- <th class="text-center">1er sem</th>
- <th class="text-center">2do sem</th>
- </tr>
- </thead>
- <tfoot>
- </tfoot>
- <input type="text" id="cycle_id" name="cycle_id" value="getsReplacedWithJS" hidden>
- <tbody id="outcome-semesters-body" onchange="update_outcome_semesters()">
- @foreach ($outcomes as $outcome)
- <tr data-id="{{ $outcome->id }}">
- <th>{{ $outcome->name }}</th>
- <th class="text-center sem1-box"><input type="checkbox"
- id="{{ $outcome->id }}-sem1" name="{{ $outcome->id }}-sem1"
- value="checked" /></th>
- <th class="text-center sem2-box"><input type="checkbox"
- id="{{ $outcome->id }}-sem2" name="{{ $outcome->id }}-sem2"
- value="checked" /></th>
- <th class="text-center sem3-box"><input type="checkbox"
- id="{{ $outcome->id }}-sem3" name="{{ $outcome->id }}-sem3"
- value="checked" /></th>
- <th class="text-center sem4-box"><input type="checkbox"
- id="{{ $outcome->id }}-sem4" name="{{ $outcome->id }}-sem4"
- value="checked" /></th>
- <th class="text-center sem5-box"><input type="checkbox"
- id="{{ $outcome->id }}-sem5" name="{{ $outcome->id }}-sem5"
- value="checked" /></th>
- <th class="text-center sem6-box"><input type="checkbox"
- id="{{ $outcome->id }}-sem6" name="{{ $outcome->id }}-sem6"
- value="checked" /></th>
- </tr>
- @endforeach
- </tbody>
- </table>
- <hr>
- <div class="">
- <button class="btn-lg btn-primary pull-right go-to-2" style="margin:5px;">Select
- Objectives</button>
- </div>
- </div>
- </div>
- <div class="panel-body" id="section2">
-
- <p class="section2-description">Select one or more Objectives that will be evaluated in a given
- Semester.</p>
- <div>
- <div class="objectives-section-0">
- </div>
- <div class="objectives-section">
- </div>
- <hr>
- <div class="">
- <button class="btn-lg btn-primary pull-right go-to-3" style="margin:5px;">Go to Course
- Selection</button>
- <button class="btn-lg btn-primary pull-right back-to-1" style="margin:5px;">Back to Semester
- Selection</button>
- </div>
- </div>
- </div>
- <div class="panel-body" id="section3">
- <p class="section3-description">Select one or more Courses that will be evaluated by an Objective in a
- given Semester.</p>
- <div>
- <div class="courses-main-clone-0" hidden>
- <div class="title-course-selection-0">
- <button class="btn btn-md btn-secondary pull-right hide-course-selection"><span
- class="glyphicon glyphicon-minus"></span> Hide Learning Outcome Options</button>
- <button class="btn btn-md btn-secondary pull-right show-course-selection"><span
- class="glyphicon glyphicon-plus"></span> Show Learning Outcome Options</button>
- <p class="h3" style="width:100%;max-width:80%;"><b> Learning Outcome:
- example</b></p>
- </div>
- <div class="semester-course-selection-0" style="margin-left:30px;">
- <label class="semester-label-course-selection-0" for="">First Semester of 2000-2000</label>
- <div class="select-course-selection-0" style="margin-left:30px;">
- <div class="objective-selector-0">
- <label for="">OBJECTIVE TEMP</label>
- <select class="select-0" name="" style="width:100%;max-width:55%;">
- <option class="default-option" value="nothing_selected">Select a course</option>
- </select>
- <button class="btn btn-md btn-primary delete-selection-0"
- style="margin:5px; "><span></span> X</button>
- </div>
- <div class="clone-objective-course-select-0">
- <div class = 'btn-group'>
- <button class="btn btn-md btn-secondary add-objective-course"
- style="margin:5px;"><span class="glyphicon glyphicon-plus"></span> Choose more
- Courses</button>
- <button class = 'btn btn-md btn-secondary copy-objective-button' onclick="showParingObjectiveModal(this)" style="margin:5px;">Copy Courses to each Objective</button>
- </div>
- </div>
- </div>
- </div>
- <div class="footer-course-selection-0" style="margin-left:30px;" hidden>
- <p><b>Course selection for this Learning Outcome is currently hidden</b></p>
- </div>
- </div>
- <div class="courses-section-0">
- </div>
- <div class="courses-section">
- </div>
- <hr>
- <div class="">
- <button class="btn-lg btn-primary pull-right go-to-temp" style="margin:5px;">Save & Create
- Annual Plans</button>
- <button class="btn-lg btn-primary pull-right back-to-2" style="margin:5px;">Back to Objective
- Selection</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="col-md-9">
- <div class="no-cycle alert alert-info">
- <p>Select a Three year cycle to start</p>
- </div>
- </div>
-
- <div id="SubmitModal" class="modal fade" tabindex="-1" data-criterion-id="0">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header" style="background-color: rgba(109, 223, 59, 0.8)">
- <h5 class="modal-title">Three Year Plan has been submitted</h5>
- <button type="button" class="close" data-dismiss="modal">×</button>
- </div>
- <div class="modal-body" id = "modalBody">
- <h5>Would you like to submit this Three Year Plan to the administration now?</h5>
- <p>You can later submit other changes in another time, but you may have to explain</p>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary" data-dismiss="modal" >Not yet</button>
- <button type="button" class="btn btn-primary" onclick = 'submitTYP()'>Submit & go to Annual Plans</button>
- </div>
- </div>
- </div>
- </div>
-
- <div id="VerifyModal" class="modal fade" tabindex="-1" data-criterion-id="0">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header" style="background-color: rgba(247, 83, 6, 0.817)">
- <h5 class="modal-title">There is some information missing</h5>
- <button type="button" class="close" data-dismiss="modal">×</button>
- </div>
- <div class="modal-body" id = "VerifyBody">
-
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary" data-dismiss="modal" >Ok</button>
-
- </div>
- </div>
- </div>
- </div>
- <div id="pairingModal" class="modal fade" tabindex="-1" data-criterion-id="0">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header" >
- <h5 class="modal-title" id = "pairingModalTitle">Would you like to pair this </h5>
- <button type="button" class="close" data-dismiss="modal">×</button>
- </div>
- <div class="modal-body" id = 'pairingModalBody'>
-
-
- </div>
- <div class="modal-footer">
-
- <button type="button" class="btn btn-secondary" data-dismiss="modal" >cancel</button>
- <button type="button" id='pairingModalSubmitButton' class="btn btn-primary" data-dismiss="modal" onclick = 'pairEverything()' >Ok</button>
-
- </div>
- </div>
- </div>
- </div>
-
- </div>
-
- <script>
-
- function fetchPairingArraysForCourses(select_semester_selector, out_sem_obj_course_array, course_ids, outcome_id){
-
- dict_to_send = {};
- //always the same
-
-
-
-
- dict_to_send['este_semestre']= returnArrayReadyPerSelector(select_semester_selector, outcome_id, course_ids);
-
- //array_por_semestre = [];
- dict_to_send['por_semestre'] =[];
-
-
- select_semester_selector.parent().children('.semester-course-selection').each(function(ind, div){
- dict_to_send['por_semestre'].push(returnArrayReadyPerSelector(div, outcome_id, course_ids));
- });
-
- //dict_to_send['por_semestre'] = array_por_semestre;
- return JSON.stringify(dict_to_send) ;
-
- }
- function returnArrayReadyPerSelector(selector, outcome_id, course_ids){
- array_to_return =[];
- semester_id = $(selector).data('semester-id');
- $(selector).children("div.select-course-selection").each(function(ind, div){
- var objective_id = $(div).data('objective-id');
- $.each(course_ids, function(ind, course_id){
- array_to_return.push([outcome_id,semester_id,objective_id, course_id ])
- })
- });
-
- return array_to_return;
- }
-
-
-
- function showParingObjectiveModal(button){
- modal = "#pairingModal"
-
-
-
-
- is_obj = false;
- if($(button).html()=="Copy Courses to each Objective"){
- $(modal+'Title').html("Would you like to pair these Courses to each Objective in this Outcome");
- $(modal+'Body').html(
- "<label> Please select if you would like to pair these courses on this semester only or on each semester of this Outcome</label>"
- );
- select_semester = $("<select>",{
- 'class':'selectpicker form-control',
- 'id':'selectPorSemestre'
- });
- option = $("<option>", {
- 'value': 'por_semestre'
- }).html("For each Semester and Objective in this Outcome")
-
- select_semester.append(option);
- option = $("<option>", {
- 'value': 'este_semestre'
- }).html("For each Objective in this Semester and Outcome");
- select_semester.append(option);
-
- $(modal+'Body').append(select_semester);
- $('.selectpicker').selectpicker('refresh');
-
- }
- else{
- $(modal+'Title').html("Would you like to pair these Objective to each Semester in this Outcome");
- $(modal+'Body').html("This action will pair these Objectives to each Semester of this Outcome.<br> This action is reversable")
-
- is_obj = true;
-
- }
- select_course_selector = $(button).parent().parent().parent();
- objective_selectors= select_course_selector.find("div:not([style*='display: none'])");
- selects = objective_selectors.find('select');
-
-
- array_to_send = [];
-
- var semester_id;
- var outcome_id;
- var objectives_ids = [];
- var course_ids = [];
- $.each(selects, function(ind, select){
- splited = $(select).val().split('-');
- semester_id = splited[1];
- outcome_id = splited[0];
- objectives_ids.push(splited[2]);
- if(!is_obj){
- course_ids.push(splited[3]);
- }
-
- array_to_send.push(splited);
- })
-
- if(!is_obj){
-
- two_possible_arrays = fetchPairingArraysForCourses(select_course_selector.parent(), array_to_send, course_ids, outcome_id);
-
-
- }
-
- else{
- whole_outcome_div = select_course_selector.parent().parent();
- whole_outcome_div.children('div.semester-course-selection').each(function(ind, div){
- if($(div).data('semester-id')== semester_id){
- return;
- }
-
- div_semester = $(div).data('semester-id');
- $.each(objectives_ids, function(ind, obj){
- array_to_send.push([outcome_id, div_semester, obj]);
- })
-
-
- })
-
- }
-
- if($(button).html()=="Copy Courses to each Objective"){
- $(modal+"SubmitButton").attr('onclick', 'pairEveryCourse('+two_possible_arrays+')');
-
- }
- else{
- $(modal+"SubmitButton").attr('onclick', 'pairEveryObjective(['+array_to_send.toString()+'])')
-
- }
-
-
-
-
- $(modal).modal('show');
-
- }
-
- function pairEveryCourse(two_possible_arrays){
- // two_possible_arrays = JSON.parse(two_possible_arrays);
-
- pair_array = two_possible_arrays[$('#selectPorSemestre').val()];
-
- var typ_id = $('#table-cycles').data('typ-id');
- $.post(
- "{{URL::action('ThreeYearPlanController@pairEveryCourse')}}", {
- pairing_array:pair_array,
- typ_id:typ_id,
- program_id:{{$program_id}},
- type_of_work: $('#selectPorSemestre').val()
- },
- function(data){
- if(data==200)
- $(".go-to-3").trigger('click');
- }
- )
- }
- function pairEveryObjective(selected_objectives){
-
- var typ_id = $('#table-cycles').data('typ-id');
- $.post(
- "{{URL::action('ThreeYearPlanController@pairEveryObjective')}}",
- {
- selected_objectives:selected_objectives,
- typ_id: typ_id,
- program_id:{{$program_id}}
- },
- function(data){
- if(data ==200){
- $(".go-to-2").trigger('click');
- }
-
-
- }
- )
- }
- $(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() {
- typ_id =$('#table-cycles').data('typ-id');
- $.post(
- "{{ URL::action('ThreeYearPlanController@verifyAndCreate', [$program_id]) }}", {
- typ_id: typ_id
- },
- function(informationMissing) {
-
- if(informationMissing.length == 0){
-
- window.open("{{ URL::action('ThreeYearPlanController@printPlan', [$program_id]) }}"+"/"+typ_id+"/1", '_blank');
- $('#SubmitModal').modal('show');
- }
- else{
- $("#VerifyBody").html('<h3>These are the fields that are missing</h3>');
-
- if(informationMissing.objectives_missing !== undefined){
- $("#VerifyBody").append("<h4>These Outcomes need Objectives paired.</h4>")
-
- $.each(informationMissing.objectives_missing, function(ob_id, semester_object){
- name = "<h5>"+semester_object.semester_name+"</h5>";
-
- ul = $('<ul>');
-
- $.each(semester_object.outcome_text, function(ind, outcome){
- li = $('<li>').html(outcome)
- ul.append(li);
- })
- $('#VerifyBody').append(name);
- $("#VerifyBody").append(ul);
- });
- }
- if(informationMissing.courses_missing !== undefined){
- $("#VerifyBody").append("<h4>These Objectives need Courses. </h4>")
-
- $.each(informationMissing.courses_missing, function(ob_id, semester_object){
- name = "<h5>" + semester_object.semester_name +"</h5>";
- ul = $('<ul>');
-
- $.each(semester_object.outcomes, function(ind, outcome){
- li = $('<li>').html(outcome.outcome_name);
-
- nested_ul = $('<ul>');
- $.each(outcome.objectives, function(ind, ob){
- nested_li = $("<li>").html(ob);
- nested_ul.append(nested_li);
- });
- li.append(nested_ul);
-
-
- ul.append(li);
- })
- $('#VerifyBody').append(name);
- $("#VerifyBody").append(ul);
- });
- }
-
- $("#VerifyModal").modal('show');
-
- }
- // window.location.href = "{{ URL::action('AnnualPlansController@showPlan', [$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);
- $('#view_button').show();
- $('#view_button').attr("href",
- "{{ URL::action('ThreeYearPlanController@viewPlan', [$program_id]) }}" +
- '/' + $(this).data('cycle-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'
- );
-
-
- });
-
-
- });
-
-
- function submitTYP(){
- typ_id =$('#table-cycles').data('typ-id');
- $.post(
- "{{URL::action('ThreeYearPlanController@submit', [$program_id])}}",{
- typ_id:typ_id
- },
- function(code){
- if(code!=500)
- window.location.href = "{{ URL::action('AnnualPlansController@showPlan', [$program_id]) }}";
-
- }
- )
- }
-
- // 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 Learning 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('<hr>');
-
- var area = $('.courses-section-0').clone(true);
- area.attr('class', '');
-
- var title = outcome_name;
- //var title = 'Learning 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('data-semester-id', semester_id);
- 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(
- '<span class="glyphicon glyphicon-plus"></span> Choose more Objectives'
- );
- select_area.find('.copy-objective-button').html('Copy Objectives to each Semester in Outcome');
-
-
- 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 Learning 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();
- objective_selector = select_area.find(
- '.objective-selector');
- objective_selector.find(".delete-selection-0").show();
- });
- area.append(select_area);
- });
- var footer = $('.footer-course-selection-0').clone(true);
- footer.attr('class', 'footer-course-selection');
- footer.find('p').html(
- '<b>Objective selection for this Learning Outcome is currently hidden.</b>'
- );
- area.append(footer);
-
- area.append('<br>');
- 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().parent().find('.objective-selector-0').clone(true);
- new_select.attr('class', 'objective-selector');
- new_select.show();
- $(this).parent().before(new_select);
- //$('.selectpicker').selectpicker('refresh')
- });
-
-
- // 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('<hr>');
-
- var area = $('.courses-section-0').clone(true);
- area.attr('class', '');
-
-
- //var title = 'Outcome: ' + outcome_name;
-
- var title = 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('data-semester-id', semester_id);
- 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.attr('data-objective-id', objective_id);
- new_select.find('label').html('');
- new_select.find('.objective-selector-0').before(
- '<p>Objective: <b>' + objective_text +
- '</b></p>');
-
- {{-- 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
- .number + '] ' + 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('<br>');
- area.show(true);
- $('.courses-section').append(area);
-
- });
- //$('.selectpicker').selectpicker('refresh');
- //$('.objective-selector').children('.delete-selection-0').css("margin:5px; display:block;");
- }
- );
- });
-
-
- // remove an
- // remove an
- $('.delete-selection-0').on('click', function(e) {
-
-
- var options_values = $(this).parent().find('select').val().split('-');
-
- var ob_selector = $(this).parent();
-
- //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(
- '<div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> <strong>Warning!</strong>You must have at least one Objective per Semester </div>'
- );
-
-
-
- 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().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),
- program_id: {{ $program_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(
- '<div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> <strong>Warning!</strong>You must have at least one Course </div>'
- );
- 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),
- program_id:{{$program_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();;
- });
- </script>
- @stop
-
- @section('included-js')
- @include('global._datatables_js')
- @stop
-
- @stop
|