diff --git a/resources/views/admin/inventory/product-stock/index.blade.php b/resources/views/admin/inventory/product-stock/index.blade.php
index 3eb355c..001f922 100644
--- a/resources/views/admin/inventory/product-stock/index.blade.php
+++ b/resources/views/admin/inventory/product-stock/index.blade.php
@@ -127,10 +127,10 @@
-
+
+ {{-- Audit N-10: aktuellen Bestand zeigen, Minus-Buchungen bewusst bestätigen lassen. --}}
+
{{ __('Aktueller Bestand') }}: {{ __('Stück') }}
@@ -244,18 +246,32 @@
});
var moveTemplate = "{{ route('admin.inventory.product-stock.movement', ['product' => '__ID__']) }}";
+ var moveStock = 0;
$('.js-ps-move').on('click', function () {
var id = $(this).data('product');
var name = $(this).data('name');
var direction = $(this).data('direction');
+ moveStock = parseInt($(this).data('stock'), 10) || 0;
$('#ps-move-form').attr('action', moveTemplate.replace('__ID__', id));
$('#ps-move-direction').val(direction);
$('#ps-move-product').text(name);
+ $('#ps-move-stock').text(moveStock);
$('#ps-move-title').text(direction === 'in' ? '{{ __('Eingang buchen') }}' : '{{ __('Ausgang buchen') }}');
$('#ps-move-quantity').val('');
$('#ps-move-note').val('');
$('#ps-move-modal').modal('show');
});
+
+ // Audit N-10: Ausgang über Bestand => Bestätigung (Inventur-Korrekturen bleiben möglich).
+ $('#ps-move-form').on('submit', function (e) {
+ var qty = parseInt($('#ps-move-quantity').val(), 10) || 0;
+ if ($('#ps-move-direction').val() === 'out' && qty > moveStock) {
+ var after = moveStock - qty;
+ if (!confirm('{{ __('Der Ausgang übersteigt den aktuellen Bestand. Der Bestand fällt auf') }} ' + after + ' {{ __('Stück. Fortfahren?') }}')) {
+ e.preventDefault();
+ }
+ }
+ });
});
@endsection