mailwolt/resources/views/livewire/ui/mail/modal/alias-form-modal.blade.php

140 lines
6.8 KiB
PHP

<div class="mw-modal-frame">
<div class="mw-modal-head">
<div class="mw-modal-title-wrap">
<h2 class="mw-modal-title">{{ $aliasId ? 'Alias bearbeiten' : 'Alias anlegen' }}</h2>
<span class="mw-modal-sub">{{ $aliasId ? 'Passe den Alias und seine Empfänger an.' : 'Lege Adresse und Empfänger fest.' }}</span>
</div>
<button wire:click="$dispatch('closeModal')" class="mw-modal-close">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M2 2l10 10M12 2L2 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
</button>
</div>
<div class="mw-modal-body">
<form id="alias-form" wire:submit.prevent="save">
<label class="mw-modal-check" style="margin-bottom:2px;">
<input type="checkbox" wire:model="is_active">
<span class="mw-modal-check-label">Alias aktivieren</span>
</label>
<div class="mw-modal-grid2" style="margin-top:12px;">
{{-- Domain --}}
<div class="mw-modal-row">
<label class="mw-modal-label">Domain</label>
<div class="mw-modal-input" style="color:var(--mw-t3);cursor:default;">
{{ optional($domain)->domain ?? '—' }}
</div>
</div>
{{-- Typ --}}
<div class="mw-modal-row" wire:ignore id="type-select-{{ $this->getId() }}">
<label class="mw-modal-label">Typ</label>
<select class="mw-modal-input"
onchange="@this.set('type', this.value)">
<option value="single" {{ $type === 'single' ? 'selected' : '' }}>Einzel</option>
<option value="group" {{ $type === 'group' ? 'selected' : '' }}>Gruppe</option>
</select>
@error('type')<div class="mw-modal-error">{{ $message }}</div>@enderror
</div>
</div>
{{-- Adresse --}}
<div class="mw-modal-row" style="margin-top:12px;">
<label class="mw-modal-label">Adresse</label>
<div class="mw-modal-split">
<input type="text" wire:model.defer="local" placeholder="info" class="mw-modal-input">
<span class="mw-modal-split-suffix">@ {{ optional($domain)->domain }}</span>
</div>
@error('local')<div class="mw-modal-error">{{ $message }}</div>@enderror
</div>
@if($type === 'group')
<div class="mw-modal-row" style="margin-top:12px;">
<label class="mw-modal-label">Gruppenname (optional)</label>
<input type="text" wire:model.defer="group_name" placeholder="z. B. Office Gruppe" class="mw-modal-input">
@error('group_name')<div class="mw-modal-error">{{ $message }}</div>@enderror
</div>
@endif
{{-- Empfänger --}}
<div style="margin-top:14px;">
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;">
<span class="mw-modal-label" style="margin:0;">Empfänger</span>
@if($type === 'group')
<button type="button" wire:click="addRecipientRow" class="mw-btn-add-row" @disabled(!$canAddRecipient)>
<svg width="10" height="10" viewBox="0 0 10 10" fill="none"><path d="M5 1v8M1 5h8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
Empfänger
</button>
@else
<span class="mw-modal-hint">Bei „Einzel" nur ein Empfänger.</span>
@endif
</div>
@error('recipients')<div class="mw-modal-error" style="margin-bottom:8px;">{{ $message }}</div>@enderror
<div style="display:flex;flex-direction:column;gap:8px;" wire:key="recipients-container">
@foreach($recipients as $idx => $r)
<div class="mw-modal-recip" wire:key="recipient-{{ $r['id'] }}">
<div class="mw-modal-recip-labels {{ $type === 'single' ? 'single' : '' }}"
style="grid-template-columns: {{ $type === 'single' ? '1fr auto 1fr' : '1fr auto 1fr auto' }};">
<span class="mw-modal-label" style="margin:0;">Internes Postfach</span>
<span></span>
<span class="mw-modal-label" style="margin:0;">Externe E-Mail</span>
@if($type === 'group')<span></span>@endif
</div>
<div class="mw-modal-recip-grid {{ $type === 'single' ? 'single' : '' }}">
<select wire:model.live="recipients.{{ $idx }}.mail_user_id"
class="mw-modal-input"
@disabled($rowState[$idx]['disable_internal'] ?? false)>
<option value="">—</option>
@foreach($domainMailUsers as $mu)
<option value="{{ $mu->id }}"
@disabled(in_array($mu->id, $disabledMailboxIdsByRow[$idx] ?? [], true))>
{{ $mu->localpart . '@' . optional($domain)->domain }}
</option>
@endforeach
</select>
<span class="mw-modal-recip-or">oder</span>
<div>
<input type="email" wire:model.live="recipients.{{ $idx }}.email"
placeholder="user@example.com" class="mw-modal-input"
@disabled($rowState[$idx]['disable_external'] ?? false)>
@error("recipients.$idx.email")<div class="mw-modal-error">{{ $message }}</div>@enderror
</div>
@if($type === 'group')
<button type="button" wire:click="removeRecipientRow({{ $idx }})" class="mw-modal-recip-del">
<svg width="12" height="12" viewBox="0 0 13 13" fill="none"><path d="M2 3.5h9M5 3.5V2h3v1.5M5.5 6v4M7.5 6v4M3 3.5l.5 7.5h6L10 3.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>
</button>
@endif
</div>
</div>
@endforeach
</div>
@if($type === 'single' && count($recipients) > 1)
<div class="mw-modal-warn" style="margin-top:8px;">Nur der erste Empfänger wird gespeichert.</div>
@endif
</div>
{{-- Notizen --}}
<div class="mw-modal-row" style="margin-top:12px;">
<label class="mw-modal-label">Notizen (optional)</label>
<textarea wire:model.defer="notes" rows="2" class="mw-modal-input" style="height:auto;line-height:1.5;padding:7px 10px;resize:vertical;"></textarea>
@error('notes')<div class="mw-modal-error">{{ $message }}</div>@enderror
</div>
</form>
</div>
<div class="mw-modal-foot">
<button type="button" wire:click="$dispatch('closeModal')" class="mw-btn-cancel">Abbrechen</button>
<button type="submit" form="alias-form" class="mw-btn-save">
{{ $aliasId ? 'Speichern' : 'Anlegen' }}
</button>
</div>
</div>