import wip
This commit is contained in:
1 parent
0d0b456db1
commit
9b36f0d088
18 files changed
+16475
-100
No files matched your search
@@ -6,6 +6,7 @@ use App\Filament\Clusters\Projekte\ProjekteCluster;
|
||||
use App\Filament\Resources\Projektes\Pages\CreateProjekte;
|
||||
use App\Filament\Resources\Projektes\Pages\EditProjekte;
|
||||
use App\Filament\Resources\Projektes\Pages\ListProjektes;
|
||||
use App\Filament\Resources\Projektes\RelationManagers\ProjekteImportsRelationManager;
|
||||
use App\Filament\Resources\Projektes\Schemas\ProjekteForm;
|
||||
use App\Filament\Resources\Projektes\Tables\ProjektesTable;
|
||||
use App\Models\Projekte;
|
||||
@@ -45,7 +46,7 @@ class ProjekteResource extends Resource
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
ProjekteImportsRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Projektes\RelationManagers;
|
||||
|
||||
use Filament\Actions\AssociateAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\DissociateAction;
|
||||
use Filament\Actions\DissociateBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ProjekteImportsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'projekte_imports';
|
||||
|
||||
protected static ?string $title = 'Import Daten';
|
||||
|
||||
protected static ?string $navigationLabel = 'Import';
|
||||
|
||||
protected static ?string $modelLabel = 'Import';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Import';
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
CreateAction::make(),
|
||||
// AssociateAction::make(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DissociateAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DissociateBulkAction::make(),
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class ProjekteForm
|
||||
@@ -18,31 +20,38 @@ class ProjekteForm
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make('Projektdaten')
|
||||
->label(fn (Projekte $record): ?string => 'Erstellt: '.$record->created_at?->diffForHumans().', Geändert: '.$record->updated_at?->diffForHumans())
|
||||
->collapsed()
|
||||
Section::make('Projekt Daten')
|
||||
->label(fn (?Projekte $record): ?string => ($record?->created_at) ? 'Erstellt: '.$record?->created_at->diffForHumans().', Geändert: '.$record?->updated_at->diffForHumans() : '')
|
||||
->collapsed(fn ($operation) => $operation == 'create' ? false : true)
|
||||
->icon('heroicon-o-rectangle-stack')
|
||||
->schema([
|
||||
Section::make('Benennung')
|
||||
->schema([
|
||||
TextInput::make('interner_name')->label('Interner Name')->required(),
|
||||
TextInput::make('offizieller_name')->label('Offizieller Name')->required(),
|
||||
DatePicker::make('erstellung')->helperText('Datum am Gutachten')->required(),
|
||||
]),
|
||||
Section::make('Zuordnung')
|
||||
->schema([
|
||||
Select::make('auftraggeber_id')->relationship(name: 'auftraggeber', titleAttribute: 'name')->required(),
|
||||
Select::make('gutachter_id')->relationship(name: 'gutachter', titleAttribute: 'name')->required(),
|
||||
Radio::make('status')->options(ProjektStatus::class)->required(),
|
||||
Tabs::make('Tabs')
|
||||
->contained(false)
|
||||
->tabs([
|
||||
Tab::make('Benennung')
|
||||
->schema([
|
||||
TextInput::make('interner_name')->label('Interner Name')->required(),
|
||||
TextInput::make('offizieller_name')->label('Offizieller Name')->required(),
|
||||
DatePicker::make('erstellung')->helperText('Datum am Gutachten')->required(),
|
||||
]),
|
||||
Tab::make('Zuordnung')
|
||||
->schema([
|
||||
Select::make('auftraggeber_id')->relationship(name: 'auftraggeber', titleAttribute: 'name')->required(),
|
||||
Select::make('gutachter_id')->relationship(name: 'gutachter', titleAttribute: 'name')->required(),
|
||||
Radio::make('status')->options(ProjektStatus::class)->required(),
|
||||
]),
|
||||
Tab::make('Beeschreibung')
|
||||
->schema([
|
||||
RichEditor::make('beschreibung')
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'link'],
|
||||
['h2', 'h3', 'alignStart', 'alignCenter', 'alignEnd'],
|
||||
['bulletList', 'orderedList', 'table'],
|
||||
['undo', 'redo'],
|
||||
])->columnSpan(2),
|
||||
]),
|
||||
]),
|
||||
|
||||
RichEditor::make('beschreibung')
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'link'],
|
||||
['h2', 'h3', 'alignStart', 'alignCenter', 'alignEnd'],
|
||||
['bulletList', 'orderedList', 'table'],
|
||||
['undo', 'redo'],
|
||||
])->columnSpan(2),
|
||||
])->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user