Add Frankfurt/Main to contribution generator
This commit is contained in:
parent
ff6c0e462e
commit
349d821638
|
@ -6,6 +6,7 @@ use App\Contribution\Documents\ContributionDocument;
|
||||||
use App\Contribution\Documents\RdpNrwDocument;
|
use App\Contribution\Documents\RdpNrwDocument;
|
||||||
use App\Contribution\Documents\CityRemscheidDocument;
|
use App\Contribution\Documents\CityRemscheidDocument;
|
||||||
use App\Contribution\Documents\CitySolingenDocument;
|
use App\Contribution\Documents\CitySolingenDocument;
|
||||||
|
use App\Contribution\Documents\CityFrankfurtMainDocument;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ class ContributionFactory
|
||||||
RdpNrwDocument::class,
|
RdpNrwDocument::class,
|
||||||
CitySolingenDocument::class,
|
CitySolingenDocument::class,
|
||||||
CityRemscheidDocument::class,
|
CityRemscheidDocument::class,
|
||||||
|
CityFrankfurtMainDocument::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Contribution\Documents;
|
||||||
|
|
||||||
|
use App\Contribution\Data\MemberData;
|
||||||
|
use App\Country;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Zoomyboy\Tex\Engine;
|
||||||
|
use Zoomyboy\Tex\Template;
|
||||||
|
|
||||||
|
class CityFrankfurtMainDocument extends ContributionDocument
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param Collection<int, Collection<int, MemberData>> $members
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
public string $dateFrom,
|
||||||
|
public string $dateUntil,
|
||||||
|
public string $zipLocation,
|
||||||
|
public ?Country $country,
|
||||||
|
public Collection $members,
|
||||||
|
public ?string $filename = '',
|
||||||
|
public string $type = 'F',
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static function fromRequest(array $request): self
|
||||||
|
{
|
||||||
|
return new self(
|
||||||
|
dateFrom: $request['dateFrom'],
|
||||||
|
dateUntil: $request['dateUntil'],
|
||||||
|
zipLocation: $request['zipLocation'],
|
||||||
|
country: Country::where('id', $request['country'])->firstOrFail(),
|
||||||
|
members: MemberData::fromModels($request['members'])->chunk(15),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@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),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dateFromHuman(): string
|
||||||
|
{
|
||||||
|
return Carbon::parse($this->dateFrom)->format('d.m.Y');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dateUntilHuman(): string
|
||||||
|
{
|
||||||
|
return Carbon::parse($this->dateUntil)->format('d.m.Y');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function countryName(): string
|
||||||
|
{
|
||||||
|
return $this->country->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function memberShort(MemberData $member): string
|
||||||
|
{
|
||||||
|
return $member->isLeader ? 'L' : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function memberName(MemberData $member): string
|
||||||
|
{
|
||||||
|
return $member->separatedName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function memberAddress(MemberData $member): string
|
||||||
|
{
|
||||||
|
return $member->fullAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function memberAge(MemberData $member): string
|
||||||
|
{
|
||||||
|
return $member->age();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function basename(): string
|
||||||
|
{
|
||||||
|
return 'zuschuesse-frankfurt';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view(): string
|
||||||
|
{
|
||||||
|
return 'tex.contribution.city-frankfurt-main';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function template(): Template
|
||||||
|
{
|
||||||
|
return Template::make('tex.templates.contribution');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFilename(string $filename): static
|
||||||
|
{
|
||||||
|
$this->filename = $filename;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEngine(): Engine
|
||||||
|
{
|
||||||
|
return Engine::PDFLATEX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getName(): string
|
||||||
|
{
|
||||||
|
return 'Für Frankfurt erstellen';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public static function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'dateFrom' => 'required|string|date_format:Y-m-d',
|
||||||
|
'dateUntil' => 'required|string|date_format:Y-m-d',
|
||||||
|
'country' => 'required|integer|exists:countries,id',
|
||||||
|
'zipLocation' => 'required|string',
|
||||||
|
'eventName' => 'required|string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
\documentclass[a4paper,landscape]{article}
|
||||||
|
|
||||||
|
\usepackage[landscape,top=0cm,left=0cm,bottom=0cm,right=0cm]{geometry}
|
||||||
|
\usepackage{tikz}
|
||||||
|
\usepackage{background}
|
||||||
|
\usepackage{blindtext}
|
||||||
|
\usetikzlibrary{matrix, shapes.misc, calc}
|
||||||
|
|
||||||
|
\pagestyle{empty}
|
||||||
|
\setlength{\parindent}{0cm}
|
||||||
|
\backgroundsetup{scale = 1, angle = 0, opacity = 1, color=black, contents = {\includegraphics[width = \paperwidth, height = \paperheight] {city-frankfurt-main.pdf}}}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\noindent \sffamily
|
||||||
|
|
||||||
|
@foreach($members as $chunk)
|
||||||
|
\begin{tikzpicture}[remember picture,overlay,yscale=-1]
|
||||||
|
\node[anchor=base west] at (53.2mm,31.0mm) {\bfseries{\large{}}}; %Feld: Jugendverband/-Gruppe
|
||||||
|
\node[anchor=base west] at (41.5mm,38.8mm) {\bfseries{\large{}}}; %Feld: Art der Maßnahme
|
||||||
|
\node[anchor=base west] at (18.0mm,47.0mm) {\bfseries{\large{<<<!!$zipLocation!!>>>, <<<!!$countryName!!>>>}}};
|
||||||
|
\node[anchor=base west] at (171.0mm,47.0mm) {\bfseries{\large{<<<!!$dateFromHuman!!>>>}}};
|
||||||
|
\node[anchor=base west] at (220.0mm,47.0mm) {\bfseries{\large{<<<!!$dateUntilHuman!!>>>}}};
|
||||||
|
|
||||||
|
@foreach($chunk as $i => $member)
|
||||||
|
\node[anchor=base, text width=4mm, align=center] at ($(8.0mm, 69.0mm + 8.05mm * <<<$i%15>>>)$) {<<<$memberShort($member)>>>};
|
||||||
|
\node[anchor=base, text width=6mm, align=center] at ($(13.0mm, 69.0mm + 8.05mm * <<<$i%15>>>)$) {<<<$i+1>>>};
|
||||||
|
\node[anchor=base, text width=67.5mm, align=center] at ($(50.65mm, 69.0mm + 8.05mm * <<<$i%15>>>)$) {<<<$memberName($member)>>>};
|
||||||
|
\node[anchor=base, text width=14.6mm, align=center] at ($(92.2mm, 69.0mm + 8.05mm * <<<$i%15>>>)$) {<<<$memberAge($member)>>>};
|
||||||
|
\node[anchor=base, text width=79.4mm, align=center] at ($(139.7mm, 69.0mm + 8.05mm * <<<$i%15>>>)$) {<<<$memberAddress($member)>>>};
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
\end{tikzpicture}
|
||||||
|
|
||||||
|
\pagebreak
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
\end{document}
|
||||||
|
|
Binary file not shown.
|
@ -25,6 +25,7 @@ class StoreTest extends TestCase
|
||||||
* @testWith ["App\\Contribution\\Documents\\CitySolingenDocument", ["Super tolles Lager", "Max Muster", "Jane Muster", "15.06.1991"]]
|
* @testWith ["App\\Contribution\\Documents\\CitySolingenDocument", ["Super tolles Lager", "Max Muster", "Jane Muster", "15.06.1991"]]
|
||||||
* ["App\\Contribution\\Documents\\RdpNrwDocument", ["Muster, Max", "Muster, Jane", "15.06.1991", "42777 SG"]]
|
* ["App\\Contribution\\Documents\\RdpNrwDocument", ["Muster, Max", "Muster, Jane", "15.06.1991", "42777 SG"]]
|
||||||
* ["App\\Contribution\\Documents\\CityRemscheidDocument", ["Max", "Muster", "Jane"]]
|
* ["App\\Contribution\\Documents\\CityRemscheidDocument", ["Max", "Muster", "Jane"]]
|
||||||
|
* ["App\\Contribution\\Documents\\CityFrankfurtMainDocument", ["Max", "Muster", "Jane"]]
|
||||||
*
|
*
|
||||||
* @param array<int, string> $bodyChecks
|
* @param array<int, string> $bodyChecks
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue