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
+24 -12

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 $navigationGroup = 'Lager';
protected static bool $shouldRegisterNavigation = false;
protected static ?string $navigationIcon = 'heroicon-o-cube';
public static function form(Form $form): Form
@@ -49,17 +50,13 @@ class SpiceResource extends Resource
->columns([
Tables\Columns\TextColumn::make('name')
->searchable(),
Tables\Columns\TextColumn::make('quantity')->label('Menge lagernd')
->formatStateUsing(function (Spice $record) {
if ($record->unit == 'grams') {
return ($record->quantity >= 1000) ? round($record->quantity / 1000, 2) . 'kg' : $record->quantity . 'g';
}elseif($record->unit == 'pieces'){
return $record->quantity . ' Stück';
}elseif($record->unit == 'liter'){
return $record->quantity . ' Liter';
}else{
return $record->quantity . ' ' . ucfirst($record->unit);
}
Tables\Columns\TextColumn::make('unit')
->label('Einheit')
->formatStateUsing(fn ($state) => match($state) {
'grams' => '(Kilo-)Gramm',
'pieces' => 'Stück',
'liter' => 'Liter',
default => ucfirst($state),
}),
])
->filters([
@@ -40,7 +40,22 @@ class SpiceSupplierResource extends Resource
->relationship('spice', 'name')
->required()
->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')
->label('Lieferant')
->relationship('supplier', 'name')