fixed required css, and user input lengths

This commit is contained in:
Godfrey M 2024-09-25 15:47:57 -07:00
parent 96953aa2ed
commit ef82f954e5
11 changed files with 29 additions and 18 deletions

View file

@ -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>

View file

@ -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')

View file

@ -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 -->

View file

@ -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 -->

View file

@ -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>

View file

@ -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>

View file

@ -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">

View file

@ -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">

View file

@ -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>

View file

@ -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>

View file

@ -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 -->