A free open source IT asset/license management system
Use qty component
snipe10b5a8ef2155
diff --git a/resources/views/blade/input/minimum-quantity.blade.php b/resources/views/blade/input/minimum-quantity.blade.phpindex 5e6aee586c..5a741691bc 100644--- a/resources/views/blade/input/minimum-quantity.blade.php+++ b/resources/views/blade/input/minimum-quantity.blade.php@@ -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">diff --git a/resources/views/blade/input/quantity.blade.php b/resources/views/blade/input/quantity.blade.phpindex 295c850b6c..f3d04df523 100644--- a/resources/views/blade/input/quantity.blade.php+++ b/resources/views/blade/input/quantity.blade.php@@ -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 }}" @endifmaxlength="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>diff --git a/resources/views/components/checkin.blade.php b/resources/views/components/checkin.blade.phpindex 3a1d0d81cb..4fdcf3a1fa 100644--- a/resources/views/components/checkin.blade.php+++ b/resources/views/components/checkin.blade.php@@ -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')"diff --git a/resources/views/components/checkout.blade.php b/resources/views/components/checkout.blade.phpindex f854d23a26..724bf835c7 100644--- a/resources/views/components/checkout.blade.php+++ b/resources/views/components/checkout.blade.php@@ -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">