- Added comprehensive parameter and return type hinting to closures across various Filament resources, actions, and relation managers to improve type safety and static analysis. - Fixed logic in ReportRelationManager where report count was incorrectly compared, preventing the 'Buat Laporan' button from showing correctly. - Corrected namespaces for RepeatableEntry and TextEntry in ViewCooperation (changed from Filament\Schemas to Filament\Infolists). - Fixed component rendering in JournalistResource form by ensuring sections are correctly returned in the mapping. - Added @var docblocks to resolve lint errors related to auth()->user() and verified query builder return types. - Standardized file retrieval logic in PartnerResource and improved overall code reliability."
34 lines
1000 B
PHP
34 lines
1000 B
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Manage\Cooperations\Actions\Report;
|
|
|
|
use App\Enums\ApprovalStatus;
|
|
use App\Models\Report;
|
|
use Filament\Actions\Action;
|
|
use Filament\Notifications\Notification;
|
|
use Filament\Support\Icons\Heroicon;
|
|
|
|
class AcceptAction extends Action
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->label('Terima')
|
|
->icon(Heroicon::OutlinedCheck)
|
|
->color('success')
|
|
->action(function (Report $record): void {
|
|
$record->update([
|
|
'status' => ApprovalStatus::ACCEPTED,
|
|
]);
|
|
|
|
Notification::make()
|
|
->title('Laporan Diterima')
|
|
->body("Laporan '{$record->title}' telah diterima.")
|
|
->success()
|
|
->send();
|
|
})
|
|
->visible(fn (Report $record): bool => ! auth()->user()->hasRole('Perusahaan') && $record->status === ApprovalStatus::PENDING);
|
|
}
|
|
}
|