Minor updates to components, and we now use @pa not @js/@css

This commit is contained in:
Deon George 2024-08-10 22:25:03 +10:00
parent 293d9913c6
commit 92dd7ac3cb
6 changed files with 12 additions and 10 deletions

View File

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

View File

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

View File

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

View File

@ -1,4 +1,3 @@
<!-- Errors -->
@if ($errors->any())
<div class="alert alert-danger alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>

View File

@ -1,8 +1,11 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="hidden" id="{{ $name }}_disabled" name="{{ $name }}" value="" disabled>
<select class="form-control @error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @required(isset($required)) @disabled(isset($disabled))>
@if(isset($addvalues) && $addvalues)
<option id="new"></option>
@if(! empty($value) || isset($addnew) || isset($choose))
<option value=""></option>
@isset($addnew)
<option value="new">{{ $addnew ?: 'Add New' }}</option>
@endisset
@endif
@empty($groupby)
@ -10,6 +13,7 @@
@continue(! Arr::get($option,'value'))
<option value="{{ Arr::get($option,'id') }}" @selected(Arr::get($option,'id') == old($old ?? $name,$value ?? ''))>{{ Arr::get($option,'value') }}</option>
@endforeach
@else
@foreach($options->groupBy($groupby) as $group)
<optgroup label="{{ $groupby == 'active' ? (Arr::get($group->first(),$groupby) ? 'Active' : 'Not Active') : Arr::get($group->first(),$groupby) }}">
@ -23,10 +27,9 @@
</select>
</x-leenooks::form.base>
@section('page-scripts')
@css(select2)
@js(select2,autofocus)
@pa(select2)
@section('page-scripts')
<script type="text/javascript">
// Select doesnt support read only so we'll use disable and a new field
function {{$id ?? $name}}_readonly(on) {

View File

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