Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
92dd7ac3cb | |||
293d9913c6 | |||
8acc3a91af |
@@ -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">
|
||||
|
@@ -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>
|
@@ -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>
|
@@ -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">×</button>
|
@@ -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) {
|
||||
|
@@ -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>
|
@@ -13,9 +13,9 @@ class LeenooksCarbon implements CastsAttributes
|
||||
*
|
||||
* @param array<string, mixed> $attributes
|
||||
*/
|
||||
public function get(Model $model, string $key, mixed $value, array $attributes): Carbon
|
||||
public function get(Model $model, string $key, mixed $value, array $attributes): ?Carbon
|
||||
{
|
||||
return Carbon::create($value);
|
||||
return $value ? Carbon::create($value) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,8 +23,8 @@ class LeenooksCarbon implements CastsAttributes
|
||||
*
|
||||
* @param array<string, mixed> $attributes
|
||||
*/
|
||||
public function set(Model $model, string $key, mixed $value, array $attributes): string
|
||||
public function set(Model $model, string $key, mixed $value, array $attributes): string|null
|
||||
{
|
||||
return ($value instanceof Carbon ? $value : $this->get($model,$key,$value,$attributes))->format('Y-m-d H:i:s');
|
||||
return ($value instanceof Carbon ? $value : $this->get($model,$key,$value,$attributes))?->format('Y-m-d H:i:s');
|
||||
}
|
||||
}
|
||||
|
@@ -106,6 +106,21 @@ class PageAssets
|
||||
]
|
||||
],
|
||||
],
|
||||
'select2' => [
|
||||
'base' => [
|
||||
'css' => [
|
||||
'//cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css',
|
||||
],
|
||||
'js' => [
|
||||
'//cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js',
|
||||
],
|
||||
],
|
||||
'autofocus' => [
|
||||
'js' => [
|
||||
'/plugin/select2/fix-autofocus.js',
|
||||
],
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
// Items to manage
|
||||
|
@@ -41,6 +41,7 @@ class CustomBladeServiceProvider extends ServiceProvider
|
||||
|
||||
switch ($type) {
|
||||
case 'datatables':
|
||||
case 'select2':
|
||||
Log::alert(sprintf('Blade @css/@js for %s deprecicated, use @pa',$type));
|
||||
break;
|
||||
|
||||
@@ -146,33 +147,6 @@ class CustomBladeServiceProvider extends ServiceProvider
|
||||
|
||||
break;
|
||||
|
||||
case 'select2':
|
||||
switch ($content) {
|
||||
case 'css':
|
||||
// Base
|
||||
$css->put($type,'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css');
|
||||
|
||||
break;
|
||||
|
||||
case 'js':
|
||||
// Base
|
||||
$js->put($type,'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js');
|
||||
|
||||
foreach ($arguments as $option) {
|
||||
$key = $type.':'.$option;
|
||||
switch ($option) {
|
||||
case 'autofocus':
|
||||
$js->put($key,'/plugin/select2/fix-autofocus.js');
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new \Exception(sprintf('Unknown [%s] option: [%s:%s]',$type,$content,$option));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'simplemde':
|
||||
switch ($content) {
|
||||
case 'css':
|
||||
|
Reference in New Issue
Block a user