@@ -1,12 +1,12 @@
|
||||
@extends('admin.app')
|
||||
@section('title', 'Add Award')
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
{{ Form::open(['route' => 'admin.awards.store']) }}
|
||||
@include('admin.awards.fields')
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
{{ Form::open(['route' => 'admin.awards.store']) }}
|
||||
@include('admin.awards.fields')
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@include('admin.awards.scripts')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
@extends('admin.app')
|
||||
@section('title', "Edit \"$award->title\" Award")
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
{{ Form::model($award, ['route' => ['admin.awards.update', $award->id], 'method' => 'patch']) }}
|
||||
@include('admin.awards.fields')
|
||||
{{ Form::close() }}
|
||||
{{ Form::model($award, ['route' => ['admin.awards.update', $award->id], 'method' => 'patch']) }}
|
||||
@include('admin.awards.fields')
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@include('admin.awards.scripts')
|
||||
|
||||
@@ -1,78 +1,78 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@component('admin.components.info')
|
||||
These are the awards that pilots can earn. Each award is assigned an
|
||||
award class, which will be run whenever a pilot's stats are changed,
|
||||
including after a PIREP is accepted.
|
||||
@endcomponent
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
@component('admin.components.info')
|
||||
These are the awards that pilots can earn. Each award is assigned an
|
||||
award class, which will be run whenever a pilot's stats are changed,
|
||||
including after a PIREP is accepted.
|
||||
@endcomponent
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('name', 'Name:') !!} <span class="required">*</span>
|
||||
<div class="callout callout-info">
|
||||
<i class="icon fa fa-info"> </i>
|
||||
This will be the title of the award
|
||||
</div>
|
||||
{!! Form::text('name', null, ['class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('name') }}</p>
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('name', 'Name:') !!} <span class="required">*</span>
|
||||
<div class="callout callout-info">
|
||||
<i class="icon fa fa-info"> </i>
|
||||
This will be the title of the award
|
||||
</div>
|
||||
{!! 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('image', 'Image:') !!}
|
||||
<div class="callout callout-info">
|
||||
<i class="icon fa fa-info"> </i>
|
||||
This is the image of the award. Be creative!
|
||||
</div>
|
||||
{!! Form::text('image_url', null, [
|
||||
'class' => 'form-control',
|
||||
'placeholder' => 'Enter the url of the image location'
|
||||
]) !!}
|
||||
<p class="text-danger">{{ $errors->first('image_url') }}</p>
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('image', 'Image:') !!}
|
||||
<div class="callout callout-info">
|
||||
<i class="icon fa fa-info"> </i>
|
||||
This is the image of the award. Be creative!
|
||||
</div>
|
||||
{!! Form::text('image_url', null, [
|
||||
'class' => 'form-control',
|
||||
'placeholder' => 'Enter the url of the image location'
|
||||
]) !!}
|
||||
<p class="text-danger">{{ $errors->first('image_url') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('description', 'Description:') !!} 
|
||||
<div class="callout callout-info">
|
||||
<i class="icon fa fa-info"> </i>
|
||||
This is the description of the award.
|
||||
</div>
|
||||
{!! Form::textarea('description', null, ['class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('description') }}</p>
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('description', 'Description:') !!} 
|
||||
<div class="callout callout-info">
|
||||
<i class="icon fa fa-info"> </i>
|
||||
This is the description of the award.
|
||||
</div>
|
||||
{!! Form::textarea('description', null, ['class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('description') }}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
<div>
|
||||
{{ Form::label('ref_model', 'Award Class:') }}
|
||||
{{ Form::select('ref_model', $award_classes, null , [
|
||||
'class' => 'form-control select2',
|
||||
'id' => 'award_class_select',
|
||||
]) }}
|
||||
<p class="text-danger">{{ $errors->first('ref_model') }}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
<div>
|
||||
{{ Form::label('ref_model', 'Award Class:') }}
|
||||
{{ Form::select('ref_model', $award_classes, null , [
|
||||
'class' => 'form-control select2',
|
||||
'id' => 'award_class_select',
|
||||
]) }}
|
||||
<p class="text-danger">{{ $errors->first('ref_model') }}</p>
|
||||
</div>
|
||||
<div>
|
||||
{{ Form::label('ref_model_params', 'Award Class parameters') }}
|
||||
{{ Form::text('ref_model_params', null, ['class' => 'form-control']) }}
|
||||
<p class="text-danger">{{ $errors->first('ref_model_params') }}</p>
|
||||
|
||||
<div>
|
||||
{{ Form::label('ref_model_params', 'Award Class parameters') }}
|
||||
{{ Form::text('ref_model_params', null, ['class' => 'form-control']) }}
|
||||
<p class="text-danger">{{ $errors->first('ref_model_params') }}</p>
|
||||
|
||||
<p id="ref_model_param_description">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<p id="ref_model_param_description">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Submit Field -->
|
||||
<div class="form-group col-sm-12">
|
||||
<div class="pull-right">
|
||||
{!! Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) !!}
|
||||
<a href="{!! route('admin.awards.index') !!}" class="btn btn-warn">Cancel</a>
|
||||
</div>
|
||||
<!-- Submit Field -->
|
||||
<div class="form-group col-sm-12">
|
||||
<div class="pull-right">
|
||||
{!! Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) !!}
|
||||
<a href="{!! route('admin.awards.index') !!}" class="btn btn-warn">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
|
||||
@section('title', 'Awards')
|
||||
@section('actions')
|
||||
<li>
|
||||
<a href="{!! route('admin.awards.create') !!}">
|
||||
<i class="ti-plus"></i>
|
||||
Add New
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{!! route('admin.awards.create') !!}">
|
||||
<i class="ti-plus"></i>
|
||||
Add New
|
||||
</a>
|
||||
</li>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
@include('admin.awards.table')
|
||||
</div>
|
||||
<div class="card">
|
||||
@include('admin.awards.table')
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
@section('scripts')
|
||||
<script>
|
||||
@if(isset($award_descriptions))
|
||||
<script>
|
||||
@if(isset($award_descriptions))
|
||||
const award_descriptions = {!! json_encode($award_descriptions) !!};
|
||||
@else
|
||||
@else
|
||||
const award_descriptions = {};
|
||||
@endif
|
||||
@endif
|
||||
|
||||
const changeParamDescription = (award_class) => {
|
||||
const descrip = award_descriptions[award_class];
|
||||
console.log('Found description: ', descrip);
|
||||
$("p#ref_model_param_description").text(descrip);
|
||||
};
|
||||
const changeParamDescription = (award_class) => {
|
||||
const descrip = award_descriptions[award_class];
|
||||
console.log('Found description: ', descrip);
|
||||
$("p#ref_model_param_description").text(descrip);
|
||||
};
|
||||
|
||||
$(document).ready(() => {
|
||||
const select_id = "select#award_class_select";
|
||||
console.log('award descriptions', award_descriptions);
|
||||
$(select_id).change((e) => {
|
||||
$(document).ready(() => {
|
||||
const select_id = "select#award_class_select";
|
||||
console.log('award descriptions', award_descriptions);
|
||||
$(select_id).change((e) => {
|
||||
const award_class = $(select_id + " option:selected").val();
|
||||
console.log('award class selected: ', award_class);
|
||||
changeParamDescription(award_class);
|
||||
});
|
||||
});
|
||||
|
||||
// on load
|
||||
const award_class = $(select_id + " option:selected").val();
|
||||
changeParamDescription(award_class);
|
||||
});
|
||||
</script>
|
||||
// on load
|
||||
const award_class = $(select_id + " option:selected").val();
|
||||
changeParamDescription(award_class);
|
||||
});
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
<table class="table table-hover table-responsive" id="awards-table">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Image</th>
|
||||
<th class="text-right">Action</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($awards as $award)
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ route('admin.awards.edit', [$award->id]) }}">
|
||||
{{ $award->name }}</a>
|
||||
</td>
|
||||
<td>{{ $award->description }}</td>
|
||||
<td>
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Image</th>
|
||||
<th class="text-right">Action</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($awards as $award)
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ route('admin.awards.edit', [$award->id]) }}">
|
||||
{{ $award->name }}</a>
|
||||
</td>
|
||||
<td>{{ $award->description }}</td>
|
||||
<td>
|
||||
|
||||
@if($award->image)
|
||||
<img src="{{ $award->image }}" name="{{ $award->name }}" alt="No Image Available" />
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-right">
|
||||
{{ Form::open(['route' => ['admin.awards.destroy', $award->id], 'method' => 'delete']) }}
|
||||
<a href="{{ route('admin.awards.edit', [$award->id]) }}" class='btn btn-sm btn-success btn-icon'>
|
||||
<i class="fas fa-pencil-alt"></i></a>
|
||||
@if($award->image)
|
||||
<img src="{{ $award->image }}" name="{{ $award->name }}" alt="No Image Available"/>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-right">
|
||||
{{ Form::open(['route' => ['admin.awards.destroy', $award->id], 'method' => 'delete']) }}
|
||||
<a href="{{ route('admin.awards.edit', [$award->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 you want to delete this award?')"
|
||||
]) }}
|
||||
{{ Form::button('<i class="fa fa-times"></i>', [
|
||||
'type' => 'submit',
|
||||
'class' => 'btn btn-sm btn-danger btn-icon',
|
||||
'onclick' => "return confirm('Are you sure you want to delete this award?')"
|
||||
]) }}
|
||||
|
||||
{{ Form::close() }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
{{ Form::close() }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user