Keine Beschreibung

semesters.blade.php 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. @extends('layouts.master')
  2. @section('css')
  3. {{ HTML::style('vendor/datetimepicker-master/jquery.datetimepicker.css') }}
  4. @stop
  5. @section('navigation')
  6. @include('local.managers.admins._new_navigation')
  7. @stop
  8. @section('main')
  9. <div class="row">
  10. <div class="col-md-8">
  11. <p>Use this page to change the available semesters' start dates, end dates, and visibility. Start dates and end
  12. dates determine the range of time within which users enter data for each semester. Visibility determines
  13. whether a user can select that semester for viewing and/or entering data. Users cannot enter new data in a
  14. closed semester, even if it is visible.</p>
  15. <p><strong>Important: At least one semester must be visible, and must have started. While semesters may have
  16. overlapping dates, they cannot have the same dates.</strong></p>
  17. <table class="table table-striped">
  18. <thead>
  19. <tr>
  20. <th>Code</th>
  21. <th>Name</th>
  22. <th>Start Date</th>
  23. <th>End Date</th>
  24. <th>Visible</th>
  25. <th>Save</th>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. </tbody>
  30. @foreach ($semesters as $semester)
  31. <tr>
  32. <td data-id="{{ $semester->id }}" class="semester-code">{{ $semester->code }}</td>
  33. <td class="semester-name">{{ $semester->name }}</td>
  34. <td class="semester-start"><input class="datetimepicker" type="text"
  35. value="{{ date('m/d/y H:i:s', strtotime($semester->start)) }}"></td>
  36. <td class="semester-end"><input class="datetimepicker" type="text"
  37. value="{{ date('m/d/y H:i:s', strtotime($semester->end)) }}"></td>
  38. <td class="semester-visible">
  39. <select name="" id="">
  40. @if ($semester->is_visible)
  41. <option selected="selected" value="1">Yes</option>
  42. <option value="0">No</option>
  43. @else
  44. <option value="1">Yes</option>
  45. <option selected="selected" value="0">No</option>
  46. @endif
  47. </select>
  48. </td>
  49. <td class="semester-save"><span class="glyphicon glyphicon-floppy-disk"></span></td>
  50. </tr>
  51. @endforeach
  52. </table>
  53. </div>
  54. </div>
  55. @stop
  56. @section('included-js')
  57. <script src="{{ asset('vendor/datetimepicker-master/jquery.datetimepicker.js') }}"></script>
  58. @stop
  59. @section('javascript')
  60. // ------------------------------------------------------------------------
  61. // Page Load
  62. // ------------------------------------------------------------------------
  63. $('.datetimepicker').datetimepicker({
  64. format: 'm/d/y H:i:s'
  65. });
  66. // ------------------------------------------------------------------------
  67. // Events
  68. // ------------------------------------------------------------------------
  69. $('.semester-save').on('click', function(e)
  70. {
  71. e.preventDefault();
  72. var id = ($(this).siblings('.semester-code').data('id'));
  73. var start = ($(this).siblings('.semester-start').find('.datetimepicker').val());
  74. var end = ($(this).siblings('.semester-end').find('.datetimepicker').val());
  75. var visible = ($(this).siblings('.semester-visible').find(':selected').val());
  76. $.post(
  77. "{{ URL::action('SemestersController@update') }}",
  78. {
  79. id: id,
  80. start: start,
  81. end: end,
  82. visible: visible
  83. },
  84. function(data)
  85. {
  86. location.reload(true);
  87. }
  88. ).fail(function() {
  89. alert( "error" );
  90. });
  91. });
  92. // ------------------------------------------------------------------------
  93. // Functions
  94. // ------------------------------------------------------------------------
  95. function selectSchoolandProgram(semester, role)
  96. {
  97. switch(role)
  98. {
  99. case 1:
  100. $('#school option[value="0"]').prop('selected', true);
  101. $('#program option[value="0"]').prop('selected', true);
  102. break;
  103. case 2:
  104. var school_id = semester.find('.semester-school').data('school-id');
  105. $('#school option[value="'+school_id+'"]').prop('selected', true);
  106. fetchPrograms();
  107. $('#program option[value="0"]').prop('selected', true);
  108. break;
  109. case 3:
  110. case 4:
  111. var school_id = semester.find('.semester-school').data('school-id');
  112. var program_id = semester.find('.semester-program').data('program-id');
  113. $('#school option[value="'+school_id+'"]').prop('selected', true);
  114. fetchPrograms();
  115. $('#program option[value="'+program_id+'"]').prop('selected', true);
  116. break;
  117. }
  118. }
  119. @stop