Warenwirtschaft: AP-21 INCI-Erweiterungen

- Lagerort-Stammdaten Raum/Regal/Fach (storage_rooms/shelves/slots) mit CRUD
  auf Einstellungen -> Allgemein (SettingCrudController-Kinder, ein gemeinsamer
  StoreStorageSegmentRequest, generische Partials setting-list-card/-segment-form)
- Ingredient: alt_name (Handelsname), Lagerort-FKs + storageLabel(),
  scopeUsedInActiveRecipes()
- INCI-Formular: Lieferanten-Repeater mit Shop-URL je Lieferant (leer = Mail),
  Alternativname, drei Lagerort-Dropdowns
- INCI-Liste: Filter "nur aktive (in Rezeptur aktiver Produkte)" + Spalte
  Alternativer Name
- Rohstoffbestand-Detail: Bestellweg pro INCI-Lieferant (Pivot-URL statt
  order_method-Fallback), Kopf zeigt Alternativname + Lagerort
- Hinweise-Doku fortgeschrieben inkl. Chargen-Format-Entscheid ttmmjj (AP-24)

Tests: StorageSettingsTest, IngredientActiveRecipeFilterTest,
IngredientOrderFieldsTest (Repeater-Format), RawMaterialStockTest erweitert
(volle Suite 170 gruen, 613 Assertions)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-06 11:36:28 +00:00
parent 8c90d95c69
commit d05df498d3
34 changed files with 1091 additions and 45 deletions

View file

@ -5,6 +5,9 @@ use App\Models\Location;
use App\Models\Product;
use App\Models\Production;
use App\Models\StockEntry;
use App\Models\StorageRoom;
use App\Models\StorageShelf;
use App\Models\StorageSlot;
use App\Models\Supplier;
use App\Services\InventoryService;
use App\User;
@ -267,3 +270,44 @@ test('detailansicht zeigt charge und lieferant', function () {
$response->assertSee('AP10-CHARGE-7');
$response->assertSee('AP10-Lieferant');
});
test('bestellweg folgt der inci-lieferanten-url', function () {
$user = ap10MakeUser(1);
$shopSupplier = Supplier::factory()->create(['name' => 'AP21-Shop', 'email' => 'shop@example.test']);
$mailSupplier = Supplier::factory()->create(['name' => 'AP21-Mail', 'email' => 'mail@example.test']);
$ing = ap10MakeIngredient('AP21-Bestellweg');
// URL gesetzt ⇒ Shop-Link (INCI-spezifisch), URL leer ⇒ Mailbestellung
$ing->suppliers()->attach($shopSupplier->id, ['url' => 'https://shop.example/zinclear?menge=25kg']);
$ing->suppliers()->attach($mailSupplier->id, ['url' => null]);
$this->actingAs($user, 'user');
$response = $this->get(route('admin.inventory.raw-material-stock.show', $ing));
$response->assertSuccessful();
$response->assertSee('https://shop.example/zinclear?menge=25kg', false);
$response->assertSee(__('Zum Shop'));
$response->assertSee(__('Per Mail'));
$response->assertSee('mailto:mail@example.test', false);
});
test('detailansicht zeigt alternativnamen und lagerort', function () {
$user = ap10MakeUser(1);
$room = StorageRoom::factory()->create(['label' => 'Raum 1']);
$shelf = StorageShelf::factory()->create(['label' => 'Regal 3']);
$slot = StorageSlot::factory()->create(['label' => 'O']);
$ing = ap10MakeIngredient('AP21-Lagerort');
$ing->update([
'alt_name' => 'Phospholipon 80 H',
'storage_room_id' => $room->id,
'storage_shelf_id' => $shelf->id,
'storage_slot_id' => $slot->id,
]);
$this->actingAs($user, 'user');
$response = $this->get(route('admin.inventory.raw-material-stock.show', $ing));
$response->assertSuccessful();
$response->assertSee('Phospholipon 80 H');
$response->assertSee('Raum 1 | Regal 3 | O');
});