|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
namespace App\Filament\Pages;
|
|
namespace App\Filament\Pages;
|
|
|
|
|
|
|
|
|
|
+use App\Support\TeacherWeeklyStatsReportPaths;
|
|
|
use Filament\Actions\Action;
|
|
use Filament\Actions\Action;
|
|
|
use Filament\Notifications\Notification;
|
|
use Filament\Notifications\Notification;
|
|
|
use Filament\Pages\Page;
|
|
use Filament\Pages\Page;
|
|
@@ -26,26 +27,29 @@ class TeacherWeeklyStatsReport extends Page
|
|
|
#[Computed(cache: false)]
|
|
#[Computed(cache: false)]
|
|
|
public function hasLatestPdf(): bool
|
|
public function hasLatestPdf(): bool
|
|
|
{
|
|
{
|
|
|
- return is_file($this->latestPdfPath());
|
|
|
|
|
|
|
+ return TeacherWeeklyStatsReportPaths::resolveLatestPdfPath() !== null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#[Computed(cache: false)]
|
|
#[Computed(cache: false)]
|
|
|
- public function latestPdfMtime(): ?string
|
|
|
|
|
|
|
+ public function latestPdfBasename(): ?string
|
|
|
{
|
|
{
|
|
|
- $p = $this->latestPdfPath();
|
|
|
|
|
|
|
+ $p = TeacherWeeklyStatsReportPaths::resolveLatestPdfPath();
|
|
|
|
|
|
|
|
- return is_file($p) ? date('Y-m-d H:i:s', filemtime($p)) : null;
|
|
|
|
|
|
|
+ return $p !== null ? basename($p) : null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#[Computed(cache: false)]
|
|
#[Computed(cache: false)]
|
|
|
- public function pdfOpenUrl(): string
|
|
|
|
|
|
|
+ public function latestPdfMtime(): ?string
|
|
|
{
|
|
{
|
|
|
- return route('filament.admin.reports.teacher-weekly-stats.open');
|
|
|
|
|
|
|
+ $p = TeacherWeeklyStatsReportPaths::resolveLatestPdfPath();
|
|
|
|
|
+
|
|
|
|
|
+ return $p !== null ? date('Y-m-d H:i:s', filemtime($p)) : null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- protected function latestPdfPath(): string
|
|
|
|
|
|
|
+ #[Computed(cache: false)]
|
|
|
|
|
+ public function pdfOpenUrl(): string
|
|
|
{
|
|
{
|
|
|
- return storage_path('app/reports/teacher-weekly-stats-latest.pdf');
|
|
|
|
|
|
|
+ return route('filament.admin.reports.teacher-weekly-stats.open');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected function getHeaderActions(): array
|
|
protected function getHeaderActions(): array
|