Compare commits
129 Commits
Author | SHA1 | Date |
---|---|---|
|
146b7dd6e3 | |
|
dafda4883d | |
|
e6526ee326 | |
|
44e8da9a37 | |
|
4e43609619 | |
|
32246e534e | |
|
4b50c85fd6 | |
|
e5ecd0a2c0 | |
|
e06f924304 | |
|
6463997f8f | |
|
247a89ae77 | |
|
6c3c8b5703 | |
|
5fe1004871 | |
|
4f9bfa0f75 | |
|
a27e86ffcc | |
|
c8e268d91b | |
|
10b71f7a36 | |
|
144af1bf71 | |
|
17808c6eb1 | |
|
427f45373e | |
|
a1981c7dec | |
|
4497084ae6 | |
|
f2090aa9d0 | |
|
6b7de1446f | |
|
f8d2be9df5 | |
|
722237f486 | |
|
51af9d427e | |
|
b0fd584397 | |
|
aab004f1f1 | |
|
79d92a6567 | |
|
a136085d2b | |
|
67fe88c9b4 | |
|
36932f8417 | |
|
3f92a48f29 | |
|
e396714d31 | |
|
af13bb1cde | |
|
bd86e65c8c | |
|
8ea566c400 | |
|
d74fcab024 | |
|
392a34b5c7 | |
|
04ddcdb0d5 | |
|
bfdb591baf | |
|
890201817f | |
|
5a2707ccac | |
|
b2153e647d | |
|
392e385682 | |
|
88bb1091a9 | |
|
e2d489d83f | |
|
dce7c26b7e | |
|
4b38296687 | |
|
634a13b4dd | |
|
0bb1d2b309 | |
|
d0bd5bb0de | |
|
b86fe9634f | |
|
752a5d7c29 | |
|
9f0516ad55 | |
|
2e1df9791d | |
|
ce976c1108 | |
|
4d25f5e56d | |
|
21cebfc04a | |
|
d53a6d23d2 | |
|
ccef61352d | |
|
5be7987d80 | |
|
ac592920e7 | |
|
68651b6c16 | |
|
cff62ebc1d | |
|
c3ecb9dc63 | |
|
ab442dff9b | |
|
88e020ac4e | |
|
d7361b6713 | |
|
4538ec8ca8 | |
|
6032b9c289 | |
|
6da6453b5d | |
|
66b6a549c3 | |
|
878de3f566 | |
|
aa55b56df7 | |
|
31c582e81d | |
|
adf9341dd7 | |
|
9853d4e82e | |
|
4698c808f8 | |
|
ea2eb08052 | |
|
09f401055a | |
|
2c786b62ce | |
|
4cd18e9b3c | |
|
9d41cdb010 | |
|
e429d7de76 | |
|
52a6491488 | |
|
9628ba34d2 | |
|
5361c3930f | |
|
e97d39abd7 | |
|
419b4227eb | |
|
63b57f3da7 | |
|
0ea3f4adce | |
|
363c4360b8 | |
|
3182dc7edd | |
|
7346c2da47 | |
|
95a466ff22 | |
|
e047b9a4f2 | |
|
0311787eec | |
|
fba42fa1d8 | |
|
fe50cf129f | |
|
27f805700e | |
|
f33a23ecc3 | |
|
103e13966f | |
|
b2117cdecf | |
|
177b661d50 | |
|
1c0a2361d6 | |
|
4ed6375202 | |
|
f9c4e32ba2 | |
|
1780e3bce8 | |
|
bf4cfdf7fd | |
|
057002b8e8 | |
|
99731fd08f | |
|
919041d2cf | |
|
47b5abc0f1 | |
|
ea79290435 | |
|
4f21dfceee | |
|
196b81a82d | |
|
83d721c1ca | |
|
027a159a1c | |
|
da8dd12dad | |
|
a482e16739 | |
|
010ad80793 | |
|
741a4a24b7 | |
|
4ecf2f4483 | |
|
fc2b3d6885 | |
|
d07a9a8372 | |
|
64511479ef | |
|
25cf073fc7 |
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:vue/vue3-recommended",
|
||||
"prettier"
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"vue"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.vue"
|
||||
],
|
||||
"rules": {
|
||||
"vue/multi-word-component-names": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
34
CHANGELOG.md
34
CHANGELOG.md
|
@ -1,5 +1,39 @@
|
|||
# Letzte Änderungen
|
||||
|
||||
### 1.12.19
|
||||
|
||||
- Zuschusslisten können nun aus Veranstaltungs-Daten erstellt werden
|
||||
- Veranstaltungs-Übersicht zeigt nun Tags an
|
||||
|
||||
### 1.12.18
|
||||
|
||||
- Fix: Initialisierung klappt nun auch, wenn Mitgliedsnummer mit einer 0 beginnt
|
||||
|
||||
### 1.12.17
|
||||
|
||||
- Fix: Mitgliedschaften werden beim Sammel-Speichern nicht mehr doppelt angelegt
|
||||
|
||||
### 1.12.16
|
||||
|
||||
- Mitgliedschaften können nun bei Mitgliedschaften-Übersicht gelöscht werden
|
||||
|
||||
### 1.12.15
|
||||
|
||||
- Bestätigung wird eingeblendet beim Kopieren eines Events
|
||||
|
||||
### 1.12.14
|
||||
|
||||
- Bilder werden nun mitkopiert beim Kopieren eines Events
|
||||
|
||||
### 1.12.13
|
||||
|
||||
- Kopieren von bestehenden Veranstaltungen
|
||||
- Präventions-Erinnerung automatisch versenden
|
||||
|
||||
### 1.12.11
|
||||
|
||||
- Fix: Bank Account mit abrufen wenn Mitglied editiert wird
|
||||
|
||||
### 1.12.7
|
||||
|
||||
- Fix: Synchronisation von allen Mitgliedern bei Mail-Verteilern - nicht nur den ersten 20
|
||||
|
|
|
@ -54,6 +54,7 @@ class ActivityResource extends JsonResource
|
|||
'index' => route('activity.index'),
|
||||
'create' => route('activity.create'),
|
||||
'membership_masslist' => route('membership.masslist.index'),
|
||||
'membership_index' => route('membership.index'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ use App\Actions\DbMaintainAction;
|
|||
use App\Form\Actions\PreventionRememberAction;
|
||||
use App\Initialize\InitializeMembers;
|
||||
use App\Invoice\Actions\InvoiceSendAction;
|
||||
use App\Prevention\Actions\YearlyRememberAction;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
|
@ -21,6 +22,7 @@ class Kernel extends ConsoleKernel
|
|||
InitializeMembers::class,
|
||||
DbMaintainAction::class,
|
||||
PreventionRememberAction::class,
|
||||
YearlyRememberAction::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -34,6 +36,7 @@ class Kernel extends ConsoleKernel
|
|||
$schedule->command(InitializeMembers::class)->dailyAt('03:00');
|
||||
$schedule->command(PreventionRememberAction::class)->dailyAt('11:00');
|
||||
$schedule->command(InvoiceSendAction::class)->dailyAt('10:00');
|
||||
$schedule->command(YearlyRememberAction::class)->dailyAt('09:00');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace App\Contribution\Actions;
|
||||
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Contribution\ContributionFactory;
|
||||
use App\Contribution\Documents\ContributionDocument;
|
||||
use App\Contribution\Requests\GenerateRequest;
|
||||
use App\Rules\JsonBase64Rule;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Lorisleiva\Actions\ActionRequest;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
use Zoomyboy\Tex\BaseCompiler;
|
||||
use Zoomyboy\Tex\Tex;
|
||||
|
@ -15,23 +15,19 @@ class GenerateAction
|
|||
{
|
||||
use AsAction;
|
||||
|
||||
/**
|
||||
* @param class-string<ContributionDocument> $document
|
||||
* @param array<string, mixed> $payload
|
||||
*/
|
||||
public function handle(string $document, array $payload): BaseCompiler
|
||||
public function handle(HasContributionData $request): BaseCompiler
|
||||
{
|
||||
return Tex::compile($document::fromRequest($payload));
|
||||
return Tex::compile($request->type()::fromPayload($request));
|
||||
}
|
||||
|
||||
public function asController(ActionRequest $request): BaseCompiler
|
||||
public function asController(GenerateRequest $request): BaseCompiler|JsonResponse
|
||||
{
|
||||
$payload = $this->payload($request);
|
||||
$type = data_get($payload, 'type');
|
||||
ValidateAction::validateType($type);
|
||||
Validator::make($payload, app(ContributionFactory::class)->rules($type))->validate();
|
||||
app(ContributionFactory::class)->validateType($request);
|
||||
$request->validateContribution();
|
||||
|
||||
return $this->handle($type, $payload);
|
||||
return $request->input('validate')
|
||||
? response()->json([])
|
||||
: $this->handle($request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,12 +39,4 @@ class GenerateAction
|
|||
'payload' => [new JsonBase64Rule()],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
private function payload(ActionRequest $request): array
|
||||
{
|
||||
return json_decode(rawurldecode(base64_decode($request->input('payload', ''))), true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
namespace App\Contribution\Actions;
|
||||
|
||||
use App\Contribution\Documents\ContributionDocument;
|
||||
use Lorisleiva\Actions\ActionRequest;
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Contribution\ContributionFactory;
|
||||
use App\Contribution\Requests\GenerateApiRequest;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
use Zoomyboy\Tex\BaseCompiler;
|
||||
use Zoomyboy\Tex\Tex;
|
||||
|
@ -13,26 +14,17 @@ class GenerateApiAction
|
|||
use AsAction;
|
||||
|
||||
/**
|
||||
* @param class-string<ContributionDocument> $document
|
||||
* @param array<string, mixed> $payload
|
||||
* @todo merge this with GenerateAction
|
||||
*/
|
||||
public function handle(string $document, array $payload): BaseCompiler
|
||||
public function handle(HasContributionData $request): BaseCompiler
|
||||
{
|
||||
return Tex::compile($document::fromApiRequest($payload));
|
||||
return Tex::compile($request->type()::fromPayload($request));
|
||||
}
|
||||
|
||||
public function asController(ActionRequest $request): BaseCompiler
|
||||
public function asController(GenerateApiRequest $request): BaseCompiler
|
||||
{
|
||||
ValidateAction::validateType($request->input('type'));
|
||||
app(ContributionFactory::class)->validateType($request);
|
||||
|
||||
return $this->handle($request->input('type'), $request->input());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [];
|
||||
return $this->handle($request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Contribution\Actions;
|
||||
|
||||
use App\Contribution\ContributionFactory;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Lorisleiva\Actions\ActionRequest;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
||||
class ValidateAction
|
||||
{
|
||||
use AsAction;
|
||||
|
||||
public function asController(): JsonResponse
|
||||
{
|
||||
return response()->json(['valid' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return app(ContributionFactory::class)->rules(request()->type);
|
||||
}
|
||||
|
||||
public function prepareForValidation(ActionRequest $request): void
|
||||
{
|
||||
static::validateType($request->input('type'));
|
||||
}
|
||||
|
||||
public static function validateType(?string $type = null): void
|
||||
{
|
||||
Validator::make(['type' => $type], app(ContributionFactory::class)->typeRule())->validate();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Contribution\Contracts;
|
||||
|
||||
use App\Contribution\Data\MemberData;
|
||||
use Carbon\Carbon;
|
||||
use App\Contribution\Documents\ContributionDocument;
|
||||
use App\Country;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
interface HasContributionData {
|
||||
|
||||
public function dateFrom(): Carbon;
|
||||
public function dateUntil(): Carbon;
|
||||
public function zipLocation(): string;
|
||||
public function eventName(): string;
|
||||
/**
|
||||
* @return class-string<ContributionDocument>
|
||||
*/
|
||||
public function type(): string;
|
||||
|
||||
/**
|
||||
* @return Collection<int, MemberData>
|
||||
*/
|
||||
public function members(): Collection;
|
||||
|
||||
public function country(): ?Country;
|
||||
|
||||
public function validateContribution(): void;
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Contribution;
|
||||
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Contribution\Documents\BdkjHesse;
|
||||
use App\Contribution\Documents\ContributionDocument;
|
||||
use App\Contribution\Documents\RdpNrwDocument;
|
||||
|
@ -10,6 +11,7 @@ use App\Contribution\Documents\CitySolingenDocument;
|
|||
use App\Contribution\Documents\CityFrankfurtMainDocument;
|
||||
use App\Contribution\Documents\WuppertalDocument;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ContributionFactory
|
||||
|
@ -27,13 +29,13 @@ class ContributionFactory
|
|||
];
|
||||
|
||||
/**
|
||||
* @return Collection<int, array{title: string, class: class-string<ContributionDocument>}>
|
||||
* @return Collection<int, array{name: string, id: class-string<ContributionDocument>}>
|
||||
*/
|
||||
public function compilerSelect(): Collection
|
||||
{
|
||||
return collect($this->documents)->map(fn ($document) => [
|
||||
'title' => $document::buttonName(),
|
||||
'class' => $document,
|
||||
'name' => $document::getName(),
|
||||
'id' => $document,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -59,4 +61,9 @@ class ContributionFactory
|
|||
...$type::rules(),
|
||||
];
|
||||
}
|
||||
|
||||
public function validateType(HasContributionData $request): void {
|
||||
Validator::make(['type' => $request->type()], $this->typeRule())->validate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class MemberData extends Data
|
|||
return collect($data)->map(fn ($member) => self::factory()->withoutMagicalCreation()->from([
|
||||
...$member,
|
||||
'birthday' => Carbon::parse($member['birthday'])->toAtomString(),
|
||||
'gender' => Gender::fromString($member['gender']),
|
||||
'gender' => $member['gender'] ? Gender::fromString($member['gender']) : null,
|
||||
'isLeader' => $member['is_leader'],
|
||||
]));
|
||||
}
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
namespace App\Contribution\Documents;
|
||||
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Contribution\Data\MemberData;
|
||||
use App\Contribution\Traits\HasPdfBackground;
|
||||
use App\Country;
|
||||
use App\Form\Enums\SpecialType;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
|
@ -17,8 +19,8 @@ class BdkjHesse extends ContributionDocument
|
|||
* @param Collection<int, Collection<int, MemberData>> $members
|
||||
*/
|
||||
public function __construct(
|
||||
public string $dateFrom,
|
||||
public string $dateUntil,
|
||||
public Carbon $dateFrom,
|
||||
public Carbon $dateUntil,
|
||||
public string $zipLocation,
|
||||
public ?Country $country,
|
||||
public Collection $members,
|
||||
|
@ -39,33 +41,15 @@ class BdkjHesse extends ContributionDocument
|
|||
return Carbon::parse($this->dateUntil)->format('d.m.Y');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function fromRequest(array $request): self
|
||||
public static function fromPayload(HasContributionData $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(20),
|
||||
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(20),
|
||||
eventName: $request['eventName'],
|
||||
dateFrom: $request->dateFrom(),
|
||||
dateUntil: $request->dateUntil(),
|
||||
zipLocation: $request->zipLocation(),
|
||||
country: $request->country(),
|
||||
members: $request->members()->chunk(20),
|
||||
eventName: $request->eventName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -133,4 +117,15 @@ class BdkjHesse extends ContributionDocument
|
|||
'zipLocation' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
||||
public static function requiredFormSpecialTypes(): array {
|
||||
return [
|
||||
SpecialType::FIRSTNAME,
|
||||
SpecialType::LASTNAME,
|
||||
SpecialType::BIRTHDAY,
|
||||
SpecialType::ZIP,
|
||||
SpecialType::LOCATION,
|
||||
SpecialType::GENDER,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,15 @@
|
|||
|
||||
namespace App\Contribution\Documents;
|
||||
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Contribution\Data\MemberData;
|
||||
use App\Contribution\Traits\FormatsDates;
|
||||
use App\Contribution\Traits\HasPdfBackground;
|
||||
use App\Country;
|
||||
use App\Form\Enums\SpecialType;
|
||||
use App\Invoice\InvoiceSettings;
|
||||
use Illuminate\Support\Collection;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CityFrankfurtMainDocument extends ContributionDocument
|
||||
{
|
||||
|
@ -20,8 +23,8 @@ class CityFrankfurtMainDocument extends ContributionDocument
|
|||
* @param Collection<int, Collection<int, MemberData>> $members
|
||||
*/
|
||||
public function __construct(
|
||||
public string $dateFrom,
|
||||
public string $dateUntil,
|
||||
public Carbon $dateFrom,
|
||||
public Carbon $dateUntil,
|
||||
public string $zipLocation,
|
||||
public ?Country $country,
|
||||
public Collection $members,
|
||||
|
@ -33,33 +36,15 @@ class CityFrankfurtMainDocument extends ContributionDocument
|
|||
$this->fromName = app(InvoiceSettings::class)->from_long;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function fromRequest(array $request): self
|
||||
public static function fromPayload(HasContributionData $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(15),
|
||||
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(15),
|
||||
eventName: $request['eventName'],
|
||||
dateFrom: $request->dateFrom(),
|
||||
dateUntil: $request->dateUntil(),
|
||||
zipLocation: $request->zipLocation(),
|
||||
country: $request->country(),
|
||||
members: $request->members()->chunk(15),
|
||||
eventName: $request->eventName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -90,4 +75,15 @@ class CityFrankfurtMainDocument extends ContributionDocument
|
|||
'zipLocation' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
||||
public static function requiredFormSpecialTypes(): array {
|
||||
return [
|
||||
SpecialType::FIRSTNAME,
|
||||
SpecialType::LASTNAME,
|
||||
SpecialType::BIRTHDAY,
|
||||
SpecialType::ZIP,
|
||||
SpecialType::LOCATION,
|
||||
SpecialType::ADDRESS,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
|
||||
namespace App\Contribution\Documents;
|
||||
|
||||
use App\Contribution\Data\MemberData;
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Contribution\Traits\FormatsDates;
|
||||
use App\Contribution\Traits\HasPdfBackground;
|
||||
use App\Country;
|
||||
use App\Form\Enums\SpecialType;
|
||||
use App\Member\Member;
|
||||
use Illuminate\Support\Collection;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CityRemscheidDocument extends ContributionDocument
|
||||
{
|
||||
|
@ -19,8 +21,8 @@ class CityRemscheidDocument extends ContributionDocument
|
|||
* @param Collection<int, Collection<int, Member>> $children
|
||||
*/
|
||||
public function __construct(
|
||||
public string $dateFrom,
|
||||
public string $dateUntil,
|
||||
public Carbon $dateFrom,
|
||||
public Carbon $dateUntil,
|
||||
public string $zipLocation,
|
||||
public ?Country $country,
|
||||
public Collection $leaders,
|
||||
|
@ -32,40 +34,18 @@ class CityRemscheidDocument extends ContributionDocument
|
|||
$this->setEventName($eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function fromRequest(array $request): self
|
||||
public static function fromPayload(HasContributionData $request): self
|
||||
{
|
||||
[$leaders, $children] = MemberData::fromModels($request['members'])->partition(fn ($member) => $member->isLeader);
|
||||
[$leaders, $children] = $request->members()->partition(fn ($member) => $member->isLeader);
|
||||
|
||||
return new self(
|
||||
dateFrom: $request['dateFrom'],
|
||||
dateUntil: $request['dateUntil'],
|
||||
zipLocation: $request['zipLocation'],
|
||||
country: Country::where('id', $request['country'])->firstOrFail(),
|
||||
dateFrom: $request->dateFrom(),
|
||||
dateUntil: $request->dateUntil(),
|
||||
zipLocation: $request->zipLocation(),
|
||||
country: $request->country(),
|
||||
leaders: $leaders->values()->toBase()->chunk(6),
|
||||
children: $children->values()->toBase()->chunk(20),
|
||||
eventName: $request['eventName'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function fromApiRequest(array $request): self
|
||||
{
|
||||
$members = MemberData::fromApi($request['member_data']);
|
||||
[$leaders, $children] = $members->partition(fn ($member) => $member->isLeader);
|
||||
|
||||
return new self(
|
||||
dateFrom: $request['dateFrom'],
|
||||
dateUntil: $request['dateUntil'],
|
||||
zipLocation: $request['zipLocation'],
|
||||
country: Country::where('id', $request['country'])->firstOrFail(),
|
||||
leaders: $leaders->values()->toBase()->chunk(6),
|
||||
children: $children->values()->toBase()->chunk(20),
|
||||
eventName: $request['eventName'],
|
||||
eventName: $request->eventName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -86,4 +66,15 @@ class CityRemscheidDocument extends ContributionDocument
|
|||
'country' => 'required|integer|exists:countries,id',
|
||||
];
|
||||
}
|
||||
|
||||
public static function requiredFormSpecialTypes(): array {
|
||||
return [
|
||||
SpecialType::FIRSTNAME,
|
||||
SpecialType::LASTNAME,
|
||||
SpecialType::ADDRESS,
|
||||
SpecialType::BIRTHDAY,
|
||||
SpecialType::ZIP,
|
||||
SpecialType::LOCATION,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace App\Contribution\Documents;
|
||||
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Contribution\Data\MemberData;
|
||||
use App\Form\Enums\SpecialType;
|
||||
use App\Invoice\InvoiceSettings;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
|
@ -16,8 +18,8 @@ class CitySolingenDocument extends ContributionDocument
|
|||
* @param Collection<int, MemberData> $members
|
||||
*/
|
||||
final private function __construct(
|
||||
public string $dateFrom,
|
||||
public string $dateUntil,
|
||||
public Carbon $dateFrom,
|
||||
public Carbon $dateUntil,
|
||||
public string $zipLocation,
|
||||
public Collection $members,
|
||||
public string $eventName,
|
||||
|
@ -30,28 +32,14 @@ class CitySolingenDocument extends ContributionDocument
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function fromRequest(array $request): static
|
||||
public static function fromPayload(HasContributionData $request): static
|
||||
{
|
||||
return new static(
|
||||
dateFrom: $request['dateFrom'],
|
||||
dateUntil: $request['dateUntil'],
|
||||
zipLocation: $request['zipLocation'],
|
||||
members: MemberData::fromModels($request['members']),
|
||||
eventName: $request['eventName'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function fromApiRequest(array $request): static
|
||||
{
|
||||
return new static(
|
||||
dateFrom: $request['dateFrom'],
|
||||
dateUntil: $request['dateUntil'],
|
||||
zipLocation: $request['zipLocation'],
|
||||
members: MemberData::fromApi($request['member_data']),
|
||||
eventName: $request['eventName'],
|
||||
dateFrom: $request->dateFrom(),
|
||||
dateUntil: $request->dateUntil(),
|
||||
zipLocation: $request->zipLocation(),
|
||||
members: $request->members(),
|
||||
eventName: $request->eventName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -75,8 +63,6 @@ class CitySolingenDocument extends ContributionDocument
|
|||
|
||||
public function checkboxes(): string
|
||||
{
|
||||
$output = '';
|
||||
|
||||
$firstRow = collect(['B' => 'Jugendbildungsmaßnahme', 'G' => 'Gruppenleiter/innenschulung', 'FK' => 'Ferienkolonie', 'F' => 'Freizeitnaßnahme'])->map(function ($item, $key) {
|
||||
return ($this->type === $key ? '\\checkedcheckbox' : '\\checkbox') . '{' . $item . '}';
|
||||
})->implode(' & ') . ' \\\\';
|
||||
|
@ -109,4 +95,15 @@ class CitySolingenDocument extends ContributionDocument
|
|||
'zipLocation' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
||||
public static function requiredFormSpecialTypes(): array {
|
||||
return [
|
||||
SpecialType::FIRSTNAME,
|
||||
SpecialType::LASTNAME,
|
||||
SpecialType::BIRTHDAY,
|
||||
SpecialType::ZIP,
|
||||
SpecialType::LOCATION,
|
||||
SpecialType::ADDRESS,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App\Contribution\Documents;
|
||||
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Form\Enums\SpecialType;
|
||||
use Zoomyboy\Tex\Document;
|
||||
use Zoomyboy\Tex\Template;
|
||||
|
||||
|
@ -11,15 +13,12 @@ abstract class ContributionDocument extends Document
|
|||
|
||||
abstract public static function getName(): string;
|
||||
|
||||
/**
|
||||
* @param ContributionRequestArray $request
|
||||
*/
|
||||
abstract public static function fromRequest(array $request): self;
|
||||
abstract public static function fromPayload(HasContributionData $request): self;
|
||||
|
||||
/**
|
||||
* @param ContributionApiRequestArray $request
|
||||
* @return array<int, SpecialType>
|
||||
*/
|
||||
abstract public static function fromApiRequest(array $request): self;
|
||||
abstract public static function requiredFormSpecialTypes(): array;
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
|
@ -38,11 +37,6 @@ abstract class ContributionDocument extends Document
|
|||
];
|
||||
}
|
||||
|
||||
public static function buttonName(): string
|
||||
{
|
||||
return 'Für ' . static::getName() . ' erstellen';;
|
||||
}
|
||||
|
||||
public function setEventName(string $eventName): void
|
||||
{
|
||||
$this->eventName = $eventName;
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
|
||||
namespace App\Contribution\Documents;
|
||||
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Contribution\Data\MemberData;
|
||||
use App\Contribution\Traits\FormatsDates;
|
||||
use App\Contribution\Traits\HasPdfBackground;
|
||||
use App\Country;
|
||||
use App\Form\Enums\SpecialType;
|
||||
use Illuminate\Support\Collection;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class RdpNrwDocument extends ContributionDocument
|
||||
{
|
||||
|
@ -17,8 +20,8 @@ class RdpNrwDocument extends ContributionDocument
|
|||
* @param Collection<int, Collection<int, MemberData>> $members
|
||||
*/
|
||||
public function __construct(
|
||||
public string $dateFrom,
|
||||
public string $dateUntil,
|
||||
public Carbon $dateFrom,
|
||||
public Carbon $dateUntil,
|
||||
public string $zipLocation,
|
||||
public ?Country $country,
|
||||
public Collection $members,
|
||||
|
@ -29,33 +32,15 @@ class RdpNrwDocument extends ContributionDocument
|
|||
$this->setEventName($eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function fromRequest(array $request): self
|
||||
public static function fromPayload(HasContributionData $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(17),
|
||||
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(17),
|
||||
eventName: $request['eventName'],
|
||||
dateFrom: $request->dateFrom(),
|
||||
dateUntil: $request->dateUntil(),
|
||||
zipLocation: $request->zipLocation(),
|
||||
country: $request->country(),
|
||||
members: $request->members()->chunk(17),
|
||||
eventName: $request->eventName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -81,4 +66,15 @@ class RdpNrwDocument extends ContributionDocument
|
|||
'zipLocation' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
||||
public static function requiredFormSpecialTypes(): array {
|
||||
return [
|
||||
SpecialType::FIRSTNAME,
|
||||
SpecialType::LASTNAME,
|
||||
SpecialType::BIRTHDAY,
|
||||
SpecialType::ZIP,
|
||||
SpecialType::LOCATION,
|
||||
SpecialType::GENDER,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
|
||||
namespace App\Contribution\Documents;
|
||||
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Contribution\Data\MemberData;
|
||||
use App\Contribution\Traits\FormatsDates;
|
||||
use App\Contribution\Traits\HasPdfBackground;
|
||||
use App\Country;
|
||||
use App\Form\Enums\SpecialType;
|
||||
use Illuminate\Support\Collection;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class WuppertalDocument extends ContributionDocument
|
||||
{
|
||||
|
@ -18,8 +21,8 @@ class WuppertalDocument extends ContributionDocument
|
|||
* @param Collection<int, Collection<int, MemberData>> $members
|
||||
*/
|
||||
public function __construct(
|
||||
public string $dateFrom,
|
||||
public string $dateUntil,
|
||||
public Carbon $dateFrom,
|
||||
public Carbon $dateUntil,
|
||||
public string $zipLocation,
|
||||
public ?Country $country,
|
||||
public Collection $members,
|
||||
|
@ -30,33 +33,15 @@ class WuppertalDocument extends ContributionDocument
|
|||
$this->setEventName($eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function fromRequest(array $request): self
|
||||
public static function fromPayload(HasContributionData $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'],
|
||||
dateFrom: $request->dateFrom(),
|
||||
dateUntil: $request->dateUntil(),
|
||||
zipLocation: $request->zipLocation(),
|
||||
country: $request->country(),
|
||||
members: $request->members()->chunk(14),
|
||||
eventName: $request->eventName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -76,4 +61,16 @@ class WuppertalDocument extends ContributionDocument
|
|||
'zipLocation' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
||||
public static function requiredFormSpecialTypes(): array {
|
||||
return [
|
||||
SpecialType::FIRSTNAME,
|
||||
SpecialType::LASTNAME,
|
||||
SpecialType::ADDRESS,
|
||||
SpecialType::BIRTHDAY,
|
||||
SpecialType::ZIP,
|
||||
SpecialType::LOCATION,
|
||||
SpecialType::GENDER,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,256 @@
|
|||
<?php
|
||||
|
||||
namespace App\Contribution\Enums;
|
||||
|
||||
enum Country: string {
|
||||
case AD = 'Andorra';
|
||||
case AE = 'Vereinigte Arabische Emirate';
|
||||
case AF = 'Afghanistan';
|
||||
case AG = 'Antigua und Barbuda';
|
||||
case AI = 'Anguilla';
|
||||
case AL = 'Albanien';
|
||||
case AM = 'Armenien';
|
||||
case AN = 'Niederländische Antillen';
|
||||
case AO = 'Angola';
|
||||
case AQ = 'Antarktis';
|
||||
case AR = 'Argentinien';
|
||||
case AS = 'Amerikanisch-Samoa';
|
||||
case AT = 'Österreich (Austria)';
|
||||
case AU = 'Australien';
|
||||
case AW = 'Aruba';
|
||||
case AZ = 'Azerbaijan';
|
||||
case BA = 'Bosnien-Herzegovina';
|
||||
case BB = 'Barbados';
|
||||
case BD = 'Bangladesh';
|
||||
case BE = 'Belgien';
|
||||
case BF = 'Burkina Faso';
|
||||
case BG = 'Bulgarien';
|
||||
case BH = 'Bahrain';
|
||||
case BI = 'Burundi';
|
||||
case BJ = 'Benin';
|
||||
case BM = 'Bermudas';
|
||||
case BN = 'Brunei Darussalam';
|
||||
case BO = 'Bolivien';
|
||||
case BR = 'Brasilien';
|
||||
case BS = 'Bahamas';
|
||||
case BT = 'Bhutan';
|
||||
case BV = 'Bouvet Island';
|
||||
case BW = 'Botswana';
|
||||
case BY = 'Weißrußland (Belarus)';
|
||||
case BZ = 'Belize';
|
||||
case CA = 'Canada';
|
||||
case CC = 'Cocos (Keeling) Islands';
|
||||
case CD = 'Demokratische Republik Kongo';
|
||||
case CF = 'Zentralafrikanische Republik';
|
||||
case CG = 'Kongo';
|
||||
case CH = 'Schweiz';
|
||||
case CI = 'Elfenbeinküste (Cote D’Ivoire)';
|
||||
case CK = 'Cook Islands';
|
||||
case CL = 'Chile';
|
||||
case CM = 'Kamerun';
|
||||
case CN = 'China';
|
||||
case CO = 'Kolumbien';
|
||||
case CR = 'Costa Rica';
|
||||
case CS = 'Tschechoslowakei (ehemalige)';
|
||||
case CU = 'Kuba';
|
||||
case CV = 'Kap Verde';
|
||||
case CX = 'Christmas Island';
|
||||
case CY = 'Zypern';
|
||||
case CZ = 'Tschechische Republik';
|
||||
case DE = 'Deutschland';
|
||||
case DJ = 'Djibouti';
|
||||
case DK = 'Dänemark';
|
||||
case DM = 'Dominica';
|
||||
case DO = 'Dominikanische Republik';
|
||||
case DZ = 'Algerien';
|
||||
case EC = 'Ecuador';
|
||||
case EE = 'Estland';
|
||||
case EG = 'Ägypten';
|
||||
case EH = 'Westsahara';
|
||||
case ER = 'Eritrea';
|
||||
case ES = 'Spanien';
|
||||
case ET = 'Äthiopien';
|
||||
case FI = 'Finnland';
|
||||
case FJ = 'Fiji';
|
||||
case FK = 'Falkland-Inseln (Malvinas)';
|
||||
case FM = 'Micronesien';
|
||||
case FO = 'Faröer-Inseln';
|
||||
case FR = 'Frankreich';
|
||||
case FX = 'France, Metropolitan';
|
||||
case GA = 'Gabon';
|
||||
case GD = 'Grenada';
|
||||
case GE = 'Georgien';
|
||||
case GF = 'Französisch Guiana';
|
||||
case GH = 'Ghana';
|
||||
case GI = 'Gibraltar';
|
||||
case GL = 'Grönland';
|
||||
case GM = 'Gambia';
|
||||
case GN = 'Guinea';
|
||||
case GP = 'Guadeloupe';
|
||||
case GQ = 'Äquatorialguinea';
|
||||
case GR = 'Griechenland';
|
||||
case GS = 'Südgeorgien und Südliche Sandwich-Inseln';
|
||||
case GT = 'Guatemala';
|
||||
case GU = 'Guam';
|
||||
case GW = 'Guinea-Bissau';
|
||||
case GY = 'Guyana';
|
||||
case HK = 'Kong Hong';
|
||||
case HM = 'Heard und Mc Donald Islands';
|
||||
case HN = 'Honduras';
|
||||
case HT = 'Haiti';
|
||||
case HU = 'Ungarn';
|
||||
case ID = 'Indonesien';
|
||||
case IE = 'Irland';
|
||||
case IL = 'Israel';
|
||||
case IN = 'Indien';
|
||||
case IO = 'British Indian Ocean Territory';
|
||||
case IQ = 'Irak';
|
||||
case IR = 'Iran (Islamische Republik)';
|
||||
case IS = 'Island';
|
||||
case IT = 'Italien';
|
||||
case JM = 'Jamaica';
|
||||
case JO = 'Jordanien';
|
||||
case JP = 'Japan';
|
||||
case KE = 'Kenya';
|
||||
case KG = 'Kirgisien';
|
||||
case KH = 'Königreich Kambodscha';
|
||||
case KI = 'Kiribati';
|
||||
case KM = 'Komoren';
|
||||
case KN = 'Saint Kitts und Nevis';
|
||||
case KP = 'Korea, Volksrepublik';
|
||||
case KR = 'Korea';
|
||||
case KW = 'Kuwait';
|
||||
case KY = 'Kayman Islands';
|
||||
case KZ = 'Kasachstan';
|
||||
case LA = 'Laos';
|
||||
case LB = 'Libanon';
|
||||
case LC = 'Saint Lucia';
|
||||
case LI = 'Liechtenstein';
|
||||
case LK = 'Sri Lanka';
|
||||
case LR = 'Liberia';
|
||||
case LS = 'Lesotho';
|
||||
case LT = 'Littauen';
|
||||
case LU = 'Luxemburg';
|
||||
case LV = 'Lettland';
|
||||
case LY = 'Libyen';
|
||||
case MA = 'Marokko';
|
||||
case MC = 'Monaco';
|
||||
case MD = 'Moldavien';
|
||||
case MG = 'Madagaskar';
|
||||
case MH = 'Marshall-Inseln';
|
||||
case MK = 'Mazedonien, ehem. Jugoslawische Republik';
|
||||
case ML = 'Mali';
|
||||
case MM = 'Myanmar';
|
||||
case MN = 'Mongolei';
|
||||
case MO = 'Macao';
|
||||
case MP = 'Nördliche Marianneninseln';
|
||||
case MQ = 'Martinique';
|
||||
case MR = 'Mauretanien';
|
||||
case MS = 'Montserrat';
|
||||
case MT = 'Malta';
|
||||
case MU = 'Mauritius';
|
||||
case MV = 'Malediven';
|
||||
case MW = 'Malawi';
|
||||
case MX = 'Mexico';
|
||||
case MY = 'Malaysien';
|
||||
case MZ = 'Mozambique';
|
||||
case NA = 'Namibia';
|
||||
case NC = 'Neu Kaledonien';
|
||||
case NE = 'Niger';
|
||||
case NF = 'Norfolk Island';
|
||||
case NG = 'Nigeria';
|
||||
case NI = 'Nicaragua';
|
||||
case NL = 'Niederlande';
|
||||
case NO = 'Norwegen';
|
||||
case NP = 'Nepal';
|
||||
case NR = 'Nauru';
|
||||
case NU = 'Niue';
|
||||
case NZ = 'Neuseeland';
|
||||
case OM = 'Oman';
|
||||
case PA = 'Panama';
|
||||
case PE = 'Peru';
|
||||
case PF = 'Französisch Polynesien';
|
||||
case PG = 'Papua Neuguinea';
|
||||
case PH = 'Philippinen';
|
||||
case PK = 'Pakistan';
|
||||
case PL = 'Polen';
|
||||
case PM = 'St. Pierre und Miquelon';
|
||||
case PN = 'Pitcairn';
|
||||
case PR = 'Puerto Rico';
|
||||
case PT = 'Portugal';
|
||||
case PW = 'Palau';
|
||||
case PY = 'Paraguay';
|
||||
case QA = 'Katar';
|
||||
case RE = 'Reunion';
|
||||
case RO = 'Rumänien';
|
||||
case RU = 'Russische Föderation';
|
||||
case RW = 'Ruanda';
|
||||
case SA = 'Saudi Arabien';
|
||||
case SB = 'Salomonen';
|
||||
case SC = 'Seychellen';
|
||||
case SD = 'Sudan';
|
||||
case SE = 'Schweden';
|
||||
case SG = 'Singapur';
|
||||
case SH = 'St. Helena';
|
||||
case SI = 'Slovenien';
|
||||
case SJ = 'Svalbard und Jan Mayen Islands';
|
||||
case SK = 'Slowakei';
|
||||
case SL = 'Sierra Leone';
|
||||
case SM = 'San Marino';
|
||||
case SN = 'Senegal';
|
||||
case SO = 'Somalia';
|
||||
case SR = 'Surinam';
|
||||
case ST = 'Sao Tome und Principe';
|
||||
case SV = 'El Salvador';
|
||||
case SY = 'Syrien, Arabische Republik';
|
||||
case SZ = 'Swaziland';
|
||||
case TC = 'Turk und Caicos-Inseln';
|
||||
case TD = 'Tschad';
|
||||
case TF = 'Französisches Südl.Territorium';
|
||||
case TG = 'Togo';
|
||||
case TH = 'Thailand';
|
||||
case TJ = 'Tadschikistan';
|
||||
case TK = 'Tokelau';
|
||||
case TM = 'Turkmenistan';
|
||||
case TN = 'Tunesien';
|
||||
case TO = 'Tonga';
|
||||
case TP = 'Ost-Timor';
|
||||
case TR = 'Türkei';
|
||||
case TT = 'Trinidad und Tobago';
|
||||
case TV = 'Tuvalu';
|
||||
case TW = 'Taiwan';
|
||||
case TZ = 'Tansania, United Republic of';
|
||||
case UA = 'Ukraine';
|
||||
case UG = 'Uganda';
|
||||
case GB = 'Großbritannien';
|
||||
case US = 'Vereinigte Staaten';
|
||||
case UM = 'Vereinigte Staaten, Minor Outlying Islands';
|
||||
case UY = 'Uruguay';
|
||||
case UZ = 'Usbekistan';
|
||||
case VA = 'Vatikanstaat';
|
||||
case VC = 'Saint Vincent und Grenadines';
|
||||
case VE = 'Venezuela';
|
||||
case VG = 'Virgin Islands (Britisch)';
|
||||
case VI = 'Virgin Islands (U.S.)';
|
||||
case VN = 'Vietnam';
|
||||
case VU = 'Vanuatu';
|
||||
case WF = 'Wallis und Futuna Islands';
|
||||
case WS = 'Samoa';
|
||||
case YE = 'Jemen';
|
||||
case YT = 'Mayotte';
|
||||
case YU = 'Jugoslawien';
|
||||
case ZA = 'Südafrika';
|
||||
case ZM = 'Sambia';
|
||||
case ZW = 'Zimbabw';
|
||||
|
||||
/**
|
||||
* @return array<int, array{name: string, id: string}>
|
||||
*/
|
||||
public static function forSelect(): array
|
||||
{
|
||||
return collect(static::cases())
|
||||
->map(fn ($case) => ['id' => $case->value, 'name' => $case->value])
|
||||
->toArray();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\Contribution\Requests;
|
||||
|
||||
use App\Contribution\Data\MemberData;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class GenerateApiRequest extends GenerateRequest {
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function payload(): array
|
||||
{
|
||||
return $this->input();
|
||||
}
|
||||
|
||||
public function validateContribution(): void {
|
||||
}
|
||||
|
||||
public function members(): Collection {
|
||||
return MemberData::fromApi($this->value('members'));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
namespace App\Contribution\Requests;
|
||||
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Contribution\ContributionFactory;
|
||||
use App\Contribution\Data\MemberData;
|
||||
use App\Contribution\Documents\ContributionDocument;
|
||||
use App\Country;
|
||||
use Lorisleiva\Actions\ActionRequest;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class GenerateRequest extends ActionRequest implements HasContributionData {
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function payload(): array
|
||||
{
|
||||
return json_decode(rawurldecode(base64_decode($this->input('payload', ''))), true);
|
||||
}
|
||||
|
||||
public function validateContribution(): void {
|
||||
Validator::make($this->payload(), app(ContributionFactory::class)->rules($this->type()))->validate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|array<array-key, mixed>
|
||||
*/
|
||||
public function value(string $key): string|array
|
||||
{
|
||||
return data_get($this->payload(), $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return class-string<ContributionDocument>
|
||||
*/
|
||||
public function type(): string
|
||||
{
|
||||
return $this->value('type');
|
||||
}
|
||||
|
||||
public function dateFrom(): Carbon {
|
||||
return Carbon::parse($this->value('dateFrom'));
|
||||
}
|
||||
|
||||
public function dateUntil(): Carbon {
|
||||
return Carbon::parse($this->value('dateUntil'));
|
||||
}
|
||||
|
||||
public function zipLocation(): string {
|
||||
return $this->value('zipLocation');
|
||||
}
|
||||
|
||||
public function eventName(): string {
|
||||
return $this->value('eventName');
|
||||
}
|
||||
|
||||
public function members(): Collection {
|
||||
return MemberData::fromModels($this->value('members'));
|
||||
}
|
||||
|
||||
public function country(): ?Country {
|
||||
return Country::where('id', $this->value('country'))->first();
|
||||
}
|
||||
|
||||
}
|
|
@ -16,7 +16,7 @@ class FormApiListAction
|
|||
|
||||
/**
|
||||
* @param string $filter
|
||||
* @return LengthAwarePaginator<Form>
|
||||
* @return LengthAwarePaginator<int, Form>
|
||||
*/
|
||||
public function handle(string $filter, int $perPage): LengthAwarePaginator
|
||||
{
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Form\Actions;
|
||||
|
||||
use App\Form\Models\Form;
|
||||
use App\Lib\Events\Succeeded;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
||||
class FormCopyAction
|
||||
{
|
||||
use AsAction;
|
||||
|
||||
public function handle(Form $form): Form
|
||||
{
|
||||
$newForm = $form->replicate();
|
||||
$newForm->save();
|
||||
$newForm->update(['name' => $form->name.' - Kopie', 'is_active' => false]);
|
||||
|
||||
foreach ($form->getRegisteredMediaCollections() as $collection) {
|
||||
foreach ($form->getMedia($collection->name) as $media) {
|
||||
$media->copy($newForm, $collection->name);
|
||||
}
|
||||
}
|
||||
|
||||
ClearFrontendCacheAction::run();
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function asController(Form $form): JsonResponse
|
||||
{
|
||||
$this->handle($form);
|
||||
|
||||
Succeeded::message('Veranstaltung kopiert.')->dispatch();
|
||||
return response()->json([]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Form\Actions;
|
||||
|
||||
use App\Form\FormSettings;
|
||||
use App\Form\Models\Form;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
||||
class FormGenerateLaterlinkAction
|
||||
{
|
||||
use AsAction;
|
||||
|
||||
public function asController(Form $form)
|
||||
{
|
||||
$registerUrl = str(app(FormSettings::class)->registerUrl)->replace('{slug}', $form->slug)->toString();
|
||||
$laterId = str()->uuid()->toString();
|
||||
$laterUrl = URL::signedRoute('form.register', ['form' => $form, 'later' => '1', 'id' => $laterId]);
|
||||
$urlParts = parse_url($laterUrl);
|
||||
|
||||
Cache::remember('later_'.$laterId, 2592000, fn () => $form->id); // Link ist 40 Tage gültig
|
||||
|
||||
return response()->json([
|
||||
'url' => $registerUrl.'?'.data_get($urlParts, 'query')
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ class FormIndexAction
|
|||
use AsAction;
|
||||
|
||||
/**
|
||||
* @return LengthAwarePaginator<Form>
|
||||
* @return LengthAwarePaginator<int, Form>
|
||||
*/
|
||||
public function handle(string $filter): LengthAwarePaginator
|
||||
{
|
||||
|
|
|
@ -36,6 +36,10 @@ class FormStoreAction
|
|||
'needs_prevention' => 'present|boolean',
|
||||
'prevention_text' => 'array',
|
||||
'prevention_conditions' => 'array',
|
||||
'leader_conditions' => 'array',
|
||||
'zip' => 'present|nullable|string',
|
||||
'location' => 'present|nullable|string',
|
||||
'country' => 'nullable|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Form\Actions;
|
||||
|
||||
use App\Form\Models\Form;
|
||||
use App\Lib\Editor\Condition;
|
||||
use App\Lib\Events\Succeeded;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
@ -36,6 +35,10 @@ class FormUpdateAction
|
|||
'needs_prevention' => 'present|boolean',
|
||||
'prevention_text' => 'array',
|
||||
'prevention_conditions' => 'array',
|
||||
'location' => 'present|nullable|string',
|
||||
'zip' => 'present|nullable|string',
|
||||
'country' => 'nullable|string|max:255',
|
||||
'leader_conditions' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class FormtemplateIndexAction
|
|||
use AsAction;
|
||||
|
||||
/**
|
||||
* @return LengthAwarePaginator<Formtemplate>
|
||||
* @return LengthAwarePaginator<int, Formtemplate>
|
||||
*/
|
||||
public function handle(): LengthAwarePaginator
|
||||
{
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Form\Actions;
|
||||
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Contribution\ContributionFactory;
|
||||
use App\Form\Models\Form;
|
||||
use App\Form\Requests\FormCompileRequest;
|
||||
use App\Rules\JsonBase64Rule;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Lorisleiva\Actions\ActionRequest;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
use Zoomyboy\Tex\BaseCompiler;
|
||||
use Zoomyboy\Tex\Tex;
|
||||
|
||||
class GenerateContributionAction
|
||||
{
|
||||
use AsAction;
|
||||
|
||||
public function handle(HasContributionData $request): BaseCompiler
|
||||
{
|
||||
return Tex::compile($request->type()::fromPayload($request));
|
||||
}
|
||||
|
||||
public function asController(ActionRequest $request, Form $form): BaseCompiler|JsonResponse
|
||||
{
|
||||
$r = FormCompileRequest::from(['form' => $form]);
|
||||
app(ContributionFactory::class)->validateType($r);
|
||||
$r->validateContribution();
|
||||
|
||||
return $request->input('validate')
|
||||
? response()->json([])
|
||||
: $this->handle($r);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'payload' => [new JsonBase64Rule()],
|
||||
];
|
||||
}
|
||||
}
|
|
@ -13,18 +13,18 @@ class PreventionRememberAction
|
|||
{
|
||||
use AsAction;
|
||||
|
||||
public string $commandSignature = 'prevention:remember';
|
||||
public string $commandSignature = 'prevention:remember-forms';
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$query = Participant::whereHas(
|
||||
'form',
|
||||
fn ($form) => $form
|
||||
fn($form) => $form
|
||||
->where('needs_prevention', true)
|
||||
->where('from', '>=', now())
|
||||
)
|
||||
->where(
|
||||
fn ($q) => $q
|
||||
fn($q) => $q
|
||||
->where('last_remembered_at', '<=', now()->subWeeks(2))
|
||||
->orWhereNull('last_remembered_at')
|
||||
);
|
||||
|
@ -33,7 +33,7 @@ class PreventionRememberAction
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($participant->getFields()->getMailRecipient() === null || count($participant->preventions()) === 0) {
|
||||
if ($participant->getFields()->getMailRecipient() === null || $participant->preventions()->count() === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ class PreventionRememberAction
|
|||
->placeholder('formname', $participant->form->name)
|
||||
->append($participant->form->prevention_text);
|
||||
|
||||
Mail::send(new PreventionRememberMail($participant, $body));
|
||||
Mail::send(new PreventionRememberMail($participant, $body, $participant->preventions()));
|
||||
|
||||
$participant->update(['last_remembered_at' => now()]);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ use App\Form\Models\Form;
|
|||
use App\Form\Models\Participant;
|
||||
use App\Member\Member;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Lorisleiva\Actions\ActionRequest;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
@ -20,13 +23,9 @@ class RegisterAction
|
|||
*/
|
||||
public function handle(Form $form, array $input): Participant
|
||||
{
|
||||
if (!$form->canRegister()) {
|
||||
throw ValidationException::withMessages(['event' => 'Anmeldung zzt nicht möglich.']);
|
||||
}
|
||||
|
||||
$memberQuery = FieldCollection::fromRequest($form, $input)
|
||||
->withNamiType()
|
||||
->reduce(fn ($query, $field) => $field->namiType->performQuery($query, $field->value), (new Member())->newQuery());
|
||||
->reduce(fn($query, $field) => $field->namiType->performQuery($query, $field->value), (new Member())->newQuery());
|
||||
$member = $form->getFields()->withNamiType()->count() && $memberQuery->count() === 1 ? $memberQuery->first() : null;
|
||||
|
||||
$participant = $form->participants()->create([
|
||||
|
@ -34,7 +33,7 @@ class RegisterAction
|
|||
'member_id' => $member?->id,
|
||||
]);
|
||||
|
||||
$form->getFields()->each(fn ($field) => $field->afterRegistration($form, $participant, $input));
|
||||
$form->getFields()->each(fn($field) => $field->afterRegistration($form, $participant, $input));
|
||||
|
||||
$participant->sendConfirmationMail();
|
||||
ExportSyncAction::dispatch($form->id);
|
||||
|
@ -77,8 +76,34 @@ class RegisterAction
|
|||
|
||||
public function asController(ActionRequest $request, Form $form): JsonResponse
|
||||
{
|
||||
if (!$form->canRegister() && !$this->isRegisteringLater($request, $form)) {
|
||||
throw ValidationException::withMessages(['event' => 'Anmeldung zzt nicht möglich.']);
|
||||
}
|
||||
|
||||
$participant = $this->handle($form, $request->validated());
|
||||
|
||||
if ($this->isRegisteringLater($request, $form)) {
|
||||
Cache::forget('later_'.request('id'));
|
||||
}
|
||||
|
||||
return response()->json($participant);
|
||||
}
|
||||
|
||||
public function isRegisteringLater(ActionRequest $request, Form $form): bool {
|
||||
if (!is_array($request->query())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$validator = Validator::make($request->query(), [
|
||||
'later' => 'required|numeric|in:1',
|
||||
'id' => 'required|string|uuid:4',
|
||||
'signature' => 'required|string',
|
||||
]);
|
||||
|
||||
if (!URL::hasValidSignature($request) || $validator->fails()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Cache::get('later_'.data_get($validator->validated(), 'id')) === $form->id;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,12 @@ class FieldCollection extends Collection
|
|||
return $this->map(fn ($field) => $field->presentRaw())->toArray();
|
||||
}
|
||||
|
||||
private function findBySpecialType(SpecialType $specialType): ?Field
|
||||
public function hasSpecialType(SpecialType $specialType): bool
|
||||
{
|
||||
return $this->findBySpecialType($specialType) !== null;
|
||||
}
|
||||
|
||||
public function findBySpecialType(SpecialType $specialType): ?Field
|
||||
{
|
||||
return $this->first(fn ($field) => $field->specialType === $specialType);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,11 @@ enum SpecialType: string
|
|||
case FIRSTNAME = 'Vorname';
|
||||
case LASTNAME = 'Nachname';
|
||||
case EMAIL = 'E-Mail-Adresse';
|
||||
case BIRTHDAY = 'Geburtsdatum';
|
||||
case ZIP = 'PLZ';
|
||||
case LOCATION = 'Ort';
|
||||
case ADDRESS = 'Adresse';
|
||||
case GENDER = 'Geschlecht';
|
||||
|
||||
/**
|
||||
* @return array<int, array{name: string, id: string}>
|
||||
|
|
|
@ -69,10 +69,8 @@ class ConfirmRegistrationMail extends Mailable
|
|||
*/
|
||||
public function attachments()
|
||||
{
|
||||
$conditionResolver = app(FormConditionResolver::class)->forParticipant($this->participant);
|
||||
|
||||
return $this->participant->form->getMedia('mailattachments')
|
||||
->filter(fn ($media) => $conditionResolver->filterCondition(Condition::fromMedia($media)))
|
||||
->filter(fn ($media) => $this->participant->matchesCondition(Condition::fromMedia($media)))
|
||||
->map(fn ($media) => Attachment::fromStorageDisk($media->disk, $media->getPathRelativeToRoot()))
|
||||
->all();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Form\Models;
|
||||
|
||||
use App\Contribution\Enums\Country;
|
||||
use App\Form\Actions\UpdateParticipantSearchIndexAction;
|
||||
use App\Form\Data\ExportData;
|
||||
use App\Form\Data\FieldCollection;
|
||||
|
@ -18,7 +19,6 @@ use Laravel\Scout\Searchable;
|
|||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
use Zoomyboy\MedialibraryHelper\DefersUploads;
|
||||
|
||||
/** @todo replace editor content with EditorData cast */
|
||||
|
@ -49,6 +49,8 @@ class Form extends Model implements HasMedia
|
|||
'to' => 'datetime',
|
||||
'registration_from' => 'datetime',
|
||||
'registration_until' => 'datetime',
|
||||
'country' => Country::class,
|
||||
'leader_conditions' => Condition::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -69,25 +71,24 @@ class Form extends Model implements HasMedia
|
|||
return $this->hasMany(Participant::class);
|
||||
}
|
||||
|
||||
|
||||
public function registerMediaCollections(): void
|
||||
{
|
||||
$this->addMediaCollection('headerImage')
|
||||
->singleFile()
|
||||
->maxWidth(fn () => 500)
|
||||
->forceFileName(fn (Form $model, string $name) => $model->slug)
|
||||
->convert(fn () => 'jpg')
|
||||
->registerMediaConversions(function (Media $media) {
|
||||
->maxWidth(fn() => 500)
|
||||
->forceFileName(fn(Form $model) => $model->slug)
|
||||
->convert(fn() => 'jpg')
|
||||
->registerMediaConversions(function () {
|
||||
$this->addMediaConversion('square')->fit(Fit::Crop, 400, 400);
|
||||
});
|
||||
$this->addMediaCollection('mailattachments')
|
||||
->withDefaultProperties(fn () => [
|
||||
->withDefaultProperties(fn() => [
|
||||
'conditions' => [
|
||||
'mode' => 'all',
|
||||
'ifs' => []
|
||||
],
|
||||
])
|
||||
->withPropertyValidation(fn () => [
|
||||
->withPropertyValidation(fn() => [
|
||||
'conditions.mode' => 'required|string|in:all,any',
|
||||
'conditions.ifs' => 'array',
|
||||
'conditions.ifs.*.field' => 'required',
|
||||
|
@ -101,7 +102,7 @@ class Form extends Model implements HasMedia
|
|||
*/
|
||||
public function getRegistrationRules(): array
|
||||
{
|
||||
return $this->getFields()->reduce(fn ($carry, $field) => [
|
||||
return $this->getFields()->reduce(fn($carry, $field) => [
|
||||
...$carry,
|
||||
...$field->getRegistrationRules($this),
|
||||
], []);
|
||||
|
@ -112,7 +113,7 @@ class Form extends Model implements HasMedia
|
|||
*/
|
||||
public function getRegistrationMessages(): array
|
||||
{
|
||||
return $this->getFields()->reduce(fn ($carry, $field) => [
|
||||
return $this->getFields()->reduce(fn($carry, $field) => [
|
||||
...$carry,
|
||||
...$field->getRegistrationMessages($this),
|
||||
], []);
|
||||
|
@ -123,7 +124,7 @@ class Form extends Model implements HasMedia
|
|||
*/
|
||||
public function getRegistrationAttributes(): array
|
||||
{
|
||||
return $this->getFields()->reduce(fn ($carry, $field) => [
|
||||
return $this->getFields()->reduce(fn($carry, $field) => [
|
||||
...$carry,
|
||||
...$field->getRegistrationAttributes($this),
|
||||
], []);
|
||||
|
@ -189,8 +190,7 @@ class Form extends Model implements HasMedia
|
|||
return Sorting::from($this->meta['sorting']);
|
||||
}
|
||||
|
||||
public function canRegister(): bool
|
||||
{
|
||||
public function isInDates(): bool {
|
||||
if ($this->registration_from && $this->registration_from->gt(now())) {
|
||||
return false;
|
||||
}
|
||||
|
@ -201,4 +201,9 @@ class Form extends Model implements HasMedia
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function canRegister(): bool
|
||||
{
|
||||
return $this->is_active && $this->isInDates();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,16 +4,17 @@ namespace App\Form\Models;
|
|||
|
||||
use App\Form\Data\FieldCollection;
|
||||
use App\Form\Data\FormConfigData;
|
||||
use App\Form\Editor\FormConditionResolver;
|
||||
use App\Form\Mails\ConfirmRegistrationMail;
|
||||
use App\Form\Scopes\ParticipantFilterScope;
|
||||
use App\Lib\Editor\Condition;
|
||||
use App\Member\Member;
|
||||
use App\Prevention\Contracts\Preventable;
|
||||
use Database\Factories\Form\Models\ParticipantFactory;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Laravel\Scout\Searchable;
|
||||
use stdClass;
|
||||
|
@ -81,20 +82,15 @@ class Participant extends Model implements Preventable
|
|||
Mail::to($this->getMailRecipient())->queue(new ConfirmRegistrationMail($this));
|
||||
}
|
||||
|
||||
public function preventableLayout(): string
|
||||
{
|
||||
return 'mail.prevention.prevention-remember-participant';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function preventions(): array
|
||||
public function preventions(): Collection
|
||||
{
|
||||
return $this->member?->preventions($this->form->from) ?: [];
|
||||
return $this->member?->preventions($this->form->from) ?: collect([]);
|
||||
}
|
||||
|
||||
public function getMailRecipient(): stdClass
|
||||
public function getMailRecipient(): ?stdClass
|
||||
{
|
||||
return $this->getFields()->getMailRecipient();
|
||||
}
|
||||
|
@ -114,4 +110,8 @@ class Participant extends Model implements Preventable
|
|||
{
|
||||
return [...$this->data, 'parent-id' => $this->parent_id, 'created_at' => $this->created_at->timestamp];
|
||||
}
|
||||
|
||||
public function matchesCondition(Condition $condition): bool {
|
||||
return app(FormConditionResolver::class)->forParticipant($this)->filterCondition($condition);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
<?php
|
||||
|
||||
namespace App\Form\Requests;
|
||||
|
||||
use App\Contribution\Contracts\HasContributionData;
|
||||
use App\Contribution\Data\MemberData;
|
||||
use App\Contribution\Documents\ContributionDocument;
|
||||
use App\Country;
|
||||
use App\Form\Editor\FormConditionResolver;
|
||||
use App\Form\Enums\SpecialType;
|
||||
use App\Form\Models\Form;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Spatie\LaravelData\Data;
|
||||
|
||||
class FormCompileRequest extends Data implements HasContributionData {
|
||||
|
||||
public function __construct(public Form $form) {}
|
||||
|
||||
/**
|
||||
* @return class-string<ContributionDocument>
|
||||
*/
|
||||
public function type(): string
|
||||
{
|
||||
$payload = json_decode(rawurldecode(base64_decode(request()->input('payload'))), true);
|
||||
|
||||
return $payload['type'];
|
||||
}
|
||||
|
||||
public function dateFrom(): Carbon
|
||||
{
|
||||
return $this->form->from;
|
||||
}
|
||||
|
||||
public function dateUntil(): Carbon
|
||||
{
|
||||
return $this->form->to;
|
||||
}
|
||||
|
||||
public function zipLocation(): string
|
||||
{
|
||||
return $this->form->zip.' '.$this->form->location;
|
||||
}
|
||||
|
||||
public function eventName(): string
|
||||
{
|
||||
return $this->form->name;
|
||||
}
|
||||
|
||||
public function members(): Collection
|
||||
{
|
||||
$members = [];
|
||||
$fields = [
|
||||
[SpecialType::FIRSTNAME, 'firstname'],
|
||||
[SpecialType::LASTNAME, 'lastname'],
|
||||
[SpecialType::BIRTHDAY, 'birthday'],
|
||||
[SpecialType::GENDER, 'gender'],
|
||||
[SpecialType::ADDRESS, 'address'],
|
||||
[SpecialType::ZIP, 'zip'],
|
||||
[SpecialType::LOCATION, 'location'],
|
||||
];
|
||||
|
||||
foreach ($this->form->participants as $participant) {
|
||||
$member = [];
|
||||
foreach ($fields as [$type, $name]) {
|
||||
$f = $this->form->getFields()->findBySpecialType($type);
|
||||
if (!$f) {
|
||||
continue;
|
||||
}
|
||||
$member[$name] = $participant->getFields()->find($f)->value;
|
||||
}
|
||||
|
||||
$members[] = [
|
||||
'is_leader' => $participant->matchesCondition($participant->form->leader_conditions),
|
||||
'gender' => 'weiblich',
|
||||
...$member,
|
||||
];
|
||||
}
|
||||
|
||||
return MemberData::fromApi($members);
|
||||
}
|
||||
|
||||
public function country(): ?Country
|
||||
{
|
||||
return Country::first();
|
||||
}
|
||||
|
||||
public function validateContribution(): void
|
||||
{
|
||||
Validator::make($this->form->toArray(), [
|
||||
'zip' => 'required',
|
||||
'location' => 'required'
|
||||
])
|
||||
->after(function($validator) {
|
||||
foreach ($this->type()::requiredFormSpecialTypes() as $type) {
|
||||
if (!$this->form->getFields()->hasSpecialType($type)) {
|
||||
$validator->errors()->add($type->name, 'Kein Feld für ' . $type->value . ' vorhanden.');
|
||||
}
|
||||
}
|
||||
if ($this->form->participants->count() === 0) {
|
||||
$validator->errors()->add('participants', 'Veranstaltung besitzt noch keine Teilnehmer*innen.');
|
||||
}
|
||||
})
|
||||
->validate();
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Form\Resources;
|
||||
|
||||
use App\Contribution\Enums\Country;
|
||||
use App\Form\Data\ExportData;
|
||||
use App\Form\Enums\NamiType;
|
||||
use App\Form\Enums\SpecialType;
|
||||
|
@ -14,6 +15,7 @@ use App\Group;
|
|||
use App\Lib\Editor\EditorData;
|
||||
use App\Lib\HasMeta;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use App\Contribution\ContributionFactory;
|
||||
|
||||
/**
|
||||
* @mixin Form
|
||||
|
@ -44,6 +46,7 @@ class FormResource extends JsonResource
|
|||
'mail_bottom' => $this->mail_bottom,
|
||||
'registration_from' => $this->registration_from?->format('Y-m-d H:i:s'),
|
||||
'registration_until' => $this->registration_until?->format('Y-m-d H:i:s'),
|
||||
'is_in_dates' => $this->isInDates(),
|
||||
'config' => $this->config,
|
||||
'participants_count' => $this->participants_count,
|
||||
'is_active' => $this->is_active,
|
||||
|
@ -53,14 +56,21 @@ class FormResource extends JsonResource
|
|||
'needs_prevention' => $this->needs_prevention,
|
||||
'prevention_text' => $this->prevention_text,
|
||||
'prevention_conditions' => $this->prevention_conditions,
|
||||
'leader_conditions' => $this->leader_conditions,
|
||||
'zip' => $this->zip,
|
||||
'location' => $this->location,
|
||||
'country' => $this->country,
|
||||
'links' => [
|
||||
'participant_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => null]),
|
||||
'participant_root_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => -1]),
|
||||
'update' => route('form.update', ['form' => $this->getModel()]),
|
||||
'destroy' => route('form.destroy', ['form' => $this->getModel()]),
|
||||
'is_dirty' => route('form.is-dirty', ['form' => $this->getModel()]),
|
||||
'update' => route('form.update', $this->getModel()),
|
||||
'destroy' => route('form.destroy', $this->getModel()),
|
||||
'is_dirty' => route('form.is-dirty', $this->getModel()),
|
||||
'frontend' => str(app(FormSettings::class)->registerUrl)->replace('{slug}', $this->slug),
|
||||
'export' => route('form.export', ['form' => $this->getModel()]),
|
||||
'export' => route('form.export', $this->getModel()),
|
||||
'copy' => route('form.copy', $this->getModel()),
|
||||
'contribution' => route('form.contribution', $this->getModel()),
|
||||
'laterlink' => route('form.laterlink', $this->getModel()),
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -82,6 +92,8 @@ class FormResource extends JsonResource
|
|||
'templates' => FormtemplateResource::collection(Formtemplate::get()),
|
||||
'namiTypes' => NamiType::forSelect(),
|
||||
'specialTypes' => SpecialType::forSelect(),
|
||||
'countries' => Country::forSelect(),
|
||||
'contribution_types' => app(ContributionFactory::class)->compilerSelect(),
|
||||
'default' => [
|
||||
'description' => [],
|
||||
'is_active' => true,
|
||||
|
@ -101,6 +113,9 @@ class FormResource extends JsonResource
|
|||
'id' => null,
|
||||
'export' => ExportData::from([]),
|
||||
'prevention_conditions' => ['mode' => 'all', 'ifs' => []],
|
||||
'zip' => '',
|
||||
'location' => '',
|
||||
'country' => null,
|
||||
],
|
||||
'section_default' => [
|
||||
'name' => '',
|
||||
|
|
|
@ -71,7 +71,7 @@ class InitializeAction
|
|||
|
||||
public function asController(ActionRequest $request, NamiSettings $settings): RedirectResponse
|
||||
{
|
||||
$settings->mglnr = (int) $request->input('mglnr');
|
||||
$settings->mglnr = $request->input('mglnr');
|
||||
$settings->password = $request->input('password');
|
||||
$settings->default_group_id = (int) $request->input('group_id');
|
||||
$settings->search_params = $request->input('params');
|
||||
|
|
|
@ -21,7 +21,7 @@ class NamiGetSearchLayerAction
|
|||
*/
|
||||
public function handle(array $input): Collection
|
||||
{
|
||||
return Nami::login((int) $input['mglnr'], $input['password'])->searchLayerOptions(
|
||||
return Nami::login($input['mglnr'], $input['password'])->searchLayerOptions(
|
||||
SearchLayer::from($input['layer'] ?: 0),
|
||||
$input['parent'] ?: null
|
||||
);
|
||||
|
|
|
@ -16,7 +16,7 @@ class NamiLoginCheckAction
|
|||
*/
|
||||
public function handle(array $input): void
|
||||
{
|
||||
Nami::freshLogin((int) $input['mglnr'], $input['password']);
|
||||
Nami::freshLogin($input['mglnr'], $input['password']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@ class NamiSearchAction
|
|||
/**
|
||||
* @param array<string, mixed> $params
|
||||
*
|
||||
* @return LengthAwarePaginator<MemberEntry>
|
||||
* @return LengthAwarePaginator<int, MemberEntry>
|
||||
*/
|
||||
public function handle(Api $api, int $page, array $params, int $perPage = 10): LengthAwarePaginator
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ class NamiSearchAction
|
|||
}
|
||||
|
||||
/**
|
||||
* @return LengthAwarePaginator<MemberEntry>
|
||||
* @return LengthAwarePaginator<int, MemberEntry>
|
||||
*/
|
||||
public function asController(ActionRequest $request): LengthAwarePaginator
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@ namespace App\Invoice\Scopes;
|
|||
|
||||
use App\Invoice\Enums\InvoiceStatus;
|
||||
use App\Invoice\Models\Invoice;
|
||||
use App\Lib\Filter;
|
||||
use App\Lib\ScoutFilter;
|
||||
use Laravel\Scout\Builder;
|
||||
use Spatie\LaravelData\Attributes\MapInputName;
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib\Data;
|
||||
|
||||
use Spatie\LaravelData\Normalizers\Normalizer;
|
||||
use App\Lib\Normalizers\DateNormalizer;
|
||||
use Spatie\LaravelData\Data;
|
||||
use Spatie\LaravelData\Attributes\WithTransformer;
|
||||
use App\Lib\Transformers\DateTransformer;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class DateData extends Data
|
||||
{
|
||||
public function __construct(
|
||||
#[WithTransformer(DateTransformer::class)]
|
||||
public Carbon $raw,
|
||||
public string $human,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return array<int, class-string<Normalizer>>
|
||||
*/
|
||||
public static function normalizers(): array
|
||||
{
|
||||
return [
|
||||
DateNormalizer::class,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib\Data;
|
||||
|
||||
use Spatie\LaravelData\Data;
|
||||
|
||||
class RecordData extends Data {
|
||||
|
||||
public function __construct(
|
||||
public int $id,
|
||||
public string $name,
|
||||
) {}
|
||||
|
||||
}
|
|
@ -14,8 +14,7 @@ class EditorData extends Data implements Editorable
|
|||
public string $version,
|
||||
public array $blocks,
|
||||
public int $time
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function placeholder(string $search, string $replacement): self
|
||||
{
|
||||
|
@ -30,7 +29,12 @@ class EditorData extends Data implements Editorable
|
|||
*/
|
||||
public function hasAll(array $wanted): bool
|
||||
{
|
||||
return collect($wanted)->first(fn ($search) => !str(json_encode($this->blocks))->contains($search)) === null;
|
||||
return collect($wanted)->doesntContain(fn($search) => !str(json_encode($this->blocks))->contains($search));
|
||||
}
|
||||
|
||||
public function hasNot(string $should): bool
|
||||
{
|
||||
return !str(json_encode($this->blocks))->contains($should);
|
||||
}
|
||||
|
||||
public static function default(): self
|
||||
|
@ -65,7 +69,7 @@ class EditorData extends Data implements Editorable
|
|||
'type' => 'list',
|
||||
'data' => [
|
||||
'style' => 'unordered',
|
||||
'items' => collect($replacements)->map(fn ($replacement) => [
|
||||
'items' => collect($replacements)->map(fn($replacement) => [
|
||||
'content' => $replacement,
|
||||
'items' => [],
|
||||
]),
|
||||
|
|
|
@ -14,10 +14,12 @@ abstract class Filter extends Data
|
|||
{
|
||||
|
||||
/**
|
||||
* @param Builder<T> $query
|
||||
* @return Builder<T>
|
||||
*/
|
||||
abstract public function apply(Builder $query): Builder;
|
||||
abstract public function getQuery(): Builder;
|
||||
|
||||
/** @var Builder<T> */
|
||||
protected Builder $query;
|
||||
|
||||
/**
|
||||
* @param array<string, mixed>|string|null $request
|
||||
|
@ -36,14 +38,6 @@ abstract class Filter extends Data
|
|||
*/
|
||||
public static function fromPost(?array $post = null): static
|
||||
{
|
||||
return static::factory()->withoutMagicalCreation()->from($post ?: [])->toDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public function toDefault(): self
|
||||
{
|
||||
return $this;
|
||||
return static::factory()->withoutMagicalCreation()->from($post ?: []);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib;
|
||||
|
||||
use Spatie\LaravelData\PaginatedDataCollection;
|
||||
|
||||
/**
|
||||
* @mixin Spatie\LaravelData\Data
|
||||
*/
|
||||
trait HasDataMeta
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function collectPages(mixed $items): array {
|
||||
$source = parent::collect($items, PaginatedDataCollection::class)->toArray();
|
||||
return [
|
||||
...parent::collect($items, PaginatedDataCollection::class)->toArray(),
|
||||
'meta' => [...$source['meta'], ...static::meta()]
|
||||
];
|
||||
}
|
||||
}
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace App\Lib;
|
||||
|
||||
/** @mixin \Illuminate\Http\Resources\Json\JsonResource */
|
||||
/**
|
||||
* @mixin \Illuminate\Http\Resources\Json\JsonResource
|
||||
*/
|
||||
trait HasMeta
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib\Normalizers;
|
||||
|
||||
use Spatie\LaravelData\Normalizers\Normalizer;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class DateNormalizer implements Normalizer
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function normalize(mixed $value): ?array
|
||||
{
|
||||
if (!$value instanceof Carbon) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return [
|
||||
'raw' => $value,
|
||||
'human' => $value->format('d.m.Y'),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib\Transformers;
|
||||
|
||||
use Spatie\LaravelData\Transformers\Transformer;
|
||||
use Spatie\LaravelData\Support\DataProperty;
|
||||
use Spatie\LaravelData\Support\Transformation\TransformationContext;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class DateTransformer implements Transformer
|
||||
{
|
||||
public function transform(DataProperty $property, mixed $value, TransformationContext $context): string
|
||||
{
|
||||
return Carbon::parse($value)->format('Y-m-d');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Member\Data;
|
||||
|
||||
use Spatie\LaravelData\Data;
|
||||
use App\Member\Member;
|
||||
|
||||
class MemberData extends Data
|
||||
{
|
||||
|
||||
public function __construct(
|
||||
public string $fullname,
|
||||
) {}
|
||||
|
||||
public static function fromModel(Member $member): static
|
||||
{
|
||||
return static::factory()->withoutMagicalCreation()->from([
|
||||
'fullname' => $member->fullname
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace App\Member\Data;
|
||||
|
||||
use App\Activity;
|
||||
use App\Group;
|
||||
use Spatie\LaravelData\Data;
|
||||
use App\Lib\Data\DateData;
|
||||
use App\Lib\Data\RecordData;
|
||||
use App\Lib\HasDataMeta;
|
||||
use App\Member\Membership;
|
||||
use App\Membership\FilterScope;
|
||||
use App\Subactivity;
|
||||
|
||||
class MembershipData extends Data
|
||||
{
|
||||
|
||||
use HasDataMeta;
|
||||
|
||||
/**
|
||||
* @param array<string, string> $links
|
||||
*/
|
||||
public function __construct(
|
||||
public int $id,
|
||||
public RecordData $activity,
|
||||
public ?RecordData $subactivity,
|
||||
public RecordData $group,
|
||||
public ?DateData $promisedAt,
|
||||
public DateData $from,
|
||||
public ?DateData $to,
|
||||
public MemberData $member,
|
||||
public bool $isActive,
|
||||
public array $links,
|
||||
) {}
|
||||
|
||||
public static function fromModel(Membership $membership): static
|
||||
{
|
||||
return static::factory()->withoutMagicalCreation()->from([
|
||||
'id' => $membership->id,
|
||||
'activity' => $membership->activity,
|
||||
'subactivity' => $membership->subactivity,
|
||||
'isActive' => $membership->isActive(),
|
||||
'from' => $membership->from,
|
||||
'to' => $membership->to,
|
||||
'group' => $membership->group,
|
||||
'promisedAt' => $membership->promised_at,
|
||||
'member' => $membership->member,
|
||||
'links' => [
|
||||
'update' => route('membership.update', $membership),
|
||||
'destroy' => route('membership.destroy', $membership),
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function meta(): array {
|
||||
return [
|
||||
'activities' => RecordData::collect(Activity::get()),
|
||||
'subactivities' => RecordData::collect(Subactivity::get()),
|
||||
'groups' => RecordData::collect(Group::get()),
|
||||
'filter' => FilterScope::fromRequest(request()->input('filter', '')),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
|
@ -48,8 +48,7 @@ class FilterScope extends ScoutFilter
|
|||
public ?bool $hasBirthday = null,
|
||||
public ?bool $hasSvk = null,
|
||||
public ?bool $hasVk = null,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $options
|
||||
|
@ -110,20 +109,20 @@ class FilterScope extends ScoutFilter
|
|||
}
|
||||
if ($this->subactivityIds && $this->activityIds) {
|
||||
$combinations = $this->combinations($this->activityIds, $this->subactivityIds)
|
||||
->map(fn ($combination) => implode('|', $combination))
|
||||
->map(fn ($combination) => str($combination)->wrap('"'));
|
||||
->map(fn($combination) => implode('|', $combination))
|
||||
->map(fn($combination) => str($combination)->wrap('"'));
|
||||
$filter->push($this->inExpression('memberships.both', $combinations));
|
||||
}
|
||||
|
||||
foreach ($this->memberships as $membership) {
|
||||
$filter->push($this->inExpression('memberships.with_group', $this->possibleValuesForMembership($membership)->map(fn ($value) => str($value)->wrap('"'))));
|
||||
$filter->push($this->inExpression('memberships.with_group', $this->possibleValuesForMembership($membership)->map(fn($value) => str($value)->wrap('"'))));
|
||||
}
|
||||
|
||||
if (count($this->exclude)) {
|
||||
$filter->push($this->notInExpression('id', $this->exclude));
|
||||
}
|
||||
|
||||
$andFilter = $filter->map(fn ($expression) => "($expression)")->implode(' AND ');
|
||||
$andFilter = $filter->map(fn($expression) => "($expression)")->implode(' AND ');
|
||||
|
||||
$options['filter'] = $this->implode(collect([$andFilter])->push($this->inExpression('id', $this->include)), 'OR');
|
||||
$options['sort'] = ['lastname:asc', 'firstname:asc'];
|
||||
|
@ -137,7 +136,7 @@ class FilterScope extends ScoutFilter
|
|||
*/
|
||||
protected function implode(Collection $values, string $between): string
|
||||
{
|
||||
return $values->filter(fn ($expression) => $expression)->implode(" {$between} ");
|
||||
return $values->filter(fn($expression) => $expression)->implode(" {$between} ");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,7 +176,7 @@ class FilterScope extends ScoutFilter
|
|||
$membership['activity_ids'] = count($membership['activity_ids']) === 0 ? Activity::pluck('id')->toArray() : $membership['activity_ids'];
|
||||
$membership['subactivity_ids'] = count($membership['subactivity_ids']) === 0 ? Subactivity::pluck('id')->toArray() : $membership['subactivity_ids'];
|
||||
return $this->combinations($membership['group_ids'], $membership['activity_ids'], $membership['subactivity_ids'])
|
||||
->map(fn ($combination) => collect($combination)->implode('|'));
|
||||
->map(fn($combination) => collect($combination)->implode('|'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -191,7 +190,7 @@ class FilterScope extends ScoutFilter
|
|||
|
||||
if (!count($otherParts)) {
|
||||
/** @var Collection<int, Collection<int, int>> */
|
||||
return collect($firstPart)->map(fn ($p) => [$p]);
|
||||
return collect($firstPart)->map(fn($p) => [$p]);
|
||||
}
|
||||
|
||||
/** @var Collection<int, mixed> */
|
||||
|
|
|
@ -13,6 +13,8 @@ use App\Nami\HasNamiField;
|
|||
use App\Nationality;
|
||||
use App\Payment\Subscription;
|
||||
use App\Pdf\Sender;
|
||||
use App\Prevention\Contracts\Preventable;
|
||||
use App\Prevention\Data\PreventionData;
|
||||
use App\Region;
|
||||
use App\Setting\NamiSettings;
|
||||
use Carbon\Carbon;
|
||||
|
@ -35,12 +37,14 @@ use Zoomyboy\Phone\HasPhoneNumbers;
|
|||
use App\Prevention\Enums\Prevention;
|
||||
use Database\Factories\Member\MemberFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Support\Collection;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* @property string $subscription_name
|
||||
* @property int $pending_payment
|
||||
*/
|
||||
class Member extends Model implements Geolocatable
|
||||
class Member extends Model implements Geolocatable, Preventable
|
||||
{
|
||||
use Notifiable;
|
||||
use HasNamiField;
|
||||
|
@ -191,7 +195,25 @@ class Member extends Model implements Geolocatable
|
|||
|
||||
protected function getAusstand(): int
|
||||
{
|
||||
return (int) $this->invoicePositions()->whereHas('invoice', fn ($query) => $query->whereNeedsPayment())->sum('price');
|
||||
return (int) $this->invoicePositions()->whereHas('invoice', fn($query) => $query->whereNeedsPayment())->sum('price');
|
||||
}
|
||||
|
||||
public function getMailRecipient(): ?stdClass
|
||||
{
|
||||
if (!$this->fullname) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!$this->email) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (object) ['name' => $this->fullname, 'email' => $this->email];
|
||||
}
|
||||
|
||||
public function preventableSubject(): string
|
||||
{
|
||||
return 'Nachweise erforderlich';
|
||||
}
|
||||
|
||||
// ---------------------------------- Relations ----------------------------------
|
||||
|
@ -339,7 +361,7 @@ class Member extends Model implements Geolocatable
|
|||
return $query->addSelect([
|
||||
'pending_payment' => InvoicePosition::selectRaw('SUM(price)')
|
||||
->whereColumn('invoice_positions.member_id', 'members.id')
|
||||
->whereHas('invoice', fn ($query) => $query->whereNeedsPayment()),
|
||||
->whereHas('invoice', fn($query) => $query->whereNeedsPayment()),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -350,7 +372,7 @@ class Member extends Model implements Geolocatable
|
|||
*/
|
||||
public function scopeWhereHasPendingPayment(Builder $query): Builder
|
||||
{
|
||||
return $query->whereHas('invoicePositions', fn ($q) => $q->whereHas('invoice', fn ($q) => $q->whereNeedsPayment()));
|
||||
return $query->whereHas('invoicePositions', fn($q) => $q->whereHas('invoice', fn($q) => $q->whereNeedsPayment()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -364,32 +386,47 @@ class Member extends Model implements Geolocatable
|
|||
}
|
||||
|
||||
/**
|
||||
* @return array<int, Prevention>
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function preventions(?Carbon $date = null): array
|
||||
public function preventions(?Carbon $date = null): Collection
|
||||
{
|
||||
$date = $date ?: now();
|
||||
|
||||
/** @var array<int, Prevention> */
|
||||
$preventions = [];
|
||||
/** @var Collection<int, PreventionData> */
|
||||
$preventions = collect([]);
|
||||
|
||||
if ($this->efz === null || $this->efz->diffInYears($date) >= 5) {
|
||||
$preventions[] = Prevention::EFZ;
|
||||
$preventions->push(PreventionData::from([
|
||||
'type' => Prevention::EFZ,
|
||||
'expires' => $this->efz === null ? now() : $this->efz->addYears(5)
|
||||
]));
|
||||
}
|
||||
|
||||
if (!$this->has_vk) {
|
||||
$preventions[] = Prevention::VK;
|
||||
$preventions->push(PreventionData::from([
|
||||
'type' => Prevention::VK,
|
||||
'expires' => now(),
|
||||
]));
|
||||
}
|
||||
|
||||
if ($this->more_ps_at === null) {
|
||||
if ($this->ps_at === null) {
|
||||
$preventions[] = Prevention::PS;
|
||||
$preventions->push(PreventionData::from([
|
||||
'type' => Prevention::PS,
|
||||
'expires' => now(),
|
||||
]));
|
||||
} else if ($this->ps_at->diffInYears($date) >= 5) {
|
||||
$preventions[] = Prevention::MOREPS;
|
||||
$preventions->push(PreventionData::from([
|
||||
'type' => Prevention::MOREPS,
|
||||
'expires' => $this->ps_at->addYears(5),
|
||||
]));
|
||||
}
|
||||
} else {
|
||||
if ($this->more_ps_at === null || $this->more_ps_at->diffInYears($date) >= 5) {
|
||||
$preventions[] = Prevention::MOREPS;
|
||||
$preventions->push(PreventionData::from([
|
||||
'type' => Prevention::MOREPS,
|
||||
'expires' => $this->more_ps_at->addYears(5),
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -499,7 +536,7 @@ class Member extends Model implements Geolocatable
|
|||
'name' => $this->fullname,
|
||||
'address' => $this->address,
|
||||
'zipLocation' => $this->zip . ' ' . $this->location,
|
||||
'mglnr' => Lazy::create(fn () => 'Mglnr.: ' . $this->nami_id),
|
||||
'mglnr' => Lazy::create(fn() => 'Mglnr.: ' . $this->nami_id),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -508,7 +545,7 @@ class Member extends Model implements Geolocatable
|
|||
*/
|
||||
public static function forSelect(): array
|
||||
{
|
||||
return static::select(['id', 'firstname', 'lastname'])->get()->map(fn ($member) => ['id' => $member->id, 'name' => $member->fullname])->toArray();
|
||||
return static::select(['id', 'firstname', 'lastname'])->get()->map(fn($member) => ['id' => $member->id, 'name' => $member->fullname])->toArray();
|
||||
}
|
||||
|
||||
// -------------------------------- Geolocation --------------------------------
|
||||
|
@ -567,7 +604,7 @@ class Member extends Model implements Geolocatable
|
|||
'age_group_icon' => $this->ageGroupMemberships->first()?->subactivity->slug,
|
||||
'is_leader' => $this->leaderMemberships()->count() > 0,
|
||||
'memberships' => $this->memberships()->active()->get()
|
||||
->map(fn ($membership) => [...$membership->only('activity_id', 'subactivity_id'), 'both' => $membership->activity_id . '|' . $membership->subactivity_id, 'with_group' => $membership->group_id . '|' . $membership->activity_id . '|' . $membership->subactivity_id]),
|
||||
->map(fn($membership) => [...$membership->only('activity_id', 'subactivity_id'), 'both' => $membership->activity_id . '|' . $membership->subactivity_id, 'with_group' => $membership->group_id . '|' . $membership->activity_id . '|' . $membership->subactivity_id]),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class MemberController extends Controller
|
|||
session()->put('title', "Mitglied {$member->firstname} {$member->lastname} bearbeiten");
|
||||
|
||||
return Inertia::render('member/VForm', [
|
||||
'data' => new MemberResource($member),
|
||||
'data' => new MemberResource($member->load('bankAccount')),
|
||||
'mode' => 'edit',
|
||||
'conflict' => '1' === $request->query('conflict', '0'),
|
||||
'meta' => MemberResource::meta(),
|
||||
|
|
|
@ -84,20 +84,24 @@ class MemberRequest extends FormRequest
|
|||
'salutation' => '',
|
||||
'comment' => '',
|
||||
'keepdata' => 'boolean',
|
||||
'bank_account' => 'array|exclude',
|
||||
'bank_account' => 'array',
|
||||
'bank_account.iban' => 'nullable|string|max:255',
|
||||
'bank_account.bic' => 'nullable|string|max:255',
|
||||
'bank_account.blz' => 'nullable|string|max:255',
|
||||
'bank_account.bank_name' => 'nullable|string|max:255',
|
||||
'bank_account.person' => 'nullable|string|max:255',
|
||||
'bank_account.account_number' => 'nullable|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
public function persistCreate(NamiSettings $settings): void
|
||||
{
|
||||
$member = new Member([
|
||||
...$this->validated(),
|
||||
...$this->dataToInsert(),
|
||||
'group_id' => Group::where('nami_id', $settings->default_group_id)->firstOrFail()->id,
|
||||
]);
|
||||
$member->updatePhoneNumbers()->save();
|
||||
$member->bankAccount->update($this->input('bank_account'));
|
||||
$member->bankAccount->update($this->validated('bank_account'));
|
||||
|
||||
if ($this->input('has_nami')) {
|
||||
$this->storeFreshMemberInNami($member);
|
||||
|
@ -116,12 +120,12 @@ class MemberRequest extends FormRequest
|
|||
|
||||
public function persistUpdate(Member $member): void
|
||||
{
|
||||
$member->fill($this->validated())->updatePhoneNumbers();
|
||||
$member->fill($this->dataToInsert())->updatePhoneNumbers();
|
||||
|
||||
$namiSync = $member->isDirty(Member::$namiFields);
|
||||
|
||||
$member->save();
|
||||
$member->bankAccount->update($this->input('bank_account'));
|
||||
$member->bankAccount->update($this->validated('bank_account'));
|
||||
|
||||
if ($this->input('has_nami') && null === $member->nami_id) {
|
||||
$this->storeFreshMemberInNami($member);
|
||||
|
@ -164,4 +168,12 @@ class MemberRequest extends FormRequest
|
|||
$when = fn () => true === $request->input('has_nami') && ($member === null || !$member->has_nami);
|
||||
$validator->sometimes($attribute, $rules, $when);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
protected function dataToInsert(): array
|
||||
{
|
||||
return $this->safe()->except('bank_account');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use App\Invoice\BillKind;
|
|||
use App\Invoice\Resources\InvoicePositionResource;
|
||||
use App\Lib\HasMeta;
|
||||
use App\Member\Data\NestedGroup;
|
||||
use App\Member\Resources\BankAccountResource;
|
||||
use App\Member\Resources\NationalityResource;
|
||||
use App\Member\Resources\RegionResource;
|
||||
use App\Membership\MembershipResource;
|
||||
|
@ -107,6 +108,7 @@ class MemberResource extends JsonResource
|
|||
'lon' => $this->lon,
|
||||
'group_name' => $this->group->name,
|
||||
'keepdata' => $this->keepdata,
|
||||
'bank_account' => new BankAccountResource($this->whenLoaded('bankAccount')),
|
||||
'links' => [
|
||||
'membership_index' => route('member.membership.index', ['member' => $this->getModel()]),
|
||||
'invoiceposition_index' => route('member.invoice-position.index', ['member' => $this->getModel()]),
|
||||
|
@ -131,11 +133,11 @@ class MemberResource extends JsonResource
|
|||
}
|
||||
|
||||
$activities = Activity::with('subactivities')->get();
|
||||
$createActivities = Activity::remote()->with(['subactivities' => fn ($q) => $q->remote()])->get();
|
||||
$createActivities = Activity::remote()->with(['subactivities' => fn($q) => $q->remote()])->get();
|
||||
|
||||
return [
|
||||
'filterActivities' => Activity::where('is_filterable', true)->pluck('name', 'id'),
|
||||
'filterSubactivities' => Subactivity::where('is_filterable', true)->pluck('name', 'id'),
|
||||
'filterActivities' => Activity::where('is_filterable', true)->get()->map(fn($a) => ['id' => $a->id, 'name' => $a->name]),
|
||||
'filterSubactivities' => Subactivity::where('is_filterable', true)->get()->map(fn($a) => ['id' => $a->id, 'name' => $a->name]),
|
||||
'formActivities' => $activities->pluck('name', 'id'),
|
||||
'formSubactivities' => $activities->map(function (Activity $activity) {
|
||||
return ['subactivities' => $activity->subactivities->pluck('name', 'id'), 'id' => $activity->id];
|
||||
|
@ -153,7 +155,7 @@ class MemberResource extends JsonResource
|
|||
'genders' => Gender::pluck('name', 'id'),
|
||||
'billKinds' => BillKind::forSelect(),
|
||||
'nationalities' => Nationality::pluck('name', 'id'),
|
||||
'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' => [
|
||||
'index' => route('member.index'),
|
||||
'create' => route('member.create'),
|
||||
|
@ -208,6 +210,14 @@ class MemberResource extends JsonResource
|
|||
'multiply_pv' => false,
|
||||
'multiply_more_pv' => false,
|
||||
'keepdata' => false,
|
||||
'bank_account' => [
|
||||
'iban' => '',
|
||||
'bic' => '',
|
||||
'blz' => '',
|
||||
'bank_name' => '',
|
||||
'person' => '',
|
||||
'account_number' => '',
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
|
|
@ -79,6 +79,19 @@ class Membership extends Model
|
|||
->where(fn ($query) => $query->whereNull('to')->orWhere('to', '>=', now()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder<Membership> $query
|
||||
*
|
||||
* @return Builder<Membership>
|
||||
*/
|
||||
public function scopeInactive(Builder $query): Builder
|
||||
{
|
||||
return $query->where(fn ($q) => $q
|
||||
->orWhere('from', '>=', now())
|
||||
->orWhere('to', '<=', now())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder<Membership> $query
|
||||
*
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Member\Resources;
|
||||
|
||||
use App\Member\BankAccount;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin BankAccount
|
||||
*/
|
||||
class BankAccountResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array<string, int|string>
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'iban' => $this->iban,
|
||||
'bic' => $this->bic,
|
||||
'blz' => $this->blz,
|
||||
'bank_name' => $this->bank_name,
|
||||
'person' => $this->person,
|
||||
'account_number' => $this->account_number,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ use App\Maildispatcher\Actions\ResyncAction;
|
|||
use App\Member\Member;
|
||||
use App\Member\Membership;
|
||||
use App\Subactivity;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Lorisleiva\Actions\ActionRequest;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
@ -20,13 +21,18 @@ class MassStoreAction
|
|||
use TracksJob;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'group_id' => 'required|numeric|exists:groups,id',
|
||||
'activity_id' => 'required|numeric|exists:activities,id',
|
||||
'activity_id' => ['required', 'numeric', 'exists:activities,id', function($key, $value, $fail) {
|
||||
$activity = Activity::findOrFail($value);
|
||||
if ($activity->subactivities->pluck('id')->doesntContain(request()->subactivity_id)) {
|
||||
return $fail(':attribute ist nicht vorhanden.');
|
||||
}
|
||||
}],
|
||||
'subactivity_id' => 'required|numeric|exists:subactivities,id',
|
||||
'members' => 'array',
|
||||
'members.*' => 'numeric|exists:members,id',
|
||||
|
@ -48,9 +54,7 @@ class MassStoreAction
|
|||
Membership::where($attributes)->active()->whereNotIn('member_id', $members)->get()
|
||||
->each(fn ($membership) => MembershipDestroyAction::run($membership->id));
|
||||
|
||||
collect($members)
|
||||
->except(Membership::where($attributes)->active()->pluck('member_id'))
|
||||
->map(fn ($memberId) => Member::findOrFail($memberId))
|
||||
Member::whereIn('id', $members)->whereDoesntHave('memberships', fn ($q) => $q->where($attributes))->get()
|
||||
->each(fn ($member) => MembershipStoreAction::run(
|
||||
$member,
|
||||
$activity,
|
||||
|
@ -59,12 +63,11 @@ class MassStoreAction
|
|||
null,
|
||||
));
|
||||
|
||||
|
||||
ResyncAction::dispatch();
|
||||
});
|
||||
}
|
||||
|
||||
public function asController(ActionRequest $request): void
|
||||
public function asController(ActionRequest $request): JsonResponse
|
||||
{
|
||||
/**
|
||||
* @var array{members: array<int, int>, group_id: int, activity_id: int, subactivity_id: int}
|
||||
|
@ -77,6 +80,19 @@ class MassStoreAction
|
|||
Subactivity::findOrFail($input['subactivity_id']),
|
||||
$input['members'],
|
||||
);
|
||||
|
||||
return response()->json([], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function getValidationAttributes(): array {
|
||||
return [
|
||||
'activity_id' => 'Tätigkeit',
|
||||
'subactivity_id' => 'Untertätigkeit',
|
||||
'group_id' => 'Gruppe',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Collection;
|
|||
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
||||
class IndexAction
|
||||
class MemberIndexAction
|
||||
{
|
||||
use AsAction;
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace App\Membership\Actions;
|
||||
|
||||
use App\Member\Data\MembershipData;
|
||||
use App\Membership\FilterScope;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
use Lorisleiva\Actions\ActionRequest;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
||||
class MembershipIndexAction
|
||||
{
|
||||
use AsAction;
|
||||
|
||||
public function asController(ActionRequest $request): Response
|
||||
{
|
||||
return Inertia::render(
|
||||
'membership/Index',
|
||||
['data' => MembershipData::collectPages(FilterScope::fromRequest($request->input('filter', ''))->getQuery()->paginate(20))]
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Membership;
|
||||
|
||||
use App\Lib\Filter;
|
||||
use App\Member\Membership;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
/**
|
||||
* @extends Filter<Membership>
|
||||
*/
|
||||
class FilterScope extends Filter
|
||||
{
|
||||
/**
|
||||
* @param array<int, int> $activities
|
||||
* @param array<int, int> $subactivities
|
||||
* @param array<int, int> $groups
|
||||
*/
|
||||
public function __construct(
|
||||
public array $activities = [],
|
||||
public array $subactivities = [],
|
||||
public array $groups = [],
|
||||
public ?bool $active = true,
|
||||
) {}
|
||||
|
||||
public function getQuery(): Builder
|
||||
{
|
||||
$query = Membership::orderByRaw('member_id, activity_id, subactivity_id');
|
||||
|
||||
if ($this->active === true) {
|
||||
$query = $query->active();
|
||||
}
|
||||
|
||||
if ($this->active === false) {
|
||||
$query = $query->inactive();
|
||||
}
|
||||
|
||||
if (count($this->groups)) {
|
||||
$query = $query->whereIn('group_id', $this->groups);
|
||||
}
|
||||
|
||||
if (count($this->activities)) {
|
||||
$query = $query->whereIn('activity_id', $this->activities);
|
||||
}
|
||||
|
||||
if (count($this->subactivities)) {
|
||||
$query = $query->whereIn('subactivity_id', $this->subactivities);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Prevention\Actions;
|
||||
|
||||
use App\Prevention\Enums\Prevention;
|
||||
use App\Prevention\PreventionSettings;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
@ -13,7 +14,10 @@ class SettingApiAction
|
|||
public function handle(): JsonResponse
|
||||
{
|
||||
return response()->json([
|
||||
'data' => app(PreventionSettings::class)->toArray(),
|
||||
'data' => app(PreventionSettings::class)->toFrontend(),
|
||||
'meta' => [
|
||||
'preventAgainsts' => Prevention::values(),
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Prevention\Actions;
|
|||
|
||||
use App\Lib\Editor\EditorData;
|
||||
use App\Lib\Events\Succeeded;
|
||||
use App\Member\FilterScope;
|
||||
use App\Prevention\PreventionSettings;
|
||||
use Lorisleiva\Actions\ActionRequest;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
@ -19,6 +20,10 @@ class SettingStoreAction
|
|||
{
|
||||
return [
|
||||
'formmail' => 'array',
|
||||
'yearlymail' => 'array',
|
||||
'weeks' => 'required|numeric|gte:0',
|
||||
'freshRememberInterval' => 'required|numeric|gte:0',
|
||||
'active' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -26,6 +31,12 @@ class SettingStoreAction
|
|||
{
|
||||
$settings = app(PreventionSettings::class);
|
||||
$settings->formmail = EditorData::from($request->formmail);
|
||||
$settings->yearlymail = EditorData::from($request->yearlymail);
|
||||
$settings->weeks = $request->weeks;
|
||||
$settings->freshRememberInterval = $request->freshRememberInterval;
|
||||
$settings->active = $request->active;
|
||||
$settings->yearlyMemberFilter = FilterScope::from($request->yearlyMemberFilter);
|
||||
$settings->preventAgainst = $request->preventAgainst;
|
||||
$settings->save();
|
||||
|
||||
Succeeded::message('Einstellungen gespeichert.')->dispatch();
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
namespace App\Prevention\Actions;
|
||||
|
||||
use App\Member\Member;
|
||||
use App\Prevention\Data\PreventionData;
|
||||
use App\Prevention\Mails\YearlyMail;
|
||||
use App\Prevention\PreventionSettings;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
||||
class YearlyRememberAction
|
||||
{
|
||||
use AsAction;
|
||||
|
||||
public string $commandSignature = 'prevention:remember-yearly';
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$settings = app(PreventionSettings::class);
|
||||
$expireDate = now()->addWeeks($settings->weeks);
|
||||
|
||||
if (!$settings->active) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($settings->yearlyMemberFilter->getQuery()->get() as $member) {
|
||||
// @todo add this check to FilterScope
|
||||
if ($member->getMailRecipient() === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$noticePreventions = $member->preventions($expireDate)
|
||||
->filter(fn($prevention) => $prevention->expiresAt($expireDate))
|
||||
->filter(fn($p) => $p->appliesToSettings($settings));
|
||||
|
||||
if ($noticePreventions->count() === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Mail::send($this->createMail($member, $noticePreventions));
|
||||
}
|
||||
|
||||
foreach ($settings->yearlyMemberFilter->getQuery()->get() as $member) {
|
||||
// @todo add this check to FilterScope
|
||||
if ($member->getMailRecipient() === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$preventions = $member->preventions()
|
||||
->filter(fn($prevention) => $prevention->expiresAt(now()))
|
||||
->filter(fn($p) => $p->appliesToSettings($settings));
|
||||
|
||||
if ($preventions->count() === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Cache::remember(
|
||||
'prevention-' . $member->id,
|
||||
(int) now()->diffInSeconds(now()->addWeeks($settings->freshRememberInterval)),
|
||||
function () use ($member, $preventions) {
|
||||
Mail::send($this->createMail($member, $preventions));
|
||||
return 0;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection<int, PreventionData> $preventions
|
||||
*/
|
||||
protected function createMail(Member $member, Collection $preventions): YearlyMail
|
||||
{
|
||||
$body = app(PreventionSettings::class)->refresh()->yearlymail;
|
||||
return new YearlyMail($member, $body, $preventions);
|
||||
}
|
||||
}
|
|
@ -2,19 +2,19 @@
|
|||
|
||||
namespace App\Prevention\Contracts;
|
||||
|
||||
use App\Prevention\Enums\Prevention;
|
||||
use App\Prevention\Data\PreventionData;
|
||||
use Illuminate\Support\Collection;
|
||||
use stdClass;
|
||||
|
||||
interface Preventable
|
||||
{
|
||||
|
||||
public function preventableLayout(): string;
|
||||
public function preventableSubject(): string;
|
||||
|
||||
/**
|
||||
* @return array<int, Prevention>
|
||||
* @return Collection<int, PreventionData>
|
||||
*/
|
||||
public function preventions(): array;
|
||||
public function preventions(): Collection;
|
||||
|
||||
public function getMailRecipient(): stdClass;
|
||||
public function getMailRecipient(): ?stdClass;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Prevention\Data;
|
||||
|
||||
use App\Prevention\Enums\Prevention;
|
||||
use App\Prevention\PreventionSettings;
|
||||
use Carbon\Carbon;
|
||||
use Spatie\LaravelData\Data;
|
||||
|
||||
class PreventionData extends Data
|
||||
{
|
||||
public function __construct(public Prevention $type, public Carbon $expires) {}
|
||||
|
||||
public function expiresAt(Carbon $date): bool
|
||||
{
|
||||
return $this->expires->isSameDay($date);
|
||||
}
|
||||
|
||||
public function text(): string
|
||||
{
|
||||
return str($this->type->text())->when(
|
||||
!$this->expiresAt(now()),
|
||||
fn($str) => $str->append(' (fällig am ' . $this->expires->format('d.m.Y') . ')')
|
||||
);
|
||||
}
|
||||
|
||||
public function appliesToSettings(PreventionSettings $settings): bool
|
||||
{
|
||||
return in_array($this->type->name, $settings->preventAgainst);
|
||||
}
|
||||
}
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
namespace App\Prevention\Enums;
|
||||
|
||||
use App\Member\Member;
|
||||
use Carbon\Carbon;
|
||||
use App\Prevention\Data\PreventionData;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
enum Prevention
|
||||
|
@ -39,15 +38,26 @@ enum Prevention
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array<int, self> $preventions
|
||||
* @param Collection<int, PreventionData> $preventions
|
||||
* @return Collection<int, array{letter: string, value: bool, tooltip: string}>
|
||||
*/
|
||||
public static function items(array $preventions): Collection
|
||||
public static function items(Collection $preventions): Collection
|
||||
{
|
||||
return collect(static::cases())->map(fn ($case) => [
|
||||
return collect(static::cases())->map(fn($case) => [
|
||||
'letter' => $case->letter(),
|
||||
'value' => !in_array($case, $preventions),
|
||||
'tooltip' => $case->tooltip(!in_array($case, $preventions)),
|
||||
'value' => $preventions->pluck('type')->doesntContain($case),
|
||||
'tooltip' => $case->tooltip($preventions->pluck('type')->doesntContain($case)),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public static function values(): array
|
||||
{
|
||||
return collect(static::cases())->map(fn($case) => [
|
||||
'id' => $case->name,
|
||||
'name' => $case->text(),
|
||||
])->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,14 @@ namespace App\Prevention\Mails;
|
|||
use App\Invoice\InvoiceSettings;
|
||||
use App\Lib\Editor\EditorData;
|
||||
use App\Prevention\Contracts\Preventable;
|
||||
use App\Prevention\Data\PreventionData;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Attachment;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class PreventionRememberMail extends Mailable
|
||||
{
|
||||
|
@ -20,12 +22,13 @@ class PreventionRememberMail extends Mailable
|
|||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
* @param Collection<int, PreventionData> $preventions
|
||||
*/
|
||||
public function __construct(public Preventable $preventable, public EditorData $bodyText)
|
||||
public function __construct(public Preventable $preventable, public EditorData $bodyText, public Collection $preventions)
|
||||
{
|
||||
$this->settings = app(InvoiceSettings::class);
|
||||
$this->bodyText = $this->bodyText
|
||||
->replaceWithList('wanted', collect($preventable->preventions())->map(fn ($prevention) => $prevention->text())->toArray());
|
||||
->replaceWithList('wanted', $preventions->map(fn($prevention) => $prevention->text())->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,7 +51,7 @@ class PreventionRememberMail extends Mailable
|
|||
public function content()
|
||||
{
|
||||
return new Content(
|
||||
markdown: $this->preventable->preventableLayout(),
|
||||
markdown: 'mail.prevention.prevention-remember-participant',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace App\Prevention\Mails;
|
||||
|
||||
use App\Invoice\InvoiceSettings;
|
||||
use App\Lib\Editor\EditorData;
|
||||
use App\Prevention\Contracts\Preventable;
|
||||
use App\Prevention\Data\PreventionData;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Attachment;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class YearlyMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public InvoiceSettings $settings;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
* @param Collection<int, PreventionData> $preventions
|
||||
*/
|
||||
public function __construct(public Preventable $preventable, public EditorData $bodyText, public Collection $preventions)
|
||||
{
|
||||
$this->settings = app(InvoiceSettings::class);
|
||||
$this->bodyText = $this->bodyText
|
||||
->replaceWithList('wanted', $preventions->map(fn($prevention) => $prevention->text())->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*
|
||||
* @return \Illuminate\Mail\Mailables\Envelope
|
||||
*/
|
||||
public function envelope()
|
||||
{
|
||||
return (new Envelope(
|
||||
subject: $this->preventable->preventableSubject(),
|
||||
))->to($this->preventable->getMailRecipient()->email, $this->preventable->getMailRecipient()->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*
|
||||
* @return \Illuminate\Mail\Mailables\Content
|
||||
*/
|
||||
public function content()
|
||||
{
|
||||
return new Content(
|
||||
markdown: 'mail.prevention.prevention-remember-participant',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
|
@ -3,12 +3,23 @@
|
|||
namespace App\Prevention;
|
||||
|
||||
use App\Lib\Editor\EditorData;
|
||||
use App\Member\FilterScope;
|
||||
use App\Setting\LocalSettings;
|
||||
|
||||
class PreventionSettings extends LocalSettings
|
||||
{
|
||||
|
||||
public EditorData $formmail;
|
||||
public EditorData $yearlymail;
|
||||
public int $weeks;
|
||||
public int $freshRememberInterval;
|
||||
public bool $active;
|
||||
public FilterScope $yearlyMemberFilter;
|
||||
/**
|
||||
* @var array<int, string>
|
||||
* @todo Create collection cast to Collection of enums
|
||||
*/
|
||||
public array $preventAgainst;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
|
@ -27,4 +38,17 @@ class PreventionSettings extends LocalSettings
|
|||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo return int value here and handle this in vue with a number field that only expects integers
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toFrontend(): array
|
||||
{
|
||||
return [
|
||||
...$this->toArray(),
|
||||
'weeks' => (string) $this->weeks,
|
||||
'freshRememberInterval' => (string) $this->freshRememberInterval,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class SearchAction
|
|||
use AsAction;
|
||||
|
||||
/**
|
||||
* @return LengthAwarePaginator<array<string, mixed>>
|
||||
* @return LengthAwarePaginator<int, array<string, mixed>>
|
||||
*/
|
||||
public function handle(ActionRequest $request): LengthAwarePaginator
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@ namespace App\Setting;
|
|||
|
||||
use App\Group;
|
||||
use App\Initialize\Actions\NamiLoginCheckAction;
|
||||
use App\Nami\Actions\SettingSaveAction;
|
||||
use App\Setting\Contracts\Storeable;
|
||||
use Lorisleiva\Actions\ActionRequest;
|
||||
use Zoomyboy\LaravelNami\Api;
|
||||
|
@ -12,7 +11,7 @@ use Zoomyboy\LaravelNami\Nami;
|
|||
|
||||
class NamiSettings extends LocalSettings implements Storeable
|
||||
{
|
||||
public int $mglnr;
|
||||
public string $mglnr;
|
||||
|
||||
public string $password;
|
||||
|
||||
|
|
|
@ -8,3 +8,5 @@ sudo mysql adrema < db.tmp
|
|||
rm db.tmp
|
||||
|
||||
echo 'app(\App\Form\FormSettings::class)->fill(["registerUrl" => "http://stammsilva.test/anmeldung/{slug}/register", "clearCacheUrl" => "http://stammsilva.test/adrema/clear-cache"])->save();' | php artisan tinker
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
"cviebrock/eloquent-sluggable": "^11.0",
|
||||
"doctrine/dbal": "^3.1",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"inertiajs/inertia-laravel": "^1.0",
|
||||
"inertiajs/inertia-laravel": "^2.0",
|
||||
"laravel/framework": "^11.0",
|
||||
"laravel/horizon": "^5.0",
|
||||
"laravel/pail": "^1.1",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -119,7 +119,7 @@ return [
|
|||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
|
|
|
@ -47,8 +47,8 @@ class FormFactory extends Factory
|
|||
'description' => EditorRequestFactory::new()->toData(),
|
||||
'excerpt' => $this->faker->words(10, true),
|
||||
'config' => ['sections' => []],
|
||||
'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'),
|
||||
'from' => $this->faker->dateTimeBetween('+1 week', '+3 weeks')->format('Y-m-d'),
|
||||
'to' => $this->faker->dateTimeBetween('+4 week', '+6 weeks')->format('Y-m-d'),
|
||||
'registration_from' => $this->faker->dateTimeBetween(Carbon::parse('-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'),
|
||||
'mail_top' => EditorRequestFactory::new()->toData(),
|
||||
|
@ -57,6 +57,8 @@ class FormFactory extends Factory
|
|||
'is_private' => false,
|
||||
'export' => ExportData::from([]),
|
||||
'prevention_conditions' => Condition::defaults(),
|
||||
'zip' => $this->faker->numberBetween(1100, 99999),
|
||||
'location' => $this->faker->city(),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -65,7 +67,7 @@ class FormFactory extends Factory
|
|||
*/
|
||||
public function sections(array $sections): self
|
||||
{
|
||||
return $this->state(['config' => ['sections' => array_map(fn ($section) => $section->create(), $sections)]]);
|
||||
return $this->state(['config' => ['sections' => array_map(fn($section) => $section->create(), $sections)]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -98,6 +98,12 @@ class MemberFactory extends Factory
|
|||
return $this->state(['nami_id' => null]);
|
||||
}
|
||||
|
||||
public function name(string $name): self
|
||||
{
|
||||
[$firstname, $lastname] = explode(' ', $name);
|
||||
return $this->state(compact('firstname', 'lastname'));
|
||||
}
|
||||
|
||||
public function withBankAccount(BankAccountFactory $factory): self
|
||||
{
|
||||
return $this->afterCreating(function ($member) use ($factory) {
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Database\Factories\Member;
|
|||
|
||||
use App\Activity;
|
||||
use App\Group;
|
||||
use App\Member\Member;
|
||||
use App\Member\Membership;
|
||||
use App\Subactivity;
|
||||
use Carbon\Carbon;
|
||||
|
@ -30,6 +31,10 @@ class MembershipFactory extends Factory
|
|||
];
|
||||
}
|
||||
|
||||
public function defaults(): self {
|
||||
return $this->for(Member::factory()->defaults())->for(Group::factory())->for(Activity::factory())->for(Subactivity::factory());
|
||||
}
|
||||
|
||||
public function inNami(int $namiId): self
|
||||
{
|
||||
return $this->state(['nami_id' => $namiId]);
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<?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('forms', function (Blueprint $table) {
|
||||
$table->string('zip')->nullable()->after('name');
|
||||
$table->string('location')->nullable()->after('name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('forms', function (Blueprint $table) {
|
||||
$table->dropColumn('zip');
|
||||
$table->dropColumn('location');
|
||||
});
|
||||
}
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
<?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('forms', function (Blueprint $table) {
|
||||
$table->string('country')->nullable()->after('location');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('forms', function (Blueprint $table) {
|
||||
$table->dropColumn('country');
|
||||
});
|
||||
}
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
<?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('forms', function (Blueprint $table) {
|
||||
$table->json('leader_conditions')->after('name')->default(json_encode(['mode' => 'all', 'ifs' => []]));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('forms', function (Blueprint $table) {
|
||||
$table->dropColumn('leader_conditions');
|
||||
});
|
||||
}
|
||||
};
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
use App\Member\FilterScope;
|
||||
use Spatie\LaravelSettings\Migrations\SettingsMigration;
|
||||
|
||||
return new class extends SettingsMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
$this->migrator->add('prevention.yearlymail', ['time' => 1, 'blocks' => [], 'version' => '1.0']);
|
||||
$this->migrator->add('prevention.weeks', 8);
|
||||
$this->migrator->add('prevention.freshRememberInterval', 12);
|
||||
$this->migrator->add('prevention.active', false);
|
||||
$this->migrator->add('prevention.yearlyMemberFilter', FilterScope::from([])->toArray());
|
||||
$this->migrator->add('prevention.preventAgainst', []);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,43 @@
|
|||
import eslint from '@eslint/js';
|
||||
import eslintPluginVue from 'eslint-plugin-vue';
|
||||
import typescriptEslint from 'typescript-eslint';
|
||||
import globals from 'globals';
|
||||
|
||||
export default typescriptEslint.config(
|
||||
{ ignores: ['*.d.ts', '**/coverage', '**/dist'] },
|
||||
{
|
||||
extends: [
|
||||
eslint.configs.recommended,
|
||||
...typescriptEslint.configs.recommended,
|
||||
...eslintPluginVue.configs['flat/recommended'],
|
||||
],
|
||||
files: ['**/*.{ts,vue}'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2022,
|
||||
sourceType: 'module',
|
||||
globals: globals.browser,
|
||||
parserOptions: {
|
||||
parser: typescriptEslint.parser,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'indent': ['error', 4],
|
||||
'vue/html-indent': ['error', 4],
|
||||
'linebreak-style': ['error', 'unix'],
|
||||
'quotes': ['error', 'single'],
|
||||
'semi': ['error', 'always'],
|
||||
'vue/no-reserved-component-names': 'off',
|
||||
'vue/multi-word-component-names': 'off',
|
||||
'vue/max-attributes-per-line': 'off',
|
||||
'vue/singleline-html-element-content-newline': 'off',
|
||||
"vue/first-attribute-linebreak": ["error", {
|
||||
"singleline": "beside",
|
||||
"multiline": "beside"
|
||||
}],
|
||||
'vue/no-undef-properties': ['error', {
|
||||
'ignores': ['/^\\$/']
|
||||
}]
|
||||
},
|
||||
},
|
||||
);
|
||||
|
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
|
@ -16,11 +16,9 @@
|
|||
"autoprefixer": "^10.4.17",
|
||||
"axios": "^1.6.6",
|
||||
"dayjs": "^1.11.10",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-prettier": "^8.10.0",
|
||||
"eslint-plugin-vue": "^8.7.1",
|
||||
"postcss": "^8.4.33",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"unplugin-vue-components": "^28.7.0",
|
||||
"vue-axios": "^3.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -28,12 +26,14 @@
|
|||
"@editorjs/header": "^2.8.1",
|
||||
"@editorjs/nested-list": "^1.4.2",
|
||||
"@editorjs/paragraph": "^2.11.3",
|
||||
"@inertiajs/vue3": "^1.0.14",
|
||||
"@inertiajs/vue3": "^2.0",
|
||||
"@tailwindcss/forms": "^0.5.7",
|
||||
"@tailwindcss/typography": "^0.5.10",
|
||||
"@vitejs/plugin-vue": "^4.6.2",
|
||||
"change-case": "^4.1.2",
|
||||
"editorjs-alert": "^1.1.3",
|
||||
"eslint": "^9.28.0",
|
||||
"eslint-plugin-vue": "^10.2.0",
|
||||
"floating-vue": "^2.0.0",
|
||||
"laravel-echo": "^1.15.3",
|
||||
"laravel-vite-plugin": "^0.7.8",
|
||||
|
@ -41,11 +41,13 @@
|
|||
"merge": "^2.1.1",
|
||||
"pinia": "^2.1.7",
|
||||
"postcss-import": "^14.1.0",
|
||||
"prettier": "^2.8.8",
|
||||
"pusher-js": "^8.3.0",
|
||||
"svg-sprite": "^2.0.2",
|
||||
"typescript-eslint": "^8.34.0",
|
||||
"uuid": "^11.1.0",
|
||||
"vite": "^4.5.2",
|
||||
"vue": "^3.3.4",
|
||||
"vue-clipboard3": "^2.0.0",
|
||||
"vue-toastification": "^2.0.0-rc.5",
|
||||
"vuedraggable": "^4.1.0",
|
||||
"wnumb": "^1.2.0"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c20cf930f2037ddda4400dd7d35bf9ef707356eb
|
||||
Subproject commit 47f01b3c3c98821603f3612511d713cf51a6a14c
|
|
@ -418,11 +418,6 @@ parameters:
|
|||
count: 1
|
||||
path: app/Mailgateway/Resources/MailgatewayResource.php
|
||||
|
||||
-
|
||||
message: "#^Generic type Illuminate\\\\Pagination\\\\LengthAwarePaginator\\<int, App\\\\Member\\\\Member\\> in PHPDoc tag @return specifies 2 template types, but class Illuminate\\\\Pagination\\\\LengthAwarePaginator supports only 1\\: TValue$#"
|
||||
count: 1
|
||||
path: app/Member/Actions/SearchAction.php
|
||||
|
||||
-
|
||||
message: "#^Class Plugins\\\\Test\\\\ServiceProvider not found\\.$#"
|
||||
count: 1
|
||||
|
|
|
@ -31,6 +31,12 @@
|
|||
@apply bg-yellow-500 text-yellow-100;
|
||||
}
|
||||
}
|
||||
&.btn-default {
|
||||
@apply bg-gray-700 text-gray-300;
|
||||
&:not(.disabled):hover {
|
||||
@apply bg-gray-500 text-gray-100;
|
||||
}
|
||||
}
|
||||
&.btn-info {
|
||||
@apply bg-blue-700 text-blue-300;
|
||||
&:not(.disabled):hover {
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
.ce-settings__button,
|
||||
.ce-toolbar__settings-btn,
|
||||
.cdx-button,
|
||||
.ce-popover,
|
||||
.ce-popover__container,
|
||||
.ce-toolbar__plus:hover {
|
||||
@apply bg-primary-700;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.ce-inline-tool-input {
|
||||
@apply bg-primary-700 text-primary-200 placeholder-primary-500;
|
||||
.cdx-search-field {
|
||||
@apply bg-primary-600;
|
||||
}
|
||||
|
||||
.ce-block--selected {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
.custom-table {
|
||||
width: 100%;
|
||||
& > thead > th {
|
||||
& > thead > th, & > thead > tr > th {
|
||||
@apply text-left px-6 text-gray-200 font-semibold py-3 border-gray-600 border-b;
|
||||
}
|
||||
|
||||
& > tr {
|
||||
& > tr, & > tbody > tr {
|
||||
@apply text-gray-200 transition-all duration-300 rounded hover:bg-gray-800;
|
||||
& > td {
|
||||
@apply py-1 px-6;
|
||||
|
@ -12,10 +12,10 @@
|
|||
}
|
||||
|
||||
&.custom-table-sm {
|
||||
& > thead > th {
|
||||
& > thead > th, & > thead > tr > th {
|
||||
@apply px-3 py-2;
|
||||
}
|
||||
& > tr {
|
||||
& > tr, & > tbody > tr {
|
||||
& > td {
|
||||
@apply py-1 px-3;
|
||||
}
|
||||
|
@ -23,20 +23,11 @@
|
|||
}
|
||||
|
||||
&.custom-table-light {
|
||||
& > thead > th {
|
||||
& > thead > th, & > thead > tr > th {
|
||||
@apply border-gray-500;
|
||||
}
|
||||
& > td {
|
||||
&:hover {
|
||||
@apply bg-gray-700;
|
||||
}
|
||||
& > tr, & > tbody > tr {
|
||||
@apply hover:bg-gray-700;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.custom-table > * {
|
||||
display: table-row;
|
||||
}
|
||||
.custom-table > * > * {
|
||||
display: table-cell;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
.v-popper__popper {
|
||||
@apply max-w-lg;
|
||||
}
|
||||
|
||||
.v-popper--theme-tooltip .v-popper__inner {
|
||||
@apply bg-primary-400 text-primary-800 px-3 py-1 text-sm;
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M6 6V2c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-4v4a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8c0-1.1.9-2 2-2h4zm2 0h4a2 2 0 0 1 2 2v4h4V2H8v4zM2 8v10h10V8H2z"/></svg>
|
After Width: | Height: | Size: 233 B |
|
@ -0,0 +1,4 @@
|
|||
<svg x="0px" y="0px" viewBox="0 0 511.626 511.627" xml:space="preserve">
|
||||
<path d="M392.857,292.354h-18.274c-2.669,0-4.859,0.855-6.563,2.573c-1.718,1.708-2.573,3.897-2.573,6.563v91.361 c0,12.563-4.47,23.315-13.415,32.262c-8.945,8.945-19.701,13.414-32.264,13.414H82.224c-12.562,0-23.317-4.469-32.264-13.414 c-8.945-8.946-13.417-19.698-13.417-32.262V155.31c0-12.562,4.471-23.313,13.417-32.259c8.947-8.947,19.702-13.418,32.264-13.418 h200.994c2.669,0,4.859-0.859,6.57-2.57c1.711-1.713,2.566-3.9,2.566-6.567V82.221c0-2.662-0.855-4.853-2.566-6.563 c-1.711-1.713-3.901-2.568-6.57-2.568H82.224c-22.648,0-42.016,8.042-58.102,24.125C8.042,113.297,0,132.665,0,155.313v237.542 c0,22.647,8.042,42.018,24.123,58.095c16.086,16.084,35.454,24.13,58.102,24.13h237.543c22.647,0,42.017-8.046,58.101-24.13 c16.085-16.077,24.127-35.447,24.127-58.095v-91.358c0-2.669-0.856-4.859-2.574-6.57 C397.709,293.209,395.519,292.354,392.857,292.354z"/>
|
||||
<path d="M506.199,41.971c-3.617-3.617-7.905-5.424-12.85-5.424H347.171c-4.948,0-9.233,1.807-12.847,5.424 c-3.617,3.615-5.428,7.898-5.428,12.847s1.811,9.233,5.428,12.85l50.247,50.248L198.424,304.067 c-1.906,1.903-2.856,4.093-2.856,6.563c0,2.479,0.953,4.668,2.856,6.571l32.548,32.544c1.903,1.903,4.093,2.852,6.567,2.852 s4.665-0.948,6.567-2.852l186.148-186.148l50.251,50.248c3.614,3.617,7.898,5.426,12.847,5.426s9.233-1.809,12.851-5.426 c3.617-3.616,5.424-7.898,5.424-12.847V54.818C511.626,49.866,509.813,45.586,506.199,41.971z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M1.225 21.225A1.678 1.678 0 0 0 2.707 22H22.28a1.68 1.68 0 0 0 1.484-.775 1.608 1.608 0 0 0 .003-1.656L13.995 1.827a1.745 1.745 0 0 0-2.969 0l-9.8 17.742a1.603 1.603 0 0 0 0 1.656zm.859-1.143l9.82-17.773A.71.71 0 0 1 12.508 2a.73.73 0 0 1 .629.342l9.751 17.708a.626.626 0 0 1 .017.662.725.725 0 0 1-.626.288H2.708a.723.723 0 0 1-.623-.286.605.605 0 0 1-.001-.632zM13 15h-1V8h1zm-1.5 2.5a1 1 0 1 1 1 1 1.002 1.002 0 0 1-1-1z"/><path fill="none" d="M0 0h24v24H0z"/></svg>
|
After Width: | Height: | Size: 686 B |
|
@ -1,16 +1,15 @@
|
|||
import {createApp, h, defineAsyncComponent} from 'vue';
|
||||
import {Head, createInertiaApp, Link as ILink} from '@inertiajs/vue3';
|
||||
import { createApp, h, defineAsyncComponent } from 'vue';
|
||||
import { Head, createInertiaApp, Link as ILink } from '@inertiajs/vue3';
|
||||
import axios from 'axios';
|
||||
import VueAxios from 'vue-axios';
|
||||
import {Plugin as FloatingVue, options as FloatingVueOptions} from './lib/floatingVue.js';
|
||||
import {createPinia, PiniaVuePlugin} from 'pinia';
|
||||
import { Plugin as FloatingVue, options as FloatingVueOptions } from './lib/floatingVue.js';
|
||||
import { createPinia, PiniaVuePlugin } from 'pinia';
|
||||
import Echo from './lib/echo.js';
|
||||
import requireModules from './lib/requireModules.js';
|
||||
|
||||
import AppLayout from './layouts/AppLayout.vue';
|
||||
import hasModule from './mixins/hasModule.js';
|
||||
import hasFlash from './mixins/hasFlash.js';
|
||||
import {Toast, options as toastOptions, interceptor as toastInterceptor} from './lib/toast.js';
|
||||
import { Toast, options as toastOptions, interceptor as toastInterceptor } from './lib/toast.js';
|
||||
|
||||
// ---------------------------------- Assets -----------------------------------
|
||||
import '../css/app.css';
|
||||
|
@ -35,8 +34,8 @@ createInertiaApp({
|
|||
|
||||
return page;
|
||||
},
|
||||
setup({el, App, props, plugin}) {
|
||||
var app = createApp({pinia, render: () => h(App, props)})
|
||||
setup({ el, App, props, plugin }) {
|
||||
var app = createApp({ pinia, render: () => h(App, props) })
|
||||
.use(plugin)
|
||||
.use(FloatingVue, FloatingVueOptions)
|
||||
.use(Toast, toastOptions)
|
||||
|
@ -47,9 +46,6 @@ createInertiaApp({
|
|||
.mixin(hasModule)
|
||||
.mixin(hasFlash);
|
||||
|
||||
requireModules(import.meta.glob('./components/form/*.vue'), app, 'f');
|
||||
requireModules(import.meta.glob('./components/ui/*.vue'), app, 'ui');
|
||||
requireModules(import.meta.glob('./components/page/*.vue', {eager: true}), app, 'page');
|
||||
app.component(
|
||||
'FSinglefile',
|
||||
defineAsyncComponent(() => import('!/medialibrary-helper/assets/components/SingleFile.vue'))
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
// Generated by unplugin-vue-components
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
// biome-ignore lint: disable
|
||||
export {}
|
||||
|
||||
/* prettier-ignore */
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
FCheckboxesLabel: typeof import('@/components/form/CheckboxesLabel.vue')['default']
|
||||
FEditor: typeof import('@/components/form/Editor.vue')['default']
|
||||
FHint: typeof import('@/components/form/Hint.vue')['default']
|
||||
FLabel: typeof import('@/components/form/Label.vue')['default']
|
||||
FMemberFilter: typeof import('@/components/form/MemberFilter.vue')['default']
|
||||
FMultipleselect: typeof import('@/components/form/Multipleselect.vue')['default']
|
||||
FSaveButton: typeof import('@/components/form/SaveButton.vue')['default']
|
||||
FSelect: typeof import('@/components/form/Select.vue')['default']
|
||||
FSwitch: typeof import('@/components/form/Switch.vue')['default']
|
||||
FText: typeof import('@/components/form/Text.vue')['default']
|
||||
FTextarea: typeof import('@/components/form/Textarea.vue')['default']
|
||||
PageFilter: typeof import('@/components/page/Filter.vue')['default']
|
||||
PageFullHeading: typeof import('@/components/page/FullHeading.vue')['default']
|
||||
PageFullHeadingBanner: typeof import('@/components/page/FullHeadingBanner.vue')['default']
|
||||
PageFullLayout: typeof import('@/components/page/FullLayout.vue')['default']
|
||||
PageHeader: typeof import('@/components/page/Header.vue')['default']
|
||||
PageLayout: typeof import('@/components/page/Layout.vue')['default']
|
||||
PagePopups: typeof import('@/components/page/Popups.vue')['default']
|
||||
PageSearchModal: typeof import('@/components/page/SearchModal.vue')['default']
|
||||
PageTitle: typeof import('@/components/page/Title.vue')['default']
|
||||
PageToolbarButton: typeof import('@/components/page/ToolbarButton.vue')['default']
|
||||
UiActionButton: typeof import('@/components/ui/ActionButton.vue')['default']
|
||||
UiAgeGroups: typeof import('@/components/ui/AgeGroups.vue')['default']
|
||||
UiBool: typeof import('@/components/ui/Bool.vue')['default']
|
||||
UiBooleanDisplay: typeof import('@/components/ui/BooleanDisplay.vue')['default']
|
||||
UiBox: typeof import('@/components/ui/Box.vue')['default']
|
||||
UiButton: typeof import('@/components/ui/Button.vue')['default']
|
||||
UiFilterSidebar: typeof import('@/components/ui/FilterSidebar.vue')['default']
|
||||
UiIconButton: typeof import('@/components/ui/IconButton.vue')['default']
|
||||
UiLabel: typeof import('@/components/ui/Label.vue')['default']
|
||||
UiLoading: typeof import('@/components/ui/Loading.vue')['default']
|
||||
UiMenulist: typeof import('@/components/ui/Menulist.vue')['default']
|
||||
UiNote: typeof import('@/components/ui/Note.vue')['default']
|
||||
UiPagination: typeof import('@/components/ui/Pagination.vue')['default']
|
||||
UiPopup: typeof import('@/components/ui/Popup.vue')['default']
|
||||
UiRemoteResource: typeof import('@/components/ui/RemoteResource.vue')['default']
|
||||
UiRemoteSelector: typeof import('@/components/ui/RemoteSelector.vue')['default']
|
||||
UiSearchPagination: typeof import('@/components/ui/SearchPagination.vue')['default']
|
||||
UiSearchResult: typeof import('@/components/ui/SearchResult.vue')['default']
|
||||
UiSidebar: typeof import('@/components/ui/Sidebar.vue')['default']
|
||||
UiSpinner: typeof import('@/components/ui/Spinner.vue')['default']
|
||||
UiSprite: typeof import('@/components/ui/Sprite.vue')['default']
|
||||
UiTableToggleButton: typeof import('@/components/ui/TableToggleButton.vue')['default']
|
||||
UiTabs: typeof import('@/components/ui/Tabs.vue')['default']
|
||||
UiTextDisplay: typeof import('@/components/ui/TextDisplay.vue')['default']
|
||||
UiTh: typeof import('@/components/ui/Th.vue')['default']
|
||||
}
|
||||
}
|
|
@ -1,22 +1,21 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="flex flex-col group" :for="id" :class="sizeClass(size)">
|
||||
<f-label v-if="label" :required="required" :value="label"></f-label>
|
||||
<f-label v-if="label" :required="required" :value="label" />
|
||||
<div class="relative w-full h-full">
|
||||
<div :id="id" :class="[fieldAppearance, paddingX, paddingY]"></div>
|
||||
<f-hint v-if="hint" :value="hint"></f-hint>
|
||||
<div :id="id" :class="[fieldAppearance, paddingX, paddingY]" />
|
||||
<f-hint v-if="hint" :value="hint" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ui-popup
|
||||
v-if="condition !== null"
|
||||
heading="Bedingungen"
|
||||
@close="
|
||||
condition.resolve(condition.data);
|
||||
condition = null;
|
||||
"
|
||||
<ui-popup v-if="condition !== null"
|
||||
heading="Bedingungen"
|
||||
@close="
|
||||
condition.resolve(condition.data);
|
||||
condition = null;
|
||||
"
|
||||
>
|
||||
<slot name="conditions" :data="condition.data" :resolve="condition.resolve" :reject="condition.reject"></slot>
|
||||
<slot name="conditions" :data="condition.data" :resolve="condition.resolve" :reject="condition.reject" />
|
||||
</ui-popup>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -106,10 +105,10 @@ class ConditionTune {
|
|||
wrap(blockContent) {
|
||||
this.wrapper = document.createElement('div');
|
||||
|
||||
var tooltip = document.createElement('div');
|
||||
const tooltip = document.createElement('div');
|
||||
tooltip.setAttribute('data-tooltip', '');
|
||||
|
||||
var content = document.createElement('div');
|
||||
const content = document.createElement('div');
|
||||
content.setAttribute('data-content', '');
|
||||
|
||||
content.appendChild(blockContent);
|
||||
|
@ -144,7 +143,7 @@ class ConditionTune {
|
|||
'Bedingung ' +
|
||||
this.data.ifs
|
||||
.map((i) => {
|
||||
var parts = [i.field];
|
||||
const parts = [i.field];
|
||||
|
||||
if (i.comparator === 'isEqual' || i.comparator === 'isIn') {
|
||||
parts.push('=');
|
||||
|
@ -191,7 +190,7 @@ class ConditionTune {
|
|||
}
|
||||
|
||||
onMounted(async () => {
|
||||
var tools = {
|
||||
const tools = {
|
||||
paragraph: {
|
||||
class: Paragraph,
|
||||
shortcut: 'CTRL+P',
|
||||
|
@ -225,7 +224,7 @@ onMounted(async () => {
|
|||
},
|
||||
};
|
||||
|
||||
var tunes = [];
|
||||
const tunes = [];
|
||||
|
||||
if (props.conditions) {
|
||||
tools.condition = {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue