123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- @extends('layouts.master')
-
- @section('navigation')
- @include('local.managers.admins._new_navigation')
- @stop
- @section('main')
-
- <div class="row">
- <div class="col-md-6">
- <div class="panel panel-default panel-button">
- <div class="panel-heading">
- Create a Course
- </div>
- <div class="panel-body">
-
- {{ Form::open(['action' => 'ProgramsController@addToOtherProgramTYP','enctype'=>"multipart/form-data"]) }}
-
-
- <!-- Program -->
- <div class="form-group">
- {{ Form::label('program', 'Select Program to pair other Program Courses\'') }}
- <select id="program" name="program" class="form-control selectpicker">
-
- @foreach ($programs as $program)
- @if (Input::old('program') != $program->id)
- <option value="{{ $program->id }}">{{ $program->name }}
- ({{ $program->school->name }})</option>
- @else
- <option selected value="{{ $program->id }}">{{ $program->name }}
- ({{ $program->school->name }})</option>
- @endif
- @endforeach
- </select>
- </div>
-
- <div class="form-group" id = "other_program_div">
- {{ Form::label('program', 'Choose other program') }}
- <select id="other_program_0" name="other_program[]" class="form-control selectpicker">
-
- @foreach ($programs as $program)
- @if (Input::old('program') != $program->id)
- <option value="{{ $program->id }}">{{ $program->name }}
- ({{ $program->school->name }})</option>
- @else
- <option selected value="{{ $program->id }}">{{ $program->name }}
- ({{ $program->school->name }})</option>
- @endif
- @endforeach
- </select>
-
-
- </div>
-
- <hr>
- <div class ='form-group'>
- <button id='add-other-program' class='btn btn-md btn-secondary'
- onclick='addOtherProgram("#add-other-program", "#other_program_div")'>
- <span class='glyphicon glyphicon-plus'>
-
- </span>
- Add another Program
- </button>
- </div>
-
-
-
-
-
-
-
-
- <br>
-
- {{ Form::submit('Pair Other Program Courses', ['class' => 'btn btn-primary btn-block', 'name' => 'pair_other_courses']) }}
- {{ Form::close() }}
-
- <br>
-
- </div>
- </div>
- </div>
-
- <div class="col-md-6">
- <div class="panel panel-default panel-button">
- <div class="panel-heading">
- Edit pairing
- </div>
- <div class="panel-body">
-
-
-
- <p>You can enroll students in this setting, by choosing the course and uploading a .txt file with the students numbers</p>
-
- {{ Form::open(['action' => 'ProgramsController@updatePairingInfo', 'enctype'=>"multipart/form-data"]) }}
-
-
- <div class = "form-group">
- {{Form::label('select-program-edit', "Edit Program Courses' Pairing")}}
- <select id = "select-program-edit" name = "program" class ='form-control selectpicker'
- onchange = "fetchProgramPairing('#select-program-edit')">
- @foreach ($programs as $program)
- @if (Input::old('program') != $program->id)
- <option value="{{ $program->id }}">{{ $program->name }}
- ({{ $program->school->name }})</option>
- @else
- <option selected value="{{ $program->id }}">{{ $program->name }}
- ({{ $program->school->name }})</option>
- @endif
- @endforeach
-
- </select>
- </div>
-
- <div class="form-group" id = "other_program_div_edit">
- {{ Form::label('program', 'Choose other program') }}
- <select id="program-edit" name="other_program[]" class="form-control selectpicker">
-
- @foreach ($programs as $program)
- @if (Input::old('program') != $program->id)
- <option value="{{ $program->id }}">{{ $program->name }}
- ({{ $program->school->name }})</option>
- @else
- <option selected value="{{ $program->id }}">{{ $program->name }}
- ({{ $program->school->name }})</option>
- @endif
- @endforeach
- </select>
-
- </div>
- <hr>
-
- <div class ='form-group'>
- <button id='add-other-program-edit' class='btn btn-md btn-secondary'
- onclick='addOtherProgram("#add-other-program-edit", "#other_program_div_edit")'>
- <span class='glyphicon glyphicon-plus'>
-
- </span>
- Add another Program
- </button>
- </div>
-
-
-
- <br>
-
- {{ Form::submit("Edit Program Courses' Pairing", ['class' => 'btn btn-primary btn-block', 'name' => 'edit_pair_other_courses']) }}
- {{ Form::close() }}
-
- </div>
- </div>
- </div>
- </div>
-
- <script>
- $('.filterSection').show();
- $('.filterButton').on('click', function() {
- var span = $(this).find('span');
- if (span.attr('class') == 'glyphicon glyphicon-plus') {
- span.attr('class', 'glyphicon glyphicon-minus');
- } else {
- span.attr('class', 'glyphicon glyphicon-plus');
- }
- $('.filterSection').toggle(533);
- });
- $('.filterButton').on('click', function(e) {
- // Prevent the default action of the clicked item. In this case that is submit
- e.preventDefault();
-
-
- return false;
- });
-
-
- options = $('#other_program_0').html();
-
- function addOtherProgram(button, div, removable = ''){
-
- master_div = $("<div>",{
-
- 'class':removable
-
- })
- div_select = $("<div>", {
- 'class':'col-md-11'
- })
- select = $("<select>", {
- 'name': "other_program[]",
- 'class':'form-control selectpicker '
- }).html(options);
-
- select.appendTo(div_select)
-
- div_button = $("<div>", {
- 'class':'col-md-1'
- })
-
- rem_button = $('<button>',{
- 'type':'button',
- 'class':'btn btn-primary',
- 'onclick':'$(this).parent().parent().remove();'
- }).html("<span class='glyphicon glyphicon-remove'></span>")
-
- div_button.append(rem_button);
-
- master_div.append(div_select);
- master_div.append(div_button);
- master_div.prepend("<br>")
- master_div.append("<br>");
-
-
-
-
-
- master_div.appendTo($(div));
- $('.selectpicker').selectpicker('refresh');
-
-
- }
-
-
- function fetchProgramPairing(select){
- $.post(
- "{{URL::action('ProgramsController@fetchPairingInfo')}}", {
- program_id: $(select).val()
- },
- function(paired_programs){
-
- $('.removable').remove();
-
- $.each(paired_programs, function(index, program_id){
-
- selectPick= $('#other_program_div_edit').find('select.selectpicker').eq(index).val(program_id);
- selectPick.val(program_id);
-
- if(paired_programs[index+1]){
- addOtherProgram("#add-other-program-edit", "#other_program_div_edit", 'removable')
- }
-
- $('.selectpicker').selectpicker('refresh');
- })
- }
- )
- }
-
-
- </script>
-
-
- @stop
-
- @section('javascript')
-
- // --------------------------------------------------------------------------
- // Page load
- // --------------------------------------------------------------------------
- $("#add-other-program").on("click", function(e){
- e.preventDefault();
- });
-
- $("#add-other-program-edit").on('click', function(e){
- e.preventDefault();
- })
-
-
- fetchProgramPairing('#select-program-edit')
-
- // --------------------------------------------------------------------------
- // Functions
- // --------------------------------------------------------------------------
-
-
-
- // --------------------------------------------------------------------------
- // Events
- // --------------------------------------------------------------------------
-
- @stop
|