mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Added data-validation=“required" to appropriate field partials
This commit is contained in:
parent
0503a51cae
commit
0eeeb24cae
|
@ -861,13 +861,21 @@
|
||||||
|
|
||||||
|
|
||||||
<script nonce="{{ csrf_token() }}">
|
<script nonce="{{ csrf_token() }}">
|
||||||
|
|
||||||
|
|
||||||
|
// ignore: 'input[type=hidden]' is required here to validate the select2 lists
|
||||||
$.validate({
|
$.validate({
|
||||||
form : '#create-form',
|
form : '#create-form',
|
||||||
modules : 'date, toggleDisabled',
|
modules : 'date, toggleDisabled',
|
||||||
disabledFormFilter : '#create-form',
|
disabledFormFilter : '#create-form',
|
||||||
showErrorDialogs : true
|
showErrorDialogs : true,
|
||||||
|
ignore: 'input[type=hidden]'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
|
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
|
||||||
|
|
||||||
<div class="col-md-7{{ ((isset($required)) && ($required=='true')) ? ' required' : '' }}">
|
<div class="col-md-7{{ ((isset($required)) && ($required=='true')) ? ' required' : '' }}">
|
||||||
<select class="js-data-ajax" data-endpoint="categories/{{ (isset($category_type)) ? $category_type : 'assets' }}" data-placeholder="{{ trans('general.select_category') }}" name="{{ $fieldname }}" style="width: 100%" id="category_select_id" aria-label="{{ $fieldname }}">
|
<select class="js-data-ajax" data-endpoint="categories/{{ (isset($category_type)) ? $category_type : 'assets' }}" data-placeholder="{{ trans('general.select_category') }}" name="{{ $fieldname }}" style="width: 100%" id="category_select_id" aria-label="{{ $fieldname }}" {!! (\App\Helpers\Helper::checkIfRequired($item, $fieldname)) ? ' data-validation="required" required' : '' !!}>
|
||||||
@if ($category_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
|
@if ($category_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
|
||||||
<option value="{{ $category_id }}" selected="selected" role="option" aria-selected="true" role="option">
|
<option value="{{ $category_id }}" selected="selected" role="option" aria-selected="true" role="option">
|
||||||
{{ (\App\Models\Category::find($category_id)) ? \App\Models\Category::find($category_id)->name : '' }}
|
{{ (\App\Models\Category::find($category_id)) ? \App\Models\Category::find($category_id)->name : '' }}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
|
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
|
||||||
<div class="col-md-6{{ ((isset($required) && ($required =='true'))) ? ' required' : '' }}">
|
<div class="col-md-6{{ ((isset($required) && ($required =='true'))) ? ' required' : '' }}">
|
||||||
<select class="js-data-ajax" data-endpoint="locations" data-placeholder="{{ trans('general.select_location') }}" name="{{ $fieldname }}" style="width: 100%" id="{{ $fieldname }}_location_select" aria-label="{{ $fieldname }}">
|
<select class="js-data-ajax" data-endpoint="locations" data-placeholder="{{ trans('general.select_location') }}" name="{{ $fieldname }}" style="width: 100%" id="{{ $fieldname }}_location_select" aria-label="{{ $fieldname }}" {!! (\App\Helpers\Helper::checkIfRequired($item, $fieldname)) ? ' data-validation="required" required' : '' !!}>
|
||||||
@if ($location_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
|
@if ($location_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
|
||||||
<option value="{{ $location_id }}" selected="selected" role="option" aria-selected="true" role="option">
|
<option value="{{ $location_id }}" selected="selected" role="option" aria-selected="true" role="option">
|
||||||
{{ (\App\Models\Location::find($location_id)) ? \App\Models\Location::find($location_id)->name : '' }}
|
{{ (\App\Models\Location::find($location_id)) ? \App\Models\Location::find($location_id)->name : '' }}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
|
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
|
||||||
|
|
||||||
<div class="col-md-7{{ ((isset($required)) && ($required=='true')) ? ' required' : '' }}">
|
<div class="col-md-7{{ ((isset($required)) && ($required=='true')) ? ' required' : '' }}">
|
||||||
<select class="js-data-ajax" data-endpoint="manufacturers" data-placeholder="{{ trans('general.select_manufacturer') }}" name="{{ $fieldname }}" style="width: 100%" id="manufacturer_select_id" aria-label="{{ $fieldname }}">
|
<select class="js-data-ajax" data-endpoint="manufacturers" data-placeholder="{{ trans('general.select_manufacturer') }}" name="{{ $fieldname }}" style="width: 100%" id="manufacturer_select_id" aria-label="{{ $fieldname }}" {!! (\App\Helpers\Helper::checkIfRequired($item, $fieldname)) ? ' data-validation="required" required' : '' !!}>
|
||||||
@if ($manufacturer_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
|
@if ($manufacturer_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
|
||||||
<option value="{{ $manufacturer_id }}" selected="selected" role="option" aria-selected="true" role="option">
|
<option value="{{ $manufacturer_id }}" selected="selected" role="option" aria-selected="true" role="option">
|
||||||
{{ (\App\Models\Manufacturer::find($manufacturer_id)) ? \App\Models\Manufacturer::find($manufacturer_id)->name : '' }}
|
{{ (\App\Models\Manufacturer::find($manufacturer_id)) ? \App\Models\Manufacturer::find($manufacturer_id)->name : '' }}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
|
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
|
||||||
|
|
||||||
<div class="col-md-7{{ ((isset($required) && ($required =='true'))) ? ' required' : '' }}">
|
<div class="col-md-7{{ ((isset($required) && ($required =='true'))) ? ' required' : '' }}">
|
||||||
<select class="js-data-ajax" data-endpoint="models" data-placeholder="{{ trans('general.select_model') }}" name="{{ $fieldname }}" style="width: 100%" id="model_select_id" aria-label="{{ $fieldname }}">
|
<select class="js-data-ajax" data-endpoint="models" data-placeholder="{{ trans('general.select_model') }}" name="{{ $fieldname }}" style="width: 100%" id="model_select_id" aria-label="{{ $fieldname }}" data-validation="required" required>
|
||||||
@if ($model_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
|
@if ($model_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
|
||||||
<option value="{{ $model_id }}" selected="selected">
|
<option value="{{ $model_id }}" selected="selected">
|
||||||
{{ (\App\Models\AssetModel::find($model_id)) ? \App\Models\AssetModel::find($model_id)->name : '' }}
|
{{ (\App\Models\AssetModel::find($model_id)) ? \App\Models\AssetModel::find($model_id)->name : '' }}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
|
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
|
||||||
<label for="name" class="col-md-3 control-label">{{ $translated_name }}</label>
|
<label for="name" class="col-md-3 control-label">{{ $translated_name }}</label>
|
||||||
<div class="col-md-7 col-sm-12{{ (\App\Helpers\Helper::checkIfRequired($item, 'name')) ? ' required' : '' }}">
|
<div class="col-md-7 col-sm-12{{ (\App\Helpers\Helper::checkIfRequired($item, 'name')) ? ' required' : '' }}">
|
||||||
<input class="form-control" type="text" name="name" aria-label="name" id="name" value="{{ old('name', $item->name) }}" />
|
<input class="form-control" type="text" name="name" aria-label="name" id="name" value="{{ old('name', $item->name) }}"{!! (\App\Helpers\Helper::checkIfRequired($item, 'name')) ? ' data-validation="required" required' : '' !!} />
|
||||||
{!! $errors->first('name', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
|
{!! $errors->first('name', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<label for="qty" class="col-md-3 control-label">{{ trans('general.quantity') }}</label>
|
<label for="qty" class="col-md-3 control-label">{{ trans('general.quantity') }}</label>
|
||||||
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($item, 'qty')) ? ' required' : '' }}">
|
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($item, 'qty')) ? ' required' : '' }}">
|
||||||
<div class="col-md-2" style="padding-left:0px">
|
<div class="col-md-2" style="padding-left:0px">
|
||||||
<input class="form-control" type="text" name="qty" aria-label="qty" id="qty" value="{{ old('qty', $item->qty) }}" />
|
<input class="form-control" type="text" name="qty" aria-label="qty" id="qty" value="{{ old('qty', $item->qty) }}" {!! (\App\Helpers\Helper::checkIfRequired($item, 'qty')) ? ' data-validation="required" required' : '' !!}/>
|
||||||
</div>
|
</div>
|
||||||
{!! $errors->first('qty', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
|
{!! $errors->first('qty', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="form-group {{ $errors->has('status_id') ? ' has-error' : '' }}">
|
<div class="form-group {{ $errors->has('status_id') ? ' has-error' : '' }}">
|
||||||
<label for="status_id" class="col-md-3 control-label">{{ trans('admin/hardware/form.status') }}</label>
|
<label for="status_id" class="col-md-3 control-label">{{ trans('admin/hardware/form.status') }}</label>
|
||||||
<div class="col-md-7 col-sm-11{{ (\App\Helpers\Helper::checkIfRequired($item, 'status_id')) ? ' required' : '' }}">
|
<div class="col-md-7 col-sm-11{{ (\App\Helpers\Helper::checkIfRequired($item, 'status_id')) ? ' required' : '' }}">
|
||||||
{{ Form::select('status_id', $statuslabel_list , old('status_id', $item->status_id), array('class'=>'select2 status_id', 'style'=>'width:100%','id'=>'status_select_id', 'aria-label'=>'status_id')) }}
|
{{ Form::select('status_id', $statuslabel_list , old('status_id', $item->status_id), array('class'=>'select2 status_id', 'style'=>'width:100%','id'=>'status_select_id', 'aria-label'=>'status_id', 'data-validation' => "required")) }}
|
||||||
{!! $errors->first('status_id', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
|
{!! $errors->first('status_id', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-sm-2 text-left">
|
<div class="col-md-2 col-sm-2 text-left">
|
||||||
|
|
Loading…
Reference in a new issue