mailwolt/resources/views/livewire/ui/system/sandbox-routes.blade.php

114 lines
7.0 KiB
PHP

<div style="margin-bottom:14px">
{{-- ── Header ── --}}
<div class="mbx-domain-head" style="margin-bottom:10px">
<div class="mbx-domain-info">
<span style="font-size:10.5px;padding:2px 8px;border-radius:4px;background:rgba(234,179,8,.12);border:1px solid rgba(234,179,8,.3);color:#fbbf24;font-weight:600;">
Sandbox-Routing
</span>
<span style="font-size:11px;color:var(--mw-t4);margin-left:6px"> Transport-Regeln für Postfix</span>
</div>
<button wire:click="syncPostfix" class="mw-btn-secondary"
style="display:flex;align-items:center;gap:6px;font-size:12px;padding:5px 12px;white-space:nowrap">
<svg width="12" height="12" viewBox="0 0 14 14" fill="none">
<path d="M12.5 7A5.5 5.5 0 1 1 7 1.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
<path d="M7 .5l2.5 1.5L7 3.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Postfix-Sync
</button>
</div>
{{-- ── Sync-Message ── --}}
@if($syncMessage)
<div style="margin-bottom:10px;padding:7px 12px;border-radius:6px;font-size:11.5px;display:flex;align-items:center;gap:7px;
{{ $syncOk
? 'background:rgba(34,197,94,.07);border:1px solid rgba(34,197,94,.25);color:var(--mw-gr)'
: 'background:rgba(239,68,68,.07);border:1px solid rgba(239,68,68,.25);color:#f87171' }}">
@if($syncOk)
<svg width="11" height="11" viewBox="0 0 11 11" fill="none"><path d="M1.5 5.5l3 3 5-5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>
@else
<svg width="11" height="11" viewBox="0 0 11 11" fill="none"><path d="M1.5 1.5l8 8M9.5 1.5l-8 8" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/></svg>
@endif
{{ $syncMessage }}
</div>
@endif
{{-- ── Add-Form ── --}}
<div style="display:flex;gap:8px;align-items:center;margin-bottom:12px;flex-wrap:wrap">
<select wire:model.live="newType"
style="font-size:12px;padding:5px 8px;border-radius:6px;background:var(--mw-bg3);border:1px solid var(--mw-b2);color:var(--mw-t2);cursor:pointer;outline:none;height:30px;flex-shrink:0">
<option value="global">global</option>
<option value="domain">domain</option>
<option value="address">address</option>
</select>
@if($newType !== 'global')
<input wire:model="newTarget" type="text"
placeholder="{{ $newType === 'domain' ? 'example.com' : 'user@example.com' }}"
style="font-size:12px;padding:5px 10px;border-radius:6px;background:var(--mw-bg3);border:1px solid var(--mw-b2);color:var(--mw-t1);outline:none;width:220px;height:30px;flex-shrink:0"
wire:keydown.enter="addRoute">
@endif
<button wire:click="addRoute" class="mw-btn-primary" style="font-size:12px;padding:5px 14px;height:30px;white-space:nowrap;flex-shrink:0">
+ Hinzufügen
</button>
</div>
{{-- ── Route List ── --}}
@if($this->routes->isEmpty())
<div style="padding:20px 16px;text-align:center;color:var(--mw-t4);font-size:12px;background:var(--mw-bg3);border:1px solid var(--mw-b1);border-radius:8px;">
Keine Sandbox-Routen konfiguriert.
</div>
@else
<div style="border:1px solid var(--mw-b1);border-radius:8px;overflow:hidden">
@foreach($this->routes as $route)
<div style="display:flex;align-items:center;gap:8px;padding:8px 12px;
{{ !$loop->last ? 'border-bottom:1px solid var(--mw-b1);' : '' }}
background:{{ $route->is_active ? 'var(--mw-bg3)' : 'var(--mw-bg4)' }}">
{{-- Type badge --}}
@if($route->type === 'global')
<span style="font-size:9.5px;padding:1px 6px;border-radius:4px;background:rgba(239,68,68,.12);border:1px solid rgba(239,68,68,.25);color:#f87171;font-weight:600;flex-shrink:0">global</span>
@elseif($route->type === 'domain')
<span style="font-size:9.5px;padding:1px 6px;border-radius:4px;background:rgba(124,58,237,.12);border:1px solid rgba(124,58,237,.25);color:var(--mw-v2);font-weight:600;flex-shrink:0">domain</span>
@else
<span style="font-size:9.5px;padding:1px 6px;border-radius:4px;background:rgba(59,130,246,.12);border:1px solid rgba(59,130,246,.25);color:#60a5fa;font-weight:600;flex-shrink:0">address</span>
@endif
{{-- Target --}}
<span style="font-size:12px;color:{{ $route->is_active ? 'var(--mw-t1)' : 'var(--mw-t4)' }};font-family:monospace;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">
{{ $route->target ?? '* (alle)' }}
</span>
{{-- Active indicator --}}
@if($route->is_active)
<span style="font-size:9.5px;padding:1px 6px;border-radius:4px;background:rgba(34,197,94,.1);border:1px solid rgba(34,197,94,.2);color:var(--mw-gr);font-weight:600;flex-shrink:0">aktiv</span>
@else
<span style="font-size:9.5px;padding:1px 6px;border-radius:4px;background:var(--mw-bg4);border:1px solid var(--mw-b2);color:var(--mw-t4);font-weight:600;flex-shrink:0">inaktiv</span>
@endif
{{-- Toggle button --}}
<button wire:click="toggleRoute({{ $route->id }})" class="mbx-act-btn"
title="{{ $route->is_active ? 'Deaktivieren' : 'Aktivieren' }}"
style="flex-shrink:0">
@if($route->is_active)
<svg width="12" height="12" viewBox="0 0 14 14" fill="none"><rect x="1" y="4" width="12" height="6" rx="3" stroke="currentColor" stroke-width="1.2"/><circle cx="10" cy="7" r="2" fill="currentColor"/></svg>
@else
<svg width="12" height="12" viewBox="0 0 14 14" fill="none"><rect x="1" y="4" width="12" height="6" rx="3" stroke="currentColor" stroke-width="1.2"/><circle cx="4" cy="7" r="2" fill="currentColor" opacity=".4"/></svg>
@endif
</button>
{{-- Delete button --}}
<button wire:click="removeRoute({{ $route->id }})"
wire:confirm="Route '{{ $route->target ?? 'global' }}' wirklich löschen?"
class="mbx-act-btn mbx-act-danger" title="Löschen" style="flex-shrink:0">
<svg width="12" height="12" viewBox="0 0 13 13" fill="none">
<path d="M2 3h9M5 3V2h3v1M3.5 3l.5 8h5l.5-8" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
</div>
@endforeach
</div>
@endif
</div>