<?php include __DIR__ . '/../layout/header.php'; ?>

<div class="page-toolbar">
    <div class="header-spacer"></div>
    <a href="<?php echo $baseUrl; ?>/admin/compatibility/create" class="admin-btn admin-btn-primary">
        <i class="fa fa-plus-circle"></i> Yeni Uyumluluk Tablosu
    </a>
</div>

<div class="admin-card" style="padding:0;overflow:hidden;">
    <div class="admin-table-wrap">
        <table class="admin-table">
            <thead>
                <tr>
                    <th>Tablo Başlığı</th>
                    <th>Slug / Bağlantı</th>
                    <th>Sütun Sayısı</th>
                    <th>Satır Sayısı</th>
                    <th style="text-align:right;width:120px;">İşlemler</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($compatibilities as $comp): ?>
                <tr>
                    <td style="font-weight:600;color:var(--text-1);"><?php echo htmlspecialchars($comp->title); ?></td>
                    <td><code>/<?php echo htmlspecialchars($comp->slug); ?></code></td>
                    <td><?php echo count($comp->headers ?? []); ?></td>
                    <td><?php echo count($comp->rows ?? []); ?></td>
                    <td style="text-align:right;">
                        <div style="display:flex;justify-content:flex-end;gap:4px;">
                            <a href="<?php echo $baseUrl; ?>/admin/compatibility/edit/<?php echo $comp->slug; ?>" class="admin-action-btn edit"><i class="fa fa-pencil"></i></a>
                            <a href="<?php echo $baseUrl; ?>/admin/compatibility/delete/<?php echo $comp->slug; ?>" onclick="return confirm('Bu uyumluluk tablosunu silmek istediğinize emin misiniz?')" class="admin-action-btn delete"><i class="fa fa-trash"></i></a>
                        </div>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>

<?php include __DIR__ . '/../layout/footer.php'; ?>
