ownerRecord->id); return $table // ->striped() ->recordTitleAttribute('top_nummer') ->columns([ TextColumn::make('top_nummer') ->alignCenter() ->label('Top Nummer') ->searchable() ->extraHeaderAttributes([ 'style' => 'position: sticky; left: 0; z-index: 1;', 'class' => 'bg-gray-50 dark:bg-gray-900', ]) ->extraCellAttributes([ 'style' => 'position: sticky; left: 0; z-index: 1;', 'class' => 'bg-gray-50 dark:bg-gray-900', ]), CheckboxColumn::make('nicht_in_orientierung') ->label('Nicht in Orientierung') ->toggleable(), TextInputColumn::make('raumart') ->toggleable() ->width('2rem') ->rules(['required']) ->searchable(), SelectColumn::make('orientierung_id') ->toggleable() ->width('2rem') ->label('Orientierung') ->selectablePlaceholder(true) ->options(Orientierung::pluck('name', 'id')) ->disableOptionWhen(fn (string $value): bool => in_array($value, [2, 11, 24, 33, 36])) ->preloadOptions(), TextInputColumn::make('a')->label($spalten['a'] ?? '')->hidden(isset($spalten['a']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(), TextInputColumn::make('b')->label($spalten['b'] ?? '')->hidden(isset($spalten['b']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(), TextInputColumn::make('c')->label($spalten['c'] ?? '')->hidden(isset($spalten['c']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(), TextInputColumn::make('d')->label($spalten['d'] ?? '')->hidden(isset($spalten['d']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(), TextInputColumn::make('e')->label($spalten['e'] ?? '')->hidden(isset($spalten['e']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(), TextInputColumn::make('f')->label($spalten['f'] ?? '')->hidden(isset($spalten['f']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(), TextInputColumn::make('g')->label($spalten['g'] ?? '')->hidden(isset($spalten['g']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(), TextInputColumn::make('h')->label($spalten['h'] ?? '')->hidden(isset($spalten['h']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(), TextInputColumn::make('i')->label($spalten['i'] ?? '')->hidden(isset($spalten['i']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(), TextInputColumn::make('j')->label($spalten['j'] ?? '')->hidden(isset($spalten['j']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(), TextColumn::make('nutzwert') ->extraHeaderAttributes([ 'style' => 'position: sticky; right: 0; z-index: 1;', 'class' => 'bg-gray-50 dark:bg-gray-900', ]) ->extraCellAttributes([ 'style' => 'position: sticky; right: 0; z-index: 1;', 'class' => 'bg-gray-50 dark:bg-gray-900', ]) ->alignCenter() ->default(fn ($record): ?int => round($record->a + $record->b + $record->c + $record->d + $record->e + $record->f + $record->g + $record->h + $record->i + $record->j)) ->weight(FontWeight::ExtraBold), ]) ->filters([ TernaryFilter::make('nicht_in_orientierung') ->default(0) ->label('Objekte "Nicht in Orientierung" anzeigen'), ]) ->headerActions([ Action::make('merkmale') ->icon('phosphor-pen') ->modalCancelAction(fn (Action $action) => $action->label('Schließen')) ->modalSubmitAction(false) ->modalHeading('Merkmale') ->slideOver() // ->modalWidth(Width::Medium) ->modalContent(view('filament.pages.actions.merkmale')), Action::make('erstellen') ->action(fn (CreateOrientierungZuAbschlaege $createOrientierungZuAbschlaege) => $createOrientierungZuAbschlaege->create($this->ownerRecord)) ->requiresConfirmation() ->modalHeading('Orientierung Zu/Abschläge erstellen') ->modalDescription('Alle bestehenden Daten in dieser Tabelle werden vorher gelöscht.') ->modalSubmitActionLabel('Erstellen') ->label('Erstellen') ->tooltip('Daten werden aus "Orientierung Zu/Abschläge" Tabelle gefiltert.') ->icon('heroicon-o-cog-8-tooth'), ]) ->toolbarActions([ BulkActionGroup::make([ BulkAction::make('raumart') ->color('primary') ->label('Raumart zuweisen') ->schema([ TextInput::make('raumart') ->prefixIcon('phosphor-house-simple'), ]) ->icon('phosphor-house-simple') ->action(function (Collection $records, array $data): void { foreach ($records as $record) { OrientierungZuAbschlaege::where('id', '=', $record->id) ->update( ['raumart' => $data['raumart']] ); } }), BulkAction::make('methode') ->color('primary') ->label('Orientierung zuweisen') ->schema([ Select::make('methode_id') ->label('Orientierung') ->prefixIcon('phosphor-compass') ->options(Orientierung::pluck('name', 'id')) ->disableOptionWhen(fn (string $value): bool => in_array($value, [2, 11, 24, 33, 36])) ->required(), ]) ->icon('phosphor-compass') ->action(function (Collection $records, array $data): void { foreach ($records as $record) { OrientierungZuAbschlaege::where('id', '=', $record->id) ->update( ['orientierung_id' => $data['methode_id']] ); } }), BulkAction::make('a') ->label($spalten['a'] ?? '') ->color('info') ->hidden(isset($spalten['a']) ? false : true) ->schema([ TextInput::make('a') ->prefixIcon('phosphor-math-operations'), ]) ->icon('phosphor-math-operations') ->action(function (Collection $records, array $data): void { foreach ($records as $record) { OrientierungZuAbschlaege::where('id', '=', $record->id) ->update( ['a' => $data['a']] ); } }), BulkAction::make('b') ->label($spalten['b'] ?? '') ->color('info') ->hidden(isset($spalten['b']) ? false : true) ->schema([ TextInput::make('b') ->prefixIcon('phosphor-math-operations'), ]) ->icon('phosphor-math-operations') ->action(function (Collection $records, array $data): void { foreach ($records as $record) { OrientierungZuAbschlaege::where('id', '=', $record->id) ->update( ['b' => $data['b']] ); } }), BulkAction::make('c') ->label($spalten['c'] ?? '') ->color('info') ->hidden(isset($spalten['c']) ? false : true) ->schema([ TextInput::make('c') ->prefixIcon('phosphor-math-operations'), ]) ->icon('phosphor-math-operations') ->action(function (Collection $records, array $data): void { foreach ($records as $record) { OrientierungZuAbschlaege::where('id', '=', $record->id) ->update( ['c' => $data['c']] ); } }), BulkAction::make('d') ->label($spalten['d'] ?? '') ->color('info') ->hidden(isset($spalten['d']) ? false : true) ->schema([ TextInput::make('d') ->prefixIcon('phosphor-math-operations'), ]) ->icon('phosphor-math-operations') ->action(function (Collection $records, array $data): void { foreach ($records as $record) { OrientierungZuAbschlaege::where('id', '=', $record->id) ->update( ['d' => $data['d']] ); } }), BulkAction::make('e') ->label($spalten['e'] ?? '') ->color('info') ->hidden(isset($spalten['e']) ? false : true) ->schema([ TextInput::make('e') ->prefixIcon('phosphor-math-operations'), ]) ->icon('phosphor-math-operations') ->action(function (Collection $records, array $data): void { foreach ($records as $record) { OrientierungZuAbschlaege::where('id', '=', $record->id) ->update( ['e' => $data['e']] ); } }), BulkAction::make('f') ->label($spalten['f'] ?? '') ->color('info') ->hidden(isset($spalten['f']) ? false : true) ->schema([ TextInput::make('f') ->prefixIcon('phosphor-math-operations'), ]) ->icon('phosphor-math-operations') ->action(function (Collection $records, array $data): void { foreach ($records as $record) { OrientierungZuAbschlaege::where('id', '=', $record->id) ->update( ['f' => $data['f']] ); } }), BulkAction::make('g') ->label($spalten['g'] ?? '') ->color('info') ->hidden(isset($spalten['g']) ? false : true) ->schema([ TextInput::make('g') ->prefixIcon('phosphor-math-operations'), ]) ->icon('phosphor-math-operations') ->action(function (Collection $records, array $data): void { foreach ($records as $record) { OrientierungZuAbschlaege::where('id', '=', $record->id) ->update( ['g' => $data['g']] ); } }), BulkAction::make('h') ->label($spalten['h'] ?? '') ->color('info') ->hidden(isset($spalten['h']) ? false : true) ->schema([ TextInput::make('h') ->prefixIcon('phosphor-math-operations'), ]) ->icon('phosphor-math-operations') ->action(function (Collection $records, array $data): void { foreach ($records as $record) { OrientierungZuAbschlaege::where('id', '=', $record->id) ->update( ['h' => $data['h']] ); } }), BulkAction::make('i') ->label($spalten['i'] ?? '') ->color('info') ->hidden(isset($spalten['i']) ? false : true) ->schema([ TextInput::make('i') ->prefixIcon('phosphor-math-operations'), ]) ->icon('phosphor-math-operations') ->action(function (Collection $records, array $data): void { foreach ($records as $record) { OrientierungZuAbschlaege::where('id', '=', $record->id) ->update( ['i' => $data['i']] ); } }), BulkAction::make('j') ->label($spalten['j'] ?? '') ->color('info') ->hidden(isset($spalten['j']) ? false : true) ->schema([ TextInput::make('j') ->prefixIcon('phosphor-math-operations'), ]) ->icon('phosphor-math-operations') ->action(function (Collection $records, array $data): void { foreach ($records as $record) { OrientierungZuAbschlaege::where('id', '=', $record->id) ->update( ['j' => $data['j']] ); } }), ]), ]); } }