diff --git a/app/Routes/admin.php b/app/Routes/admin.php index 921ec289..41a48c97 100644 --- a/app/Routes/admin.php +++ b/app/Routes/admin.php @@ -37,7 +37,7 @@ Route::group([ # pirep related routes Route::resource('pireps', 'PirepController'); Route::match(['get'], 'pireps/pending', 'PirepController@pending'); - Route::match(['post', 'put'], 'pireps/{id}/status', 'PirepController@status'); + Route::match(['post', 'put'], 'pireps/{id}/status', 'PirepController@status')->name('pirep.status'); Route::resource('pirepfields', 'PirepFieldController'); diff --git a/resources/views/admin/pireps/pirep_card.blade.php b/resources/views/admin/pireps/pirep_card.blade.php index 14d2f4d9..9e1e5915 100644 --- a/resources/views/admin/pireps/pirep_card.blade.php +++ b/resources/views/admin/pireps/pirep_card.blade.php @@ -10,13 +10,16 @@
- @if($pirep->state == PirepState::PENDING) -
Pending
+ @if($pirep->state === PirepState::PENDING) +
@elseif($pirep->state === PirepState::ACCEPTED) -
Accepted
+
+ @elseif($pirep->state === PirepState::REJECTED) +
@else -
Rejected
+
@endif + {!! PirepState::label($pirep->state) !!}
@@ -57,28 +60,30 @@ @if($pirep->state == PirepState::PENDING || $pirep->state == PirepState::REJECTED) - {!! Form::open(['url' => url('/admin/pireps/'.$pirep->id.'/status'), 'method' => 'post', - 'name' => 'accept_'.$pirep->id, - 'id' => $pirep->id.'_accept', - 'pirep_id' => $pirep->id, - 'new_status' => PirepState::ACCEPTED, - 'class' => 'pirep_submit_status']) !!} - {!! Form::button('Accept', ['type' => 'submit', 'class' => 'btn btn-info']) !!} - {!! Form::close() !!} + {!! Form::open(['url' => route('admin.pirep.status', ['id'=>$pirep->id]), + 'method' => 'post', + 'name' => 'accept_'.$pirep->id, + 'id' => $pirep->id.'_accept', + 'pirep_id' => $pirep->id, + 'new_status' => PirepState::ACCEPTED, + 'class' => 'pirep_submit_status']) !!} + {!! Form::button('Accept', ['type' => 'submit', 'class' => 'btn btn-info']) !!} + {!! Form::close() !!} @endif   @if($pirep->state == PirepState::PENDING || $pirep->state == PirepState::ACCEPTED) - {!! Form::open(['url' => url('/admin/pireps/'.$pirep->id.'/status'), 'method' => 'post', - 'name' => 'reject_'.$pirep->id, - 'id' => $pirep->id.'_reject', - 'pirep_id' => $pirep->id, - 'new_status' => PirepState::REJECTED, - 'class' => 'pirep_submit_status']) !!} - {!! Form::button('Reject', ['type' => 'submit', 'class' => 'btn btn-danger']) !!} - {!! Form::close() !!} + {!! Form::open(['url' => route('admin.pirep.status', ['id'=>$pirep->id]), + 'method' => 'post', + 'name' => 'reject_'.$pirep->id, + 'id' => $pirep->id.'_reject', + 'pirep_id' => $pirep->id, + 'new_status' => PirepState::REJECTED, + 'class' => 'pirep_submit_status']) !!} + {!! Form::button('Reject', ['type' => 'submit', 'class' => 'btn btn-danger']) !!} + {!! Form::close() !!} @endif