From e5c34bc8af881a6ea582b7155baa044dc93cd67e Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Wed, 3 Jan 2018 20:39:24 -0600 Subject: [PATCH] Change the PIREP accept/reject buttons --- .../Controllers/Admin/PirepController.php | 4 +- .../views/admin/pireps/actions.blade.php | 39 ++++++++++++++++ .../views/admin/pireps/pirep_card.blade.php | 44 ++----------------- .../views/admin/pireps/scripts.blade.php | 6 +-- resources/views/admin/pireps/show.blade.php | 6 +-- .../views/admin/pireps/show_fields.blade.php | 10 ++++- 6 files changed, 57 insertions(+), 52 deletions(-) create mode 100644 resources/views/admin/pireps/actions.blade.php diff --git a/app/Http/Controllers/Admin/PirepController.php b/app/Http/Controllers/Admin/PirepController.php index adaddec2..c8ac642d 100644 --- a/app/Http/Controllers/Admin/PirepController.php +++ b/app/Http/Controllers/Admin/PirepController.php @@ -218,7 +218,7 @@ class PirepController extends BaseController } /** - * Change or update the PIREP status + * Change or update the PIREP status. Just return the new actionbar * @param Request $request * @return \Illuminate\View\View */ @@ -233,7 +233,7 @@ class PirepController extends BaseController } $pirep->refresh(); - return view('admin.pireps.pirep_card', ['pirep' => $pirep]); + return view('admin.pireps.actions', ['pirep' => $pirep]); } /** diff --git a/resources/views/admin/pireps/actions.blade.php b/resources/views/admin/pireps/actions.blade.php new file mode 100644 index 00000000..d69a4b67 --- /dev/null +++ b/resources/views/admin/pireps/actions.blade.php @@ -0,0 +1,39 @@ + + + + + + + + +
+ @if($pirep->state === PirepState::PENDING + || $pirep->state === PirepState::REJECTED) + {!! 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' => 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 +   + + +
diff --git a/resources/views/admin/pireps/pirep_card.blade.php b/resources/views/admin/pireps/pirep_card.blade.php index 9e1e5915..50266532 100644 --- a/resources/views/admin/pireps/pirep_card.blade.php +++ b/resources/views/admin/pireps/pirep_card.blade.php @@ -54,46 +54,10 @@
-
- - - - - - - - -
- @if($pirep->state == PirepState::PENDING - || $pirep->state == PirepState::REJECTED) - {!! 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' => 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 -   - - -
+
+
+ @include('admin.pireps.actions') +
diff --git a/resources/views/admin/pireps/scripts.blade.php b/resources/views/admin/pireps/scripts.blade.php index 8690d86e..1be405f1 100644 --- a/resources/views/admin/pireps/scripts.blade.php +++ b/resources/views/admin/pireps/scripts.blade.php @@ -1,7 +1,7 @@ @section('scripts')