wip
This commit is contained in:
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';
|
||||
|
||||
+49
-19
@@ -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';
|
||||
|
||||
@@ -6,5 +6,11 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjekteImport extends Model
|
||||
{
|
||||
//
|
||||
protected $fillable = [
|
||||
'projekte_id',
|
||||
'file',
|
||||
'beschreibung',
|
||||
'filetype',
|
||||
'original_name',
|
||||
];
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
use App\Models\KontoOption;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class KontoOptionPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:KontoOption');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, KontoOption $kontoOption): bool
|
||||
{
|
||||
return $authUser->can('View:KontoOption');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:KontoOption');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, KontoOption $kontoOption): bool
|
||||
{
|
||||
return $authUser->can('Update:KontoOption');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, KontoOption $kontoOption): bool
|
||||
{
|
||||
return $authUser->can('Delete:KontoOption');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, KontoOption $kontoOption): bool
|
||||
{
|
||||
return $authUser->can('Restore:KontoOption');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, KontoOption $kontoOption): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:KontoOption');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:KontoOption');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:KontoOption');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, KontoOption $kontoOption): bool
|
||||
{
|
||||
return $authUser->can('Replicate:KontoOption');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:KontoOption');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\KontoOption;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
|
||||
class KontoOptionPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:KontoOption');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, KontoOption $kontooptionen): bool
|
||||
{
|
||||
return $authUser->can('View:KontoOption');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:KontoOption');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, KontoOption $kontooptionen): bool
|
||||
{
|
||||
return $authUser->can('Update:KontoOption');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, KontoOption $kontooptionen): bool
|
||||
{
|
||||
return $authUser->can('Delete:KontoOption');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, KontoOption $kontooptionen): bool
|
||||
{
|
||||
return $authUser->can('Restore:KontoOption');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, KontoOption $kontooptionen): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:KontoOption');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:KontoOption');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:KontoOption');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, KontoOption $kontooptionen): bool
|
||||
{
|
||||
return $authUser->can('Replicate:KontoOption');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:KontoOption');
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,8 @@ class AdminPanelProvider extends PanelProvider
|
||||
])->plugins([
|
||||
FilamentShieldPlugin::make()
|
||||
->navigationSort(10)
|
||||
->navigationBadge('3'),
|
||||
->navigationBadge('3')
|
||||
->globallySearchable(false),
|
||||
FilamentBackgroundsPlugin::make()
|
||||
->imageProvider(
|
||||
MyImages::make()
|
||||
|
||||
Reference in new issue
Block a user