123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- @extends('layouts.master')
-
- @section('navigation')
- @if (Auth::user()->role == 1)
- @include('local.managers.admins._new_navigation')
- @elseif(Auth::user()->role == 2)
- @include('local.managers.sCoords._new_navigation')
- @elseif(Auth::user()->role == 3)
- @include('local.managers.pCoords._new_navigation')
- @elseif(Auth::user()->role == 4)
- @include('local.professors._navigation')
- @endif
- @stop
-
-
- @section('main')
- <div class ='row'>
- <div class ='col-md-3'>
- <div class="form-group">
- {{ Form::label('program_id2', 'Select Program') }}
- <select id='select-program' class="form-control selectpicker"
- onchange='fetchAllObjectives("#select-program")'>
- @foreach ($programs as $program)
- <option value='{{ $program->id }}' data-is-graduate = "{{$program->is_graduate}}" data-subtext="{{ $program->code }}">
- {{ $program->name }}</option>
- @endforeach
- </select>
- </div>
- </div>
- </div>
-
- <div class = 'row'>
- <div class = 'col-md-12' id ='div_table'>
-
- </div>
-
-
- </div>
-
- <!-- Modal -->
- <div id="criteria-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"></h4>
- </div>
- <div class="modal-body">
-
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-
- </div>
- </div>
-
- </div>
- </div>
-
-
-
- <script>
-
- $(document).ready(function(){
- onLoad();
- });
-
- function onLoad(){
-
- fetchAllObjectives('#select-program');
-
- }
-
- function fetchAllObjectives(select){
- program_id =$(select).val();
- is_graduate = $(select).find(':selected').data('is-graduate');
-
-
- $.post(
- "{{URL::action('CriteriaController@fetchCriteriaOutcomes')}}",
- {
- program_id:program_id
- },
- function(criteria_outcomes){
-
-
- drawTable(criteria_outcomes.criteria, criteria_outcomes.outcomes, is_graduate);
-
- }
- )
- }
-
- function drawTable(criteria, outcomes, is_graduate){
-
-
- table = $('<table>',{
- 'id': 'theMainTable',
- 'class': 'table table-striped table-condensed datatable'
- });
-
- thead = $("<thead>");
- thead_row = $('<tr>');
-
- th= $('<th>').html('Criteria');
- thead_row.append(th);
-
-
-
- outcomes_th = [];
- $.each(outcomes, function(ind, outcomes){
-
- th = $('<th>', {
- 'class':'th-outcomes th-out-id',
- 'data-outcome-id':outcomes.id
- }).html(outcomes.name);
-
- outcomes_th.push(th);
-
- thead_row.append(th);
-
-
- })
- th = $('<th>', {
- 'class':'th-outcomes'
- }).html('Objectives');
-
- thead_row.append(th);
-
- thead.append(thead_row);
-
- tbody = $('<tbody>');
-
-
- $.each(criteria, function(ind, criterion){
-
- tr = $("<tr>", {
- 'class':'criteria',
- 'data-criterion-id':criterion.id,
- })
-
- td = $("<td>", {
- 'class': 'objective',
- 'data-criterion-id':criterion.id,
- }).html(criterion.name);
-
- tr.append(td);
-
- $(outcomes_th).each(function(id, th){
-
- var td = $('<td>');
- outcome_id = $(th).data('outcome-id');
- //console.log(outcome_id);
- if(criterion.outcome_ids.includes(outcome_id)){
- var span = $("<span>", {
- 'class':'glyphicon glyphicon-ok'
- })
- td.append(span);
- }
- tr.append(td);
-
- });
-
- td_link = $('<td>');
- a = $("<a>",{
- 'onclick':'fetchObjectiveCriteria("'+criterion.id+'", "#select-program")'
- }).html('View Objectives');
-
- td_link.append(a);
- tr.append(td_link);
-
- tbody.append(tr);
-
-
- });
-
- table.append(thead)
- table.append(tbody);
- $('#div_table').html(table);
-
- table = $("#theMainTable").DataTable();
- table.draw();
- }
-
-
- function fetchObjectiveCriteria(criterion_id,program_select){
- program_id = $(program_select).val();
- $.post(
- "{{URL::action('CriteriaController@fetchCriteriaObjectiveOutcomes')}}",
- {
- program_id:program_id,
- criterion_id:criterion_id
- },
- function(data){
- modal = "#criteria-modal";
-
-
- $(modal).find('.modal-body').html(createModalContent(data.outcomes));
-
- $(modal).find('.modal-title').html("Objectives for <strong>"+data.criterion.name+"</strong>")
- $(modal).modal('show');
- }
- )
- }
-
- function createModalContent(outcomes){
- ol_out = $("<ol>")
- $.each(outcomes, function(ind, out){
- //ol_out = $("<ol>")
- if(out.objectives.length == 0)
- return;
- li = $('<li>').html("<p><strong>"+out.name+"</strong></p>");
-
- ul = $('<ul>');
-
-
- $.each(out.objectives, function(ind, obj){
- li2 = $("<li>").html(obj.text);
- ul.append(li2);
- });
- li.append(ul);
- ol_out.append(li)
-
- //div.append(ol_out)
-
-
-
- })
-
- return ol_out;
- }
-
- </script>
-
- @stop
-
-
- @section('included-js')
- @include('global._datatables_js')
- @stop
-
- @section('javascript')
- @stop
|