Compare commits

...

95 Commits

Author SHA1 Message Date
philipp lang 20dea4502c --wip-- [skip ci] 2025-04-03 23:03:07 +02:00
philipp lang ba3e88b930 Update contribution 2025-04-03 23:03:07 +02:00
philipp lang 7cc3d4197b Remove global rules 2025-04-03 23:03:07 +02:00
philipp lang c433abbbb4 Add lazy loading to Contribution MemberData 2025-04-03 23:03:07 +02:00
philipp lang 6806e54209 Add Validation for contribution form 2025-04-03 23:03:07 +02:00
philipp lang d6a1de8fb9 Remove comments 2025-04-03 23:03:07 +02:00
philipp lang 2567f28741 Fix UserSeeder 2025-04-03 23:03:07 +02:00
philipp lang 4e845d29a9 Add class merging for ui components 2025-04-03 23:03:07 +02:00
philipp lang a9089f6d01 Mod sleect for contribution compilers 2025-04-03 23:03:07 +02:00
philipp lang 5f07686bc9 Add id to form elements instead of uuid 2025-04-03 23:03:07 +02:00
philipp lang 793429e8e0 Fix namespace 2025-04-03 23:03:07 +02:00
philipp lang f4407e41e5 Pass initial value to editor function call 2025-04-03 23:03:07 +02:00
philipp lang c2cd87bc5b Merge class attributes to form text field 2025-04-03 23:03:07 +02:00
philipp lang 71538a6d81 Add Lazy Loading prevention to app when testing 2025-04-03 23:03:07 +02:00
philipp lang b33596c6f0 Fix form tests 2025-04-03 23:03:07 +02:00
philipp lang 3693dcfe54 Add contribution index page 2025-04-03 23:03:07 +02:00
philipp lang 4644f3832b Fix database migrations for mailgateways 2025-04-03 22:52:33 +02:00
philipp lang d68b166e15 Exit successfully after running copydb 2025-04-03 22:52:33 +02:00
philipp lang 5d103b1908 Remove conditions from editor 2025-04-03 22:52:33 +02:00
philipp lang 195fcc97b2 Add prevention settings 2025-04-03 22:52:33 +02:00
philipp lang ef4f4e68fb Add fileshare settings 2025-04-03 22:52:33 +02:00
philipp lang 7c73b489ce Add form settings 2025-04-03 22:52:31 +02:00
philipp lang 74db2f7c6b Lint 2025-04-03 22:51:47 +02:00
philipp lang 458d68c271 Add password reset confirm 2025-04-03 22:51:47 +02:00
philipp lang 471f766638 Cleanup 2025-04-03 22:51:47 +02:00
philipp lang dc3eb68861 Add Password Reset email page 2025-04-03 22:51:47 +02:00
philipp lang 003e30d423 Add Login module 2025-04-03 22:51:47 +02:00
philipp lang 5d40c0b2bb Move DPSG Icon 2025-04-03 22:51:47 +02:00
philipp lang e60105e5af Add title and menu to Page component 2025-04-03 22:51:47 +02:00
philipp lang 2fadba3193 Add head component for html page head tag 2025-04-03 22:51:47 +02:00
philipp lang 357a696a53 Fix error handling for mailgateway forms 2025-04-03 22:51:47 +02:00
philipp lang 79fed8c002 Add error handling via tooltip 2025-04-03 22:51:47 +02:00
philipp lang 9b02bddea9 Fix: Add id to select field 2025-04-03 22:51:47 +02:00
philipp lang 1b6057673a Add Vite facade 2025-04-03 22:51:47 +02:00
philipp lang 5c9c59718c Add Danger theme for tippy 2025-04-03 22:51:47 +02:00
philipp lang c1e0842457 Add vite spritemap 2025-04-03 22:51:47 +02:00
philipp lang a61fd55b29 Update sprite component 2025-04-03 22:51:47 +02:00
philipp lang 4156a8744a Add validation attributes to nami field 2025-04-03 22:51:47 +02:00
philipp lang 84b17b312f Add SettingIntro component 2025-04-03 22:51:47 +02:00
philipp lang 6906b7c097 Add Nami Settings 2025-04-03 22:51:47 +02:00
philipp lang 30c84f0cfd Move test files 2025-04-03 22:51:47 +02:00
philipp lang d765bad0ed Add page title 2025-04-03 22:51:47 +02:00
philipp lang 89ce931f9d Add active menu entry for setting 2025-04-03 22:51:47 +02:00
philipp lang 2fac4d5a73 Set active title for setting 2025-04-03 22:51:47 +02:00
philipp lang 56090b0104 Update arch tests 2025-04-03 22:51:45 +02:00
philipp lang 131061a3ee Lint 2025-04-03 22:49:28 +02:00
philipp lang 9733c260b2 Move types 2025-04-03 22:49:28 +02:00
philipp lang e2e9ddb9fd Move modules 2025-04-03 22:49:28 +02:00
philipp lang 511a58ded3 Add Badge component 2025-04-03 22:49:28 +02:00
philipp lang b937a8f4fa Add data type cast for Mailgateway 2025-04-03 22:49:26 +02:00
philipp lang cb01496028 Allow MailmanTypeRequest to cast to data 2025-04-03 22:45:58 +02:00
philipp lang 92284b053c Mod setArray macro for nested values 2025-04-03 22:45:58 +02:00
philipp lang 39f0d476fb Simplify form 2025-04-03 22:45:58 +02:00
philipp lang e6aa5e2c61 Update update hook 2025-04-03 22:45:58 +02:00
philipp lang d225be6137 Add test for events 2025-04-03 22:45:58 +02:00
philipp lang 6094a16c36 Lint 2025-04-03 22:45:58 +02:00
philipp lang 34355d9b32 Update refresh page 2025-04-03 22:45:58 +02:00
philipp lang 7a39798e8b Add mailgateway 2025-04-03 22:45:58 +02:00
philipp lang b07ad8d739 Fix layout 2025-04-03 22:45:58 +02:00
philipp lang 5cd164f0d8 Remove old MailgatewayRequestFactory 2025-04-03 22:45:58 +02:00
philipp lang 652b83a140 Lint 2025-04-03 22:45:58 +02:00
philipp lang 4d0923a01f Add HTTP Check to MailmanTypeRequest 2025-04-03 22:45:58 +02:00
philipp lang 1de148eecc Delete old mailgateway tests 2025-04-03 22:45:58 +02:00
philipp lang 12f053428c Mark MailgatewayResource as deprecated 2025-04-03 22:45:58 +02:00
philipp lang 0ce797c874 Mark old mailgateway settings as deprecated 2025-04-03 22:45:58 +02:00
philipp lang 8e2487c719 Add BooleanDisplay component 2025-04-03 22:45:58 +02:00
philipp lang 2b1fe6ddcd Make right slot optional in SettingLayout 2025-04-03 22:45:58 +02:00
philipp lang fe8a2d69e6 fixup! Add modal component 2025-04-03 22:45:58 +02:00
philipp lang 76d6c4ef90 Add testable macro for setArray 2025-04-03 22:45:58 +02:00
philipp lang 8bd66010dd Add modal component 2025-04-03 22:45:58 +02:00
philipp lang bb9c219d81 Throw exception when variant not found 2025-04-03 22:45:58 +02:00
philipp lang b52eedc254 Merge attributes for hint 2025-04-03 22:45:58 +02:00
philipp lang a06fd01194 Lint 2025-04-03 22:45:58 +02:00
philipp lang 4a731f1104 Fix Tooltip attribute of Table action 2025-04-03 22:45:58 +02:00
philipp lang 278a598078 Register MailgatewayServiceProvider 2025-04-03 22:45:58 +02:00
philipp lang 3c72b890fb Add select field 2025-04-03 22:45:58 +02:00
philipp lang 7de12a92dd Disable autocomplete for password fields 2025-04-03 22:45:58 +02:00
philipp lang 643959ff04 Fix label required 2025-04-03 22:45:58 +02:00
philipp lang 5d16d65f8a Add Table action button 2025-04-03 22:45:58 +02:00
philipp lang 985b7942c4 Add table component 2025-04-03 22:45:58 +02:00
philipp lang 6582f49321 Mod Component Test 2025-04-03 22:45:58 +02:00
philipp lang 5998230569 Move Dashboard registrations 2025-04-03 22:45:58 +02:00
philipp lang 0dbac1da4a Add Settings for Bill 2025-04-03 22:45:58 +02:00
philipp lang 4b507aa297 Add Toast and tooltip 2025-04-03 22:45:58 +02:00
philipp lang af45560fe1 Remove Base tests from Composer 2025-04-03 22:45:58 +02:00
philipp lang cecc90f07b Add Component Resolver for Modules 2025-04-03 22:45:58 +02:00
philipp lang 5b116a54c4 Add Dashboard 2025-04-03 22:45:58 +02:00
philipp lang 0070976e34 Add Service Provider 2025-04-03 22:45:58 +02:00
philipp lang dd07f6dbd7 Add livewire components 2025-04-03 22:45:58 +02:00
philipp lang ab74abdfdf Add config file 2025-04-03 22:45:58 +02:00
philipp lang 8f5448bbbc Install Livewire Package 2025-04-03 22:45:56 +02:00
philipp lang 2fd6598ef3 Lint 2025-04-03 17:59:49 +02:00
philipp lang 0c90f66a66 Add update for bank account 2025-04-03 02:40:51 +02:00
philipp lang b541d246e0 Set permanent bank account of member 2025-04-03 00:56:07 +02:00
philipp lang 858ae7f8d1 Lint 2025-04-03 00:53:22 +02:00
216 changed files with 8524 additions and 5149 deletions
app
Actions
Contribution
Efz
Http
Invoice
Lib/Editor
Maildispatcher
Mailgateway
Mailman/Support
Member
Membership
Prevention
Providers
Setting
User.php
View
bin
composer.jsoncomposer.lock
config
database
deptrac.yaml
modules

View File

@ -61,7 +61,7 @@ class InsertMemberAction
}
return tap(Member::updateOrCreate(['nami_id' => $member->id], $payload), function ($insertedMember) use ($member) {
$insertedMember->bankAccount()->updateOrCreate([
$insertedMember->bankAccount->update([
'iban' => $member->bankAccount->iban,
'bic' => $member->bankAccount->bic,
'blz' => $member->bankAccount->blz,

View File

@ -1,36 +0,0 @@
<?php
namespace App\Contribution\Actions;
use App\Contribution\ContributionFactory;
use App\Country;
use Inertia\Inertia;
use Inertia\Response;
use Lorisleiva\Actions\Concerns\AsAction;
class FormAction
{
use AsAction;
/**
* @return array<string, mixed>
*/
public function handle(): array
{
return [
'countries' => Country::select('name', 'id')->get(),
'data' => [
'country' => Country::firstWhere('name', 'Deutschland')->id,
],
'compilers' => app(ContributionFactory::class)->compilerSelect(),
];
}
public function asController(): Response
{
session()->put('menu', 'contribution');
session()->put('title', 'Zuschüsse');
return Inertia::render('contribution/VIndex', $this->handle());
}
}

View File

@ -1,54 +0,0 @@
<?php
namespace App\Contribution\Actions;
use App\Contribution\ContributionFactory;
use App\Contribution\Documents\ContributionDocument;
use App\Rules\JsonBase64Rule;
use Illuminate\Support\Facades\Validator;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
use Zoomyboy\Tex\BaseCompiler;
use Zoomyboy\Tex\Tex;
class GenerateAction
{
use AsAction;
/**
* @param class-string<ContributionDocument> $document
* @param array<string, mixed> $payload
*/
public function handle(string $document, array $payload): BaseCompiler
{
return Tex::compile($document::fromRequest($payload));
}
public function asController(ActionRequest $request): BaseCompiler
{
$payload = $this->payload($request);
$type = data_get($payload, 'type');
ValidateAction::validateType($type);
Validator::make($payload, app(ContributionFactory::class)->rules($type))->validate();
return $this->handle($type, $payload);
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'payload' => [new JsonBase64Rule()],
];
}
/**
* @return array<string, string>
*/
private function payload(ActionRequest $request): array
{
return json_decode(rawurldecode(base64_decode($request->input('payload', ''))), true);
}
}

View File

@ -1,38 +0,0 @@
<?php
namespace App\Contribution\Actions;
use App\Contribution\Documents\ContributionDocument;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
use Zoomyboy\Tex\BaseCompiler;
use Zoomyboy\Tex\Tex;
class GenerateApiAction
{
use AsAction;
/**
* @param class-string<ContributionDocument> $document
* @param array<string, mixed> $payload
*/
public function handle(string $document, array $payload): BaseCompiler
{
return Tex::compile($document::fromApiRequest($payload));
}
public function asController(ActionRequest $request): BaseCompiler
{
ValidateAction::validateType($request->input('type'));
return $this->handle($request->input('type'), $request->input());
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [];
}
}

View File

@ -1,37 +0,0 @@
<?php
namespace App\Contribution\Actions;
use App\Contribution\ContributionFactory;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Validator;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class ValidateAction
{
use AsAction;
public function asController(): JsonResponse
{
return response()->json(['valid' => true]);
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return app(ContributionFactory::class)->rules(request()->type);
}
public function prepareForValidation(ActionRequest $request): void
{
static::validateType($request->input('type'));
}
public static function validateType(?string $type = null): void
{
Validator::make(['type' => $type], app(ContributionFactory::class)->typeRule())->validate();
}
}

View File

@ -10,7 +10,6 @@ use App\Contribution\Documents\CitySolingenDocument;
use App\Contribution\Documents\CityFrankfurtMainDocument;
use App\Contribution\Documents\WuppertalDocument;
use Illuminate\Support\Collection;
use Illuminate\Validation\Rule;
class ContributionFactory
{
@ -32,31 +31,8 @@ class ContributionFactory
public function compilerSelect(): Collection
{
return collect($this->documents)->map(fn ($document) => [
'title' => $document::buttonName(),
'class' => $document,
'name' => $document::buttonName(),
'id' => $document,
]);
}
/**
* @return array<string, mixed>
*/
public function typeRule(): array
{
return [
'type' => ['required', Rule::in($this->documents)],
];
}
/**
* @param class-string<ContributionDocument> $type
*
* @return array<string, mixed>
*/
public function rules(string $type): array
{
return [
...$type::globalRules(),
...$type::rules(),
];
}
}

View File

@ -29,7 +29,7 @@ class MemberData extends Data
*/
public static function fromModels(array $ids): Collection
{
return Member::whereIn('id', $ids)->orderByRaw('lastname, firstname')->get()->map(fn ($member) => self::factory()->withoutMagicalCreation()->from([
return Member::with('leaderMemberships', 'gender')->whereIn('id', $ids)->orderByRaw('lastname, firstname')->get()->map(fn ($member) => self::factory()->withoutMagicalCreation()->from([
...$member->toArray(),
'birthday' => $member->birthday->toAtomString(),
'isLeader' => $member->isLeader(),

View File

@ -120,17 +120,4 @@ class BdkjHesse extends ContributionDocument
{
return 'BDKJ Hessen';
}
/**
* @return array<string, mixed>
*/
public static function rules(): array
{
return [
'dateFrom' => 'required|string|date_format:Y-m-d',
'dateUntil' => 'required|string|date_format:Y-m-d',
'country' => 'required|integer|exists:countries,id',
'zipLocation' => 'required|string',
];
}
}

View File

@ -6,7 +6,7 @@ use App\Contribution\Data\MemberData;
use App\Contribution\Traits\FormatsDates;
use App\Contribution\Traits\HasPdfBackground;
use App\Country;
use App\Invoice\InvoiceSettings;
use Modules\Invoice\InvoiceSettings;
use Illuminate\Support\Collection;
class CityFrankfurtMainDocument extends ContributionDocument
@ -77,17 +77,4 @@ class CityFrankfurtMainDocument extends ContributionDocument
{
return 'Frankfurt';
}
/**
* @return array<string, mixed>
*/
public static function rules(): array
{
return [
'dateFrom' => 'required|string|date_format:Y-m-d',
'dateUntil' => 'required|string|date_format:Y-m-d',
'country' => 'required|integer|exists:countries,id',
'zipLocation' => 'required|string',
];
}
}

View File

@ -73,17 +73,4 @@ class CityRemscheidDocument extends ContributionDocument
{
return 'Remscheid';
}
/**
* @return array<string, mixed>
*/
public static function rules(): array
{
return [
'dateFrom' => 'required|string|date_format:Y-m-d',
'dateUntil' => 'required|string|date_format:Y-m-d',
'zipLocation' => 'required|string',
'country' => 'required|integer|exists:countries,id',
];
}
}

View File

@ -3,7 +3,7 @@
namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData;
use App\Invoice\InvoiceSettings;
use Modules\Invoice\InvoiceSettings;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Zoomyboy\Tex\Engine;
@ -97,16 +97,4 @@ class CitySolingenDocument extends ContributionDocument
{
return 'Stadt Solingen';
}
/**
* @return array<string, mixed>
*/
public static function rules(): array
{
return [
'dateFrom' => 'required|string|date_format:Y-m-d',
'dateUntil' => 'required|string|date_format:Y-m-d',
'zipLocation' => 'required|string',
];
}
}

View File

@ -21,23 +21,6 @@ abstract class ContributionDocument extends Document
*/
abstract public static function fromApiRequest(array $request): self;
/**
* @return array<string, mixed>
*/
abstract public static function rules(): array;
/**
* @return array<string, mixed>
*/
public static function globalRules(): array
{
return [
'eventName' => 'required|string',
'members' => 'present|array|min:1',
'members.*' => 'integer|exists:members,id',
];
}
public static function buttonName(): string
{
return 'Für ' . static::getName() . ' erstellen';;

View File

@ -68,17 +68,4 @@ class RdpNrwDocument extends ContributionDocument
{
return 'RdP NRW';
}
/**
* @return array<string, mixed>
*/
public static function rules(): array
{
return [
'dateFrom' => 'required|string|date_format:Y-m-d',
'dateUntil' => 'required|string|date_format:Y-m-d',
'country' => 'required|integer|exists:countries,id',
'zipLocation' => 'required|string',
];
}
}

View File

@ -64,16 +64,4 @@ class WuppertalDocument extends ContributionDocument
{
return 'Wuppertal';
}
/**
* @return array<string, mixed>
*/
public static function rules(): array
{
return [
'dateFrom' => 'required|string|date_format:Y-m-d',
'dateUntil' => 'required|string|date_format:Y-m-d',
'zipLocation' => 'required|string',
];
}
}

View File

@ -1,44 +0,0 @@
<?php
namespace App\Efz;
use App\Dashboard\Blocks\Block;
use App\Member\Member;
use Illuminate\Database\Eloquent\Builder;
class EfzPendingBlock extends Block
{
/**
* @return Builder<Member>
*/
public function query(): Builder
{
return Member::where(function ($query) {
return $query->where('efz', '<=', now()->subYears(5)->endOfYear())
->orWhereNull('efz');
})
->whereCurrentGroup()
->orderByRaw('lastname, firstname')
->whereHas('memberships', fn ($builder) => $builder->isLeader()->active());
}
/**
* @return array{members: array<int, string>}
*/
public function data(): array
{
return [
'members' => $this->query()->get()->map(fn ($member) => $member->fullname)->toArray(),
];
}
public function component(): string
{
return 'efz-pending';
}
public function title(): string
{
return 'Ausstehende Führungszeugnisse';
}
}

View File

@ -1,60 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Inertia\Response;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
public function showLoginForm(): Response
{
session()->put('title', 'Anmelden');
return \Inertia::render('authentication/VLogin');
}
/**
* Validate the user login request.
*/
protected function validateLogin(Request $request): void
{
$request->validate([
$this->username() => 'required|max:255|string|email',
'password' => 'required|string',
]);
}
}

View File

@ -1,71 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use App\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @return \App\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
}

View File

@ -1,50 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Display the password reset view for the given token.
*
* If no token is present, display the link request form.
*
* @param \Illuminate\Http\Request $request
*/
public function showResetForm(Request $request): Response
{
$token = $request->route()->parameter('token');
return Inertia::render('authentication/PasswordResetConfirm', [
'token' => $token,
'email' => $request->email,
]);
}
}

View File

@ -3,7 +3,7 @@
namespace App\Http\Middleware;
use App\Http\Resources\UserResource;
use App\Module\ModuleSettings;
use Modules\Module\ModuleSettings;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Inertia\Middleware;

View File

@ -6,6 +6,7 @@ use App\Invoice\Models\Invoice;
use App\Payment\Payment;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Str;
use Modules\Invoice\InvoiceSettings;
use Zoomyboy\Tex\Document;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;

View File

@ -1,37 +0,0 @@
<?php
namespace App\Invoice;
use App\Dashboard\Blocks\Block;
use App\Invoice\Models\InvoicePosition;
use App\Member\Member;
class MemberPaymentBlock extends Block
{
/**
* @return array<string, string|int>
*/
public function data(): array
{
$amount = InvoicePosition::whereHas('invoice', fn ($query) => $query->whereNeedsPayment())
->selectRaw('sum(price) AS price')
->first();
$members = Member::whereHasPendingPayment()->count();
return [
'members' => $members,
'total_members' => Member::count(),
'amount' => number_format((int) $amount->price / 100, 2, ',', '.') . ' €',
];
}
public function component(): string
{
return 'member-payment';
}
public function title(): string
{
return 'Ausstehende Mitgliedsbeiträge';
}
}

View File

@ -6,7 +6,7 @@ use App\Invoice\BillDocument;
use App\Invoice\BillKind;
use App\Invoice\Enums\InvoiceStatus;
use App\Invoice\InvoiceDocument;
use App\Invoice\InvoiceSettings;
use Modules\Invoice\InvoiceSettings;
use App\Invoice\RememberDocument;
use App\Invoice\Scopes\InvoiceFilterScope;
use App\Member\Member;

View File

@ -2,13 +2,17 @@
namespace App\Lib\Editor;
use Livewire\Wireable;
use Spatie\LaravelData\Concerns\WireableData;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Support\EloquentCasts\DataEloquentCast;
/** @todo replace blocks with actual block data classes */
class EditorData extends Data implements Editorable
class EditorData extends Data implements Editorable, Wireable
{
use WireableData;
/** @param array<int, mixed> $blocks */
public function __construct(
public string $version,

View File

@ -2,7 +2,7 @@
namespace App\Maildispatcher\Models;
use App\Mailgateway\Models\Mailgateway;
use Modules\Mailgateway\Models\Mailgateway;
use Database\Factories\Maildispatcher\Models\MaildispatcherFactory;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;

View File

@ -4,8 +4,7 @@ namespace App\Maildispatcher\Resources;
use App\Lib\HasMeta;
use App\Maildispatcher\Models\Maildispatcher;
use App\Mailgateway\Models\Mailgateway;
use App\Mailgateway\Resources\MailgatewayResource;
use Modules\Mailgateway\Models\Mailgateway;
use App\Member\FilterScope;
use App\Member\Member;
use Illuminate\Http\Resources\Json\JsonResource;

View File

@ -1,27 +0,0 @@
<?php
namespace App\Mailgateway\Actions;
use App\Mailgateway\Models\Mailgateway;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class StoreAction
{
use AsAction;
use ValidatesRequests;
/**
* @param array<string, mixed> $input
*/
public function handle(array $input): void
{
$this->checkIfWorks($input);
Mailgateway::create($input);
}
public function asController(ActionRequest $request): void
{
$this->handle($request->validated());
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace App\Mailgateway\Actions;
use App\Mailgateway\Models\Mailgateway;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class UpdateAction
{
use AsAction;
use ValidatesRequests;
/**
* @param array<string, mixed> $input
*/
public function handle(Mailgateway $mailgateway, array $input): void
{
$this->checkIfWorks($input);
$mailgateway->update($input);
}
public function asController(Mailgateway $mailgateway, ActionRequest $request): void
{
$this->handle($mailgateway, $request->validated());
}
}

View File

@ -1,65 +0,0 @@
<?php
namespace App\Mailgateway\Actions;
use App\Mailgateway\Types\Type;
use Illuminate\Validation\Rule;
use Illuminate\Validation\ValidationException;
use Lorisleiva\Actions\ActionRequest;
trait ValidatesRequests
{
/**
* @param array<string, mixed> $input
*/
public function checkIfWorks(array $input): void
{
if (!app(data_get($input, 'type.cls'))->setParams($input['type']['params'])->works()) {
throw ValidationException::withMessages(['connection' => 'Verbindung fehlgeschlagen.']);
}
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'name' => 'required|string|max:255',
'domain' => 'required|string|max:255',
...$this->typeValidation(),
'type.params' => 'present|array',
...collect(request()->input('type.cls')::rules('storeValidator'))->mapWithKeys(fn ($rules, $key) => ["type.params.{$key}" => $rules]),
];
}
/**
* @return array<string, mixed>
*/
public function getValidationAttributes(): array
{
return [
'type.cls' => 'Typ',
'name' => 'Beschreibung',
'domain' => 'Domain',
...collect(request()->input('type.cls')::fieldNames())->mapWithKeys(fn ($attribute, $key) => ["type.params.{$key}" => $attribute]),
];
}
/**
* @return array<string, mixed>
*/
private function typeValidation(): array
{
return [
'type.cls' => ['required', 'string', 'max:255', Rule::in(app('mail-gateways'))],
];
}
public function prepareForValidation(ActionRequest $request): void
{
if (!is_subclass_of(request()->input('type.cls'), Type::class)) {
throw ValidationException::withMessages(['type.cls' => 'Typ ist nicht valide.']);
}
}
}

View File

@ -1,42 +0,0 @@
<?php
namespace App\Mailgateway\Casts;
use App\Mailgateway\Types\Type;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
/**
* @implements CastsAttributes<Type, Type>
*/
class TypeCast implements CastsAttributes
{
/**
* Cast the given value.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param mixed $value
* @param array<string, mixed> $attributes
*
* @return mixed
*/
public function get($model, string $key, $value, array $attributes)
{
$value = json_decode($value, true);
return app($value['cls'])->setParams($value['params']);
}
/**
* Prepare the given value for storage.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param mixed $value
* @param array<string, mixed> $attributes
*
* @return mixed
*/
public function set($model, string $key, $value, array $attributes)
{
return json_encode($value);
}
}

View File

@ -1,68 +0,0 @@
<?php
namespace App\Mailgateway\Resources;
use App\Lib\HasMeta;
use App\Mailgateway\Models\Mailgateway;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @mixin Mailgateway
*/
class MailgatewayResource extends JsonResource
{
use HasMeta;
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
*
* @return array<string, mixed>
*/
public function toArray($request)
{
return [
'name' => $this->name,
'domain' => $this->domain,
'type_human' => $this->type::name(),
'works' => $this->type->works(),
'type' => $this->type->toResource(),
'id' => $this->id,
'links' => [
'update' => route('mailgateway.update', ['mailgateway' => $this->getModel()]),
],
];
}
/**
* @return array<string, mixed>
*/
public static function meta(): array
{
return [
'links' => [
'store' => route('mailgateway.store'),
],
'types' => app('mail-gateways')->map(fn ($gateway) => [
'id' => $gateway,
'name' => $gateway::name(),
'fields' => $gateway::presentFields('storeValidator'),
'defaults' => (object) $gateway::defaults(),
])->prepend([
'id' => null,
'name' => '-- kein --',
'fields' => [],
'defaults' => (object) [],
]),
'default' => [
'domain' => '',
'name' => '',
'type' => [
'params' => [],
'cls' => null,
],
],
];
}
}

View File

@ -85,7 +85,7 @@ class MailmanService
return app(Paginator::class)->result(
fn ($page) => $this->http()->get("/lists/{$list->listId}/roster/member?page={$page}&count=10"),
function ($response) use ($list) {
throw_unless($response->ok(), MailmanServiceException::class, 'Fetching members for listId '.$list->listId.' failed.');
throw_unless($response->ok(), MailmanServiceException::class, 'Fetching members for listId ' . $list->listId . ' failed.');
/** @var array<int, array{email: string, self_link: string}>|null */
$entries = data_get($response->json(), 'entries', []);
throw_if(is_null($entries), MailmanServiceException::class, 'Failed getting member list from response');
@ -112,7 +112,7 @@ class MailmanService
'pre_confirmed' => 'true',
]);
throw_unless(201 === $response->status(), MailmanServiceException::class, 'Adding member '.$email.' to '.$list->listId.' failed');
throw_unless(201 === $response->status(), MailmanServiceException::class, 'Adding member ' . $email . ' to ' . $list->listId . ' failed');
}
public function removeMember(Member $member): void

View File

@ -48,7 +48,16 @@ class NamiPutMemberAction
'id' => $member->nami_id,
'version' => $member->version,
'keepdata' => $member->keepdata,
'bankAccount' => BankAccount::from([]),
'bankAccount' => BankAccount::from([
'bankName' => $member->bankAccount->bank_name,
'id' => $member->bankAccount->nami_id,
'memberId' => $member->mitgliedsnr,
'iban' => $member->bankAccount->iban,
'bic' => $member->bankAccount->bic,
'blz' => $member->bankAccount->blz,
'person' => $member->bankAccount->person,
'accountNumber' => $member->bankAccount->account_number,
]),
]);
$response = $api->putMember($namiMember, $activity ? $activity->nami_id : null, $subactivity ? $subactivity->nami_id : null);
Member::withoutEvents(function () use ($response, $member) {

View File

@ -12,4 +12,6 @@ class BankAccount extends Model
use HasFactory;
public $guarded = [];
public $primaryKey = 'member_id';
}

View File

@ -9,7 +9,8 @@ use Zoomyboy\LaravelNami\Data\Member as NamiMember;
use Zoomyboy\LaravelNami\Data\MembershipEntry as NamiMembershipEntry;
use Spatie\LaravelData\Attributes\DataCollectionOf;
class FullMember extends Data {
class FullMember extends Data
{
/**
* @param DataCollection<int, NamiCourse> $courses
* @param DataCollection<int, NamiMembershipEntry> $memberships
@ -20,6 +21,6 @@ class FullMember extends Data {
public DataCollection $courses,
#[DataCollectionOf(NamiMembershipEntry::class)]
public DataCollection $memberships,
) {}
) {
}
}

View File

@ -304,12 +304,17 @@ class Member extends Model implements Geolocatable
public static function booted()
{
static::created(function (self $model): void {
$model->bankAccount()->create([]);
});
static::deleting(function (self $model): void {
$model->memberships->each->delete();
$model->courses->each->delete();
$model->invoicePositions->each(function ($position) {
$position->delete();
});
$model->bankAccount()->delete();
});
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Membership;
use App\Dashboard\Blocks\Block;
use App\Member\Member;
use Illuminate\Database\Eloquent\Builder;
class TestersBlock extends Block
{
/**
* @return Builder<Member>
*/
public function query(): Builder
{
return Member::whereHas('memberships', fn ($q) => $q->isTrying())
->with('memberships', fn ($q) => $q->isTrying());
}
/**
* @return array{members: array<int, array{name: string, try_ends_at: string, try_ends_at_human: string}>}
*/
public function data(): array
{
return [
'members' => $this->query()->get()->map(fn ($member) => [
'name' => $member->fullname,
'try_ends_at' => $member->memberships->first()->from->addWeeks(8)->format('d.m.Y'),
'try_ends_at_human' => $member->memberships->first()->from->addWeeks(8)->diffForHumans(),
])->toArray(),
];
}
public function component(): string
{
return 'testers';
}
public function title(): string
{
return 'Endende Schhnupperzeiten';
}
}

View File

@ -1,19 +0,0 @@
<?php
namespace App\Prevention\Actions;
use App\Prevention\PreventionSettings;
use Illuminate\Http\JsonResponse;
use Lorisleiva\Actions\Concerns\AsAction;
class SettingApiAction
{
use AsAction;
public function handle(): JsonResponse
{
return response()->json([
'data' => app(PreventionSettings::class)->toArray(),
]);
}
}

View File

@ -1,33 +0,0 @@
<?php
namespace App\Prevention\Actions;
use App\Lib\Editor\EditorData;
use App\Lib\Events\Succeeded;
use App\Prevention\PreventionSettings;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class SettingStoreAction
{
use AsAction;
/**
* @return array<string, string>
*/
public function rules(): array
{
return [
'formmail' => 'array',
];
}
public function handle(ActionRequest $request): void
{
$settings = app(PreventionSettings::class);
$settings->formmail = EditorData::from($request->formmail);
$settings->save();
Succeeded::message('Einstellungen gespeichert.')->dispatch();
}
}

View File

@ -2,7 +2,6 @@
namespace App\Prevention\Mails;
use App\Invoice\InvoiceSettings;
use App\Lib\Editor\EditorData;
use App\Prevention\Contracts\Preventable;
use Illuminate\Bus\Queueable;
@ -11,6 +10,7 @@ use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
use Modules\Invoice\InvoiceSettings;
class PreventionRememberMail extends Mailable
{

View File

@ -3,13 +3,11 @@
namespace App\Providers;
use App\Form\Models\Form;
use App\Mailgateway\Types\LocalType;
use App\Mailgateway\Types\MailmanType;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Laravel\Telescope\Telescope;
class AppServiceProvider extends ServiceProvider
{
@ -30,14 +28,10 @@ class AppServiceProvider extends ServiceProvider
return $this;
});
app()->bind('mail-gateways', fn () => collect([
LocalType::class,
MailmanType::class,
]));
app()->extend('media-library-helpers', fn ($p) => $p->put('form', Form::class));
Blade::componentNamespace('App\\View\\Mail', 'mail-view');
Model::preventLazyLoading(!app()->isProduction());
}
/**

View File

@ -0,0 +1,43 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Blade;
use Illuminate\View\ComponentAttributeBag;
use Livewire\Livewire;
class BaseServiceProvider extends ServiceProvider
{
/**
* Register services.
*/
public function register(): void
{
Blade::componentNamespace('App\\View\\Ui', 'ui');
Blade::componentNamespace('App\\View\\Page', 'page');
Blade::componentNamespace('App\\View\\Form', 'form');
ComponentAttributeBag::macro('mergeWhen', function ($condition, $key, $attributes) {
/** @var ComponentAttributeBag */
$self = $this;
return $condition ? $self->merge([$key => $attributes]) : $self;
});
Livewire::resolveMissingComponent(function ($name) {
'modules.dashboard.components.dashboard-component';
if (str($name)->startsWith('modules.')) {
return str($name)->explode('.')->map(fn ($name) => str($name)->studly()->toString())->implode('\\');
}
return null;
});
}
/**
* Bootstrap services.
*/
public function boot(): void
{
}
}

View File

@ -7,6 +7,7 @@ use Illuminate\Http\RedirectResponse;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
/** @deprecated */
class StoreAction
{
use AsAction;

View File

@ -8,6 +8,7 @@ use Inertia\Inertia;
use Inertia\Response;
use Lorisleiva\Actions\Concerns\AsAction;
/** @deprecated */
class ViewAction
{
use AsAction;

View File

@ -0,0 +1,36 @@
<?php
namespace App\Setting\Data;
use Livewire\Mechanisms\HandleComponents\Synthesizers\Synth;
use Spatie\LaravelSettings\Settings;
class SettingSynthesizer extends Synth
{
public static $key = 'setting-class';
public static function match($target)
{
return $target instanceof Settings;
}
public function dehydrate($target)
{
return [$target->toArray(), ['setting_class' => get_class($target)]];
}
public function hydrate($value, $meta)
{
return app($meta['setting_class'])->fill($value);
}
public function get(&$target, $key)
{
return $target->{$key};
}
public function set(&$target, $key, $value)
{
$target->{$key} = $value;
}
}

View File

@ -10,7 +10,7 @@ abstract class LocalSettings extends Settings
public function url(): string
{
return route('setting.view', ['settingGroup' => $this->group()]);
return url('setting/' . $this->group());
}
/**

View File

@ -3,14 +3,10 @@
namespace App\Setting;
use App\Group;
use App\Initialize\Actions\NamiLoginCheckAction;
use App\Nami\Actions\SettingSaveAction;
use App\Setting\Contracts\Storeable;
use Lorisleiva\Actions\ActionRequest;
use Zoomyboy\LaravelNami\Api;
use Zoomyboy\LaravelNami\Nami;
class NamiSettings extends LocalSettings implements Storeable
class NamiSettings extends LocalSettings
{
public int $mglnr;
@ -43,14 +39,6 @@ class NamiSettings extends LocalSettings implements Storeable
];
}
public function beforeSave(ActionRequest $request): void
{
NamiLoginCheckAction::run([
'mglnr' => $request->mglnr,
'password' => $request->password,
]);
}
public function localGroup(): ?Group
{
return Group::firstWhere('nami_id', $this->default_group_id);

View File

@ -2,9 +2,8 @@
namespace App\Setting;
use App\Invoice\InvoiceSettings;
use App\Setting\Contracts\Storeable;
use Illuminate\Routing\Router;
use Illuminate\Support\Collection;
class SettingFactory
{
@ -26,16 +25,11 @@ class SettingFactory
}
/**
* @return array<int, array{url: string, is_active: bool}>
* @return Collection<int, LocalSettings>
*/
public function getShare(): array
public function all(): Collection
{
return collect($this->settings)->map(fn ($setting) => [
'url' => (new $setting)->url(),
'is_active' => url(request()->path()) === (new $setting)->url(),
'title' => $setting::title(),
])
->toArray();
return collect($this->settings)->map(fn ($setting) => new $setting);
}
public function resolveGroupName(string $name): LocalSettings

View File

@ -2,16 +2,12 @@
namespace App\Setting;
use App\Fileshare\FileshareSettings;
use App\Form\FormSettings;
use App\Invoice\InvoiceSettings;
use App\Mailgateway\MailgatewaySettings;
use App\Module\ModuleSettings;
use App\Prevention\PreventionSettings;
use App\Setting\Actions\StoreAction;
use App\Setting\Actions\ViewAction;
use Modules\Module\ModuleSettings;
use App\Setting\Data\SettingSynthesizer;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Livewire\Livewire;
use Modules\Invoice\InvoiceSettings;
class SettingServiceProvider extends ServiceProvider
{
@ -24,9 +20,6 @@ class SettingServiceProvider extends ServiceProvider
{
app()->singleton(SettingFactory::class, fn () => new SettingFactory());
app(Router::class)->bind('settingGroup', fn ($param) => app(SettingFactory::class)->resolveGroupName($param));
app(Router::class)->middleware(['web', 'auth:web'])->name('setting.view')->get('/setting/{settingGroup}', ViewAction::class);
app(Router::class)->middleware(['web', 'auth:web'])->name('setting.data')->get('/setting/{settingGroup}/data', ViewAction::class);
app(Router::class)->middleware(['web', 'auth:web'])->name('setting.store')->post('/setting/{settingGroup}', StoreAction::class);
}
/**
@ -38,10 +31,8 @@ class SettingServiceProvider extends ServiceProvider
{
app(SettingFactory::class)->register(ModuleSettings::class);
app(SettingFactory::class)->register(InvoiceSettings::class);
app(SettingFactory::class)->register(MailgatewaySettings::class);
app(SettingFactory::class)->register(NamiSettings::class);
app(SettingFactory::class)->register(FormSettings::class);
app(SettingFactory::class)->register(FileshareSettings::class);
app(SettingFactory::class)->register(PreventionSettings::class);
Livewire::propertySynthesizer(SettingSynthesizer::class);
}
}

View File

@ -2,11 +2,11 @@
namespace App;
use App\Auth\ResetPassword;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Modules\Auth\Mails\ResetPassword;
class User extends Authenticatable
{

View File

@ -0,0 +1,77 @@
<?php
namespace App\View\Enums;
use Illuminate\Support\Collection;
use InvalidArgumentException;
enum Variant: string
{
case PRIMARY = 'primary';
case SECONDARY = 'secondary';
case PRIMARYLIGHT = 'primary-light';
case WARNING = 'warning';
case INFO = 'info';
case DANGER = 'danger';
public function foreground(): string
{
return match ($this) {
self::PRIMARY => 'text-primary-300',
self::SECONDARY => 'text-primary-400',
self::PRIMARYLIGHT => 'text-primary-200',
self::WARNING => 'text-yellow-300',
self::INFO => 'text-blue-300',
self::DANGER => 'text-red-100',
};
}
public function background(): string
{
return match ($this) {
self::PRIMARY => 'bg-primary-700',
self::SECONDARY => 'bg-primary-800',
self::PRIMARYLIGHT => 'bg-primary-600',
self::WARNING => 'bg-yellow-700',
self::INFO => 'bg-blue-700',
self::DANGER => 'bg-red-400',
};
}
public function hoverForeground(): string
{
return match ($this) {
self::PRIMARY => 'hover:text-primary-100',
self::SECONDARY => 'hover:text-primary-200',
self::PRIMARYLIGHT => 'hover:text-primary-100',
self::WARNING => 'hover:text-yellow-100',
self::INFO => 'hover:text-blue-100',
self::DANGER => 'hover:text-red-100',
};
}
public function hoverBackground(): string
{
return match ($this) {
self::PRIMARY => 'hover:bg-primary-500',
self::SECONDARY => 'hover:bg-primary-600',
self::PRIMARYLIGHT => 'hover:bg-primary-500',
self::WARNING => 'hover:bg-yellow-500',
self::INFO => 'hover:bg-blue-500',
self::DANGER => 'hover:bg-red-500',
};
}
public static function fromString(string $input): self
{
return collect(static::cases())
->first(fn ($variant) => $variant->value === $input)
?: throw new InvalidArgumentException("Unknown variant: {$input} - Available Variants: " . self::values()->implode(', '));
}
public static function values(): Collection
{
return collect(static::cases())->map(fn ($variant) => $variant->value);
}
}

53
app/View/Form/Editor.php Normal file
View File

@ -0,0 +1,53 @@
<?php
namespace App\View\Form;
use App\View\Traits\HasFormDimensions;
use Illuminate\View\Component;
class Editor extends Component
{
use HasFormDimensions;
public function __construct(
public string $name,
public string $size = 'default',
public ?string $hint = null,
public bool $required = false,
public string $label = '',
public string $id = ''
) {
$this->id = $this->id ? $this->id : $this->name;
}
public function render()
{
return <<<'HTML'
<div class="flex flex-col group {{$heightClass}}">
@if ($label)
<x-form::label :required="$required">{{$label}}</x-form::label>
@endif
<div class="relative w-full h-full">
<div
class="
w-full border-gray-600 border-solid text-gray-300 bg-gray-700 leading-none rounded-lg
group-[.size-default]:border-2 group-[.size-sm]:border
group-[.size-default]:text-sm group-[.size-sm]:text-xs
group-[.size-default]:p-2 group-[.size-sm]:p-1
"
@updated="$wire.{{$attributes->wire('model')->value}} = $event.detail"
x-data="editor($wire.{{$attributes->wire('model')->value}})"
id="{{$id}}"
{{$attributes}}
></div>
<x-ui::errors :for="$name" />
@if($hint)
<x-form::hint>{{$hint}}</x-form::hint>
@endif
</div>
</div>
HTML;
}
}

28
app/View/Form/Hint.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace App\View\Form;
use App\View\Traits\HasFormDimensions;
use Illuminate\View\Component;
class Hint extends Component
{
use HasFormDimensions;
public function __construct(
public bool $required = false,
) {
}
public function render()
{
return <<<'HTML'
<div {{ $attributes->merge(['class' => 'h-full items-center flex absolute top-0 right-0']) }}>
<div x-tooltip.raw="{{$slot}}" class="mr-2">
<x-ui::sprite src="info-button" class="w-5 h-5 text-primary-700"></x-ui::sprite>
</div>
</div>
HTML;
}
}

29
app/View/Form/Label.php Normal file
View File

@ -0,0 +1,29 @@
<?php
namespace App\View\Form;
use App\View\Traits\HasFormDimensions;
use Illuminate\View\Component;
class Label extends Component
{
use HasFormDimensions;
public function __construct(
public bool $required = false,
) {
}
public function render()
{
return <<<'HTML'
<span class="font-semibold leading-none text-gray-400 group-[.size-default]:text-sm group-[.size-sm]:text-xs">
{{ $slot }}
@if ($required)
<span class="text-red-800">&nbsp;*</span>
@endif
</span>
HTML;
}
}

59
app/View/Form/Lever.php Normal file
View File

@ -0,0 +1,59 @@
<?php
namespace App\View\Form;
use App\View\Traits\HasFormDimensions;
use Illuminate\View\Component;
class Lever extends Component
{
use HasFormDimensions;
public function __construct(
public string $name,
public string $size = 'default',
public $value = null,
public ?string $hint = null,
public bool $disabled = false,
public bool $required = false,
public string $label = '',
public string $id = ''
) {
$this->id = $this->id ? $this->id : $this->name;
}
public function render()
{
return <<<'HTML'
<label class="flex flex-col items-start group {{$heightClass}} " for="{{$id}}" style="{{$heightVars}}">
@if ($label)
<x-form::label :required="$required">{{$label}}</x-form::label>
@endif
<span class="relative flex-none flex h-[var(--height)] @if($hint) pr-8 @endif">
<input id="{{$id}}" type="checkbox" name="{{$name}}" value="{{$value}}" @if($disabled) disabled="disabled" @endif class="absolute peer opacity-0" {{ $attributes }} />
<span class="relative cursor-pointer h-full w-[calc(var(--height)*2)] rounded peer-focus:bg-red-500 duration-300 bg-gray-700 peer-checked:bg-primary-700"></span>
<span class="absolute h-full top-0 left-0 flex-none flex justify-center items-center aspect-square">
<x-ui::sprite
class="relative text-gray-400 flex-none text-white duration-300 group-[.size-default]:size-3 group-[.size-sm]:size-2"
src="check"
></x-ui::sprite>
</span>
<span class="absolute h-full top-0 left-[var(--height)] flex-none flex justify-center items-center aspect-square">
<x-ui::sprite
class="relative text-gray-400 flex-none text-white duration-300 group-[.size-default]:size-3 group-[.size-sm]:size-2"
src="close"
></x-ui::sprite>
</span>
<var class="absolute duration-300 bg-gray-400 rounded
top-[var(--padding)] left-[var(--padding)]
size-[calc(var(--height)-var(--padding)*2)] peer-checked:left-[calc(var(--height)+var(--padding))]"
></var>
@if($hint)
<x-form::hint>{{$hint}}</x-form::hint>
@endif
</span>
</label>
HTML;
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\View\Form;
use Illuminate\View\Component;
class SaveButton extends Component
{
public function __construct(public string $form = '')
{
}
public function render()
{
return <<<'HTML'
<button @if($form) form="{{$form}}" @endif type="submit" class="flex items-center transition-all justify-center w-8 h-8 bg-primary-700 hover:bg-primary-600 rounded" x-tooltip="`speichern`">
<x-ui::sprite class="w-4 h-4 text-white" src="save"></x-ui::sprite>
</button>
HTML;
}
}

58
app/View/Form/Select.php Normal file
View File

@ -0,0 +1,58 @@
<?php
namespace App\View\Form;
use App\View\Traits\HasFormDimensions;
use Illuminate\View\Component;
class Select extends Component
{
use HasFormDimensions;
public function __construct(
public string $name,
public string $size = 'default',
public ?string $hint = null,
public bool $required = false,
public string $label = '',
public $options = [],
public bool $disabled = false,
public string $id = ''
) {
$this->id = $this->id ? $this->id : $this->name;
}
public function render()
{
return <<<'HTML'
<label class="flex flex-col group {{$heightClass}}" for="{{$id}}" style="{{$heightVars}}">
@if ($label)
<x-form::label :required="$required">{{$label}}</x-form::label>
@endif
<div class="relative flex-none flex">
<select {{$attributes}} @if($disabled) disabled @endif name="{{$name}}" id="{{$id}}"
class="
w-full h-[var(--height)] border-gray-600 border-solid text-gray-300 bg-gray-700 leading-none rounded-lg
group-[.size-default]:border-2 group-[.size-sm]:border
group-[.size-default]:text-sm group-[.size-sm]:text-xs
group-[.size-default]:px-2 group-[.size-sm]:px-1
py-0
"
>
<option value="">-- kein --</option>
@foreach ($options as $option)
<option value="{{$option['id']}}">{{ $option['name'] }}</option>
@endforeach
</select>
<x-ui::errors :for="$name" />
@if($hint)
<x-form::hint class="right-6">{{$hint}}</x-form::hint>
@endif
</div>
</label>
HTML;
}
}

54
app/View/Form/Text.php Normal file
View File

@ -0,0 +1,54 @@
<?php
namespace App\View\Form;
use App\View\Traits\HasFormDimensions;
use Illuminate\View\Component;
class Text extends Component
{
use HasFormDimensions;
public function __construct(
public string $name,
public string $size = 'default',
public ?string $hint = null,
public bool $required = false,
public string $label = '',
public string $type = 'text',
public string $id = ''
) {
$this->id = $this->id ? $this->id : $this->name;
}
public function render()
{
return <<<'HTML'
<label {{ $attributes->merge(['class' => 'flex flex-col group '.$heightClass])->only('class') }} for="{{$id}}" style="{{$heightVars}}">
@if ($label)
<x-form::label :required="$required">{{$label}}</x-form::label>
@endif
<div class="relative flex-none flex">
<input
id="{{$id}}"
type="{{$type}}"
@if ($type === 'password') autocomplete="off" @endif
placeholder=""
class="
w-full h-[var(--height)] border-gray-600 border-solid text-gray-300 bg-gray-700 leading-none rounded-lg
group-[.size-default]:border-2 group-[.size-sm]:border
group-[.size-default]:text-sm group-[.size-sm]:text-xs
group-[.size-default]:p-2 group-[.size-sm]:p-1
"
{{ $attributes->except('class') }}
/>
<x-ui::errors :for="$name" />
@if($hint)
<x-form::hint>{{$hint}}</x-form::hint>
@endif
</div>
</label>
HTML;
}
}

32
app/View/Page/Full.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace App\View\Page;
use Illuminate\View\Component;
class Full extends Component
{
public function __construct(public string $title = '', public ?string $heading = null)
{
session()->put('title', $title);
}
public function render()
{
return <<<'HTML'
<div class="min-w-[16rem] sm:min-w-[18rem] md:min-w-[24rem] bg-gray-800 rounded-xl overflow-hidden shadow-lg @if($heading === null) p-6 md:p-10 @endif">
@if ($heading)
<div class="h-24 p-6 md:px-10 bg-primary-800 flex justify-between items-center w-full">
<span class="text-primary-500 text-xl">{{$heading}}</span>
<img src="{{asset('img/dpsg.gif')}}" class="w-24" />
</div>
@endif
<div @if($heading !== null) class="p-6 md:p-10" @endif>
{{ $slot }}
</div>
</div>
HTML;
}
}

29
app/View/Page/Header.php Normal file
View File

@ -0,0 +1,29 @@
<?php
namespace App\View\Page;
use Illuminate\View\Component;
class Header extends Component
{
public function __construct(public string $title)
{
}
public function render()
{
return <<<'HTML'
<div class="h-16 px-6 flex items-center justify-between border-b border-solid border-gray-600 group-[.is-bright]:border-gray-500">
<div class="flex items-center space-x-4">
{{ $beforeTitle ?? ''}}
<span class="text-sm md:text-xl font-semibold leading-none text-white">{{ $title }}</span>
{{ $toolbar ?? '' }}
</div>
<div class="flex items-center space-x-4 ml-2">
{{ $right ?? '' }}
</div>
</div>
HTML;
}
}

59
app/View/Page/Layout.php Normal file
View File

@ -0,0 +1,59 @@
<?php
namespace App\View\Page;
use Illuminate\View\Component;
class Layout extends Component
{
public function __construct(public string $pageClass = '', public string $title = '', public string $menu = '')
{
session()->put('title', $title);
session()->put('menu', $menu);
}
public function userName(): string
{
return auth()->user()->firstname . ' ' . auth()->user()->lastname;
}
public function userAvatar(): string
{
return auth()->user()->getGravatarUrl();
}
public function render()
{
return <<<'HTML'
<div class="grow flex flex-col" @refresh-page.window="$wire.$refresh">
<div class="grow bg-gray-900 flex flex-col duration-300 navbar:ml-60">
<x-page::header :title="$title">
<x-slot:beforeTitle>
<a href="#" class="lg:hidden" wire:click.prevent="dispatch('toggle-sidebar')">
<x-ui::sprite src="menu" class="text-gray-100 w-5 h-5"></x-ui::sprite>
</a>
</x-slot:beforeTitle>
<x-slot:toolbar>
{{ $toolbar ?? ''}}
</x-slot:toolbar>
<x-slot:right>
{{ $right ?? '' }}
<div class="flex items-center space-x-2">
<div class="rounded-full overflow-hidden border-2 border-solid border-gray-300">
<img src="{{ $userAvatar() }}" class="w-8 h-8 object-cover" />
</div>
<div class="text-gray-300"">{{ $userName() }}</div>
</div>
</x-slot:right>
</x-page::header>
<div class="grow flex flex-col {{$pageClass}}">
{{ $slot }}
</div>
</div>
<livewire:page.sidebar :mobile="true" />
</div>
HTML;
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\View\Page;
use Illuminate\View\Component;
class MenuEntry extends Component
{
public function __construct(
public string $href,
public string $menu,
public string $icon,
) {
}
public function render()
{
return <<<'HTML'
<a class="flex text-white py-2 px-3 rounded-lg hover:bg-gray-600 {{ $menu === session('menu') ? 'bg-gray-700' : '' }}" href="{{$href}}">
<x-ui::sprite class="text-white w-6 h-6 mr-4" src="{{$icon}}"></x-ui::sprite>
<span class="font-semibold">
{{ $slot }}
</span>
</a>
HTML;
}
}

101
app/View/Page/Modal.php Normal file
View File

@ -0,0 +1,101 @@
<?php
namespace App\View\Page;
use Livewire\Attributes\On;
use Livewire\Component;
class Modal extends Component
{
public ?string $component = null;
public array $props = [];
public string $key = '';
public array $actions = [];
public ?string $size = null;
public string $title = '';
public function __construct()
{
}
#[On('openModal')]
public function onOpenModal(string $component, string $title, array $props = [], array $actions = ['storeable', 'closeable'], string $size = "xl"): void
{
$this->component = $component;
$this->props = $props;
$this->size = $size;
$this->title = $title;
$this->key = md5(json_encode(['component' => $component, 'props' => $props]));
$this->actions = $this->parseActions($actions);
}
public function parseActions(array $actions): array
{
return collect($actions)->map(function ($action) {
if ($action === 'closeable') {
return ['event' => 'closeModal', 'icon' => 'close', 'label' => 'Schließen'];
}
if ($action === 'storeable') {
return ['event' => 'onStoreFromModal', 'icon' => 'save', 'label' => 'Speichern'];
}
return $action;
})->toArray();
}
#[On('closeModal')]
public function onCloseModal(): void
{
$this->reset();
}
public function sizeClass(): string
{
if ($this->size === 'lg') {
return 'max-w-lg';
}
if ($this->size === 'xl') {
return 'max-w-xl';
}
return '';
}
public function render()
{
return <<<'HTML'
<div>
@if($component)
<div class="fixed z-40 top-0 left-0 w-full h-full flex items-center justify-center p-6 bg-black/60 backdrop-blur-sm" @click.self="$dispatch('closeModal')">
<div
class="relative rounded-lg p-8 bg-zinc-800 shadow-2xl shadow-black border border-zinc-700 border-solid w-full max-h-full flex flex-col overflow-auto {{$this->sizeClass()}}"
>
<div class="flex">
<h3 class="font-semibold text-primary-200 text-xl grow">{{$title}}</h3>
<div class="flex space-x-6">
@foreach ($this->actions as $action)
<a x-tooltip.raw="{{$action['label']}}" href="#" @click.prevent="$dispatch('{{$action['event']}}')">
<x-ui::sprite :src="$action['icon']" class="text-zinc-400 w-6 h-6"></x-ui::sprite>
</a>
@endforeach
</div>
</div>
<div class="text-primary-100 group is-popup grow flex flex-col mt-3">
<div>
@if ($component)
@livewire($component, $props, key($key))
@endif
</div>
</div>
</div>
</div>
@else
<div></div>
@endif
</div>
HTML;
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace App\View\Page;
use App\Setting\SettingFactory;
use Illuminate\View\Component;
class SettingLayout extends Component
{
public array $entries;
public function __construct(public string $active)
{
$this->entries = app(SettingFactory::class)->all()
->map(fn ($setting) => [
'url' => $setting->url(),
'is_active' => get_class($setting) === $active,
'title' => $setting->title(),
])->toArray();
}
public function render()
{
return <<<'HTML'
<x-page::layout :title="$active::title()" menu="setting">
<x-slot:right>
{{ $right ?? '' }}
</x-slot:right>
<x-slot:toolbar>
{{ $toolbar ?? '' }}
</x-slot:toolbar>
<div class="flex grow relative">
<x-ui::menulist :entries="$entries"></x-ui::menulist>
<div class="grow">
{{ $slot }}
</div>
</div>
</x-page::layout>
HTML;
}
}

51
app/View/Page/Sidebar.php Normal file
View File

@ -0,0 +1,51 @@
<?php
namespace App\View\Page;
use Livewire\Component;
class Sidebar extends Component
{
public $mobile = false;
public function render()
{
return <<<'HTML'
<div
class="fixed z-40 bg-gray-800 p-6 w-60 top-0 h-screen border-r border-gray-600 border-solid flex flex-col justify-between duration-300
@if (!$mobile) left-[-16rem] navbar:left-0 @endif"
@if($mobile)
x-data="{ visible: false }"
x-on:toggle-sidebar.window="visible = true"
:class="{'left-[-16rem]' : !visible, 'left-0': visible}"
@endif
>
<div class="grid gap-2">
<x-page::menu-entry href="/" menu="dashboard" icon="loss">Dashboard</x-page::menu-entry>
<x-page::menu-entry href="/member" menu="member" icon="user">Mitglieder</x-page::menu-entry>
<x-page::menu-entry v-show="hasModule('bill')" href="/subscription" menu="subscription" icon="money">Beiträge</x-page::menu-entry>
<x-page::menu-entry v-show="hasModule('bill')" href="/invoice" menu="invoice" icon="moneypaper">Rechnungen</x-page::menu-entry>
<x-page::menu-entry href="/contribution" menu="contribution" icon="contribution">Zuschüsse</x-page::menu-entry>
<x-page::menu-entry href="/activity" menu="activity" icon="activity">Tätigkeiten</x-page::menu-entry>
<x-page::menu-entry href="/group" menu="group" icon="group">Gruppierungen</x-page::menu-entry>
<x-page::menu-entry v-if="hasModule('event')" href="/form" menu="form" icon="event">Veranstaltungen</x-page::menu-entry>
<x-page::menu-entry href="/maildispatcher" menu="maildispatcher" icon="at">Mail-Verteiler</x-page::menu-entry>
</div>
<div class="grid gap-2">
<a href="#" class="flex w-full px-3 py-2 rounded-xl text-gray-300 bg-gray-700" @click.prevent="dispatch('show-search')">
<x-ui::sprite class="text-white w-6 h-6 mr-4" src="search"></x-ui::sprite>
<div class="">Suchen</div>
</a>
<x-page::menu-entry href="/setting" menu="setting" icon="setting">Einstellungen</x-page::menu-entry>
<x-page::menu-entry href="/logout" menu="" icon="logout">Abmelden</x-page::menu-entry>
</div>
@if($mobile)
<a href="#" class="absolute right-0 top-0 mr-2 mt-2" @click.prevent="visible = false">
<x-ui::sprite src="close" class="w-5 h-5 text-gray-300"></x-ui::sprite>
</a>
@endif
</div>
HTML;
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\View\Traits;
use App\View\Enums\Variant;
trait HasColors
{
public function bgColor(string $variant): string
{
$variant = Variant::fromString($variant);
return implode(' ', [
$variant->background(),
$variant->hoverBackground(),
]);
}
public function fgColor(string $variant): string
{
$variant = Variant::fromString($variant);
return implode(' ', [
$variant->foreground(),
$variant->hoverForeground(),
]);
}
public function allColors(string $variant): string
{
return "{$this->bgColor($variant)} {$this->fgColor($variant)}";
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\View\Traits;
trait HasFormDimensions
{
public function heightVars(): string
{
return data_get([
'default' => '--height: 35px; --padding: 3px;',
'sm' => '--height: 23px; --padding: 2px;',
], $this->size);
}
public function heightClass(): string
{
return data_get([
'default' => 'size-default',
'sm' => 'size-sm',
], $this->size);
}
}

27
app/View/Ui/Action.php Normal file
View File

@ -0,0 +1,27 @@
<?php
namespace App\View\Ui;
use App\View\Traits\HasColors;
use Illuminate\View\Component;
class Action extends Component
{
use HasColors;
public function __construct(
public string $icon,
public string $variant = 'primary'
) {
}
public function render()
{
return <<<'HTML'
<a x-tooltip.raw="{{$slot}}" href="#" {{ $attributes->merge(['class' => 'inline-flex w-6 h-5 flex items-center justify-center rounded '.$allColors($variant)]) }}>
<x-ui::sprite class="w-3 h-3 flex-none" :src="$icon"></x-ui::sprite>
</a>
HTML;
}
}

33
app/View/Ui/Badge.php Normal file
View File

@ -0,0 +1,33 @@
<?php
namespace App\View\Ui;
use App\View\Traits\HasColors;
use Illuminate\View\Component;
class Badge extends Component
{
use HasColors;
public function __construct(
public string $icon,
public string $variant = 'primary'
) {
}
public function render()
{
return <<<'HTML'
<button type="button" href="#" {{ $attributes->merge(['class' => 'h-6 px-3 space-x-2 items-center rounded-full hidden lg:flex '.$allColors($variant)]) }}>
<x-ui::sprite class="w-3 h-3 flex-none" :src="$icon"></x-ui::sprite>
<span class="text-sm">
{{$slot}}
</span>
</button>
<button type="button" x-tooltip.raw="{{$slot}}" href="#" {{ $attributes }} class="h-6 px-3 space-x-2 flex items-center rounded-full {{ $allColors($variant) }} lg:hidden">
<x-ui::sprite class="w-3 h-3 flex-none" :src="$icon"></x-ui::sprite>
</button>
HTML;
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\View\Ui;
use Illuminate\View\Component;
class BooleanDisplay extends Component
{
public function __construct(
public bool $value,
public string $hint,
public string $right,
public string $wrong,
public bool $dark = false,
) {
}
public function spriteClass(): string
{
return $this->value ? 'text-green-800 group-[.dark]:text-green-600' : 'text-red-800 group-[.dark]:text-red-600';
}
public function render()
{
return <<<'HTML'
<div x-tooltip.raw="{{$hint}}" {{ $attributes->merge(['class' => 'flex space-x-2 items-center group '.($dark ? 'dark' : '')]) }}">
<div class="border-2 rounded-full w-5 h-5 flex items-center justify-center
@if ($value) border-green-700 group-[.dark]:border-green-500
@else border-red-700 group-[.dark]:border-red-500
@endif
"
>
<x-ui::sprite :src="$value ? 'check ' :'close'" class="w-3 h-3 flex-none {{$spriteClass}}"></x-ui::sprite>
</div>
<div class="text-gray-400 text-xs">{{ $value ? $right : $wrong }}</div>
</div>
HTML;
}
}

38
app/View/Ui/Box.php Normal file
View File

@ -0,0 +1,38 @@
<?php
namespace App\View\Ui;
use Illuminate\View\Component;
class Box extends Component
{
public function __construct(
public string $containerClass = '',
public bool $second = false,
public string $title = '',
public string $inTitle = '',
) {
}
public function render()
{
return <<<'HTML'
<section {!! $attributes
->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')
!!}>
<div class="flex items-center">
@if($title)
<div class="col-span-full font-semibold text-gray-300 group-[.is-popup]:text-zinc-300">{{$title}}</div>
@endif
{{$inTitle}}
</div>
<main class="{{ $title ? 'mt-2' : '' }} {{ $containerClass }}">
{{ $slot }}
</main>
</section>
HTML;
}
}

22
app/View/Ui/Button.php Normal file
View File

@ -0,0 +1,22 @@
<?php
namespace App\View\Ui;
use Illuminate\View\Component;
class Button extends Component
{
public function __construct(public string $type = 'button')
{
}
public function render()
{
return <<<'HTML'
<button type="{{$type}}" {{ $attributes->merge(['class' => 'px-3 py-2 uppercase no-underline text-sm items-center justify-center bg-primary-700 rounded text-primary-300']) }}>
{{$slot}}
</button>
HTML;
}
}

33
app/View/Ui/Errors.php Normal file
View File

@ -0,0 +1,33 @@
<?php
namespace App\View\Ui;
use Illuminate\View\Component;
class Errors extends Component
{
public function __construct(
public string $for,
) {
}
public function id(): string
{
return 'errors-' . str_replace('.', '--', $this->for);
}
public function render()
{
return <<<'HTML'
@error($for)
<div x-data="{error: ''}" x-init="window.setTimeout(() => document.querySelector('#{{$id()}}') ? document.querySelector('#{{$id()}}').remove() : null, 2000)" class="absolute bottom-[calc(100%+0.5rem)] right-0" id="{{$id}}">
<div class="tippy-box" tabindex="-1" data-theme="danger" data-placement="top">
<div class="tippy-content">{{$message}}</div>
<div class="tippy-arrow absolute right-0 mr-2"></div>
</div>
</div>
@enderror
HTML;
}
}

34
app/View/Ui/Menulist.php Normal file
View File

@ -0,0 +1,34 @@
<?php
namespace App\View\Ui;
use Illuminate\View\Component;
class Menulist extends Component
{
public function __construct(public array $entries)
{
}
public function activeClass($entry): string
{
return $entry['is_active'] ? 'bg-gray-600' : '';
}
public function render()
{
return <<<'HTML'
<div {{$attributes->merge(['class' => 'p-6 bg-gray-700 border-r border-gray-600 flex-none w-maxc flex flex-col justify-between']) }}">
<div class="grid gap-1">
@foreach($entries as $entry)
<a href="{{$entry['url']}}" class="rounded py-1 px-3 text-gray-400 duration-200 hover:bg-gray-600 {{$activeClass($entry)}}" @if($entry['is_active']) data-active @endif>
{{$entry['title']}}
</a>
@endforeach
</div>
<slot name="bottom"></slot>
</div>
HTML;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\View\Ui;
use Illuminate\View\Component;
class SettingIntro extends Component
{
public function __construct(public ?string $title = null)
{
}
public function render()
{
return <<<'HTML'
<div {{$attributes}}>
@if ($title) <h2 class="text-lg font-semibold text-gray-300">{{$title}}</h2> @endif
<div class="text-gray-100 text-sm">
{{ $slot }}
</div>
</div>
HTML;
}
}

28
app/View/Ui/Sprite.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace App\View\Ui;
use Illuminate\Support\Facades\Cache;
use Illuminate\View\Component;
class Sprite extends Component
{
public string $spritemapFile;
public function __construct(
public string $src = '',
) {
$this->spritemapFile = Cache::rememberForever('spritemap_file', function () {
$manifest = json_decode(file_get_contents(public_path('build/manifest.json')), true);
return asset('build/' . $manifest['spritemap.svg']['file']);
});
}
public function render()
{
return <<<'HTML'
<svg {{ $attributes->merge(['class' => 'fill-current']) }}><use xlink:href="{{$spritemapFile}}#sprite-{{$src}}" /></svg>
HTML;
}
}

31
app/View/Ui/Table.php Normal file
View File

@ -0,0 +1,31 @@
<?php
namespace App\View\Ui;
use Illuminate\View\Component;
class Table extends Component
{
public function __construct(public string $mode = 'dark')
{
}
public function render()
{
return <<<'HTML'
<div class="@container/table">
<table cellpadding="0" cellspacing="0" border="0" class="w-full @if ($mode === 'dark') table-dark @else table-light @endif
[&_th]:text-left [&_th]:px-2 [&_th]:@4xl/table:px-6 [&_th]:text-gray-200 [&_th]:font-semibold [&_th]:py-3 [&_th]:border-gray-600 [&_th]:border-b
[&_tbody_tr]:text-gray-200 [&_tbody_tr]:duration-300 [&_tbody_tr]:rounded [&_tbody_tr:hover]:bg-gray-800
[&_tr_td]:py-1 [&_tr_td]:px-2 [&_tr_td]:@4xl/table:px-6
[&.table-light_th]:border-gray-500 [&.table-light_tbody_tr:hover]:bg-gray-700
">
{{ $slot }}
</table>
</div>
HTML;
}
}

View File

@ -8,3 +8,5 @@ sudo mysql adrema < db.tmp
rm db.tmp
echo 'app(\App\Form\FormSettings::class)->fill(["registerUrl" => "http://stammsilva.test/anmeldung/{slug}/register", "clearCacheUrl" => "http://stammsilva.test/adrema/clear-cache"])->save();' | php artisan tinker
exit 0

View File

@ -61,6 +61,7 @@
"laravel/ui": "^4.0",
"league/csv": "^9.9",
"league/flysystem-webdav": "dev-master as 3.28.0",
"livewire/livewire": "^3.5",
"lorisleiva/laravel-actions": "^2.4",
"meilisearch/meilisearch-php": "^1.6",
"monicahq/laravel-sabre": "^1.6",
@ -85,7 +86,8 @@
"mockery/mockery": "^1.4.4",
"orchestra/testbench": "^9.0",
"pestphp/pest": "^3.0",
"phpstan/phpstan-mockery": "^2.0"
"phpstan/phpstan-mockery": "^2.0",
"qossmic/deptrac": "^2.0"
},
"config": {
"optimize-autoloader": true,
@ -104,6 +106,7 @@
"autoload": {
"psr-4": {
"App\\": "app/",
"Modules\\": "modules/",
"Plugins\\": "plugins/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
@ -111,6 +114,7 @@
},
"autoload-dev": {
"psr-4": {
"Modules\\Dashboard\\Tests\\": "modules/dashboard/tests/",
"Tests\\": "tests/",
"Zoomyboy\\LaravelNami\\Tests\\": "packages/laravel-nami/tests/"
}
@ -118,6 +122,10 @@
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"archtest": [
"./vendor/bin/deptrac analyze",
"./vendor/bin/pest tests/Arch.php"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"

289
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b901e66375d81c04e5067a7352780f13",
"content-hash": "65ea356f4d9ce066e39c9914f823db01",
"packages": [
{
"name": "amphp/amp",
@ -3611,16 +3611,16 @@
},
{
"name": "laravel/horizon",
"version": "v5.31.0",
"version": "v5.31.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/horizon.git",
"reference": "a21e7d64784b24eaf3bf873f82affbf67707a72a"
"reference": "bc98b63313b2e0a3d0c8e84e1b691388ef1bf653"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/horizon/zipball/a21e7d64784b24eaf3bf873f82affbf67707a72a",
"reference": "a21e7d64784b24eaf3bf873f82affbf67707a72a",
"url": "https://api.github.com/repos/laravel/horizon/zipball/bc98b63313b2e0a3d0c8e84e1b691388ef1bf653",
"reference": "bc98b63313b2e0a3d0c8e84e1b691388ef1bf653",
"shasum": ""
},
"require": {
@ -3685,9 +3685,9 @@
],
"support": {
"issues": "https://github.com/laravel/horizon/issues",
"source": "https://github.com/laravel/horizon/tree/v5.31.0"
"source": "https://github.com/laravel/horizon/tree/v5.31.1"
},
"time": "2025-03-04T14:56:42+00:00"
"time": "2025-03-16T23:48:25+00:00"
},
{
"name": "laravel/pail",
@ -3905,16 +3905,16 @@
},
{
"name": "laravel/scout",
"version": "v10.14.0",
"version": "v10.14.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/scout.git",
"reference": "840d18e3d68b17c59663fc687497c49c0ff0d295"
"reference": "6ae3ec83ceacb554f395df9fe15318a14b79bb39"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/scout/zipball/840d18e3d68b17c59663fc687497c49c0ff0d295",
"reference": "840d18e3d68b17c59663fc687497c49c0ff0d295",
"url": "https://api.github.com/repos/laravel/scout/zipball/6ae3ec83ceacb554f395df9fe15318a14b79bb39",
"reference": "6ae3ec83ceacb554f395df9fe15318a14b79bb39",
"shasum": ""
},
"require": {
@ -3982,7 +3982,7 @@
"issues": "https://github.com/laravel/scout/issues",
"source": "https://github.com/laravel/scout"
},
"time": "2025-03-18T14:00:31+00:00"
"time": "2025-04-01T14:58:03+00:00"
},
{
"name": "laravel/serializable-closure",
@ -4047,16 +4047,16 @@
},
{
"name": "laravel/telescope",
"version": "v5.6.0",
"version": "v5.7.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/telescope.git",
"reference": "352dc633c2fe500c169e3401a10a7efae4fc3327"
"reference": "440908cb856cfbef9323244f7978ad4bf8cd2daa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/telescope/zipball/352dc633c2fe500c169e3401a10a7efae4fc3327",
"reference": "352dc633c2fe500c169e3401a10a7efae4fc3327",
"url": "https://api.github.com/repos/laravel/telescope/zipball/440908cb856cfbef9323244f7978ad4bf8cd2daa",
"reference": "440908cb856cfbef9323244f7978ad4bf8cd2daa",
"shasum": ""
},
"require": {
@ -4110,9 +4110,9 @@
],
"support": {
"issues": "https://github.com/laravel/telescope/issues",
"source": "https://github.com/laravel/telescope/tree/v5.6.0"
"source": "https://github.com/laravel/telescope/tree/v5.7.0"
},
"time": "2025-03-17T20:24:10+00:00"
"time": "2025-03-27T17:25:52+00:00"
},
{
"name": "laravel/tinker",
@ -5205,6 +5205,82 @@
],
"time": "2024-12-08T08:18:47+00:00"
},
{
"name": "livewire/livewire",
"version": "v3.6.2",
"source": {
"type": "git",
"url": "https://github.com/livewire/livewire.git",
"reference": "8f8914731f5eb43b6bb145d87c8d5a9edfc89313"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/livewire/livewire/zipball/8f8914731f5eb43b6bb145d87c8d5a9edfc89313",
"reference": "8f8914731f5eb43b6bb145d87c8d5a9edfc89313",
"shasum": ""
},
"require": {
"illuminate/database": "^10.0|^11.0|^12.0",
"illuminate/routing": "^10.0|^11.0|^12.0",
"illuminate/support": "^10.0|^11.0|^12.0",
"illuminate/validation": "^10.0|^11.0|^12.0",
"laravel/prompts": "^0.1.24|^0.2|^0.3",
"league/mime-type-detection": "^1.9",
"php": "^8.1",
"symfony/console": "^6.0|^7.0",
"symfony/http-kernel": "^6.2|^7.0"
},
"require-dev": {
"calebporzio/sushi": "^2.1",
"laravel/framework": "^10.15.0|^11.0|^12.0",
"mockery/mockery": "^1.3.1",
"orchestra/testbench": "^8.21.0|^9.0|^10.0",
"orchestra/testbench-dusk": "^8.24|^9.1|^10.0",
"phpunit/phpunit": "^10.4|^11.5",
"psy/psysh": "^0.11.22|^0.12"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"Livewire": "Livewire\\Livewire"
},
"providers": [
"Livewire\\LivewireServiceProvider"
]
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Livewire\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Caleb Porzio",
"email": "calebporzio@gmail.com"
}
],
"description": "A front-end framework for Laravel.",
"support": {
"issues": "https://github.com/livewire/livewire/issues",
"source": "https://github.com/livewire/livewire/tree/v3.6.2"
},
"funding": [
{
"url": "https://github.com/livewire",
"type": "github"
}
],
"time": "2025-03-12T20:24:15+00:00"
},
{
"name": "lorisleiva/laravel-actions",
"version": "v2.9.0",
@ -5843,16 +5919,16 @@
},
{
"name": "nesbot/carbon",
"version": "3.8.6",
"version": "3.9.0",
"source": {
"type": "git",
"url": "https://github.com/CarbonPHP/carbon.git",
"reference": "ff2f20cf83bd4d503720632ce8a426dc747bf7fd"
"reference": "6d16a8a015166fe54e22c042e0805c5363aef50d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/ff2f20cf83bd4d503720632ce8a426dc747bf7fd",
"reference": "ff2f20cf83bd4d503720632ce8a426dc747bf7fd",
"url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/6d16a8a015166fe54e22c042e0805c5363aef50d",
"reference": "6d16a8a015166fe54e22c042e0805c5363aef50d",
"shasum": ""
},
"require": {
@ -5945,7 +6021,7 @@
"type": "tidelift"
}
],
"time": "2025-02-20T17:33:38+00:00"
"time": "2025-03-27T12:57:33+00:00"
},
{
"name": "nette/schema",
@ -6155,38 +6231,39 @@
},
{
"name": "nunomaduro/collision",
"version": "v8.7.0",
"version": "v8.8.0",
"source": {
"type": "git",
"url": "https://github.com/nunomaduro/collision.git",
"reference": "586cb8181a257a2152b6a855ca8d9598878a1a26"
"reference": "4cf9f3b47afff38b139fb79ce54fc71799022ce8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nunomaduro/collision/zipball/586cb8181a257a2152b6a855ca8d9598878a1a26",
"reference": "586cb8181a257a2152b6a855ca8d9598878a1a26",
"url": "https://api.github.com/repos/nunomaduro/collision/zipball/4cf9f3b47afff38b139fb79ce54fc71799022ce8",
"reference": "4cf9f3b47afff38b139fb79ce54fc71799022ce8",
"shasum": ""
},
"require": {
"filp/whoops": "^2.17.0",
"filp/whoops": "^2.18.0",
"nunomaduro/termwind": "^2.3.0",
"php": "^8.2.0",
"symfony/console": "^7.2.1"
"symfony/console": "^7.2.5"
},
"conflict": {
"laravel/framework": "<11.39.1 || >=13.0.0",
"phpunit/phpunit": "<11.5.3 || >=12.0.0"
"laravel/framework": "<11.44.2 || >=13.0.0",
"phpunit/phpunit": "<11.5.15 || >=13.0.0"
},
"require-dev": {
"larastan/larastan": "^2.10.0",
"laravel/framework": "^11.44.2",
"brianium/paratest": "^7.8.3",
"larastan/larastan": "^3.2",
"laravel/framework": "^11.44.2 || ^12.6",
"laravel/pint": "^1.21.2",
"laravel/sail": "^1.41.0",
"laravel/sanctum": "^4.0.8",
"laravel/tinker": "^2.10.1",
"orchestra/testbench-core": "^9.12.0",
"pestphp/pest": "^3.7.4",
"sebastian/environment": "^6.1.0 || ^7.2.0"
"orchestra/testbench-core": "^9.12.0 || ^10.1",
"pestphp/pest": "^3.8.0",
"sebastian/environment": "^7.2.0 || ^8.0"
},
"type": "library",
"extra": {
@ -6249,7 +6326,7 @@
"type": "patreon"
}
],
"time": "2025-03-14T22:37:40+00:00"
"time": "2025-04-03T14:33:09+00:00"
},
{
"name": "nunomaduro/termwind",
@ -6626,21 +6703,21 @@
},
{
"name": "pestphp/pest",
"version": "v3.8.0",
"version": "v3.8.1",
"source": {
"type": "git",
"url": "https://github.com/pestphp/pest.git",
"reference": "42e1b9f17fc2b2036701f4b968158264bde542d4"
"reference": "6080f51a0b0830715c48ba0e7458b06907febfe5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pestphp/pest/zipball/42e1b9f17fc2b2036701f4b968158264bde542d4",
"reference": "42e1b9f17fc2b2036701f4b968158264bde542d4",
"url": "https://api.github.com/repos/pestphp/pest/zipball/6080f51a0b0830715c48ba0e7458b06907febfe5",
"reference": "6080f51a0b0830715c48ba0e7458b06907febfe5",
"shasum": ""
},
"require": {
"brianium/paratest": "^7.8.3",
"nunomaduro/collision": "^8.7.0",
"nunomaduro/collision": "^8.8.0",
"nunomaduro/termwind": "^2.3.0",
"pestphp/pest-plugin": "^3.0.0",
"pestphp/pest-plugin-arch": "^3.1.0",
@ -6722,7 +6799,7 @@
],
"support": {
"issues": "https://github.com/pestphp/pest/issues",
"source": "https://github.com/pestphp/pest/tree/v3.8.0"
"source": "https://github.com/pestphp/pest/tree/v3.8.1"
},
"funding": [
{
@ -6734,7 +6811,7 @@
"type": "github"
}
],
"time": "2025-03-30T17:49:10+00:00"
"time": "2025-04-03T16:35:58+00:00"
},
{
"name": "pestphp/pest-plugin",
@ -11137,16 +11214,16 @@
},
{
"name": "spatie/laravel-medialibrary",
"version": "11.12.8",
"version": "11.12.9",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-medialibrary.git",
"reference": "98d6d26e56d9ea01f757a4307ef03cb4ae563e0d"
"reference": "2435e90009c36906c33668d26c96c86acdb39af7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-medialibrary/zipball/98d6d26e56d9ea01f757a4307ef03cb4ae563e0d",
"reference": "98d6d26e56d9ea01f757a4307ef03cb4ae563e0d",
"url": "https://api.github.com/repos/spatie/laravel-medialibrary/zipball/2435e90009c36906c33668d26c96c86acdb39af7",
"reference": "2435e90009c36906c33668d26c96c86acdb39af7",
"shasum": ""
},
"require": {
@ -11230,7 +11307,7 @@
],
"support": {
"issues": "https://github.com/spatie/laravel-medialibrary/issues",
"source": "https://github.com/spatie/laravel-medialibrary/tree/11.12.8"
"source": "https://github.com/spatie/laravel-medialibrary/tree/11.12.9"
},
"funding": [
{
@ -11242,7 +11319,7 @@
"type": "github"
}
],
"time": "2025-03-21T09:15:22+00:00"
"time": "2025-03-31T07:55:00+00:00"
},
{
"name": "spatie/laravel-package-tools",
@ -14702,7 +14779,7 @@
"dist": {
"type": "path",
"url": "./packages/tex",
"reference": "48251272de62e3fea044a7ad31e1a411c15eb4c6"
"reference": "ed283d97ca7680b3c27b2d75da9937f4f379e321"
},
"type": "library",
"extra": {
@ -14846,16 +14923,16 @@
},
{
"name": "iamcal/sql-parser",
"version": "v0.5",
"version": "v0.6",
"source": {
"type": "git",
"url": "https://github.com/iamcal/SQLParser.git",
"reference": "644fd994de3b54e5d833aecf406150aa3b66ca88"
"reference": "947083e2dca211a6f12fb1beb67a01e387de9b62"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/iamcal/SQLParser/zipball/644fd994de3b54e5d833aecf406150aa3b66ca88",
"reference": "644fd994de3b54e5d833aecf406150aa3b66ca88",
"url": "https://api.github.com/repos/iamcal/SQLParser/zipball/947083e2dca211a6f12fb1beb67a01e387de9b62",
"reference": "947083e2dca211a6f12fb1beb67a01e387de9b62",
"shasum": ""
},
"require-dev": {
@ -14881,46 +14958,46 @@
"description": "MySQL schema parser",
"support": {
"issues": "https://github.com/iamcal/SQLParser/issues",
"source": "https://github.com/iamcal/SQLParser/tree/v0.5"
"source": "https://github.com/iamcal/SQLParser/tree/v0.6"
},
"time": "2024-03-22T22:46:32+00:00"
"time": "2025-03-17T16:59:46+00:00"
},
{
"name": "larastan/larastan",
"version": "v3.2.0",
"version": "v3.3.1",
"source": {
"type": "git",
"url": "https://github.com/larastan/larastan.git",
"reference": "d84d5a3b6536a586899ad6855a3e098473703690"
"reference": "58bee8be51daf12d78ed0a909be3b205607d2f27"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/larastan/larastan/zipball/d84d5a3b6536a586899ad6855a3e098473703690",
"reference": "d84d5a3b6536a586899ad6855a3e098473703690",
"url": "https://api.github.com/repos/larastan/larastan/zipball/58bee8be51daf12d78ed0a909be3b205607d2f27",
"reference": "58bee8be51daf12d78ed0a909be3b205607d2f27",
"shasum": ""
},
"require": {
"ext-json": "*",
"iamcal/sql-parser": "^0.5.0",
"illuminate/console": "^11.41.3 || ^12.0",
"illuminate/container": "^11.41.3 || ^12.0",
"illuminate/contracts": "^11.41.3 || ^12.0",
"illuminate/database": "^11.41.3 || ^12.0",
"illuminate/http": "^11.41.3 || ^12.0",
"illuminate/pipeline": "^11.41.3 || ^12.0",
"illuminate/support": "^11.41.3 || ^12.0",
"iamcal/sql-parser": "^0.6.0",
"illuminate/console": "^11.44.2 || ^12.4.1",
"illuminate/container": "^11.44.2 || ^12.4.1",
"illuminate/contracts": "^11.44.2 || ^12.4.1",
"illuminate/database": "^11.44.2 || ^12.4.1",
"illuminate/http": "^11.44.2 || ^12.4.1",
"illuminate/pipeline": "^11.44.2 || ^12.4.1",
"illuminate/support": "^11.44.2 || ^12.4.1",
"php": "^8.2",
"phpstan/phpstan": "^2.1.3"
"phpstan/phpstan": "^2.1.11"
},
"require-dev": {
"doctrine/coding-standard": "^12.0",
"laravel/framework": "^11.41.3 || ^12.0",
"mockery/mockery": "^1.6",
"nikic/php-parser": "^5.3",
"orchestra/canvas": "^v9.1.3 || ^10.0",
"orchestra/testbench-core": "^9.5.2 || ^10.0",
"phpstan/phpstan-deprecation-rules": "^2.0.0",
"phpunit/phpunit": "^10.5.35 || ^11.3.6"
"laravel/framework": "^11.44.2 || ^12.7.2",
"mockery/mockery": "^1.6.12",
"nikic/php-parser": "^5.4",
"orchestra/canvas": "^v9.2.2 || ^10.0.1",
"orchestra/testbench-core": "^9.12.0 || ^10.1",
"phpstan/phpstan-deprecation-rules": "^2.0.1",
"phpunit/phpunit": "^10.5.35 || ^11.5.15"
},
"suggest": {
"orchestra/testbench": "Using Larastan for analysing a package needs Testbench"
@ -14968,15 +15045,19 @@
],
"support": {
"issues": "https://github.com/larastan/larastan/issues",
"source": "https://github.com/larastan/larastan/tree/v3.2.0"
"source": "https://github.com/larastan/larastan/tree/v3.3.1"
},
"funding": [
{
"url": "https://github.com/canvural",
"type": "github"
},
{
"url": "https://github.com/nunomaduro",
"type": "github"
}
],
"time": "2025-03-14T21:54:26+00:00"
"time": "2025-04-03T20:08:04+00:00"
},
{
"name": "laravel/envoy",
@ -15643,6 +15724,54 @@
},
"time": "2024-10-14T03:18:12+00:00"
},
{
"name": "qossmic/deptrac",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/qossmic/deptrac.git",
"reference": "a6dbfaf4f20f0ae98b766954f35b8c164c3063ed"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/qossmic/deptrac/zipball/a6dbfaf4f20f0ae98b766954f35b8c164c3063ed",
"reference": "a6dbfaf4f20f0ae98b766954f35b8c164c3063ed",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^8.1"
},
"suggest": {
"ext-dom": "For using the JUnit output formatter"
},
"bin": [
"bin/deptrac",
"deptrac.phar"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Qossmic\\Deptrac\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Deptrac is a static code analysis tool that helps to enforce rules for dependencies between software layers.",
"keywords": [
"static analysis"
],
"support": {
"source": "https://github.com/qossmic/deptrac/tree/2.0.4"
},
"abandoned": "deptrac/deptrac",
"time": "2024-11-21T22:38:34+00:00"
},
{
"name": "symfony/polyfill-php84",
"version": "v1.31.0",
@ -15832,5 +15961,5 @@
"php": "^8.3"
},
"platform-dev": [],
"plugin-api-version": "2.6.0"
"plugin-api-version": "2.2.0"
}

View File

@ -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,18 @@ 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,
App\Providers\BaseServiceProvider::class,
Modules\Dashboard\DashboardServiceProvider::class,
Modules\Module\ModuleServiceProvider::class,
Modules\Invoice\InvoiceServiceProvider::class,
Modules\Mailgateway\MailgatewayServiceProvider::class,
Modules\Nami\NamiServiceProvider::class,
Modules\Auth\AuthServiceProvider::class,
Modules\Form\FormServiceProvider::class,
Modules\Fileshare\FileshareServiceProvider::class,
Modules\Contribution\ContributionServiceProvider::class,
],
/*
@ -228,6 +237,7 @@ return [
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Vite' => Illuminate\Support\Facades\Vite::class,
'Inertia' => \Inertia\Inertia::class,
],
];

160
config/livewire.php Normal file
View File

@ -0,0 +1,160 @@
<?php
return [
/*
|---------------------------------------------------------------------------
| Class Namespace
|---------------------------------------------------------------------------
|
| This value sets the root class namespace for Livewire component classes in
| your application. This value will change where component auto-discovery
| finds components. It's also referenced by the file creation commands.
|
*/
'class_namespace' => 'App\\View',
/*
|---------------------------------------------------------------------------
| View Path
|---------------------------------------------------------------------------
|
| This value is used to specify where Livewire component Blade templates are
| stored when running file creation commands like `artisan make:livewire`.
| It is also used if you choose to omit a component's render() method.
|
*/
'view_path' => resource_path('views/livewire'),
/*
|---------------------------------------------------------------------------
| Layout
|---------------------------------------------------------------------------
| The view that will be used as the layout when rendering a single component
| as an entire page via `Route::get('/post/create', CreatePost::class);`.
| In this case, the view returned by CreatePost will render into $slot.
|
*/
'layout' => 'components.layouts.app',
/*
|---------------------------------------------------------------------------
| Lazy Loading Placeholder
|---------------------------------------------------------------------------
| Livewire allows you to lazy load components that would otherwise slow down
| the initial page load. Every component can have a custom placeholder or
| you can define the default placeholder view for all components below.
|
*/
'lazy_placeholder' => null,
/*
|---------------------------------------------------------------------------
| Temporary File Uploads
|---------------------------------------------------------------------------
|
| Livewire handles file uploads by storing uploads in a temporary directory
| before the file is stored permanently. All file uploads are directed to
| a global endpoint for temporary storage. You may configure this below:
|
*/
'temporary_file_upload' => [
'disk' => null, // Example: 'local', 's3' | Default: 'default'
'rules' => null, // Example: ['file', 'mimes:png,jpg'] | Default: ['required', 'file', 'max:12288'] (12MB)
'directory' => null, // Example: 'tmp' | Default: 'livewire-tmp'
'middleware' => null, // Example: 'throttle:5,1' | Default: 'throttle:60,1'
'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs...
'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
'mov', 'avi', 'wmv', 'mp3', 'm4a',
'jpg', 'jpeg', 'mpga', 'webp', 'wma',
],
'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated...
'cleanup' => true, // Should cleanup temporary uploads older than 24 hrs...
],
/*
|---------------------------------------------------------------------------
| Render On Redirect
|---------------------------------------------------------------------------
|
| This value determines if Livewire will run a component's `render()` method
| after a redirect has been triggered using something like `redirect(...)`
| Setting this to true will render the view once more before redirecting
|
*/
'render_on_redirect' => false,
/*
|---------------------------------------------------------------------------
| Eloquent Model Binding
|---------------------------------------------------------------------------
|
| Previous versions of Livewire supported binding directly to eloquent model
| properties using wire:model by default. However, this behavior has been
| deemed too "magical" and has therefore been put under a feature flag.
|
*/
'legacy_model_binding' => false,
/*
|---------------------------------------------------------------------------
| Auto-inject Frontend Assets
|---------------------------------------------------------------------------
|
| By default, Livewire automatically injects its JavaScript and CSS into the
| <head> and <body> of pages containing Livewire components. By disabling
| this behavior, you need to use @livewireStyles and @livewireScripts.
|
*/
'inject_assets' => true,
/*
|---------------------------------------------------------------------------
| Navigate (SPA mode)
|---------------------------------------------------------------------------
|
| By adding `wire:navigate` to links in your Livewire application, Livewire
| will prevent the default link handling and instead request those pages
| via AJAX, creating an SPA-like effect. Configure this behavior here.
|
*/
'navigate' => [
'show_progress_bar' => true,
'progress_bar_color' => '#2299dd',
],
/*
|---------------------------------------------------------------------------
| HTML Morph Markers
|---------------------------------------------------------------------------
|
| Livewire intelligently "morphs" existing HTML into the newly rendered HTML
| after each update. To make this process more reliable, Livewire injects
| "markers" into the rendered Blade surrounding @if, @class & @foreach.
|
*/
'inject_morph_markers' => true,
/*
|---------------------------------------------------------------------------
| Pagination Theme
|---------------------------------------------------------------------------
|
| When enabling Livewire's pagination feature by using the `WithPagination`
| trait, Livewire will use Tailwind templates to render pagination views
| on the page. If you want Bootstrap CSS, you can specify: "bootstrap"
|
*/
'pagination_theme' => 'tailwind',
];

View File

@ -6,17 +6,10 @@ use App\Member\BankAccount;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @template TModel of \App\Member\BankAccount
*
* @extends \Illuminate\Database\Eloquent\Factories\Factory<TModel>
* @extends Factory<BankAccount>
*/
class BankAccountFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var class-string<TModel>
*/
protected $model = BankAccount::class;
/**
@ -27,7 +20,17 @@ class BankAccountFactory extends Factory
public function definition(): array
{
return [
//
'bank_name' => $this->faker->name(),
'bic' => $this->faker->swiftBicNumber(),
'iban' => $this->faker->iban('DE'),
'blz' => $this->faker->name(),
'person' => $this->faker->name(),
'account_number' => $this->faker->name(),
];
}
public function inNami(int $namiId): self
{
return $this->state(['nami_id' => $namiId]);
}
}

View File

@ -93,6 +93,13 @@ class MemberFactory extends Factory
return $this->state(['nami_id' => $namiId]);
}
public function withBankAccount(BankAccountFactory $factory): self
{
return $this->afterCreating(function ($member) use ($factory) {
$member->bankAccount->update($factory->make()->toArray());
});
}
public function sameFamilyAs(Member $member): self
{
return $this->state([

View File

@ -27,4 +27,9 @@ class UserFactory extends Factory
'lastname' => $this->faker->lastName,
];
}
public function loginData(string $email, string $password): self
{
return $this->state(['email' => $email, 'password' => Hash::make($password)]);
}
}

View File

@ -19,7 +19,8 @@ class UserSeeder extends Seeder
'email' => config('init.email'),
'email_verified_at' => now(),
'password' => Hash::make(config('init.password')),
'name' => 'Adrema Benutzer',
'firstname' => 'Adrema',
'lastname' => 'Benutzer',
]);
}
}

30
deptrac.yaml Normal file
View File

@ -0,0 +1,30 @@
deptrac:
paths:
- ./app
- ./modules
exclude_files:
- '#.*Test.php$#'
layers:
- name: AppFiles
collectors:
- type: bool
must:
- type: classLike
value: .*
- type: directory
value: app/.*
- name: ModuleFiles
collectors:
- type: bool
must:
- type: classLike
value: .*
- type: directory
value: modules/.*
ruleset:
ModuleFiles:
- AppFiles
AppFiles:
- ModuleFiles

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Auth;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Modules\Auth\Components\LoginForm;
use Modules\Auth\Components\PasswordReset;
use Modules\Auth\Components\PasswordResetConfirm;
class AuthServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
app(Router::class)->middleware(['web', 'guest'])->group(function ($router) {
$router->get('/login', LoginForm::class)->name('login');
$router->get('/password/reset', PasswordReset::class)->name('password.request');
$router->get('/password/reset/{token}', PasswordResetConfirm::class)->name('password.reset');
});
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace Modules\Auth\Components;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Livewire\Attributes\Layout;
use Livewire\Component;
class LoginForm extends Component
{
use AuthenticatesUsers;
use ThrottlesLogins;
public string $email = '';
public string $password = '';
public function validateLogin(Request $request)
{
$this->validate([
'email' => 'required|max:255|string|email',
'password' => 'required|string',
]);
}
protected function credentials(Request $request)
{
return ['email' => $this->email, 'password' => $this->password];
}
protected function sendLoginResponse(Request $request)
{
return redirect()->intended('/');
}
public function submit()
{
return $this->login(request());
}
#[Layout('components.layouts.full')]
public function render(): string
{
return <<<'HTML'
<x-page::full heading="Login" title="Login">
<form wire:submit="submit">
<div class="grid gap-5">
<x-form::text name="email" wire:model="email" label="E-Mail-Adresse"></x-form::text>
<x-form::text name="password" wire:model="password" type="password" label="Passwort"></x-form::text>
<x-ui::button type="submit">Login</x-ui::button>
<div class="flex justify-center">
<a href="{{route('password.request')}}" class="text-gray-500 text-sm hover:text-gray-300">Passwort vergessen?</a>
</div>
</div>
</form>
</x-page::full>
HTML;
}
}

View File

@ -0,0 +1,70 @@
<?php
namespace Modules\Auth\Components;
use App\User;
use Illuminate\Auth\Events\Lockout;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Event;
use Livewire\Livewire;
uses(TestCase::class);
uses(DatabaseTransactions::class);
it('redirects to login', function () {
test()->get('/')->assertRedirect('/login');
});
it('displays component', function () {
test()->get('/login')->assertSeeLivewire(LoginForm::class)->assertDontSee('Dashboard');
});
it('displays form', function () {
Livewire::test(LoginForm::class)
->assertSee('Login')
->assertSee('Passwort vergessen')
->assertSee(route('password.request'));
});
it('loggs in', function () {
User::factory()->loginData('admin@example.com', 'secret')->create();
Livewire::test(LoginForm::class)
->set('email', 'admin@example.com')
->set('password', 'secret')
->call('submit')
->assertRedirect('/');
$this->assertEquals('admin@example.com', auth()->user()->email);
});
it('displays failed login response', function () {
Livewire::test(LoginForm::class)
->set('email', 'admin@example.com')
->set('password', 'secret')
->call('submit')
->assertHasErrors(['email' => 'Login fehlgeschlagen.']);
});
it('increments login attempts', function () {
Event::fake([Lockout::class]);
Livewire::test(LoginForm::class)
->set('email', 'admin@example.com')
->set('password', 'secret')
->call('submit')
->call('submit')
->call('submit')
->call('submit')
->call('submit')
->call('submit');
Event::assertDispatchedTimes(Lockout::class);
});
it('requires email and password', function () {
User::factory()->loginData('admin@example.com', 'secret')->create();
Livewire::test(LoginForm::class)
->set('email', '')
->set('password', '')
->call('submit')
->assertHasErrors(['email', 'password']);
});

View File

@ -0,0 +1,66 @@
<?php
namespace Modules\Auth\Components;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Livewire\Attributes\Layout;
use Livewire\Component;
class PasswordReset extends Component
{
use SendsPasswordResetEmails;
public string $email = '';
protected function validateEmail(Request $request)
{
$this->validate([
'email' => 'required|max:255|string|email',
]);
}
protected function sendResetLinkFailedResponse(Request $request, $response)
{
throw ValidationException::withMessages([
'email' => [trans($response)],
]);
}
protected function credentials(Request $request)
{
return ['email' => $this->email];
}
public function submit()
{
$this->sendResetLinkEmail(request());
$this->dispatch('success', 'Du hast weitere Instruktionen per E-Mail erhalten.');
}
#[Layout('components.layouts.full')]
public function render(): string
{
return <<<'HTML'
<x-page::full heading="Passwort vergessen" title="Passwort vergessen">
<form wire:submit.prevent="submit">
<div class="grid gap-5">
<span class="text-gray-500 text-sm"
>Hier kannst du dein Passwort zurücksetzen.<br />
Gebe dafür die E-Mail-Adresse deines Benutzerkontos ein.<br />
Anschließend bekommst du eine E-Mail<br />
mit weiteren Anweisungen.</span
>
<x-form::text name="email" wire:model="email" label="E-Mail-Adresse"></x-form::text>
<x-ui::button type="submit">Passwort zurücksetzen</x-ui::button>
<div class="flex justify-center">
<a href="/login" class="text-gray-500 text-sm hover:text-gray-300">Zurück zum Login</a>
</div>
</div>
</form>
</x-page::full>
HTML;
}
}

View File

@ -0,0 +1,87 @@
<?php
namespace Modules\Auth\Components;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Validation\Rules\Password as PasswordRule;
use Illuminate\Validation\ValidationException;
use Livewire\Attributes\Layout;
use Livewire\Component;
class PasswordResetConfirm extends Component
{
public string $password = '';
public string $password_confirmation = '';
public string $token = '';
public string $email = '';
public function mount(string $token): void
{
$this->email = request()->query('email');
$this->token = $token;
}
public function submit()
{
$this->validate([
'token' => 'required',
'email' => 'required|email',
'password' => ['required', 'confirmed', PasswordRule::defaults()],
]);
$response = Password::broker()->reset([
'email' => $this->email,
'password' => $this->password,
'password_confirmation' => $this->password_confirmation,
'token' => $this->token
], fn ($user, $password) => $this->resetPassword($user, $password));
if ($response == Password::PASSWORD_RESET) {
$this->dispatch('success', 'Passwort erfolgreich geändert.');
return redirect()->route('home');
}
ValidationException::withMessages([
'password' => 'Passwort konnte nicht geändert werden.',
]);
}
protected function resetPassword($user, $password)
{
$user->password = Hash::make($password);
$user->setRememberToken(Str::random(60));
$user->save();
event(new PasswordReset($user));
auth()->login($user);
}
#[Layout('components.layouts.full')]
public function render(): string
{
return <<<'HTML'
<x-page::full heading="Passwort vergessen" title="Passwort vergessen">
<form wire:submit.prevent="submit">
<div class="grid gap-5">
<span class="text-gray-500 text-sm">
Hier kannst du dein Passwort zurücksetzen.<br />
Gebe dafür ein neues Passwort ein.<br />
Merke oder notiere dir dieses Passwort, bevor du das Formular absendest.<br />
Danach wirst du zum Dashboard weitergeleitet.
</span>
<x-form::text type="password" name="password" wire:model="password" label="Neues Passwort"></x-form::text>
<x-form::text type="password" name="password_confirmation" wire:model="password_confirmation" label="Neues Passwort widerholen"></x-form::text>
<x-ui::button type="submit">Passwort zurücksetzen</x-ui::button>
<div class="flex justify-center">
<a href="/login" class="text-gray-500 text-sm hover:text-gray-300">Zurück zum Login</a>
</div>
</div>
</form>
</x-page::full>
HTML;
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace Modules\Auth\Components;
use Modules\Auth\Mails\ResetPassword;
use App\User;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Notification;
use Livewire\Livewire;
uses(TestCase::class);
uses(DatabaseTransactions::class);
it('displays component', function () {
test()->get(route('password.request'))->assertSeeLivewire(PasswordReset::class)->assertDontSee('Dashboard');
});
it('shows intro', function () {
Livewire::test(PasswordReset::class)->assertSee('Hier kannst du dein Passwort zurücksetzen.');
});
it('it needs email address', function (string $email, string $error) {
Livewire::test(PasswordReset::class)
->set('email', $email)
->call('submit')
->assertHasErrors(['email' => $error]);
})
->with([
['', 'E-Mail Adresse ist erforderlich.'],
['aaa', 'E-Mail Adresse muss eine gültige E-Mail-Adresse sein.'],
]);
it('displays error when user doesnt exsst', function () {
Livewire::test(PasswordReset::class)
->set('email', 'nowhere@example.com')
->call('submit')
->assertHasErrors(['email' => 'Es konnte leider kein Nutzer mit dieser E-Mail-Adresse gefunden werden.']);
});
it('requests link', function () {
Notification::fake();
$user = User::factory()->loginData('admin@example.com', 'secret')->create();
Livewire::test(PasswordReset::class)
->set('email', 'admin@example.com')
->call('submit')
->assertDispatched('success', 'Du hast weitere Instruktionen per E-Mail erhalten.');
Notification::assertSentTo($user, ResetPassword::class);
});

View File

@ -1,6 +1,6 @@
<?php
namespace App\Auth;
namespace Modules\Auth\Mails;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Lang;
@ -17,7 +17,7 @@ class ResetPassword extends BaseResetPassword
protected function buildMailMessage($url)
{
return (new MailMessage)
->subject(Lang::get('Passwort zurücksetzen | Adrema'))
->subject(Lang::get('Passwort zurücksetzen | ' . config('app.name')))
->line(Lang::get('Du erhälst diese E-Mail, weil du eine Anfrage zum zurücksetzen deines Account-Passworts gestellt hast.'))
->action(Lang::get('Passwort zurücksetzen'), $url)
->line(Lang::get('Dieser Link wird in :count Minuten ablaufen.', ['count' => config('auth.passwords.' . config('auth.defaults.passwords') . '.expire')]))

View File

@ -0,0 +1,132 @@
<?php
namespace Modules\Contribution\Components;
use App\Contribution\ContributionFactory;
use App\Country;
use Illuminate\Support\Collection;
use App\Member\Member;
use Carbon\Carbon;
use Livewire\Attributes\Validate;
use Livewire\Component;
use Zoomyboy\Tex\Tex;
class FillList extends Component
{
#[Validate(rule: 'required|string|max:255', as: 'Veranstaltungs-Name')]
public string $eventName = '';
#[Validate(rule: 'required|date', as: 'Datum von')]
public Carbon $dateFrom;
#[Validate(rule: 'required|date', as: 'Datum bis')]
public Carbon $dateUntil;
#[Validate(rule: 'required|integer|gt:0', as: 'Land')]
public int $country;
#[Validate(rule: 'array|min:1', as: 'Mitglieder')]
public $members = [];
#[Validate(rule: 'required', as: 'Formular')]
public ?string $compiler = null;
#[Validate(rule: 'required', as: 'PLZ / Ort')]
public string $zipLocation;
public Collection $countries;
public string $search = '';
public Collection $compilers;
public Collection $memberResults;
public function rules(): array
{
return [
'eventName' => 'required|string|max:255',
];
}
public function mount(): void
{
$this->compilers = app(ContributionFactory::class)->compilerSelect();
$this->countries = Country::select('name', 'id')->get()->toBase();
$this->clearSearch();
$this->country = Country::firstWhere('name', 'Deutschland')->id;
}
public function submit()
{
$payload = $this->validate();
return Tex::compile($this->compiler::fromRequest($payload));
}
public function updatedSearch(): void
{
$this->memberResults = Member::search($this->search, fn ($engine, $query, $options) => $engine->search($query, [
...$options,
'filter' => ['birthday IS NOT NULL', 'address IS NOT EMPTY']
]))->get()->toBase();
}
public function onSubmitFirstMemberResult(): void
{
if (count($this->memberResults) === 0) {
$this->clearSearch();
return;
}
$this->onSubmitMemberResult($this->memberResults[0]->id);
}
public function onSubmitMemberResult(int $memberId): void
{
if (in_array($memberId, $this->members)) {
$this->members = array_values(array_filter($this->members, fn ($m) => $m !== $memberId));
} else {
$this->members[] = $memberId;
}
$this->js('document.querySelector("#search_input").focus()');
$this->clearSearch();
}
public function clearSearch(): void
{
$this->search = '';
$this->memberResults = collect([]);
}
public function render()
{
return <<<'HTML'
<x-page::layout title="Zuschüsse" menu="contribution">
<form wire:submit.prevent="submit" class="max-w-4xl w-full mx-auto gap-6 grid-cols-2 grid p-6">
<x-form::text name="eventName" wire:model="eventName" class="col-span-2" label="Veranstaltungs-Name" required></x-form::text>
<x-form::text name="dateFrom" wire:model="dateFrom" type="date" label="Datum von" required></x-form::text>
<x-form::text name="dateUntil" wire:model="dateUntil" type="date" label="Datum bis" required></x-form::text>
<x-form::text name="zipLocation" wire:model="zipLocation" label="PLZ / Ort" required></x-form::text>
<x-form::select name="country" wire:model="country" :options="$countries" label="Land" required></x-form::select>
<x-form::select name="compiler" wire:model="compiler" :options="$compilers" label="Formular" required></x-form::select>
<x-ui::box class="relative col-span-2" title="Mitglieder finden">
<x-ui::errors for="members" />
<x-form::text name="search_text" id="search_input" wire:model.live="search" class="col-span-2" label="Suchen …" size="sm" wire:keydown.enter.prevent="onSubmitFirstMemberResult"></x-form::text>
<div class="mt-2 grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2 col-span-2">
@foreach($memberResults as $member)
<x-form::lever
id="members-{{$member->id}}"
:wire:key="$member->id"
wire:model="members"
:label="$member->fullname"
name="members"
:value="$member->id"
size="sm"
wire:keydown.enter.prevent="onSubmitMemberResult({{$member->id}})"
></x-form::lever>
@endforeach
</div>
</x-ui::box>
<x-ui::button class="col-span-2" type="submit">Formular erstellen</x-ui::button>
</form>
</x-page::layout>
HTML;
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace Modules\Contribution\Components;
use App\Country;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Livewire\Livewire;
uses(TestCase::class);
uses(DatabaseTransactions::class);
beforeEach(function () {
test()->login()->loginNami();
});
it('displays page', function () {
test()->get(route('contribution.index'))
->assertSeeLivewire(FillList::class);
});
it('loads component', function () {
$country = Country::factory()->create();
Livewire::test(FillList::class)
->assertSee('Zuschüsse')
->assertSee($country->name)
->assertSee('RdP NRW');
});
it('validates payload', function (array $attributes, array $error) {
Livewire::test(FillList::class)
->setArray($attributes)
->call('submit')
->assertHasErrors($error);
})->with([
[['eventName' => ''], ['eventName' => 'Veranstaltungs-Name ist erforderlich.']],
[['dateFrom' => ''], ['dateFrom' => 'Datum von ist erforderlich.']],
[['dateUntil' => ''], ['dateUntil' => 'Datum bis ist erforderlich.']],
[['country' => ''], ['country' => 'Land ist erforderlich.']],
[['zipLocation' => ''], ['zipLocation' => 'PLZ / Ort ist erforderlich.']],
[['compiler' => null], ['compiler' => 'Formular ist erforderlich.']],
]);

View File

@ -0,0 +1,31 @@
<?php
namespace Modules\Contribution;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Modules\Contribution\Components\FillList;
class ContributionServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
app(Router::class)->middleware(['web', 'auth:web'])->group(function ($router) {
$router->get('/contribution', FillList::class)->name('contribution.index');
});
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Dashboard;
use Livewire\Component;
abstract class Block extends Component
{
abstract protected function title(): string;
abstract public function render(): string;
}

View File

@ -0,0 +1,32 @@
<?php
namespace Modules\Dashboard\Components;
use Livewire\Component;
use Modules\Dashboard\DashboardFactory;
class DashboardComponent extends Component
{
private array $blocks = [];
public function mount(DashboardFactory $factory): void
{
$this->blocks = $factory->load();
}
public function render(): string
{
return <<<'HTML'
<x-page::layout title="Dashboard" menu="dashboard">
<div class="gap-6 md:grid-cols-2 xl:grid-cols-4 grid p-6">
@foreach($this->blocks as $block)
<x-ui::box title="{{$block->title()}}" :second="true">
<livewire:dynamic-component is="{{ get_class($block) }}" lazy></livewire:dynamic-component>
</x-ui::box>
@endforeach
</div>
</x-page::layout>
HTML;
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace Modules\Dashboard;
use Livewire\Livewire;
class DashboardFactory
{
/**
* @var array<int, class-string<Block>>
*/
private array $blocks = [];
/**
* @return array<int, Block>
*/
public function load(): array
{
return collect($this->blocks)->map(fn ($block) => app($block))->toArray();
}
/**
* @param class-string<Block> $block
*/
public function register(string $block): self
{
$this->blocks[] = $block;
$componentName = str($block)->replace('\\', '.')->explode('.')->map(fn ($part) => str($part)->lcfirst()->kebab())->implode('.');
Livewire::component($componentName, $block);
return $this;
}
public function purge(): self
{
$this->blocks = [];
return $this;
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace Modules\Dashboard;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Modules\Dashboard\Components\DashboardComponent;
use Modules\Invoice\MemberPaymentBlock;
use Modules\Member\AgeGroupCountBlock;
use Modules\Member\TestersBlock;
use Modules\Prevention\EfzPendingBlock;
use Modules\Prevention\PsPendingBlock;
class DashboardServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
app()->singleton(DashboardFactory::class, fn () => new DashboardFactory());
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
app(Router::class)->middleware(['web', 'auth:web'])->group(function ($router) {
$router->get('/', DashboardComponent::class)->name('home');
});
app(DashboardFactory::class)->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);
}
}

Some files were not shown because too many files have changed in this diff Show More