Initial commit: Pireon Admin — headless admin panel and public API
Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer collective, backed by the Pireon OAuth identity server. The public site is a separate, server-rendered application consuming /api/public/v1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
49
app/Filament/Support/ReviewStatusColumn.php
Normal file
49
app/Filament/Support/ReviewStatusColumn.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Support;
|
||||
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Whether anybody is waiting on this record, in the listing.
|
||||
*
|
||||
* Deliberately blank when nothing is waiting. A column that says "no" on every
|
||||
* row is a column that gets read once; this one is empty until it matters, so
|
||||
* the rows that need somebody are the only ones with anything in them.
|
||||
*/
|
||||
class ReviewStatusColumn extends TextColumn
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->badge();
|
||||
$this->color('warning');
|
||||
$this->icon('heroicon-o-hand-raised');
|
||||
$this->placeholder('—');
|
||||
|
||||
$this->state(fn (Model $record): ?string => $record->isAwaitingReview()
|
||||
? __('panel.reviews.waiting')
|
||||
: null);
|
||||
|
||||
// Who it is waiting for, since that is the next question anybody asks
|
||||
// — and "anybody" is a real answer rather than a missing one.
|
||||
$this->description(function (Model $record): ?string {
|
||||
if (! $record->isAwaitingReview()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $record->reviewer?->name ?? __('panel.reviews.anyone');
|
||||
});
|
||||
|
||||
$this->tooltip(fn (Model $record): ?string => $record->isAwaitingReview()
|
||||
? $record->review_requested_at?->diffForHumans()
|
||||
: null);
|
||||
|
||||
$this->sortable(query: fn ($query, string $direction) => $query
|
||||
->orderBy('review_requested_at', $direction));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user