Skip to content

A free open source IT asset/license management system

fixed required css, and user input lengths

Godfrey Mef82f954e538
diff --git a/resources/views/modals/location.blade.php b/resources/views/modals/location.blade.php
index 9817e1ddd7..9580f4bbf9 100644
--- a/resources/views/modals/location.blade.php
+++ b/resources/views/modals/location.blade.php
@@ -9,7 +9,7 @@
<form action="{{ route('api.locations.store') }}" onsubmit="return false">
<div class="alert alert-danger" id="modal_error_msg" style="display:none">
</div>
- @include('modals.partials.name')
+ @include('modals.partials.name', ['item' => new \App\Models\Location(), 'required' => 'true'])
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-city">{{ trans('general.city') }}:</label></div>
diff --git a/resources/views/modals/model.blade.php b/resources/views/modals/model.blade.php
index 3b6bd47e5f..fb1650eee7 100644
--- a/resources/views/modals/model.blade.php
+++ b/resources/views/modals/model.blade.php
@@ -9,8 +9,8 @@
<form action="{{ route('api.models.store') }}" onsubmit="return false">
<div class="alert alert-danger" id="modal_error_msg" style="display:none">
</div>
- @include('modals.partials.name')
- @include('modals.partials.categories-select')
+ @include('modals.partials.name', ['required' => 'true'])
+ @include('modals.partials.categories-select', ['required' => 'true'])
@include('modals.partials.manufacturer-select')
@include('modals.partials.model-number')
@include('modals.partials.fieldset-select')
diff --git a/resources/views/modals/partials/categories-select.blade.php b/resources/views/modals/partials/categories-select.blade.php
index 9cbc721748..116a0808e9 100644
--- a/resources/views/modals/partials/categories-select.blade.php
+++ b/resources/views/modals/partials/categories-select.blade.php
@@ -1,8 +1,11 @@
<!-- modals/partials/categories-select.blade.php -->
+@php
+ $required = $required ?? '';
+@endphp
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-category_id">{{ trans('general.category') }}:</label></div>
<div class="col-md-8 col-xs-12 required">
- <select class="js-data-ajax" data-endpoint="categories/asset" name="category_id" style="width: 100%" id="modal-category_id"></select>
+ <select class="js-data-ajax" data-endpoint="categories/asset" name="category_id" style="width: 100%" id="modal-category_id" {{$required ? 'required' : ''}}></select>
</div>
</div>
<!-- modals/partials/categories-select.blade.php -->
\ No newline at end of file
diff --git a/resources/views/modals/partials/name.blade.php b/resources/views/modals/partials/name.blade.php
index 92bd7a62b7..6a64ed525f 100644
--- a/resources/views/modals/partials/name.blade.php
+++ b/resources/views/modals/partials/name.blade.php
@@ -1,7 +1,10 @@
<!-- modals/partials/name.blade.php -->
+@php
+ $required = $required ?? '';
+@endphp
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-name">{{ trans('general.name') }}:
</label></div>
- <div class="col-md-8 col-xs-12 required"><input type='text' name="name" id='modal-name' class="form-control"></div>
+ <div class="col-md-8 col-xs-12"><input type='text' name="name" id='modal-name' class="form-control" {{$required ? 'required' : ''}}></div>
</div>
<!-- modals/partials/name.blade.php -->
\ No newline at end of file
diff --git a/resources/views/modals/statuslabel.blade.php b/resources/views/modals/statuslabel.blade.php
index fba829ae50..e7076f1bbb 100644
--- a/resources/views/modals/statuslabel.blade.php
+++ b/resources/views/modals/statuslabel.blade.php
@@ -10,13 +10,13 @@
<div class="alert alert-danger" id="modal_error_msg" style="display:none">
</div>
<div class="dynamic-form-row">
- @include('partials.forms.edit.name', ['item' => new \App\Models\Statuslabel(),'translated_name' => trans('admin/statuslabels/table.name') ])
+ @include('partials.forms.edit.name', ['required' => 'true', 'item' => new \App\Models\Statuslabel(),'translated_name' => trans('admin/statuslabels/table.name') ])
</div>
<div class="dynamic-form-row">
<div class="col-md-3 col-xs-12"><label for="modal-type">{{ trans('admin/statuslabels/table.status_type') }}:
</label></div>
- <div class="col-md-8 col-xs-12 required">{{ Form::select('type', $statuslabel_types, '', array('class'=>'select2', 'style'=>'width:100%','id' =>'modal-type')) }}</div>
+ <div class="col-md-8 col-xs-12">{{ Form::select('type', $statuslabel_types, '', array('class'=>'select2', 'style'=>'width:100%','id' =>'modal-type', 'required',)) }}</div>
</div>
</form>
</div>
diff --git a/resources/views/modals/user.blade.php b/resources/views/modals/user.blade.php
index f04689569b..5672119fa1 100644
--- a/resources/views/modals/user.blade.php
+++ b/resources/views/modals/user.blade.php
@@ -42,16 +42,16 @@
@include ('partials.forms.edit.location-profile-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
</div>
<div class="dynamic-form-row">
- @include('partials.forms.edit.name-first', ['class' => 'col-md-8 col-xs-12-pull', 'style' => 'width:67%;'])
+ @include('partials.forms.edit.name-first', [ 'required' => 'true', 'class' => 'col-md-8 col-xs-12-pull', 'style' => 'width:67%;'])
</div>
<div class="dynamic-form-row">
- @include('partials.forms.edit.name-last', ['class' => 'col-md-8 col-xs-12-pull', 'style' => 'width:67%;'])
+ @include('partials.forms.edit.name-last', ['required' => 'true', 'class' => 'col-md-8 col-xs-12-pull', 'style' => 'width:67%;'])
</div>
<div class="dynamic-form-row">
@include('partials.forms.edit.email')
</div>
<div class="dynamic-form-row">
- @include('partials.forms.edit.username')
+ @include('partials.forms.edit.username', [ 'required' => 'true'])
</div>
<div class="dynamic-form-row">
@@ -59,8 +59,8 @@
<div class="col-md-3 col-xs-12">
<label class="control-label" for="modal-password">{{ trans('admin/users/table.password') }}:</label>
</div>
- <div class="col-md-8 col-xs-12 required" style="margin-bottom:5px;">
- <input type='password' name="password" id='modal-password' class="form-control">
+ <div class="col-md-8 col-xs-12 " style="margin-bottom:5px;">
+ <input type='password' name="password" id='modal-password' class="form-control" required>
<a href="#" class="left" id="modal-genPassword">Generate</a>
<div id="modal-generated-password"></div>
</div>
@@ -72,8 +72,8 @@
<div class="col-md-3 col-xs-12 ">
<label class="control-label" for="modal-password_confirmation">{{ trans('admin/users/table.password_confirm') }}:</label>
</div>
- <div class="col-md-8 col-xs-12 required">
- <input class="form-control" type='password' name="password_confirmation" id='modal-password_confirmation'>
+ <div class="col-md-8 col-xs-12">
+ <input class="form-control" type='password' name="password_confirmation" id='modal-password_confirmation' required>
</div>
</div>
diff --git a/resources/views/partials/forms/edit/company-select.blade.php b/resources/views/partials/forms/edit/company-select.blade.php
index 012e032866..59de71a6ab 100644
--- a/resources/views/partials/forms/edit/company-select.blade.php
+++ b/resources/views/partials/forms/edit/company-select.blade.php
@@ -20,7 +20,7 @@
<!-- full company support is enabled or this user is a superadmin -->
<div id="{{ $fieldname }}" class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}">
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
- <div class="col-md-7">
+ <div class="col-md-8">
<select class="js-data-ajax" data-endpoint="companies" data-placeholder="{{ trans('general.select_company') }}" name="{{ $fieldname }}" style="width: 100%" id="company_select"{{ (isset($multiple) && ($multiple=='true')) ? " multiple='multiple'" : '' }}>
@if ($company_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
<option value="{{ $company_id }}" selected="selected">
diff --git a/resources/views/partials/forms/edit/location-profile-select.blade.php b/resources/views/partials/forms/edit/location-profile-select.blade.php
index e0e222aa99..14dc4793a5 100644
--- a/resources/views/partials/forms/edit/location-profile-select.blade.php
+++ b/resources/views/partials/forms/edit/location-profile-select.blade.php
@@ -2,7 +2,7 @@
<div id="location_id" class="form-group{{ $errors->has('location_id') ? ' has-error' : '' }}"{!! (isset($style)) ? ' style="'.e($style).'"' : '' !!}>
{{ Form::label('location_id', $translated_name, array('class' => 'col-md-3 control-label')) }}
- <div class="col-md-7">
+ <div class="col-md-8">
<select class="js-data-ajax" data-endpoint="locations" data-placeholder="{{ trans('general.select_location') }}" name="location_id" style="width: 100%" id="location_id_location_select" aria-label="location_id">
@if ($location_id = old('location_id', (isset($user)) ? $user->location_id : ''))
<option value="{{ $location_id }}" selected="selected" role="option" aria-selected="true" role="option">
diff --git a/resources/views/partials/forms/edit/name-first.blade.php b/resources/views/partials/forms/edit/name-first.blade.php
index d7c07947ae..5175313824 100644
--- a/resources/views/partials/forms/edit/name-first.blade.php
+++ b/resources/views/partials/forms/edit/name-first.blade.php
@@ -2,11 +2,12 @@
@php
$class = $class ?? 'col-md-6';
$style = $style ?? '';
+ $required = $required ?? '';
@endphp
<div class="form-group {{ $errors->has('first_name') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="first_name">{{ trans('general.first_name') }}</label>
<div class="{{$class ? $class : 'col-md-6'}}" style= "{{$style}}""{{ (Helper::checkIfRequired($user, 'first_name')) ? ' required' : '' }}">
- <input class="form-control" type="text" name="first_name" id="first_name" value="{{ old('first_name', $user->first_name) }}" maxlength="191" />
+ <input class="form-control" type="text" name="first_name" id="first_name" value="{{ old('first_name', $user->first_name) }}" {{$required ? 'required' : ''}} maxlength="191" />
{!! $errors->first('first_name', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
diff --git a/resources/views/partials/forms/edit/name-last.blade.php b/resources/views/partials/forms/edit/name-last.blade.php
index 61ef221dc0..6d01a477d8 100644
--- a/resources/views/partials/forms/edit/name-last.blade.php
+++ b/resources/views/partials/forms/edit/name-last.blade.php
@@ -2,6 +2,7 @@
@php
$class = $class ?? 'col-md-6';
$style = $style ?? '';
+ $required = $required ?? '';
@endphp
<div class="form-group {{ $errors->has('last_name') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="last_name">{{ trans('general.last_name') }} </label>
diff --git a/resources/views/partials/forms/edit/username.blade.php b/resources/views/partials/forms/edit/username.blade.php
index fe8b21dd1b..030becf722 100644
--- a/resources/views/partials/forms/edit/username.blade.php
+++ b/resources/views/partials/forms/edit/username.blade.php
@@ -1,6 +1,9 @@
<!-- partials/forms/edit/username.blade.php -->
+@php
+ $required = $required ?? '';
+@endphp
<div class="form-group">
<div class="col-md-3 col-xs-12"><label for="modal-username">{{ trans('admin/users/table.username') }}:</label></div>
- <div class="col-md-8 col-xs-12 required"><input type='text' name="username" id='modal-username' class="form-control"></div>
+ <div class="col-md-8 col-xs-12 required"><input type='text' name="username" id='modal-username' class="form-control" {{$required ? 'required' : ''}}></div>
</div>
<!-- partials/forms/edit/username.blade.php -->
\ No newline at end of file