wip
This commit is contained in:
1 parent
48deb69379
commit
e34fa82499
16 files changed
+235
-228
No files matched your search
@@ -35,7 +35,7 @@ class EditProjekte extends EditRecord
|
||||
Action::make('freischalten')
|
||||
->hidden(fn ($record): bool => $record->bezahlt_am ? true : false)
|
||||
->color('success')
|
||||
->visible(fn (): bool => Auth::user()->konto->guthaben)
|
||||
->visible(fn (): bool => (bool) Auth::user()->konto->guthaben)
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Gutachten freischalten?')
|
||||
->tooltip('Von Ihrem Guthaben wird ein Punkt abgezogen.')
|
||||
|
||||
+27
-44
@@ -6,10 +6,10 @@ use App\Actions\Create\CreateProjektMethoden;
|
||||
use App\Models\Aufstellung;
|
||||
use App\Models\Methode;
|
||||
use App\Models\ProjektMethode;
|
||||
use App\Models\ProjektObjekteImDetail;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\BulkAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
@@ -17,9 +17,7 @@ use Filament\Notifications\Notification;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\SelectColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\TextInputColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
@@ -83,31 +81,8 @@ class ProjektMethodesRelationManager extends RelationManager
|
||||
->recordTitleAttribute('raumart')
|
||||
->defaultPaginationPageOption(50)
|
||||
->columns([
|
||||
TextColumn::make('methode.name')
|
||||
->searchable(),
|
||||
TextColumn::make('aufstellung.name')
|
||||
->searchable(),
|
||||
// SelectColumn::make('methode_id')
|
||||
// ->label('Methoden')
|
||||
// ->optionsRelationship('methode', 'name')
|
||||
// ->preloadOptions()
|
||||
// ->rules(['required'])
|
||||
// ->afterStateUpdated(function (Component $livewire) {
|
||||
// $livewire->dispatch('refreshMethods');
|
||||
// })->validationMessages([
|
||||
// 'required' => 'Die Eingabe einer Methode ist erforderlich.',
|
||||
// ]),
|
||||
// SelectColumn::make('aufstellung_id')
|
||||
// ->label('Aufstellung')
|
||||
// ->optionsRelationship('aufstellung', 'name')
|
||||
// ->preloadOptions()
|
||||
// ->rules(['required'])
|
||||
// ->afterStateUpdated(function (Component $livewire) {
|
||||
// $livewire->dispatch('refreshMethods');
|
||||
// })->validationMessages([
|
||||
// 'required' => 'Die Eingabe einer Aufstellung ist erforderlich.',
|
||||
// ]),
|
||||
|
||||
TextColumn::make('methode.name'),
|
||||
TextColumn::make('aufstellung.name'),
|
||||
TextColumn::make('raumart')
|
||||
->searchable(),
|
||||
TextColumn::make('faktor')
|
||||
@@ -115,25 +90,20 @@ class ProjektMethodesRelationManager extends RelationManager
|
||||
->icon('phosphor-function')
|
||||
->searchable()
|
||||
->label('Faktor'),
|
||||
// TextInputColumn::make('faktor')
|
||||
// ->extraInputAttributes(['onClick' => 'this.select()'])
|
||||
// ->suffixIcon('phosphor-function')
|
||||
// ->width('1rem')
|
||||
// ->rules(['required', 'faktor' => 'decimal:0,2'])
|
||||
// ->searchable()
|
||||
// ->afterStateUpdated(function ($record) {
|
||||
// $objects = ProjektObjekteImDetail::where('projekte_id', $record['projekte_id'])->where('raumart', $record['raumart'])->get();
|
||||
// foreach ($objects as $value) {
|
||||
// $nutzwert = round($record['faktor'] * $value->flaeche, 2);
|
||||
// ProjektObjekteImDetail::where('id', $value->id)->update(['nutzwert' => $nutzwert]);
|
||||
// }
|
||||
// })->validationMessages([
|
||||
// 'required' => 'Die Eingabe eines Faktors ist erforderlich.',
|
||||
// 'decimal' => 'Für den Faktors sind zwei Dezimalstellen erforderlich.',
|
||||
// ]),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()
|
||||
->iconButton()
|
||||
->modalDescription(new HtmlString('Es werden auch alle damit verbundenen <b>Räume im Detail</b> gelöscht.'))
|
||||
->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshProjektObjekteImDetail');
|
||||
})->successNotification(
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Raume Methode gelöscht')
|
||||
->body('Inclusive aller damit verbundenen Räume im Detail.'),
|
||||
),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('methodes')
|
||||
@@ -150,6 +120,19 @@ class ProjektMethodesRelationManager extends RelationManager
|
||||
|
||||
])
|
||||
->headerActions([
|
||||
Action::make('Wohnnutzfläche')
|
||||
->tooltip('Setzt alle leeren Felder auf "Normale Wohnnutzfläche"')
|
||||
->icon('phosphor-arrow-bend-right-down')
|
||||
->action(function (): void {
|
||||
ProjektMethode::where('projekte_id', '=', $this->ownerRecord->id)->where('methode_id', '=', 0)->update(['methode_id' => 1]);
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshMethods');
|
||||
|
||||
Notification::make()
|
||||
->title('Alle leeren Felder wurden auf "Normale Wohnnutzfläche" gesetzt.')
|
||||
->success()
|
||||
->send();
|
||||
}),
|
||||
Action::make('methoden')
|
||||
->icon('phosphor-question')
|
||||
->modalCancelAction(fn (Action $action) => $action->label('Schließen'))
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ class ProjektObjekteImDetailRelationManager extends RelationManager
|
||||
->color('info')
|
||||
->label('Hochladen')
|
||||
->modalHeading('Objekte im Detail hochladen')
|
||||
->modalDescription(new HtmlString('<b>Objekte werden immer hinzugefügt!</b><br/>Spalten Separator:<br/>Strichpunkt ";" oder Pfeife "|"<br/>Immer vier Spalten verwenden.<br/><br/>Beispiel:<br/>"APG 01";"UG ";"Stellplatz+ ";"14,25"<br/>"APG 02";"UG ";"Stellplatz";"12,94"'))
|
||||
->modalDescription(new HtmlString('Daten fixiert auf: <b class="text-primary-500">Top, Geschoss und Raumart</b>. <br/>Bestehen diese wird die Reihe <b>aktualisiert</b>.<br/>Ansonnsten wird ein neue Reihe <b>hinzugefügt</b>!<br/><br/>Separator:<br/>Strichpunkt ";" oder Pfeife "|"<br/>Text ist <b>Vierspaltig</b>.<br/><br/>Beispiel:<br/>"APG 01";"UG ";"Stellplatz+ ";"14,25"<br/>"APG 02";"UG ";"Stellplatz";"12,94"'))
|
||||
->schema([
|
||||
Textarea::make('upload_data')
|
||||
->required()
|
||||
|
||||
+23
-2
@@ -10,6 +10,7 @@ use Filament\Actions\BulkAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Select;
|
||||
@@ -21,6 +22,8 @@ use Filament\Tables\Columns\SelectColumn;
|
||||
use Filament\Tables\Columns\Summarizers\Sum;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\TextInputColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -251,11 +254,26 @@ class ProjektObjekteRelationManager extends RelationManager
|
||||
->alignCenter(),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('orientierung_id')
|
||||
->label('Orientierung')
|
||||
->preload()
|
||||
->searchable()
|
||||
->options(function () {
|
||||
$res = ProjektObjekte::where('projekte_id', $this->ownerRecord->id)
|
||||
->where('orientierung_id', '>', 0)
|
||||
->groupBy('orientierung_id')
|
||||
->select('orientierung_id')
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
return Orientierung::whereIn('id', $res)->orderBy('id')->pluck('name', 'id');
|
||||
}),
|
||||
TernaryFilter::make('nicht_in_orientierung')
|
||||
->default(0)
|
||||
->label('Objekte "Nicht in Orientierung" anzeigen'),
|
||||
])
|
||||
->label('"Nicht in Orientierung" anzeigen'),
|
||||
], FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->filtersFormColumns(4)
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton()
|
||||
->mutateDataUsing(function (array $data): array {
|
||||
@@ -601,6 +619,9 @@ class ProjektObjekteRelationManager extends RelationManager
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
DeleteBulkAction::make()->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshProjektObjekteImDetail');
|
||||
}),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user