Allow optional status label on quickscan checkin

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-08-15 10:08:48 +01:00
parent 3e29457094
commit 01c69c8f8f
4 changed files with 19 additions and 7 deletions

View file

@ -928,7 +928,7 @@ class AssetsController extends Controller
}
}
if ($request->has('status_id')) {
if ($request->filled('status_id')) {
$asset->status_id = $request->input('status_id');
}
@ -978,7 +978,7 @@ class AssetsController extends Controller
public function checkinByTag(Request $request, $tag = null) : JsonResponse
{
$this->authorize('checkin', Asset::class);
if(null == $tag && null !== ($request->input('asset_tag'))) {
if (null == $tag && null !== ($request->input('asset_tag'))) {
$tag = $request->input('asset_tag');
}
$asset = Asset::where('asset_tag', $tag)->first();

View file

@ -837,14 +837,14 @@ class AssetsController extends Controller
$this->authorize('audit', Asset::class);
$dt = Carbon::now()->addMonths(12)->toDateString();
return view('hardware/quickscan')->with('next_audit_date', $dt);
return view('hardware/quickscan')->with('statusLabel_list', Helper::statusLabelList())->with('next_audit_date', $dt);
}
public function quickScanCheckin()
{
$this->authorize('checkin', Asset::class);
return view('hardware/quickscan-checkin');
return view('hardware/quickscan-checkin')->with('statusLabel_list', Helper::statusLabelList());
}
public function audit($id)

View file

@ -279,6 +279,7 @@ return [
'site_name' => 'Site Name',
'state' => 'State',
'status_labels' => 'Status Labels',
'status_label' => 'Status Label',
'status' => 'Status',
'accept_eula' => 'Acceptance Agreement',
'supplier' => 'Supplier',

View file

@ -33,14 +33,25 @@
<div class="form-group {{ $errors->has('asset_tag') ? 'error' : '' }}">
{{ Form::label('asset_tag', trans('general.asset_tag'), array('class' => 'col-md-3 control-label', 'id' => 'checkin_tag')) }}
<div class="col-md-9">
<div class="input-group date col-md-5" data-date-format="yyyy-mm-dd">
<input type="text" class="form-control" name="asset_tag" id="asset_tag" value="{{ old('asset_tag') }}">
<div class="input-group date col-md-11" data-date-format="yyyy-mm-dd">
<input type="text" class="form-control" name="asset_tag" id="asset_tag" value="{{ old('asset_tag') }}" required>
</div>
{!! $errors->first('asset_tag', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
<!-- Status -->
<div class="form-group {{ $errors->has('status_id') ? 'error' : '' }}">
<label for="status_id" class="col-md-3 control-label">
{{ trans('admin/hardware/form.status') }}
</label>
<div class="col-md-7">
{{ Form::select('status_id', $statusLabel_list, '', array('class'=>'select2', 'style'=>'width:100%','', 'aria-label'=>'status_id')) }}
{!! $errors->first('status_id', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
<!-- Locations -->
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])