diff --git a/app/Contribution/ContributionController.php b/app/Contribution/ContributionController.php new file mode 100644 index 00000000..89c7a7c4 --- /dev/null +++ b/app/Contribution/ContributionController.php @@ -0,0 +1,31 @@ +put('menu', 'contribution'); + session()->put('title', 'Zuschüsse'); + + return Inertia::render('contribution/VIndex', [ + 'members' => MemberResource::collection(Member::get()), + ]); + } + + public function generate(Request $request): PdfGenerator + { + $data = app($request->query('type')); + + return app(PdfGenerator::class)->setRepository($data)->render(); + } +} diff --git a/app/Contribution/SolingenData.php b/app/Contribution/SolingenData.php new file mode 100644 index 00000000..cbfbce52 --- /dev/null +++ b/app/Contribution/SolingenData.php @@ -0,0 +1,90 @@ +eventName, + dateFrom: $request->dateFrom, + dateUntil: $request->dateUntil, + ); + } + + 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(' & ').' \\\\'; + + $secondRow = collect(['I' => 'Int. Jugendbegegnung', 'P' => 'politische Jugendbildung', 'PR' => 'Projekte'])->map(function ($item, $key) { + return ($this->type === $key ? '\\checkedcheckbox' : '\\checkbox').'{'.$item.'}'; + })->implode(' & ').' & \\emptycheckbox \\\\'; + + return $firstRow."\n".$secondRow; + } + + public function members(): Collection + { + return Member::orderByRaw('lastname, firstname')->get(); + } + + public function niceEventFrom(): string + { + return Carbon::parse($this->dateFrom)->format('d.m.Y'); + } + + public function niceEventTo(): string + { + return Carbon::parse($this->dateUntil)->format('d.m.Y'); + } + + public function getFilename(): string + { + return 'zuschuesse-solingen-'.Str::slug($this->eventName); + } + + public function getView(): string + { + return 'tex.zuschuss-stadt'; + } + + public function getTemplate(): string + { + return 'efz'; + } + + public function setFilename(string $filename): static + { + $this->filename = $filename; + + return $this; + } + + public function getScript(): EnvType + { + return EnvType::PDFLATEX; + } +} diff --git a/app/Member/Member.php b/app/Member/Member.php index 4e2f63f0..5dab7318 100644 --- a/app/Member/Member.php +++ b/app/Member/Member.php @@ -83,7 +83,7 @@ class Member extends Model ])); } - //----------------------------------- Getters ----------------------------------- + // ----------------------------------- Getters ----------------------------------- public function getFullnameAttribute(): string { return $this->firstname.' '.$this->lastname; @@ -118,7 +118,7 @@ class Member extends Model return $this->subscription->fee->nami_id; } - //---------------------------------- Relations ---------------------------------- + // ---------------------------------- Relations ---------------------------------- public function country(): BelongsTo { return $this->belongsTo(Country::class); diff --git a/app/Tex/TexCompiler.php b/app/Tex/TexCompiler.php index 8edb7f2c..3efab1eb 100644 --- a/app/Tex/TexCompiler.php +++ b/app/Tex/TexCompiler.php @@ -7,4 +7,6 @@ use Illuminate\View\Compilers\BladeCompiler; class TexCompiler extends BladeCompiler { protected $contentTags = ['<<<', '>>>']; + + protected $rawTags = ['<<>>']; } diff --git a/resources/img/svg/contribution.svg b/resources/img/svg/contribution.svg new file mode 100644 index 00000000..e26605a7 --- /dev/null +++ b/resources/img/svg/contribution.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/js/layouts/AppLayout.vue b/resources/js/layouts/AppLayout.vue index 3a38850b..be89711c 100644 --- a/resources/js/layouts/AppLayout.vue +++ b/resources/js/layouts/AppLayout.vue @@ -12,9 +12,10 @@ Beiträge + Zuschüsse
- Abmelden + Abmelden
diff --git a/resources/js/layouts/_VLink.vue b/resources/js/layouts/_VLink.vue index 5350a715..0efa2c4d 100644 --- a/resources/js/layouts/_VLink.vue +++ b/resources/js/layouts/_VLink.vue @@ -2,6 +2,7 @@ diff --git a/resources/js/views/contribution/VIndex.vue b/resources/js/views/contribution/VIndex.vue new file mode 100644 index 00000000..b88c89eb --- /dev/null +++ b/resources/js/views/contribution/VIndex.vue @@ -0,0 +1,47 @@ + + + diff --git a/resources/views/tex/zuschuss-stadt.tex b/resources/views/tex/zuschuss-stadt.tex new file mode 100644 index 00000000..4ba9c0b5 --- /dev/null +++ b/resources/views/tex/zuschuss-stadt.tex @@ -0,0 +1,124 @@ +\documentclass[a4paper,landscape]{article} + +\usepackage[landscape,top=0cm,left=0cm,bottom=0cm,right=0cm]{geometry} +\usepackage{tikz,ulem} +\usetikzlibrary{matrix} +\usetikzlibrary{backgrounds} +\usetikzlibrary{intersections} +\usetikzlibrary{positioning} +\usetikzlibrary{calc} + +\pagestyle{empty} +\setlength{\parindent}{0cm} + +\tikzset{outer/.style={overlay, remember picture}} +\tikzset{formfill/.style={pos=0.01,anchor=base west,font=\LARGE}} +\tikzset{ + table/.style={ + matrix of nodes, + row sep=-\pgflinewidth, + column sep=-\pgflinewidth, + nodes={ + rectangle, + draw=black, + font=\Large, + }, + minimum height=1.5em, + text depth=0.5ex, + text height=2.5ex, + nodes in empty cells, + column 1/.style={ + nodes={ + align=center, + text width=5em, + } + }, + column 2/.style={ + nodes={ + align=center, + text width=17em, + } + }, + column 3/.style={ + nodes={ + align=center, + text width=15em, + } + }, + column 4/.style={ + nodes={ + align=center, + text width=5em, + } + }, + column 5/.style={ + nodes={ + align=center, + text width=9em, + } + }, + column 6/.style={ + nodes={ + align=center, + text width=7em, + } + }, + column 7/.style={ + nodes={ + align=center, + text width=12.5em, + } + }, + row 1/.style={ + nodes={ + draw=white, + align=center, + } + } + } +} + +\newcommand{\checkbox}[1]{\tikz[label distance=0.2cm]{\node[label={east:\large{#1}},draw,very thick,rectangle,text height=0.5cm,text width=0.5cm,inner sep=0cm] at (0,0) {};}} +\newcommand{\checkedcheckbox}[1]{\tikz[label distance=0.2cm]{\node[label={east:\large{#1}},draw,very thick,rectangle,text height=0.5cm,text width=0.5cm,inner sep=0cm] at (0,0) {}; \draw (--0.25cm,0) -- (-0.25cm,0.5cm) (-0.25cm,0) -- (0.25cm,0.5cm); }} +\newcommand{\emptycheckbox}{\tikz{\node[text height=0.5cm,text width=0.5cm,inner sep=0cm] at (0,0) {};}} + +\begin{document} \sffamily +@foreach($data->members()->chunk(14) as $chunk) +\begin{tikzpicture}[outer] + \path (current page.north west) ++(1cm,-1cm) coordinate (OL) -- (current page.north east) ++(-1cm,0cm) coordinate (OR) node[midway,below=0.5cm] {\textbf{TEILNEHMER - / INNENLISTE}}; + \matrix (options) at ($(OL)+(0.5cm,-1cm)$) [matrix of nodes, column sep=0cm,row sep=0.5cm,nodes in empty cells, every node/.style={inner sep=0cm,align=left,text width=6.2cm}, anchor=north west] { + <<checkboxes()!!>>> + }; + \node[align=left,inner sep=0cm,anchor=west] at (options-2-4.west) {\tikz{\node[draw,very thick,rectangle,text height=0.5cm,text width=0.5cm,inner sep=0cm] (checkbox) at (0,0) {}; \draw[thick] (checkbox.south east) ++(0.2cm,0) -- (checkbox.south east -| options-2-4.south east);}}; + + \node[anchor=north west] (org) at ($(options.south west)+(0cm,-0.5cm)$) {\large{Veranstalter:}}; + \draw (org.south east -| options-2-2.south west) -- (org.south east -| options-2-4.south east) node[formfill] {DPSG Stamm Silva Solingen Wald}; + + \node[anchor=north west] (title) at ($(org.south west)+(0cm,-0.5cm)$) {\large{Titel der Maßnahme:}}; + \draw (title.south east -| options-2-2.south west) -- (title.south east -| options-2-4.south east) node[formfill] {<<<$data->eventName>>>}; + + \node[anchor=north west] (datefrom) at ($(title.south west)+(0cm,-0.5cm)$) {\large{Datum vom:}}; + \draw (datefrom.south east -| options-2-2.south west) -- ($(datefrom.south east -| options-2-2.south east) - (1,0cm)$) node[formfill] {<<<$data->niceEventFrom()>>>}; + + \node[anchor=south west] (dateuntil) at (options-2-3.south west |- datefrom.south west) {\large{bis:}}; + \draw[label={east:aaa}] (dateuntil.south east) -- (datefrom.south east -| options-2-3.south east) node[formfill] {<<<$data->niceEventTo()>>>}; + + \path[fill=yellow] (datefrom.south -| OL) ++(0,-1.0) rectangle ($(datefrom.south -| OR) + (0,-1.5)$); + + \matrix (table) at ($(datefrom.south west) + (0,-2.3cm)$) [table,below right] { + \uline{Lfd. Nr.} & \uline{Name / Vorname} & \uline{Straße} & \uline{PLZ} & \uline{Wohnort} & \uline{Geburtsjahr} & \uline{Unterschrift} \\ + @foreach($chunk as $i => $member) + <<<$i+1>>> & <<<$member->fullname>>> & <<<$member->address>>> & <<<$member->zip>>> & <<<$member->location>>> & <<<$member->birthday->year>>> & \\ + @endforeach + }; + + \draw[ultra thick] (OL) rectangle (table.south east -| OR); +\end{tikzpicture} + +\pagebreak[4] + +@endforeach + +\end{document} + + diff --git a/routes/web.php b/routes/web.php index a79b40f4..b4627593 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,6 @@ 'auth:web'], function (): void { Route::resource('member.course', CourseController::class); Route::get('/member/{member}/efz', MemberEfzController::class)->name('efz'); Route::get('/member/{member}/resync', MemberResyncController::class)->name('member.resync'); + Route::get('/contribution', [ContributionController::class, 'form'])->name('contribution.form'); + Route::get('/contribution/generate', [ContributionController::class, 'generate'])->name('contribution.generate'); });