@extends('layouts.app', ['title' => 'Dienstleistungen / Workflow']) @section('content') {{-- Neue Station Modal (dynamisch befüllt per JS) --}} {{-- Neuer Workflow Modal --}} {{-- Header --}}
@include('layouts.breadcrumb', ['crumbs' => ['System', 'Dienstleistungen']])
@if (session('msg'))

{{ session('msg') }}

@endif {{-- Typ-Labels --}} @php $typeLabels = [ 'angebot' => ['label' => 'Angebot', 'color' => 'primary'], 'auftrag' => ['label' => 'Auftrag', 'color' => 'warning'], 'rechnung_ein' => ['label' => 'Rechnung Eingang', 'color' => 'success'], 'rechnung_aus' => ['label' => 'Rechnung Ausgang', 'color' => 'danger'], ]; @endphp {{-- Workflow-Gruppen --}} @foreach ($typeLabels as $type => $info) @php $group = $workflows->where('type', $type); @endphp
{{ $info['label'] }} Workflows {{ $group->count() }}
@if ($group->isEmpty())

Noch kein Workflow vorhanden

@else
@foreach ($group as $wf)

{{-- Stationen --}} @if ($wf->stations->isEmpty())

Noch keine Stationen definiert.

@else @php $stations = $wf->stations; @endphp
@foreach ($stations as $i => $station) @php $prev = $i > 0 ? $stations[$i - 1] : null; $next = $i < $stations->count() - 1 ? $stations[$i + 1] : null; @endphp {{-- Station Card --}}
{{-- Sort Controls --}}
@csrf
{{ $station->sort_order }}
@csrf
{{-- Card --}}
{{-- Davor --}}
@if ($prev) Davor: {{ $prev->department->name ?? '—' }} @else Start @endif
{{-- Aktuelle Station --}}
{{ $station->department->name ?? '—' }}
@csrf
@if ($station->aufgabe)
{{ $station->aufgabe }}
@endif {{-- Danach --}}
@if ($next) Danach: {{ $next->department->name ?? '—' }} @else Ende @endif
{{-- Pfeil zwischen Stationen --}} @if (!$loop->last)
@endif @endforeach
@endif {{-- Station hinzufügen --}}
@csrf
@endforeach
@endif
@endforeach @endsection