62 lines
3.1 KiB
PHP
62 lines
3.1 KiB
PHP
<?php
|
|
$pageTitle = $title ?? 'Support';
|
|
$tablesReady = (bool)($tables_ready ?? false);
|
|
$tickets = is_array($tickets ?? null) ? $tickets : [];
|
|
$q = (string)($q ?? '');
|
|
ob_start();
|
|
?>
|
|
<section class="admin-card">
|
|
<div class="badge">Support</div>
|
|
<div style="display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:16px;">
|
|
<div>
|
|
<h1 style="font-size:28px; margin:0;">Tickets</h1>
|
|
<p style="color: var(--muted); margin-top:6px;">Contact form submissions and support conversations.</p>
|
|
</div>
|
|
<a href="/admin/support/settings" class="btn outline">Settings</a>
|
|
</div>
|
|
|
|
<?php if (!$tablesReady): ?>
|
|
<div class="admin-card" style="margin-top:16px; padding:16px; display:flex; align-items:center; justify-content:space-between; gap:16px;">
|
|
<div>
|
|
<div style="font-weight:600;">Support tables not initialized</div>
|
|
<div style="color: var(--muted); font-size:13px; margin-top:4px;">Create support tables before accepting contact tickets.</div>
|
|
</div>
|
|
<form method="post" action="/admin/support/install">
|
|
<button type="submit" class="btn small">Create Tables</button>
|
|
</form>
|
|
</div>
|
|
<?php else: ?>
|
|
<form method="get" action="/admin/support" style="margin-top:16px; display:flex; gap:8px;">
|
|
<input class="input" type="text" name="q" value="<?= htmlspecialchars($q, ENT_QUOTES, 'UTF-8') ?>" placeholder="Search ticket no, subject, or email">
|
|
<button class="btn small" type="submit">Search</button>
|
|
<a href="/admin/support" class="btn outline small">Reset</a>
|
|
</form>
|
|
|
|
<div class="admin-card" style="margin-top:12px; padding:12px;">
|
|
<?php if (!$tickets): ?>
|
|
<div style="color:var(--muted); font-size:13px;">No tickets yet.</div>
|
|
<?php else: ?>
|
|
<div style="display:grid; gap:10px;">
|
|
<?php foreach ($tickets as $ticket): ?>
|
|
<a href="/admin/support/ticket?id=<?= (int)($ticket['id'] ?? 0) ?>" style="text-decoration:none; color:inherit;">
|
|
<div class="admin-card" style="padding:12px; display:grid; grid-template-columns:1.1fr 2fr auto auto; gap:12px; align-items:center;">
|
|
<div>
|
|
<div style="font-weight:700;"><?= htmlspecialchars((string)($ticket['ticket_no'] ?? ''), ENT_QUOTES, 'UTF-8') ?></div>
|
|
<div style="color:var(--muted); font-size:12px; margin-top:2px;"><?= htmlspecialchars((string)($ticket['customer_email'] ?? ''), ENT_QUOTES, 'UTF-8') ?></div>
|
|
</div>
|
|
<div style="font-size:13px;"><?= htmlspecialchars((string)($ticket['subject'] ?? ''), ENT_QUOTES, 'UTF-8') ?></div>
|
|
<div class="pill"><?= htmlspecialchars((string)($ticket['status'] ?? 'open'), ENT_QUOTES, 'UTF-8') ?></div>
|
|
<div style="font-size:12px; color:var(--muted); white-space:nowrap;"><?= htmlspecialchars((string)($ticket['last_message_at'] ?? ''), ENT_QUOTES, 'UTF-8') ?></div>
|
|
</div>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
<?php
|
|
$content = ob_get_clean();
|
|
require __DIR__ . '/../../../../modules/admin/views/layout.php';
|
|
|