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
<!-- 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">
<input class="form-control" type="text" name="name" id="name"
value="{{ Input::old('name', $asset->name) }}"/>
{!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
<!-- Only allow an asset name to be changed if the checker-outer has permission to edit the asset -->
@can('update', $asset)
<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">
<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>
@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 -->
<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>') !!}
</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
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true'])