This commit is contained in:
salam committed 2025-10-03 17:03:13 +02:00
1 parent 9b36f0d088
commit 4204c74406
18 files changed
+298 -239

No files matched your search

@@ -23,8 +23,6 @@ class InhaltsverzeichnisResource extends Resource
protected static string|BackedEnum|null $navigationIcon = 'phosphor-list';
protected static ?string $recordTitleAttribute = 'name';
protected static ?string $navigationLabel = 'Inhaltsverzeichnis';
protected static ?string $modelLabel = 'Inhaltsverzeichnis';
@@ -23,8 +23,6 @@ class MethodeResource extends Resource
protected static string|BackedEnum|null $navigationIcon = 'lucide-calculator';
protected static ?string $recordTitleAttribute = 'name';
protected static ?string $navigationLabel = 'Methode';
protected static ?string $modelLabel = 'Methode';
@@ -23,8 +23,6 @@ class OrientierungResource extends Resource
protected static string|BackedEnum|null $navigationIcon = 'lucide-compass';
protected static ?string $recordTitleAttribute = 'name';
protected static ?string $navigationLabel = 'Orientierung';
protected static ?string $modelLabel = 'Orientierung';
@@ -3,18 +3,18 @@
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\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\HtmlString;
class ProjekteImportsRelationManager extends RelationManager
{
@@ -32,10 +32,24 @@ class ProjekteImportsRelationManager extends RelationManager
{
return $schema
->components([
TextInput::make('name')
Select::make('filetype')
->label('Dokument Type')
->required()
->options([
'allgemein' => 'Allgemeinflächen',
'nutzwerte' => 'Nutzwerte',
]),
FileUpload::make('file')
->required()
->disabledOn('edit')
->label('Datei (csv/txt) auswählen')
->directory('projekt-data-files')
->storeFileNamesIn('original_name')
->moveFiles()
->acceptedFileTypes(['text/csv', 'text/plain']),
Textarea::make('beschreibung')
->maxLength(255),
]);
])->columns(1);
}
public function table(Table $table): Table
@@ -43,26 +57,42 @@ class ProjekteImportsRelationManager extends RelationManager
return $table
->recordTitleAttribute('name')
->columns([
TextColumn::make('name')
->searchable(),
TextColumn::make('filetype')
->badge()
->color(fn (string $state): string => match ($state) {
'allgemein' => 'success',
'nutzwerte' => 'info',
}),
TextColumn::make('original_name')
->label('name')
->wrap()
->description(function ($record) {
return new HtmlString($record->beschreibung);
}),
])
->filters([
//
])
->headerActions([
CreateAction::make(),
// CreateAction::make(),
// AssociateAction::make(),
CreateAction::make()
->createAnother(false)
->label('Hochladen')
->color('primary')
->icon('heroicon-o-document-arrow-up')
->before(function (array $data) {
$path = Storage::disk('private')->path($data['file']);
$contents = file_get_contents($path);
$arr = preg_split("/\r\n|\n|\r/", $contents);
dd($arr);
// Runs before the form fields are saved to the database.
}),
])
->recordActions([
EditAction::make(),
DissociateAction::make(),
DeleteAction::make(),
])
->toolbarActions([
BulkActionGroup::make([
DissociateBulkAction::make(),
DeleteBulkAction::make(),
]),
EditAction::make()->iconButton()->color('gray'),
DeleteAction::make()->iconButton(),
]);
}
}
@@ -40,7 +40,7 @@ class ProjekteForm
Select::make('gutachter_id')->relationship(name: 'gutachter', titleAttribute: 'name')->required(),
Radio::make('status')->options(ProjektStatus::class)->required(),
]),
Tab::make('Beeschreibung')
Tab::make('Beschreibung')
->schema([
RichEditor::make('beschreibung')
->toolbarButtons([
@@ -23,8 +23,6 @@ class TextblockResource extends Resource
protected static string|BackedEnum|null $navigationIcon = 'phosphor-article';
protected static ?string $recordTitleAttribute = 'name';
protected static ?string $navigationLabel = 'Textblock';
protected static ?string $modelLabel = 'Textblock';
@@ -26,8 +26,6 @@ class UserResource extends Resource
protected static string|BackedEnum|null $navigationIcon = 'lucide-user-pen';
protected static ?string $recordTitleAttribute = 'name';
protected static ?string $navigationLabel = 'Benutzer';
protected static ?string $modelLabel = 'Benutzer';