refactor: update internal Filament navigation to use getUrl() methods and remove redundant getRedirectUrl() implementations.
This commit is contained in:
parent
38533fa246
commit
eb72bac3cb
@ -6,6 +6,8 @@
|
||||
use App\Enums\VerificationStatus;
|
||||
use App\Models\VerificationRequest;
|
||||
use App\Models\VerificationReview;
|
||||
use App\Filament\Resources\Manage\Partners\Pages\ViewPartner;
|
||||
use App\Filament\Resources\Manage\Journalists\Pages\ManageJournalists;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\Concerns\InteractsWithActions;
|
||||
@ -114,9 +116,9 @@ public function getDetailUrl(VerificationRequest $request): ?string
|
||||
}
|
||||
|
||||
return match ($type) {
|
||||
'Company' => route('filament.dashboard.resources.manage.partners.view', ['record' => $entity->user_id]),
|
||||
'PartnerMedia' => route('filament.dashboard.resources.manage.partners.view', ['record' => $entity->company?->user_id]),
|
||||
'Journalist' => route('filament.dashboard.resources.manage.journalists.view', ['record' => $entity->id]),
|
||||
'Company' => ViewPartner::getUrl(['record' => $entity->user_id]),
|
||||
'PartnerMedia' => ViewPartner::getUrl(['record' => $entity->company?->user_id]),
|
||||
'Journalist' => ManageJournalists::getUrl(),
|
||||
default => null,
|
||||
};
|
||||
}
|
||||
|
||||
@ -8,6 +8,9 @@
|
||||
use App\Models\Journalist;
|
||||
use App\Models\PartnerMedia;
|
||||
use App\Models\VerificationRequest;
|
||||
use App\Filament\Pages\CustomCompany;
|
||||
use App\Filament\Pages\CustomMedia;
|
||||
use App\Filament\Resources\Manage\Journalists\Pages\ManageJournalists;
|
||||
use BackedEnum;
|
||||
use BezhanSalleh\FilamentShield\Traits\HasPageShield;
|
||||
use Filament\Actions\Action;
|
||||
@ -200,7 +203,7 @@ public function companyProgress(): array
|
||||
'needsRevision' => $this->needsRevision($this->companyVerification),
|
||||
'latestNotes' => $this->getLatestReviewNotes($this->companyVerification),
|
||||
'reviewHistory' => $this->getReviewHistory($this->companyVerification),
|
||||
'editUrl' => route('filament.dashboard.pages.manage.company'),
|
||||
'editUrl' => CustomCompany::getUrl(),
|
||||
'steps' => [
|
||||
[
|
||||
'title' => 'Pengajuan',
|
||||
@ -244,7 +247,7 @@ public function mediaProgress(): array
|
||||
'needsRevision' => $this->needsRevision($this->mediaVerification),
|
||||
'latestNotes' => $this->getLatestReviewNotes($this->mediaVerification),
|
||||
'reviewHistory' => $this->getReviewHistory($this->mediaVerification),
|
||||
'editUrl' => route('filament.dashboard.pages.manage.media'),
|
||||
'editUrl' => CustomMedia::getUrl(),
|
||||
'steps' => [
|
||||
[
|
||||
'title' => 'Pengajuan',
|
||||
@ -288,7 +291,7 @@ public function journalistProgress(): array
|
||||
'needsRevision' => $this->needsRevision($this->journalistVerification),
|
||||
'latestNotes' => $this->getLatestReviewNotes($this->journalistVerification),
|
||||
'reviewHistory' => $this->getReviewHistory($this->journalistVerification),
|
||||
'editUrl' => route('filament.dashboard.resources.manage.journalists.index'),
|
||||
'editUrl' => ManageJournalists::getUrl(),
|
||||
'steps' => [
|
||||
[
|
||||
'title' => 'Pengajuan',
|
||||
@ -320,14 +323,14 @@ public function journalistProgress(): array
|
||||
public function submitCompanyAction(): Action
|
||||
{
|
||||
return Action::make('submitCompany')
|
||||
->label(fn () => $this->needsRevision($this->companyVerification) ? 'Kirim Ulang' : 'Ajukan Verifikasi')
|
||||
->label(fn() => $this->needsRevision($this->companyVerification) ? 'Kirim Ulang' : 'Ajukan Verifikasi')
|
||||
->icon('heroicon-o-paper-airplane')
|
||||
->color('primary')
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Ajukan Verifikasi Perusahaan')
|
||||
->modalDescription('Apakah Anda yakin ingin mengajukan data perusahaan untuk diverifikasi? Pastikan semua data sudah benar.')
|
||||
->modalSubmitActionLabel('Ya, Ajukan')
|
||||
->visible(fn () => $this->canSubmit($this->company, $this->companyVerification))
|
||||
->visible(fn() => $this->canSubmit($this->company, $this->companyVerification))
|
||||
->action(function () {
|
||||
$this->submitVerification('company', $this->company, $this->companyVerification);
|
||||
});
|
||||
@ -339,14 +342,14 @@ public function submitCompanyAction(): Action
|
||||
public function submitMediaAction(): Action
|
||||
{
|
||||
return Action::make('submitMedia')
|
||||
->label(fn () => $this->needsRevision($this->mediaVerification) ? 'Kirim Ulang' : 'Ajukan Verifikasi')
|
||||
->label(fn() => $this->needsRevision($this->mediaVerification) ? 'Kirim Ulang' : 'Ajukan Verifikasi')
|
||||
->icon('heroicon-o-paper-airplane')
|
||||
->color('primary')
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Ajukan Verifikasi Media')
|
||||
->modalDescription('Apakah Anda yakin ingin mengajukan data media untuk diverifikasi? Pastikan semua data sudah benar.')
|
||||
->modalSubmitActionLabel('Ya, Ajukan')
|
||||
->visible(fn () => $this->canSubmit($this->partnerMedia, $this->mediaVerification))
|
||||
->visible(fn() => $this->canSubmit($this->partnerMedia, $this->mediaVerification))
|
||||
->action(function () {
|
||||
$this->submitVerification('media', $this->partnerMedia, $this->mediaVerification);
|
||||
});
|
||||
@ -358,14 +361,14 @@ public function submitMediaAction(): Action
|
||||
public function submitJournalistAction(): Action
|
||||
{
|
||||
return Action::make('submitJournalist')
|
||||
->label(fn () => $this->needsRevision($this->journalistVerification) ? 'Kirim Ulang' : 'Ajukan Verifikasi')
|
||||
->label(fn() => $this->needsRevision($this->journalistVerification) ? 'Kirim Ulang' : 'Ajukan Verifikasi')
|
||||
->icon('heroicon-o-paper-airplane')
|
||||
->color('primary')
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Ajukan Verifikasi Jurnalis')
|
||||
->modalDescription('Apakah Anda yakin ingin mengajukan data jurnalis untuk diverifikasi? Pastikan semua data sudah benar.')
|
||||
->modalSubmitActionLabel('Ya, Ajukan')
|
||||
->visible(fn () => $this->canSubmit($this->journalist, $this->journalistVerification))
|
||||
->visible(fn() => $this->canSubmit($this->journalist, $this->journalistVerification))
|
||||
->action(function () {
|
||||
$this->submitVerification('journalist', $this->journalist, $this->journalistVerification);
|
||||
});
|
||||
|
||||
@ -12,17 +12,12 @@ class CreateCooperation extends CreateRecord
|
||||
|
||||
protected static ?string $title = 'Tambah Kerja Sama';
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('back')
|
||||
->label('Kembali')
|
||||
->url(fn (): string => route('filament.dashboard.resources.manage.cooperations.index'))
|
||||
->url(ListCooperations::getUrl())
|
||||
->outlined()
|
||||
->color('secondary'),
|
||||
];
|
||||
|
||||
@ -10,17 +10,12 @@ class EditCooperation extends EditRecord
|
||||
{
|
||||
protected static string $resource = CooperationResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('back')
|
||||
->label('Kembali')
|
||||
->url(fn (): string => route('filament.dashboard.resources.manage.cooperations.index'))
|
||||
->url(ListCooperations::getUrl())
|
||||
->outlined()
|
||||
->color('secondary'),
|
||||
];
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Filament\Columns\TimestampColumns;
|
||||
use App\Filament\Resources\Manage\Journalists\Pages\ManageJournalists;
|
||||
use App\Filament\Pages\CustomMedia;
|
||||
use App\Models\Journalist;
|
||||
use Asmit\FilamentUpload\Forms\Components\AdvancedFileUpload;
|
||||
use BackedEnum;
|
||||
@ -105,7 +106,7 @@ public static function form(Schema $schema): Schema
|
||||
->schema(
|
||||
collect($documents)
|
||||
->map(
|
||||
fn ($doc) => Section::make($doc['title'])
|
||||
fn($doc) => Section::make($doc['title'])
|
||||
->schema([
|
||||
TextInput::make($doc['text_name'])
|
||||
->hiddenLabel()
|
||||
@ -279,7 +280,7 @@ public static function table(Table $table): Table
|
||||
->emptyStateActions([
|
||||
Action::make('completeMedia')
|
||||
->label('Lengkapi Data Media')
|
||||
->url(route('filament.dashboard.pages.manage.media'))
|
||||
->url(CustomMedia::getUrl())
|
||||
->button(),
|
||||
]);
|
||||
});
|
||||
|
||||
@ -12,17 +12,12 @@ class CreateContentRecap extends CreateRecord
|
||||
|
||||
protected static ?string $title = 'Tambah Rekap Konten';
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('back')
|
||||
->label('Kembali')
|
||||
->url(fn (): string => route('filament.dashboard.resources.monitoring.content-recaps.index'))
|
||||
->url(ListContentRecaps::getUrl())
|
||||
->outlined()
|
||||
->color('secondary'),
|
||||
];
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\Monitoring\ContentRecaps\Pages;
|
||||
|
||||
use App\Filament\Resources\Monitoring\ContentRecaps\ContentRecapResource;
|
||||
use App\Filament\Resources\Monitoring\MediaMonitorings\Pages\ListMediaMonitorings;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
@ -15,14 +16,9 @@ protected function getHeaderActions(): array
|
||||
return [
|
||||
Action::make('back')
|
||||
->label('Kembali')
|
||||
->url(fn (): string => route('filament.dashboard.resources.monitoring.media-monitorings.index'))
|
||||
->url(ListMediaMonitorings::getUrl())
|
||||
->outlined()
|
||||
->color('secondary'),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,17 +12,12 @@ class CreateIssueManagement extends CreateRecord
|
||||
|
||||
protected static ?string $title = 'Tambah Manajemen Isu';
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('back')
|
||||
->label('Kembali')
|
||||
->url(fn (): string => route('filament.dashboard.resources.monitoring.issue-managements.index'))
|
||||
->url(ListIssueManagements::getUrl())
|
||||
->outlined()
|
||||
->color('secondary'),
|
||||
];
|
||||
|
||||
@ -15,14 +15,9 @@ protected function getHeaderActions(): array
|
||||
return [
|
||||
Action::make('back')
|
||||
->label('Kembali')
|
||||
->url(fn (): string => route('filament.dashboard.resources.monitoring.issue-managements.index'))
|
||||
->url(ListIssueManagements::getUrl())
|
||||
->outlined()
|
||||
->color('secondary'),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,17 +13,12 @@ class CreateMediaMonitoring extends CreateRecord
|
||||
|
||||
protected static ?string $title = 'Tambah Monitoring Media';
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('back')
|
||||
->label('Kembali')
|
||||
->url(fn (): string => route('filament.dashboard.resources.monitoring.media-monitorings.index'))
|
||||
->url(ListMediaMonitorings::getUrl())
|
||||
->outlined()
|
||||
->color('secondary'),
|
||||
];
|
||||
@ -39,7 +34,7 @@ protected function mutateFormDataBeforeCreate(array $data): array
|
||||
|
||||
$newNumber = str_pad($lastNumber + 1, 6, '0', STR_PAD_LEFT);
|
||||
|
||||
$data['code'] = 'ADN'.$newNumber;
|
||||
$data['code'] = 'ADN' . $newNumber;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@ -15,14 +15,9 @@ protected function getHeaderActions(): array
|
||||
return [
|
||||
Action::make('back')
|
||||
->label('Kembali')
|
||||
->url(fn (): string => route('filament.dashboard.resources.monitoring.media-monitorings.index'))
|
||||
->url(ListMediaMonitorings::getUrl())
|
||||
->outlined()
|
||||
->color('secondary'),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,17 +13,12 @@ class CreateNews extends CreateRecord
|
||||
|
||||
protected static ?string $title = 'Tambah Berita';
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('back')
|
||||
->label('Kembali')
|
||||
->url(fn (): string => route('filament.dashboard.resources.publication.news.index'))
|
||||
->url(ListNews::getUrl())
|
||||
->outlined()
|
||||
->color('secondary'),
|
||||
];
|
||||
|
||||
@ -15,14 +15,9 @@ protected function getHeaderActions(): array
|
||||
return [
|
||||
Action::make('back')
|
||||
->label('Kembali')
|
||||
->url(fn (): string => route('filament.dashboard.resources.publication.news.index'))
|
||||
->url(ListNews::getUrl())
|
||||
->outlined()
|
||||
->color('secondary'),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user