initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace App\Enum;
|
||||
|
||||
enum Months: int {
|
||||
case JANUARY = 1;
|
||||
case FEBRUARY = 2;
|
||||
case MARCH = 3;
|
||||
case APRIL = 4;
|
||||
case MAY = 5;
|
||||
case JUNE = 6;
|
||||
case JULY = 7;
|
||||
case AUGUST = 8;
|
||||
case SEPTEMBER = 9;
|
||||
case OCTOBER = 10;
|
||||
case NOVEMBER = 11;
|
||||
case DECEMBER = 12;
|
||||
|
||||
public static function tryFromName(string $name) : ?Months
|
||||
{
|
||||
$name = strtoupper($name);
|
||||
foreach (self::cases() as $v) {
|
||||
if ($name === $v->name) {
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace App\Enum;
|
||||
|
||||
enum ReportStatus: int {
|
||||
case INSERT = 1;
|
||||
case WORKING = 2;
|
||||
case COMPLETE = 3;
|
||||
|
||||
public function checkboxColor() : string
|
||||
{
|
||||
return match ($this)
|
||||
{
|
||||
ReportStatus::INSERT => 'primary',
|
||||
ReportStatus::WORKING => 'success',
|
||||
ReportStatus::COMPLETE => 'dark',
|
||||
};
|
||||
}
|
||||
public function backgroundColor() : string
|
||||
{
|
||||
return match ($this)
|
||||
{
|
||||
ReportStatus::INSERT => 'light',
|
||||
ReportStatus::WORKING => 'warning',
|
||||
ReportStatus::COMPLETE => 'success',
|
||||
};
|
||||
}
|
||||
|
||||
public function textColor() : string
|
||||
{
|
||||
return match ($this)
|
||||
{
|
||||
ReportStatus::WORKING, ReportStatus::INSERT => 'dark',
|
||||
ReportStatus::COMPLETE => 'white',
|
||||
};
|
||||
}
|
||||
|
||||
public function linkColor() : string
|
||||
{
|
||||
return match ($this)
|
||||
{
|
||||
ReportStatus::WORKING, ReportStatus::INSERT => 'dark',
|
||||
ReportStatus::COMPLETE => 'light',
|
||||
};
|
||||
}
|
||||
|
||||
public function takeLang() : string
|
||||
{
|
||||
return match ($this) {
|
||||
ReportStatus::INSERT => 'Oczekujące',
|
||||
ReportStatus::WORKING => 'W trakcie',
|
||||
ReportStatus::COMPLETE => 'Zakończony',
|
||||
};
|
||||
}
|
||||
|
||||
public function next() : ?ReportStatus
|
||||
{
|
||||
return ReportStatus::tryFrom($this->value+1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace App\Enum;
|
||||
|
||||
enum ReportTodoEnum: int {
|
||||
case SENT_EMAIL = 1;
|
||||
case MAKE_PHONE_CALL = 2;
|
||||
case INVOICE_SEND = 4;
|
||||
case COMPLETE = 3;
|
||||
|
||||
public function takeLang() : string
|
||||
{
|
||||
return match ($this) {
|
||||
self::SENT_EMAIL => "Wysłano E-Mail",
|
||||
self::MAKE_PHONE_CALL => "Wykonano połączenie",
|
||||
self::COMPLETE => "Zakończono",
|
||||
self::INVOICE_SEND => "Wysłano fakturę"
|
||||
};
|
||||
}
|
||||
|
||||
public function backgroundColor(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::SENT_EMAIL,self::MAKE_PHONE_CALL,self::INVOICE_SEND => "info",
|
||||
self::COMPLETE => "success",
|
||||
};
|
||||
}
|
||||
|
||||
public function takeIcon(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::SENT_EMAIL => "envelope",
|
||||
self::MAKE_PHONE_CALL => "phone",
|
||||
self::COMPLETE => "check",
|
||||
self::INVOICE_SEND => "file-invoice",
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace App\Enum;
|
||||
|
||||
enum ScheduleStatus: int
|
||||
{
|
||||
case TODO = 1;
|
||||
case INCOMING = 2;
|
||||
case OVERDUE = 3;
|
||||
case COMPLETED = 4;
|
||||
|
||||
public function backgroundColor(): string
|
||||
{
|
||||
return match ($this)
|
||||
{
|
||||
ScheduleStatus::TODO => 'white',
|
||||
ScheduleStatus::INCOMING => 'warning',
|
||||
ScheduleStatus::OVERDUE => 'danger',
|
||||
ScheduleStatus::COMPLETED => 'success',
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user