First Aid list, amount list and kitchen list PDF download implemented

This commit is contained in:
2026-03-28 22:22:06 +01:00
parent df7c14442e
commit 7bea223ded
20 changed files with 92 additions and 36 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Resources;
use App\Enumerations\ParticipationType;
use App\Models\EventParticipant;
use App\ValueObjects\Age;
use Illuminate\Http\Resources\Json\JsonResource;
class EventParticipantResource extends JsonResource
@@ -34,6 +35,11 @@ class EventParticipantResource extends JsonResource
return array_merge(
$this->resource->toArray(),
[
'age' => new Age($this->resource->birthday)->getAge(),
'localgroup' => $this->resource->localGroup()->first()->name,
'swimmingPermission' => $this->resource->swimmingPermission()->first()->short,
'extendedFirstAid' => $this->resource->firstAidPermission()->first()->name,
'tetanusVaccination' => $this->resource->tetanus_vaccination?->format('d.m.Y'),
'presenceDays' => ['real' => $presenceDays, 'support' => $presenceDaysSupport],
'participationType' => ParticipationType::where(['slug' => $this->resource->participation_type])->first()->name,
'needs_payment' => $this->resource->amount->getAmount() > 0 && $event->pay_direct,
@@ -43,7 +49,8 @@ class EventParticipantResource extends JsonResource
'amount_left_string' => $amountLeft->toString(),
'amount_left_value' => $amountLeft->getAmount(),
'email_1' => $this->resource->email_1,
'amountPaid' => ['value' => $this->resource->amount_paid, 'readable' => $this->resource->amount_paid?->toString() ?? '0,00 Euro'],
'amountExpected' => ['value' => $this->resource->amount, 'readable' => $this->resource->amount?->toString() ?? '0,00 Euro'],
]
);

View File

@@ -67,13 +67,12 @@ class EventResource extends JsonResource{
$returnArray['participants'][$participationType] = $this->getParticipants($participationType);
}
$returnArray['costUnit'] = new CostUnitResource($this->event->costUnit()->first())->toArray(true);
$returnArray['solidarityPayment'] = $this->event->participation_fee_type === ParticipationFeeType::PARTICIPATION_FEE_TYPE_SOLIDARITY;
$returnArray['payPerDay'] = $this->event->pay_per_day;
$returnArray['maxAmount'] = $this->event->total_max_amount->getFormattedAmount();
$returnArray['arrivalDefault'] = $this->event->start_date->format('Y-m-d');
$returnArray['departureDefault'] = $this->event->end_date->format('Y-m-d');
$returnArray['eventBegin'] = $this->event->start_date->format('d.m.Y');
$returnArray['eventBeginInternal'] = $this->event->start_date;
$returnArray['eventEnd'] = $this->event->end_date->format('d.m.Y');
@@ -94,7 +93,6 @@ class EventResource extends JsonResource{
$totalBalanceReal->subtractAmount($returnArray['costUnit']['overAllAmount']['value']);
$totalBalanceExpected->subtractAmount($returnArray['costUnit']['overAllAmount']['value']);
$returnArray['totalBalance'] = [
'real' => [
'value' => $totalBalanceReal->getAmount(),