feat: Conditionally render cooperation table filters based on user role and set the status filter to non-native.
This commit is contained in:
parent
9a63d33991
commit
c4347f980e
@ -141,14 +141,17 @@ public static function configure(Table $table): Table
|
|||||||
|
|
||||||
...TimestampColumns::make(),
|
...TimestampColumns::make(),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters(
|
||||||
|
auth()->user()->hasRole(RoleEnum::DEVELOPER->value) || auth()->user()->hasRole(RoleEnum::ADMINISTRATOR->value)
|
||||||
|
? [
|
||||||
TrashedFilter::make()
|
TrashedFilter::make()
|
||||||
->native(false)
|
->native(false)
|
||||||
->visible(fn (): bool => auth()->user()?->hasRole(RoleEnum::DEVELOPER->value)),
|
->visible(fn (): bool => auth()->user()?->hasRole(RoleEnum::DEVELOPER->value)),
|
||||||
|
|
||||||
SelectFilter::make('status')
|
SelectFilter::make('status')
|
||||||
->label('Status')
|
->label('Status')
|
||||||
->options(CooperationStatus::class),
|
->options(CooperationStatus::class)
|
||||||
|
->native(false),
|
||||||
|
|
||||||
SelectFilter::make('partnerMedia')
|
SelectFilter::make('partnerMedia')
|
||||||
->label('Media')
|
->label('Media')
|
||||||
@ -249,7 +252,9 @@ public static function configure(Table $table): Table
|
|||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}),
|
}),
|
||||||
], FiltersLayout::AboveContentCollapsible)
|
] : [],
|
||||||
|
FiltersLayout::AboveContentCollapsible
|
||||||
|
)
|
||||||
->filtersFormColumns(3)
|
->filtersFormColumns(3)
|
||||||
->recordActions([
|
->recordActions([
|
||||||
ViewAction::make(),
|
ViewAction::make(),
|
||||||
@ -266,18 +271,17 @@ public static function configure(Table $table): Table
|
|||||||
|
|
||||||
CompleteCooperationAction::make('completeCooperation'),
|
CompleteCooperationAction::make('completeCooperation'),
|
||||||
|
|
||||||
EditAction::make()
|
EditAction::make(),
|
||||||
->visible(fn (): bool => ! auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value)),
|
|
||||||
|
|
||||||
DeleteAction::make()
|
DeleteAction::make(),
|
||||||
->visible(fn (): bool => ! auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value)),
|
|
||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
->exports([
|
->exports([
|
||||||
CooperationExcelExport::make(),
|
CooperationExcelExport::make(),
|
||||||
])
|
])
|
||||||
->color('success'),
|
->color('success')
|
||||||
|
->visible(fn (): bool => auth()->user()->hasRole(RoleEnum::DEVELOPER->value) || auth()->user()->hasRole(RoleEnum::ADMINISTRATOR->value)),
|
||||||
|
|
||||||
])
|
])
|
||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
|
|||||||
@ -693,15 +693,6 @@ public function run(): void
|
|||||||
"permissions": [
|
"permissions": [
|
||||||
"ViewAny:Cooperation",
|
"ViewAny:Cooperation",
|
||||||
"View:Cooperation",
|
"View:Cooperation",
|
||||||
"Create:Cooperation",
|
|
||||||
"Update:Cooperation",
|
|
||||||
"Delete:Cooperation",
|
|
||||||
"Restore:Cooperation",
|
|
||||||
"ForceDelete:Cooperation",
|
|
||||||
"ForceDeleteAny:Cooperation",
|
|
||||||
"RestoreAny:Cooperation",
|
|
||||||
"Replicate:Cooperation",
|
|
||||||
"Reorder:Cooperation",
|
|
||||||
|
|
||||||
"View:Company",
|
"View:Company",
|
||||||
|
|
||||||
@ -709,15 +700,6 @@ public function run(): void
|
|||||||
|
|
||||||
"ViewAny:DataChangeRequest",
|
"ViewAny:DataChangeRequest",
|
||||||
"View:DataChangeRequest",
|
"View:DataChangeRequest",
|
||||||
"Create:DataChangeRequest",
|
|
||||||
"Update:DataChangeRequest",
|
|
||||||
"Delete:DataChangeRequest",
|
|
||||||
"Restore:DataChangeRequest",
|
|
||||||
"ForceDelete:DataChangeRequest",
|
|
||||||
"ForceDeleteAny:DataChangeRequest",
|
|
||||||
"RestoreAny:DataChangeRequest",
|
|
||||||
"Replicate:DataChangeRequest",
|
|
||||||
"Reorder:DataChangeRequest",
|
|
||||||
|
|
||||||
"ViewAny:Journalist",
|
"ViewAny:Journalist",
|
||||||
"View:Journalist",
|
"View:Journalist",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user