| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 | 
							- <?php
 - 
 - namespace App\Filament\Company\Resources\Core;
 - 
 - use App\Filament\Company\Resources\Core\DepartmentResource\Pages;
 - use App\Models\Core\Department;
 - use Filament\Forms\Form;
 - use Filament\Resources\Resource;
 - use Filament\Tables\Table;
 - use Filament\{Forms, Tables};
 - 
 - class DepartmentResource extends Resource
 - {
 -     protected static ?string $model = Department::class;
 - 
 -     protected static ?string $navigationIcon = 'heroicon-o-square-3-stack-3d';
 - 
 -     protected static ?string $navigationGroup = 'HR';
 - 
 -     protected static ?string $slug = 'hr/departments';
 - 
 -     public static function form(Form $form): Form
 -     {
 -         return $form
 -             ->schema([
 -                 Forms\Components\Section::make('General')
 -                     ->schema([
 -                         Forms\Components\TextInput::make('name')
 -                             ->autofocus()
 -                             ->required()
 -                             ->maxLength(100),
 -                         Forms\Components\Select::make('manager_id')
 -                             ->label('Manager')
 -                             ->relationship('manager', 'name')
 -                             ->searchable()
 -                             ->preload()
 -                             ->placeholder('Select a manager')
 -                             ->nullable(),
 -                         Forms\Components\Group::make()
 -                             ->schema([
 -                                 Forms\Components\Select::make('parent_id')
 -                                     ->label('Parent Department')
 -                                     ->relationship('parent', 'name')
 -                                     ->preload()
 -                                     ->searchable()
 -                                     ->nullable(),
 -                                 Forms\Components\Textarea::make('description')
 -                                     ->label('Description')
 -                                     ->autosize()
 -                                     ->nullable(),
 -                             ])->columns(1),
 -                     ])->columns(),
 -             ]);
 -     }
 - 
 -     public static function table(Table $table): Table
 -     {
 -         return $table
 -             ->columns([
 -                 Tables\Columns\TextColumn::make('name')
 -                     ->weight('semibold')
 -                     ->searchable()
 -                     ->sortable(),
 -                 Tables\Columns\TextColumn::make('manager.name')
 -                     ->label('Manager')
 -                     ->searchable()
 -                     ->sortable(),
 -             ])
 -             ->filters([
 -                 //
 -             ])
 -             ->actions([
 -                 Tables\Actions\EditAction::make(),
 -             ])
 -             ->bulkActions([
 -                 Tables\Actions\BulkActionGroup::make([
 -                     Tables\Actions\DeleteBulkAction::make(),
 -                 ]),
 -             ]);
 -     }
 - 
 -     public static function getRelations(): array
 -     {
 -         return [
 -             //
 -         ];
 -     }
 - 
 -     public static function getPages(): array
 -     {
 -         return [
 -             'index' => Pages\ListDepartments::route('/'),
 -             'create' => Pages\CreateDepartment::route('/create'),
 -             'edit' => Pages\EditDepartment::route('/{record}/edit'),
 -         ];
 -     }
 - }
 
 
  |