Rohstoffe: inline creation in Lieferung form, hide nav entry, remove quantity column
Deploy / deploy (push) Successful in 17s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Malek TellissiandClaude Sonnet 4.6 committed 2026-09-13 01:00:07 +02:00
1 parent a85afbc93a
commit 22fb5ed09d
2 files changed
+26 -14

No files matched your search

+8 -11
View File
@@ -21,6 +21,7 @@ class SpiceResource extends Resource
protected static ?string $slug = 'rohstoffe'; protected static ?string $slug = 'rohstoffe';
protected static ?string $navigationGroup = 'Lager'; protected static ?string $navigationGroup = 'Lager';
protected static bool $shouldRegisterNavigation = false;
protected static ?string $navigationIcon = 'heroicon-o-cube'; protected static ?string $navigationIcon = 'heroicon-o-cube';
public static function form(Form $form): Form public static function form(Form $form): Form
@@ -49,17 +50,13 @@ class SpiceResource extends Resource
->columns([ ->columns([
Tables\Columns\TextColumn::make('name') Tables\Columns\TextColumn::make('name')
->searchable(), ->searchable(),
Tables\Columns\TextColumn::make('quantity')->label('Menge lagernd') Tables\Columns\TextColumn::make('unit')
->formatStateUsing(function (Spice $record) { ->label('Einheit')
if ($record->unit == 'grams') { ->formatStateUsing(fn ($state) => match($state) {
return ($record->quantity >= 1000) ? round($record->quantity / 1000, 2) . 'kg' : $record->quantity . 'g'; 'grams' => '(Kilo-)Gramm',
}elseif($record->unit == 'pieces'){ 'pieces' => 'Stück',
return $record->quantity . ' Stück'; 'liter' => 'Liter',
}elseif($record->unit == 'liter'){ default => ucfirst($state),
return $record->quantity . ' Liter';
}else{
return $record->quantity . ' ' . ucfirst($record->unit);
}
}), }),
]) ])
->filters([ ->filters([
@@ -37,10 +37,25 @@ class SpiceSupplierResource extends Resource
->schema([ ->schema([
Select::make('spice_id') Select::make('spice_id')
->label('Rohstoff') ->label('Rohstoff')
->relationship('spice', 'name') ->relationship('spice', 'name')
->required() ->required()
->preload() ->preload()
->searchable(), ->searchable()
->createOptionForm([
TextInput::make('name')->label('Name')->required()->maxLength(255),
Forms\Components\Select::make('unit')
->label('Mengeneinheit')
->native(false)
->options([
'grams' => '(Kilo-)Gramm',
'pieces' => 'Stück',
'liter' => 'Liter',
])
->required(),
])
->createOptionUsing(function (array $data) {
return \App\Models\Spice::create($data)->id;
}),
Select::make('supplier_id') Select::make('supplier_id')
->label('Lieferant') ->label('Lieferant')
->relationship('supplier', 'name') ->relationship('supplier', 'name')