feat: granular permissions, export backup, user/role management
Some checks failed
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
Tests / PHP 8.5 (push) Has been cancelled

- PermissionSeeder: 29 permissions with role mapping (admin/manager/staff)
- Policies updated to use hasPermissionTo() instead of hasRole()
- ExportBackup command: JSON per-table backup with chunk processing
- UserResource: CRUD users with role assignment (admin only)
- RoleResource: CRUD roles with permission assignment (admin only)
- UserPolicy + RolePolicy: admin-only access control
- ImportCskh: detailed skip logging with color in dry-run mode
- Widgets: permission-based visibility checks
- Tests: 8/8 pass (21 assertions)
This commit is contained in:
2026-05-02 04:47:10 +00:00
parent 7c5055075b
commit 3a8db5cae6
40 changed files with 1804 additions and 440 deletions

View File

@@ -36,7 +36,7 @@ class EditFeedback extends EditRecord
->label('Transfer Department')
->icon('heroicon-o-arrows-right-left')
->color('warning')
->visible(fn (): bool => auth()->user()->hasRole(['admin', 'manager']))
->visible(fn (): bool => auth()->user()->hasPermissionTo('transfer-department'))
->form([
Select::make('to_department_id')
->label('Target Department')
@@ -106,7 +106,7 @@ class EditFeedback extends EditRecord
->label('Close Ticket')
->icon('heroicon-o-check-circle')
->color('success')
->visible(fn (): bool => $this->getRecord()->status !== 'closed' && auth()->user()->hasRole(['admin', 'manager']))
->visible(fn (): bool => $this->getRecord()->status !== 'closed' && auth()->user()->hasPermissionTo('close-ticket'))
->requiresConfirmation()
->modalHeading('Close Ticket')
->modalDescription('Bạn có chắc muốn đóng phiếu này? Hành động này KHÔNG thể hoàn tác.')

View File

@@ -53,7 +53,7 @@ class InteractionsRelationManager extends RelationManager
Select::make('new_status')
->label('New Status')
->options(fn (): array => auth()->user()->hasRole(['admin', 'manager'])
->options(fn (): array => auth()->user()->hasPermissionTo('close-ticket')
? ['pending' => 'Pending', 'processing' => 'Processing', 'resolved' => 'Resolved', 'closed' => 'Closed']
: ['pending' => 'Pending', 'processing' => 'Processing', 'resolved' => 'Resolved'],
)

View File

@@ -11,6 +11,7 @@ use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Schema;
class FeedbackForm
@@ -19,18 +20,22 @@ class FeedbackForm
{
return $schema
->components([
Section::make('Feedback Information')
Section::make('Customer & Product')
->description('Select the customer and their associated product')
->icon('heroicon-o-user-group')
->schema([
Select::make('customer_id')
->relationship('customer', 'name')
->searchable()
->required()
->live(),
->live()
->columnSpan(1),
Toggle::make('is_general')
->label('General feedback (not related to a product)')
->default(false)
->live(),
->live()
->columnSpan(1),
Select::make('customer_product_id')
->label('Product')
@@ -57,7 +62,7 @@ class FeedbackForm
->live(),
Select::make('contract_id')
->label('Hợp đồng')
->label('Contract')
->visible(fn ($get): bool => ! $get('is_general') && filled($get('customer_product_id')))
->options(function ($get): array {
$customerProductId = $get('customer_product_id');
@@ -102,48 +107,46 @@ class FeedbackForm
})
->nullable()
->searchable(),
])
->columns(2),
Section::make('Feedback Details')
->description('Describe the customer feedback')
->icon('heroicon-o-chat-bubble-left-right')
->schema([
Select::make('feedback_channel_id')
->relationship('feedbackChannel', 'name')
->required()
->preload(),
->preload()
->columnSpan(1),
TextInput::make('title')
->required()
->maxLength(255),
->maxLength(255)
->columnSpan(1),
Textarea::make('content')
->required()
->rows(6)
->columnSpanFull(),
Select::make('attachment_collection')
->label('Attachment Collection')
->options([
'general' => 'General',
'proof_of_resolution' => 'Proof of Resolution',
'customer_evidence' => 'Customer Evidence',
])
->default('general'),
FileUpload::make('attachments')
->label('Attachments')
->multiple()
->disk('local')
->directory('feedback-attachments')
->columnSpanFull()
->dehydrated(false),
Select::make('tags')
->relationship('tags', 'name')
->multiple()
->preload()
->columnSpanFull()
->createOptionForm([
TextInput::make('name')->required(),
TextInput::make('slug')->required(),
ColorPicker::make('color')->default('#3b82f6'),
]),
])
->columns(2),
Section::make('Assignment & Status')
->description('Assign handler and set initial status')
->icon('heroicon-o-arrow-path-rounded-square')
->schema([
Select::make('status')
->options([
'pending' => 'Pending',
@@ -152,22 +155,50 @@ class FeedbackForm
'closed' => 'Closed',
])
->default('pending')
->required(),
->required()
->columnSpan(1),
Select::make('assigned_to')
->relationship('assignedTo', 'name')
->searchable()
->nullable(),
->nullable()
->columnSpan(1),
Select::make('current_department_id')
->label('Department')
->options(Department::pluck('name', 'id')->toArray())
->searchable()
->nullable(),
->nullable()
->columnSpan(1),
Toggle::make('is_escalated')
->label('Escalated')
->visible(fn (): bool => auth()->user()?->hasRole(['admin', 'manager']) ?? false),
->visible(fn (): bool => auth()->user()?->hasPermissionTo('close-ticket') ?? false)
->columnSpan(1),
])
->columns(2),
Section::make('Attachments')
->description('Upload files related to this feedback')
->icon('heroicon-o-paper-clip')
->schema([
Select::make('attachment_collection')
->label('Collection')
->options([
'general' => 'General',
'proof_of_resolution' => 'Proof of Resolution',
'customer_evidence' => 'Customer Evidence',
])
->default('general')
->columnSpan(1),
FileUpload::make('attachments')
->label('Files')
->multiple()
->disk('local')
->directory('feedback-attachments')
->columnSpan(1)
->dehydrated(false),
])
->columns(2),
]);

View File

@@ -16,16 +16,28 @@ class FeedbackTable
{
return $table
->columns([
TextColumn::make('id')
->label('#')
->sortable()
->weight('bold')
->color('primary'),
TextColumn::make('title')
->searchable()
->sortable(),
->sortable()
->weight('semibold')
->limit(40),
TextColumn::make('customer.name')
->searchable()
->sortable(),
TextColumn::make('customerProduct.product.name')
->label('Product')
->placeholder('General')
->sortable(),
->sortable()
->toggleable(),
TextColumn::make('contract.type')
->label('Contract')
->badge()
@@ -38,17 +50,17 @@ class FeedbackTable
})
->placeholder('-')
->toggleable(),
TextColumn::make('feedbackChannel.name')
->label('Channel')
->formatStateUsing(fn ($state, $record) => sprintf(
'<span style="display:inline-block;background:%s;color:#fff;padding:2px 10px;border-radius:9999px;font-size:0.75rem;">%s</span>',
$record->feedbackChannel?->color ?: '#6b7280',
e($state)
))
->html(),
->badge()
->color('gray'),
TextColumn::make('tags.name')
->badge()
->separator(','),
->separator(',')
->toggleable(),
TextColumn::make('status')
->badge()
->color(fn(string $state): string => match ($state) {
@@ -58,20 +70,28 @@ class FeedbackTable
'closed' => 'gray',
default => 'gray',
}),
TextColumn::make('currentDepartment.name')
->label('Department')
->badge()
->color('info')
->toggleable(),
TextColumn::make('assignedTo.name')
->label('Assigned To')
->toggleable(),
IconColumn::make('is_escalated')
->label('Escalated')
->boolean()
->toggleable(),
TextColumn::make('created_at')
->dateTime()
->label('Created')
->since()
->sortable()
->toggleable(),
->toggleable()
->color('secondary'),
])
->filters([
SelectFilter::make('status')

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Filament\Resources\Roles\Pages;
use App\Filament\Resources\Roles\RoleResource;
use Filament\Resources\Pages\CreateRecord;
use Spatie\Permission\Models\Permission;
class CreateRole extends CreateRecord
{
protected static string $resource = RoleResource::class;
protected function afterCreate(): void
{
$record = $this->record;
$permissionNames = $this->data['permissions'] ?? [];
if (! empty($permissionNames)) {
$record->syncPermissions($permissionNames);
}
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Filament\Resources\Roles\Pages;
use App\Filament\Resources\Roles\RoleResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditRole extends EditRecord
{
protected static string $resource = RoleResource::class;
protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
protected function afterSave(): void
{
$record = $this->record;
$permissionNames = $this->data['permissions'] ?? [];
$record->syncPermissions($permissionNames);
}
protected function mutateFormDataBeforeFill(array $data): array
{
$role = $this->record;
$data['permissions'] = $role->permissions->pluck('name')->toArray();
return $data;
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Roles\Pages;
use App\Filament\Resources\Roles\RoleResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListRoles extends ListRecords
{
protected static string $resource = RoleResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace App\Filament\Resources\Roles;
use App\Filament\Resources\Roles\Pages\CreateRole;
use App\Filament\Resources\Roles\Pages\EditRole;
use App\Filament\Resources\Roles\Pages\ListRoles;
use App\Filament\Resources\Roles\Schemas\RoleForm;
use App\Filament\Resources\Roles\Tables\RolesTable;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use Spatie\Permission\Models\Role;
class RoleResource extends Resource
{
protected static ?string $model = Role::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedShieldCheck;
protected static ?string $pluralLabel = 'Roles';
protected static ?int $navigationSort = 6;
protected static ?string $recordTitleAttribute = 'name';
public static function getNavigationGroup(): ?string
{
return 'Management';
}
public static function form(Schema $schema): Schema
{
return RoleForm::configure($schema);
}
public static function table(Table $table): Table
{
return RolesTable::configure($table);
}
public static function getRelations(): array
{
return [];
}
public static function getPages(): array
{
return [
'index' => ListRoles::route('/'),
'create' => CreateRole::route('/create'),
'edit' => EditRole::route('/{record}/edit'),
];
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Filament\Resources\Roles\Schemas;
use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
use Filament\Schemas\Components\Section;
use Spatie\Permission\Models\Permission;
class RoleForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
Section::make()
->schema([
TextInput::make('name')
->label('Role Name')
->required()
->maxLength(255)
->unique(ignoreRecord: true),
]),
Section::make('Permissions')
->description('Chọn quyền cho role này')
->schema([
CheckboxList::make('permissions')
->label('')
->options(fn () => Permission::orderBy('name')->pluck('name', 'name')->toArray())
->columns(4)
->columnSpanFull(),
]),
]);
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace App\Filament\Resources\Roles\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class RolesTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
TextColumn::make('id')
->label('#')
->sortable(),
TextColumn::make('name')
->label('Role Name')
->searchable()
->sortable()
->badge()
->color(fn (string $state): string => match ($state) {
'admin' => 'danger',
'manager' => 'warning',
'staff' => 'info',
default => 'gray',
}),
TextColumn::make('permissions_count')
->label('Permissions')
->counts('permissions')
->badge()
->color('primary'),
TextColumn::make('users_count')
->label('Users')
->counts('users')
->badge()
->color('success'),
TextColumn::make('created_at')
->dateTime('d/m/Y H:i')
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->defaultSort('id', 'asc')
->filters([
//
])
->recordActions([
EditAction::make(),
])
->bulkActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Filament\Resources\Users\Pages;
use App\Filament\Resources\Users\UserResource;
use Filament\Resources\Pages\CreateRecord;
class CreateUser extends CreateRecord
{
protected static string $resource = UserResource::class;
protected function afterCreate(): void
{
$record = $this->record;
$role = $record->role;
// Assign the primary role
$record->syncRoles([$role]);
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Filament\Resources\Users\Pages;
use App\Filament\Resources\Users\UserResource;
use Filament\Resources\Pages\EditRecord;
class EditUser extends EditRecord
{
protected static string $resource = UserResource::class;
protected function getHeaderActions(): array
{
return [
\Filament\Actions\DeleteAction::make(),
];
}
protected function afterSave(): void
{
$record = $this->record;
$role = $record->role;
// Sync the primary role
$record->syncRoles([$role]);
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Filament\Resources\Users\Pages;
use App\Filament\Resources\Users\UserResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
use Filament\Schemas\Components\Tabs\Tab;
use Illuminate\Database\Eloquent\Builder;
class ListUsers extends ListRecords
{
protected static string $resource = UserResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
public function getTabs(): array
{
return [
'all' => Tab::make(),
'admin' => Tab::make()
->modifyQueryUsing(fn (Builder $query) => $query->where('role', 'admin'))
->badge(fn () => static::getResource()::getModel()::where('role', 'admin')->count()),
'manager' => Tab::make()
->modifyQueryUsing(fn (Builder $query) => $query->where('role', 'manager'))
->badge(fn () => static::getResource()::getModel()::where('role', 'manager')->count()),
'staff' => Tab::make()
->modifyQueryUsing(fn (Builder $query) => $query->where('role', 'staff'))
->badge(fn () => static::getResource()::getModel()::where('role', 'staff')->count()),
];
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Filament\Resources\Users\Schemas;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
use Spatie\Permission\Models\Role;
class UserForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('name')
->required()
->maxLength(255),
TextInput::make('email')
->email()
->required()
->maxLength(255)
->unique(ignoreRecord: true),
TextInput::make('password')
->password()
->revealable()
->required(fn (string $operation): bool => $operation === 'create')
->dehydrateStateUsing(fn (?string $state): ?string => filled($state) ? bcrypt($state) : null)
->dehydrated(fn (?string $state): bool => filled($state))
->maxLength(255)
->columnSpanFull(),
Select::make('role')
->label('Role')
->options(Role::pluck('name', 'name')->toArray())
->required()
->searchable(),
]);
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace App\Filament\Resources\Users\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class UsersTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
TextColumn::make('id')
->label('#')
->sortable(),
TextColumn::make('name')
->searchable()
->sortable(),
TextColumn::make('email')
->searchable()
->sortable(),
TextColumn::make('role')
->badge()
->color(fn (string $state): string => match ($state) {
'admin' => 'danger',
'manager' => 'warning',
'staff' => 'info',
default => 'gray',
}),
TextColumn::make('created_at')
->dateTime('d/m/Y H:i')
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->defaultSort('id', 'asc')
->filters([
//
])
->recordActions([
EditAction::make(),
])
->headerActions([
//
])
->bulkActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace App\Filament\Resources\Users;
use App\Filament\Resources\Users\Pages\CreateUser;
use App\Filament\Resources\Users\Pages\EditUser;
use App\Filament\Resources\Users\Pages\ListUsers;
use App\Filament\Resources\Users\Schemas\UserForm;
use App\Filament\Resources\Users\Tables\UsersTable;
use App\Models\User;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
class UserResource extends Resource
{
protected static ?string $model = User::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUsers;
protected static ?string $pluralLabel = 'Users';
protected static ?int $navigationSort = 5;
protected static ?string $recordTitleAttribute = 'name';
public static function getNavigationGroup(): ?string
{
return 'Management';
}
public static function form(Schema $schema): Schema
{
return UserForm::configure($schema);
}
public static function table(Table $table): Table
{
return UsersTable::configure($table);
}
public static function getRelations(): array
{
return [];
}
public static function getPages(): array
{
return [
'index' => ListUsers::route('/'),
'create' => CreateUser::route('/create'),
'edit' => EditUser::route('/{record}/edit'),
];
}
}

View File

@@ -17,7 +17,7 @@ class AvgProcessingTimeWidget extends BaseWidget
->whereNotNull('assigned_to')
->whereNotNull('updated_at');
if ($user->hasRole('manager')) {
if ($user->hasRole('manager') && ! $user->hasRole('admin')) {
$deptIds = Department::where('manager_id', $user->id)->pluck('id');
$query->whereIn('current_department_id', $deptIds);
}
@@ -33,27 +33,38 @@ class AvgProcessingTimeWidget extends BaseWidget
$escalatedCount = (clone $query)->where('is_escalated', true)->count();
$avgDisplay = $avgMinutes ? round($avgMinutes) . ' min' : 'N/A';
$avgDescription = $avgMinutes
? 'Avg time from creation to resolution'
: 'No resolved tickets yet';
return [
Stat::make('Resolved Tickets', (string) $totalResolved)
->description('Total resolved/closed tickets')
->color('success'),
->descriptionIcon('heroicon-m-check-circle')
->color('success')
->chart([7, 3, 4, 5, 6, 8, $totalResolved]),
Stat::make('Avg Processing Time', $avgMinutes ? round($avgMinutes) . ' min' : 'N/A')
->description('Average time from creation to resolution')
->color('warning'),
Stat::make('Avg Processing Time', $avgDisplay)
->description($avgDescription)
->descriptionIcon('heroicon-m-clock')
->color('info'),
Stat::make('Pending Tickets', (string) $totalPending)
->description('Still in progress')
->color('danger'),
->descriptionIcon('heroicon-m-arrow-path')
->color('warning')
->chart([3, 5, 4, 6, 5, 4, $totalPending]),
Stat::make('Escalated', (string) $escalatedCount)
->description('Tickets marked as escalated')
->color('gray'),
->descriptionIcon('heroicon-m-exclamation-triangle')
->color('danger'),
];
}
public static function canView(): bool
{
return auth()->user()?->hasRole(['admin', 'manager']) ?? false;
return auth()->user()?->hasPermissionTo('view-dashboard-widgets') ?? false;
}
}

View File

@@ -10,6 +10,8 @@ class HandlerPerformanceWidget extends ChartWidget
{
protected ?string $heading = 'Avg Processing Time by Handler';
protected ?string $description = 'Average time from ticket creation to resolution, broken down by handler.';
protected int|string|array $columnSpan = 'full';
protected function getType(): string
@@ -25,7 +27,7 @@ class HandlerPerformanceWidget extends ChartWidget
->whereIn('status', ['resolved', 'closed'])
->whereNotNull('assigned_to');
if ($user->hasRole('manager')) {
if ($user->hasRole('manager') && ! $user->hasRole('admin')) {
$deptIds = Department::where('manager_id', $user->id)->pluck('id');
$query->whereIn('current_department_id', $deptIds);
}
@@ -40,12 +42,37 @@ class HandlerPerformanceWidget extends ChartWidget
$labels = $handlers->map(fn ($h) => $h->assignedTo?->name ?? 'Unknown')->toArray();
$data = $handlers->map(fn ($h) => round($h->avg_minutes, 1))->toArray();
// Generate gradient colors based on performance
$maxMinutes = max($data) ?: 1;
$colors = collect($data)->map(function ($minutes) use ($maxMinutes) {
$ratio = $minutes / $maxMinutes;
if ($ratio > 0.8) {
return 'rgba(220, 38, 38, 0.8)'; // Red for slow
} elseif ($ratio > 0.5) {
return 'rgba(217, 119, 6, 0.8)'; // Amber for medium
}
return 'rgba(26, 86, 219, 0.8)'; // Blue for fast
})->toArray();
$borderColors = collect($data)->map(function ($minutes) use ($maxMinutes) {
$ratio = $minutes / $maxMinutes;
if ($ratio > 0.8) {
return 'rgb(220, 38, 38)';
} elseif ($ratio > 0.5) {
return 'rgb(217, 119, 6)';
}
return 'rgb(26, 86, 219)';
})->toArray();
return [
'datasets' => [
[
'label' => 'Avg Time (minutes)',
'data' => $data,
'backgroundColor' => '#3b82f6',
'backgroundColor' => $colors,
'borderColor' => $borderColors,
'borderWidth' => 1,
'borderRadius' => 6,
],
],
'labels' => $labels,
@@ -54,6 +81,6 @@ class HandlerPerformanceWidget extends ChartWidget
public static function canView(): bool
{
return auth()->user()?->hasRole(['admin', 'manager']) ?? false;
return auth()->user()?->hasPermissionTo('view-dashboard-widgets') ?? false;
}
}

View File

@@ -20,7 +20,7 @@ class ResolvedTicketsWidget extends BaseWidget
Feedback::query()
->where('status', 'resolved')
->when(
auth()->user()->hasRole('manager'),
auth()->user()->hasRole('manager') && ! auth()->user()->hasRole('admin'),
function ($q) {
$deptIds = Department::where('manager_id', auth()->id())->pluck('id');
return $q->whereIn('current_department_id', $deptIds);
@@ -30,30 +30,47 @@ class ResolvedTicketsWidget extends BaseWidget
->columns([
TextColumn::make('id')
->label('#')
->sortable(),
->sortable()
->weight('bold')
->color('primary'),
TextColumn::make('title')
->label('Ticket')
->searchable()
->url(fn (Feedback $record): string => FeedbackResource::getUrl('edit', ['record' => $record])),
->weight('semibold')
->url(fn (Feedback $record): string => FeedbackResource::getUrl('edit', ['record' => $record]))
->color('primary'),
TextColumn::make('customer.name')
->label('Customer')
->searchable(),
TextColumn::make('customerProduct.product.name')
->label('Product')
->placeholder('General'),
TextColumn::make('assignedTo.name')
->label('Handler'),
TextColumn::make('currentDepartment.name')
->label('Department'),
->label('Department')
->badge()
->color('info'),
TextColumn::make('updated_at')
->label('Resolved Date')
->dateTime('d/m/Y')
->sortable(),
->label('Resolved')
->since()
->sortable()
->color('secondary'),
])
->defaultSort('updated_at', 'desc')
->heading('Tickets Awaiting Closure (Resolved)')
->description('Tickets that have been resolved and are pending manager review for closure.');
->heading('Tickets Awaiting Closure')
->description('Tickets that have been resolved and are pending manager review for closure.')
->paginated([5]);
}
public static function canView(): bool
{
return auth()->user()?->hasRole(['admin', 'manager']) ?? false;
return auth()->user()?->hasPermissionTo('view-dashboard-widgets') ?? false;
}
}