Added show in nav for status label views and controller

This commit is contained in:
snipe 2016-08-23 18:52:42 -07:00
parent fb402e138d
commit ad22293f4b
4 changed files with 29 additions and 11 deletions

View file

@ -120,6 +120,7 @@ class StatuslabelsController extends Controller
$statuslabel->pending = $statustype['pending'];
$statuslabel->archived = $statustype['archived'];
$statuslabel->color = e(Input::get('color'));
$statuslabel->show_in_nav = e(Input::get('show_in_nav'),0);
// Was the asset created?
@ -208,6 +209,7 @@ class StatuslabelsController extends Controller
$statuslabel->pending = $statustype['pending'];
$statuslabel->archived = $statustype['archived'];
$statuslabel->color = e(Input::get('color'));
$statuslabel->show_in_nav = e(Input::get('show_in_nav'),0);
// Was the asset created?
@ -258,7 +260,7 @@ class StatuslabelsController extends Controller
public function getDatatable()
{
$statuslabels = Statuslabel::select(array('id','name','deployable','pending','archived','color'))
$statuslabels = Statuslabel::select(array('id','name','deployable','pending','archived','color','show_in_nav'))
->whereNull('deleted_at');
if (Input::has('search')) {
@ -314,6 +316,7 @@ class StatuslabelsController extends Controller
'type' => e($label_type),
'name' => e($statuslabel->name),
'color' => $color,
'show_in_nav' => ($statuslabel->show_in_nav=='1') ? trans('general.yes') : trans('general.no'),
'actions' => $actions
);
}

View file

@ -405,6 +405,16 @@
<li>
<a href="{{ URL::to('hardware') }}">@lang('general.list_all')</a>
</li>
<?php $status_navs = \App\Models\Statuslabel::where('show_in_nav','=',1)->get(); ?>
@if (count($status_navs) > 0)
<li class="divider">&nbsp;</li>
@foreach ($status_navs as $status_nav)
<li><a href="{{ URL::to('hardware?status_id='.$status_nav->id) }}"}> {{ $status_nav->name }}</a></li>
@endforeach
@endif
<li{!! (Request::query('status') == 'Deployed' ? ' class="active"' : '') !!}>
<a href="{{ URL::to('hardware?status=Deployed') }}">@lang('general.deployed')
</a>
@ -489,8 +499,7 @@
<li><a href="{{ URL::to('reports/assets') }}" {{ (Request::is('reports/assets') ? ' class="active"' : '') }} >@lang('general.asset_report')</a></li>
<li><a href="{{ URL::to('reports/unaccepted_assets') }}" {{ (Request::is('reports/unaccepted_assets') ? ' class="active"' : '') }} >@lang('general.unaccepted_asset_report')</a></li>
<li><a href="{{ URL::to('reports/accessories') }}" {{ (Request::is('reports/accessories') ? ' class="active"' : '') }} >@lang('general.accessory_report')</a></li>
<li><a href="{{ URL::to('reports/custom') }}" {{ (Request::is('reports/custom') ? ' class="active"' : '') }} >@lang('general.custom_report')</a></li>
<li><a href="{{ URL::to('reports/custom') }}" {{ (Request::is('reports/custom') ? ' class="active"' : '') }}>@lang('general.custom_report')</a></li>
</ul>
</li>
@endcan

View file

@ -38,9 +38,8 @@
<div class="box box-default">
<div class="box-body">
<!-- Asset Title -->
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-3 control-label">{{ trans('general.name') }}</label>
</label>
<div class="col-md-7 required">
<input class="form-control" type="text" name="name" id="name" value="{{ Input::old('name', $statuslabel->name) }}" />
{!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
@ -48,9 +47,8 @@
</div>
<!-- Label type -->
<div class="form-group {{ $errors->has('statuslabel_types') ? 'has-error' : '' }}">
<label for="statuslabel_types" class="col-md-3 control-label">{{ trans('admin/statuslabels/table.status_type') }}
</label>
<div class="form-group{{ $errors->has('statuslabel_types') ? ' has-error' : '' }}">
<label for="statuslabel_types" class="col-md-3 control-label">{{ trans('admin/statuslabels/table.status_type') }} </label>
<div class="col-md-7 required">
{{ Form::select('statuslabel_types', $statuslabel_types, $statuslabel->getStatuslabelType(), array('class'=>'select2', 'style'=>'min-width:400px')) }}
{!! $errors->first('statuslabel_types', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
@ -65,14 +63,12 @@
{{ Form::text('color', Input::old('color', $statuslabel->color), array('class' => 'form-control', 'style' => 'width: 100px;', 'maxlength'=>'10')) }}
<div class="input-group-addon"><i></i></div>
</div><!-- /.input group -->
{!! $errors->first('header_color', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
<!-- Note -->
<div class="form-group {{ $errors->has('notes') ? 'has-error' : '' }}">
<div class="form-group{{ $errors->has('notes') ? ' has-error' : '' }}">
<label for="notes" class="col-md-3 control-label">{{ trans('admin/hardware/form.notes') }}</label>
<div class="col-md-7">
<textarea class="col-md-12 form-control" id="notes" name="notes">{{ Input::old('notes', $statuslabel->notes) }}</textarea>
@ -80,6 +76,15 @@
</div>
</div>
<!-- Show in Nav -->
<div class="form-group{{ $errors->has('notes') ? ' has-error' : '' }}">
<label class="col-md-offset-3" style="padding-left: 15px;">
<input type="checkbox" value="1" name="show_in_nav" id="show_in_nav" class="minimal" {{ Input::old('show_in_nav', $statuslabel->show_in_nav) == '1' ? ' checked="checked"' : '' }}> {{ trans('admin/statuslabels/table.show_in_nav') }}
</label>
</div>

View file

@ -32,6 +32,7 @@
<th data-sortable="true" data-field="name">{{ trans('admin/statuslabels/table.name') }}</th>
<th data-sortable="false" data-field="type">{{ trans('admin/statuslabels/table.status_type') }}</th>
<th data-sortable="false" data-field="color">{{ trans('admin/statuslabels/table.color') }}</th>
<th data-sortable="true" data-field="show_in_nav">{{ trans('admin/statuslabels/table.show_in_nav') }}</th>
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="actions">{{ trans('table.actions') }}</th>
</tr>
</thead>