- Chargen-Existenz-Check beim Buchen (JSON-Endpoint batch-check): Hinweis „Charge bereits im Haus" + Vorbelegung MHD/Qualität aus dem letzten Eingang - Rohstoffbestand-Detail: Chargen je batch_number summiert (InventoryService::chargeGroupsForIngredient), Einkäufe als Unterzeilen - Produktion: Charge-Dropdown je Charge mit Summen-Rest (batches im Recipe-Payload), Verbrauch wird per expandBatchLines FEFO auf die Einzel-Einkäufe der Charge verteilt; Service-API bleibt je stock_entry - Jeder Einkauf bleibt eigener stock_entry (Preis/Datum/Audit) - Hinweise-Doku + Plan V6.0 §6 fortgeschrieben Tests: StockEntryChargeMergeTest (7 neu); Suite 193 grün, 698 Assertions Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
32 lines
1.4 KiB
PHP
32 lines
1.4 KiB
PHP
@extends('layouts.layout-2')
|
|
|
|
@section('content')
|
|
<h4 class="font-weight-bold py-2 mb-2">{{ __('Neue Produktion') }}</h4>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<form method="post" action="{{ route('admin.inventory.productions.store') }}" id="form-production">
|
|
@csrf
|
|
@include('admin.inventory.productions._form_fields', ['isEdit' => false])
|
|
|
|
<button type="submit" class="btn btn-primary" id="btn-submit-production">{{ __('Produktion speichern') }}</button>
|
|
<a href="{{ route('admin.inventory.productions.index') }}" class="btn btn-outline-secondary">{{ __('Abbrechen') }}</a>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@section('scripts')
|
|
@php
|
|
// AP-27: Zeilen je Charge (batch_key) zusammenfassen — mehrere Einkäufe derselben Charge = eine Formularzeile.
|
|
$existingLines = $model
|
|
? $model->productionIngredients->groupBy('ingredient_id')->map(function ($lines) {
|
|
return $lines
|
|
->groupBy(fn ($l) => $l->stockEntry?->batchGroupKey() ?? 'e:'.$l->stock_entry_id)
|
|
->map(fn ($group, $key) => ['batch_key' => $key, 'quantity_used' => (float) $group->sum('quantity_used')])
|
|
->values();
|
|
})
|
|
: [];
|
|
@endphp
|
|
@include('admin.inventory.productions._scripts', ['existingLines' => $existingLines, 'excludeProductionId' => null])
|
|
@endsection
|