Rohstoffe: inline creation in Lieferung form, hide nav entry, remove quantity column
Deploy / deploy (push) Successful in 17s
Deploy / deploy (push) Successful in 17s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
a85afbc93a
commit
22fb5ed09d
2 files changed
+26
-14
No files matched your search
@@ -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([
|
||||
|
||||
Reference in new issue
Block a user