Warenwirtschaft: Review-Fix — Hinweis auf kritische Rohstoffe außerhalb der Rezepturen
Der Default-Scope 'recipe' blendet rezepturlose Rohstoffe aus, das Sidebar-Badge zählt aber alle aktiven kritischen — Badge und Seite konnten sich widersprechen. Die recipe-Ansicht zeigt jetzt einen Hinweis mit 'Alle anzeigen', sobald das Badge mehr zählt; Empty-State-Text scope-abhängig. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
80d0687f95
commit
f4256bfc89
5 changed files with 65 additions and 2 deletions
|
|
@ -321,6 +321,38 @@ test('modus recipe zeigt nur rohstoffe aus herstellerrezepturen aktiver produkte
|
|||
->assertSee('AP20-Neuentwicklung');
|
||||
});
|
||||
|
||||
test('recipe-scope weist auf kritische rohstoffe ausserhalb der rezepturen hin', function () {
|
||||
// Review 20.07.2026: Badge zählt alle aktiven kritischen Rohstoffe, die
|
||||
// Standardansicht blendet rezepturlose aus — der Hinweis schließt die Lücke.
|
||||
$user = ap10MakeUser(1);
|
||||
$inRecipe = ap10MakeIngredient('AP20-InRezeptur', 500);
|
||||
// rezepturloser Rohstoff mit Meldebestand, aber ohne Bestand => kritisch
|
||||
ap10MakeIngredient('AP20-Neuentwicklung', 500);
|
||||
|
||||
$product = Product::query()->create(['name' => 'AP20-Produkt', 'title' => 'AP20-Produkt', 'active' => true]);
|
||||
ProductIngredient::query()->create([
|
||||
'product_id' => $product->id,
|
||||
'ingredient_id' => $inRecipe->id,
|
||||
'pos' => 0,
|
||||
'gram' => 10,
|
||||
'factor' => 1.0,
|
||||
'recipe_type' => 'manufacturer',
|
||||
]);
|
||||
|
||||
$this->actingAs($user, 'user');
|
||||
|
||||
// Badge zählt beide, die recipe-Ansicht nur einen => Hinweis auf den versteckten
|
||||
expect(app(InventoryService::class)->criticalIngredientCount())->toBe(2);
|
||||
$this->get(route('admin.inventory.raw-material-stock.index'))
|
||||
->assertSuccessful()
|
||||
->assertSee('außerhalb der Herstellerrezepturen');
|
||||
|
||||
// Im „alle"-Modus kein Hinweis (alles sichtbar)
|
||||
$this->get(route('admin.inventory.raw-material-stock.index', ['scope' => 'all']))
|
||||
->assertSuccessful()
|
||||
->assertDontSee('außerhalb der Herstellerrezepturen');
|
||||
});
|
||||
|
||||
test('letzter netto-preis je lieferant kommt aus dem neuesten einkauf', function () {
|
||||
$user = ap10MakeUser();
|
||||
$location = Location::factory()->create();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue