From f8ea3824aed88849306429b6e78db5b1307bd0b1 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Mon, 23 Sep 2024 23:49:17 +0200 Subject: [PATCH] Add livewire components --- .gitignore | 1 + app/Providers/LivewireServiceProvider.php | 46 +++++++++++++++++++++++ app/View/Page/MenuEntry.php | 28 ++++++++++++++ app/View/Page/Sidebar.php | 43 +++++++++++++++++++++ app/View/Ui/Box.php | 38 +++++++++++++++++++ app/View/Ui/Sprite.php | 21 +++++++++++ config/app.php | 5 ++- vite.config.js | 2 +- 8 files changed, 181 insertions(+), 3 deletions(-) create mode 100644 app/Providers/LivewireServiceProvider.php create mode 100644 app/View/Page/MenuEntry.php create mode 100644 app/View/Page/Sidebar.php create mode 100644 app/View/Ui/Box.php create mode 100644 app/View/Ui/Sprite.php diff --git a/.gitignore b/.gitignore index c723cdc5..581fdaa2 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ Homestead.json /public/sprite.svg /.php-cs-fixer.cache /groups.sql +/.phpunit.cache/ diff --git a/app/Providers/LivewireServiceProvider.php b/app/Providers/LivewireServiceProvider.php new file mode 100644 index 00000000..880ad376 --- /dev/null +++ b/app/Providers/LivewireServiceProvider.php @@ -0,0 +1,46 @@ +register(AgeGroupCountBlock::class); + app(DashboardFactory::class)->register(MemberPaymentBlock::class); + app(DashboardFactory::class)->register(TestersBlock::class); + app(DashboardFactory::class)->register(EfzPendingBlock::class); + app(DashboardFactory::class)->register(PsPendingBlock::class); + + ComponentAttributeBag::macro('mergeWhen', function ($condition, $key, $attributes) { + /** @var ComponentAttributeBag */ + $self = $this; + return $condition ? $self->merge([$key => $attributes]) : $self; + }); + } + + /** + * Bootstrap services. + */ + public function boot(): void + { + // + } +} diff --git a/app/View/Page/MenuEntry.php b/app/View/Page/MenuEntry.php new file mode 100644 index 00000000..260fc395 --- /dev/null +++ b/app/View/Page/MenuEntry.php @@ -0,0 +1,28 @@ + + + + {{ $slot }} + + + HTML; + } +} diff --git a/app/View/Page/Sidebar.php b/app/View/Page/Sidebar.php new file mode 100644 index 00000000..946c8f2f --- /dev/null +++ b/app/View/Page/Sidebar.php @@ -0,0 +1,43 @@ + +
+ Dashboard + Mitglieder + Beiträge + Rechnungen + Zuschüsse + Tätigkeiten + Gruppierungen + Veranstaltungen + Mail-Verteiler +
+
+ + +
Suchen
+
+ Einstellungen + Abmelden +
+ + + + + HTML; + } +} diff --git a/app/View/Ui/Box.php b/app/View/Ui/Box.php new file mode 100644 index 00000000..03e51808 --- /dev/null +++ b/app/View/Ui/Box.php @@ -0,0 +1,38 @@ +mergeWhen($second, 'class', 'bg-gray-700 group-[.is-popup]:bg-zinc-600') + ->mergeWhen(!$second, 'class', 'bg-gray-800 group-[.is-popup]:bg-zinc-700') + ->mergeWhen(true, 'class', 'p-3 rounded-lg flex flex-col') + !!}> +
+ @if($title) +
{{$title}}
+ @endif + {{$inTitle}} +
+
+ {{ $slot }} +
+ + HTML; + } +} diff --git a/app/View/Ui/Sprite.php b/app/View/Ui/Sprite.php new file mode 100644 index 00000000..679eaf18 --- /dev/null +++ b/app/View/Ui/Sprite.php @@ -0,0 +1,21 @@ +merge(['class' => 'fill-current']) }}"> + HTML; + } +} diff --git a/config/app.php b/config/app.php index 5f2a4bbd..a763ad6e 100644 --- a/config/app.php +++ b/config/app.php @@ -168,7 +168,6 @@ return [ */ App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, - // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\HorizonServiceProvider::class, App\Providers\RouteServiceProvider::class, @@ -176,8 +175,10 @@ return [ App\Tex\TexServiceProvider::class, App\Dav\ServiceProvider::class, App\Setting\SettingServiceProvider::class, - App\Dashboard\DashboardServiceProvider::class, + // App\Dashboard\DashboardServiceProvider::class, App\Providers\PluginServiceProvider::class, + Modules\Dashboard\DashboardServiceProvider::class, + App\Providers\LivewireServiceProvider::class, ], /* diff --git a/vite.config.js b/vite.config.js index c7d9e4c1..17dc260c 100644 --- a/vite.config.js +++ b/vite.config.js @@ -5,7 +5,7 @@ import path from 'path'; export default defineConfig({ plugins: [ - laravel(['resources/js/app.js']), + laravel(['resources/js/app.js', 'resources/livewire-js/app.js']), vue({ template: { transformAssetUrls: {