Warenwirtschaft: AP-33b Sammel-Dokumente — Lieferscheine/Rechnungen der Auswahl als ein PDF

Checkbox-Auswahl im Abwicklungs-Board (Alle-auswählen, Zähler in den Buttons)
+ zwei Sammel-Aktionen: „Lieferscheine drucken" und „+ Rechnungen" — je ein
zusammengeführtes PDF (PDFMerger/FPDI) im neuen Tab zum Stapeldruck. Fehlende
Dokumente werden dabei ohne Mailversand erzeugt, auf der Platte fehlende
Altdateien mit bestehender Nummer regeneriert. API-Bestellungen sind von der
Auswahl ausgenommen (deaktivierte Checkbox, Rechnung liegt im externen Shop)
und werden in gemischter Auswahl übersprungen; max. 100 je Druck.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-16 12:00:10 +00:00
parent c21cc63428
commit 1252c30820
4 changed files with 159 additions and 3 deletions

View file

@ -87,7 +87,7 @@
<div class="wawi-card">
<div class="wawi-toolbar">
<div class="d-flex align-items-center" style="gap:.75rem;">
<div class="d-flex align-items-center flex-wrap" style="gap:.75rem;">
@if ($filter !== '')
<a href="{{ route('admin.inventory.orders.index') }}" class="btn btn-sm btn-outline-secondary">
<span class="fas fa-times mr-1"></span>{{ __('Filter zurücksetzen') }}
@ -95,12 +95,25 @@
@endif
<input type="search" id="of-search" class="form-control form-control-sm" style="width:240px"
placeholder="{{ __('Suche Bestellnr. / Kunde …') }}">
{{-- AP-33b: Sammel-Druck der ausgewählten Bestellungen (öffnet ein PDF im neuen Tab) --}}
<form id="of-batch-form" method="post" action="{{ route('admin.inventory.orders.documents.batch') }}" target="_blank" class="mb-0 d-flex align-items-center" style="gap:.5rem;">
@csrf
<button type="submit" name="type" value="delivery" class="btn btn-sm btn-outline-secondary js-of-batch" disabled
title="{{ __('Lieferscheine der Auswahl als ein PDF (fehlende Dokumente werden erstellt)') }}">
<span class="fas fa-dolly mr-1"></span>{{ __('Lieferscheine drucken') }} (<span class="of-batch-count">0</span>)
</button>
<button type="submit" name="type" value="combined" class="btn btn-sm btn-outline-secondary js-of-batch" disabled
title="{{ __('Rechnungen + Lieferscheine der Auswahl als ein PDF (fehlende Dokumente werden erstellt)') }}">
<span class="fas fa-print mr-1"></span>{{ __('+ Rechnungen') }}
</button>
</form>
</div>
</div>
<div class="table-responsive">
<table class="table wawi-table" id="of-table">
<thead>
<tr>
<th style="width:32px;"><input type="checkbox" id="of-check-all" title="{{ __('Alle sichtbaren auswählen') }}"></th>
<th>{{ __('Bestellung') }}</th>
<th>{{ __('Kunde') }}</th>
<th>{{ __('Status') }}</th>
@ -120,6 +133,13 @@
$itemCount = $order->shopping_order_items->sum('qty');
@endphp
<tr class="of-row" data-search="{{ mb_strtolower($order->id.' '.$customer) }}">
<td>
@if ($order->isApiOrder())
<input type="checkbox" disabled title="{{ __('API-Bestellung — Dokumente liegen im externen Shop') }}">
@else
<input type="checkbox" class="js-of-check" form="of-batch-form" name="order_ids[]" value="{{ $order->id }}">
@endif
</td>
<td>
<a href="{{ route('admin_sales_detail', $order->id) }}">#{{ $order->id }}</a>
@if ($order->isApiOrder())
@ -210,7 +230,7 @@
</td>
</tr>
<tr class="of-items d-none" id="of-items-{{ $order->id }}">
<td colspan="6" class="pl-4" style="background:rgba(24,28,33,.02);">
<td colspan="7" class="pl-4" style="background:rgba(24,28,33,.02);">
<strong class="small text-muted">{{ __('Packliste') }}</strong>
@if ($order->weight)
<span class="small text-muted">· {{ __('Gewicht') }}: {{ number_format($order->weight / 1000, 2, ',', '.') }} kg</span>
@ -234,7 +254,7 @@
</tr>
@empty
<tr>
<td colspan="6">
<td colspan="7">
<div class="wawi-empty">
<div><span class="fas fa-mug-hot"></span></div>
{{ __('Nichts zu tun — keine Bestellungen in diesem Filter.') }}
@ -269,6 +289,19 @@
}
});
});
// AP-33b: Auswahl für den Sammel-Druck
function refreshBatchButtons() {
var count = $('.js-of-check:checked').length;
$('.js-of-batch').prop('disabled', count === 0);
$('.of-batch-count').text(count);
}
$('#of-check-all').on('change', function () {
var checked = $(this).is(':checked');
$('#of-table tbody tr.of-row:visible .js-of-check').prop('checked', checked);
refreshBatchButtons();
});
$(document).on('change', '.js-of-check', refreshBatchButtons);
});
</script>
@endsection