@extends('layouts.layout-2') @php $statusPill = match ($status) { 'critical' => '' . __('Kritisch') . '', 'critical_ordered' => '' . __('Kritisch · bereits bestellt') . '', 'warning' => '' . __('Bald nachbestellen') . '', default => '' . __('Ausreichend') . '', }; $stockCritical = in_array($status, ['critical', 'critical_ordered'], true); @endphp @section('content') @include('admin.inventory.partials.wawi-ui')

{{ $ingredient->name }} {!! $statusPill !!}

{{ __('Rohstoffbestellung & Bestand') }}

{{ \App\Services\Util::formatNumber($remaining, 0) }} g
{{ __('Gesamtbestand') }}
{{ $openTotal > 0 ? \App\Services\Util::formatNumber($openTotal, 0) . ' g' : '—' }}
{{ __('Offen bestellt') }}
{{ ($daily !== null && $daily > 0) ? \App\Services\Util::formatNumber($daily, 0) . ' g' : '—' }}
{{ __('Verbrauch / Tag') }}
{{ $expectedEmpty !== null ? $expectedEmpty->format('d.m.Y') : '—' }}
{{ __('Voraussichtlich auf Null') }} @if($expectedEmpty !== null) ({{ $daysUntilEmpty }} {{ trans_choice('Tag|Tagen', $daysUntilEmpty) }}) @endif
{{ __('Enthalten in') }}
@forelse($ingredient->products as $product) @empty @endforelse
{{ __('Produkt') }} {{ __('Produktbestand') }} {{ __('Rezeptur-Anteil (g/Stück)') }}
{{ $product->name }} {{ \App\Services\Util::formatNumber($productStock[$product->id] ?? 0, 0) }} {{ __('Stück') }} @if($product->pivot->gram !== null && $product->pivot->gram !== '') {{ \App\Services\Util::formatNumber($product->pivot->gram, 2) }} g @else @endif
{{ __('Dieser Rohstoff wird in keiner aktiven Rezeptur verwendet.') }}
{{ __('Lieferanten & Bestellung') }}
@forelse($ingredient->suppliers as $supplier) @php $deliveryTime = $ingredient->delivery_time ?: $supplier->delivery_time; $lastPrice = $lastPriceBySupplier[$supplier->id] ?? null; $orderUrl = $supplier->order_url ?: $supplier->url; $orderEmail = $supplier->order_email ?: $supplier->email; @endphp @empty @endforelse
{{ __('Lieferant') }} {{ __('Lieferzeit') }} {{ __('Letzter Einkauf (Netto/kg)') }}
{{ $supplier->name }} @if($supplier->pivot->preferred) {{ __('bevorzugt') }} @endif @if($supplier->pivot->supplier_sku)
{{ __('Art.-Nr.') }}: {{ $supplier->pivot->supplier_sku }}
@endif
{{ $deliveryTime ?: '—' }} @if($lastPrice !== null) {{ \App\Services\Util::formatNumber($lastPrice, 2) }} € @else @endif @if($supplier->order_method === 'online_shop' && $orderUrl) {{ __('Zum Shop') }} @elseif($orderEmail) {{ __('Per Mail') }} @elseif($orderUrl) {{ __('Zum Shop') }} @else @endif
{{ __('Diesem Rohstoff ist kein Lieferant zugeordnet.') }}
@if(Auth::user()->isAdmin()) @endif
{{ __('Offene Bestellungen / unterwegs') }}
@forelse($openOrders as $order) @empty @endforelse
{{ __('Bestellt am') }} {{ __('Lieferant') }} {{ __('Lagerort') }} {{ __('Bestellte Menge') }}
{{ $order->ordered_at?->format('d.m.Y') ?? '—' }} {{ $order->supplier?->name ?? '—' }} {{ $order->location?->name ?? '—' }} {{ \App\Services\Util::formatNumber($order->ordered_quantity, 0) }} g
{{ __('Keine offenen Bestellungen.') }}
@if($openOrders->isNotEmpty()) @endif
{{ __('Verfügbare Chargen') }}
@forelse($charges as $charge) @empty @endforelse @if($charges->isNotEmpty() && count($remainingByLocation) > 0) @foreach($locations as $location) @if(isset($remainingByLocation[$location->id]) && $remainingByLocation[$location->id] > 0) @endif @endforeach @endif
{{ __('Charge') }} {{ __('Lieferant') }} {{ __('Lagerort') }} {{ __('MHD') }} {{ __('Restbestand') }}
{{ $charge->batch_number ?: '#' . $charge->id }} {{ $charge->supplier?->name ?? '—' }} {{ $charge->location?->name ?? '—' }} {{ $charge->best_before?->format('d.m.Y') ?? '—' }} {{ \App\Services\Util::formatNumber($charge->getAttribute('remaining_quantity'), 0) }} g
{{ __('Kein Restbestand vorhanden.') }}
{{ __('Bestand') }} {{ $location->name }} {{ \App\Services\Util::formatNumber($remainingByLocation[$location->id], 0) }} g
@endsection