57 lines
1.6 KiB
PHP
57 lines
1.6 KiB
PHP
<?php
|
||
|
||
namespace App\Filament\Admin\Resources\Projects\Pages;
|
||
|
||
use App\Filament\Admin\Resources\Projects\ProjectResource;
|
||
use Filament\Actions\Action;
|
||
use Filament\Actions\DeleteAction;
|
||
use Filament\Notifications\Notification;
|
||
use Filament\Resources\Pages\EditRecord;
|
||
use Filament\Support\Enums\Width;
|
||
|
||
class EditProject extends EditRecord
|
||
{
|
||
protected static string $resource = ProjectResource::class;
|
||
|
||
public function getTitle(): string
|
||
{
|
||
return 'Proje Yönetimi: ' . $this->record->title;
|
||
}
|
||
|
||
public function getMaxContentWidth(): Width | string | null
|
||
{
|
||
return Width::Full;
|
||
}
|
||
|
||
protected function getHeaderActions(): array
|
||
{
|
||
return [
|
||
Action::make('recalculate')
|
||
->label('İlerlemeyi Yeniden Hesapla')
|
||
->icon('heroicon-o-calculator')
|
||
->color('info')
|
||
->action(function () {
|
||
$pct = $this->record->recalculateProgress();
|
||
Notification::make()
|
||
->title('Proje ilerleme yüzdesi güncellendi: %' . $pct)
|
||
->success()
|
||
->send();
|
||
}),
|
||
|
||
Action::make('preview_portal')
|
||
->label('Müşteri Ekranında Gör')
|
||
->icon('heroicon-o-eye')
|
||
->color('warning')
|
||
->url(fn () => route('projects.show', $this->record->slug))
|
||
->openUrlInNewTab(),
|
||
|
||
DeleteAction::make(),
|
||
];
|
||
}
|
||
|
||
protected function afterSave(): void
|
||
{
|
||
$this->record->recalculateProgress();
|
||
}
|
||
}
|