From c69cbe87467d135a244bbcc0c102a8fe5d005987 Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 4 Dec 2024 13:54:10 +1100 Subject: [PATCH] Add select component, and start of switch to use @pa instead of @js/@css --- app/Providers/AppServiceProvider.php | 6 ++ app/Providers/CustomBladeServiceProvider.php | 1 + .../views/components/form/base.blade.php | 27 ++++++++ .../views/components/form/select.blade.php | 62 +++++++++++++++++++ resources/views/layouts/app.blade.php | 2 - .../layouts/partials/htmlheader.blade.php | 5 ++ .../views/layouts/partials/scripts.blade.php | 8 ++- .../views/user/system/register.blade.php | 42 +++---------- 8 files changed, 115 insertions(+), 38 deletions(-) create mode 100644 resources/views/components/form/base.blade.php create mode 100644 resources/views/components/form/select.blade.php diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ab3ac4a..d010a02 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; +use Illuminate\Foundation\AliasLoader; use Illuminate\Http\Request; use Illuminate\Notifications\ChannelManager; use Illuminate\Support\Facades\Auth; @@ -13,6 +14,7 @@ use Illuminate\Support\ServiceProvider; use App\Events\Echomail as EchomailEvent; use App\Events\Matrix\Message; +use App\Helpers\PageAssets; use App\Listeners\EchomailListener; use App\Listeners\Matrix\MessageListener; use App\Notifications\Channels\{EchomailChannel,MatrixChannel,NetmailChannel}; @@ -79,5 +81,9 @@ class AppServiceProvider extends ServiceProvider EchomailEvent::class, EchomailListener::class, ); + + // Custom Aliases + $loader = AliasLoader::getInstance(); + $loader->alias('PageAssets',PageAssets::class); } } diff --git a/app/Providers/CustomBladeServiceProvider.php b/app/Providers/CustomBladeServiceProvider.php index 00e7dbe..15973a8 100644 --- a/app/Providers/CustomBladeServiceProvider.php +++ b/app/Providers/CustomBladeServiceProvider.php @@ -5,6 +5,7 @@ namespace App\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; +// @deprecated - now using pa() class CustomBladeServiceProvider extends ServiceProvider { /** diff --git a/resources/views/components/form/base.blade.php b/resources/views/components/form/base.blade.php new file mode 100644 index 0000000..b2cf197 --- /dev/null +++ b/resources/views/components/form/base.blade.php @@ -0,0 +1,27 @@ +
+ @if(isset($label)) + + @endisset +
+ @if(isset($icon) || isset($prepend)) + {{-- // messes with the icon box, we have rounded corners on the right side +
+ --}} + @isset($icon)@endisset @isset($prepend){!! $prepend !!}@endisset + {{-- +
+ --}} + @endif + {{ $slot }} + + @error((! empty($old)) ? $old : $name) + {{ $message }} + @elseif(isset($feedback)) + {{ $feedback }} + @enderror + +
+ @isset($helper) + {{ $helper }} + @endif +
\ No newline at end of file diff --git a/resources/views/components/form/select.blade.php b/resources/views/components/form/select.blade.php new file mode 100644 index 0000000..560282b --- /dev/null +++ b/resources/views/components/form/select.blade.php @@ -0,0 +1,62 @@ + + + + + +@pa(select2) + +@section('page-scripts') + +@append \ No newline at end of file diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 5ab5ceb..2aaec36 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -20,8 +20,6 @@ {{-- Scripts --}} @section('scripts') @include('layouts.partials.scripts') - - @yield('page-scripts') @show \ No newline at end of file diff --git a/resources/views/layouts/partials/htmlheader.blade.php b/resources/views/layouts/partials/htmlheader.blade.php index e5af3bb..f410820 100644 --- a/resources/views/layouts/partials/htmlheader.blade.php +++ b/resources/views/layouts/partials/htmlheader.blade.php @@ -15,6 +15,10 @@ + + {!! PageAssets::css() !!} + + @yield('page-css') @if(file_exists('css/fixes.css')) @@ -22,5 +26,6 @@ @endif + diff --git a/resources/views/layouts/partials/scripts.blade.php b/resources/views/layouts/partials/scripts.blade.php index 65e5186..af633a9 100644 --- a/resources/views/layouts/partials/scripts.blade.php +++ b/resources/views/layouts/partials/scripts.blade.php @@ -36,4 +36,10 @@ }, false) }); })() - \ No newline at end of file + + + +{!! PageAssets::js() !!} + + +@yield('page-scripts') \ No newline at end of file diff --git a/resources/views/user/system/register.blade.php b/resources/views/user/system/register.blade.php index b8906d4..1989d2b 100644 --- a/resources/views/user/system/register.blade.php +++ b/resources/views/user/system/register.blade.php @@ -21,27 +21,13 @@ use App\Models\System;
- -
- - - - @error('system_id') - {{ $message }} - @else - BBS Name is required. - @enderror - -
+ @php($options = System::select(['systems.id','systems.name']) + ->active() + ->where('id','<>',$setup->system_id) + ->whereRaw('id NOT IN (SELECT system_id FROM "system_user")') + ->cursor()) + +
@@ -74,21 +60,7 @@ use App\Models\System; @endsection -@section('page-css') - @css('select2') -@append @section('page-scripts') - @js('select2') - - -