暂无描述

learning-outcomes-grad-undergrad.blade.php 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. @extends('layouts.master')
  2. @section('navigation')
  3. @if (Auth::user()->role == 1)
  4. @include('local.managers.admins._new_navigation')
  5. @elseif(Auth::user()->role == 2)
  6. @include('local.managers.sCoords._new_navigation')
  7. @elseif(Auth::user()->role == 3)
  8. @include('local.managers.pCoords._new_navigation')
  9. @endif
  10. @stop
  11. @section('main')
  12. <div class="row">
  13. <div class="col-md-12">
  14. <p>Click on the values you want to change. Invalid values will be rejected automatically. To save your changes,
  15. click the 'Save' button at the bottom of the page.</p>
  16. <!-- Nav tabs -->
  17. <ul class="nav nav-tabs" role="tablist">
  18. <li role="presentation" class="active"><a href="#undergraduate" aria-controls="undergraduate"
  19. role="tab" data-toggle="tab">
  20. <h4>Undergraduate Program Participation</h4>
  21. </a></li>
  22. <li role="presentation"><a href="#graduate" aria-controls="graduate" role="tab" data-toggle="tab">
  23. <h4>Graduate Program Participation</h4>
  24. </a></li>
  25. </ul>
  26. <!-- Tab panes -->
  27. <div class="tab-content">
  28. <div role="tabpanel" class="tab-pane active" id="undergraduate">
  29. <table class="table table-striped table-condensed editable-table">
  30. <thead>
  31. <tr class="center-text">
  32. <th class="col-md-4">Learning Outcome</th>
  33. <th class="col-md-7">Definition</th>
  34. <th class="col-md-1">Expected Value</th>
  35. </thead>
  36. <tbody>
  37. @foreach ($outcomes as $outcome)
  38. <tr data-id="{{ $outcome->id }}">
  39. <td contenteditable="true" class="name col-md-4">{{ $outcome->name }}</td>
  40. <td contenteditable="true" data-type="textarea" class="definition col-md-6">
  41. {{ $outcome->definition }}</td>
  42. <td contenteditable="true" class="expected-outcome col-md-1">
  43. {{ $outcome->expected_outcome }}</td>
  44. </tr>
  45. @endforeach
  46. </tbody>
  47. </table>
  48. </div>
  49. <div role="tabpanel" class="tab-pane" id="graduate">
  50. <table class="table table-striped table-condensed editable-table">
  51. <thead>
  52. <tr class="center-text">
  53. <th class="col-md-4">Learning Outcome</th>
  54. <th class="col-md-7">Definition</th>
  55. <th class="col-md-1">Expected Value</th>
  56. </thead>
  57. <tbody>
  58. @foreach ($outcomes as $outcome)
  59. <tr data-id="{{ $outcome->id }}">
  60. <td contenteditable="true" class="name col-md-4">{{ $outcome->name }}</td>
  61. <td contenteditable="true" data-type="textarea" class="definition col-md-6">
  62. {{ $outcome->definition }}</td>
  63. <td contenteditable="true" class="expected-outcome col-md-1">
  64. {{ $outcome->expected_outcome }}</td>
  65. </tr>
  66. @endforeach
  67. </tbody>
  68. </table>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="row">
  74. <div class="col-md-12"><button class="btn btn-lg btn-primary center-block">Save</button></div>
  75. </div>
  76. @stop
  77. @section('javascript')
  78. $('button').on('click', function(e)
  79. {
  80. e.preventDefault();
  81. var outcomeArray= new Array();
  82. // For each learning outcome, get its value and put it into an array
  83. $('tbody tr').each(function( index )
  84. {
  85. var outcomeObject = new Object();
  86. outcomeObject.id= $(this).data('id');
  87. outcomeObject.name= $(this).children('.name').text();
  88. outcomeObject.definition= $(this).children('.definition').text();
  89. outcomeObject.expected_outcome= $(this).children('.expected-outcome').text();
  90. if($(this).find('.glyphicon-eye-close').length>0)
  91. {
  92. outcomeObject.delete=1;
  93. }
  94. else
  95. outcomeObject.delete=0;
  96. var clone = jQuery.extend({}, outcomeObject);
  97. outcomeArray.push(clone);
  98. });
  99. $.post(
  100. "{{ URL::action('OutcomesController@update') }}",
  101. { outcomeArray: JSON.stringify(outcomeArray)},
  102. function(data)
  103. {
  104. location.reload();
  105. }
  106. );
  107. });
  108. $('span').on('click', function()
  109. {
  110. if($(this).hasClass('glyphicon-eye-open'))
  111. $(this).removeClass('glyphicon-eye-open').addClass('glyphicon-eye-close');
  112. else
  113. $(this).removeClass('glyphicon-eye-close').addClass('glyphicon-eye-open');
  114. });
  115. @stop