Compare commits

..

9 Commits

Author SHA1 Message Date
philipp lang 11530c575b --wip-- [skip ci] 2024-09-21 15:22:26 +02:00
philipp lang 78920e8aef Add Popup button version for SaveButton 2024-09-13 01:59:23 +02:00
philipp lang aa64d1ceb6 Add Margin after popup title 2024-09-13 01:29:46 +02:00
philipp lang 3830f3d1d4 Remove tests for member create and edit 2024-09-12 22:42:27 +02:00
philipp lang 6d102d9319 Fix tests 2024-09-12 22:42:27 +02:00
philipp lang 18a786bf1e Remove edit route from searchable array 2024-09-12 22:42:27 +02:00
philipp lang c058a1b78a Fix UpdateTest 2024-09-12 22:42:27 +02:00
philipp lang 4b73c79139 Fix member links 2024-09-12 22:42:27 +02:00
philipp lang 2023011b75 Remove member create and edit routes 2024-09-12 22:42:27 +02:00
169 changed files with 4206 additions and 5358 deletions

View File

@ -1,12 +1,11 @@
FROM php:8.3.11-fpm as php FROM php:8.1.6-fpm as php
WORKDIR /app WORKDIR /app
RUN ls /app RUN ls /app
RUN apt-get update RUN apt-get update
RUN apt-get install -y rsync libcurl3-dev apt-utils zlib1g-dev libpng-dev libicu-dev libonig-dev unzip poppler-utils libpng-dev libjpeg-dev default-mysql-client libzip-dev imagemagick libmagickwand-dev RUN apt-get install -y rsync libcurl3-dev apt-utils zlib1g-dev libpng-dev libicu-dev libonig-dev unzip poppler-utils libpng-dev libjpeg-dev default-mysql-client libzip-dev
RUN apt-get install -y --no-install-recommends texlive-base texlive-latex-base texlive-pictures texlive-latex-extra texlive-lang-german texlive-plain-generic texlive-fonts-recommended texlive-fonts-extra texlive-extra-utils RUN apt-get install -y --no-install-recommends texlive-base texlive-latex-base texlive-pictures texlive-latex-extra texlive-lang-german texlive-plain-generic texlive-fonts-recommended texlive-fonts-extra texlive-extra-utils
RUN docker-php-ext-install pdo_mysql curl exif intl mbstring pcntl zip RUN docker-php-ext-install pdo_mysql curl exif intl mbstring pcntl zip
RUN pecl install redis && docker-php-ext-enable redis RUN pecl install redis && docker-php-ext-enable redis
RUN pecl install imagick && docker-php-ext-enable imagick
RUN docker-php-ext-configure gd --with-jpeg RUN docker-php-ext-configure gd --with-jpeg
RUN docker-php-ext-install gd RUN docker-php-ext-install gd
RUN usermod -s /bin/bash www-data RUN usermod -s /bin/bash www-data

View File

@ -1,6 +0,0 @@
#!/bin/bash
docker buildx build -f .docker/base.Dockerfile .
docker image tag sha256:... zoomyboy/adrema-base
docker push zoomyboy/adrema-base

View File

@ -1,4 +1,4 @@
FROM composer:2.7.9 as composer FROM composer:2.2.7 as composer
WORKDIR /app WORKDIR /app
COPY . /app COPY . /app
RUN composer install --ignore-platform-reqs --no-dev RUN composer install --ignore-platform-reqs --no-dev

View File

@ -1,4 +1,4 @@
FROM composer:2.7.9 as composer FROM composer:2.2.7 as composer
WORKDIR /app WORKDIR /app
COPY . /app COPY . /app
RUN composer install --ignore-platform-reqs --no-dev RUN composer install --ignore-platform-reqs --no-dev

View File

@ -12,7 +12,7 @@ steps:
- git submodule update --init --recursive - git submodule update --init --recursive
- name: composer_dev - name: composer_dev
image: composer:2.7.9 image: composer:2.2.7
commands: commands:
- composer install --ignore-platform-reqs --dev - composer install --ignore-platform-reqs --dev
@ -39,7 +39,6 @@ steps:
- name: tests - name: tests
image: zoomyboy/adrema-base:latest image: zoomyboy/adrema-base:latest
commands: commands:
- touch .env
- php artisan migrate - php artisan migrate
- php artisan test - php artisan test
- rm -f .env - rm -f .env
@ -103,7 +102,7 @@ steps:
event: tag event: tag
- name: deploy - name: deploy
image: zoomyboy/adrema-base:latest image: php:8.1.6
environment: environment:
SSH_KEY: SSH_KEY:
from_secret: deploy_private_key from_secret: deploy_private_key
@ -136,7 +135,7 @@ steps:
event: push event: push
- name: composer_no_dev - name: composer_no_dev
image: composer:2.7.9 image: composer:2.2.7
commands: commands:
- composer install --ignore-platform-reqs --no-dev - composer install --ignore-platform-reqs --no-dev

1
.gitignore vendored
View File

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

View File

@ -1,26 +1,5 @@
# Letzte Änderungen # 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
### 1.11.1
- Es kann nun auch das Feld "Datenweiterverwendung" über Adrema gepflegt werden.
### 1.10.20 ### 1.10.20
- Fixed: Bei Textfeldern wird nun die Einleitung dargestellt - Fixed: Bei Textfeldern wird nun die Einleitung dargestellt

View File

@ -50,7 +50,6 @@ class InsertMemberAction
'nationality_id' => Nationality::where('nami_id', $member->nationalityId)->firstOrFail()->id, 'nationality_id' => Nationality::where('nami_id', $member->nationalityId)->firstOrFail()->id,
'mitgliedsnr' => $member->memberId, 'mitgliedsnr' => $member->memberId,
'version' => $member->version, 'version' => $member->version,
'keepdata' => $member->keepdata,
]); ]);
} }

View File

@ -4,14 +4,12 @@ namespace App;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use Cviebrock\EloquentSluggable\Sluggable; use Cviebrock\EloquentSluggable\Sluggable;
use Database\Factories\ActivityFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Activity extends Model class Activity extends Model
{ {
/** @use HasFactory<ActivityFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;
use Sluggable; use Sluggable;

View File

@ -2,13 +2,11 @@
namespace App; namespace App;
use Database\Factories\ConfessionFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Confession extends Model class Confession extends Model
{ {
/** @use HasFactory<ConfessionFactory> */
use HasFactory; use HasFactory;
public $fillable = ['name', 'nami_id', 'is_null']; public $fillable = ['name', 'nami_id', 'is_null'];

View File

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

View File

@ -29,7 +29,7 @@ class MemberData extends Data
*/ */
public static function fromModels(array $ids): Collection public static function fromModels(array $ids): Collection
{ {
return Member::whereIn('id', $ids)->orderByRaw('lastname, firstname')->get()->map(fn ($member) => self::factory()->withoutMagicalCreation()->from([ return Member::whereIn('id', $ids)->orderByRaw('lastname, firstname')->get()->map(fn ($member) => self::withoutMagicalCreationFrom([
...$member->toArray(), ...$member->toArray(),
'birthday' => $member->birthday->toAtomString(), 'birthday' => $member->birthday->toAtomString(),
'isLeader' => $member->isLeader(), 'isLeader' => $member->isLeader(),
@ -44,7 +44,7 @@ class MemberData extends Data
*/ */
public static function fromApi(array $data): Collection public static function fromApi(array $data): Collection
{ {
return collect($data)->map(fn ($member) => self::factory()->withoutMagicalCreation()->from([ return collect($data)->map(fn ($member) => self::withoutMagicalCreationFrom([
...$member, ...$member,
'birthday' => Carbon::parse($member['birthday'])->toAtomString(), 'birthday' => Carbon::parse($member['birthday'])->toAtomString(),
'gender' => Gender::fromString($member['gender']), 'gender' => Gender::fromString($member['gender']),
@ -72,23 +72,13 @@ class MemberData extends Data
return $this->zip.' '.$this->location; return $this->zip.' '.$this->location;
} }
public function age(): int public function age(): string
{ {
return intval($this->birthday->diffInYears(now())); return (string) $this->birthday->diffInYears(now()) ?: '';
} }
public function birthYear(): string public function birthYear(): string
{ {
return (string) $this->birthday->year; 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,16 +3,15 @@
namespace App\Contribution\Documents; namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData; use App\Contribution\Data\MemberData;
use App\Contribution\Traits\HasPdfBackground;
use App\Country; use App\Country;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class BdkjHesse extends ContributionDocument class BdkjHesse extends ContributionDocument
{ {
use HasPdfBackground;
/** /**
* @param Collection<int, Collection<int, MemberData>> $members * @param Collection<int, Collection<int, MemberData>> $members
*/ */
@ -26,7 +25,6 @@ class BdkjHesse extends ContributionDocument
public ?string $filename = '', public ?string $filename = '',
public string $type = 'F', public string $type = 'F',
) { ) {
$this->setEventName($eventName);
} }
public function dateFrom(): string public function dateFrom(): string
@ -76,7 +74,7 @@ class BdkjHesse extends ContributionDocument
public function durationDays(): int public function durationDays(): int
{ {
return intVal(Carbon::parse($this->dateUntil)->diffInDays(Carbon::parse($this->dateFrom))) + 1; return Carbon::parse($this->dateUntil)->diffInDays(Carbon::parse($this->dateFrom)) + 1;
} }
/** /**
@ -116,9 +114,36 @@ class BdkjHesse extends ContributionDocument
return $member->birthYear(); 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 public static function getName(): string
{ {
return 'BDKJ Hessen'; return 'Für BDKJ Hessen erstellen';
} }
/** /**
@ -131,6 +156,7 @@ class BdkjHesse extends ContributionDocument
'dateUntil' => 'required|string|date_format:Y-m-d', 'dateUntil' => 'required|string|date_format:Y-m-d',
'country' => 'required|integer|exists:countries,id', 'country' => 'required|integer|exists:countries,id',
'zipLocation' => 'required|string', 'zipLocation' => 'required|string',
'eventName' => 'required|string',
]; ];
} }
} }

View File

@ -3,17 +3,16 @@
namespace App\Contribution\Documents; namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData; use App\Contribution\Data\MemberData;
use App\Contribution\Traits\FormatsDates;
use App\Contribution\Traits\HasPdfBackground;
use App\Country; use App\Country;
use App\Invoice\InvoiceSettings; use App\Invoice\InvoiceSettings;
use Carbon\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class CityFrankfurtMainDocument extends ContributionDocument class CityFrankfurtMainDocument extends ContributionDocument
{ {
use HasPdfBackground;
use FormatsDates;
public string $fromName; public string $fromName;
/** /**
@ -29,7 +28,6 @@ class CityFrankfurtMainDocument extends ContributionDocument
public ?string $filename = '', public ?string $filename = '',
public string $type = 'F', public string $type = 'F',
) { ) {
$this->setEventName($eventName);
$this->fromName = app(InvoiceSettings::class)->from_long; $this->fromName = app(InvoiceSettings::class)->from_long;
} }
@ -63,6 +61,17 @@ 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 public function countryName(): string
{ {
return $this->country->name; return $this->country->name;
@ -73,9 +82,56 @@ class CityFrankfurtMainDocument extends ContributionDocument
return count($this->members); 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 public static function getName(): string
{ {
return 'Frankfurt'; return 'Für Frankfurt erstellen';
} }
/** /**
@ -88,6 +144,7 @@ class CityFrankfurtMainDocument extends ContributionDocument
'dateUntil' => 'required|string|date_format:Y-m-d', 'dateUntil' => 'required|string|date_format:Y-m-d',
'country' => 'required|integer|exists:countries,id', 'country' => 'required|integer|exists:countries,id',
'zipLocation' => 'required|string', 'zipLocation' => 'required|string',
'eventName' => 'required|string',
]; ];
} }
} }

View File

@ -3,17 +3,15 @@
namespace App\Contribution\Documents; namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData; use App\Contribution\Data\MemberData;
use App\Contribution\Traits\FormatsDates;
use App\Contribution\Traits\HasPdfBackground;
use App\Country; use App\Country;
use App\Member\Member; use App\Member\Member;
use Carbon\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class CityRemscheidDocument extends ContributionDocument class CityRemscheidDocument extends ContributionDocument
{ {
use HasPdfBackground;
use FormatsDates;
/** /**
* @param Collection<int, Collection<int, Member>> $leaders * @param Collection<int, Collection<int, Member>> $leaders
* @param Collection<int, Collection<int, Member>> $children * @param Collection<int, Collection<int, Member>> $children
@ -27,9 +25,17 @@ class CityRemscheidDocument extends ContributionDocument
public Collection $children, public Collection $children,
public ?string $filename = '', public ?string $filename = '',
public string $type = 'F', public string $type = 'F',
public string $eventName = '',
) { ) {
$this->setEventName($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');
} }
/** /**
@ -46,7 +52,6 @@ class CityRemscheidDocument extends ContributionDocument
country: Country::where('id', $request['country'])->firstOrFail(), country: Country::where('id', $request['country'])->firstOrFail(),
leaders: $leaders->values()->toBase()->chunk(6), leaders: $leaders->values()->toBase()->chunk(6),
children: $children->values()->toBase()->chunk(20), children: $children->values()->toBase()->chunk(20),
eventName: $request['eventName'],
); );
} }
@ -65,13 +70,39 @@ class CityRemscheidDocument extends ContributionDocument
country: Country::where('id', $request['country'])->firstOrFail(), country: Country::where('id', $request['country'])->firstOrFail(),
leaders: $leaders->values()->toBase()->chunk(6), leaders: $leaders->values()->toBase()->chunk(6),
children: $children->values()->toBase()->chunk(20), 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 public static function getName(): string
{ {
return 'Remscheid'; return 'Für Remscheid erstellen';
} }
/** /**

View File

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

View File

@ -3,12 +3,9 @@
namespace App\Contribution\Documents; namespace App\Contribution\Documents;
use Zoomyboy\Tex\Document; use Zoomyboy\Tex\Document;
use Zoomyboy\Tex\Template;
abstract class ContributionDocument extends Document abstract class ContributionDocument extends Document
{ {
private string $eventName;
abstract public static function getName(): string; abstract public static function getName(): string;
/** /**
@ -32,34 +29,8 @@ abstract class ContributionDocument extends Document
public static function globalRules(): array public static function globalRules(): array
{ {
return [ return [
'eventName' => 'required|string',
'members' => 'present|array|min:1', 'members' => 'present|array|min:1',
'members.*' => 'integer|exists:members,id', '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,16 +3,14 @@
namespace App\Contribution\Documents; namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData; use App\Contribution\Data\MemberData;
use App\Contribution\Traits\FormatsDates;
use App\Contribution\Traits\HasPdfBackground;
use App\Country; use App\Country;
use Carbon\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class RdpNrwDocument extends ContributionDocument class RdpNrwDocument extends ContributionDocument
{ {
use HasPdfBackground;
use FormatsDates;
/** /**
* @param Collection<int, Collection<int, MemberData>> $members * @param Collection<int, Collection<int, MemberData>> $members
*/ */
@ -24,9 +22,14 @@ class RdpNrwDocument extends ContributionDocument
public Collection $members, public Collection $members,
public ?string $filename = '', public ?string $filename = '',
public string $type = 'F', public string $type = 'F',
public string $eventName = '',
) { ) {
$this->setEventName($eventName); }
public function dateRange(): string
{
return Carbon::parse($this->dateFrom)->format('d.m.Y')
. ' - '
. Carbon::parse($this->dateUntil)->format('d.m.Y');
} }
/** /**
@ -40,7 +43,6 @@ class RdpNrwDocument extends ContributionDocument
zipLocation: $request['zipLocation'], zipLocation: $request['zipLocation'],
country: Country::where('id', $request['country'])->firstOrFail(), country: Country::where('id', $request['country'])->firstOrFail(),
members: MemberData::fromModels($request['members'])->chunk(17), members: MemberData::fromModels($request['members'])->chunk(17),
eventName: $request['eventName'],
); );
} }
@ -55,7 +57,6 @@ class RdpNrwDocument extends ContributionDocument
zipLocation: $request['zipLocation'], zipLocation: $request['zipLocation'],
country: Country::where('id', $request['country'])->firstOrFail(), country: Country::where('id', $request['country'])->firstOrFail(),
members: MemberData::fromApi($request['member_data'])->chunk(17), members: MemberData::fromApi($request['member_data'])->chunk(17),
eventName: $request['eventName'],
); );
} }
@ -64,9 +65,65 @@ class RdpNrwDocument extends ContributionDocument
return $this->country->name; 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 public static function getName(): string
{ {
return 'RdP NRW'; return 'Für RdP NRW erstellen';
} }
/** /**
@ -79,6 +136,7 @@ class RdpNrwDocument extends ContributionDocument
'dateUntil' => 'required|string|date_format:Y-m-d', 'dateUntil' => 'required|string|date_format:Y-m-d',
'country' => 'required|integer|exists:countries,id', 'country' => 'required|integer|exists:countries,id',
'zipLocation' => 'required|string', 'zipLocation' => 'required|string',
'eventName' => 'required|string',
]; ];
} }
} }

View File

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

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

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

View File

@ -3,13 +3,11 @@
namespace App; namespace App;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use Database\Factories\CountryFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Country extends Model class Country extends Model
{ {
/** @use HasFactory<CountryFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;

View File

@ -3,13 +3,11 @@
namespace App\Course\Models; namespace App\Course\Models;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use Database\Factories\Course\Models\CourseFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Course extends Model class Course extends Model
{ {
/** @use HasFactory<CourseFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;

View File

@ -3,14 +3,12 @@
namespace App\Course\Models; namespace App\Course\Models;
use App\Member\Member; use App\Member\Member;
use Database\Factories\Course\Models\CourseMemberFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CourseMember extends Model class CourseMember extends Model
{ {
/** @use HasFactory<CourseMemberFactory> */
use HasFactory; use HasFactory;
/** @var array<int, string> */ /** @var array<int, string> */

View File

@ -2,9 +2,7 @@
namespace App\Dashboard; namespace App\Dashboard;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use App\Dashboard\Actions\IndexAction as DashboardIndexAction;
class DashboardServiceProvider extends ServiceProvider class DashboardServiceProvider extends ServiceProvider
{ {
@ -25,8 +23,5 @@ class DashboardServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
app(Router::class)->middleware(['web', 'auth:web'])->group(function ($router) {
$router->get('/', DashboardIndexAction::class)->name('home');
});
} }
} }

View File

@ -4,14 +4,12 @@ namespace App;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use App\Payment\Subscription; use App\Payment\Subscription;
use Database\Factories\FeeFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
class Fee extends Model class Fee extends Model
{ {
/** @use HasFactory<FeeFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;

View File

@ -17,6 +17,6 @@ class ListFilesAction
*/ */
public function handle(ActionRequest $request, Fileshare $fileshare): DataCollection public function handle(ActionRequest $request, Fileshare $fileshare): DataCollection
{ {
return ResourceData::collect($fileshare->type->getSubDirectories($request->input('parent')), DataCollection::class)->wrap('data'); return ResourceData::collection($fileshare->type->getSubDirectories($request->input('parent')))->wrap('data');
} }
} }

View File

@ -3,13 +3,11 @@
namespace App\Fileshare\Models; namespace App\Fileshare\Models;
use App\Fileshare\ConnectionTypes\ConnectionType; use App\Fileshare\ConnectionTypes\ConnectionType;
use Database\Factories\Fileshare\Models\FileshareFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Fileshare extends Model class Fileshare extends Model
{ {
/** @use HasFactory<FileshareFactory> */
use HasFactory; use HasFactory;
public $guarded = []; public $guarded = [];

View File

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

View File

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

View File

@ -17,12 +17,7 @@ class PreventionRememberAction
public function handle(): void public function handle(): void
{ {
$query = Participant::whereHas( $query = Participant::whereHas('form', fn ($form) => $form->where('needs_prevention', true))
'form',
fn ($form) => $form
->where('needs_prevention', true)
->where('from', '>=', now())
)
->where( ->where(
fn ($q) => $q fn ($q) => $q
->where('last_remembered_at', '<=', now()->subWeeks(2)) ->where('last_remembered_at', '<=', now()->subWeeks(2))

View File

@ -7,7 +7,6 @@ use App\Form\Models\Form;
use App\Form\Models\Participant; use App\Form\Models\Participant;
use App\Member\Member; use App\Member\Member;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
use Lorisleiva\Actions\ActionRequest; use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction; use Lorisleiva\Actions\Concerns\AsAction;
@ -20,10 +19,6 @@ class RegisterAction
*/ */
public function handle(Form $form, array $input): Participant 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) $memberQuery = FieldCollection::fromRequest($form, $input)
->withNamiType() ->withNamiType()
->reduce(fn ($query, $field) => $field->namiType->performQuery($query, $field->value), (new Member())->newQuery()); ->reduce(fn ($query, $field) => $field->namiType->performQuery($query, $field->value), (new Member())->newQuery());

View File

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

@ -6,7 +6,6 @@ use App\Form\Fields\Field;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Casts\Cast;
use Spatie\LaravelData\Data; use Spatie\LaravelData\Data;
use Spatie\LaravelData\Support\Creation\CreationContext;
use Spatie\LaravelData\Support\DataProperty; use Spatie\LaravelData\Support\DataProperty;
class CollectionCast implements Cast class CollectionCast implements Cast
@ -21,9 +20,10 @@ class CollectionCast implements Cast
/** /**
* @param array<int, array<string, mixed>> $value * @param array<int, array<string, mixed>> $value
* @param array<string, mixed> $context
* @return Collection<int, Data> * @return Collection<int, Data>
*/ */
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): mixed public function cast(DataProperty $property, mixed $value, array $context): mixed
{ {
return collect($value)->map(fn ($item) => $this->target::from($item)); return collect($value)->map(fn ($item) => $this->target::from($item));
} }

View File

@ -5,16 +5,16 @@ namespace App\Form\Casts;
use App\Form\Data\FieldCollection; use App\Form\Data\FieldCollection;
use App\Form\Fields\Field; use App\Form\Fields\Field;
use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Casts\Cast;
use Spatie\LaravelData\Support\Creation\CreationContext;
use Spatie\LaravelData\Support\DataProperty; use Spatie\LaravelData\Support\DataProperty;
class FieldCollectionCast implements Cast class FieldCollectionCast implements Cast
{ {
/** /**
* @param array<int, array<string, string>> $value * @param array<int, array<string, string>> $value
* @param array<string, mixed> $context
* @return FieldCollection * @return FieldCollection
*/ */
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): mixed public function cast(DataProperty $property, mixed $value, array $context): mixed
{ {
return new FieldCollection(collect($value)->map(fn ($value) => Field::classFromType($value['type'])::from($value))->all()); return new FieldCollection(collect($value)->map(fn ($value) => Field::classFromType($value['type'])::from($value))->all());
} }

View File

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

View File

@ -2,7 +2,6 @@
namespace App\Form\Data; namespace App\Form\Data;
use App\Form\Contracts\Filterable;
use App\Form\Enums\SpecialType; use App\Form\Enums\SpecialType;
use App\Form\Fields\Field; use App\Form\Fields\Field;
use App\Form\Fields\NamiField; use App\Form\Fields\NamiField;
@ -118,27 +117,4 @@ class FieldCollection extends Collection
{ {
return $this->first(fn ($field) => $field->specialType === $specialType); 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

@ -48,7 +48,7 @@ enum NamiType: string
static::LOCATION => $member->location, static::LOCATION => $member->location,
static::NICKNAME => $member->nickname, static::NICKNAME => $member->nickname,
static::GENDER => $member->gender?->name, static::GENDER => $member->gender?->name,
static::AGE => intVal($member->birthday->diffInYears(now())), static::AGE => $member->birthday->diffInYears(now()),
static::AGEEVENT => $member->birthday->diffInYears($form->from), static::AGEEVENT => $member->birthday->diffInYears($form->from),
static::MOBILEPHONE => $member->mobile_phone, static::MOBILEPHONE => $member->mobile_phone,
}; };

View File

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

View File

@ -2,7 +2,6 @@
namespace App\Form\Fields; namespace App\Form\Fields;
use App\Form\Contracts\Filterable;
use App\Form\Matchers\Matcher; use App\Form\Matchers\Matcher;
use App\Form\Matchers\SingleValueMatcher; use App\Form\Matchers\SingleValueMatcher;
use App\Form\Models\Form; use App\Form\Models\Form;
@ -10,7 +9,7 @@ use App\Form\Models\Participant;
use Faker\Generator; use Faker\Generator;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
class DropdownField extends Field implements Filterable class DropdownField extends Field
{ {
public bool $required; public bool $required;
/** @var array<int, string> */ /** @var array<int, string> */
@ -88,14 +87,4 @@ class DropdownField extends Field implements Filterable
{ {
return app(SingleValueMatcher::class); 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,10 +180,4 @@ abstract class Field extends Data
{ {
return app(SingleValueMatcher::class); return app(SingleValueMatcher::class);
} }
/** @param mixed $value */
public function filter($value): string
{
return '';
}
} }

View File

@ -2,7 +2,6 @@
namespace App\Form\Fields; namespace App\Form\Fields;
use App\Form\Contracts\Filterable;
use App\Form\Matchers\Matcher; use App\Form\Matchers\Matcher;
use App\Form\Matchers\SingleValueMatcher; use App\Form\Matchers\SingleValueMatcher;
use App\Form\Models\Form; use App\Form\Models\Form;
@ -10,7 +9,7 @@ use App\Form\Models\Participant;
use Faker\Generator; use Faker\Generator;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
class RadioField extends Field implements Filterable class RadioField extends Field
{ {
public bool $required; public bool $required;
/** @var array<int, string> */ /** @var array<int, string> */
@ -88,13 +87,4 @@ class RadioField extends Field implements Filterable
{ {
return app(SingleValueMatcher::class); 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,20 +2,17 @@
namespace App\Form\Models; namespace App\Form\Models;
use App\Form\Actions\UpdateParticipantSearchIndexAction;
use App\Form\Data\ExportData; use App\Form\Data\ExportData;
use App\Form\Data\FieldCollection; use App\Form\Data\FieldCollection;
use App\Form\Data\FormConfigData; use App\Form\Data\FormConfigData;
use App\Lib\Editor\Condition; use App\Lib\Editor\Condition;
use App\Lib\Editor\EditorData; use App\Lib\Editor\EditorData;
use App\Lib\Sorting;
use Cviebrock\EloquentSluggable\Sluggable; use Cviebrock\EloquentSluggable\Sluggable;
use Database\Factories\Form\Models\FormFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Laravel\Scout\Searchable; use Laravel\Scout\Searchable;
use Spatie\Image\Enums\Fit; use Spatie\Image\Manipulations;
use Spatie\MediaLibrary\HasMedia; use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia; use Spatie\MediaLibrary\InteractsWithMedia;
use Spatie\MediaLibrary\MediaCollections\Models\Media; use Spatie\MediaLibrary\MediaCollections\Models\Media;
@ -24,7 +21,6 @@ use Zoomyboy\MedialibraryHelper\DefersUploads;
/** @todo replace editor content with EditorData cast */ /** @todo replace editor content with EditorData cast */
class Form extends Model implements HasMedia class Form extends Model implements HasMedia
{ {
/** @use HasFactory<FormFactory> */
use HasFactory; use HasFactory;
use Sluggable; use Sluggable;
use InteractsWithMedia; use InteractsWithMedia;
@ -45,12 +41,11 @@ class Form extends Model implements HasMedia
'needs_prevention' => 'boolean', 'needs_prevention' => 'boolean',
'prevention_text' => EditorData::class, 'prevention_text' => EditorData::class,
'prevention_conditions' => Condition::class, 'prevention_conditions' => Condition::class,
'from' => 'datetime',
'to' => 'datetime',
'registration_from' => 'datetime',
'registration_until' => 'datetime',
]; ];
/** @var array<int, string> */
public $dates = ['from', 'to', 'registration_from', 'registration_until'];
/** /**
* @return SluggableConfig * @return SluggableConfig
*/ */
@ -78,7 +73,7 @@ class Form extends Model implements HasMedia
->forceFileName(fn (Form $model, string $name) => $model->slug) ->forceFileName(fn (Form $model, string $name) => $model->slug)
->convert(fn () => 'jpg') ->convert(fn () => 'jpg')
->registerMediaConversions(function (Media $media) { ->registerMediaConversions(function (Media $media) {
$this->addMediaConversion('square')->fit(Fit::Crop, 400, 400); $this->addMediaConversion('square')->fit(Manipulations::FIT_CROP, 400, 400);
}); });
$this->addMediaCollection('mailattachments') $this->addMediaCollection('mailattachments')
->withDefaultProperties(fn () => [ ->withDefaultProperties(fn () => [
@ -160,7 +155,7 @@ class Form extends Model implements HasMedia
if (is_null(data_get($model->meta, 'active_columns'))) { if (is_null(data_get($model->meta, 'active_columns'))) {
$model->setAttribute('meta', [ $model->setAttribute('meta', [
'active_columns' => $model->getFields()->count() ? $model->getFields()->take(4)->pluck('key')->toArray() : null, 'active_columns' => $model->getFields()->count() ? $model->getFields()->take(4)->pluck('key')->toArray() : null,
'sorting' => Sorting::by('id'), 'sorting' => $model->getFields()->count() ? [$model->getFields()->first()->key, 'asc'] : null,
]); ]);
return; return;
} }
@ -173,32 +168,5 @@ class Form extends Model implements HasMedia
return; 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

@ -4,7 +4,6 @@ namespace App\Form\Models;
use App\Form\Data\FormConfigData; use App\Form\Data\FormConfigData;
use App\Lib\Editor\EditorData; use App\Lib\Editor\EditorData;
use Database\Factories\Form\Models\FormtemplateFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -13,7 +12,6 @@ use Illuminate\Database\Eloquent\Model;
*/ */
class Formtemplate extends Model class Formtemplate extends Model
{ {
/** @use HasFactory<FormtemplateFactory> */
use HasFactory; use HasFactory;
public $guarded = []; public $guarded = [];

View File

@ -8,22 +8,17 @@ use App\Form\Mails\ConfirmRegistrationMail;
use App\Form\Scopes\ParticipantFilterScope; use App\Form\Scopes\ParticipantFilterScope;
use App\Member\Member; use App\Member\Member;
use App\Prevention\Contracts\Preventable; use App\Prevention\Contracts\Preventable;
use Database\Factories\Form\Models\ParticipantFactory;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use Laravel\Scout\Searchable;
use stdClass; use stdClass;
class Participant extends Model implements Preventable class Participant extends Model implements Preventable
{ {
/** @use HasFactory<ParticipantFactory> */
use HasFactory; use HasFactory;
use Searchable;
public $guarded = []; public $guarded = [];
@ -48,6 +43,15 @@ class Participant extends Model implements Preventable
return $this->hasMany(self::class, 'parent_id'); 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> * @return BelongsTo<Member, self>
*/ */
@ -103,15 +107,4 @@ class Participant extends Model implements Preventable
{ {
return 'Nachweise erforderlich für deine Anmeldung zu ' . $this->form->name; 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,7 +35,6 @@ class FormApiResource extends JsonResource
'image' => $this->getMedia('headerImage')->first()->getFullUrl('square'), 'image' => $this->getMedia('headerImage')->first()->getFullUrl('square'),
'is_active' => $this->is_active, 'is_active' => $this->is_active,
'is_private' => $this->is_private, 'is_private' => $this->is_private,
'can_register' => $this->getModel()->canRegister(),
]; ];
} }

View File

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

View File

@ -5,7 +5,6 @@ namespace App\Form\Transformers;
use App\Form\Fields\Field; use App\Form\Fields\Field;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Spatie\LaravelData\Support\DataProperty; use Spatie\LaravelData\Support\DataProperty;
use Spatie\LaravelData\Support\Transformation\TransformationContext;
use Spatie\LaravelData\Transformers\Transformer; use Spatie\LaravelData\Transformers\Transformer;
class CollectionTransformer implements Transformer class CollectionTransformer implements Transformer
@ -19,7 +18,7 @@ class CollectionTransformer implements Transformer
* @param Collection<int, Field> $value * @param Collection<int, Field> $value
* @return array<string, mixed> * @return array<string, mixed>
*/ */
public function transform(DataProperty $property, mixed $value, TransformationContext $context): mixed public function transform(DataProperty $property, mixed $value): mixed
{ {
return $value->toArray(); return $value->toArray();
} }

View File

@ -5,7 +5,6 @@ namespace App\Form\Transformers;
use App\Form\Fields\Field; use App\Form\Fields\Field;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Spatie\LaravelData\Support\DataProperty; use Spatie\LaravelData\Support\DataProperty;
use Spatie\LaravelData\Support\Transformation\TransformationContext;
use Spatie\LaravelData\Transformers\Transformer; use Spatie\LaravelData\Transformers\Transformer;
class FieldCollectionTransformer implements Transformer class FieldCollectionTransformer implements Transformer
@ -15,7 +14,7 @@ class FieldCollectionTransformer implements Transformer
* @param Collection<int, Field> $value * @param Collection<int, Field> $value
* @return array<string, mixed> * @return array<string, mixed>
*/ */
public function transform(DataProperty $property, mixed $value, TransformationContext $context): mixed public function transform(DataProperty $property, mixed $value): mixed
{ {
return $value->map(fn ($field) => [ return $value->map(fn ($field) => [
...$field->toArray(), ...$field->toArray(),

View File

@ -3,15 +3,12 @@
namespace App; namespace App;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use Database\Factories\GenderFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Gender extends Model class Gender extends Model
{ {
use HasNamiField; use HasNamiField;
/** @use HasFactory<GenderFactory> */
use HasFactory; use HasFactory;
public $fillable = ['name', 'nami_id']; public $fillable = ['name', 'nami_id'];
@ -25,15 +22,6 @@ 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 public static function fromString(string $title): self
{ {
return self::firstWhere('name', $title); return self::firstWhere('name', $title);

View File

@ -5,7 +5,6 @@ namespace App;
use App\Fileshare\Data\FileshareResourceData; use App\Fileshare\Data\FileshareResourceData;
use App\Group\Enums\Level; use App\Group\Enums\Level;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use Database\Factories\GroupFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -13,7 +12,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class Group extends Model class Group extends Model
{ {
/** @use HasFactory<GroupFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;
@ -26,11 +24,11 @@ class Group extends Model
]; ];
/** /**
* @return BelongsTo<self, self> * @return BelongsTo<static, self>
*/ */
public function parent(): BelongsTo public function parent(): BelongsTo
{ {
return $this->belongsTo(self::class, 'parent_id'); return $this->belongsTo(static::class, 'parent_id');
} }
/** /**
@ -38,7 +36,7 @@ class Group extends Model
*/ */
public function children(): HasMany public function children(): HasMany
{ {
return $this->hasMany(self::class, 'parent_id'); return $this->hasMany(static::class, 'parent_id');
} }
public static function booted(): void public static function booted(): void

View File

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

View File

@ -36,7 +36,7 @@ abstract class InvoiceDocument extends Document
public static function fromInvoice(Invoice $invoice): self public static function fromInvoice(Invoice $invoice): self
{ {
return static::factory()->withoutMagicalCreation()->from([ return static::withoutMagicalCreationFrom([
'toName' => $invoice->to['name'], 'toName' => $invoice->to['name'],
'toAddress' => $invoice->to['address'], 'toAddress' => $invoice->to['address'],
'toZip' => $invoice->to['zip'], 'toZip' => $invoice->to['zip'],

View File

@ -8,17 +8,27 @@ use Lorisleiva\Actions\ActionRequest;
class InvoiceSettings extends LocalSettings implements Storeable class InvoiceSettings extends LocalSettings implements Storeable
{ {
public ?string $from_long; public string $from_long;
public ?string $from;
public ?string $mobile; public string $from;
public ?string $email;
public ?string $website; public string $mobile;
public ?string $address;
public ?string $place; public string $email;
public ?string $zip;
public ?string $iban; public string $website;
public ?string $bic;
public ?int $rememberWeeks; public string $address;
public string $place;
public string $zip;
public string $iban;
public string $bic;
public int $rememberWeeks;
public static function group(): string public static function group(): string
{ {

View File

@ -11,20 +11,16 @@ use App\Invoice\RememberDocument;
use App\Invoice\Scopes\InvoiceFilterScope; use App\Invoice\Scopes\InvoiceFilterScope;
use App\Member\Member; use App\Member\Member;
use App\Payment\Subscription; use App\Payment\Subscription;
use Database\Factories\Invoice\Models\InvoiceFactory;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Laravel\Scout\Searchable;
use stdClass; use stdClass;
class Invoice extends Model class Invoice extends Model
{ {
/** @use HasFactory<InvoiceFactory> */
use HasFactory; use HasFactory;
use Searchable;
public $guarded = []; public $guarded = [];
@ -32,8 +28,12 @@ class Invoice extends Model
'to' => 'json', 'to' => 'json',
'status' => InvoiceStatus::class, 'status' => InvoiceStatus::class,
'via' => BillKind::class, 'via' => BillKind::class,
'sent_at' => 'datetime', ];
'last_remembered_at' => 'datetime',
/** @var array<int, string> */
public $dates = [
'sent_at',
'last_remembered_at',
]; ];
/** /**
@ -122,6 +122,15 @@ class Invoice extends Model
->where('last_remembered_at', '<=', now()->subWeeks($weeks)); ->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 public function getMailRecipient(): stdClass
{ {
return (object) [ return (object) [
@ -147,20 +156,4 @@ 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

@ -3,14 +3,12 @@
namespace App\Invoice\Models; namespace App\Invoice\Models;
use App\Member\Member; use App\Member\Member;
use Database\Factories\Invoice\Models\InvoicePositionFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
class InvoicePosition extends Model class InvoicePosition extends Model
{ {
/** @use HasFactory<InvoicePositionFactory> */
use HasFactory; use HasFactory;
public $guarded = []; public $guarded = [];

View File

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

View File

@ -20,12 +20,12 @@ class Condition extends Data
public static function fromMedia(Media $media): self public static function fromMedia(Media $media): self
{ {
return $media->getCustomProperty('conditions') ? static::factory()->withoutMagicalCreation()->from($media->getCustomProperty('conditions')) : static::defaults(); return $media->getCustomProperty('conditions') ? static::withoutMagicalCreationFrom($media->getCustomProperty('conditions')) : static::defaults();
} }
public static function defaults(): self public static function defaults(): self
{ {
return static::factory()->withoutMagicalCreation()->from(['mode' => 'any', 'ifs' => []]); return static::withoutMagicalCreationFrom(['mode' => 'any', 'ifs' => []]);
} }
public function hasStatements(): bool public function hasStatements(): bool

View File

@ -20,7 +20,7 @@ abstract class ConditionResolver
*/ */
public function filterBlock(array $block): bool public function filterBlock(array $block): bool
{ {
return $this->filterCondition(Condition::factory()->withoutMagicalCreation()->from([ return $this->filterCondition(Condition::withoutMagicalCreationFrom([
'mode' => data_get($block, 'tunes.condition.mode', 'any'), 'mode' => data_get($block, 'tunes.condition.mode', 'any'),
'ifs' => data_get($block, 'tunes.condition.ifs', []), 'ifs' => data_get($block, 'tunes.condition.ifs', []),
])); ]));

View File

@ -36,7 +36,7 @@ abstract class Filter extends Data
*/ */
public static function fromPost(?array $post = null): static public static function fromPost(?array $post = null): static
{ {
return static::factory()->withoutMagicalCreation()->from($post ?: [])->toDefault(); return static::withoutMagicalCreationFrom($post ?: [])->toDefault();
} }
/** /**

View File

@ -14,11 +14,9 @@ abstract class ScoutFilter extends Data
{ {
/** /**
* @return Builder<T> * @return Builder
*/ */
abstract public function getQuery(): Builder; abstract public function getQuery(): Builder;
/** @var Builder<T> */
protected Builder $query; protected Builder $query;
/** /**
@ -38,6 +36,6 @@ abstract class ScoutFilter extends Data
*/ */
public static function fromPost(?array $post = null): static public static function fromPost(?array $post = null): static
{ {
return static::factory()->withoutMagicalCreation()->from($post ?: []); return static::withoutMagicalCreationFrom($post ?: []);
} }
} }

View File

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

@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Model;
class Localmaildispatcher extends Model class Localmaildispatcher extends Model
{ {
use HasFactory;
use HasUuids; use HasUuids;
public $guarded = []; public $guarded = [];

View File

@ -3,7 +3,6 @@
namespace App\Maildispatcher\Models; namespace App\Maildispatcher\Models;
use App\Mailgateway\Models\Mailgateway; use App\Mailgateway\Models\Mailgateway;
use Database\Factories\Maildispatcher\Models\MaildispatcherFactory;
use Illuminate\Database\Eloquent\Concerns\HasUuids; use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -11,7 +10,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Maildispatcher extends Model class Maildispatcher extends Model
{ {
/** @use HasFactory<MaildispatcherFactory> */
use HasFactory; use HasFactory;
use HasUuids; use HasUuids;

View File

@ -3,14 +3,12 @@
namespace App\Mailgateway\Models; namespace App\Mailgateway\Models;
use App\Mailgateway\Casts\TypeCast; use App\Mailgateway\Casts\TypeCast;
use Database\Factories\Mailgateway\Models\MailgatewayFactory;
use Illuminate\Database\Eloquent\Concerns\HasUuids; use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Mailgateway extends Model class Mailgateway extends Model
{ {
/** @use HasFactory<MailgatewayFactory> */
use HasFactory; use HasFactory;
use HasUuids; use HasUuids;

View File

@ -26,7 +26,7 @@ class MailingList extends Data
) { ) {
} }
public static function toFactory(): MailinglistFactory public static function factory(): MailinglistFactory
{ {
return MailinglistFactory::new(); return MailinglistFactory::new();
} }

View File

@ -4,38 +4,24 @@ namespace App\Member\Actions;
use App\Member\Member; use App\Member\Member;
use App\Member\MemberResource; use App\Member\MemberResource;
use Inertia\Inertia; use Illuminate\Http\JsonResponse;
use Inertia\Response;
use Lorisleiva\Actions\Concerns\AsAction; use Lorisleiva\Actions\Concerns\AsAction;
class MemberShowAction class MemberShowAction
{ {
use AsAction; use AsAction;
/** public function asController(Member $member): JsonResponse
* @return array{data: MemberResource}
*/
public function handle(Member $member): array
{ {
return [ return response()->json([
'data' => new MemberResource( 'data' => new MemberResource($member
$member
->load('memberships') ->load('memberships')
->load('invoicePositions.invoice') ->load('invoicePositions.invoice')
->load('nationality') ->load('nationality')
->load('region') ->load('region')
->load('subscription') ->load('subscription')
->load('courses.course') ->load('courses.course')),
),
'meta' => MemberResource::meta(), 'meta' => MemberResource::meta(),
]; ]);
}
public function asController(Member $member): Response
{
session()->put('menu', 'member');
session()->put('title', 'Mitglied ' . $member->fullname);
return Inertia::render('member/ShowView', $this->handle($member));
} }
} }

View File

@ -46,7 +46,7 @@ class NamiPutMemberAction
'groupId' => $member->group->nami_id, 'groupId' => $member->group->nami_id,
'id' => $member->nami_id, 'id' => $member->nami_id,
'version' => $member->version, 'version' => $member->version,
'keepdata' => $member->keepdata, 'keepdata' => false,
]); ]);
$response = $api->putMember($namiMember, $activity ? $activity->nami_id : null, $subactivity ? $subactivity->nami_id : null); $response = $api->putMember($namiMember, $activity ? $activity->nami_id : null, $subactivity ? $subactivity->nami_id : null);
Member::withoutEvents(function () use ($response, $member) { Member::withoutEvents(function () use ($response, $member) {

View File

@ -5,6 +5,7 @@ namespace App\Member\Data;
use App\Group; use App\Group;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Spatie\LaravelData\Data; use Spatie\LaravelData\Data;
use Spatie\LaravelData\DataCollection;
class NestedGroup extends Data class NestedGroup extends Data
{ {
@ -30,10 +31,10 @@ class NestedGroup extends Data
} }
/** /**
* @return Collection<int, static> * @return DataCollection<int, static>
*/ */
public static function cacheForSelect(): Collection public static function cacheForSelect(): DataCollection
{ {
return static::collect(static::forSelect()); return static::collection(static::forSelect());
} }
} }

View File

@ -33,7 +33,6 @@ use Zoomyboy\Osm\Geolocatable;
use Zoomyboy\Osm\HasGeolocation; use Zoomyboy\Osm\HasGeolocation;
use Zoomyboy\Phone\HasPhoneNumbers; use Zoomyboy\Phone\HasPhoneNumbers;
use App\Prevention\Enums\Prevention; use App\Prevention\Enums\Prevention;
use Database\Factories\Member\MemberFactory;
/** /**
* @property string $subscription_name * @property string $subscription_name
@ -43,7 +42,6 @@ class Member extends Model implements Geolocatable
{ {
use Notifiable; use Notifiable;
use HasNamiField; use HasNamiField;
/** @use HasFactory<MemberFactory> */
use HasFactory; use HasFactory;
use Sluggable; use Sluggable;
use Searchable; use Searchable;
@ -58,7 +56,12 @@ class Member extends Model implements Geolocatable
/** /**
* @var array<int, string> * @var array<int, string>
*/ */
public static array $namiFields = ['firstname', 'lastname', 'joined_at', 'birthday', 'send_newspaper', 'address', 'zip', 'location', 'nickname', 'other_country', 'further_address', 'main_phone', 'mobile_phone', 'work_phone', 'fax', 'email', 'email_parents', 'gender_id', 'confession_id', 'region_id', 'country_id', 'fee_id', 'nationality_id', 'slug', 'subscription_id', 'keepdata']; public static array $namiFields = ['firstname', 'lastname', 'joined_at', 'birthday', 'send_newspaper', 'address', 'zip', 'location', 'nickname', 'other_country', 'further_address', 'main_phone', 'mobile_phone', 'work_phone', 'fax', 'email', 'email_parents', 'gender_id', 'confession_id', 'region_id', 'country_id', 'fee_id', 'nationality_id', 'slug', 'subscription_id'];
/**
* @var array<int, string>
*/
public $dates = ['try_created_at', 'recertified_at', 'joined_at', 'birthday', 'efz', 'ps_at', 'more_ps_at', 'without_education_at', 'without_efz_at'];
/** /**
* @var array<string, string> * @var array<string, string>
@ -77,19 +80,8 @@ class Member extends Model implements Geolocatable
'multiply_pv' => 'boolean', 'multiply_pv' => 'boolean',
'multiply_more_pv' => 'boolean', 'multiply_more_pv' => 'boolean',
'is_leader' => 'boolean', 'is_leader' => 'boolean',
'keepdata' => 'boolean',
'bill_kind' => BillKind::class, 'bill_kind' => BillKind::class,
'mitgliedsnr' => 'integer', 'mitgliedsnr' => 'integer',
'try_created_at' => 'datetime',
'recertified_at' => 'datetime',
'joined_at' => 'datetime',
'birthday' => 'datetime',
'efz' => 'datetime',
'ps_at' => 'datetime',
'more_ps_at' => 'datetime',
'without_education_at' => 'datetime',
'without_efz_at' => 'datetime',
]; ];
/** /**
@ -185,7 +177,7 @@ class Member extends Model implements Geolocatable
public function getAge(): ?int public function getAge(): ?int
{ {
return $this->birthday ? intval($this->birthday->diffInYears(now())) : null; return $this->birthday?->diffInYears(now());
} }
protected function getAusstand(): int protected function getAusstand(): int
@ -409,14 +401,14 @@ class Member extends Model implements Geolocatable
return $query->where('group_id', $group->id); return $query->where('group_id', $group->id);
} }
public static function fromVcard(string $url, string $data): self public static function fromVcard(string $url, string $data): static
{ {
$settings = app(NamiSettings::class); $settings = app(NamiSettings::class);
$card = Reader::read($data); $card = Reader::read($data);
[$lastname, $firstname] = $card->N->getParts(); [$lastname, $firstname] = $card->N->getParts();
[$deprecated1, $deprecated2, $address, $location, $region, $zip, $country] = $card->ADR->getParts(); [$deprecated1, $deprecated2, $address, $location, $region, $zip, $country] = $card->ADR->getParts();
return new self([ return new static([
'joined_at' => now(), 'joined_at' => now(),
'send_newspaper' => false, 'send_newspaper' => false,
'firstname' => $firstname, 'firstname' => $firstname,
@ -546,7 +538,6 @@ class Member extends Model implements Geolocatable
'group_name' => $this->group->inner_name ?: $this->group->name, 'group_name' => $this->group->inner_name ?: $this->group->name,
'links' => [ 'links' => [
'show' => route('member.show', ['member' => $this], false), 'show' => route('member.show', ['member' => $this], false),
'edit' => route('member.edit', ['member' => $this], false),
], ],
'age_group_icon' => $this->ageGroupMemberships->first()?->subactivity->slug, 'age_group_icon' => $this->ageGroupMemberships->first()?->subactivity->slug,
'is_leader' => $this->leaderMemberships()->count() > 0, 'is_leader' => $this->leaderMemberships()->count() > 0,

View File

@ -4,6 +4,7 @@ namespace App\Member;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Setting\NamiSettings; use App\Setting\NamiSettings;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Inertia\Response; use Inertia\Response;
@ -27,17 +28,6 @@ class MemberController extends Controller
]); ]);
} }
public function create(): Response
{
session()->put('menu', 'member');
session()->put('title', 'Mitglied erstellen');
return Inertia::render('member/VForm', [
'mode' => 'create',
'meta' => MemberResource::meta(),
]);
}
public function store(MemberRequest $request, NamiSettings $settings): RedirectResponse public function store(MemberRequest $request, NamiSettings $settings): RedirectResponse
{ {
$request->persistCreate($settings); $request->persistCreate($settings);
@ -45,27 +35,14 @@ class MemberController extends Controller
return redirect()->route('member.index'); return redirect()->route('member.index');
} }
public function edit(Member $member, Request $request): Response public function update(Member $member, MemberRequest $request): JsonResponse
{
session()->put('menu', 'member');
session()->put('title', "Mitglied {$member->firstname} {$member->lastname} bearbeiten");
return Inertia::render('member/VForm', [
'data' => new MemberResource($member),
'mode' => 'edit',
'conflict' => '1' === $request->query('conflict', '0'),
'meta' => MemberResource::meta(),
]);
}
public function update(Member $member, MemberRequest $request): RedirectResponse
{ {
try { try {
$request->persistUpdate($member); $request->persistUpdate($member);
} catch (ConflictException $e) { } catch (ConflictException $e) {
return redirect()->route('member.edit', ['member' => $member, 'conflict' => '1']); return response()->json([], 409);
} }
return redirect()->route('member.index'); return response()->json([]);
} }
} }

View File

@ -83,7 +83,6 @@ class MemberRequest extends FormRequest
'other_country' => '', 'other_country' => '',
'salutation' => '', 'salutation' => '',
'comment' => '', 'comment' => '',
'keepdata' => 'boolean',
]; ];
} }

View File

@ -106,13 +106,12 @@ class MemberResource extends JsonResource
'lat' => $this->lat, 'lat' => $this->lat,
'lon' => $this->lon, 'lon' => $this->lon,
'group_name' => $this->group->name, 'group_name' => $this->group->name,
'keepdata' => $this->keepdata,
'links' => [ 'links' => [
'membership_index' => route('member.membership.index', ['member' => $this->getModel()]), 'membership_index' => route('member.membership.index', ['member' => $this->getModel()]),
'invoiceposition_index' => route('member.invoice-position.index', ['member' => $this->getModel()]), 'invoiceposition_index' => route('member.invoice-position.index', ['member' => $this->getModel()]),
'course_index' => route('member.course.index', ['member' => $this->getModel()]), 'course_index' => route('member.course.index', ['member' => $this->getModel()]),
'show' => route('member.show', ['member' => $this->getModel()]), 'show' => route('member.show', ['member' => $this->getModel()]),
'edit' => route('member.edit', ['member' => $this->getModel()]), 'update' => route('member.update', ['member' => $this->getModel()]),
], ],
]; ];
} }
@ -156,7 +155,7 @@ class MemberResource extends JsonResource
'members' => Member::ordered()->get()->map(fn ($member) => ['id' => $member->id, 'name' => $member->fullname]), 'members' => Member::ordered()->get()->map(fn ($member) => ['id' => $member->id, 'name' => $member->fullname]),
'links' => [ 'links' => [
'index' => route('member.index'), 'index' => route('member.index'),
'create' => route('member.create'), 'store' => route('member.store'),
], ],
'default_membership_filter' => [ 'default_membership_filter' => [
'group_ids' => [], 'group_ids' => [],
@ -203,7 +202,6 @@ class MemberResource extends JsonResource
'has_svk' => false, 'has_svk' => false,
'multiply_pv' => false, 'multiply_pv' => false,
'multiply_more_pv' => false, 'multiply_more_pv' => false,
'keepdata' => false,
] ]
]; ];
} }

View File

@ -6,7 +6,6 @@ use App\Activity;
use App\Group; use App\Group;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use App\Subactivity; use App\Subactivity;
use Database\Factories\Member\MembershipFactory;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -17,7 +16,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
*/ */
class Membership extends Model class Membership extends Model
{ {
/** @use HasFactory<MembershipFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;

View File

@ -3,13 +3,11 @@
namespace App; namespace App;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use Database\Factories\NationalityFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Nationality extends Model class Nationality extends Model
{ {
/** @use HasFactory<NationalityFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;

View File

@ -3,7 +3,6 @@
namespace App\Payment; namespace App\Payment;
use App\Fee; use App\Fee;
use Database\Factories\Payment\SubscriptionFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -11,7 +10,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class Subscription extends Model class Subscription extends Model
{ {
/** @use HasFactory<SubscriptionFactory> */
use HasFactory; use HasFactory;
/** /**

View File

@ -2,14 +2,12 @@
namespace App\Payment; namespace App\Payment;
use Database\Factories\Payment\SubscriptionChildFactory;
use Illuminate\Database\Eloquent\Concerns\HasUuids; use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class SubscriptionChild extends Model class SubscriptionChild extends Model
{ {
/** @use HasFactory<SubscriptionChildFactory> */
use HasFactory; use HasFactory;
use HasUuids; use HasUuids;

View File

@ -21,6 +21,7 @@ class AppServiceProvider extends ServiceProvider
public function register() public function register()
{ {
JsonResource::withoutWrapping(); JsonResource::withoutWrapping();
Telescope::ignoreMigrations();
\Inertia::share('search', request()->query('search', '')); \Inertia::share('search', request()->query('search', ''));

View File

@ -2,14 +2,12 @@
namespace App; namespace App;
use Database\Factories\RegionFactory;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Region extends Model class Region extends Model
{ {
/** @use HasFactory<RegionFactory> */
use HasFactory; use HasFactory;
public $timestamps = false; public $timestamps = false;

View File

@ -4,14 +4,12 @@ namespace App;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use Cviebrock\EloquentSluggable\Sluggable; use Cviebrock\EloquentSluggable\Sluggable;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Subactivity extends Model class Subactivity extends Model
{ {
/** @use HasFactory<UserFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;
use Sluggable; use Sluggable;

View File

@ -3,14 +3,12 @@
namespace App; namespace App;
use App\Auth\ResetPassword; use App\Auth\ResetPassword;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
class User extends Authenticatable class User extends Authenticatable
{ {
/** @use HasFactory<UserFactory> */
use HasFactory; use HasFactory;
use Notifiable; use Notifiable;

View File

@ -6,5 +6,3 @@ 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 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 sudo mysql scoutrobot < db.tmp
rm 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,17 +1,5 @@
#!/bin/bash #!/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 new-session -d -s test
tmux send-keys -t test "a serve" Enter tmux send-keys -t test "a serve" Enter
@ -24,11 +12,11 @@ tmux send-keys -t test "SS start docker && duu socketi" Enter
tmux new-window -t test tmux new-window -t test
tmux send-keys -t test "nrh" Enter tmux send-keys -t test "nrh" Enter
$WEB && tmux new-window -t test tmux new-window -t test
$WEB && tmux send-keys -t test "ggwdk && cd plugins/silva/adrema/assets/vendor/adrema-form && nrd" Enter tmux send-keys -t test "ggwdk && cd plugins/silva/adrema/assets/vendor/adrema-form && nrd" Enter
$FILESHARE && tmux new-window -t test tmux new-window -t test
$FILESHARE && tmux send-keys -t test "cd tests/Fileshare && docker compose up" Enter tmux send-keys -t test "cd tests/Fileshare && docker compose up" Enter
tmux attach-session -t test tmux attach-session -t test

View File

@ -45,34 +45,35 @@
], ],
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^8.3", "php": "^8.1",
"barryvdh/laravel-debugbar": "^3.9", "barryvdh/laravel-debugbar": "^3.9",
"cviebrock/eloquent-sluggable": "^11.0", "beyondcode/laravel-dump-server": "^1.8",
"cviebrock/eloquent-sluggable": "^9.0",
"doctrine/dbal": "^3.1", "doctrine/dbal": "^3.1",
"guzzlehttp/guzzle": "^7.0.1", "guzzlehttp/guzzle": "^7.0.1",
"inertiajs/inertia-laravel": "^1.0", "inertiajs/inertia-laravel": "^0.6.9",
"laravel/framework": "^11.0", "laravel/framework": "^9.0",
"laravel/horizon": "^5.0", "laravel/horizon": "^5.0",
"laravel/pail": "^1.1", "laravel/passport": "^11.8",
"laravel/passport": "^12.8", "laravel/scout": "^9.8",
"laravel/scout": "^10.8", "laravel/telescope": "^4.13",
"laravel/telescope": "^5.0",
"laravel/tinker": "^2.0", "laravel/tinker": "^2.0",
"laravel/ui": "^4.0", "laravel/ui": "^3.0",
"league/csv": "^9.9", "league/csv": "^9.9",
"league/flysystem-webdav": "dev-master as 3.28.0",
"lorisleiva/laravel-actions": "^2.4", "lorisleiva/laravel-actions": "^2.4",
"meilisearch/meilisearch-php": "^1.6", "meilisearch/meilisearch-php": "^1.6",
"monicahq/laravel-sabre": "^1.6", "monicahq/laravel-sabre": "^1.6",
"nunomaduro/collision": "^8.1", "nunomaduro/collision": "^6.1",
"phake/phake": "^4.2", "phake/phake": "^4.2",
"pusher/pusher-php-server": "^7.2", "pusher/pusher-php-server": "^7.2",
"spatie/laravel-data": "^4.0", "spatie/laravel-data": "^3.0",
"spatie/laravel-ignition": "^2.0", "spatie/laravel-ignition": "^1.0",
"spatie/laravel-settings": "^3.0", "spatie/laravel-medialibrary": "^10.0",
"worksome/request-factories": "^3.0", "spatie/laravel-settings": "^2.2",
"worksome/request-factories": "^2.5",
"zoomyboy/laravel-nami": "dev-master", "zoomyboy/laravel-nami": "dev-master",
"zoomyboy/medialibrary-helper": "dev-master as 1.0", "zoomyboy/medialibrary-helper": "dev-master as 1.0",
"league/flysystem-webdav": "dev-master as 3.28.0",
"zoomyboy/osm": "1.0.3", "zoomyboy/osm": "1.0.3",
"zoomyboy/phone": "^1.0", "zoomyboy/phone": "^1.0",
"zoomyboy/table-document": "dev-master as 1.0", "zoomyboy/table-document": "dev-master as 1.0",
@ -80,12 +81,12 @@
}, },
"require-dev": { "require-dev": {
"fakerphp/faker": "^1.9.1", "fakerphp/faker": "^1.9.1",
"larastan/larastan": "^2.0",
"laravel/envoy": "^2.8", "laravel/envoy": "^2.8",
"mockery/mockery": "^1.4.4", "mockery/mockery": "^1.4.4",
"orchestra/testbench": "^9.0", "larastan/larastan": "^2.0",
"pestphp/pest": "^3.0", "orchestra/testbench": "^7.0",
"phpstan/phpstan-mockery": "^1.1" "phpstan/phpstan-mockery": "^1.1",
"phpunit/phpunit": "^9.5.10"
}, },
"config": { "config": {
"optimize-autoloader": true, "optimize-autoloader": true,

4578
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -69,23 +69,6 @@ return [
], ],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'job_batches',
],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Failed Queue Jobs | Failed Queue Jobs

View File

@ -1,7 +1,6 @@
<?php <?php
use App\Form\Models\Form; use App\Form\Models\Form;
use App\Invoice\Models\Invoice;
use App\Member\Member; use App\Member\Member;
return [ return [
@ -154,17 +153,8 @@ return [
'pagination' => [ 'pagination' => [
'maxTotalHits' => 1000000, 'maxTotalHits' => 1000000,
] ]
],
Invoice::class => [
'filterableAttributes' => ['to', 'usage', 'greeting', 'mail_email', 'status', 'id'],
'searchableAttributes' => ['to', 'usage', 'greeting', 'mail_email', 'status', 'id'],
'sortableAttributes' => [],
'displayedAttributes' => ['to', 'usage', 'greeting', 'mail_email', 'status', 'id'],
'pagination' => [
'maxTotalHits' => 1000000,
] ]
], ],
], ],
],
]; ];

View File

@ -7,7 +7,6 @@ use App\Form\Models\Form;
use App\Lib\Editor\Condition; use App\Lib\Editor\Condition;
use Database\Factories\Traits\FakesMedia; use Database\Factories\Traits\FakesMedia;
use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
use Tests\Feature\Form\FormtemplateFieldRequest; use Tests\Feature\Form\FormtemplateFieldRequest;
use Tests\Feature\Form\FormtemplateSectionRequest; use Tests\Feature\Form\FormtemplateSectionRequest;
use Tests\RequestFactories\EditorRequestFactory; use Tests\RequestFactories\EditorRequestFactory;
@ -49,8 +48,8 @@ class FormFactory extends Factory
'config' => ['sections' => []], 'config' => ['sections' => []],
'from' => $this->faker->dateTimeBetween('+1 week', '+4 weeks')->format('Y-m-d H:i:s'), 'from' => $this->faker->dateTimeBetween('+1 week', '+4 weeks')->format('Y-m-d H:i:s'),
'to' => $this->faker->dateTimeBetween('+1 week', '+4 weeks')->format('Y-m-d H:i:s'), 'to' => $this->faker->dateTimeBetween('+1 week', '+4 weeks')->format('Y-m-d H:i:s'),
'registration_from' => $this->faker->dateTimeBetween(Carbon::parse('-2 weeks'), now())->format('Y-m-d H:i:s'), 'registration_from' => $this->faker->dateTimeBetween('-2 weeks', 'now')->format('Y-m-d H:i:s'),
'registration_until' => $this->faker->dateTimeBetween(now(), Carbon::parse('+2 weeks'))->format('Y-m-d H:i:s'), 'registration_until' => $this->faker->dateTimeBetween('now', '+2 weeks')->format('Y-m-d H:i:s'),
'mail_top' => EditorRequestFactory::new()->toData(), 'mail_top' => EditorRequestFactory::new()->toData(),
'mail_bottom' => EditorRequestFactory::new()->toData(), 'mail_bottom' => EditorRequestFactory::new()->toData(),
'is_active' => true, 'is_active' => true,

View File

@ -36,7 +36,6 @@ class MemberFactory extends Factory
'location' => $this->faker->city, 'location' => $this->faker->city,
'email' => $this->faker->safeEmail(), 'email' => $this->faker->safeEmail(),
'recertified_at' => null, 'recertified_at' => null,
'keepdata' => false,
]; ];
} }

View File

@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('settings', function (Blueprint $table): void {
$table->boolean('locked')->default(false)->change();
$table->unique(['group', 'name']);
$table->dropIndex(['group']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('settings', function (Blueprint $table): void {
$table->boolean('locked')->default(null)->change();
$table->dropUnique(['group', 'name']);
$table->index('group');
});
}
};

View File

@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('members', function (Blueprint $table) {
$table->boolean('keepdata')->after('email_parents')->default(false);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('members', function (Blueprint $table) {
$table->dropColumn('keepdata');
});
}
};

View File

@ -1,31 +0,0 @@
<?php
use App\Form\Actions\UpdateParticipantSearchIndexAction;
use App\Form\Models\Form;
use App\Lib\Sorting;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
foreach (Form::get() as $form) {
UpdateParticipantSearchIndexAction::run($form);
foreach ($form->participants as $participant) {
$participant->searchable();
}
$form->updateQuietly(['meta' => [...$form->meta, 'sorting' => Sorting::by('id')]]);
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};

View File

@ -1,27 +0,0 @@
<?php
use App\Invoice\Models\Invoice;
use Illuminate\Database\Migrations\Migration;
use Laravel\Scout\Console\SyncIndexSettingsCommand;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Artisan::call(SyncIndexSettingsCommand::class);
foreach (Invoice::get() as $invoice) {
$invoice->searchable();
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};

View File

@ -1,30 +0,0 @@
<?php
use App\Form\Actions\UpdateParticipantSearchIndexAction;
use App\Form\Models\Form;
use App\Lib\Sorting;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
foreach (Form::get() as $form) {
UpdateParticipantSearchIndexAction::run($form);
foreach ($form->participants as $participant) {
$participant->searchable();
}
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};

View File

@ -92,6 +92,8 @@ services:
socketi: socketi:
image: quay.io/soketi/soketi:89604f268623cf799573178a7ba56b7491416bde-16-debian image: quay.io/soketi/soketi:89604f268623cf799573178a7ba56b7491416bde-16-debian
ports:
- '6001:6001'
environment: environment:
SOKETI_DEFAULT_APP_ID: adremaid SOKETI_DEFAULT_APP_ID: adremaid
SOKETI_DEFAULT_APP_KEY: adremakey SOKETI_DEFAULT_APP_KEY: adremakey
@ -104,6 +106,8 @@ services:
meilisearch: meilisearch:
image: getmeili/meilisearch:v1.6 image: getmeili/meilisearch:v1.6
ports:
- '7700:7700'
volumes: volumes:
- ./data/meilisearch:/meili_data - ./data/meilisearch:/meili_data
env_file: env_file:

@ -1 +1 @@
Subproject commit bc61530e510b3d41048984b7cf20b6d82c4f85fb Subproject commit 84103d40521d77f936635a7f992cf1ae4b01dafe

@ -1 +1 @@
Subproject commit 424ca30932610dcef496640e4097644ed404f13b Subproject commit 59d7647720ab2791e954944b38c986143db9de8e

@ -1 +1 @@
Subproject commit 7304963370ff64fb5accf08da4864981cc424301 Subproject commit 8aefd17b06ee3c26d00b472a154a48898b884d15

View File

@ -10,6 +10,7 @@ parameters:
paths: paths:
- app - app
- tests
- database - database
- packages/tex/src - packages/tex/src
- packages/laravel-nami/src - packages/laravel-nami/src
@ -28,11 +29,6 @@ parameters:
AddressBookCard: 'array{lastmodified: int, etag: string, uri: string, id: int, size: int}' AddressBookCard: 'array{lastmodified: int, etag: string, uri: string, id: int, size: int}'
ignoreErrors: ignoreErrors:
-
message: "#but does not specify its types: TData#"
-
message: "#cast\\(\\) has parameter \\$properties#"
- -
message: "#^Method App\\\\Activity\\:\\:sluggable\\(\\) return type has no value type specified in iterable type array\\.$#" message: "#^Method App\\\\Activity\\:\\:sluggable\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1 count: 1
@ -63,6 +59,11 @@ parameters:
count: 1 count: 1
path: app/Member/Member.php path: app/Member/Member.php
-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: app/Member/Member.php
- -
message: "#^Method App\\\\Member\\\\MemberRequest\\:\\:rules\\(\\) return type has no value type specified in iterable type array\\.$#" message: "#^Method App\\\\Member\\\\MemberRequest\\:\\:rules\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1 count: 1
@ -393,6 +394,16 @@ parameters:
count: 1 count: 1
path: tests/Feature/Member/DavTest.php path: tests/Feature/Member/DavTest.php
-
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$email\\.$#"
count: 2
path: app/Maildispatcher/Actions/ResyncAction.php
-
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$email_parents\\.$#"
count: 2
path: app/Maildispatcher/Actions/ResyncAction.php
- -
message: "#^Unable to resolve the template type TKey in call to function collect$#" message: "#^Unable to resolve the template type TKey in call to function collect$#"
count: 2 count: 2
@ -502,8 +513,3 @@ parameters:
message: "#^Call to an undefined method Phake\\\\Proxies\\\\VerifierProxy\\:\\:handle\\(\\)\\.$#" message: "#^Call to an undefined method Phake\\\\Proxies\\\\VerifierProxy\\:\\:handle\\(\\)\\.$#"
count: 2 count: 2
path: tests/Feature/Member/NamiPutMemberActionTest.php path: tests/Feature/Member/NamiPutMemberActionTest.php
-
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\Relation\\<\\*, \\*, \\*\\>\\:\\:isTrying\\(\\)\\.$#"
count: 1
path: app/Membership/TestersBlock.php

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache"> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<testsuites> <testsuites>
<testsuite name="Unit"> <testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory> <directory suffix="Test.php">./tests/Unit</directory>
@ -10,9 +13,6 @@
<testsuite name="Fileshare"> <testsuite name="Fileshare">
<directory suffix="Test.php">./tests/Fileshare</directory> <directory suffix="Test.php">./tests/Fileshare</directory>
</testsuite> </testsuite>
<testsuite name="Arch">
<file>tests/Arch.php</file>
</testsuite>
<testsuite name="NamiUnit"> <testsuite name="NamiUnit">
<directory suffix="Test.php">./packages/laravel-nami/tests/Unit</directory> <directory suffix="Test.php">./packages/laravel-nami/tests/Unit</directory>
</testsuite> </testsuite>
@ -20,6 +20,11 @@
<directory suffix="Test.php">./tests/EndToEnd</directory> <directory suffix="Test.php">./tests/EndToEnd</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php> <php>
<server name="APP_ENV" value="testing"/> <server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/> <server name="BCRYPT_ROUNDS" value="4"/>
@ -30,9 +35,4 @@
<server name="SESSION_DRIVER" value="array"/> <server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/> <server name="TELESCOPE_ENABLED" value="false"/>
</php> </php>
<source>
<include>
<directory suffix=".php">./app</directory>
</include>
</source>
</phpunit> </phpunit>

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