first commit
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled

This commit is contained in:
brusnitsyn
2026-04-06 00:06:00 +09:00
commit fb2e6c58e3
409 changed files with 42953 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Enums;
enum ExpenseCategory: string
{
case Alcohol = 'alcohol';
case Narcotic = 'narcotic';
case Solutions = 'solutions';
case Medicines = 'medicines';
case Dressing = 'dressing';
public function label(): string
{
return match ($this) {
self::Alcohol => 'Спирт',
self::Narcotic => 'Наркотики',
self::Solutions => 'Растворы',
self::Medicines => 'Медикаменты',
self::Dressing => 'Перевязка / ИМН',
};
}
public function countsTowardsWithoutDressing(): bool
{
return $this !== self::Dressing;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Enums;
enum FundingSource: string
{
case Oms = 'oms';
case Budget = 'budget';
case Paid = 'paid';
case VmpOms = 'vmp_oms';
case VmpBudget = 'vmp_budget';
public function label(): string
{
return match ($this) {
self::Oms => 'ОМС',
self::Budget => 'Бюджет',
self::Paid => 'ОПУ',
self::VmpOms => 'ВМП ОМС',
self::VmpBudget => 'ВМП Бюджет',
};
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Enums;
enum ReportPeriodStatus: string
{
case Draft = 'draft';
case Approved = 'approved';
public function label(): string
{
return match ($this) {
self::Draft => 'Черновик',
self::Approved => 'Утвержден',
};
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Enums;
enum TeamPermission: string
{
case UpdateTeam = 'team:update';
case DeleteTeam = 'team:delete';
case AddMember = 'member:add';
case UpdateMember = 'member:update';
case RemoveMember = 'member:remove';
case CreateInvitation = 'invitation:create';
case CancelInvitation = 'invitation:cancel';
}

79
app/Enums/TeamRole.php Normal file
View File

@@ -0,0 +1,79 @@
<?php
namespace App\Enums;
enum TeamRole: string
{
case Owner = 'owner';
case Admin = 'admin';
case Member = 'member';
/**
* Get the display label for the role.
*/
public function label(): string
{
return ucfirst($this->value);
}
/**
* Get all the permissions for this role.
*
* @return array<TeamPermission>
*/
public function permissions(): array
{
return match ($this) {
self::Owner => TeamPermission::cases(),
self::Admin => [
TeamPermission::UpdateTeam,
TeamPermission::CreateInvitation,
TeamPermission::CancelInvitation,
],
self::Member => [],
};
}
/**
* Determine if the role has the given permission.
*/
public function hasPermission(TeamPermission $permission): bool
{
return in_array($permission, $this->permissions());
}
/**
* Get the hierarchy level for this role.
* Higher numbers indicate higher privileges.
*/
public function level(): int
{
return match ($this) {
self::Owner => 3,
self::Admin => 2,
self::Member => 1,
};
}
/**
* Check if this role is at least as privileged as another role.
*/
public function isAtLeast(TeamRole $role): bool
{
return $this->level() >= $role->level();
}
/**
* Get the roles that can be assigned to team members (excludes Owner).
*
* @return array<array{value: string, label: string}>
*/
public static function assignable(): array
{
return collect(self::cases())
->filter(fn (self $role) => $role !== self::Owner)
->map(fn (self $role) => ['value' => $role->value, 'label' => $role->label()])
->values()
->toArray();
}
}