Files
mareike/app/Enumerations/VatPricingMode.php
T
2026-08-12 17:18:45 +02:00

39 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Enumerations;
/**
* Preismodus bei bestehender Umsatzsteuerpflicht: entweder ist die USt bereits im konfigurierten Beitrag
* enthalten (Brutto/„Supermarkt") oder sie wird bei der Preisermittlung aufgeschlagen (Netto). Gespeichert
* wird immer der finale Brutto-Beitrag; der Modus beeinflusst nur die Preisermittlung im Anmeldeprozess.
*/
enum VatPricingMode: string
{
case Inclusive = 'inclusive';
case AddOn = 'add_on';
public function label(): string
{
return match ($this) {
self::Inclusive => 'Inklusive Beiträge sind Endpreise (USt enthalten)',
self::AddOn => 'Aufschlagen USt wird auf die Beiträge aufgeschlagen',
};
}
/**
* Optionen für das Frontend: [['value' => ..., 'label' => ...], ...].
*
* @return array<int, array{value: string, label: string}>
*/
public static function options(): array
{
return array_map(
static fn (self $mode): array => [
'value' => $mode->value,
'label' => $mode->label(),
],
self::cases(),
);
}
}