More compoonents for forms

This commit is contained in:
Deon George 2024-07-23 23:50:02 +10:00
parent f32c29fa8c
commit 83bdea458f
12 changed files with 48 additions and 58 deletions

View File

@ -1,4 +1,4 @@
<button type="cancel" id="cancel" {{ $attributes->class(['btn','btn-sm','btn-danger']) }}>Cancel</button>
<button type="cancel" id="cancel" style="margin-top: 2.0rem !important;" {{ $attributes->class(['btn','btn-sm','btn-danger']) }}>Cancel</button>
@section('page-scripts')
<script type="text/javascript">

View File

@ -1 +1 @@
<button type="reset" id="reset" {{ $attributes->class(['btn','btn-sm','btn-secondary']) }}>Reset</button>
<button type="reset" id="reset" style="margin-top: 2.0rem !important;" {{ $attributes->class(['btn','btn-sm','btn-secondary']) }}>Reset</button>

View File

@ -1 +1 @@
<button type="submit" id="submit" {{ $attributes->class(['btn','btn-sm','btn-success']) }}>{{ $slot }}</button>
<button type="submit" id="submit" style="margin-top: 2.0rem !important;" {{ $attributes->class(['btn','btn-sm','btn-success']) }}>{{ $slot }}</button>

View File

@ -1,25 +1,23 @@
@if(isset($label))
<label for="{{ $id ?? $name }}">{{ $label }}</label>
@endisset
<div class="form-group">
@if(isset($label))
<label for="{{ $id ?? $name }}">{{ $label }}</label>
@endisset
<div class="form-group">
<div class="input-group has-validation">
@if(isset($icon) || isset($prepend))
<div class="input-group-prepend">
<span class="input-group-text">@isset($icon)<i class="fas fa-fw {{ $icon }}"></i>@endisset @isset($prepend){!! $prepend !!}@endisset</span>
</div>
@endif()
{{ $slot }}
<span class="invalid-feedback" role="alert">
@error($name)
{{ $message }}
@elseif(isset($feedback))
{{ $feedback }}
@enderror
</span>
</div>
@isset($helper)
<span class="input-helper">{{ $helper }}</span>
@endif
<div class="input-group has-validation">
@if(isset($icon) || isset($prepend))
<div class="input-group-prepend">
<span class="input-group-text">@isset($icon)<i class="fas fa-fw {{ $icon }}"></i>@endisset @isset($prepend){!! $prepend !!}@endisset</span>
</div>
@endif()
{{ $slot }}
<span class="invalid-feedback" role="alert">
@error($name)
{{ $message }}
@elseif(isset($feedback))
{{ $feedback }}
@enderror
</span>
</div>
</div>
@isset($helper)
<span class="input-helper">{{ $helper }}</span>
@endif
</div>

View File

@ -0,0 +1,3 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="date" class="form-control {{ $classes ?? ''}}@error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required))>
</x-leenooks::form.base>

View File

@ -1,3 +1,3 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="email" class="form-control {{ $classes ?? ''}}@error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($name,$value ?? "") }}">
<input type="email" class="form-control {{ $classes ?? ''}}@error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($name,$value ?? '') }}">
</x-leenooks::form.base>

View File

@ -1,3 +1,3 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="password" class="form-control {{ $classes ?? ''}}@error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($name,$value ?? "") }}">
<input type="password" class="form-control {{ $classes ?? ''}}@error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($name,$value ?? '') }}">
</x-leenooks::form.base>

View File

@ -1,3 +1,3 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="text" class="form-control {{ $classes ?? ''}}@error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($name,$value ?? "") }}" @readonly(isset($readonly)) @required(isset($required))>
<input type="text" class="form-control {{ $classes ?? ''}}@error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required))>
</x-leenooks::form.base>

View File

@ -1,3 +1,3 @@
<x-leenooks::form.base {{ $attributes }}>
<textarea class="form-control {{ $classes ?? ''}} @error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @isset($placeholder)placeholder="{{ $placeholder }}"@endisset>{{ old($name,$value ?? "") }}</textarea>
<textarea class="form-control {{ $classes ?? ''}} @error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @isset($placeholder)placeholder="{{ $placeholder }}"@endisset>{{ old($name,$value ?? '') }}</textarea>
</x-leenooks::form.base>

View File

@ -0,0 +1,17 @@
<div class="form-group">
<div class="input-group has-validation">
<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
<input type="checkbox" class="custom-control-input @error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @checked(old($name,$value ?? ''))>
@if(isset($label))
<label class="custom-control-label" for="{{ $id ?? $name }}">{{ $label }}</label>
@endif
</div>
<span class="invalid-feedback" role="alert">
@error($name)
{{ $message }}
@elseif(isset($feedback))
{{ $feedback }}
@enderror
</span>
</div>
</div>

View File

@ -1,17 +0,0 @@
<div class="form-group">
<label for="{{ $id }}">{{ $label }}</label>
<div class="input-group has-validation">
@empty($icon)
@else
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa-fw {{ $icon }}"></i></span>
</div>
@endempty()
<input type="date" class="form-control @error($id) is-invalid @enderror" id="{{ $id }}" name="{{ $name ?? $id}}" value="{{ old($old,$value) }}">
<span class="invalid-feedback" role="alert">
@error($id)
{{ $message }}
@enderror
</span>
</div>
</div>

View File

@ -1,11 +0,0 @@
<div class="form-group">
<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
<input type="checkbox" class="custom-control-input" id="{{ $id }}" name="{{ $name ?: $id }}" {{ old($old ?? $name,$value) ? 'checked' : '' }}>
<label class="custom-control-label" for="{{ $id }}">{{ $label }}</label>
</div>
<span class="invalid-feedback @error($id) d-block @enderror" role="alert">
@error($id)
{{ $message }}
@enderror
</span>
</div>