- E-mail intake (IMAP), optional and off by default: clients can create a ticket or reply to an existing one just by sending/replying to an e-mail. Configure any number of mailboxes in the new Admin > Poczta page (SMTP + IMAP together, replacing the old "E-MAIL" tab), each routed to a specific subcategory or a whole category (new tickets.category_id column). Replies are matched to their ticket via the number/checksum already in every notification subject; autoresponders/bounces are detected and rejected; "restrict tickets to LDAP" is enforced for e-mail like the guest web form. Manual "Pobierz teraz" per-mailbox fetch button; dedicated storage/logs/imap-*.log regardless of the app's log level; mail-icon badges on e-mail-originated tickets/messages in the operator queue and ticket view. - Operator queue: "select all" checkbox in the table header for every currently visible ticket under the active filter/tab. - Fixed: scheduled commands (SLA breach check, automation rules, and now IMAP fetch) always sent notifications through .env's default mailer instead of the configured SMTP server, because AppServiceProvider's Settings override used to skip itself for any console command, not just migrate. - Fixed: visiting a ticket that no longer exists (deleted mid-session, or a stale background refresh) showed a raw 404 instead of redirecting back to the operator queue / client dashboard. - Docs: README/ARCHITECTURE/CLAUDE/install/wiki updated for all of the above, including the previously-missing host crontab entry for schedule:run. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
183 lines
12 KiB
PHP
183 lines
12 KiB
PHP
<div>
|
|
<h3 style="margin:0 0 14px">E-mail (SMTP)</h3>
|
|
<form wire:submit="saveMailConfig" class="card" style="padding:20px;gap:14px;max-width:480px;margin-bottom:32px">
|
|
<div class="field"><label>Adres nadawcy</label><input class="input" type="email" placeholder="wsparcie@firma.pl" wire:model="mailConfig.fromAddress"></div>
|
|
<div class="field"><label>Nazwa nadawcy</label><input class="input" placeholder="Zespół Wsparcia" wire:model="mailConfig.fromName"></div>
|
|
|
|
<div class="hr"></div>
|
|
|
|
<label class="radio"><input type="checkbox" wire:model="mailConfig.smtpEnabled" style="position:static;opacity:1;width:auto;height:auto"><strong>Włącz wysyłkę przez własny serwer SMTP</strong></label>
|
|
<span class="text-muted" style="font-size:11.5px;margin-top:-8px">Bez włączenia aplikacja wysyła pocztę zgodnie z konfiguracją środowiska (.env).</span>
|
|
|
|
@if ($mailConfig['smtpEnabled'])
|
|
<div class="field"><label>Host SMTP</label><input class="input" placeholder="smtp.example.com" wire:model="mailConfig.smtpHost"></div>
|
|
<div style="display:flex;gap:10px">
|
|
<div class="field" style="flex:1"><label>Port</label><input class="input" type="number" placeholder="587" wire:model="mailConfig.smtpPort"></div>
|
|
<div class="field" style="flex:1">
|
|
<label>Szyfrowanie</label>
|
|
<select class="input" wire:model="mailConfig.smtpEncryption">
|
|
<option value="none">Brak</option>
|
|
<option value="tls">STARTTLS</option>
|
|
<option value="ssl">SSL/TLS</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="field"><label>Użytkownik</label><input class="input" wire:model="mailConfig.smtpUsername"></div>
|
|
<div class="field"><label>Hasło</label><input class="input" type="password" placeholder="(bez zmian jeśli puste)" wire:model="mailConfig.smtpPassword"></div>
|
|
|
|
<div style="display:flex;gap:10px;margin-top:8px;align-items:center;flex-wrap:wrap">
|
|
<button type="button" class="btn btn-secondary" wire:click="testMailConnection">Wyślij testową wiadomość</button>
|
|
<button type="submit" class="btn btn-primary">Zapisz</button>
|
|
@if ($mailTestResult === 'ok')
|
|
<div style="display:flex;align-items:center;gap:6px;color:var(--color-success)"><span class="material-symbols-outlined" style="font-size:18px">check_circle</span>Wysłano na Twój adres</div>
|
|
@elseif ($mailTestResult === 'error')
|
|
<div style="display:flex;align-items:center;gap:6px;color:var(--color-danger)"><span class="material-symbols-outlined" style="font-size:18px">error</span>Błąd wysyłki</div>
|
|
@endif
|
|
</div>
|
|
@else
|
|
<button type="submit" class="btn btn-primary" style="align-self:flex-start">Zapisz</button>
|
|
@endif
|
|
</form>
|
|
|
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:14px">
|
|
<h3 style="margin:0">Skrzynki IMAP (zgłoszenia i odpowiedzi przez e-mail)</h3>
|
|
<button class="btn btn-primary" type="button" wire:click="openMailboxForm">+ Nowa skrzynka</button>
|
|
</div>
|
|
|
|
<p class="text-muted" style="font-size:12.5px;margin:0 0 14px">
|
|
Każda skrzynka jest sprawdzana co kilka minut — nowa wiadomość zakłada zgłoszenie w wybranej podkategorii (np. zgloszenia-it@firma.pl → IT), a odpowiedź na powiadomienie e-mail (temat zawiera numer zgłoszenia) trafia jako odpowiedź do istniejącego zgłoszenia. Automatyczne odpowiedzi (autorespondery, „poza biurem”, bounce) są odrzucane.
|
|
</p>
|
|
|
|
@if ($this->mailboxes->isNotEmpty())
|
|
<div class="table-wrap" style="margin-bottom:20px">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Nazwa</th>
|
|
<th>Serwer</th>
|
|
<th>Użytkownik</th>
|
|
<th>Kategoria / podkategoria</th>
|
|
<th>Status</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($this->mailboxes as $mailbox)
|
|
<tr>
|
|
<td>{{ $mailbox->name }}</td>
|
|
<td class="text-muted" style="white-space:nowrap">{{ $mailbox->host }}:{{ $mailbox->port }}</td>
|
|
<td class="text-muted">{{ $mailbox->username }}</td>
|
|
<td class="text-muted">{{ $mailbox->targetLabel() }}</td>
|
|
<td>
|
|
<button type="button" class="tag" style="border:none;cursor:pointer;background:color-mix(in srgb, var(--color-{{ $mailbox->enabled ? 'success' : 'danger' }}) 18%, transparent);color:var(--color-{{ $mailbox->enabled ? 'success' : 'danger' }})"
|
|
wire:click="toggleMailboxEnabled({{ $mailbox->id }})">
|
|
{{ $mailbox->enabled ? 'Włączona' : 'Wyłączona' }}
|
|
</button>
|
|
@if ($mailbox->last_error)
|
|
<div style="color:var(--color-danger);font-size:11px;margin-top:4px">{{ $mailbox->last_error }}</div>
|
|
@elseif ($mailbox->last_checked_at)
|
|
<div class="text-muted" style="font-size:11px;margin-top:4px">Sprawdzono: {{ $mailbox->last_checked_at->format('Y-m-d H:i') }}</div>
|
|
@endif
|
|
@if ($mailboxFetchResultId === $mailbox->id)
|
|
<div class="text-muted" style="font-size:11px;margin-top:4px">{{ $mailboxFetchSummary }}</div>
|
|
@endif
|
|
</td>
|
|
<td>
|
|
<div style="display:flex;gap:6px;justify-content:flex-end">
|
|
<button class="btn btn-ghost" type="button" wire:click="fetchMailboxNow({{ $mailbox->id }})" wire:loading.attr="disabled" wire:target="fetchMailboxNow({{ $mailbox->id }})">Pobierz teraz</button>
|
|
<button class="btn btn-ghost" type="button" wire:click="editMailbox({{ $mailbox->id }})">Edytuj</button>
|
|
<button class="btn btn-ghost" type="button" wire:click="removeMailbox({{ $mailbox->id }})" wire:confirm="Usunąć tę skrzynkę IMAP?">Usuń</button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@else
|
|
<p class="text-muted" style="font-size:13px">Brak skonfigurowanych skrzynek IMAP. Dodaj pierwszą używając przycisku wyżej.</p>
|
|
@endif
|
|
|
|
@if ($mailboxFormOpen)
|
|
<div class="dialog-backdrop">
|
|
<form wire:submit="submitMailboxForm" class="dialog" style="max-width:520px;max-height:90vh;overflow-y:auto">
|
|
<div class="dialog-title">{{ $mailboxForm['id'] ? 'Edytuj skrzynkę IMAP' : 'Nowa skrzynka IMAP' }}</div>
|
|
|
|
<div class="field">
|
|
<label>Nazwa (etykieta)</label>
|
|
<input class="input" placeholder="np. Zgłoszenia IT" wire:model="mailboxForm.name">
|
|
</div>
|
|
@error('mailboxForm.name') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
|
|
|
<label class="radio"><input type="checkbox" wire:model="mailboxForm.enabled" style="position:static;opacity:1;width:auto;height:auto">Włączona</label>
|
|
|
|
<div class="hr"></div>
|
|
|
|
<div class="field"><label>Host IMAP</label><input class="input" placeholder="imap.firma.pl" wire:model="mailboxForm.host"></div>
|
|
@error('mailboxForm.host') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
|
|
|
<div style="display:flex;gap:10px">
|
|
<div class="field" style="flex:1"><label>Port</label><input class="input" type="number" wire:model="mailboxForm.port"></div>
|
|
<div class="field" style="flex:1">
|
|
<label>Szyfrowanie</label>
|
|
<select class="input" wire:model="mailboxForm.encryption">
|
|
<option value="ssl">SSL/TLS</option>
|
|
<option value="tls">STARTTLS</option>
|
|
<option value="none">Brak</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<label class="radio"><input type="checkbox" wire:model="mailboxForm.validateCert" style="position:static;opacity:1;width:auto;height:auto">Weryfikuj certyfikat TLS</label>
|
|
|
|
<div class="field"><label>Adres skrzynki (login)</label><input class="input" placeholder="zgloszenia-it@firma.pl" wire:model="mailboxForm.username"></div>
|
|
@error('mailboxForm.username') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
|
<div class="field"><label>Hasło</label><input class="input" type="password" placeholder="(bez zmian jeśli puste)" wire:model="mailboxForm.password"></div>
|
|
|
|
<div class="hr"></div>
|
|
|
|
<div class="field">
|
|
<label>Kategoria / podkategoria nowych zgłoszeń</label>
|
|
<select class="input" wire:model="mailboxForm.target">
|
|
<option value="">Brak (zgłoszenie nieprzypisane)</option>
|
|
@foreach ($this->categoryOptions as $category)
|
|
<optgroup label="{{ $category['name'] }}">
|
|
<option value="category:{{ $category['id'] }}">Cała kategoria: {{ $category['name'] }}</option>
|
|
@foreach ($category['subcategories'] as $sub)
|
|
<option value="subcategory:{{ $sub['id'] }}">{{ $sub['name'] }}</option>
|
|
@endforeach
|
|
</optgroup>
|
|
@endforeach
|
|
</select>
|
|
<span class="text-muted" style="font-size:11.5px">Wybierz konkretną podkategorię (trafi też do jej zespołu) albo całą kategorię, jeśli nie chcesz przypisywać konkretnej podkategorii.</span>
|
|
</div>
|
|
|
|
<div class="field"><label>Folder</label><input class="input" wire:model="mailboxForm.folder"></div>
|
|
<div style="display:flex;gap:10px">
|
|
<div class="field" style="flex:1"><label>Folder po przetworzeniu (opcjonalnie)</label><input class="input" placeholder="pozostaw puste = oznacz jako przeczytane" wire:model="mailboxForm.processedFolder"></div>
|
|
<div class="field" style="flex:1"><label>Folder odrzuconych (opcjonalnie)</label><input class="input" placeholder="pozostaw puste = oznacz jako przeczytane" wire:model="mailboxForm.rejectedFolder"></div>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<label>Zablokowani nadawcy (dodatkowo do filtrów autoresponderów)</label>
|
|
<input class="input" wire:model="mailboxForm.blocklistSenders">
|
|
</div>
|
|
|
|
<div style="display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:4px">
|
|
<button type="button" class="btn btn-secondary" wire:click="testMailboxConnection">Testuj połączenie</button>
|
|
@if ($mailboxTestResult === 'ok')
|
|
<div style="display:flex;align-items:center;gap:6px;color:var(--color-success)"><span class="material-symbols-outlined" style="font-size:18px">check_circle</span>Połączono</div>
|
|
@elseif ($mailboxTestResult === 'error')
|
|
<div style="display:flex;align-items:center;gap:6px;color:var(--color-danger);font-size:12.5px"><span class="material-symbols-outlined" style="font-size:18px">error</span>{{ $mailboxTestMessage }}</div>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="dialog-actions">
|
|
<button class="btn btn-secondary" type="button" wire:click="closeMailboxForm">Anuluj</button>
|
|
<button class="btn btn-primary" type="submit">Zapisz</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
@endif
|
|
</div>
|