Warenwirtschaft: N-10 — Bestand im Bewegungs-Modal + Warnung vor Minus-Buchung
Das Modal zeigt den aktuellen Bestand; ein Ausgang über Bestand fragt per Bestätigung nach (Inventur-Korrekturen bleiben möglich, Tippfehler werden abgefangen). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
016e8bbbd8
commit
6af6760ffc
1 changed files with 19 additions and 3 deletions
|
|
@ -127,10 +127,10 @@
|
|||
<div class="wawi-actions">
|
||||
@if (Auth::user()->isAdmin())
|
||||
<button type="button" class="btn icon-btn btn-sm btn-success js-ps-move"
|
||||
data-product="{{ $product->id }}" data-name="{{ $product->name }}" data-direction="in"
|
||||
data-product="{{ $product->id }}" data-name="{{ $product->name }}" data-stock="{{ (int) $row['stock'] }}" data-direction="in"
|
||||
title="{{ __('Eingang buchen') }}"><span class="fas fa-plus"></span></button>
|
||||
<button type="button" class="btn icon-btn btn-sm btn-outline-danger js-ps-move"
|
||||
data-product="{{ $product->id }}" data-name="{{ $product->name }}" data-direction="out"
|
||||
data-product="{{ $product->id }}" data-name="{{ $product->name }}" data-stock="{{ (int) $row['stock'] }}" data-direction="out"
|
||||
title="{{ __('Ausgang buchen') }}"><span class="fas fa-minus"></span></button>
|
||||
<a href="{{ route('admin.inventory.productions.create', ['product_id' => $product->id]) }}"
|
||||
class="btn btn-sm btn-outline-secondary">
|
||||
|
|
@ -167,7 +167,9 @@
|
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="text-muted mb-3" id="ps-move-product"></p>
|
||||
<p class="text-muted mb-1" id="ps-move-product"></p>
|
||||
{{-- Audit N-10: aktuellen Bestand zeigen, Minus-Buchungen bewusst bestätigen lassen. --}}
|
||||
<p class="small mb-3">{{ __('Aktueller Bestand') }}: <strong id="ps-move-stock"></strong> {{ __('Stück') }}</p>
|
||||
<div class="form-group">
|
||||
<label for="ps-move-quantity">{{ __('Stückzahl') }} <span class="text-danger">*</span></label>
|
||||
<input type="number" min="1" step="1" name="quantity" id="ps-move-quantity" class="form-control" required>
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue