Compare commits

..

46 Commits

Author SHA1 Message Date
philipp lang a456cc1889 Fix: Sort participants by created_at
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-12-16 14:18:02 +01:00
philipp lang 784b49c3dd Add invoice full text search
continuous-integration/drone/push Build is failing Details
2024-12-15 16:05:38 +01:00
philipp lang c3a0381a0a Fix invoice settings when fields are empty
continuous-integration/drone/push Build is passing Details
2024-12-15 12:06:44 +01:00
philipp lang 101ac7402a Add Phpunit to gitignore
continuous-integration/drone/push Build is passing Details
2024-12-15 11:56:13 +01:00
philipp lang 2c38488962 Remove cross
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-12-13 19:13:30 +01:00
philipp lang 8a26276e28 Rename document
continuous-integration/drone/push Build is passing Details
2024-12-13 19:03:40 +01:00
philipp lang 4651a4cb96 Lint
continuous-integration/drone/push Build is passing Details
2024-12-13 14:37:13 +01:00
philipp lang 688e10e230 Lint
continuous-integration/drone/push Build is failing Details
2024-12-13 11:56:02 +01:00
philipp lang 267da38c6b Lint
continuous-integration/drone/push Build is passing Details
2024-12-13 02:46:44 +01:00
philipp lang 499c61afff Lint 2024-12-13 02:44:08 +01:00
philipp lang 02531938b3 Lint 2024-12-13 02:42:08 +01:00
philipp lang 1c53e81f1a Lint 2024-12-13 02:40:33 +01:00
philipp lang 98712093b2 Lint 2024-12-13 02:36:17 +01:00
philipp lang a32ef33113 Move engine 2024-12-13 02:33:12 +01:00
philipp lang 088ea4f0a2 Lint 2024-12-13 02:28:41 +01:00
philipp lang 4ac89da124 Lint 2024-12-13 02:16:09 +01:00
philipp lang 286ceea0d4 Lint 2024-12-13 01:59:24 +01:00
philipp lang 52ac5937a4 Add validation 2024-12-13 01:59:09 +01:00
philipp lang 4690e86bbf Add gallier document 2024-12-13 01:54:02 +01:00
philipp lang 1a4a7c3652 Add base gallier document 2024-12-13 00:58:44 +01:00
philipp lang b05c5025c0 Add button to mark invoice as paid
continuous-integration/drone/push Build is passing Details
2024-12-12 21:26:51 +01:00
philipp lang acf7b94094 Update CHANGELOG
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/tag Build is passing Details
2024-12-12 16:37:20 +01:00
philipp lang 57b1efb065 Add registration_from and registration_until to frontend api
continuous-integration/drone/push Build is passing Details
2024-12-12 15:42:35 +01:00
philipp lang 3e563f8390 Add registration_from and registration_to fields 2024-12-12 15:21:03 +01:00
philipp lang 0a5590d533 Remove CreatesApplication Trait 2024-12-12 13:56:13 +01:00
philipp lang 10deaf15a1 Update form edit view 2024-12-12 13:45:42 +01:00
philipp lang ae447a7a60 Add fileshare and web setting on bin/run 2024-12-12 13:45:26 +01:00
philipp lang baea21807a Update CHANGELOG
continuous-integration/drone/push Build is passing Details
2024-12-12 13:21:05 +01:00
philipp lang 58426c5537 Fix tests
continuous-integration/drone/push Build was killed Details
2024-12-12 12:18:49 +01:00
philipp lang 84cd13c085 Fix migration
continuous-integration/drone/push Build is failing Details
2024-12-12 03:12:26 +01:00
philipp lang b8d2b37057 Add sorting frontend for participants list
continuous-integration/drone/push Build is failing Details
2024-12-12 03:07:10 +01:00
philipp lang 44eb3719b9 Update tests
continuous-integration/drone/push Build is passing Details
2024-12-12 02:35:27 +01:00
philipp lang c65a208e34 Add frontend for sorting
continuous-integration/drone/push Build was killed Details
2024-12-12 02:33:10 +01:00
philipp lang 95a8d4d689 Fix page navigation 2024-12-12 02:27:58 +01:00
philipp lang e1e8669beb Fix tests
continuous-integration/drone/push Build is failing Details
2024-12-12 01:32:01 +01:00
philipp lang a3ecfa756d Add sorting to participant list
continuous-integration/drone/push Build was killed Details
2024-12-12 01:26:22 +01:00
philipp lang 70e085a49e Fix: Dont update form when not using meilisearch
continuous-integration/drone/push Build is failing Details
2024-12-12 00:50:05 +01:00
philipp lang 1178b011e0 Lint
continuous-integration/drone/push Build was killed Details
2024-12-12 00:36:56 +01:00
philipp lang 6a91e857d2 Add filtering for participant index
continuous-integration/drone/push Build was killed Details
2024-12-12 00:30:59 +01:00
philipp lang 82baf67a73 Lint 2024-12-11 22:37:49 +01:00
philipp lang 36466420f6 Lint 2024-12-11 22:36:25 +01:00
philipp lang 54c37fccd1 Add searchable participants via full text 2024-12-11 22:32:23 +01:00
philipp lang d03f036a2b Move ParticipantIndexActionTest to EndToEnd 2024-12-10 01:28:35 +01:00
philipp lang 75d11f9860 Update formsettings when copying db 2024-12-10 00:58:05 +01:00
philipp lang da4d553ea6 Update CHANGELOG
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-12-09 14:08:52 +01:00
philipp lang 5bad88c5f4 Add config for job batching
continuous-integration/drone/push Build is passing Details
2024-12-09 14:08:02 +01:00
221 changed files with 3497 additions and 7458 deletions

2
.gitignore vendored
View File

@ -40,4 +40,4 @@ Homestead.json
/public/sprite.svg
/.php-cs-fixer.cache
/groups.sql
/.phpunit.cache/
/.phpunit.cache

View File

@ -1,5 +1,18 @@
# Letzte Änderungen
### 1.12.2
- Zuschussliste Gallier
### 1.12.1
- In Teilnehmer-Liste von Veranstaltungen kann nun sortiert und gefiltert werden.
- Formulare: Feld Registrierung von / bis
### 1.11.5
- Fix: Synchronisation von NaMi-Mitgliedern
### 1.11.4
- Fix: Nicht an Präventions-Unterlagen für vergangene Veranstaltungen erinnern

View File

@ -1,6 +1,6 @@
<?php
namespace Modules\Auth\Mails;
namespace App\Auth;
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 | ' . config('app.name')))
->subject(Lang::get('Passwort zurücksetzen | Adrema'))
->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

@ -8,6 +8,7 @@ use App\Contribution\Documents\RdpNrwDocument;
use App\Contribution\Documents\CityRemscheidDocument;
use App\Contribution\Documents\CitySolingenDocument;
use App\Contribution\Documents\CityFrankfurtMainDocument;
use App\Contribution\Documents\WuppertalDocument;
use Illuminate\Support\Collection;
use Illuminate\Validation\Rule;
@ -22,6 +23,7 @@ class ContributionFactory
CityRemscheidDocument::class,
CityFrankfurtMainDocument::class,
BdkjHesse::class,
WuppertalDocument::class,
];
/**
@ -30,7 +32,7 @@ class ContributionFactory
public function compilerSelect(): Collection
{
return collect($this->documents)->map(fn ($document) => [
'title' => $document::getName(),
'title' => $document::buttonName(),
'class' => $document,
]);
}

View File

@ -72,13 +72,23 @@ class MemberData extends Data
return $this->zip . ' ' . $this->location;
}
public function age(): string
public function age(): int
{
return (string) $this->birthday->diffInYears(now()) ?: '';
return intval($this->birthday->diffInYears(now()));
}
public function birthYear(): string
{
return (string) $this->birthday->year;
}
public function birthdayHuman(): string
{
return $this->birthday->format('d.m.Y');
}
public function genderLetter(): string
{
return $this->gender->short;
}
}

View File

@ -3,15 +3,16 @@
namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData;
use App\Contribution\Traits\HasPdfBackground;
use App\Country;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class BdkjHesse extends ContributionDocument
{
use HasPdfBackground;
/**
* @param Collection<int, Collection<int, MemberData>> $members
*/
@ -25,6 +26,7 @@ class BdkjHesse extends ContributionDocument
public ?string $filename = '',
public string $type = 'F',
) {
$this->setEventName($eventName);
}
public function dateFrom(): string
@ -114,36 +116,9 @@ class BdkjHesse extends ContributionDocument
return $member->birthYear();
}
public function basename(): string
{
return 'zuschuesse-bdkj-hessen' . Str::slug($this->eventName);
}
public function view(): string
{
return 'tex.contribution.bdkj-hesse';
}
public function template(): Template
{
return Template::make('tex.templates.contribution');
}
public function setFilename(string $filename): static
{
$this->filename = $filename;
return $this;
}
public function getEngine(): Engine
{
return Engine::PDFLATEX;
}
public static function getName(): string
{
return 'Für BDKJ Hessen erstellen';
return 'BDKJ Hessen';
}
/**
@ -156,7 +131,6 @@ class BdkjHesse extends ContributionDocument
'dateUntil' => 'required|string|date_format:Y-m-d',
'country' => 'required|integer|exists:countries,id',
'zipLocation' => 'required|string',
'eventName' => 'required|string',
];
}
}

View File

@ -3,16 +3,17 @@
namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData;
use App\Contribution\Traits\FormatsDates;
use App\Contribution\Traits\HasPdfBackground;
use App\Country;
use Carbon\Carbon;
use App\Invoice\InvoiceSettings;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Modules\Invoice\InvoiceSettings;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class CityFrankfurtMainDocument extends ContributionDocument
{
use HasPdfBackground;
use FormatsDates;
public string $fromName;
/**
@ -28,6 +29,7 @@ class CityFrankfurtMainDocument extends ContributionDocument
public ?string $filename = '',
public string $type = 'F',
) {
$this->setEventName($eventName);
$this->fromName = app(InvoiceSettings::class)->from_long;
}
@ -61,17 +63,6 @@ class CityFrankfurtMainDocument extends ContributionDocument
);
}
public function dateFromHuman(): string
{
return Carbon::parse($this->dateFrom)->format('d.m.Y');
}
public function dateUntilHuman(): string
{
return Carbon::parse($this->dateUntil)->format('d.m.Y');
}
public function countryName(): string
{
return $this->country->name;
@ -82,56 +73,9 @@ class CityFrankfurtMainDocument extends ContributionDocument
return count($this->members);
}
public function memberShort(MemberData $member): string
{
return $member->isLeader ? 'L' : '';
}
public function memberName(MemberData $member): string
{
return $member->separatedName();
}
public function memberAddress(MemberData $member): string
{
return $member->fullAddress();
}
public function memberAge(MemberData $member): string
{
return $member->age();
}
public function basename(): string
{
return 'zuschuesse-frankfurt-' . Str::slug($this->eventName);
}
public function view(): string
{
return 'tex.contribution.city-frankfurt-main';
}
public function template(): Template
{
return Template::make('tex.templates.contribution');
}
public function setFilename(string $filename): static
{
$this->filename = $filename;
return $this;
}
public function getEngine(): Engine
{
return Engine::PDFLATEX;
}
public static function getName(): string
{
return 'Für Frankfurt erstellen';
return 'Frankfurt';
}
/**
@ -144,7 +88,6 @@ class CityFrankfurtMainDocument extends ContributionDocument
'dateUntil' => 'required|string|date_format:Y-m-d',
'country' => 'required|integer|exists:countries,id',
'zipLocation' => 'required|string',
'eventName' => 'required|string',
];
}
}

View File

@ -3,15 +3,17 @@
namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData;
use App\Contribution\Traits\FormatsDates;
use App\Contribution\Traits\HasPdfBackground;
use App\Country;
use App\Member\Member;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class CityRemscheidDocument extends ContributionDocument
{
use HasPdfBackground;
use FormatsDates;
/**
* @param Collection<int, Collection<int, Member>> $leaders
* @param Collection<int, Collection<int, Member>> $children
@ -25,17 +27,9 @@ class CityRemscheidDocument extends ContributionDocument
public Collection $children,
public ?string $filename = '',
public string $type = 'F',
public string $eventName = '',
) {
}
public function niceDateFrom(): string
{
return Carbon::parse($this->dateFrom)->format('d.m.Y');
}
public function niceDateUntil(): string
{
return Carbon::parse($this->dateUntil)->format('d.m.Y');
$this->setEventName($eventName);
}
/**
@ -52,6 +46,7 @@ class CityRemscheidDocument extends ContributionDocument
country: Country::where('id', $request['country'])->firstOrFail(),
leaders: $leaders->values()->toBase()->chunk(6),
children: $children->values()->toBase()->chunk(20),
eventName: $request['eventName'],
);
}
@ -70,39 +65,13 @@ class CityRemscheidDocument extends ContributionDocument
country: Country::where('id', $request['country'])->firstOrFail(),
leaders: $leaders->values()->toBase()->chunk(6),
children: $children->values()->toBase()->chunk(20),
eventName: $request['eventName'],
);
}
public function basename(): string
{
return 'zuschuesse-remscheid';
}
public function view(): string
{
return 'tex.contribution.city-remscheid';
}
public function template(): Template
{
return Template::make('tex.templates.contribution');
}
public function setFilename(string $filename): static
{
$this->filename = $filename;
return $this;
}
public function getEngine(): Engine
{
return Engine::PDFLATEX;
}
public static function getName(): string
{
return 'Für Remscheid erstellen';
return 'Remscheid';
}
/**

View File

@ -3,12 +3,10 @@
namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData;
use App\Invoice\InvoiceSettings;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Modules\Invoice\InvoiceSettings;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class CitySolingenDocument extends ContributionDocument
{
@ -25,6 +23,7 @@ class CitySolingenDocument extends ContributionDocument
public string $eventName,
public string $type = 'F',
) {
$this->setEventName($eventName);
$this->fromName = app(InvoiceSettings::class)->from_long;
}
@ -74,11 +73,6 @@ class CitySolingenDocument extends ContributionDocument
return Carbon::parse($this->dateUntil)->format('d.m.Y');
}
public function template(): Template
{
return Template::make('tex.templates.contribution');
}
public function checkboxes(): string
{
$output = '';
@ -94,16 +88,6 @@ class CitySolingenDocument extends ContributionDocument
return $firstRow . "\n" . $secondRow;
}
public function basename(): string
{
return 'zuschuesse-solingen-' . Str::slug($this->eventName);
}
public function view(): string
{
return 'tex.contribution.city-solingen';
}
public function getEngine(): Engine
{
return Engine::PDFLATEX;
@ -111,7 +95,7 @@ class CitySolingenDocument extends ContributionDocument
public static function getName(): string
{
return 'Für Stadt Solingen erstellen';
return 'Stadt Solingen';
}
/**
@ -123,7 +107,6 @@ class CitySolingenDocument extends ContributionDocument
'dateFrom' => 'required|string|date_format:Y-m-d',
'dateUntil' => 'required|string|date_format:Y-m-d',
'zipLocation' => 'required|string',
'eventName' => 'required|string',
];
}
}

View File

@ -3,9 +3,12 @@
namespace App\Contribution\Documents;
use Zoomyboy\Tex\Document;
use Zoomyboy\Tex\Template;
abstract class ContributionDocument extends Document
{
private string $eventName;
abstract public static function getName(): string;
/**
@ -29,8 +32,34 @@ abstract class ContributionDocument extends Document
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';;
}
public function setEventName(string $eventName): void
{
$this->eventName = $eventName;
}
public function basename(): string
{
return str('Zuschüsse ')->append($this->getName())->append(' ')->append($this->eventName)->slug();
}
public function template(): Template
{
return Template::make('tex.templates.contribution');
}
public function view(): string
{
return 'tex.contribution.' . str(class_basename(static::class))->replace('Document', '')->kebab()->toString();
}
}

View File

@ -3,14 +3,16 @@
namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData;
use App\Contribution\Traits\FormatsDates;
use App\Contribution\Traits\HasPdfBackground;
use App\Country;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class RdpNrwDocument extends ContributionDocument
{
use HasPdfBackground;
use FormatsDates;
/**
* @param Collection<int, Collection<int, MemberData>> $members
*/
@ -22,14 +24,9 @@ class RdpNrwDocument extends ContributionDocument
public Collection $members,
public ?string $filename = '',
public string $type = 'F',
public string $eventName = '',
) {
}
public function dateRange(): string
{
return Carbon::parse($this->dateFrom)->format('d.m.Y')
. ' - '
. Carbon::parse($this->dateUntil)->format('d.m.Y');
$this->setEventName($eventName);
}
/**
@ -43,6 +40,7 @@ class RdpNrwDocument extends ContributionDocument
zipLocation: $request['zipLocation'],
country: Country::where('id', $request['country'])->firstOrFail(),
members: MemberData::fromModels($request['members'])->chunk(17),
eventName: $request['eventName'],
);
}
@ -57,6 +55,7 @@ class RdpNrwDocument extends ContributionDocument
zipLocation: $request['zipLocation'],
country: Country::where('id', $request['country'])->firstOrFail(),
members: MemberData::fromApi($request['member_data'])->chunk(17),
eventName: $request['eventName'],
);
}
@ -65,65 +64,9 @@ class RdpNrwDocument extends ContributionDocument
return $this->country->name;
}
public function memberShort(MemberData $member): string
{
return $member->isLeader ? 'L' : '';
}
public function memberName(MemberData $member): string
{
return $member->separatedName();
}
public function memberAddress(MemberData $member): string
{
return $member->fullAddress();
}
public function memberGender(MemberData $member): string
{
if (!$member->gender) {
return '';
}
return strtolower(substr($member->gender->name, 0, 1));
}
public function memberAge(MemberData $member): string
{
return $member->age();
}
public function basename(): string
{
return 'zuschuesse-rdp-nrw';
}
public function view(): string
{
return 'tex.contribution.rdp-nrw';
}
public function template(): Template
{
return Template::make('tex.templates.contribution');
}
public function setFilename(string $filename): static
{
$this->filename = $filename;
return $this;
}
public function getEngine(): Engine
{
return Engine::PDFLATEX;
}
public static function getName(): string
{
return 'Für RdP NRW erstellen';
return 'RdP NRW';
}
/**
@ -136,7 +79,6 @@ class RdpNrwDocument extends ContributionDocument
'dateUntil' => 'required|string|date_format:Y-m-d',
'country' => 'required|integer|exists:countries,id',
'zipLocation' => 'required|string',
'eventName' => 'required|string',
];
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData;
use App\Contribution\Traits\FormatsDates;
use App\Contribution\Traits\HasPdfBackground;
use App\Country;
use Illuminate\Support\Collection;
class WuppertalDocument extends ContributionDocument
{
use HasPdfBackground;
use FormatsDates;
/**
* @param Collection<int, Collection<int, MemberData>> $members
*/
public function __construct(
public string $dateFrom,
public string $dateUntil,
public string $zipLocation,
public ?Country $country,
public Collection $members,
public ?string $filename = '',
public string $type = 'F',
public string $eventName = '',
) {
$this->setEventName($eventName);
}
/**
* {@inheritdoc}
*/
public static function fromRequest(array $request): self
{
return new self(
dateFrom: $request['dateFrom'],
dateUntil: $request['dateUntil'],
zipLocation: $request['zipLocation'],
country: Country::where('id', $request['country'])->firstOrFail(),
members: MemberData::fromModels($request['members'])->chunk(14),
eventName: $request['eventName'],
);
}
/**
* {@inheritdoc}
*/
public static function fromApiRequest(array $request): self
{
return new self(
dateFrom: $request['dateFrom'],
dateUntil: $request['dateUntil'],
zipLocation: $request['zipLocation'],
country: Country::where('id', $request['country'])->firstOrFail(),
members: MemberData::fromApi($request['member_data'])->chunk(14),
eventName: $request['eventName'],
);
}
public static function getName(): string
{
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

@ -0,0 +1,24 @@
<?php
namespace App\Contribution\Traits;
use Carbon\Carbon;
trait FormatsDates
{
public function niceDateFrom(): string
{
return Carbon::parse($this->dateFrom)->format('d.m.Y');
}
public function niceDateUntil(): string
{
return Carbon::parse($this->dateUntil)->format('d.m.Y');
}
public function dateRange(): string
{
return implode(' - ', [$this->niceDateFrom(), $this->niceDateUntil()]);
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Contribution\Traits;
use Zoomyboy\Tex\Engine;
trait HasPdfBackground
{
public function getEngine(): Engine
{
return Engine::PDFLATEX;
}
}

View File

@ -0,0 +1,44 @@
<?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

@ -22,8 +22,8 @@ class FormUpdateMetaAction
return [
'sorting' => 'array',
'sorting.0' => 'required|string',
'sorting.1' => 'required|string|in:asc,desc',
'sorting.by' => 'required|string',
'sorting.direction' => 'required|boolean',
'active_columns' => 'array',
'active_columns.*' => ['string', Rule::in([...$form->getFields()->pluck('key')->toArray(), 'created_at', 'prevention'])]
];

View File

@ -6,9 +6,8 @@ use App\Form\Models\Form;
use App\Form\Models\Participant;
use App\Form\Resources\ParticipantResource;
use App\Form\Scopes\ParticipantFilterScope;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
use Illuminate\Pagination\LengthAwarePaginator;
use Laravel\Scout\Builder;
use Lorisleiva\Actions\Concerns\AsAction;
class ParticipantIndexAction
@ -16,29 +15,22 @@ class ParticipantIndexAction
use AsAction;
/**
* @return HasMany<Participant>
* @return Builder<Participant>
*/
protected function getQuery(Form $form, ParticipantFilterScope $filter): HasMany
protected function getQuery(Form $form, ParticipantFilterScope $filter): Builder
{
return $form->participants()->withFilter($filter)->withCount('children')->with('form');
}
/**
* @return LengthAwarePaginator<Participant>
*/
public function handle(Form $form, ParticipantFilterScope $filter): LengthAwarePaginator
{
return $this->getQuery($form, $filter)->paginate(15);
return $filter->setForm($form)->getQuery()
->query(fn ($q) => $q->withCount('children')->with('form'));
}
public function asController(Form $form, ?int $parent = null): AnonymousResourceCollection
{
$filter = ParticipantFilterScope::fromRequest(request()->input('filter'));
$filter = ParticipantFilterScope::fromRequest(request()->input('filter', ''))->parent($parent);
$data = match ($parent) {
null => $this->handle($form, $filter),
-1 => $this->getQuery($form, $filter)->where('parent_id', null)->paginate(15),
default => $this->getQuery($form, $filter)->where('parent_id', $parent)->get(),
null => $this->getQuery($form, $filter)->paginate(15), // initial all elements - paginate
-1 => $this->getQuery($form, $filter)->paginate(15), // initial root elements - parinate
default => $this->getQuery($form, $filter)->get(), // specific parent element - show all
};
return ParticipantResource::collection($data)->additional(['meta' => ParticipantResource::meta($form)]);

View File

@ -7,6 +7,7 @@ use App\Form\Models\Form;
use App\Form\Models\Participant;
use App\Member\Member;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
@ -19,6 +20,10 @@ class RegisterAction
*/
public function handle(Form $form, array $input): Participant
{
if (!$form->canRegister()) {
throw ValidationException::withMessages(['event' => 'Anmeldung zzt nicht möglich.']);
}
$memberQuery = FieldCollection::fromRequest($form, $input)
->withNamiType()
->reduce(fn ($query, $field) => $field->namiType->performQuery($query, $field->value), (new Member())->newQuery());

View File

@ -0,0 +1,31 @@
<?php
namespace App\Form\Actions;
use App\Form\Models\Form;
use Lorisleiva\Actions\Concerns\AsAction;
class UpdateParticipantSearchIndexAction
{
use AsAction;
public function handle(Form $form): void
{
if (config('scout.driver') !== 'meilisearch') {
return;
}
$form->searchableUsing()->updateIndexSettings(
$form->participantsSearchableAs(),
[
'filterableAttributes' => [...$form->getFields()->filterables()->getKeys(), 'parent-id'],
'searchableAttributes' => $form->getFields()->searchables()->getKeys(),
'sortableAttributes' => [...$form->getFields()->sortables()->getKeys(), 'id', 'created_at'],
'displayedAttributes' => [...$form->getFields()->filterables()->getKeys(), ...$form->getFields()->searchables()->getKeys(), 'id'],
'pagination' => [
'maxTotalHits' => 1000000,
]
]
);
}
}

View File

@ -0,0 +1,9 @@
<?php
namespace App\Form\Contracts;
interface Filterable
{
/** @param mixed $value */
public function filter($value): string;
}

View File

@ -2,6 +2,7 @@
namespace App\Form\Data;
use App\Form\Contracts\Filterable;
use App\Form\Enums\SpecialType;
use App\Form\Fields\Field;
use App\Form\Fields\NamiField;
@ -117,4 +118,27 @@ class FieldCollection extends Collection
{
return $this->first(fn ($field) => $field->specialType === $specialType);
}
public function searchables(): self
{
return $this;
}
public function sortables(): self
{
return $this;
}
public function filterables(): self
{
return $this->filter(fn ($field) => $field instanceof Filterable);
}
/**
* @return array<int, string>
*/
public function getKeys(): array
{
return $this->map(fn ($field) => $field->key)->toArray();
}
}

View File

@ -2,6 +2,7 @@
namespace App\Form\Fields;
use App\Form\Contracts\Filterable;
use App\Form\Matchers\BooleanMatcher;
use App\Form\Matchers\Matcher;
use App\Form\Models\Form;
@ -9,9 +10,8 @@ use App\Form\Models\Participant;
use App\Form\Presenters\BooleanPresenter;
use App\Form\Presenters\Presenter;
use Faker\Generator;
use Illuminate\Validation\Rule;
class CheckboxField extends Field
class CheckboxField extends Field implements Filterable
{
public bool $required;
public string $description;
@ -86,4 +86,11 @@ class CheckboxField extends Field
{
return app(BooleanMatcher::class);
}
public function filter($value): string
{
$asString = $value ? 'true' : 'false';
return "{$this->key} = $asString";
}
}

View File

@ -2,6 +2,7 @@
namespace App\Form\Fields;
use App\Form\Contracts\Filterable;
use App\Form\Matchers\Matcher;
use App\Form\Matchers\SingleValueMatcher;
use App\Form\Models\Form;
@ -9,7 +10,7 @@ use App\Form\Models\Participant;
use Faker\Generator;
use Illuminate\Validation\Rule;
class DropdownField extends Field
class DropdownField extends Field implements Filterable
{
public bool $required;
/** @var array<int, string> */
@ -87,4 +88,14 @@ class DropdownField extends Field
{
return app(SingleValueMatcher::class);
}
/** @inheritdoc */
public function filter($value): string
{
if (is_null($value)) {
return "{$this->key} IS NULL";
}
return $this->key . ' = \'' . $value . '\'';
}
}

View File

@ -180,4 +180,10 @@ abstract class Field extends Data
{
return app(SingleValueMatcher::class);
}
/** @param mixed $value */
public function filter($value): string
{
return '';
}
}

View File

@ -2,6 +2,7 @@
namespace App\Form\Fields;
use App\Form\Contracts\Filterable;
use App\Form\Matchers\Matcher;
use App\Form\Matchers\SingleValueMatcher;
use App\Form\Models\Form;
@ -9,7 +10,7 @@ use App\Form\Models\Participant;
use Faker\Generator;
use Illuminate\Validation\Rule;
class RadioField extends Field
class RadioField extends Field implements Filterable
{
public bool $required;
/** @var array<int, string> */
@ -87,4 +88,13 @@ class RadioField extends Field
{
return app(SingleValueMatcher::class);
}
public function filter($value): string
{
if (is_null($value)) {
return "{$this->key} IS NULL";
}
return $this->key . ' = \'' . $value . '\'';
}
}

View File

@ -2,11 +2,13 @@
namespace App\Form\Models;
use App\Form\Actions\UpdateParticipantSearchIndexAction;
use App\Form\Data\ExportData;
use App\Form\Data\FieldCollection;
use App\Form\Data\FormConfigData;
use App\Lib\Editor\Condition;
use App\Lib\Editor\EditorData;
use App\Lib\Sorting;
use Cviebrock\EloquentSluggable\Sluggable;
use Database\Factories\Form\Models\FormFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@ -14,7 +16,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Laravel\Scout\Searchable;
use Spatie\Image\Enums\Fit;
use Spatie\Image\Manipulations;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
@ -159,7 +160,7 @@ class Form extends Model implements HasMedia
if (is_null(data_get($model->meta, 'active_columns'))) {
$model->setAttribute('meta', [
'active_columns' => $model->getFields()->count() ? $model->getFields()->take(4)->pluck('key')->toArray() : null,
'sorting' => $model->getFields()->count() ? [$model->getFields()->first()->key, 'asc'] : null,
'sorting' => Sorting::by('id'),
]);
return;
}
@ -172,5 +173,32 @@ class Form extends Model implements HasMedia
return;
}
});
static::saved(function ($model) {
UpdateParticipantSearchIndexAction::dispatch($model);
});
}
public function participantsSearchableAs(): string
{
return config('scout.prefix') . 'forms_' . $this->id . '_participants';
}
public function defaultSorting(): Sorting
{
return Sorting::from($this->meta['sorting']);
}
public function canRegister(): bool
{
if ($this->registration_from && $this->registration_from->gt(now())) {
return false;
}
if ($this->registration_until && $this->registration_until->lt(now())) {
return false;
}
return true;
}
}

View File

@ -15,6 +15,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Mail;
use Laravel\Scout\Searchable;
use stdClass;
class Participant extends Model implements Preventable
@ -22,6 +23,7 @@ class Participant extends Model implements Preventable
/** @use HasFactory<ParticipantFactory> */
use HasFactory;
use Searchable;
public $guarded = [];
@ -46,15 +48,6 @@ class Participant extends Model implements Preventable
return $this->hasMany(self::class, 'parent_id');
}
/**
* @param Builder<self> $query
* @return Builder<self>
*/
public function scopeWithFilter(Builder $query, ParticipantFilterScope $filter): Builder
{
return $filter->apply($query);
}
/**
* @return BelongsTo<Member, self>
*/
@ -110,4 +103,15 @@ class Participant extends Model implements Preventable
{
return 'Nachweise erforderlich für deine Anmeldung zu ' . $this->form->name;
}
public function searchableAs(): string
{
return $this->form->participantsSearchableAs();
}
/** @return array<string, mixed> */
public function toSearchableArray(): array
{
return [...$this->data, 'parent-id' => $this->parent_id, 'created_at' => $this->created_at->timestamp];
}
}

View File

@ -35,6 +35,7 @@ class FormApiResource extends JsonResource
'image' => $this->getMedia('headerImage')->first()->getFullUrl('square'),
'is_active' => $this->is_active,
'is_private' => $this->is_private,
'can_register' => $this->getModel()->canRegister(),
];
}

View File

@ -4,32 +4,76 @@ namespace App\Form\Scopes;
use App\Form\Models\Form;
use App\Form\Models\Participant;
use App\Lib\Filter;
use Illuminate\Database\Eloquent\Builder;
use App\Lib\ScoutFilter;
use App\Lib\Sorting;
use Illuminate\Support\Arr;
use Laravel\Scout\Builder;
use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Attributes\MapOutputName;
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
/**
* @extends Filter<Participant>
* @extends ScoutFilter<Participant>
*/
#[MapInputName(SnakeCaseMapper::class)]
#[MapOutputName(SnakeCaseMapper::class)]
class ParticipantFilterScope extends Filter
class ParticipantFilterScope extends ScoutFilter
{
public static string $nan = 'deeb3ef4-d185-44b1-a4bc-0a4e7addebc3d8900c6f-a344-4afb-b54e-065ed483a7ba';
private Form $form;
/**
* @param array<string, mixed> $data
* @param array<string, mixed> $options
*/
public function __construct(
public array $data = [],
public string $search = '',
public array $options = [],
public ?int $parent = null,
public ?Sorting $sort = null
) {
}
public static string $nan = 'deeb3ef4-d185-44b1-a4bc-0a4e7addebc3d8900c6f-a344-4afb-b54e-065ed483a7ba';
public function getQuery(): Builder
{
$this->search = $this->search ?: '';
return Participant::search($this->search, function ($engine, string $query, array $options) {
$filter = collect([]);
foreach ($this->form->getFields()->filterables() as $field) {
if ($this->data[$field->key] === static::$nan) {
continue;
}
$filter->push($field->filter($this->data[$field->key]));
}
if ($this->parent === -1) {
$filter->push('parent-id IS NULL');
}
if ($this->parent !== null && $this->parent !== -1) {
$filter->push('parent-id = ' . $this->parent);
}
$options['filter'] = $filter->map(fn ($expression) => "($expression)")->implode(' AND ');
$options['sort'] = $this->sort->toMeilisearch();
return $engine->search($query, [...$this->options, ...$options]);
})->within($this->form->participantsSearchableAs());
}
public function setForm(Form $form): self
{
$this->form = $form;
if (is_null($this->sort)) {
$this->sort = $this->form->defaultSorting();
}
foreach ($form->getFields() as $field) {
if (!Arr::has($this->data, $field->key)) {
data_set($this->data, $field->key, static::$nan);
@ -39,18 +83,10 @@ class ParticipantFilterScope extends Filter
return $this;
}
/**
* @inheritdoc
*/
public function apply(Builder $query): Builder
public function parent(?int $parent): self
{
foreach ($this->data as $key => $value) {
if ($value === static::$nan) {
continue;
}
$query = $query->where('data->' . $key, $value);
}
$this->parent = $parent;
return $query;
return $this;
}
}

View File

@ -25,6 +25,15 @@ class Gender extends Model
};
}
public function getShortAttribute(): string
{
return match ($this->name) {
'Männlich' => 'm',
'Weiblich' => 'w',
default => ''
};
}
public static function fromString(string $title): self
{
return self::firstWhere('name', $title);

View File

@ -0,0 +1,60 @@
<?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

@ -0,0 +1,71 @@
<?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

@ -0,0 +1,50 @@
<?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 Modules\Module\ModuleSettings;
use App\Module\ModuleSettings;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Inertia\Middleware;

View File

@ -6,9 +6,9 @@ use Lorisleiva\Actions\Concerns\AsAction;
use App\Invoice\Models\Invoice;
use App\Invoice\Resources\InvoiceResource;
use App\Invoice\Scopes\InvoiceFilterScope;
use Illuminate\Pagination\LengthAwarePaginator;
use Inertia\Inertia;
use Inertia\Response;
use Laravel\Scout\Builder;
use Lorisleiva\Actions\ActionRequest;
class InvoiceIndexAction
@ -17,11 +17,11 @@ class InvoiceIndexAction
/**
* @return LengthAwarePaginator<Invoice>
* @return Builder<Invoice>
*/
public function handle(InvoiceFilterScope $filter): LengthAwarePaginator
public function handle(InvoiceFilterScope $filter): Builder
{
return Invoice::withFilter($filter)->with('positions')->paginate(15);
return $filter->getQuery()->query(fn ($q) => $q->with('positions'));
}
public function asController(ActionRequest $request): Response
@ -32,7 +32,7 @@ class InvoiceIndexAction
$filter = InvoiceFilterScope::fromRequest($request->input('filter', ''));
return Inertia::render('invoice/Index', [
'data' => InvoiceResource::collection($this->handle($filter)),
'data' => InvoiceResource::collection($this->handle($filter)->paginate(15)),
]);
}
}

View File

@ -6,7 +6,6 @@ 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,6 +1,6 @@
<?php
namespace Modules\Invoice;
namespace App\Invoice;
use App\Setting\Contracts\Storeable;
use App\Setting\LocalSettings;
@ -8,27 +8,17 @@ use Lorisleiva\Actions\ActionRequest;
class InvoiceSettings extends LocalSettings implements Storeable
{
public string $from_long;
public string $from;
public string $mobile;
public string $email;
public string $website;
public string $address;
public string $place;
public string $zip;
public string $iban;
public string $bic;
public int $rememberWeeks;
public ?string $from_long;
public ?string $from;
public ?string $mobile;
public ?string $email;
public ?string $website;
public ?string $address;
public ?string $place;
public ?string $zip;
public ?string $iban;
public ?string $bic;
public ?int $rememberWeeks;
public static function group(): string
{

View File

@ -0,0 +1,37 @@
<?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,6 +6,7 @@ use App\Invoice\BillDocument;
use App\Invoice\BillKind;
use App\Invoice\Enums\InvoiceStatus;
use App\Invoice\InvoiceDocument;
use App\Invoice\InvoiceSettings;
use App\Invoice\RememberDocument;
use App\Invoice\Scopes\InvoiceFilterScope;
use App\Member\Member;
@ -16,13 +17,14 @@ use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Modules\Invoice\InvoiceSettings;
use Laravel\Scout\Searchable;
use stdClass;
class Invoice extends Model
{
/** @use HasFactory<InvoiceFactory> */
use HasFactory;
use Searchable;
public $guarded = [];
@ -120,15 +122,6 @@ class Invoice extends Model
->where('last_remembered_at', '<=', now()->subWeeks($weeks));
}
/**
* @param Builder<self> $query
* @return Builder<self>
*/
public function scopeWithFilter(Builder $query, InvoiceFilterScope $filter): Builder
{
return $filter->apply($query);
}
public function getMailRecipient(): stdClass
{
return (object) [
@ -154,4 +147,20 @@ class Invoice extends Model
]);
}
}
/**
* Get the indexable data array for the model.
*
* @return array<string, mixed>
*/
public function toSearchableArray(): array
{
return [
'to' => implode(', ', $this->to),
'usage' => $this->usage,
'greeting' => $this->greeting,
'mail_email' => $this->mail_email,
'status' => $this->status->value,
];
}
}

View File

@ -5,42 +5,43 @@ namespace App\Invoice\Scopes;
use App\Invoice\Enums\InvoiceStatus;
use App\Invoice\Models\Invoice;
use App\Lib\Filter;
use Illuminate\Database\Eloquent\Builder;
use App\Lib\ScoutFilter;
use Laravel\Scout\Builder;
use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Attributes\MapOutputName;
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
/**
* @extends Filter<Invoice>
* @extends ScoutFilter<Invoice>
*/
#[MapInputName(SnakeCaseMapper::class)]
#[MapOutputName(SnakeCaseMapper::class)]
class InvoiceFilterScope extends Filter
class InvoiceFilterScope extends ScoutFilter
{
/**
* @param array<int, string> $statuses
*/
public function __construct(
public ?array $statuses = null,
public ?string $search = null
) {
}
/**
* @inheritdoc
*/
public function apply(Builder $query): Builder
{
$query = $query->whereIn('status', $this->statuses);
return $query;
}
/**
* @inheritdoc
*/
public function toDefault(): self
{
$this->statuses = $this->statuses === null ? InvoiceStatus::defaultVisibleValues()->toArray() : $this->statuses;
return $this;
}
/**
* @inheritdoc
*/
public function getQuery(): Builder
{
$this->search = $this->search ?: '';
return Invoice::search($this->search, function ($engine, string $query, array $options) {
if (empty($this->statuses)) {
$filter = 'status = "asa6aeruuni4BahC7Wei6ahm1"';
} else {
$filter = collect($this->statuses)->map(fn (string $status) => "status = \"$status\"")->join(' OR ');
}
return $engine->search($query, [...$options, 'filter' => $filter]);
});
}
}

25
app/Lib/Sorting.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace App\Lib;
use Spatie\LaravelData\Data;
class Sorting extends Data
{
public static function by(string $by): self
{
return static::factory()->withoutMagicalCreation()->from(['by' => $by]);
}
public function __construct(public string $by, public bool $direction = false)
{
}
/**
* @return array<int, string>
*/
public function toMeilisearch(): array
{
return [$this->by . ':' . ($this->direction ? 'desc' : 'asc')];
}
}

View File

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

View File

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

View File

@ -0,0 +1,27 @@
<?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

@ -0,0 +1,28 @@
<?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

@ -0,0 +1,65 @@
<?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

@ -0,0 +1,42 @@
<?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,7 +1,9 @@
<?php
namespace Modules\Mailgateway;
namespace App\Mailgateway;
use App\Mailgateway\Models\Mailgateway;
use App\Mailgateway\Resources\MailgatewayResource;
use App\Setting\LocalSettings;
class MailgatewaySettings extends LocalSettings
@ -21,6 +23,8 @@ class MailgatewaySettings extends LocalSettings
*/
public function viewData(): array
{
return [];
return [
'data' => MailgatewayResource::collection(Mailgateway::paginate(10)),
];
}
}

View File

@ -1,21 +1,19 @@
<?php
namespace Modules\Mailgateway\Models;
namespace App\Mailgateway\Models;
use Modules\Mailgateway\Types\Type;
use App\Mailgateway\Casts\TypeCast;
use Database\Factories\Mailgateway\Models\MailgatewayFactory;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Mailgateway extends Model
{
public static $factory = MailgatewayFactory::class;
/** @use HasFactory<MailgatewayFactory> */
use HasFactory;
use HasUuids;
public $casts = ['type' => Type::class];
public $casts = ['type' => TypeCast::class];
public $guarded = [];
}

View File

@ -0,0 +1,68 @@
<?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

@ -1,6 +1,6 @@
<?php
namespace Modules\Mailgateway\Types;
namespace App\Mailgateway\Types;
use App\Maildispatcher\Data\MailEntry;
use App\Maildispatcher\Models\Localmaildispatcher;

View File

@ -1,6 +1,6 @@
<?php
namespace Modules\Mailgateway\Types;
namespace App\Mailgateway\Types;
use App\Maildispatcher\Data\MailEntry;
use App\Mailman\Data\MailingList;
@ -45,28 +45,32 @@ class MailmanType extends Type
'name' => 'url',
'label' => 'URL',
'type' => 'text',
'validator' => 'required|max:255',
'storeValidator' => 'required|max:255',
'updateValidator' => 'required|max:255',
'default' => '',
],
[
'name' => 'user',
'label' => 'Benutzer',
'type' => 'text',
'validator' => 'required|max:255',
'storeValidator' => 'required|max:255',
'updateValidator' => 'required|max:255',
'default' => '',
],
[
'name' => 'password',
'label' => 'Passwort',
'type' => 'password',
'validator' => 'required|max:255',
'storeValidator' => 'required|max:255',
'updateValidator' => 'nullable|max:255',
'default' => '',
],
[
'name' => 'owner',
'label' => 'E-Mail-Adresse des Eigentümers',
'type' => 'email',
'validator' => 'required|email|max:255',
'storeValidator' => 'required|email|max:255',
'updateValidator' => 'required|email|max:255',
'default' => '',
],
];

View File

@ -1,18 +1,12 @@
<?php
namespace Modules\Mailgateway\Types;
namespace App\Mailgateway\Types;
use App\Maildispatcher\Data\MailEntry;
use Illuminate\Support\Collection;
use Livewire\Wireable;
use Spatie\LaravelData\Concerns\WireableData;
use Spatie\LaravelData\Data;
abstract class Type extends Data implements Wireable
abstract class Type
{
use WireableData;
abstract public static function name(): string;
/**
@ -66,13 +60,24 @@ abstract class Type extends Data implements Wireable
/**
* @return array<string, mixed>
*/
public static function rules(): array
public static function rules(string $validator): array
{
return collect(static::fields())->mapWithKeys(fn ($field) => [
$field['name'] => $field['validator'],
$field['name'] => $field[$validator],
])->toArray();
}
/**
* @return array<string, array<string, mixed>>
*/
public function toResource(): array
{
return [
'cls' => get_class($this),
'params' => get_object_vars($this),
];
}
/**
* @param Collection<int, MailEntry> $results
*/
@ -88,8 +93,8 @@ abstract class Type extends Data implements Wireable
}
$this->list($name, $domain)
->filter(fn ($listEntry) => $results->doesntContain(fn ($r) => $r->is($listEntry)))
->each(fn ($listEntry) => $this->remove($name, $domain, $listEntry->email));
->filter(fn ($listEntry) => $results->doesntContain(fn ($r) => $r->is($listEntry)))
->each(fn ($listEntry) => $this->remove($name, $domain, $listEntry->email));
}
/**

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

@ -1,23 +1,18 @@
<?php
namespace Modules\Prevention;
namespace App\Member;
use App\Member\Member;
use Modules\Dashboard\Block;
use App\Dashboard\Blocks\Block;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
class PsPendingBlock extends Block
{
/**
* @var Collection<Member>
* @return Builder<Member>
*/
public Collection $members;
public function mount(): void
public function query(): Builder
{
$this->members = Member::where(function ($query) {
return Member::where(function ($query) {
$time = now()->subYears(5)->endOfYear();
return $query
@ -28,25 +23,28 @@ class PsPendingBlock extends Block
})
->whereCurrentGroup()
->orderByRaw('lastname, firstname')
->whereHas('memberships', fn ($builder) => $builder->isLeader()->active())
->get();
->whereHas('memberships', fn ($builder) => $builder->isLeader()->active());
}
/**
* @return array{members: array{fullname: string}}
*/
public function data(): array
{
return [
'members' => $this->query()->get()->map(fn ($member) => [
'fullname' => $member->fullname,
])->toArray(),
];
}
public function component(): string
{
return 'ps-pending';
}
public function title(): string
{
return 'Ausstehende Präventionsschulungen';
}
public function render(): string
{
return <<<'HTML'
<div>
@foreach ($members as $member)
<div class="flex mt-2 items-center leading-none text-gray-100">
<span class="grow">{{ $member->fullname }}</span>
</div>
@endforeach
</div>
HTML;
}
}

View File

@ -0,0 +1,43 @@
<?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,6 +1,6 @@
<?php
namespace Modules\Module;
namespace App\Module;
use App\Setting\Contracts\Storeable;
use App\Setting\LocalSettings;

View File

@ -2,6 +2,7 @@
namespace App\Prevention\Mails;
use App\Invoice\InvoiceSettings;
use App\Lib\Editor\EditorData;
use App\Prevention\Contracts\Preventable;
use Illuminate\Bus\Queueable;
@ -10,7 +11,6 @@ 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,10 +3,13 @@
namespace App\Providers;
use App\Form\Models\Form;
use App\Mailgateway\Types\LocalType;
use App\Mailgateway\Types\MailmanType;
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
{
@ -27,6 +30,11 @@ 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');

View File

@ -1,43 +0,0 @@
<?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,7 +7,6 @@ use Illuminate\Http\RedirectResponse;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
/** @deprecated */
class StoreAction
{
use AsAction;

View File

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

View File

@ -1,36 +0,0 @@
<?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 url('setting/' . $this->group());
return route('setting.view', ['settingGroup' => $this->group()]);
}
/**

View File

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

View File

@ -4,13 +4,14 @@ namespace App\Setting;
use App\Fileshare\FileshareSettings;
use App\Form\FormSettings;
use Modules\Module\ModuleSettings;
use App\Invoice\InvoiceSettings;
use App\Mailgateway\MailgatewaySettings;
use App\Module\ModuleSettings;
use App\Prevention\PreventionSettings;
use App\Setting\Data\SettingSynthesizer;
use App\Setting\Actions\StoreAction;
use App\Setting\Actions\ViewAction;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Livewire\Livewire;
use Modules\Invoice\InvoiceSettings;
class SettingServiceProvider extends ServiceProvider
{
@ -23,6 +24,9 @@ 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);
}
/**
@ -34,11 +38,10 @@ 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

@ -1,77 +0,0 @@
<?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);
}
}

View File

@ -1,28 +0,0 @@
<?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;
}
}

View File

@ -1,29 +0,0 @@
<?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;
}
}

View File

@ -1,60 +0,0 @@
<?php
namespace App\View\Form;
use App\View\Traits\HasFormDimensions;
use Illuminate\View\Component;
class Lever extends Component
{
use HasFormDimensions;
public string $id;
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 = '',
) {
$this->id = str()->uuid()->toString();
}
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

@ -1,22 +0,0 @@
<?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;
}
}

View File

@ -1,59 +0,0 @@
<?php
namespace App\View\Form;
use App\View\Traits\HasFormDimensions;
use Illuminate\View\Component;
class Select extends Component
{
use HasFormDimensions;
public string $id;
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,
) {
$this->id = str()->uuid()->toString();
}
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;
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\View\Form;
use App\View\Traits\HasFormDimensions;
use Illuminate\View\Component;
class Text extends Component
{
use HasFormDimensions;
public string $id;
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'
) {
$this->id = str()->uuid()->toString();
}
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">
<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 }}
/>
<x-ui::errors :for="$name" />
@if($hint)
<x-form::hint>{{$hint}}</x-form::hint>
@endif
</div>
</label>
HTML;
}
}

View File

@ -1,32 +0,0 @@
<?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;
}
}

View File

@ -1,29 +0,0 @@
<?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;
}
}

View File

@ -1,59 +0,0 @@
<?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

@ -1,28 +0,0 @@
<?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;
}
}

View File

@ -1,101 +0,0 @@
<?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

@ -1,42 +0,0 @@
<?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;
}
}

View File

@ -1,51 +0,0 @@
<?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

@ -1,33 +0,0 @@
<?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

@ -1,23 +0,0 @@
<?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);
}
}

View File

@ -1,29 +0,0 @@
<?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 }} 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;
}
}

View File

@ -1,33 +0,0 @@
<?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 }} class="h-6 px-3 space-x-2 items-center rounded-full {{ $allColors($variant) }} hidden lg:flex">
<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

@ -1,40 +0,0 @@
<?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}}" class="flex space-x-2 items-center group @if($dark) dark @endif">
<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;
}
}

View File

@ -1,38 +0,0 @@
<?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;
}
}

View File

@ -1,22 +0,0 @@
<?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}}" class="px-3 py-2 uppercase no-underline text-sm items-center justify-center bg-primary-700 rounded text-primary-300">
{{$slot}}
</button>
HTML;
}
}

View File

@ -1,33 +0,0 @@
<?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;
}
}

View File

@ -1,34 +0,0 @@
<?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 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

@ -1,25 +0,0 @@
<?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;
}
}

View File

@ -1,28 +0,0 @@
<?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;
}
}

View File

@ -1,31 +0,0 @@
<?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

@ -6,3 +6,5 @@ echo "create database scoutrobot;" | sudo mysql
ssh -l stammsilva zoomyboy.de "cd /usr/share/webapps/nami_silva && docker compose exec db mysqldump -udb -p$SCOUTROBOT_DB_PASSWORD db" > db.tmp
sudo mysql scoutrobot < 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

20
bin/run
View File

@ -1,5 +1,17 @@
#!/bin/bash
set -e
FILESHARE=false
WEB=false
while getopts f opt; do
case $opt in
f) FILESHARE=true ;;
w) WEB=true ;;
esac
done
tmux new-session -d -s test
tmux send-keys -t test "a serve" Enter
@ -12,11 +24,11 @@ tmux send-keys -t test "SS start docker && duu socketi" Enter
tmux new-window -t test
tmux send-keys -t test "nrh" Enter
tmux new-window -t test
tmux send-keys -t test "ggwdk && cd plugins/silva/adrema/assets/vendor/adrema-form && nrd" Enter
$WEB && tmux new-window -t test
$WEB && tmux send-keys -t test "ggwdk && cd plugins/silva/adrema/assets/vendor/adrema-form && nrd" Enter
tmux new-window -t test
tmux send-keys -t test "cd tests/Fileshare && docker compose up" Enter
$FILESHARE && tmux new-window -t test
$FILESHARE && tmux send-keys -t test "cd tests/Fileshare && docker compose up" Enter
tmux attach-session -t test

View File

@ -61,7 +61,6 @@
"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",
@ -86,8 +85,7 @@
"mockery/mockery": "^1.4.4",
"orchestra/testbench": "^9.0",
"pestphp/pest": "^3.0",
"phpstan/phpstan-mockery": "^1.1",
"qossmic/deptrac": "^2.0"
"phpstan/phpstan-mockery": "^1.1"
},
"config": {
"optimize-autoloader": true,
@ -106,7 +104,6 @@
"autoload": {
"psr-4": {
"App\\": "app/",
"Modules\\": "modules/",
"Plugins\\": "plugins/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
@ -114,7 +111,6 @@
},
"autoload-dev": {
"psr-4": {
"Modules\\Dashboard\\Tests\\": "modules/dashboard/tests/",
"Tests\\": "tests/",
"Zoomyboy\\LaravelNami\\Tests\\": "packages/laravel-nami/tests/"
}
@ -122,10 +118,6 @@
"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"

123
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": "3ffa3d4a189ba5d296ca71166298a74f",
"content-hash": "10f0b0d2a8dee4a8dad4821de9935f85",
"packages": [
{
"name": "amphp/amp",
@ -5153,82 +5153,6 @@
],
"time": "2024-03-23T07:42:40+00:00"
},
{
"name": "livewire/livewire",
"version": "v3.5.8",
"source": {
"type": "git",
"url": "https://github.com/livewire/livewire.git",
"reference": "ce1ce71b39a3492b98f7d2f2a4583f1b163fe6ae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/livewire/livewire/zipball/ce1ce71b39a3492b98f7d2f2a4583f1b163fe6ae",
"reference": "ce1ce71b39a3492b98f7d2f2a4583f1b163fe6ae",
"shasum": ""
},
"require": {
"illuminate/database": "^10.0|^11.0",
"illuminate/routing": "^10.0|^11.0",
"illuminate/support": "^10.0|^11.0",
"illuminate/validation": "^10.0|^11.0",
"laravel/prompts": "^0.1.24",
"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",
"mockery/mockery": "^1.3.1",
"orchestra/testbench": "^8.21.0|^9.0",
"orchestra/testbench-dusk": "^8.24|^9.1",
"phpunit/phpunit": "^10.4",
"psy/psysh": "^0.11.22|^0.12"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Livewire\\LivewireServiceProvider"
],
"aliases": {
"Livewire": "Livewire\\Livewire"
}
}
},
"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.5.8"
},
"funding": [
{
"url": "https://github.com/livewire",
"type": "github"
}
],
"time": "2024-09-20T19:41:19+00:00"
},
{
"name": "lorisleiva/laravel-actions",
"version": "v2.8.4",
@ -15743,51 +15667,6 @@
},
"time": "2024-09-11T15:47:29+00:00"
},
{
"name": "qossmic/deptrac",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/qossmic/deptrac.git",
"reference": "f646695c1468051138e1347d89590f9084fa6256"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/qossmic/deptrac/zipball/f646695c1468051138e1347d89590f9084fa6256",
"reference": "f646695c1468051138e1347d89590f9084fa6256",
"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.",
"support": {
"issues": "https://github.com/qossmic/deptrac/issues",
"source": "https://github.com/qossmic/deptrac/tree/2.0.1"
},
"time": "2024-06-17T10:43:11+00:00"
},
{
"name": "rector/rector",
"version": "1.2.5",

View File

@ -168,6 +168,7 @@ 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,
@ -175,15 +176,8 @@ 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,
],
/*
@ -234,7 +228,6 @@ 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,
],
];

View File

@ -1,160 +0,0 @@
<?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',
];

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