wip methods
This commit is contained in:
1 parent
de41dd5187
commit
2ca6d0c48d
6 files changed
+30
-33
No files matched your search
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Filament\Clusters\Administration\Methodes\Schemas;
|
namespace App\Filament\Clusters\Administration\Methodes\Schemas;
|
||||||
|
|
||||||
use Filament\Forms\Components\RichEditor;
|
use Filament\Forms\Components\Textarea;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
@@ -13,12 +13,7 @@ class MethodeForm
|
|||||||
return $schema
|
return $schema
|
||||||
->components([
|
->components([
|
||||||
TextInput::make('name')->required(),
|
TextInput::make('name')->required(),
|
||||||
RichEditor::make('description')
|
Textarea::make('description')->label('Beschreibung')->rows(6),
|
||||||
->label('Beschreibung')
|
|
||||||
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
|
|
||||||
->toolbarButtons([
|
|
||||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
|
|
||||||
]),
|
|
||||||
])->columns(1);
|
])->columns(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,6 @@ use Filament\Actions\EditAction;
|
|||||||
use Filament\Support\Enums\FontWeight;
|
use Filament\Support\Enums\FontWeight;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Support\HtmlString;
|
|
||||||
|
|
||||||
class MethodesTable
|
class MethodesTable
|
||||||
{
|
{
|
||||||
@@ -14,13 +13,15 @@ class MethodesTable
|
|||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->paginated(false)
|
->paginated(false)
|
||||||
|
->defaultSort('order', direction: 'asc')
|
||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('id'),
|
TextColumn::make('id'),
|
||||||
TextColumn::make('name')
|
TextColumn::make('name')
|
||||||
|
->color(fn($record) => $record->color)
|
||||||
->weight(FontWeight::Bold)
|
->weight(FontWeight::Bold)
|
||||||
->wrap()
|
->wrap()
|
||||||
->description(function ($record) {
|
->description(function ($record) {
|
||||||
return new HtmlString($record->description);
|
return $record->description;
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
->recordActions([
|
->recordActions([
|
||||||
|
|||||||
+11
-9
@@ -47,7 +47,7 @@ class ProjektMethodesRelationManager extends RelationManager
|
|||||||
->components([
|
->components([
|
||||||
Select::make('methode_id')
|
Select::make('methode_id')
|
||||||
->label('Methoden')
|
->label('Methoden')
|
||||||
->options(Methode::pluck('name', 'id'))
|
->options(Methode::orderBy('order')->pluck('name', 'id'))
|
||||||
->rules(['required'])
|
->rules(['required'])
|
||||||
->afterStateUpdated(function (Component $livewire) {
|
->afterStateUpdated(function (Component $livewire) {
|
||||||
$livewire->dispatch('refreshMethods');
|
$livewire->dispatch('refreshMethods');
|
||||||
@@ -56,14 +56,14 @@ class ProjektMethodesRelationManager extends RelationManager
|
|||||||
])
|
])
|
||||||
->live(),
|
->live(),
|
||||||
Select::make('aufstellung_id')
|
Select::make('aufstellung_id')
|
||||||
->visible(fn (Get $get): bool => ! in_array($get('methode_id'), [1, 5]))
|
->visible(fn(Get $get): bool => ! in_array($get('methode_id'), [1, 5]))
|
||||||
->label('Aufstellung')
|
->label('Aufstellung')
|
||||||
->options(Aufstellung::pluck('name', 'id'))
|
->options(Aufstellung::pluck('name', 'id'))
|
||||||
->afterStateUpdated(function (Component $livewire) {
|
->afterStateUpdated(function (Component $livewire) {
|
||||||
$livewire->dispatch('refreshMethods');
|
$livewire->dispatch('refreshMethods');
|
||||||
}),
|
}),
|
||||||
TextInput::make('faktor')
|
TextInput::make('faktor')
|
||||||
->visible(fn (Get $get): bool => $get('methode_id') != 1)
|
->visible(fn(Get $get): bool => $get('methode_id') != 1)
|
||||||
->suffixIcon('phosphor-function')
|
->suffixIcon('phosphor-function')
|
||||||
->numeric()
|
->numeric()
|
||||||
->label('Fläche')
|
->label('Fläche')
|
||||||
@@ -84,7 +84,9 @@ class ProjektMethodesRelationManager extends RelationManager
|
|||||||
->recordTitleAttribute('raumart')
|
->recordTitleAttribute('raumart')
|
||||||
->defaultPaginationPageOption(50)
|
->defaultPaginationPageOption(50)
|
||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('methode.name'),
|
TextColumn::make('methode.name')
|
||||||
|
->badge()
|
||||||
|
->color(fn($record) => $record->methode->color),
|
||||||
TextColumn::make('aufstellung.name'),
|
TextColumn::make('aufstellung.name'),
|
||||||
TextColumn::make('raumart')
|
TextColumn::make('raumart')
|
||||||
->searchable(),
|
->searchable(),
|
||||||
@@ -119,8 +121,8 @@ class ProjektMethodesRelationManager extends RelationManager
|
|||||||
TernaryFilter::make('faktor')
|
TernaryFilter::make('faktor')
|
||||||
->label('Faktor fehlt')
|
->label('Faktor fehlt')
|
||||||
->queries(
|
->queries(
|
||||||
true: fn (Builder $query) => $query->where('faktor', '=', 0),
|
true: fn(Builder $query) => $query->where('faktor', '=', 0),
|
||||||
false: fn (Builder $query) => $query->where('faktor', '>', 0),
|
false: fn(Builder $query) => $query->where('faktor', '>', 0),
|
||||||
),
|
),
|
||||||
|
|
||||||
], FiltersLayout::AboveContent)
|
], FiltersLayout::AboveContent)
|
||||||
@@ -142,15 +144,15 @@ class ProjektMethodesRelationManager extends RelationManager
|
|||||||
}),
|
}),
|
||||||
Action::make('methoden')
|
Action::make('methoden')
|
||||||
->icon('phosphor-question')
|
->icon('phosphor-question')
|
||||||
->modalCancelAction(fn (Action $action) => $action->label('Schließen'))
|
->modalCancelAction(fn(Action $action) => $action->label('Schließen'))
|
||||||
->modalSubmitAction(false)
|
->modalSubmitAction(false)
|
||||||
->modalHeading('Hilfe zu Methoden')
|
->modalHeading('Hilfe zu Methoden')
|
||||||
->slideOver()
|
->slideOver()
|
||||||
->modalContent(view('filament.pages.actions.methoden')),
|
->modalContent(view('filament.pages.actions.methoden')),
|
||||||
Action::make('erstellen')
|
Action::make('erstellen')
|
||||||
->action(fn (CreateProjektMethoden $createProjektMethoden) => $createProjektMethoden->create($this->ownerRecord))
|
->action(fn(CreateProjektMethoden $createProjektMethoden) => $createProjektMethoden->create($this->ownerRecord))
|
||||||
->requiresConfirmation()
|
->requiresConfirmation()
|
||||||
->hidden(fn (): bool => $this->ownerRecord->bezahlt_am ? false : true)
|
->hidden(fn(): bool => $this->ownerRecord->bezahlt_am ? false : true)
|
||||||
->modalHeading('Raum Methoden erstellen')
|
->modalHeading('Raum Methoden erstellen')
|
||||||
->modalDescription(new HtmlString('Daten werden aus der Tabelle "Objekte im Detail" generiert. Änderungen werden übernommen nicht mehr verwendete Objekte gelöscht. <br>Um die Tabelle neu zu generieren bitte die Tabelle vorher leeren.'))
|
->modalDescription(new HtmlString('Daten werden aus der Tabelle "Objekte im Detail" generiert. Änderungen werden übernommen nicht mehr verwendete Objekte gelöscht. <br>Um die Tabelle neu zu generieren bitte die Tabelle vorher leeren.'))
|
||||||
->modalSubmitActionLabel('Generieren')
|
->modalSubmitActionLabel('Generieren')
|
||||||
|
|||||||
@@ -3,31 +3,27 @@
|
|||||||
namespace App\Filament\Resources\Projektes\Widgets;
|
namespace App\Filament\Resources\Projektes\Widgets;
|
||||||
|
|
||||||
use App\Models\Methode;
|
use App\Models\Methode;
|
||||||
use Filament\Support\Enums\FontWeight;
|
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Filament\Widgets\TableWidget;
|
use Filament\Widgets\TableWidget;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\HtmlString;
|
|
||||||
|
|
||||||
class WidgetMethoden extends TableWidget
|
class WidgetMethoden extends TableWidget
|
||||||
{
|
{
|
||||||
public function table(Table $table): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->query(fn (): Builder => Methode::query())
|
->query(fn(): Builder => Methode::query()->orderBy('order'))
|
||||||
->paginated(false)
|
->paginated(false)
|
||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('methode')
|
TextColumn::make('methode')
|
||||||
->color(fn ($record) => $record->color)
|
|
||||||
->badge(),
|
|
||||||
TextColumn::make('name')
|
|
||||||
->label('')
|
->label('')
|
||||||
->weight(FontWeight::Bold)
|
->color(fn($record) => $record->color)
|
||||||
->wrap()
|
->badge(),
|
||||||
->description(function ($record) {
|
TextColumn::make('description')
|
||||||
return new HtmlString($record->description);
|
->html()
|
||||||
}),
|
->label('')
|
||||||
|
->wrap(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,11 +45,13 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
'primary' => Color::Blue,
|
'primary' => Color::Blue,
|
||||||
'success' => Color::Green,
|
'success' => Color::Green,
|
||||||
'warning' => Color::Amber,
|
'warning' => Color::Amber,
|
||||||
'info' => Color::Gray,
|
'info' => Color::Purple,
|
||||||
|
'secondary' => Color::Cyan,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
FilamentView::registerRenderHook(
|
FilamentView::registerRenderHook(
|
||||||
PanelsRenderHook::AUTH_LOGIN_FORM_BEFORE, fn (): View => view('components.login-links'),
|
PanelsRenderHook::AUTH_LOGIN_FORM_BEFORE,
|
||||||
|
fn(): View => view('components.login-links'),
|
||||||
);
|
);
|
||||||
|
|
||||||
// FilamentView::registerRenderHook(
|
// FilamentView::registerRenderHook(
|
||||||
@@ -60,8 +62,8 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
FilamentView::registerRenderHook(
|
FilamentView::registerRenderHook(
|
||||||
PanelsRenderHook::FOOTER, fn (): View => view('layouts.footer'),
|
PanelsRenderHook::FOOTER,
|
||||||
|
fn(): View => view('layouts.footer'),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ return new class extends Migration
|
|||||||
$table->string('color');
|
$table->string('color');
|
||||||
$table->string('methode');
|
$table->string('methode');
|
||||||
$table->text('description');
|
$table->text('description');
|
||||||
|
$table->integer('order')->default(0);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user