Allow multiple supplier/farmer entries per ingredient in batch origins
Deploy / deploy (push) Successful in 14s

Each batch origin row now shows a searchable Rohstoff Select so the same
ingredient can appear in multiple rows with different suppliers or farmers.
Pre-fill from recipe still works (one row per ingredient); user clicks
'Eintrag hinzufügen' to add a second entry for the same ingredient.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Malek TellissiandClaude Sonnet 4.6 committed 2026-09-12 19:46:17 +02:00
1 parent 2dffe6f695
commit 400237aa5b
2 files changed
+10 -19

No files matched your search

+5 -13
View File
@@ -132,20 +132,12 @@ class BatchResource extends Resource
Forms\Components\Repeater::make('origins')
->label('')
->relationship()
->afterStateHydrated(function ($component, $record) {
// Pre-fill on create only when no origins exist
if ($record?->id) {
return;
}
// State is set reactively via recipe_id afterStateUpdated
})
->schema([
Forms\Components\Hidden::make('spice_id'),
Forms\Components\Placeholder::make('spice_name')
Forms\Components\Select::make('spice_id')
->label('Rohstoff')
->content(fn (Get $get): string =>
Spice::find($get('spice_id'))?->name ?? '—'
),
->options(Spice::orderBy('name')->pluck('name', 'id'))
->searchable()
->required(),
Forms\Components\Select::make('supplier_id')
->label('Lieferant')
@@ -168,7 +160,7 @@ class BatchResource extends Resource
->columnSpanFull(),
])
->columns(2)
->addActionLabel('Rohstoff hinzufügen')
->addActionLabel('Eintrag hinzufügen')
->reorderable(false),
]),
]);
@@ -117,12 +117,11 @@ class BatchesRelationManager extends RelationManager
])->toArray());
})
->schema([
Forms\Components\Hidden::make('spice_id'),
Forms\Components\Placeholder::make('spice_name')
Forms\Components\Select::make('spice_id')
->label('Rohstoff')
->content(fn (Get $get): string =>
Spice::find($get('spice_id'))?->name ?? '—'
),
->options(Spice::orderBy('name')->pluck('name', 'id'))
->searchable()
->required(),
Forms\Components\Select::make('supplier_id')
->label('Lieferant')
@@ -145,7 +144,7 @@ class BatchesRelationManager extends RelationManager
->columnSpanFull(),
])
->columns(2)
->addActionLabel('Rohstoff hinzufügen')
->addActionLabel('Eintrag hinzufügen')
->columnSpanFull(),
]);
}