import new
This commit is contained in:
1 parent
df55380236
commit
228927274d
12 files changed
+272
-207
No files matched your search
+37
-1
@@ -2,12 +2,17 @@
|
||||
|
||||
namespace App\Filament\Resources\Projektes\RelationManagers;
|
||||
|
||||
use App\Filament\Imports\ImportAllgemeinDirect;
|
||||
use App\Models\ProjektAllgemeinflaechen;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\Summarizers\Sum;
|
||||
@@ -53,7 +58,7 @@ class ProjektAllgemeinflaechensRelationManager extends RelationManager
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->emptyStateDescription('Schalten Sie das Projekt frei und importieren Sie die Daten der Allgemeinflächen.')
|
||||
->emptyStateDescription('Bitte Projekt zuerst freischalten und dann die Daten der Allgemeinflächen hochladen.')
|
||||
->striped()
|
||||
->recordTitleAttribute('geschoss')
|
||||
->columns([
|
||||
@@ -75,6 +80,37 @@ class ProjektAllgemeinflaechensRelationManager extends RelationManager
|
||||
->searchable(),
|
||||
])
|
||||
->headerActions([
|
||||
Action::make('import-text')
|
||||
->icon('phosphor-upload')
|
||||
->hidden(fn (): bool => $this->ownerRecord->bezahlt_am ? false : true)
|
||||
->modalIcon('phosphor-file-csv')
|
||||
->color('info')
|
||||
->label('Hochladen')
|
||||
->modalHeading('Allgemeinflächen hochladen')
|
||||
->modalDescription(new HtmlString('<b>Objekte werden immer hinzugefügt!</b><br/>Spalten-Separator ist der Strichpunkt ";" oder die Pfeife "|"'))
|
||||
->schema([
|
||||
Textarea::make('upload_data')
|
||||
->required()
|
||||
->label('Text hier einfügen:')
|
||||
->extraInputAttributes(['onClick' => 'this.select()'])
|
||||
->rows(5),
|
||||
|
||||
])
|
||||
->action(function (array $data): void {
|
||||
ImportAllgemeinDirect::run($data, $this->ownerRecord->id);
|
||||
}),
|
||||
Action::make('leeren')
|
||||
->action(function () {
|
||||
ProjektAllgemeinflaechen::where('projekte_id', $this->ownerRecord->id)->delete();
|
||||
})
|
||||
->icon('phosphor-trash')
|
||||
->color('danger')
|
||||
->requiresConfirmation()
|
||||
->successNotification(
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Allgemeinflächen gelöscht'),
|
||||
),
|
||||
CreateAction::make()
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false),
|
||||
|
||||
Reference in new issue
Block a user