feat(admin): improve payments and server settings

This commit is contained in:
baodev0
2026-10-19 07:59:23 +07:00
parent 9ed77a85fd
commit ea9a53f742
32 changed files with 680 additions and 78 deletions
+25
View File
@@ -25,6 +25,31 @@ enum ProductBillingCycle: string
};
}
public function vietnameseLabel(): string
{
return match ($this) {
self::ONE_TIME => 'Một lần',
self::MONTHLY => 'Hàng tháng',
self::QUARTERLY => '3 tháng',
self::SEMI_ANNUALLY => '6 tháng',
self::ANNUALLY => 'Hàng năm',
self::BIENNIALLY => '2 năm',
self::TRIENNIALLY => '3 năm',
};
}
public static function vietnameseLabelFor(?string $code): string
{
return self::tryFrom((string) $code)?->vietnameseLabel() ?? ($code ?: 'N/A');
}
public static function vietnameseLabelForMonths(int $months): string
{
$cycle = collect(self::cases())->first(fn (self $case) => $case->months() === $months && $months > 0);
return $cycle?->vietnameseLabel() ?? $months . ' tháng';
}
public function months(): int
{
return match ($this) {