Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
Fixed bug where pages wouldn't load due to free flights without airli…
Browse files Browse the repository at this point in the history
…ne assignment.
  • Loading branch information
BossOfGames committed Jun 3, 2019
1 parent f5e8c3d commit a432596
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
10 changes: 7 additions & 3 deletions app/Models/Flight.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ public function scopeCompleted($query)

public function getCallsign()
{
if (is_null($this->airline_id) && is_null($this->callsign))
return $this->flightnum;
if (is_null($this->callsign))
return $this->airline->icao.$this->flightnum;
if (is_null($this->airline_id))
return $this->flightnum;
if (is_null($this->callsign) && is_null($this->flightnum))
return "N/A";
else
return $this->callsign;


return $this->callsign;
}
}
2 changes: 1 addition & 1 deletion resources/views/admin/users/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</div>
</div>
<div class="form-group row">
<label class="col-md-3 form-control-label" for="text-input">Pilot ID</label>
<label class="col-md-3 form-control-label" for="text-input">Username</label>
<div class="col-md-9">
<input type="text" id="depicao" name="username" class="form-control" placeholder="eg. KLAX">
</div>
Expand Down
19 changes: 14 additions & 5 deletions resources/views/admin/users/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
<input type="text" class="form-control" name="email" value="{{ $user->email }}">
</div>
<div class="form-group">
<label>Pilot ID</label>
<input type="text" name="pilotid" class="form-control" value="{{ $user->pilotid }}" placeholder="0001">
<label>Username</label>
<input type="text" name="username" class="form-control" value="{{ $user->username }}" placeholder="0001">
</div>
<div class="form-group">
<label>VATSIM ID</label>
Expand Down Expand Up @@ -99,11 +99,20 @@
<tbody>
@foreach($user->flights as $p)
<tr>
<td>{{ $p->airline->icao }}</td>
<td>{{ $p->flightnum }}</td>
@if(isset($p->airline))
<td>{{ $p->airline->icao }}</td>
@else
<td>Private Flight</td>
@endif

<td>{{ $p->getCallsign() }}</td>
<td>{{ $p->depapt->icao }}</td>
<td>{{ $p->arrapt->icao }}</td>
<td>{{ $p->aircraft->name }} ({{ $p->aircraft->registration }})</td>
@if(isset($p->aircraft))
<td>{{ $p->aircraft->name }} ({{ $p->aircraft->registration }})</td>
@else
<td>Aircraft Assignment Error</td>
@endif
@if($p->status === 1)
<td>Approved</td>
@elseif($p->status === 2)
Expand Down

0 comments on commit a432596

Please sign in to comment.