Skip to content

Commit

Permalink
CR
Browse files Browse the repository at this point in the history
  • Loading branch information
alexPopaCode4 committed Jun 5, 2024
1 parent 2833207 commit ed64206
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 9 additions & 0 deletions app/Enums/Level.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,13 @@ protected function labelKeyPrefix(): ?string
{
return 'enum.level';
}

public static function colors(): array
{
return [
'success' => Level::LOW,
'warning' => Level::MEDIUM,
'danger' => Level::HIGH,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,7 @@ private function evaluations(): Group
->formatStateUsing(fn ($state) => $state != '-' ? $state->label() : '')
->hidden(fn ($state) => $state == '-')
->badge()
->colors([
'success' => Level::LOW,
'warning' => Level::MEDIUM,
'danger' => Level::HIGH,
]),
->colors(Level::colors()),
]),
Group::make()
->visible(fn ($record) => ! $record->violence?->violence_types)
Expand Down Expand Up @@ -255,7 +251,7 @@ private function evaluations(): Group
->schema(function ($state) {
$fields = [];
foreach (RecommendationService::options() as $key => $option) {
if (! isset($state->$key) || ! $state->$key) {
if (empty($state->$key)) {
continue;
}

Expand Down

0 comments on commit ed64206

Please sign in to comment.