2022-05-17 01:37:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Contribution;
|
|
|
|
|
2022-08-23 23:49:19 +02:00
|
|
|
use App\Country;
|
2022-05-17 01:37:07 +02:00
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Member\Member;
|
|
|
|
use App\Member\MemberResource;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Inertia\Inertia;
|
|
|
|
use Inertia\Response;
|
2022-11-07 16:18:11 +01:00
|
|
|
use Zoomyboy\Tex\BaseCompiler;
|
|
|
|
use Zoomyboy\Tex\Tex;
|
2022-05-17 01:37:07 +02:00
|
|
|
|
|
|
|
class ContributionController extends Controller
|
|
|
|
{
|
|
|
|
public function form(): Response
|
|
|
|
{
|
|
|
|
session()->put('menu', 'contribution');
|
|
|
|
session()->put('title', 'Zuschüsse');
|
|
|
|
|
|
|
|
return Inertia::render('contribution/VIndex', [
|
2022-08-11 23:19:52 +02:00
|
|
|
'allMembers' => MemberResource::collection(Member::slangOrdered()->get()),
|
2022-08-23 23:49:19 +02:00
|
|
|
'countries' => Country::pluck('name', 'id'),
|
|
|
|
'defaultCountry' => Country::firstWhere('name', 'Deutschland')->id,
|
2022-05-17 01:37:07 +02:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2022-11-07 16:18:11 +01:00
|
|
|
public function generate(Request $request): BaseCompiler
|
2022-05-17 01:37:07 +02:00
|
|
|
{
|
2022-11-07 16:18:11 +01:00
|
|
|
/** @var class-string<SolingenDocument> */
|
|
|
|
$type = $request->query('type');
|
2022-05-17 01:37:07 +02:00
|
|
|
|
2022-11-07 16:18:11 +01:00
|
|
|
return Tex::compile($type::fromRequest($request));
|
2022-05-17 01:37:07 +02:00
|
|
|
}
|
|
|
|
}
|