From aa2fcc46565a36b925e86f01a39221af13fe0cf8 Mon Sep 17 00:00:00 2001 From: Kevin Adametz Date: Tue, 8 Sep 2026 11:09:53 +0000 Subject: [PATCH] =?UTF-8?q?Warenwirtschaft:=20F-18=20=E2=80=94=20Zwischens?= =?UTF-8?q?peichern=20oben/mittig/unten,=20Notizfeld=20f=C3=BCr=20Touch=20?= =?UTF-8?q?vergr=C3=B6=C3=9Ferbar=20und=20auto-wachsend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5.1 --- .../productions/_form_fields.blade.php | 24 ++++++++++++++++++- .../inventory/productions/_scripts.blade.php | 12 ++++++++++ .../inventory/productions/create.blade.php | 2 +- .../inventory/productions/edit.blade.php | 2 +- tests/Feature/ProductionDraftTest.php | 18 ++++++++++++++ 5 files changed, 55 insertions(+), 3 deletions(-) diff --git a/resources/views/admin/inventory/productions/_form_fields.blade.php b/resources/views/admin/inventory/productions/_form_fields.blade.php index 8cc0f41..5e548a8 100644 --- a/resources/views/admin/inventory/productions/_form_fields.blade.php +++ b/resources/views/admin/inventory/productions/_form_fields.blade.php @@ -1,6 +1,9 @@ @php // Achtung: in diesem Template nur die Block-Form von php-Direktiven verwenden (Blade-Compiler-Falle, siehe AP-23). $isEdit = $isEdit ?? false; + // AP-43/F-18: Zwischenspeichern an mehreren Stellen (oben, vor dem Ergebnis, unten) — + // nur solange die Produktion noch nicht gebucht ist. + $canDraft = ! $isEdit || ($model && $model->isDraft()); // AP-28: Vorbelegung der Produktionsergebnis-Zeilen (old() > bestehende Outputs > leer = Default aus Planung per JS). $initialOutputs = old('outputs'); @@ -60,9 +63,21 @@ #recipe-ingredient-lines .input-group-text { font-size: 16px; } + /* F-18: Notizfeld auf dem iPad groß genug und per Finger/automatisch vergrößerbar */ + #notes { + min-height: 88px; + font-size: 16px; + resize: vertical; + } } +@if ($canDraft) +
+ +
+@endif +
@@ -157,9 +172,16 @@
- + {{-- F-18: wächst beim Tippen automatisch mit (siehe _scripts), zusätzlich manuell vergrößerbar --}} +
+@if ($canDraft) +
+ +
+@endif + {{-- AP-28: Produktionsergebnis — treibt den Produktbestand (mehrere Output-Produkte möglich) --}}
{{ __('Produktionsergebnis') }}
diff --git a/resources/views/admin/inventory/productions/_scripts.blade.php b/resources/views/admin/inventory/productions/_scripts.blade.php index d757ad8..ee8c3c3 100644 --- a/resources/views/admin/inventory/productions/_scripts.blade.php +++ b/resources/views/admin/inventory/productions/_scripts.blade.php @@ -574,11 +574,23 @@ } } + // F-18: Notizfeld wächst automatisch mit dem Text (iPad: kein Ziehen am Rand nötig). + function autoGrowNotes() { + var el = document.getElementById('notes'); + if (!el) { + return; + } + el.style.height = 'auto'; + el.style.height = Math.max(el.scrollHeight, el.offsetHeight) + 'px'; + } + $('#notes').on('input', autoGrowNotes); + $(document).ready(function () { if ($('#product_id').val() && $('#location_id').val()) { loadRecipe(); } initOutputs(); + autoGrowNotes(); }); })(jQuery); diff --git a/resources/views/admin/inventory/productions/create.blade.php b/resources/views/admin/inventory/productions/create.blade.php index e522d3c..4562efc 100644 --- a/resources/views/admin/inventory/productions/create.blade.php +++ b/resources/views/admin/inventory/productions/create.blade.php @@ -11,7 +11,7 @@ {{-- AP-43: Zwischenspeichern als Entwurf — ohne Pflichtfeld-/Bestandsprüfung, bucht keinen Bestand. --}} - + {{ __('Abbrechen') }}
diff --git a/resources/views/admin/inventory/productions/edit.blade.php b/resources/views/admin/inventory/productions/edit.blade.php index d5e9166..fe70f46 100644 --- a/resources/views/admin/inventory/productions/edit.blade.php +++ b/resources/views/admin/inventory/productions/edit.blade.php @@ -18,7 +18,7 @@ {{-- AP-43: „Zwischenspeichern" nur solange die Produktion noch nicht gebucht ist (Entwurf). --}} @if ($model->isDraft()) - + @endif {{ __('Abbrechen') }} diff --git a/tests/Feature/ProductionDraftTest.php b/tests/Feature/ProductionDraftTest.php index c6e8771..3a19720 100644 --- a/tests/Feature/ProductionDraftTest.php +++ b/tests/Feature/ProductionDraftTest.php @@ -425,3 +425,21 @@ test('F-06: nach einem validierungsfehler bleiben die eingegebenen chargenzeilen ->and($existing[$ing->id.'|'][0]['batch_key'])->toBe($key) ->and($existing[$ing->id.'|'][0]['quantity_used'])->toBe('20,0'); }); + +test('F-18: mehrere zwischenspeichern-buttons und touch-regeln für das notizfeld; keine entwurfs-buttons bei gebuchter produktion', function () { + $user = draftUser(); + $location = Location::factory()->create(); + $this->actingAs($user, 'user'); + + $create = $this->get(route('admin.inventory.productions.create'))->assertOk()->getContent(); + expect(substr_count($create, 'btn-save-draft'))->toBeGreaterThanOrEqual(3) + ->and($create)->toContain('#notes {')->toContain('autoGrowNotes'); + + $product = Product::query()->create(['name' => 'Draft-F18', 'title' => 'Draft-F18', 'active' => true, 'no_recipe_required' => true]); + $done = app(ProductionService::class)->store( + ['product_id' => $product->id, 'location_id' => $location->id, 'produced_at' => '2026-08-01', 'quantity' => 1, 'notes' => null], + [], $user->id, [['product_id' => $product->id, 'quantity' => 1, 'batch_number' => null]] + ); + $edit = $this->get(route('admin.inventory.productions.edit', $done))->assertOk()->getContent(); + expect(substr_count($edit, 'btn-save-draft'))->toBe(0); +});