Skip to content

Commit

Permalink
Show assigned and requested lab assistants in TA console
Browse files Browse the repository at this point in the history
  • Loading branch information
colinschoen committed Aug 30, 2015
1 parent 23db07c commit ebefeef
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/Assignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ public function sec() {
return $this->hasOne('App\Section', "id", "section");
}

public function user() {
return $this->hasOne('App\User', "id", "uid");
}

}
2 changes: 1 addition & 1 deletion app/Http/Controllers/TAController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function get_console() {
//Get our audits
$audits = Audit::with("user")->orderBy('created_at', 'DESC')->get();
//Get our sections
$sections = Section::with("ta")->with("ta2")->with("category")->orderBy("type", "ASC")->get();
$sections = Section::with("pref.user")->with("assigned.user")->with("ta")->with("ta2")->with("category")->orderBy("type", "ASC")->get();
//Get our announcements
$announcements = Announcement::with("user")->orderBy("hidden", "DESC")->orderBy("created_at", "DESC")->get();
return view("ta.console")->with(["sections" => $sections, "user_hours" => $user_hours, "checkins_unique_per_week" => $checkins_unique_per_week, "checkins_per_staff" => $checkins_per_staff,"checkins_per_week" => $checkins_per_week, "audits" => $audits, "announcements_ta" => $announcements, "gsis" => $gsis, "types" => $types, "checkins" => $checkins, "users" => $users, "password" => $password]);
Expand Down
4 changes: 4 additions & 0 deletions app/Preference.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ public function getUpdatedAtAttribute($value)
public function sec() {
return $this->hasOne('App\Section', "id", "section");
}

public function user() {
return $this->hasOne('App\User', "id", "uid");
}
}
8 changes: 8 additions & 0 deletions app/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,12 @@ public function ta2() {
return $this->hasOne('App\User', 'id', 'second_gsi');
}

public function pref() {
return $this->hasMany('App\Preference', 'section', 'id');
}

public function assigned() {
return $this->hasMany('App\Assignment', 'section', 'id');
}

}
7 changes: 4 additions & 3 deletions resources/views/ta/console.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
<div class="col-lg-12">
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped">
<tr><th>Type</th><th>Location</th><th>Days</th><th>Start Time</th><th>End Time</th><th>GSI</th><th>Max Lab Assistants</th><th>Lab Assistants</th><th>Actions</th></tr>
<tr><th>Type</th><th>Location</th><th>Days</th><th>Start Time</th><th>End Time</th><th>GSI</th><th>Max Lab Assistants</th><th>Assigned</th><th>Requested</th><th>Actions</th></tr>
@foreach ($sections as $s)
<tr data-sid="{{{ $s->id }}}" data-type="{{{ $s->type }}}" data-location="{{{ $s->location }}}" data-max_las="{{{ $s->max_las}}}" data-mon="{{{ $s->mon }}}" data-tue="{{{ $s->tue }}}" data-wed="{{{ $s->wed }}}" data-thu="{{{ $s->thu }}}" data-fri="{{{ $s->fri }}}" data-sat="{{{ $s->sat }}}" data-sun="{{{ $s->sun }}}" data-gsi="{{{ $s->gsi }}}" data-second_gsi="{{{ $s->second_gsi }}}" data-start_time="{{{ $s->start_time }}}" data-end_time="{{{ $s->end_time }}}">
<td>{{{ $s->category->name }}}</td>
Expand All @@ -304,8 +304,9 @@
@else
<td><span class="label label-danger"><i class="fa fa-bookmark fa-fw"></i> {{{ $s->ta->name }}}</span> @if ($s->second_gsi != -1) <span class="label label-danger"><i class="fa fa-bookmark fa-fw"></i> {{{ $s->ta2->name }}}</span> @endif </td>
@endif
<td>{{{ $s->max_las }}}</td>
<td>Coming Soon</td>
<td>@if ($s->max_las == -1 ) &infin; @else {{{ $s->max_las }}} @endif</td>
<td>@foreach ($s->assigned as $assigned) {{{ $assigned->user->name }}} @endforeach</td>
<td>@foreach ($s->pref as $assigned) {{{ $assigned->user->name }}} @endforeach</td>
<td><a class="sectionViewActionsLink" href="#">View Actions</a>
<p class="sectionActions" style="display: none;">
<button class="btn btn-warning sectionEditBtn">
Expand Down

0 comments on commit ebefeef

Please sign in to comment.