123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- @extends('layouts.master')
-
- @section('navigation')
- @include('local.managers.admins._new_navigation')
- @stop
-
- @section('main')
-
- <div class="row">
- <div class="col-md-12">
- <table class="table table-striped">
- <thead>
- <tr>
- <th>Name</th>
- <th>School</th>
- <th>Program</th>
- <th>Primary Email</th>
- <th>Role</th>
- </tr>
- </thead>
- <tbody>
-
- </tbody>
- @foreach ($users as $user)
- <tr>
- <td>{{ $user->surnames }}, {{ $user->first_name }}</td>
- <td>
- @if(count($user->school))
- {{ $user->school->name }}
- @endif
- </td>
- <td>
- @if(count($user->program))
- {{ $user->program->name }}
- @endif
- </td>
- <td class="email">{{ $user->email }}</td>
- <td>
- <select name="role" class="role form-control">
- <option value="1" <?php if ($user->role == 1) echo 'selected="selected"' ?>>Administrator</option>
- <option value="2" <?php if ($user->role == 2) echo 'selected="selected"' ?>>School Coordinator</option>
- <option value="3" <?php if ($user->role == 3) echo 'selected="selected"' ?>>Program Coordinator</option>
- <option value="4" <?php if ($user->role == 4) echo 'selected="selected"' ?>>Professor</option>
- </select>
- </td>
-
-
- </tr>
- @endforeach
- </table>
- {{ $users->links() }}
- <button id="submit_roles" class="btn btn-primary btn pull-right">Update this page</button>
- </div>
- </div>
-
- @stop
-
- @section('javascript')
-
- $(document).ready(function()
- {
- // --------------------------------------------------------------------------
- // Page load
- // --------------------------------------------------------------------------
-
- $('#submit_roles').on('click', function()
- {
- var userBundle = new Array();
- $('tbody tr').each(function()
- {
- var user = new Object();
- user.email= $(this).find('.email').text();
- user.role= $(this).find('.role').find(':selected').val();
-
- var clone = jQuery.extend({}, user);
- userBundle.push(clone);
- });
-
- alert(JSON.stringify(userBundle));
-
- // Save activity to the database
- $.post
- (
- "{{ URL::action('UsersController@update') }}",
- {
- users: JSON.stringify(userBundle),
- submit_roles: true
- },
- function(data)
- {
- location.reload();
- }
- );
-
- });
-
- // --------------------------------------------------------------------------
- // Functions
- // --------------------------------------------------------------------------
-
-
-
- // --------------------------------------------------------------------------
- // Events
- // --------------------------------------------------------------------------
-
-
- });
- @stop
|