zuabschl wip

This commit is contained in:
salam committed 2025-10-08 12:05:35 +02:00
1 parent 79c0b14bb5
commit 1728384c4e
12 files changed
+12411 -104

No files matched your search

@@ -26,11 +26,11 @@ class ProjekteResource extends Resource
protected static ?string $recordTitleAttribute = 'interner_name';
protected static ?string $navigationLabel = 'Projekte';
protected static ?string $navigationLabel = 'Gutachten';
protected static ?string $modelLabel = 'Projekte';
protected static ?string $modelLabel = 'Gutachten';
protected static ?string $pluralModelLabel = 'Projekte';
protected static ?string $pluralModelLabel = 'Gutachten';
public static function form(Schema $schema): Schema
{
@@ -12,9 +12,11 @@ use Filament\Actions\ImportAction;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\Summarizers\Sum;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\TextInputColumn;
use Filament\Tables\Table;
use Illuminate\Support\HtmlString;
use Illuminate\Validation\Rules\File;
class AllgemeinflaechensRelationManager extends RelationManager
@@ -23,11 +25,16 @@ class AllgemeinflaechensRelationManager extends RelationManager
protected static ?string $title = 'Allgemeinflächen';
protected static ?string $navigationLabel = 'Allgemeinflächen';
protected static ?string $modelLabel = 'Allgemeinflächen';
protected static ?string $pluralModelLabel = 'Allgemeinflächen';
public function form(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('geschoss')
->required()
->maxLength(255),
@@ -35,7 +42,7 @@ class AllgemeinflaechensRelationManager extends RelationManager
->required()
->maxLength(255),
TextInput::make('flaeche')
->suffix('m²')
->suffix(new HtmlString(' m²'))
->numeric()
->label('Fläche')
->required()
@@ -46,12 +53,16 @@ class AllgemeinflaechensRelationManager extends RelationManager
public function table(Table $table): Table
{
return $table
->striped()
->recordTitleAttribute('geschoss')
->columns([
TextColumn::make('geschoss')->searchable(),
TextColumn::make('raumart')->searchable(),
TextInputColumn::make('flaeche')
->suffix('m²')
->summarize(Sum::make()->label('Gesammt')->numeric(
decimalPlaces: 2,
)->suffix(new HtmlString(' m²')))
->suffix(new HtmlString(' m²'))
->width('2rem')
->rules(['required', 'price' => 'decimal:2'])
->alignment('right')
@@ -12,11 +12,13 @@ use Filament\Actions\BulkActionGroup;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Support\Enums\FontWeight;
use Filament\Support\Enums\Width;
use Filament\Tables\Columns\CheckboxColumn;
use Filament\Tables\Columns\SelectColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\TextInputColumn;
use Filament\Tables\Filters\TernaryFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Collection;
@@ -38,12 +40,23 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
$spalten = Merkmale::map($this->ownerRecord->id);
return $table
// ->striped()
->recordTitleAttribute('top_nummer')
->columns([
TextColumn::make('top_nummer')
->searchable(),
->alignCenter()
->label('Top Nummer')
->searchable()
->extraHeaderAttributes([
'style' => 'position: sticky; left: 0; z-index: 1;',
'class' => 'bg-gray-50 dark:bg-gray-900',
])
->extraCellAttributes([
'style' => 'position: sticky; left: 0; z-index: 1;',
'class' => 'bg-gray-50 dark:bg-gray-900',
]),
CheckboxColumn::make('nicht_in_orientierung')
->label('NiO')
->label('Nicht in Orientierung')
->toggleable(),
TextInputColumn::make('raumart')
->toggleable()
@@ -68,9 +81,23 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
TextInputColumn::make('h')->label($spalten['h'] ?? '')->hidden(isset($spalten['h']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
TextInputColumn::make('i')->label($spalten['i'] ?? '')->hidden(isset($spalten['i']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
TextInputColumn::make('j')->label($spalten['j'] ?? '')->hidden(isset($spalten['j']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
TextColumn::make('nutzwert')
->extraHeaderAttributes([
'style' => 'position: sticky; right: 0; z-index: 1;',
'class' => 'bg-gray-50 dark:bg-gray-900',
])
->extraCellAttributes([
'style' => 'position: sticky; right: 0; z-index: 1;',
'class' => 'bg-gray-50 dark:bg-gray-900',
])
->alignCenter()
->default(fn ($record): ?int => round($record->a + $record->b + $record->c + $record->d + $record->e + $record->f + $record->g + $record->h + $record->i + $record->j))
->weight(FontWeight::ExtraBold),
])
->filters([
//
TernaryFilter::make('nicht_in_orientierung')
->default(0)
->label('Objekte "Nicht in Orientierung" anzeigen'),
])
->headerActions([
Action::make('merkmale')
@@ -78,8 +105,8 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
->modalCancelAction(fn (Action $action) => $action->label('Schließen'))
->modalSubmitAction(false)
->modalHeading('Merkmale')
// ->slideOver()
->modalWidth(Width::Medium)
->slideOver()
// ->modalWidth(Width::Medium)
->modalContent(view('filament.pages.actions.merkmale')),
Action::make('erstellen')
->action(fn (CreateOrientierungZuAbschlaege $createOrientierungZuAbschlaege) => $createOrientierungZuAbschlaege->create($this->ownerRecord))
@@ -129,6 +156,54 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
);
}
}),
BulkAction::make('a')
->label($spalten['a'] ?? '')
->hidden(isset($spalten['a']) ? false : true)
->schema([
TextInput::make('a')
->prefixIcon('phosphor-gear'),
])
->icon('phosphor-gear')
->action(function (Collection $records, array $data): void {
foreach ($records as $record) {
OrientierungZuAbschlaege::where('id', '=', $record->id)
->update(
['a' => $data['a']]
);
}
}),
BulkAction::make('b')
->label($spalten['b'] ?? '')
->hidden(isset($spalten['b']) ? false : true)
->schema([
TextInput::make('b')
->prefixIcon('phosphor-gear'),
])
->icon('phosphor-gear')
->action(function (Collection $records, array $data): void {
foreach ($records as $record) {
OrientierungZuAbschlaege::where('id', '=', $record->id)
->update(
['b' => $data['b']]
);
}
}),
BulkAction::make('c')
->label($spalten['c'] ?? '')
->hidden(isset($spalten['c']) ? false : true)
->schema([
TextInput::make('c')
->prefixIcon('phosphor-gear'),
])
->icon('phosphor-gear')
->action(function (Collection $records, array $data): void {
foreach ($records as $record) {
OrientierungZuAbschlaege::where('id', '=', $record->id)
->update(
['c' => $data['c']]
);
}
}),
]),
]);
}
@@ -33,6 +33,7 @@ class ProjektMethodesRelationManager extends RelationManager
public function table(Table $table): Table
{
return $table
->striped()
->recordTitleAttribute('raumart')
->columns([
SelectColumn::make('methode_id')
@@ -22,6 +22,7 @@ use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\HtmlString;
use Illuminate\Validation\Rules\File;
class RaeumeallesRelationManager extends RelationManager
@@ -49,6 +50,7 @@ class RaeumeallesRelationManager extends RelationManager
public function table(Table $table): Table
{
return $table
->striped()
->recordTitleAttribute('top_nummer')
->columns([
TextColumn::make('top_nummer')->searchable()->label('Top'),
@@ -60,8 +62,10 @@ class RaeumeallesRelationManager extends RelationManager
->rules(['required', 'faktor' => 'decimal:0,2'])
->searchable(),
TextInputColumn::make('flaeche')
->summarize(Sum::make()->label('Gesammt'))
->suffix('m²')
->summarize(Sum::make()->label('Gesammt')->numeric(
decimalPlaces: 2,
)->suffix(new HtmlString(' m²')))
->suffix(new HtmlString(' m²'))
->width('2rem')
->alignment('right')
->rules(['required', 'flaeche' => 'decimal:2'])
@@ -3,6 +3,7 @@
namespace App\Filament\Resources\Projektes\Widgets;
use App\Models\Merkmale;
use App\Models\OrientierungZuAbschlaege;
use Filament\Actions\Action;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
@@ -14,29 +15,22 @@ use Illuminate\Database\Eloquent\Builder;
class WidgetMerkmale extends TableWidget
{
// protected static ?string $title = 'Merkmale';
protected static ?string $navigationLabel = 'Merkmal';
// protected static ?string $navigationLabel = 'Merkmale';
protected static ?string $pluralModelLabel = 'Merkmale';
// protected static ?string $pluralModelLabel = 'Merkmale';
protected static ?string $modelLabel = 'Merkmal';
// protected static ?string $modelLabel = 'Merkmale';
protected static ?string $title = 'Merkmale';
protected static ?string $title = 'Merkmal';
public $projekte_id;
// public function mount(): void
// {
// dd($this->projekte_id);
// // $this->data = $this->ownerRecord;
// }
// $livewire->ownerRecord or $this->ownerRecord
public function table(Table $table): Table
{
return $table
->striped()
->query(fn (): Builder => Merkmale::where('projekte_id', $this->projekte_id))
->defaultSort('code')
->columns([
TextColumn::make('name'),
])
@@ -51,8 +45,15 @@ class WidgetMerkmale extends TableWidget
->maxLength(255),
]),
DeleteAction::make()
->modalHeading('Merkmal löschen')
->color('gray')
->iconButton(),
->iconButton()
->after(function ($record) {
OrientierungZuAbschlaege::where('projekte_id', '=', $record->projekte_id)
->update(
[$record->code => 0]
);
}),
])
->headerActions([
Action::make('name')