Beistrich bei Eingabe statt Punkt
This commit is contained in:
1 parent
096c8cf091
commit
ddbf171881
15 files changed
+407
-305
No files matched your search
+7
-12
@@ -12,7 +12,6 @@ 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 Livewire\Component;
|
||||
@@ -60,24 +59,20 @@ class ProjektAllgemeinflaechensRelationManager extends RelationManager
|
||||
->columns([
|
||||
TextColumn::make('geschoss')->searchable(),
|
||||
TextColumn::make('raumart')->searchable(),
|
||||
TextInputColumn::make('flaeche')
|
||||
->extraInputAttributes(['onClick' => 'this.select()'])
|
||||
TextColumn::make('flaeche')
|
||||
->numeric(
|
||||
decimalPlaces: 2,
|
||||
decimalSeparator: ',',
|
||||
thousandsSeparator: '.'
|
||||
)
|
||||
->summarize(Sum::make()->label('Gesammt')->numeric(
|
||||
decimalPlaces: 2,
|
||||
)->suffix(new HtmlString(' m²')))
|
||||
->suffix(new HtmlString(' m²'))
|
||||
->width('2rem')
|
||||
->rules(['required', 'flaeche' => 'decimal:2'])
|
||||
->alignment('right')
|
||||
->label('Fläche')
|
||||
->searchable()
|
||||
->validationMessages([
|
||||
'required' => 'Die Eingabe einer Fläche ist erforderlich.',
|
||||
'decimal' => 'Für die Fläche sind zwei Dezimalstellen erforderlich.',
|
||||
])
|
||||
->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshProjektAllgemeinflaechen');
|
||||
}),
|
||||
->searchable(),
|
||||
])
|
||||
->headerActions([
|
||||
CreateAction::make()
|
||||
|
||||
+73
-29
@@ -10,10 +10,12 @@ use App\Models\ProjektObjekteImDetail;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\BulkAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\SelectColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\TextInputColumn;
|
||||
@@ -37,51 +39,93 @@ class ProjektMethodesRelationManager extends RelationManager
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Raum Methoden';
|
||||
|
||||
public function table(Table $table): Table
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->recordTitleAttribute('raumart')
|
||||
->columns([
|
||||
SelectColumn::make('methode_id')
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('methode_id')
|
||||
->label('Methoden')
|
||||
->optionsRelationship('methode', 'name')
|
||||
->preloadOptions()
|
||||
->options(Methode::pluck('name', 'id'))
|
||||
->rules(['required'])
|
||||
->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshMethods');
|
||||
})->validationMessages([
|
||||
'required' => 'Die Eingabe einer Methode ist erforderlich.',
|
||||
]),
|
||||
SelectColumn::make('aufstellung_id')
|
||||
Select::make('aufstellung_id')
|
||||
->label('Aufstellung')
|
||||
->optionsRelationship('aufstellung', 'name')
|
||||
->preloadOptions()
|
||||
->rules(['required'])
|
||||
->options(Aufstellung::pluck('name', 'id'))
|
||||
->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshMethods');
|
||||
})->validationMessages([
|
||||
'required' => 'Die Eingabe einer Aufstellung ist erforderlich.',
|
||||
}),
|
||||
TextInput::make('faktor')
|
||||
->suffixIcon('phosphor-function')
|
||||
->numeric()
|
||||
->label('Fläche')
|
||||
->rules(['required'])
|
||||
->validationMessages([
|
||||
'required' => 'Die Eingabe einer Fläche ist erforderlich.',
|
||||
]),
|
||||
])->columns(3);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->recordTitleAttribute('raumart')
|
||||
->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('raumart')
|
||||
->searchable(),
|
||||
TextInputColumn::make('faktor')
|
||||
->extraInputAttributes(['onClick' => 'this.select()'])
|
||||
->suffixIcon('phosphor-function')
|
||||
->width('1rem')
|
||||
->rules(['required', 'faktor' => 'decimal:0,2'])
|
||||
TextColumn::make('faktor')
|
||||
->numeric(2, ',')
|
||||
->icon('phosphor-function')
|
||||
->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.',
|
||||
]),
|
||||
->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(),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('methodes')
|
||||
|
||||
+26
-14
@@ -52,8 +52,9 @@ class ProjektObjekteImDetailRelationManager extends RelationManager
|
||||
->suffixIcon('phosphor-building'),
|
||||
TextInput::make('flaeche')
|
||||
->suffix(new HtmlString(' m²'))
|
||||
->rules(['required'])
|
||||
->numeric()
|
||||
->label('Fläche')
|
||||
->rules(['required', 'flaeche' => 'decimal:2'])
|
||||
->validationMessages([
|
||||
'required' => 'Die Eingabe einer Fläche ist erforderlich.',
|
||||
'decimal' => 'Für die Fläche sind zwei Dezimalstellen erforderlich.',
|
||||
@@ -79,31 +80,42 @@ class ProjektObjekteImDetailRelationManager extends RelationManager
|
||||
TextColumn::make('geschoss')->searchable(),
|
||||
TextColumn::make('raumart')->searchable()->sortable(),
|
||||
TextColumn::make('methode.faktor')
|
||||
->numeric(2, ',')
|
||||
->icon('phosphor-function')
|
||||
->searchable()
|
||||
->label('Faktor'),
|
||||
TextInputColumn::make('flaeche')
|
||||
->extraInputAttributes(['onClick' => 'this.select()'])
|
||||
TextColumn::make('flaeche')
|
||||
->numeric(2, ',', '.')
|
||||
->summarize(Sum::make()->label('Gesammt')->numeric(
|
||||
decimalPlaces: 2,
|
||||
)->suffix(new HtmlString(' m²')))
|
||||
->suffix(new HtmlString(' m²'))
|
||||
->width('2rem')
|
||||
->alignment('right')
|
||||
->rules(['required'])
|
||||
->label('Fläche')
|
||||
->searchable()
|
||||
->afterStateUpdated(function ($record, Component $livewire) {
|
||||
$object = ProjektObjekteImDetail::find($record['id']);
|
||||
$object->nutzwert = round($record->methode->faktor * $object->flaeche, 2);
|
||||
$object->save();
|
||||
->searchable(),
|
||||
// TextInputColumn::make('flaeche')
|
||||
// ->extraInputAttributes(['onClick' => 'this.select()'])
|
||||
// ->summarize(Sum::make()->label('Gesammt')->numeric(
|
||||
// decimalPlaces: 2,
|
||||
// )->suffix(new HtmlString(' m²')))
|
||||
// ->suffix(new HtmlString(' m²'))
|
||||
// ->width('2rem')
|
||||
// ->alignment('right')
|
||||
// ->rules(['required'])
|
||||
// ->label('Fläche')
|
||||
// ->searchable()
|
||||
// ->afterStateUpdated(function ($record, Component $livewire) {
|
||||
// $object = ProjektObjekteImDetail::find($record['id']);
|
||||
// $object->nutzwert = round($record->methode->faktor * $object->flaeche, 2);
|
||||
// $object->save();
|
||||
|
||||
$livewire->dispatch('refreshProjektObjekteImDetail');
|
||||
// $livewire->dispatch('refreshProjektObjekteImDetail');
|
||||
|
||||
})->validationMessages([
|
||||
'required' => 'Die Eingabe einer Fläche ist erforderlich.',
|
||||
'decimal' => 'Für die Fläche sind zwei Dezimalstellen erforderlich.',
|
||||
]),
|
||||
// })->validationMessages([
|
||||
// 'required' => 'Die Eingabe einer Fläche ist erforderlich.',
|
||||
// 'decimal' => 'Für die Fläche sind zwei Dezimalstellen erforderlich.',
|
||||
// ]),
|
||||
TextColumn::make('nutzwert')
|
||||
->alignCenter()
|
||||
->summarize(Sum::make()->label('Gesammt'))
|
||||
|
||||
@@ -216,6 +216,7 @@ class ProjektObjekteRelationManager extends RelationManager
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextColumn::make('nutzwert')
|
||||
->numeric(2, ',', '.')
|
||||
->extraHeaderAttributes([
|
||||
'style' => 'position: sticky; right: 0; z-index: 1;',
|
||||
'class' => 'bg-gray-50 dark:bg-gray-900 border-x border-gray-200 dark:border-gray-800',
|
||||
|
||||
Reference in new issue
Block a user