Creation and editing of events

This commit is contained in:
2026-02-16 21:59:21 +01:00
parent 2b458eccd7
commit fcf41c5d13
61 changed files with 3002 additions and 380 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Resources;
use App\Enumerations\InvoiceStatus;
use App\Enumerations\InvoiceType;
use App\Models\CostUnit;
use App\Repositories\CostUnitRepository;
use App\ValueObjects\Amount;
@@ -28,6 +29,14 @@ class CostUnitResource {
$countDonatedInvoices = $countInvoices[InvoiceStatus::INVOICE_META_STATUS_DONATED];
$countDeniedInvoices = $countInvoices[InvoiceStatus::INVOICE_STATUS_DENIED];
$amounts = [];
$overAllAmount = new Amount(0, 'Euro');
foreach (InvoiceType::all() as $invoiceType) {
$overAllAmount->addAmount($costUnitRepository->sumupByInvoiceType($this->costUnit, $invoiceType));
$amounts[$invoiceType->slug]['string'] = $costUnitRepository->sumupByInvoiceType($this->costUnit, $invoiceType)->toString();
$amounts[$invoiceType->slug]['name'] = $invoiceType->name;
}
$data = array_merge(
$this->costUnit->toArray(),
@@ -41,6 +50,8 @@ class CostUnitResource {
'countDonatedInvoices' => $countDonatedInvoices,
'countDeniedInvoices' => $countDeniedInvoices,
'treasurers' => $this->costUnit->treasurers()->get()->map(fn($user) => new UserResource($user))->toArray(),
'amounts' => $amounts,
'overAllAmount' => ['text' => $overAllAmount->toString(), 'value' => $overAllAmount],
]);