3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-08-18 03:06:23 +00:00

Converted hardware bulk checkin to form components

This commit is contained in:
snipe
2026-08-11 16:47:03 +01:00
parent 1d90b8aebd
commit f7beec86df
2 changed files with 72 additions and 16 deletions

View File

@ -0,0 +1,62 @@
@use('App\Models\Asset', 'Asset')
@use('Illuminate\Support\Arr', 'Arr')
@props([
'label',
'name',
'selected' => null,
'required' => false,
'multiple' => false,
'assetStatusType' => null,
'companyId' => null,
'excludeId' => null,
])
<div
@class([
'form-group',
'has-error' => $errors->has($name),
])
>
<label for="{{ $name }}_select" class="col-md-3 control-label">{{ $label }}</label>
<div class="col-md-7">
<select
class="js-data-ajax select2"
data-endpoint="hardware"
data-placeholder="{{ trans('general.select_asset') }}"
name="{{ $name }}{{ $multiple ? '[]' : '' }}"
id="{{ $name }}_select"
style="width: 100%"
aria-label="{{ $label }}"
@required($required)
@if ($multiple) multiple @endif
@if ($assetStatusType) data-asset-status-type="{{ $assetStatusType }}" @endif
@if ($companyId) data-company-id="{{ $companyId }}" @endif
@if ($excludeId) data-exclude-id="{{ $excludeId }}" @endif
>
@unless ($multiple)
<option value="" role="option">{{ trans('general.select_asset') }}</option>
@endunless
@if ($selected)
@foreach (Arr::wrap($selected) as $value)
@php($asset = Asset::with('model')->find($value))
@if ($asset)
<option value="{{ $asset->id }}" selected="selected" role="option" aria-selected="true">
{{ $asset->present()->fullName }}
</option>
@endif
@endforeach
@endif
</select>
</div>
@if ($snipeSettings->full_multiple_companies_support == '1')
@cannot('superadmin')
<div class="col-md-7 col-md-offset-3">
<p class="help-block"><x-icon type="tip" /> {{ trans('general.fmcs_select_note') }}</p>
</div>
@endcannot
@endif
<div class="col-md-8 col-md-offset-3"><x-form.error :name="$name" /></div>
</div>

View File

@ -24,16 +24,14 @@
{{ trans('admin/hardware/form.tag') }}
</x-slot:header>
@include('partials.forms.edit.asset-select', [
'translated_name' => trans('general.assets'),
'fieldname' => 'selected_assets[]',
'multiple' => true,
'required' => true,
'asset_status_type' => 'Deployed',
'select_id' => 'assigned_assets_select',
'asset_selector_div_id' => 'assets_to_checkin_div',
'asset_ids' => old('selected_assets'),
])
<x-input.asset-select
:label="trans('general.assets')"
name="selected_assets"
:multiple="true"
:required="true"
assetStatusType="Deployed"
:selected="old('selected_assets')"
/>
{{-- Status --}}
<x-form.row
@ -85,17 +83,13 @@
</x-slot:input>
</x-form.row>
{{-- Note --}}
<x-form.row
:label="trans('general.notes')"
name="note"
type="textarea"
label_class="col-sm-3"
input_div_class="col-md-8"
>
<x-slot:input>
<textarea class="col-md-6 form-control" id="note" name="note">{{ old('note') }}</textarea>
</x-slot:input>
</x-form.row>
/>
{{-- Checkin associated license seats. The hidden
partner input ensures a "0" value submits when