Type Ratings | New Feature (#1360)
* Type Ratings Adding "Type Rating" definition and assignment possibility to v7 core. * Update ProfileController.php * StyleFix 1 * Update settings.yml Change description text as requested
This commit is contained in:
@@ -62,6 +62,10 @@
|
||||
<li><a href="{{ url('/admin/ranks') }}"><i class="pe-7s-graph1"></i>ranks</a></li>
|
||||
@endability
|
||||
|
||||
@ability('admin', 'typeratings')
|
||||
<li><a href="{{ url('/admin/typeratings') }}"><i class="pe-7s-plane"></i>type ratings</a></li>
|
||||
@endability
|
||||
|
||||
@ability('admin', 'awards')
|
||||
<li><a href="{!! url('/admin/awards') !!}"><i class="pe-7s-diamond"></i>awards</a></li>
|
||||
@endability
|
||||
|
||||
@@ -16,6 +16,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
@include('admin.subfleets.type_ratings')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
@include('admin.subfleets.fares')
|
||||
|
||||
@@ -114,6 +114,12 @@
|
||||
$.pjax.submit(event, '#subfleet_ranks_wrapper', {push: false});
|
||||
});
|
||||
|
||||
$(document).on('submit', 'form.modify_typerating', function (event) {
|
||||
event.preventDefault();
|
||||
console.log(event);
|
||||
$.pjax.submit(event, '#subfleet_typeratings_wrapper', {push: false});
|
||||
});
|
||||
|
||||
$(document).on('submit', 'form.modify_expense', function (event) {
|
||||
event.preventDefault();
|
||||
console.log(event);
|
||||
|
||||
45
resources/views/admin/subfleets/type_ratings.blade.php
Normal file
45
resources/views/admin/subfleets/type_ratings.blade.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<div id="subfleet_typeratings_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
|
||||
<div class="header">
|
||||
<h3>type ratings</h3>
|
||||
@component('admin.components.info')
|
||||
These type ratings are allowed to fly aircraft in this subfleet.
|
||||
@endcomponent
|
||||
</div>
|
||||
<br/>
|
||||
<table id="subfleet_ranks" class="table table-hover">
|
||||
@if(count($subfleet->typeratings))
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Name</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@endif
|
||||
<tbody>
|
||||
@foreach($subfleet->typeratings as $tr)
|
||||
<tr>
|
||||
<td class="sorting_1">{{ $tr->type }}</td>
|
||||
<td>{{ $tr->name }}</td>
|
||||
<td style="text-align: right; width:3%;">
|
||||
{{ Form::open(['url' => '/admin/subfleets/'.$subfleet->id.'/typeratings', 'method' => 'delete', 'class' => 'modify_typerating']) }}
|
||||
{{ Form::hidden('typerating_id', $tr->id) }}
|
||||
{{ Form::button('<i class="fa fa-times"></i>', ['type' => 'submit', 'class' => 'btn btn-sm btn-danger btn-icon']) }}
|
||||
{{ Form::close() }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="text-right">
|
||||
{{ Form::open(['url' => '/admin/subfleets/'.$subfleet->id.'/typeratings', 'method' => 'post', 'class' => 'modify_typerating form-inline']) }}
|
||||
{{ Form::select('typerating_id', $avail_ratings, null, ['placeholder' => 'Select Type Rating', 'class' => 'ac-fare-dropdown form-control input-lg select2']) }}
|
||||
{{ Form::button('<i class="glyphicon glyphicon-plus"></i> add', ['type' => 'submit', 'class' => 'btn btn-success btn-s']) }}
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
12
resources/views/admin/typeratings/create.blade.php
Normal file
12
resources/views/admin/typeratings/create.blade.php
Normal file
@@ -0,0 +1,12 @@
|
||||
@extends('admin.app')
|
||||
@section('title', 'Add Type Rating')
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
{{ Form::open(['route' => 'admin.typeratings.store', 'class' => 'add_typerating', 'method'=>'POST', 'autocomplete' => false]) }}
|
||||
@include('admin.typeratings.fields')
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@include('admin.typeratings.scripts')
|
||||
26
resources/views/admin/typeratings/edit.blade.php
Normal file
26
resources/views/admin/typeratings/edit.blade.php
Normal file
@@ -0,0 +1,26 @@
|
||||
@extends('admin.app')
|
||||
@section('title', 'Edit '.$typerating->name)
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
{{ Form::model($typerating, ['route' => ['admin.typeratings.update', $typerating->id], 'method' => 'patch', 'autocomplete' => false]) }}
|
||||
@include('admin.typeratings.fields')
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
<div class="header">
|
||||
<h3>Subfleets</h3>
|
||||
@component('admin.components.info')
|
||||
These are the subfleets this type rating is allowed to use.
|
||||
@endcomponent
|
||||
</div>
|
||||
<div class="row">
|
||||
@include('admin.typeratings.subfleets')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@include('admin.typeratings.scripts')
|
||||
45
resources/views/admin/typeratings/fields.blade.php
Normal file
45
resources/views/admin/typeratings/fields.blade.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
{{ Form::label('name', 'Name:') }}
|
||||
{{ Form::text('name', null, ['class' => 'form-control']) }}
|
||||
<p class="text-danger">{{ $errors->first('name') }}</p>
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
{{ Form::label('type', 'Type Code:') }}
|
||||
{{ Form::text('type', null, ['class' => 'form-control']) }}
|
||||
<p class="text-danger">{{ $errors->first('type') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-md-7">
|
||||
{{ Form::label('description', 'Description:') }}
|
||||
{{ Form::text('description', null, ['class' => 'form-control']) }}
|
||||
<p class="text-danger">{{ $errors->first('description') }}</p>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
{{ Form::label('image_url', 'Image Link:') }}
|
||||
{{ Form::text('image_url', null, ['class' => 'form-control']) }}
|
||||
<p class="text-danger">{{ $errors->first('image_url') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-md-3">
|
||||
<div class="checkbox">
|
||||
<label class="checkbox-inline">
|
||||
{{ Form::hidden('active', false) }}
|
||||
{{ Form::checkbox('active') }}
|
||||
{{ Form::label('active', 'Active:') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="text-right">
|
||||
{{ Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
18
resources/views/admin/typeratings/index.blade.php
Normal file
18
resources/views/admin/typeratings/index.blade.php
Normal file
@@ -0,0 +1,18 @@
|
||||
@extends('admin.app')
|
||||
@section('title', 'Type Ratings')
|
||||
@section('actions')
|
||||
<li>
|
||||
<a href="{{ route('admin.typeratings.create') }}">
|
||||
<i class="ti-plus"></i>
|
||||
Add New
|
||||
</a>
|
||||
</li>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
@include('admin.typeratings.table')
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
48
resources/views/admin/typeratings/scripts.blade.php
Normal file
48
resources/views/admin/typeratings/scripts.blade.php
Normal file
@@ -0,0 +1,48 @@
|
||||
@section('scripts')
|
||||
<script>
|
||||
function setEditable() {
|
||||
|
||||
const token = $('meta[name="csrf-token"]').attr('content');
|
||||
const api_key = $('meta[name="api-key"]').attr('content');
|
||||
|
||||
@if(isset($typerating))
|
||||
$('#subfleets-table a').editable({
|
||||
type: 'text',
|
||||
mode: 'inline',
|
||||
emptytext: 'inherited',
|
||||
url: '{{ url('/admin/typerating/'.$typerating->id.'/subfleets') }}',
|
||||
title: 'Enter override value',
|
||||
ajaxOptions: {
|
||||
type: 'put',
|
||||
headers: {
|
||||
'x-api-key': api_key,
|
||||
'X-CSRF-TOKEN': token,
|
||||
}
|
||||
},
|
||||
params: function (params) {
|
||||
return {
|
||||
subfleet_id: params.pk,
|
||||
name: params.name,
|
||||
value: params.value
|
||||
}
|
||||
}
|
||||
});
|
||||
@endif
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
setEditable();
|
||||
|
||||
$(document).on('submit', 'form.pjax_form', function (event) {
|
||||
event.preventDefault();
|
||||
$.pjax.submit(event, '#typerating_subfleet_wrapper', {push: false});
|
||||
});
|
||||
|
||||
$(document).on('pjax:complete', function () {
|
||||
initPlugins();
|
||||
setEditable();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
17
resources/views/admin/typeratings/show.blade.php
Normal file
17
resources/views/admin/typeratings/show.blade.php
Normal file
@@ -0,0 +1,17 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>{{ $typerating->name }}</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row" style="padding-left: 20px">
|
||||
@include('admin.typerating.show_fields')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@include('admin.typerating.scripts')
|
||||
42
resources/views/admin/typeratings/show_fields.blade.php
Normal file
42
resources/views/admin/typeratings/show_fields.blade.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<!-- Id Field -->
|
||||
<div class="form-group">
|
||||
{{ Form::label('id', 'Id:') }}
|
||||
<p>{{ $typerating->id }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Name Field -->
|
||||
<div class="form-group">
|
||||
{{ Form::label('name', 'Name:') }}
|
||||
<p>{{ $typerating->name }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Type Code Field -->
|
||||
<div class="form-group">
|
||||
{{ Form::label('type', 'Type Code:') }}
|
||||
<p>{{ $typerating->type }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Description Field -->
|
||||
<div class="form-group">
|
||||
{{ Form::label('description', 'Description:') }}
|
||||
<p>{{ $typerating->description }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Image URL Field -->
|
||||
<div class="form-group">
|
||||
{{ Form::label('image_url', 'Image URL:') }}
|
||||
<p>{{ $typerating->image_url }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Created At Field -->
|
||||
<div class="form-group">
|
||||
{{ Form::label('created_at', 'Created At:') }}
|
||||
<p>{{ show_datetime($typerating->created_at) }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Updated At Field -->
|
||||
<div class="form-group">
|
||||
{{ Form::label('updated_at', 'Updated At:') }}
|
||||
<p>{{ show_datetime($typerating->updated_at) }}</p>
|
||||
</div>
|
||||
|
||||
54
resources/views/admin/typeratings/subfleets.blade.php
Normal file
54
resources/views/admin/typeratings/subfleets.blade.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<div id="typerating_subfleet_wrapper" class="dataTables_wrapper form-inline dt-bootstrap col-lg-12">
|
||||
@if(count($typerating->subfleets) === 0)
|
||||
@include('admin.common.none_added', ['type' => 'subfleets'])
|
||||
@endif
|
||||
|
||||
<table class="table table-responsive" id="subfleets-table">
|
||||
@if(count($typerating->subfleets))
|
||||
<thead>
|
||||
<th>Airline</th>
|
||||
<th>Name</th>
|
||||
<th style="text-align: center;">Actions</th>
|
||||
</thead>
|
||||
@endif
|
||||
<tbody>
|
||||
@foreach($typerating->subfleets as $sf)
|
||||
<tr>
|
||||
<td>{{ $sf->airline->name }}</td>
|
||||
<td>{{ $sf->name.' ('.$sf->type.')' }}</td>
|
||||
<td style="width: 10%; text-align: center;" class="form-inline">
|
||||
{{ Form::open(['url' => '/admin/typeratings/'.$typerating->id.'/subfleets', 'method' => 'delete', 'class' => 'pjax_form']) }}
|
||||
{{ Form::hidden('subfleet_id', $sf->id) }}
|
||||
<div class='btn-group'>
|
||||
{{ Form::button('<i class="fa fa-times"></i>',
|
||||
['type' => 'submit',
|
||||
'class' => 'btn btn-sm btn-danger btn-icon'])
|
||||
}}
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="input-group input-group-lg pull-right">
|
||||
{{ Form::open(['url' => url('/admin/typeratings/'.$typerating->id.'/subfleets'),
|
||||
'method' => 'post',
|
||||
'class' => 'pjax_form form-inline'
|
||||
])
|
||||
}}
|
||||
{{ Form::select('subfleet_id', $avail_subfleets, null, [
|
||||
'placeholder' => 'Select Subfleet',
|
||||
'class' => 'select2 form-control input-lg'])
|
||||
}}
|
||||
{{ Form::button('<i class="fa fa-plus"></i> Add',
|
||||
['type' => 'submit',
|
||||
'class' => 'btn btn-success btn-small']) }}
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
26
resources/views/admin/typeratings/table.blade.php
Normal file
26
resources/views/admin/typeratings/table.blade.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<div id="typeratings_table_wrapper">
|
||||
<table class="table table-hover table-responsive">
|
||||
<thead>
|
||||
<th>Type Code</th>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($typeratings as $typerating)
|
||||
<tr>
|
||||
<td><a href="{{ route('admin.typeratings.edit', [$typerating->id]) }}">{{ $typerating->type }}</a></td>
|
||||
<td>{{ $typerating->name }}</td>
|
||||
<td>{{ $typerating->description }}</td>
|
||||
<td class="text-right">
|
||||
{{ Form::open(['route' => ['admin.typeratings.destroy', $typerating->id], 'method' => 'delete']) }}
|
||||
<a href="{{ route('admin.typeratings.edit', [$typerating->id]) }}" class='btn btn-sm btn-success btn-icon'>
|
||||
<i class="fas fa-pencil-alt"></i></a>
|
||||
{{ Form::button('<i class="fa fa-times"></i>', ['type' => 'submit', 'class' => 'btn btn-sm btn-danger btn-icon', 'onclick' => "return confirm('Are you sure?')"]) }}
|
||||
{{ Form::close() }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -9,6 +9,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
<div class="header">
|
||||
<h3>Type Ratings</h3>
|
||||
</div>
|
||||
@include('admin.users.type_ratings')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
<div class="header">
|
||||
@@ -34,3 +43,4 @@
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@include('admin.users.script')
|
||||
|
||||
25
resources/views/admin/users/script.blade.php
Normal file
25
resources/views/admin/users/script.blade.php
Normal file
@@ -0,0 +1,25 @@
|
||||
@section('scripts')
|
||||
<script>
|
||||
function setEditable() {
|
||||
|
||||
const token = $('meta[name="csrf-token"]').attr('content');
|
||||
const api_key = $('meta[name="api-key"]').attr('content');
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
setEditable();
|
||||
|
||||
$(document).on('submit', 'form.modify_typerating', function (event) {
|
||||
event.preventDefault();
|
||||
console.log(event);
|
||||
$.pjax.submit(event, '#user_typeratings_wrapper', {push: false});
|
||||
});
|
||||
|
||||
$(document).on('pjax:complete', function () {
|
||||
initPlugins();
|
||||
setEditable();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
38
resources/views/admin/users/type_ratings.blade.php
Normal file
38
resources/views/admin/users/type_ratings.blade.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<div id="user_typeratings_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
|
||||
<table id="user_typeratings" class="table table-hover">
|
||||
@if(count($user->typeratings))
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Name</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@endif
|
||||
<tbody>
|
||||
@foreach($user->typeratings as $tr)
|
||||
<tr>
|
||||
<td class="sorting_1">{{ $tr->type }}</td>
|
||||
<td>{{ $tr->name }}</td>
|
||||
<td style="text-align: right; width:3%;">
|
||||
{{ Form::open(['url' => '/admin/users/'.$user->id.'/typeratings', 'method' => 'delete', 'class' => 'modify_typerating']) }}
|
||||
{{ Form::hidden('typerating_id', $tr->id) }}
|
||||
{{ Form::button('<i class="fa fa-times"></i>', ['type' => 'submit', 'class' => 'btn btn-sm btn-danger btn-icon']) }}
|
||||
{{ Form::close() }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="text-right">
|
||||
{{ Form::open(['url' => '/admin/users/'.$user->id.'/typeratings', 'method' => 'post', 'class' => 'modify_typerating form-inline']) }}
|
||||
{{ Form::select('typerating_id', $avail_ratings, null, ['placeholder' => 'Select Type Rating', 'class' => 'ac-fare-dropdown form-control input-lg select2']) }}
|
||||
{{ Form::button('<i class="glyphicon glyphicon-plus"></i> add', ['type' => 'submit', 'class' => 'btn btn-success btn-s']) }}
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user