Warenwirtschaft: R-01 — stabile Phasen-IDs im Artikelformular, keine Zuordnung nach Reihenfolge

mfg_phase_id[] je Phasenblock; Zuordnung bestehender Phasen über ID, dann Name,
dann gemeinsame Rohstoffe. Ein vorangestellter neuer Block übernimmt nicht mehr
die ID einer umbenannten Phase; Produktionszeilen behalten ihre Phase.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-09-09 07:28:06 +00:00
parent a439d05a6a
commit fda37d5599
2 changed files with 64 additions and 12 deletions

View file

@ -778,10 +778,10 @@
$mfgBlocks = [];
if (($mfgRowsByPhase[0] ?? collect())->isNotEmpty() || $mfgPhaseList->isEmpty()) {
// Altbestand ohne Phase bzw. leere Rezeptur => impliziter erster Block
$mfgBlocks[] = ['name' => '', 'note' => '', 'rows' => $mfgRowsByPhase[0] ?? collect()];
$mfgBlocks[] = ['id' => null, 'name' => '', 'note' => '', 'rows' => $mfgRowsByPhase[0] ?? collect()];
}
foreach ($mfgPhaseList as $mfgPhase) {
$mfgBlocks[] = ['name' => $mfgPhase->name, 'note' => $mfgPhase->note, 'rows' => $mfgRowsByPhase[$mfgPhase->id] ?? collect()];
$mfgBlocks[] = ['id' => $mfgPhase->id, 'name' => $mfgPhase->name, 'note' => $mfgPhase->note, 'rows' => $mfgRowsByPhase[$mfgPhase->id] ?? collect()];
}
@endphp
@ -790,6 +790,8 @@
<div class="card mb-3 mfg-phase-block">
<div class="card-header d-flex align-items-center py-2">
<span class="text-muted mfg-phase-drag-handle mr-2" style="cursor:grab" title="{{ __('Phase verschieben') }}">&#9776;</span>
{{-- R-01: stabile Phasen-ID — Umbenennen/Umordnen/Einfügen wechselt die Identität nicht --}}
<input type="hidden" name="mfg_phase_id[]" class="mfg-phase-id" value="{{ $block['id'] ?? '' }}">
<input type="text" name="mfg_phase_name[]" class="form-control form-control-sm mfg-phase-name"
style="max-width: 16rem" placeholder="{{ __('Phase') }} {{ chr(65 + $blockIndex) }}"
value="{{ $block['name'] }}" autocomplete="off">
@ -920,6 +922,7 @@
<div class="card mb-3 mfg-phase-block">
<div class="card-header d-flex align-items-center py-2">
<span class="text-muted mfg-phase-drag-handle mr-2" style="cursor:grab" title="{{ __('Phase verschieben') }}">&#9776;</span>
<input type="hidden" name="mfg_phase_id[]" class="mfg-phase-id" value="">
<input type="text" name="mfg_phase_name[]" class="form-control form-control-sm mfg-phase-name"
style="max-width: 16rem" placeholder="{{ __('Phase') }}" value="" autocomplete="off">
<a class="text-danger ml-auto mfg-phase-remove" href="#" title="{{ __('Phase entfernen') }}"><i class="far fa-trash-alt"></i></a>