Display asset name if one exists and the user cannot edit

This commit is contained in:
snipe 2018-10-15 17:02:31 -07:00
parent 539c3023b9
commit 6b6cf06530
2 changed files with 27 additions and 7 deletions

View file

@ -46,14 +46,25 @@
@endif @endif
<!-- Asset Name --> <!-- Asset Name -->
<div class="form-group {{ $errors->has('name') ? 'error' : '' }}"> <!-- Only allow an asset name to be changed if the checker-outer has permission to edit the asset -->
{{ Form::label('name', trans('admin/hardware/form.name'), array('class' => 'col-md-3 control-label')) }} @can('update', $asset)
<div class="col-md-8"> <div class="form-group {{ $errors->has('name') ? 'error' : '' }}">
<input class="form-control" type="text" name="name" id="name" {{ Form::label('name', trans('admin/hardware/form.name'), array('class' => 'col-md-3 control-label')) }}
value="{{ Input::old('name', $asset->name) }}"/> <div class="col-md-8">
{!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!} <input class="form-control" type="text" name="name" id="name" value="{{ Input::old('name', $asset->name) }}" tabindex="1">
{!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div> </div>
</div> @else
@if ($asset->name!='')
<div class="form-group {{ $errors->has('name') ? 'error' : '' }}">
{{ Form::label('name', trans('admin/hardware/form.name'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-8">
<p class="form-control-static">{{ $asset->name }}</p>
</div>
</div>
@endif
@endcan
<!-- Status --> <!-- Status -->
<div class="form-group {{ $errors->has('status_id') ? 'error' : '' }}"> <div class="form-group {{ $errors->has('status_id') ? 'error' : '' }}">

View file

@ -46,6 +46,15 @@
{!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div> </div>
</div> </div>
@else
@if ($asset->name!='')
<div class="form-group {{ $errors->has('name') ? 'error' : '' }}">
{{ Form::label('name', trans('admin/hardware/form.name'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-8">
<p class="form-control-static">{{ $asset->name }}</p>
</div>
</div>
@endif
@endcan @endcan
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true']) @include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true'])