First Aid list, amount list and kitchen list PDF download implemented
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Domains\Event\Actions\SignUp;
|
||||
|
||||
use App\Enumerations\EatingHabit;
|
||||
use App\Enumerations\EfzStatus;
|
||||
use App\ValueObjects\Age;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -13,8 +14,13 @@ class SignUpCommand {
|
||||
public function execute() : SignUpResponse {
|
||||
$response = new SignUpResponse();
|
||||
|
||||
$participantAge = new Age($this->request->birthday);
|
||||
$eatingHabit = match ($this->request->eating_habit) {
|
||||
'vegan' => EatingHabit::EATING_HABIT_VEGAN,
|
||||
'vegetarian' => EatingHabit::EATING_HABIT_VEGETARIAN,
|
||||
default => EatingHabit::EATING_HABIT_OMNIVOR,
|
||||
};
|
||||
|
||||
$participantAge = new Age($this->request->birthday);
|
||||
$response->participant = $this->request->event->participants()->create(
|
||||
[
|
||||
'tenant' => $this->request->event->tenant,
|
||||
@@ -39,7 +45,7 @@ class SignUpCommand {
|
||||
'intolerances' => $this->request->intolerances,
|
||||
'medications' => $this->request->medications,
|
||||
'tetanus_vaccination' => $this->request->tetanus_vaccination,
|
||||
'eating_habit' => $this->request->eating_habit,
|
||||
'eating_habit' => $eatingHabit,
|
||||
'swimming_permission' => $participantAge->isfullAged() ? 'SWIMMING_PERMISSION_ALLOWED' : $this->request->swimming_permission,
|
||||
'first_aid_permission' => $participantAge->isfullAged() ? 'FIRST_AID_PERMISSION_ALLOWED' : $this->request->first_aid_permission,
|
||||
'foto_socialmedia' => $this->request->foto_socialmedia,
|
||||
|
||||
@@ -10,12 +10,15 @@ use App\Domains\Event\Actions\UpdateManagers\UpdateManagersCommand;
|
||||
use App\Domains\Event\Actions\UpdateManagers\UpdateManagersRequest;
|
||||
use App\Enumerations\ParticipationFeeType;
|
||||
use App\Enumerations\ParticipationType;
|
||||
use App\Models\EventParticipant;
|
||||
use App\Providers\InertiaProvider;
|
||||
use App\Providers\PdfGenerateAndDownloadProvider;
|
||||
use App\Resources\EventResource;
|
||||
use App\Scopes\CommonController;
|
||||
use App\ValueObjects\Amount;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class DetailsController extends CommonController {
|
||||
public function __invoke(int $eventId) {
|
||||
@@ -123,4 +126,31 @@ class DetailsController extends CommonController {
|
||||
|
||||
return response()->json(['status' => $response->success ? 'success' : 'error']);
|
||||
}
|
||||
|
||||
public function downloadPdfList(string $eventId, string $listType, Request $request): Response
|
||||
{
|
||||
$event = $this->events->getByIdentifier($eventId);
|
||||
|
||||
$participants = $this->eventParticipants->getForList($event, $request);
|
||||
$kitchenOverview = $this->eventParticipants->getKitchenOverview($event);
|
||||
|
||||
$html = view('pdfs.' . $listType, [
|
||||
'event' => $event->name,
|
||||
'eventStart' => $event->start_date,
|
||||
'eventEnd' => $event->end_date,
|
||||
'rows' => $participants,
|
||||
'kitchenRequirements' => $kitchenOverview,
|
||||
'participantsForKitchenList' => $this->eventParticipants->getParticipantsWithIntolerances($event, $request),
|
||||
])->render();
|
||||
|
||||
$pdf = PdfGenerateAndDownloadProvider::fromHtml(
|
||||
$html,
|
||||
'landscape'
|
||||
);
|
||||
|
||||
return response($pdf, 200, [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'attachment; filename="' . $listType .'.pdf"',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,10 +81,10 @@ class SignupController extends CommonController {
|
||||
$registrationData['nachname'],
|
||||
$registrationData['email_1'],
|
||||
DateTime::createFromFormat('Y-m-d', $registrationData['geburtsdatum']));
|
||||
|
||||
/*
|
||||
if ($doubleCheckEventRegistrationProvider->isRegistered()) {
|
||||
return response()->json(['status' => 'exists']);
|
||||
}
|
||||
}*/
|
||||
|
||||
$amount = $eventResource->calculateAmount(
|
||||
$registrationData['participationType'],
|
||||
|
||||
@@ -18,6 +18,7 @@ Route::middleware(IdentifyTenant::class)->group(function () {
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
Route::get('/new', CreateController::class);
|
||||
Route::get('/details/{eventId}', DetailsController::class);
|
||||
Route::get('/details/{eventId}/pdf/{listType}', [DetailsController::class, 'downloadPdfList']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
sendWeeklyReports: props.event.sendWeeklyReports,
|
||||
registrationAllowed: props.event.registrationAllowed,
|
||||
flatSupport: props.event.flatSupportEdit,
|
||||
supportPerson: props.event.supportPersonEdit,
|
||||
supportPerson: props.event.supportPersonIndex,
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
@@ -60,11 +60,20 @@ import {onMounted, reactive, ref} from "vue";
|
||||
<div class="event-flexbox-row top">
|
||||
<div class="left"><ParticipationSummary v-if="dynamicProps.event" :event="dynamicProps.event" /></div>
|
||||
<div class="right">
|
||||
<input type="button" value="Erste-Hilfe-Liste (PDF)" /><br/>
|
||||
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/first-aid-list'">
|
||||
<input type="button" value="Erste-Hilfe-Liste (PDF)" />
|
||||
</a><br/>
|
||||
|
||||
<input type="button" value="Teili-Liste (CSV)" /><br/>
|
||||
<input type="button" value="KSV-Daten (CSV)" /><br/>
|
||||
<input type="button" value="Küchenübersicht (PDF)" /><br/>
|
||||
<input type="button" value="Beitragsliste (PDF)" /><br/>
|
||||
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/kitchen-list'">
|
||||
<input type="button" value="Küchenübersicht (PDF)" />
|
||||
</a><br/>
|
||||
|
||||
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/amount-list'">
|
||||
<input type="button" value="Beitragsliste (PDF)" />
|
||||
</a><br/>
|
||||
|
||||
<input type="button" value="Getränkeliste (PDF)" /><br/>
|
||||
<input type="button" value="Foto-Erlaubnis (PDF)" /><br/>
|
||||
<input type="button" class="fix-button" value="Zahlungserinnerung senden" /><br/>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<table class="participant-income-table" style="margin-bottom: 40px; font-size: 11pt;">
|
||||
<tr>
|
||||
<th>Teili</th>
|
||||
<td>{{props.event.participants.participant.count}} Personen:</td>
|
||||
<td><strong>{{props.event.participants.participant.count}} Personen:</strong></td>
|
||||
<td>
|
||||
{{props.event.participants.participant.amount.paid.readable}} /
|
||||
</td>
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<tr>
|
||||
<th>Team</th>
|
||||
<td>{{props.event.participants.team.count}} Personen:</td>
|
||||
<td><strong>{{props.event.participants.team.count}} Personen:</strong></td>
|
||||
<td>
|
||||
{{props.event.participants.team.amount.paid.readable}} /
|
||||
</td>
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
<tr>
|
||||
<th>Unterstützende</th>
|
||||
<td>{{props.event.participants.volunteer.count}} Personen:</td>
|
||||
<td><strong>{{props.event.participants.volunteer.count}} Personen:</strong></td>
|
||||
<td>
|
||||
{{props.event.participants.volunteer.amount.paid.readable}} /
|
||||
</td>
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
<tr>
|
||||
<th>Sonstige</th>
|
||||
<td>{{props.event.participants.other.count}} Personen:</td>
|
||||
<td><strong>{{props.event.participants.other.count}} Personen:</strong></td>
|
||||
<td>
|
||||
{{props.event.participants.other.amount.paid.readable}} /
|
||||
</td>
|
||||
@@ -91,7 +91,7 @@
|
||||
{{ props.event.totalBalance.real.readable }} /
|
||||
</td>
|
||||
<td v-else style="color: #f44336; font-weight: bold; padding-top: 20px; font-size: 12pt !important;">
|
||||
{{props.event.totalBalance.expected.readable}}
|
||||
{{props.event.totalBalance.real.readable}}
|
||||
</td>
|
||||
|
||||
<td v-if="props.event.totalBalance.expected.value >= 0" style="color: #4caf50; font-weight: bold; padding-top: 20px; font-size: 12pt !important;">
|
||||
@@ -107,14 +107,14 @@
|
||||
|
||||
<div class="right">
|
||||
<h3>Ausgaben</h3>
|
||||
<table class="event-payment-table" style="font-size: 11pt;">
|
||||
<table class="event-payment-table" style="font-size: 10pt;">
|
||||
<tr v-for="amount in props.event.costUnit.amounts">
|
||||
<th>{{amount.name}}</th>
|
||||
<td>{{amount.string}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="color:#f44336; border-width: 1px; border-bottom-style: solid; padding-top: 20px">Gesamt</th>
|
||||
<td style="color:#f44336; border-width: 1px; border-bottom-style: solid; padding-top: 20px; font-weight: bold">{{props.event.costUnit.overAllAmount.text}}</td>
|
||||
<th style="color:#f44336; border-width: 1px; border-bottom-style: solid; padding-top: 58px">Gesamt</th>
|
||||
<td style="color:#f44336; border-width: 1px; border-bottom-style: solid; padding-top: 58px; font-weight: bold">{{props.event.costUnit.overAllAmount.text}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -33,8 +33,8 @@ console.log(participantData)
|
||||
first_aid: '-1',
|
||||
participant_group: '',
|
||||
beitrag: 'regular',
|
||||
arrival: event.eventBeginInternal?.split('T')[0] ?? '',
|
||||
departure: event.eventEndInternal?.split('T')[0] ?? '',
|
||||
arrival: event.arrivalDefault ?? '',
|
||||
departure: event.departureDefault ?? '',
|
||||
anreise_essen: '1',
|
||||
abreise_essen: '2',
|
||||
foto: { socialmedia: false, print: false, webseite: false, partner: false, intern: false },
|
||||
|
||||
@@ -31,7 +31,7 @@ const emit = defineEmits(['next'])
|
||||
</div>
|
||||
<div class="age-card__body">
|
||||
<h4 class="age-card__title">Mich selbst anmelden</h4>
|
||||
<p class="age-card__desc">Ich bin <strong>{{ event.alcoholicsAge }} Jahre oder älter</strong>.</p>
|
||||
<p class="age-card__desc">Ich bin <strong>18 Jahre oder älter</strong>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user