added settings page in admin #93
This commit is contained in:
@@ -140,8 +140,8 @@ $(document).ready(function () {
|
||||
$(".select2").select2();
|
||||
|
||||
$('input').iCheck({
|
||||
checkboxClass: 'icheckbox_flat-orange',
|
||||
radioClass: 'iradio_flat-orange'
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
radioClass: 'icheckbox_square-blue'
|
||||
});
|
||||
|
||||
var storage = getStorage("phpvms.admin");
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
@section('title', 'Settings')
|
||||
@section('content')
|
||||
<div class="card">
|
||||
@include('flash::message')
|
||||
@include('admin.settings.table')
|
||||
</div>
|
||||
@include('flash::message')
|
||||
@include('admin.settings.table')
|
||||
@endsection
|
||||
|
||||
@include('admin.settings.script')
|
||||
|
||||
30
resources/views/admin/settings/script.blade.php
Normal file
30
resources/views/admin/settings/script.blade.php
Normal file
@@ -0,0 +1,30 @@
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#settings a').editable({
|
||||
type: 'text',
|
||||
mode: 'inline',
|
||||
emptytext: 'default',
|
||||
url: '/admin/settings/update',
|
||||
title: 'Enter override value',
|
||||
ajaxOptions: { 'type': 'put'},
|
||||
params: function(params) {
|
||||
return {
|
||||
fare_id: params.pk,
|
||||
name: params.name,
|
||||
value: params.value
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('submit', 'form.rm_fare', function(event) {
|
||||
event.preventDefault();
|
||||
$.pjax.submit(event, '#aircraft_fares_wrapper', {push: false});
|
||||
});
|
||||
|
||||
$(document).on('pjax:complete', function() {
|
||||
$(".select2").select2();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -1,22 +1,44 @@
|
||||
<table class="table table-responsive" id="settings-table">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Value</th>
|
||||
<th>Description</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($settings as $s)
|
||||
<tr>
|
||||
<td>{!! $s->key !!}</td>
|
||||
<td>{!! $s->value !!}</td>
|
||||
<td>
|
||||
@if(Setting::get($s->key.'_descrip'))
|
||||
{!! Setting::get($s->key.'_descrip') !!}
|
||||
@else
|
||||
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
{!! Form::model($grouped_settings, ['route' => ['admin.settings.update'], 'method' => 'post']) !!}
|
||||
@foreach($grouped_settings as $group => $settings)
|
||||
<div class="card">
|
||||
<div class="content table-responsive table-full-width">
|
||||
<table class="table table-hover" id="flights-table">
|
||||
<thead>
|
||||
<th colspan="2">
|
||||
<h5>{!! $group !!}</h5>
|
||||
</th>
|
||||
</thead>
|
||||
|
||||
@foreach($settings as $setting)
|
||||
<tr>
|
||||
<td>
|
||||
<p>{!! $setting->name !!}</p>
|
||||
<p class="description">{{$setting->description}}</p></td>
|
||||
<td>
|
||||
@if($setting->type === 'text')
|
||||
{!! Form::input('text', $setting->id, $setting->value, ['class' => 'form-control']) !!}
|
||||
@elseif($setting->type === 'boolean' || $setting->type === 'bool')
|
||||
{!! Form::hidden($setting->id, 0) !!}
|
||||
{!! Form::checkbox($setting->id, null, $setting->value, ['']) !!}
|
||||
@elseif($setting->type === 'int' || $setting->type === 'number')
|
||||
{!! Form::number($setting->id, $setting->value, ['class'=>'form-control']) !!}
|
||||
@elseif($setting->type === 'select')
|
||||
{!! Form::select($setting->id,
|
||||
explode(',', $setting->options),
|
||||
$setting->value, ['class' => 'select2', 'style' => 'width: 100%']) !!}
|
||||
@else
|
||||
{!! Form::input('text', $setting->id, $setting->value, ['class' => 'form-control']) !!}
|
||||
@endif
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="pull-right">
|
||||
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
|
||||
<a href="{!! route('admin.subfleets.index') !!}" class="btn btn-default">Cancel</a>
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
|
||||
Reference in New Issue
Block a user