Warenwirtschaft: AP-09 bis AP-13 (Produktbestand, Set-Produkte, Ausschuss, Konzepte)
- AP-09 Produktbestand inkl. Bewegungshistorie (product_stock_movements, ProductStockService) - AP-10 Rohstoffbestand-Ansicht je Lager (RawMaterialStockController) - AP-11 Bestandsschwellen / Out-of-Stock-Handling fuer Produkte und Shop - AP-12 Ausgang/Ausschuss (stock_disposals, StockDisposalController, InventoryService) - Set-Produkte (product_set_items) inkl. Aufloesung - Produktentwicklung & Hinweise-Verwaltung (Notices) - AP-13 Entwicklungskonzept Shop-Bestandsabzug im Plan dokumentiert - Feature-Tests fuer neue Module + aktualisierter Entwicklungsplan Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
78679e0c55
commit
3ee2d756e9
63 changed files with 5968 additions and 901 deletions
|
|
@ -0,0 +1,156 @@
|
|||
@extends('layouts.layout-2')
|
||||
|
||||
@section('content')
|
||||
@include('admin.inventory.partials.table-actions-style')
|
||||
<style>
|
||||
#rms-table tbody tr.rms-row {
|
||||
cursor: pointer;
|
||||
}
|
||||
#rms-table tbody tr.rms-row:hover {
|
||||
background-color: rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
#rms-table tbody tr.rms-row:hover .fa-edit {
|
||||
color: #26b4ff !important;
|
||||
}
|
||||
</style>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="d-flex flex-wrap justify-content-between align-items-center">
|
||||
<h6 class="mb-0">{{ __('Rohstoffbestand') }}</h6>
|
||||
<label class="form-check d-inline-flex align-items-center mb-0">
|
||||
<input type="checkbox" id="rms-only-critical" class="form-check-input mr-2">
|
||||
<span>{{ __('nur kritische anzeigen') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group row mt-3 mb-0 align-items-center">
|
||||
<label for="rms-search" class="col-sm-1 col-form-label">{{ __('Suchen') }}</label>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" id="rms-search" class="form-control" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-datatable table-responsive">
|
||||
<table class="table table-striped wawi-table mb-0" id="rms-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('Name') }}</th>
|
||||
<th>{{ __('Qualität') }}</th>
|
||||
<th class="text-right">{{ __('Bestand') }}</th>
|
||||
<th class="text-right">{{ __('Offen bestellt') }}</th>
|
||||
<th class="text-right">{{ __('Verbrauch / Tag') }}</th>
|
||||
<th>{{ __('Voraussichtlich auf Null') }}</th>
|
||||
<th class="text-right" style="min-width: 13rem;">
|
||||
<select id="rms-horizon" class="form-control form-control-sm">
|
||||
@foreach($horizonOptions as $days => $label)
|
||||
<option value="{{ $days }}" @selected($days === $defaultHorizon)>{{ $label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($rows as $row)
|
||||
@php
|
||||
$ingredient = $row['ingredient'];
|
||||
$rowClass = $row['status'] === 'critical'
|
||||
? 'table-danger'
|
||||
: (in_array($row['status'], ['warning', 'critical_ordered'], true) ? 'table-warning' : '');
|
||||
@endphp
|
||||
<tr class="rms-row {{ $rowClass }}"
|
||||
data-name="{{ Str::lower($ingredient->name) }} {{ Str::lower($ingredient->inci ?? '') }}"
|
||||
data-status="{{ $row['status'] }}"
|
||||
data-href="{{ route('admin.inventory.raw-material-stock.show', $ingredient) }}">
|
||||
<td>
|
||||
<i class="far fa-edit text-muted mr-2" title="{{ __('Bestellung öffnen') }}"></i>
|
||||
{{ $ingredient->name }}
|
||||
</td>
|
||||
<td class="text-muted">{{ $ingredient->materialQuality?->name ?? '—' }}</td>
|
||||
<td class="text-right {{ in_array($row['status'], ['critical', 'critical_ordered'], true) ? 'text-danger font-weight-bold' : '' }}">
|
||||
{{ \App\Services\Util::formatNumber($row['remaining'], 0) }} g
|
||||
@if($row['status'] === 'critical_ordered')
|
||||
<span class="badge badge-info ml-1">{{ __('bestellt') }}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-right">
|
||||
@if($row['open_order'] > 0)
|
||||
{{ \App\Services\Util::formatNumber($row['open_order'], 0) }} g
|
||||
@else
|
||||
<span class="text-muted">—</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-right">
|
||||
@if($row['daily'] !== null && $row['daily'] > 0)
|
||||
{{ \App\Services\Util::formatNumber($row['daily'], 0) }} g
|
||||
@else
|
||||
<span class="text-muted">—</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($row['expected_empty'] !== null)
|
||||
{{ $row['expected_empty']->format('d.m.Y') }}
|
||||
<span class="text-muted">({{ $row['days_until_empty'] }} {{ trans_choice('Tag|Tagen', $row['days_until_empty']) }})</span>
|
||||
@else
|
||||
<span class="text-muted">—</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-right rms-forecast" data-daily="{{ $row['daily'] !== null ? $row['daily'] : 0 }}">
|
||||
@if($row['daily'] !== null && $row['daily'] > 0)
|
||||
{{ \App\Services\Util::formatNumber($row['daily'] * $defaultHorizon, 0) }} g
|
||||
@else
|
||||
<span class="text-muted">—</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="7" class="text-center text-muted py-4">{{ __('Keine aktiven Rohstoffe vorhanden.') }}</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
var $rows = $('#rms-table tbody tr.rms-row');
|
||||
|
||||
function applyFilter() {
|
||||
var term = ($('#rms-search').val() || '').toLowerCase().trim();
|
||||
var onlyCritical = $('#rms-only-critical').is(':checked');
|
||||
|
||||
$rows.each(function () {
|
||||
var $row = $(this);
|
||||
var matchesTerm = term === '' || ($row.data('name') || '').toString().indexOf(term) !== -1;
|
||||
var status = $row.data('status');
|
||||
var matchesCritical = !onlyCritical || (status === 'critical' || status === 'warning');
|
||||
$row.toggle(matchesTerm && matchesCritical);
|
||||
});
|
||||
}
|
||||
|
||||
function applyForecast() {
|
||||
var days = parseInt($('#rms-horizon').val(), 10) || 0;
|
||||
$('.rms-forecast').each(function () {
|
||||
var daily = parseFloat($(this).data('daily')) || 0;
|
||||
if (daily > 0) {
|
||||
var total = Math.round(daily * days);
|
||||
$(this).text(total.toLocaleString('de-DE') + ' g');
|
||||
} else {
|
||||
$(this).html('<span class="text-muted">—</span>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#rms-search').on('keyup', applyFilter);
|
||||
$('#rms-only-critical').on('change', applyFilter);
|
||||
$('#rms-horizon').on('change', applyForecast);
|
||||
|
||||
$rows.on('click', function () {
|
||||
var href = $(this).data('href');
|
||||
if (href) {
|
||||
window.location = href;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,256 @@
|
|||
@extends('layouts.layout-2')
|
||||
|
||||
@section('content')
|
||||
@include('admin.inventory.partials.table-actions-style')
|
||||
|
||||
@php
|
||||
$statusBadge = match ($status) {
|
||||
'critical' => '<span class="badge badge-danger">' . __('Kritisch') . '</span>',
|
||||
'critical_ordered' => '<span class="badge badge-warning">' . __('Kritisch · bereits bestellt') . '</span>',
|
||||
'warning' => '<span class="badge badge-warning">' . __('Bald nachbestellen') . '</span>',
|
||||
default => '<span class="badge badge-success">' . __('Ausreichend') . '</span>',
|
||||
};
|
||||
@endphp
|
||||
|
||||
<div class="card mb-3">
|
||||
<h6 class="card-header d-flex justify-content-between align-items-center">
|
||||
<span>{{ __('Rohstoffbestellung') }}: {{ $ingredient->name }} {!! $statusBadge !!}</span>
|
||||
<a href="{{ route('admin.inventory.raw-material-stock.index') }}" class="btn btn-sm btn-outline-secondary">{{ __('Zurück') }}</a>
|
||||
</h6>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-6 mb-2">
|
||||
<div class="text-muted small">{{ __('Qualität') }}</div>
|
||||
<div>{{ $ingredient->materialQuality?->name ?? '—' }}</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-6 mb-2">
|
||||
<div class="text-muted small">{{ __('Gesamtbestand') }}</div>
|
||||
<div class="{{ in_array($status, ['critical', 'critical_ordered'], true) ? 'text-danger font-weight-bold' : 'font-weight-bold' }}">
|
||||
{{ \App\Services\Util::formatNumber($remaining, 0) }} g
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-6 mb-2">
|
||||
<div class="text-muted small">{{ __('Offen bestellt') }}</div>
|
||||
<div>
|
||||
@if($openTotal > 0)
|
||||
{{ \App\Services\Util::formatNumber($openTotal, 0) }} g
|
||||
@else
|
||||
—
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-6 mb-2">
|
||||
<div class="text-muted small">{{ __('Verbrauch / Tag') }}</div>
|
||||
<div>
|
||||
@if($daily !== null && $daily > 0)
|
||||
{{ \App\Services\Util::formatNumber($daily, 0) }} g
|
||||
@else
|
||||
—
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-6 mb-2">
|
||||
<div class="text-muted small">{{ __('Voraussichtlich auf Null') }}</div>
|
||||
<div>
|
||||
@if($expectedEmpty !== null)
|
||||
{{ $expectedEmpty->format('d.m.Y') }}
|
||||
<span class="text-muted">({{ $daysUntilEmpty }} {{ trans_choice('Tag|Tagen', $daysUntilEmpty) }})</span>
|
||||
@else
|
||||
—
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if($ingredient->min_stock_alert !== null)
|
||||
<div class="text-muted small mt-2">
|
||||
{{ __('Meldebestand') }}: {{ \App\Services\Util::formatNumber($ingredient->min_stock_alert, 0) }} g
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mb-3">
|
||||
<h6 class="card-header">{{ __('Enthalten in') }}</h6>
|
||||
<div class="card-datatable table-responsive">
|
||||
<table class="table table-striped wawi-table mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('Produkt') }}</th>
|
||||
<th class="text-right">{{ __('Produktbestand') }}</th>
|
||||
<th class="text-right">{{ __('Rezeptur-Anteil (g/Stück)') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($ingredient->products as $product)
|
||||
<tr>
|
||||
<td>{{ $product->name }}</td>
|
||||
<td class="text-right">{{ \App\Services\Util::formatNumber($productStock[$product->id] ?? 0, 0) }} {{ __('Stück') }}</td>
|
||||
<td class="text-right">
|
||||
@if($product->pivot->gram !== null && $product->pivot->gram !== '')
|
||||
{{ \App\Services\Util::formatNumber($product->pivot->gram, 2) }} g
|
||||
@else
|
||||
<span class="text-muted">—</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="3" class="text-center text-muted py-3">{{ __('Dieser Rohstoff wird in keiner aktiven Rezeptur verwendet.') }}</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mb-3">
|
||||
<h6 class="card-header">{{ __('Lieferanten & Bestellung') }}</h6>
|
||||
<div class="card-datatable table-responsive">
|
||||
<table class="table table-striped wawi-table mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('Lieferant') }}</th>
|
||||
<th>{{ __('Lieferzeit') }}</th>
|
||||
<th class="text-right">{{ __('Letzter Einkauf (Netto/kg)') }}</th>
|
||||
<th class="text-right" style="width: 11rem;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@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
|
||||
<tr>
|
||||
<td>
|
||||
{{ $supplier->name }}
|
||||
@if($supplier->pivot->preferred)
|
||||
<span class="badge badge-success ml-1">{{ __('bevorzugt') }}</span>
|
||||
@endif
|
||||
@if($supplier->pivot->supplier_sku)
|
||||
<div class="text-muted small">{{ __('Art.-Nr.') }}: {{ $supplier->pivot->supplier_sku }}</div>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $deliveryTime ?: '—' }}</td>
|
||||
<td class="text-right">
|
||||
@if($lastPrice !== null)
|
||||
{{ \App\Services\Util::formatNumber($lastPrice, 2) }} €
|
||||
@else
|
||||
<span class="text-muted">—</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-right">
|
||||
@if($supplier->order_method === 'online_shop' && $orderUrl)
|
||||
<a href="{{ $orderUrl }}" target="_blank" rel="noopener" class="btn btn-sm btn-dark">{{ __('Zum Shop') }}</a>
|
||||
@elseif($orderEmail)
|
||||
<a href="mailto:{{ $orderEmail }}?subject={{ rawurlencode(__('Bestellung') . ': ' . $ingredient->name) }}" class="btn btn-sm btn-dark">{{ __('Per Mail') }}</a>
|
||||
@elseif($orderUrl)
|
||||
<a href="{{ $orderUrl }}" target="_blank" rel="noopener" class="btn btn-sm btn-dark">{{ __('Zum Shop') }}</a>
|
||||
@else
|
||||
<span class="text-muted">—</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="4" class="text-center text-muted py-3">{{ __('Diesem Rohstoff ist kein Lieferant zugeordnet.') }}</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@if(Auth::user()->isAdmin())
|
||||
<div class="card-footer">
|
||||
<a href="{{ route('admin.inventory.stock-entries.create', ['ingredient_id' => $ingredient->id]) }}" class="btn btn-sm btn-primary">{{ __('Einkauf erfassen') }}</a>
|
||||
<a href="{{ route('admin.inventory.stock-disposals.create', ['ingredient_id' => $ingredient->id]) }}" class="btn btn-sm btn-outline-danger">{{ __('Ausschuss erfassen') }}</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="card mb-3">
|
||||
<h6 class="card-header">{{ __('Offene Bestellungen / unterwegs') }}</h6>
|
||||
<div class="card-datatable table-responsive">
|
||||
<table class="table table-striped wawi-table mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('Bestellt am') }}</th>
|
||||
<th>{{ __('Lieferant') }}</th>
|
||||
<th>{{ __('Lagerort') }}</th>
|
||||
<th class="text-right">{{ __('Bestellte Menge') }}</th>
|
||||
<th class="text-right" style="width: 8rem;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($openOrders as $order)
|
||||
<tr>
|
||||
<td>{{ $order->ordered_at?->format('d.m.Y') ?? '—' }}</td>
|
||||
<td>{{ $order->supplier?->name ?? '—' }}</td>
|
||||
<td>{{ $order->location?->name ?? '—' }}</td>
|
||||
<td class="text-right">{{ \App\Services\Util::formatNumber($order->ordered_quantity, 0) }} g</td>
|
||||
<td class="text-right">
|
||||
<a href="{{ route('admin.inventory.stock-entries.show', $order) }}" class="btn icon-btn btn-sm btn-primary" title="{{ __('Wareneingang buchen') }}">
|
||||
<span class="far fa-eye"></span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="5" class="text-center text-muted py-3">{{ __('Keine offenen Bestellungen.') }}</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@if($openOrders->isNotEmpty())
|
||||
<div class="card-footer text-muted small">
|
||||
{{ __('Offene Bestellungen zählen erst nach gebuchtem Wareneingang zum Bestand.') }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="card mb-3">
|
||||
<h6 class="card-header">{{ __('Verfügbare Chargen') }}</h6>
|
||||
<div class="card-datatable table-responsive">
|
||||
<table class="table table-striped wawi-table mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('Charge') }}</th>
|
||||
<th>{{ __('Lieferant') }}</th>
|
||||
<th>{{ __('Lagerort') }}</th>
|
||||
<th>{{ __('MHD') }}</th>
|
||||
<th class="text-right">{{ __('Restbestand') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($charges as $charge)
|
||||
<tr>
|
||||
<td>{{ $charge->batch_number ?: '#' . $charge->id }}</td>
|
||||
<td>{{ $charge->supplier?->name ?? '—' }}</td>
|
||||
<td>{{ $charge->location?->name ?? '—' }}</td>
|
||||
<td>{{ $charge->best_before?->format('d.m.Y') ?? '—' }}</td>
|
||||
<td class="text-right">{{ \App\Services\Util::formatNumber($charge->getAttribute('remaining_quantity'), 0) }} g</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="5" class="text-center text-muted py-3">{{ __('Kein Restbestand vorhanden.') }}</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
@if($charges->isNotEmpty() && count($remainingByLocation) > 0)
|
||||
<tfoot>
|
||||
@foreach($locations as $location)
|
||||
@if(isset($remainingByLocation[$location->id]) && $remainingByLocation[$location->id] > 0)
|
||||
<tr>
|
||||
<td colspan="4" class="text-right text-muted">{{ __('Bestand') }} {{ $location->name }}</td>
|
||||
<td class="text-right">{{ \App\Services\Util::formatNumber($remainingByLocation[$location->id], 0) }} g</td>
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
</tfoot>
|
||||
@endif
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Loading…
Add table
Add a link
Reference in a new issue