Use qty component

This commit is contained in:
snipe
2026-06-04 14:42:25 +01:00
parent f0a9a49753
commit 10b5a8ef21
4 changed files with 25 additions and 26 deletions
@@ -22,7 +22,7 @@
value="{{ old('min_amt', $item->min_amt ?? '') }}"
min="0"
maxlength="5"
@required(Helper::checkIfRequired($item, 'min_amt'))
@required($item && Helper::checkIfRequired($item, 'min_amt'))
/>
</div>
<div class="col-md-7" style="margin-left: -15px">
@@ -5,6 +5,9 @@
'name' => 'qty',
'label' => null,
'min' => 0,
'max' => null,
'value' => null,
'help_text' => null,
])
<div
@@ -24,14 +27,18 @@
name="{{ $name }}"
id="{{ $name }}"
aria-label="{{ $label ?? trans('general.quantity') }}"
value="{{ old($name, $item->{$name} ?? '') }}"
value="{{ old($name, $value ?? $item?->{$name} ?? '') }}"
min="{{ $min }}"
@if ($max) max="{{ $max }}" @endif
maxlength="5"
@required(Helper::checkIfRequired($item, $name))
@required($item && Helper::checkIfRequired($item, $name))
/>
</div>
<div class="col-md-12" style="padding-left: 0">
{!! $errors->first($name, '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
@if ($help_text)
<p class="help-block">{{ $help_text }}</p>
@endif
</div>
</div>
</div>
+8 -11
View File
@@ -21,17 +21,14 @@
<x-form.static :label="trans('general.checkin_from')">{{ $asset->present()->fullName }}</x-form.static>
<!-- Qty -->
<div class="form-group {{ $errors->has('checkin_qty') ? 'has-error' : '' }}">
<label for="checkin_qty" class="col-md-3 control-label">{{ trans('general.qty') }}</label>
<div class="col-md-3 text-right">
<input type="text" class="form-control" name="checkin_qty" aria-label="{{ trans('general.qty') }}" id="checkin_qty" value="{{ old('assigned_qty', $component_assets->assigned_qty) }}">
</div>
<div class="col-md-9 col-md-offset-2">
<p class="help-block">{{ trans('admin/components/general.checkin_limit', ['assigned_qty' => $component_assets->assigned_qty]) }}</p>
{!! $errors->first('checkin_qty', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
<x-input.quantity
name="checkin_qty"
:value="$component_assets->assigned_qty"
:min="1"
:max="$component_assets->assigned_qty"
:label="trans('general.qty')"
:help_text="trans('admin/components/general.checkin_limit', ['assigned_qty' => $component_assets->assigned_qty])"
/>
<x-form.row
:label="trans('admin/hardware/form.notes')"
+7 -12
View File
@@ -25,18 +25,13 @@
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.select_asset'), 'fieldname' => 'asset_id', 'company_id' => $snipe_component->company_id, 'required' => 'true', 'value' => old('asset_id')])
<!-- Qty -->
<div class="form-group {{ $errors->has('assigned_qty') ? 'has-error' : '' }}">
<label for="assigned_qty" class="col-md-3 control-label">{{ trans('general.qty') }}</label>
<div class="col-md-2 col-sm-5 col-xs-5">
<input class="form-control" type="number" name="assigned_qty" id="assigned_qty" value="1" min="1" max="{{ old('assigned_qty') ?? $snipe_component->numRemaining() }}" aria-label="{{ trans('general.qty') }}" maxlength="999999" />
</div>
@if ($errors->first('assigned_qty'))
<div class="col-md-9 col-md-offset-3">
{!! $errors->first('assigned_qty', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
@endif
</div>
<x-input.quantity
name="assigned_qty"
:value="1"
:min="1"
:max="$snipe_component->numRemaining()"
:label="trans('general.qty')"
/>
@if ($snipe_component->requireAcceptance() || $snipe_component->getEula() || ($snipeSettings->webhook_endpoint != ''))
<div class="form-group notification-callout">