Fix PIREP field error on file
This commit is contained in:
parent
2dee3190ce
commit
5ee053cace
@ -132,7 +132,6 @@ class Handler extends ExceptionHandler
|
||||
{
|
||||
if ($request->expectsJson() || $request->is('api/*')) {
|
||||
$error = $this->createError(401, 'Unauthenticated');
|
||||
|
||||
return response()->json($error, 401);
|
||||
}
|
||||
|
||||
@ -159,8 +158,8 @@ class Handler extends ExceptionHandler
|
||||
'exception' => $e,
|
||||
'SKIN_NAME' => config('phpvms.skin'),
|
||||
], $status, $e->getHeaders());
|
||||
} else {
|
||||
return $this->convertExceptionToResponse($e);
|
||||
}
|
||||
|
||||
return $this->convertExceptionToResponse($e);
|
||||
}
|
||||
}
|
||||
|
@ -489,6 +489,7 @@ class PirepController extends Controller
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \App\Exceptions\PirepCancelled
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function route_post($id, RouteRequest $request)
|
||||
{
|
||||
@ -506,6 +507,10 @@ class PirepController extends Controller
|
||||
|
||||
$count = 0;
|
||||
$route = $request->post('route', []);
|
||||
if (\count($route) === 0) {
|
||||
return $this->message('No points to add');
|
||||
}
|
||||
|
||||
foreach ($route as $position) {
|
||||
$position['pirep_id'] = $id;
|
||||
$position['type'] = AcarsType::ROUTE;
|
||||
|
@ -21,12 +21,12 @@ class RouteRequest extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
$rules = [
|
||||
'route' => 'nullable|array',
|
||||
/*'route.*.name' => 'required',
|
||||
'route' => 'required|array',
|
||||
'route.*.name' => 'required',
|
||||
'route.*.order' => 'required|int',
|
||||
'route.*.nav_type' => 'nullable|int',
|
||||
'route.*.lat' => 'required|numeric',
|
||||
'route.*.lon' => 'required|numeric',*/
|
||||
'route.*.lon' => 'required|numeric',
|
||||
];
|
||||
|
||||
return $rules;
|
||||
|
@ -1,9 +1,11 @@
|
||||
<table class="table table-responsive table-hover" id="flight-fields-table">
|
||||
@if(count($pirep->fields))
|
||||
<thead>
|
||||
<th></th>
|
||||
<th>Value</th>
|
||||
<th>Source</th>
|
||||
</thead>
|
||||
@endif
|
||||
<tbody>
|
||||
@foreach($pirep->fields as $field)
|
||||
<tr>
|
||||
|
@ -270,7 +270,7 @@ flight reports that have been filed. You've been warned!
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
|
||||
@if(isset($pirep) && $pirep->fields)
|
||||
<div class="form-container">
|
||||
<h6><i class="fab fa-wpforms"></i>
|
||||
{{ trans_choice('common.field', 2) }}
|
||||
@ -282,7 +282,7 @@ flight reports that have been filed. You've been warned!
|
||||
@each('pireps.custom_fields', $pirep->fields, 'field')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
<div id="fares_container">
|
||||
@include('pireps.fares')
|
||||
</div>
|
||||
|
@ -643,6 +643,7 @@ class AcarsTest extends TestCase
|
||||
$response = $this->post($uri, $pirep);
|
||||
$pirep_id = $response->json()['data']['id'];
|
||||
|
||||
// Missing lat/lon
|
||||
$post_route = ['order' => 1, 'name' => 'NAVPOINT'];
|
||||
$uri = '/api/pireps/'.$pirep_id.'/route';
|
||||
$response = $this->post($uri, $post_route);
|
||||
|
Loading…
Reference in New Issue
Block a user