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

104 lines
8.1 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';
$input = 'border:1px solid rgba(128,128,128,.4);border-radius:.375rem;padding:.3rem .45rem;background:transparent';
$card = 'border:1px solid rgba(128,128,128,.3);border-radius:.5rem;padding:.75rem 1rem;margin-bottom:.6rem';
$requirements = $this->requirements();
$scenarios = $this->scenarios();
$run = $this->run();
$report = $run?->report ?? [];
$stateColor = ['done' => '#15803d', 'external' => '#0369a1', 'open' => '#b45309', 'problem' => '#b91c1c', 'waiting' => '#6d28d9', 'later' => '#6b7280', 'not_applicable' => '#9ca3af'];
@endphp
<x-filament::section heading="So funktioniert der Test" collapsible collapsed>
<p style="font-size:.9rem">Der Test spielt einen ausgedachten Vorgang mit Ihrer aktuellen – auch noch nicht gespeicherten – Einstellung durch. Er nutzt dieselben Abläufe wie ein echter Vorgang, aber in einem eigenen, abgeschotteten Lauf: eigene Testdatenbank, keine echten Gäste, keine Mails an echte Empfänger, keine Portale, keine Kalender. Mails werden nur angezeigt. Links in den Mails sind nur Text.</p>
</x-filament::section>
@if ($requirements !== [])
<x-filament::section heading="Der Prozess-Tester ist auf diesem Server gesperrt">
<ul style="color:#b91c1c;font-size:.9rem;list-style:disc;padding-left:1.2rem">
@foreach ($requirements as $requirement)<li>{{ $requirement }}</li>@endforeach
</ul>
<p style="{{ $muted }}">Ohne diese Voraussetzungen lässt sich die Trennung von den echten Daten nicht sicher herstellen. Es gibt deshalb keinen Ausweichbetrieb.</p>
</x-filament::section>
@else
<x-filament::section heading="Szenario">
<p style="{{ $muted }}">Ablauf: {{ app(\App\Process\ProcessCatalogue::class)->model($this->draft['model'])::label() }}{{ ($this->draft['variant'] ?? 'standard') !== 'standard' ? ' · Variante '.$this->draft['variant'] : '' }} · {{ $this->intake === 'booking' ? 'feste Buchungen' : 'Anfragen' }} über {{ $this->record->name }}</p>
<div style="display:flex;flex-wrap:wrap;gap:.8rem;align-items:end;margin-top:.5rem">
<label style="font-size:.85rem">Szenario
<select wire:model.live="scenario" style="{{ $input }};display:block">
@foreach ($scenarios as $key => $class)<option value="{{ $key }}">{{ $class::label() }}</option>@endforeach
</select>
</label>
@if ($class = $scenarios[$this->scenario] ?? null)
@foreach ($class::inputs() as $key => $definition)
<label style="font-size:.85rem">{{ $definition['label'] }}
@if ($definition['type'] === 'bool')
<input type="checkbox" wire:model="inputs.{{ $key }}" style="display:block">
@elseif ($definition['type'] === 'select')
<select wire:model="inputs.{{ $key }}" style="{{ $input }};display:block">
@foreach ($definition['options'] as $value => $label)<option value="{{ $value }}">{{ $label }}</option>@endforeach
</select>
@else
<input type="{{ $definition['type'] === 'date' ? 'date' : 'number' }}" wire:model="inputs.{{ $key }}" style="{{ $input }};display:block;width:10rem">
@endif
</label>
@endforeach
@endif
</div>
@if ($class)<p style="font-size:.85rem;margin-top:.5rem">{{ $class::description() }}</p>@endif
<div style="display:flex;gap:.5rem;margin-top:.8rem">
<x-filament::button wire:click="start" wire:loading.attr="disabled">Test starten</x-filament::button>
@if ($run && count($report['timeline'] ?? []) < ($report['scenario']['available_events'] ?? 0) && blank($report['aborted'] ?? null))
<x-filament::button color="gray" wire:click="next" wire:loading.attr="disabled">Weiter: nächstes Ereignis</x-filament::button>
@endif
<span wire:loading style="{{ $muted }}">Testlauf läuft …</span>
</div>
</x-filament::section>
@endif
@if ($run)
<x-filament::section heading="Bericht">
@if (filled($report['aborted'] ?? null))
<p style="color:#b91c1c;font-weight:600">{{ $report['aborted'] }}</p>
@foreach ($report['violations'] ?? [] as $violation)<p style="color:#b91c1c;font-size:.85rem">{{ $violation['message'] ?? '' }}</p>@endforeach
@endif
@if ($plan = $report['plan'] ?? null)
<p style="font-size:.9rem"><strong>{{ $plan['label'] }}</strong> ({{ $plan['model'] }} Version {{ $plan['version'] }}{{ $plan['variant'] !== 'standard' ? ', Variante '.$plan['variant'] : '' }}) · Vorgangsart {{ $plan['case_type'] }}</p>
<details style="font-size:.85rem;margin:.4rem 0"><summary>Wirksame Einstellungen</summary>
<ul style="padding-left:1.2rem;list-style:disc">
@foreach ($plan['configuration'] as $row)<li>{{ $row['question'] }}: <strong>{{ $row['value'] }}</strong> <span style="{{ $muted }}">({{ $row['source'] }})</span></li>@endforeach
</ul>
</details>
@endif
@foreach ($report['timeline'] ?? [] as $index => $event)
<div style="{{ $card }}">
<div style="display:flex;justify-content:space-between"><strong>{{ $index + 1 }}. {{ $event['label'] }}</strong><span style="{{ $muted }}">{{ $event['at'] }} (simuliert)</span></div>
@if ($event['error'])<p style="color:#b91c1c;font-size:.85rem">Fehler: {{ $event['error'] }}</p>@endif
@isset($event['situation'])<p style="font-size:.85rem;margin:.3rem 0">{{ $event['status'] }} · {{ $event['situation'] }}</p>@endisset
<ul style="font-size:.85rem;list-style:none;padding:0">
@foreach ($event['activities'] as $activity)
<li><span style="color:{{ $stateColor[$activity['state_key']] ?? '#6b7280' }};font-weight:600">{{ $activity['state'] }}</span> – {{ $activity['label'] }}@if ($activity['detail'])<span style="{{ $muted }}"> · {{ $activity['detail'] }}</span>@endif</li>
@endforeach
</ul>
@if (($event['skipped'] ?? []) !== [])
<p style="{{ $muted }};margin-top:.3rem">Übersprungen: {{ collect($event['skipped'])->map(fn ($skipped) => $skipped['label'].' ('.$skipped['reason'].')')->implode(', ') }}</p>
@endif
@if (isset($event['calendar']))
<p style="{{ $muted }}">Kalender: {{ $event['calendar']['occupying'] ? 'Zeitraum belegt' : 'Zeitraum frei' }}{{ $event['calendar']['hold_until'] ? ', reserviert bis '.$event['calendar']['hold_until'] : '' }} · Preis: {{ $event['price']['total'] !== null ? \App\Support\Money::format($event['price']['total']) : 'noch offen' }}</p>
@endif
@foreach ($event['mails'] as $mail)
<details style="font-size:.85rem;margin-top:.3rem"><summary>✉ simuliert: {{ $mail['subject'] }} <span style="{{ $muted }}">an {{ $mail['to'] }}</span></summary><p style="{{ $muted }}">{{ $mail['excerpt'] }}</p></details>
@endforeach
</div>
@endforeach
@if ($result = $report['result'] ?? null)
<p style="font-size:.9rem"><strong>Ergebnis:</strong> {{ $result['status'] }} · {{ $result['situation'] }}@if ($result['next']) · nächster Schritt: {{ $result['next'] }}@endif</p>
@endif
<p style="{{ $muted }}">Bericht Nr. {{ $run->id }} vom {{ $run->created_at->format('d.m.Y H:i') }} · wird nach {{ config('fewo.retention.process_test_run_days') }} Tagen gelöscht.</p>
</x-filament::section>
@endif
</x-filament-panels::page>