

<?php $__env->startSection('header-title', 'Sohbet Yönetimi'); ?>

<?php $__env->startSection('content'); ?>
<div class="page-header">
    <div class="page-header-content">
        <div>
            <h1 class="page-title">💬 Sohbet Yönetimi</h1>
            <p class="page-subtitle">Tüm sohbet odalarını yönet, mesajları denetle ve otomatik temizleme ayarla</p>
        </div>
        <a href="<?php echo e(route('admin.chat-rooms.create')); ?>" style="padding:12px 24px;background:linear-gradient(135deg,#3b82f6,#2563eb);color:white;border-radius:10px;font-size:14px;font-weight:600;text-decoration:none;display:inline-flex;align-items:center;gap:8px;box-shadow:0 4px 12px rgba(59,130,246,.3);white-space:nowrap;">
            + Yeni Oda
        </a>
    </div>
</div>

<?php if(session('success')): ?>
    <div style="background:#d1fae5;border:1px solid #6ee7b7;color:#065f46;padding:14px 18px;border-radius:10px;margin-bottom:24px;display:flex;align-items:center;gap:10px;font-weight:500;">
        ✅ <?php echo e(session('success')); ?>

    </div>
<?php endif; ?>


<div style="display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:28px;">
    <div style="background:linear-gradient(135deg,#667eea,#764ba2);border-radius:12px;padding:22px;color:white;box-shadow:0 4px 12px rgba(102,126,234,.3);">
        <div style="font-size:12px;opacity:.9;text-transform:uppercase;letter-spacing:1px;margin-bottom:8px;">Toplam Oda</div>
        <div style="font-size:32px;font-weight:700;"><?php echo e($stats['total_rooms']); ?></div>
    </div>
    <div style="background:linear-gradient(135deg,#43e97b,#38f9d7);border-radius:12px;padding:22px;color:white;box-shadow:0 4px 12px rgba(67,233,123,.3);">
        <div style="font-size:12px;opacity:.9;text-transform:uppercase;letter-spacing:1px;margin-bottom:8px;">Aktif Oda</div>
        <div style="font-size:32px;font-weight:700;"><?php echo e($stats['active_rooms']); ?></div>
    </div>
    <div style="background:linear-gradient(135deg,#4facfe,#00f2fe);border-radius:12px;padding:22px;color:white;box-shadow:0 4px 12px rgba(79,172,254,.3);">
        <div style="font-size:12px;opacity:.9;text-transform:uppercase;letter-spacing:1px;margin-bottom:8px;">Toplam Mesaj</div>
        <div style="font-size:32px;font-weight:700;"><?php echo e(number_format($stats['total_messages'])); ?></div>
    </div>
    <div style="background:linear-gradient(135deg,#f093fb,#f5576c);border-radius:12px;padding:22px;color:white;box-shadow:0 4px 12px rgba(240,147,251,.3);">
        <div style="font-size:12px;opacity:.9;text-transform:uppercase;letter-spacing:1px;margin-bottom:8px;">Bugünkü Mesaj</div>
        <div style="font-size:32px;font-weight:700;"><?php echo e($stats['messages_today']); ?></div>
    </div>
</div>


<div style="background:white;border-radius:12px;border:1px solid #e5e7eb;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,0.05);">
    <div style="padding:20px 24px;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;align-items:center;">
        <h2 style="margin:0;font-size:18px;font-weight:600;color:#111827;">📋 Sohbet Odaları</h2>
        <span style="font-size:13px;color:#6b7280;background:#f3f4f6;padding:4px 12px;border-radius:20px;"><?php echo e($rooms->total()); ?> oda</span>
    </div>
    <table style="width:100%;border-collapse:collapse;">
        <thead>
            <tr style="background:#f9fafb;">
                <th style="text-align:left;padding:12px 24px;font-size:12px;font-weight:600;color:#6b7280;text-transform:uppercase;letter-spacing:0.5px;">Oda Adı</th>
                <th style="text-align:left;padding:12px 16px;font-size:12px;font-weight:600;color:#6b7280;text-transform:uppercase;letter-spacing:0.5px;">Kategori</th>
                <th style="text-align:left;padding:12px 16px;font-size:12px;font-weight:600;color:#6b7280;text-transform:uppercase;letter-spacing:0.5px;">Durum</th>
                <th style="text-align:left;padding:12px 16px;font-size:12px;font-weight:600;color:#6b7280;text-transform:uppercase;letter-spacing:0.5px;">Mesaj</th>
                <th style="text-align:left;padding:12px 16px;font-size:12px;font-weight:600;color:#6b7280;text-transform:uppercase;letter-spacing:0.5px;">Tarih</th>
                <th style="text-align:right;padding:12px 24px;font-size:12px;font-weight:600;color:#6b7280;text-transform:uppercase;letter-spacing:0.5px;">İşlemler</th>
            </tr>
        </thead>
        <tbody>
            <?php $__empty_1 = true; $__currentLoopData = $rooms; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $room): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <tr style="border-top:1px solid #e5e7eb;<?php echo e($room->trashed() ? 'opacity:0.5;' : ''); ?>">
                    <td style="padding:16px 24px;">
                        <div style="font-weight:600;color:#111827;"><?php echo e($room->name); ?></div>
                        <div style="font-size:12px;color:#9ca3af;margin-top:2px;">/sohbet/<?php echo e($room->slug); ?></div>
                        <?php if($room->trashed()): ?>
                            <span style="font-size:11px;background:#fee2e2;color:#991b1b;padding:2px 8px;border-radius:10px;">SİLİNDİ</span>
                        <?php endif; ?>
                    </td>
                    <td style="padding:16px;">
                        <?php
                            $catLabel = match($room->category) {
                                'mulakat' => ['label' => 'Subay Alımları', 'bg' => '#eff6ff', 'color' => '#1d4ed8'],
                                'subay'   => ['label' => 'Astsubay Alımları', 'bg' => '#f0fdf4', 'color' => '#16a34a'],
                                'astsubay'=> ['label' => 'Uzman Erbaş', 'bg' => '#fdf4ff', 'color' => '#9333ea'],
                                'saglik'  => ['label' => 'Sağlık', 'bg' => '#fff7ed', 'color' => '#ea580c'],
                                default   => ['label' => 'Genel', 'bg' => '#f9fafb', 'color' => '#6b7280'],
                            };
                        ?>
                        <span style="font-size:12px;background:<?php echo e($catLabel['bg']); ?>;color:<?php echo e($catLabel['color']); ?>;padding:4px 10px;border-radius:10px;font-weight:500;">
                            <?php echo e($catLabel['label']); ?>

                        </span>
                    </td>
                    <td style="padding:16px;">
                        <?php if(!$room->trashed()): ?>
                            <span style="font-size:12px;padding:5px 12px;border-radius:20px;font-weight:600;<?php echo e($room->is_active ? 'background:#d1fae5;color:#065f46;' : 'background:#fee2e2;color:#991b1b;'); ?>">
                                <?php echo e($room->is_active ? '● Aktif' : '● Pasif'); ?>

                            </span>
                        <?php endif; ?>
                    </td>
                    <td style="padding:16px;">
                        <span style="font-weight:700;font-size:16px;color:#374151;"><?php echo e(number_format($room->messages_count)); ?></span>
                    </td>
                    <td style="padding:16px;font-size:13px;color:#6b7280;">
                        <?php echo e($room->created_at->format('d.m.Y')); ?>

                    </td>
                    <td style="padding:16px 24px;text-align:right;">
                        <div style="display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;">
                            <?php if(!$room->trashed()): ?>
                                <a href="<?php echo e(route('admin.chat-rooms.show', $room)); ?>"
                                   style="padding:7px 14px;background:#eff6ff;color:#1d4ed8;border-radius:8px;font-size:12px;text-decoration:none;font-weight:600;border:1px solid #bfdbfe;">
                                    📋 Detay
                                </a>
                                <form method="POST" action="<?php echo e(route('admin.chat-rooms.toggle_active', $room)); ?>" style="display:inline;">
                                    <?php echo csrf_field(); ?>
                                    <button type="submit" style="padding:7px 14px;background:<?php echo e($room->is_active ? '#fff7ed' : '#f0fdf4'); ?>;color:<?php echo e($room->is_active ? '#ea580c' : '#16a34a'); ?>;border:1px solid <?php echo e($room->is_active ? '#fed7aa' : '#bbf7d0'); ?>;border-radius:8px;font-size:12px;cursor:pointer;font-weight:600;">
                                        <?php echo e($room->is_active ? '🔕 Pasif' : '🔔 Aktif'); ?>

                                    </button>
                                </form>
                                <form method="POST" action="<?php echo e(route('admin.chat-rooms.destroy', $room)); ?>" style="display:inline;"
                                      onsubmit="return confirm('Bu odayı silmek istediğinizden emin misiniz?')">
                                    <?php echo csrf_field(); ?>
                                    <?php echo method_field('DELETE'); ?>
                                    <button type="submit" style="padding:7px 14px;background:#fef2f2;color:#dc2626;border:1px solid #fecaca;border-radius:8px;font-size:12px;cursor:pointer;font-weight:600;">
                                        🗑 Sil
                                    </button>
                                </form>
                            <?php else: ?>
                                <form method="POST" action="<?php echo e(route('admin.chat-rooms.restore', $room->id)); ?>" style="display:inline;">
                                    <?php echo csrf_field(); ?>
                                    <button type="submit" style="padding:7px 14px;background:#f0fdf4;color:#16a34a;border:1px solid #bbf7d0;border-radius:8px;font-size:12px;cursor:pointer;font-weight:600;">
                                        ↩️ Geri Yükle
                                    </button>
                                </form>
                            <?php endif; ?>
                        </div>
                    </td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <tr>
                    <td colspan="6" style="text-align:center;color:#9ca3af;padding:60px;font-size:15px;">
                        <div style="font-size:48px;margin-bottom:12px;">💬</div>
                        Henüz sohbet odası yok.
                    </td>
                </tr>
            <?php endif; ?>
        </tbody>
    </table>
    <?php if($rooms->hasPages()): ?>
        <div style="padding:16px 24px;border-top:1px solid #e5e7eb;">
            <?php echo e($rooms->links()); ?>

        </div>
    <?php endif; ?>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\askeribilgiler\resources\views\admin\chat-rooms\index.blade.php ENDPATH**/ ?>