

<?php $__env->startSection('styles'); ?>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="<?php echo e(asset('css/admin.css')); ?>">
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>

<?php
    $totalPesan   = count($data);
    $pengirimUnik = \App\Models\Kontak::distinct('email')->count('email');
    $tglTerakhir  = \App\Models\Kontak::max('created_at');
?>

<div class="dash-page-header">
    <div>
        <h2 class="dash-page-title">📬 Pesan Kontak</h2>
        <p class="dash-page-sub">Pesan masuk dari pengguna — Kabupaten Gowa</p>
    </div>
    <a href="/admin/dashboard"><button class="dash-btn-back">← Dashboard</button></a>
</div>

<div class="dash-summary-strip" style="margin-bottom:20px;">
    <div class="dash-sum-item">
        <div class="dash-sum-ico" style="background:#e8f5e9;">📬</div>
        <div><div class="dash-sum-val"><?php echo e($totalPesan); ?></div><div class="dash-sum-lbl">Total Pesan</div></div>
    </div>
    <div class="dash-sum-sep"></div>
    <div class="dash-sum-item">
        <div class="dash-sum-ico" style="background:#e3f2fd;">👤</div>
        <div><div class="dash-sum-val" style="color:#1565c0;"><?php echo e($pengirimUnik); ?></div><div class="dash-sum-lbl">Pengirim</div></div>
    </div>
    <div class="dash-sum-sep"></div>
    <div class="dash-sum-item">
        <div class="dash-sum-ico" style="background:#f3e5f5;">📅</div>
        <div>
            <div class="dash-sum-val" style="color:#6a1b9a;font-size:13px;">
                <?php echo e($tglTerakhir ? \Carbon\Carbon::parse($tglTerakhir)->format('d M Y') : '-'); ?>

            </div>
            <div class="dash-sum-lbl">Pesan Terakhir</div>
        </div>
    </div>
</div>

<?php if($totalPesan === 0): ?>
<div class="dash-tbl-wrap">
    <div style="text-align:center;padding:60px;color:#9ca3af;">
        <div style="font-size:40px;margin-bottom:12px;">📭</div>
        <div style="font-size:15px;font-weight:600;margin-bottom:4px;font-family:'Plus Jakarta Sans',sans-serif;">Belum ada pesan masuk</div>
        <div style="font-size:13px;">Pesan dari halaman kontak publik akan muncul di sini</div>
    </div>
</div>
<?php else: ?>
<div class="dash-tbl-wrap">
    <table class="dash-tbl">
        <thead>
            <tr>
                <th style="width:40px;">#</th>
                <th>Nama Pengirim</th>
                <th>Email</th>
                <th>Pesan</th>
                <th style="white-space:nowrap;">Tanggal</th>
            </tr>
        </thead>
        <tbody>
            <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr>
                <td style="color:#9ca3af;font-size:12px;"><?php echo e($i+1); ?></td>
                <td><div class="dash-tbl-name"><?php echo e($item->nama); ?></div></td>
                <td>
                    <a href="mailto:<?php echo e($item->email); ?>" style="color:#1b5e20;font-size:12px;font-weight:500;text-decoration:none;">
                        <?php echo e($item->email); ?>

                    </a>
                </td>
                <td><div class="dash-kontak-pesan"><?php echo e($item->pesan); ?></div></td>
                <td style="font-size:12px;color:#6b7280;white-space:nowrap;">
                    <?php echo e(\Carbon\Carbon::parse($item->created_at)->format('d M Y')); ?><br>
                    <span style="font-size:11px;"><?php echo e(\Carbon\Carbon::parse($item->created_at)->format('H:i')); ?></span>
                </td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </tbody>
    </table>
</div>
<?php endif; ?>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\Maylha\pelaporanpertanian\resources\views/admin/kontak.blade.php ENDPATH**/ ?>