Files
fewo-stommer/resources/views/filament/resources/channels/channel-process.blade.php
T

181 lines
14 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<x-filament-panels::page>
@php
$muted = 'color:#6b7280;font-size:.8rem';
$card = 'border:1px solid rgba(128,128,128,.3);border-radius:.5rem;padding:.75rem 1rem;margin-bottom:.6rem';
$input = 'border:1px solid rgba(128,128,128,.4);border-radius:.375rem;padding:.3rem .45rem;background:transparent';
$phases = ['P01' => 'Eingang und Daten', 'P02' => 'Angebot und Verbindlichkeit', 'P03' => 'Abwicklung', 'P04' => 'Aufenthalt', 'P05' => 'Abschluss'];
$performers = ['system' => 'System', 'landlord' => 'Sie', 'guest' => 'Gast', 'portal' => 'Portal', 'service_provider' => 'Dienstleister', 'none' => 'niemand'];
$draft = $this->drafts[$this->intake];
$models = $this->models();
$model = $this->model();
$steps = $this->steps();
$problems = $this->problems();
@endphp
@if (count($this->tabs()) > 1)
<div style="display:flex;gap:.5rem">
@foreach ($this->tabs() as $key => $label)
<x-filament::button :color="$this->intake === $key ? 'primary' : 'gray'" wire:click="$set('intake', '{{ $key }}')">{{ $label }}</x-filament::button>
@endforeach
</div>
@endif
@if (! $this->record->isWebsite())
@php($capabilities = $this->capabilities())
<x-filament::section heading="Was kann dieses Portal für Ihr Konto?" description="Davon hängt ab, welche Abläufe passen. Mit dem Speichern bestätigen Sie die hier gezeigten Angaben. Geben Sie nur an, was Sie wissen – „unbekannt“ sperrt nichts.">
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(18rem,1fr));gap:.6rem">
@foreach ($capabilities as $key => $capability)
<label style="{{ $card }};font-size:.85rem">
{{ \App\Process\ChannelCapabilities::definitions()[$key]['question'] }}
<select wire:model.live="capabilityDraft.{{ $key }}" style="{{ $input }};display:block;margin-top:.3rem">
<option value="1">ja</option><option value="0">nein</option><option value="">unbekannt</option>
</select>
<span style="{{ $muted }}">{{ $capability->sourceLabel() }}</span>
</label>
@endforeach
</div>
</x-filament::section>
@endif
<x-filament::section :heading="$this->question()" :description="$draft['derived'] ? 'Noch nicht gewählt: abgeleitet aus Ihren bisherigen Einstellungen. Gespeichert wird erst, wenn Sie speichern.' : null">
@if ($models === [])
<p>Für diese Eingangsart gibt es keine Ablaufmodelle.</p>
@endif
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(18rem,1fr));gap:.6rem" role="radiogroup" aria-label="Ablaufmodell">
@foreach ($models as $key => $option)
@php($candidate = $option['model'])
<div style="{{ $card }};{{ $draft['model'] === $key ? 'border-color:rgb(var(--primary-600));box-shadow:0 0 0 1px rgb(var(--primary-600))' : '' }};{{ $option['admissible'] ? '' : 'opacity:.85;background:rgba(128,128,128,.07)' }}">
<button type="button" role="radio" aria-checked="{{ $draft['model'] === $key ? 'true' : 'false' }}" @disabled(! $option['admissible']) wire:click="chooseModel('{{ $key }}')" style="text-align:left;width:100%">
<strong>{{ $candidate::label() }}</strong>
<span style="{{ $muted }}"> · {{ implode('/', array_map(fn ($type) => strtoupper($type->value), $candidate::caseTypes())) }}</span>
<div style="font-size:.85rem;margin-top:.3rem">{{ $candidate::description() }}</div>
</button>
@foreach ($option['restrictions'] as $restriction)
<p style="color:#b45309;font-size:.8rem;margin-top:.4rem"><strong>Passt gerade nicht ({{ $restriction->kind }}):</strong> {{ $restriction->reason }}@if ($restriction->alternative) <br>Zulässig ist stattdessen: {{ $restriction->alternative }}.@endif @if ($restriction->change) <br>{{ $restriction->change }}.@endif</p>
@endforeach
@foreach ($option['hints'] as $hint)<p style="{{ $muted }};margin-top:.3rem">{{ $hint }}</p>@endforeach
@if ($draft['model'] === $key && ! $option['admissible'])<p style="color:#b91c1c;font-size:.8rem;margin-top:.3rem">Dies ist Ihr bisheriger Ablauf. Er bleibt wirksam, bis Sie ein passendes Modell wählen oder die Fähigkeit oben ändern.</p>@endif
</div>
@endforeach
</div>
@if ($conflicts = $this->conflicts())
<div style="{{ $card }};margin-top:.8rem;border-color:#b45309">
<strong>Bisherige Einstellungen widersprechen diesem Modell</strong>
<ul style="font-size:.85rem;list-style:disc;padding-left:1.2rem">@foreach ($conflicts as $conflict)<li>{{ $conflict['text'] }}</li>@endforeach</ul>
<label style="font-size:.85rem"><input type="checkbox" wire:model.live="acknowledge"> Ich bestätige: Diese bisherigen Einstellungen werden beim Speichern entfernt und im Verlauf des Kanals festgehalten.</label>
</div>
@endif
@if (count($model->variants()) > 1)
<div style="margin-top:.8rem">
<label style="font-size:.9rem">Variante
<select wire:model.live="drafts.{{ $this->intake }}.variant" style="{{ $input }};margin-left:.4rem">
@foreach ($model->variants() as $variant)
<option value="{{ $variant->key }}">{{ $variant->label }}</option>
@endforeach
</select>
</label>
@if ($model->variant($draft['variant'])?->isTesterOnly())
<p style="color:#b45309;font-size:.85rem;margin-top:.3rem">Nur im Prozess-Tester verwendbar (Architekturnachweis). Sie können diese Variante mit „Ablauf testen“ durchspielen, aber nicht speichern.</p>
@endif
</div>
@endif
</x-filament::section>
@if ($problems !== [])
<x-filament::section heading="Nicht zulässig">
<ul style="color:#b91c1c;font-size:.9rem;list-style:disc;padding-left:1.2rem">
@foreach ($problems as $problem)<li>{{ $problem }}</li>@endforeach
</ul>
</x-filament::section>
@endif
<div style="display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:1rem;align-items:start">
<div>
@foreach (collect($steps)->groupBy('phase') as $phase => $group)
<h3 style="font-weight:600;margin:.6rem 0 .3rem">{{ $phases[$phase] ?? $phase }}</h3>
@foreach ($group as $index => $step)
<div style="{{ $card }};{{ $step['on'] ? '' : 'opacity:.6' }}" wire:key="step-{{ $this->intake }}-{{ $step['module'] }}">
<div style="display:flex;justify-content:space-between;gap:.5rem;align-items:center">
<strong>{{ $step['label'] }}
@if ($step['tester_only'])<span style="color:#b45309;font-size:.75rem"> · nur im Prozess-Tester</span>@endif
@if ($step['inserted'])<span style="{{ $muted }}"> · Zusatzschritt der Variante</span>@endif
</strong>
@if ($step['optional'])
<x-filament::button size="xs" :color="($draft['steps'][$step['module']]['on'] ?? true) === false ? 'gray' : 'success'" wire:click="toggleStep('{{ $step['module'] }}')">
{{ ($draft['steps'][$step['module']]['on'] ?? true) === false ? 'aus' : 'an' }}
</x-filament::button>
@else
<span style="{{ $muted }}" title="Pflichtschritt – nicht abschaltbar">🔒 Pflicht</span>
@endif
</div>
<div style="font-size:.85rem;margin-top:.25rem">{{ $step['purpose'] }}</div>
<div style="{{ $muted }};margin-top:.25rem">
@if ($step['needs'] !== []) braucht zuerst: {{ implode(', ', $step['needs']) }} · @elseif ($step['on']) läuft unabhängig · @endif
@if ($step['after'] !== []) soll nach: {{ implode(', ', $step['after']) }} · @endif
@if ($step['condition']) nur wenn: {{ $step['condition'] }} · @endif
@if ($step['executions'] !== [] && ! $step['optional']) So darf das erfüllt werden: {{ implode(', ', $step['executions']) }}@if ($step['why']) – {{ $step['why'] }}@endif · @endif
Wer: {{ $performers[$step['performer']] ?? $step['performer'] ?? '–' }}
@if ($step['waits'] !== []) · kann warten auf: {{ implode(', ', array_map(fn ($wait) => ['guest' => 'Gast', 'portal' => 'Portal', 'landlord' => 'Sie', 'time' => 'Frist'][$wait] ?? $wait, $step['waits'])) }}@endif
@if (! $step['on'] && $step['reason']) · <em>übersprungen: {{ $step['reason'] }}</em>@endif
@if ($this->expert()) · <code>{{ $step['module'] }}</code> v{{ $step['version'] }}@endif
</div>
@if ($step['mode_setting'] && $step['mode_options'] !== [])
<label style="display:block;font-size:.85rem;margin-top:.4rem">Ausführung
<select wire:model.live="drafts.{{ $this->intake }}.settings.{{ $step['mode_setting']->value }}" style="{{ $input }};margin-left:.4rem">
<option value="">wie Standard</option>
@foreach ($step['mode_options'] as $value => $label)<option value="{{ $value }}">{{ $label }}</option>@endforeach
</select>
<span style="{{ $muted }}">{{ $this->setting($step['mode_setting'], $this->profile())['source'] }}</span>
</label>
@endif
@if ($step['performer_setting'] && count($step['performer_options']) > 1)
<label style="display:block;font-size:.85rem;margin-top:.4rem">Wer sendet
<select wire:model.live="drafts.{{ $this->intake }}.settings.{{ $step['performer_setting']->value }}" style="{{ $input }};margin-left:.4rem">
<option value="">wie Standard</option>
@foreach ($step['performer_options'] as $value => $label)<option value="{{ $value }}">{{ $label }}</option>@endforeach
</select>
<span style="{{ $muted }}">im Rahmen des Modells wählbar, ohne Modellwechsel</span>
</label>
@endif
@foreach ($step['parameters'] as $parameter)
<label style="display:block;font-size:.85rem;margin-top:.4rem">{{ $parameter['question'] }}
@if ($parameter['options'])
<select wire:model.live="drafts.{{ $this->intake }}.settings.{{ $parameter['key'] }}" style="{{ $input }};margin-left:.4rem">
<option value="">wie geerbt</option>
@foreach ($parameter['options'] as $value => $label)<option value="{{ $value }}">{{ $label }}</option>@endforeach
</select>
@else
<input type="text" wire:model.live.debounce.600ms="drafts.{{ $this->intake }}.settings.{{ $parameter['key'] }}" placeholder="{{ $parameter['value'] }}" style="{{ $input }};width:8rem;margin-left:.4rem">
@endif
<span style="{{ $muted }}">wirksam: {{ $parameter['value'] }} ({{ $parameter['source'] }})</span>
@if ($parameter['set'])
<button type="button" wire:click="inherit('{{ $parameter['key'] }}')" style="{{ $muted }};text-decoration:underline">auf geerbten Wert zurücksetzen</button>
@endif
</label>
@endforeach
</div>
@endforeach
@endforeach
</div>
<x-filament::section heading="Vorschau: ein neuer Vorgang" description="Mit den aktuellen, auch ungespeicherten Einstellungen. Es wird nichts gespeichert und nichts ausgeführt.">
<ul style="font-size:.85rem;list-style:disc;padding-left:1.2rem">
@foreach ($steps as $step)
<li style="{{ $step['on'] ? '' : 'color:#9ca3af;text-decoration:line-through' }}">
{{ $step['label'] }}
<span style="{{ $muted }}">– {{ $step['on'] ? ($performers[$step['performer']] ?? $step['performer'] ?? '').($step['mode'] ? ', '.(\App\Enums\ProcessingMode::tryFrom($step['mode'])?->getLabel() ?? \App\Enums\DataRequestMode::tryFrom($step['mode'])?->getLabel() ?? $step['mode']) : '') : 'übersprungen: '.$step['reason'] }}</span>
</li>
@endforeach
</ul>
<p style="{{ $muted }};margin-top:.6rem">Gilt für neue Vorgänge. Laufende Vorgänge dieses Kanals ({{ $this->runningCases() }}) behalten ihren bisherigen Ablauf.</p>
<x-filament::button color="gray" wire:click="test" style="margin-top:.6rem">Ablauf testen</x-filament::button>
<p style="{{ $muted }}">Spielt einen ausgedachten Vorgang mit genau dieser Einstellung durch – ohne Wirkung auf echte Daten.</p>
</x-filament::section>
</div>
</x-filament-panels::page>