From 688e10e2300f5f4efd0d34ab163e70f3e2f89fbb Mon Sep 17 00:00:00 2001 From: philipp lang Date: Fri, 13 Dec 2024 11:56:02 +0100 Subject: [PATCH] Lint --- app/Contribution/Data/MemberData.php | 2 +- .../Documents/CityFrankfurtMainDocument.php | 34 ++----------------- .../tex/contribution/city-frankfurt-main.tex | 12 +++---- 3 files changed, 9 insertions(+), 39 deletions(-) diff --git a/app/Contribution/Data/MemberData.php b/app/Contribution/Data/MemberData.php index 9e44f910..b562b421 100644 --- a/app/Contribution/Data/MemberData.php +++ b/app/Contribution/Data/MemberData.php @@ -74,7 +74,7 @@ class MemberData extends Data public function age(): string { - return (string) $this->birthday->diffInYears(now()) ?: ''; + return $this->birthday ? intval($this->birthday->diffInYears(now())) : ''; } public function birthYear(): string diff --git a/app/Contribution/Documents/CityFrankfurtMainDocument.php b/app/Contribution/Documents/CityFrankfurtMainDocument.php index 92e1a146..63e6acdd 100644 --- a/app/Contribution/Documents/CityFrankfurtMainDocument.php +++ b/app/Contribution/Documents/CityFrankfurtMainDocument.php @@ -3,15 +3,16 @@ namespace App\Contribution\Documents; use App\Contribution\Data\MemberData; +use App\Contribution\Traits\FormatsDates; use App\Contribution\Traits\HasPdfBackground; use App\Country; use App\Invoice\InvoiceSettings; -use Carbon\Carbon; use Illuminate\Support\Collection; class CityFrankfurtMainDocument extends ContributionDocument { use HasPdfBackground; + use FormatsDates; public string $fromName; @@ -62,17 +63,6 @@ class CityFrankfurtMainDocument extends ContributionDocument ); } - public function dateFromHuman(): string - { - return Carbon::parse($this->dateFrom)->format('d.m.Y'); - } - - public function dateUntilHuman(): string - { - return Carbon::parse($this->dateUntil)->format('d.m.Y'); - } - - public function countryName(): string { return $this->country->name; @@ -83,26 +73,6 @@ class CityFrankfurtMainDocument extends ContributionDocument return count($this->members); } - public function memberShort(MemberData $member): string - { - return $member->isLeader ? 'L' : ''; - } - - public function memberName(MemberData $member): string - { - return $member->separatedName(); - } - - public function memberAddress(MemberData $member): string - { - return $member->fullAddress(); - } - - public function memberAge(MemberData $member): string - { - return $member->age(); - } - public static function getName(): string { return 'Frankfurt'; diff --git a/resources/views/tex/contribution/city-frankfurt-main.tex b/resources/views/tex/contribution/city-frankfurt-main.tex index c01dd016..5ae765c4 100644 --- a/resources/views/tex/contribution/city-frankfurt-main.tex +++ b/resources/views/tex/contribution/city-frankfurt-main.tex @@ -18,15 +18,15 @@ \node[anchor=base west, text width=205.3mm] at (52.9mm,31.0mm) {\bfseries{\large{<<>>}}}; %Feld: Jugendverband/-Gruppe \node[anchor=base west, text width=215.9mm] at (41.3mm,38.8mm) {\bfseries{\large{<<>>}}}; %Feld: Art der Maßnahme \node[anchor=base west, text width=104.8mm] at (17.5mm,47.0mm) {\bfseries{\large{<<>>, <<>>}}}; - \node[anchor=base west, text width=41.3mm, align=center] at (170.7mm,47.0mm) {\bfseries{\large{<<>>}}}; - \node[anchor=base west, text width=38.4mm, align=center] at (219.9mm,47.0mm) {\bfseries{\large{<<>>}}}; + \node[anchor=base west, text width=41.3mm, align=center] at (170.7mm,47.0mm) {\bfseries{\large{<<>>}}}; + \node[anchor=base west, text width=38.4mm, align=center] at (219.9mm,47.0mm) {\bfseries{\large{<<>>}}}; @foreach($chunk as $j => $member) - \node[anchor=base, text width=4mm, align=center] at ($(8.0mm, 69.0mm + 8.05mm * <<<$j%15>>>)$) {<<<$memberShort($member)>>>}; + \node[anchor=base, text width=4mm, align=center] at ($(8.0mm, 69.0mm + 8.05mm * <<<$j%15>>>)$) {<<<$member->isLeader ? 'L' : ''>>>}; \node[anchor=base, text width=6mm, align=center] at ($(13.0mm, 69.0mm + 8.05mm * <<<$j%15>>>)$) {<<<$j+1>>>}; - \node[anchor=base, text width=67.5mm, align=center] at ($(50.65mm, 69.0mm + 8.05mm * <<<$j%15>>>)$) {<<<$memberName($member)>>>}; - \node[anchor=base, text width=14.6mm, align=center] at ($(92.2mm, 69.0mm + 8.05mm * <<<$j%15>>>)$) {<<<$memberAge($member)>>>}; - \node[anchor=base, text width=79.4mm, align=center] at ($(139.7mm, 69.0mm + 8.05mm * <<<$j%15>>>)$) {<<<$memberAddress($member)>>>}; + \node[anchor=base, text width=67.5mm, align=center] at ($(50.65mm, 69.0mm + 8.05mm * <<<$j%15>>>)$) {<<<$member->separatedName()>>>}; + \node[anchor=base, text width=14.6mm, align=center] at ($(92.2mm, 69.0mm + 8.05mm * <<<$j%15>>>)$) {<<<$member->age()>>>}; + \node[anchor=base, text width=79.4mm, align=center] at ($(139.7mm, 69.0mm + 8.05mm * <<<$j%15>>>)$) {<<<$member->fullAddress()>>>}; @endforeach \node[anchor=base, text width=23.0mm, align=center] at (278.2mm,196.1mm) {Seite <<>> von <<>>};