Change the PIREP accept/reject buttons
This commit is contained in:
parent
1f1acb424c
commit
e5c34bc8af
@ -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
|
* @param Request $request
|
||||||
* @return \Illuminate\View\View
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
@ -233,7 +233,7 @@ class PirepController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pirep->refresh();
|
$pirep->refresh();
|
||||||
return view('admin.pireps.pirep_card', ['pirep' => $pirep]);
|
return view('admin.pireps.actions', ['pirep' => $pirep]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
39
resources/views/admin/pireps/actions.blade.php
Normal file
39
resources/views/admin/pireps/actions.blade.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<table class="">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@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
|
||||||
|
</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>
|
||||||
|
@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
|
||||||
|
</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>
|
||||||
|
<a href="{!! route('admin.pireps.edit', [$pirep->id]) !!}"
|
||||||
|
class='btn btn-sm btn-success btn-icon'>
|
||||||
|
<i class="fa fa-pencil-square-o"></i></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
@ -54,46 +54,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 ">
|
<div class="col-lg-12">
|
||||||
<table class="pull-right">
|
<div id="pirep_{!! $pirep->id !!}_actionbar" class="pull-right">
|
||||||
<tr>
|
@include('admin.pireps.actions')
|
||||||
<td>
|
</div>
|
||||||
@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
|
|
||||||
</td>
|
|
||||||
<td> </td>
|
|
||||||
<td>
|
|
||||||
@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
|
|
||||||
</td>
|
|
||||||
<td> </td>
|
|
||||||
<td>
|
|
||||||
<a href="{!! route('admin.pireps.edit', [$pirep->id]) !!}"
|
|
||||||
class='btn btn-sm btn-success btn-icon'>
|
|
||||||
<i class="fa fa-pencil-square-o"></i></a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
@section('scripts')
|
@section('scripts')
|
||||||
<script>
|
<script>
|
||||||
function changeStatus(values) {
|
function changeStatus(values) {
|
||||||
var destContainer = '#pirep_' + values.pirep_id + '_container';
|
const destContainer = '#pirep_' + values.pirep_id + '_actionbar';
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: BASE_URL + '/admin/pireps/' + values.pirep_id + '/status',
|
url: BASE_URL + '/admin/pireps/' + values.pirep_id + '/status',
|
||||||
data: values,
|
data: values,
|
||||||
@ -11,7 +11,7 @@ function changeStatus(values) {
|
|||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
$(destContainer).replaceWith(data);
|
$(destContainer).html(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ $(document).ready(function() {
|
|||||||
console.log(event);
|
console.log(event);
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var values = {
|
const values = {
|
||||||
pirep_id: $(this).attr('pirep_id'),
|
pirep_id: $(this).attr('pirep_id'),
|
||||||
new_status: $(this).attr('new_status')
|
new_status: $(this).attr('new_status')
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
@extends('admin.app')
|
@extends('admin.app')
|
||||||
@section('title', 'pilot report')
|
@section('title', 'pilot report')
|
||||||
@section('actions')
|
|
||||||
<li><a href="#"><i class="ti-plus"></i>Accept</a></li>
|
|
||||||
<li><a href="#"><i class="ti-plus"></i>Reject</a></li>
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="card border-blue-bottom">
|
<div class="card border-blue-bottom">
|
||||||
@ -32,4 +28,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
@include('admin.pireps.scripts');
|
@include('admin.pireps.scripts')
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-4">
|
||||||
<div class="box box-solid">
|
<div class="box box-solid">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
{{--<i class="fa fa-text-width"></i>--}}
|
{{--<i class="fa fa-text-width"></i>--}}
|
||||||
@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-5">
|
||||||
<div class="box box-solid">
|
<div class="box box-solid">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
{{--<i class="fa fa-text-width"></i>--}}
|
{{--<i class="fa fa-text-width"></i>--}}
|
||||||
@ -23,6 +23,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-3">
|
||||||
|
<div id="pirep_{!! $pirep->id !!}_actionbar" class="pull-right">
|
||||||
|
@include('admin.pireps.actions')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
Loading…
Reference in New Issue
Block a user