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

<div class="admin-card">
    <div class="admin-card-header">
        <h3 class="admin-card-title">Tüm Bayiler / Mağazalar</h3>
        <a href="<?php echo $baseUrl; ?>/superadmin/tenants/create" class="admin-action-btn" style="width:auto; padding: 0 16px; background: #10b981; color: white; border-radius: var(--r-md); font-weight: 600;">
            <i class="fa fa-plus" style="margin-right: 8px;"></i> Yeni Bayi Ekle
        </a>
    </div>

    <div class="admin-table-wrap">
        <table class="admin-table">
            <thead>
                <tr>
                    <th>Subdomain / Tenant ID</th>
                    <th>Kurulum Yolu</th>
                    <th>Oluşturulma Tarihi</th>
                    <th style="text-align:right;">İşlemler</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($tenants as $tenant): ?>
                <tr>
                    <td style="font-weight:600; color: #10b981;">
                        <i class="fa fa-building" style="margin-right:8px; opacity:0.5;"></i> 
                        <?php echo htmlspecialchars($tenant); ?>
                    </td>
                    <td style="color:var(--text-3); font-family:monospace;">/data/tenants/<?php echo htmlspecialchars($tenant); ?></td>
                    <td style="color:var(--text-3);">Mevcut</td>
                    <td style="text-align:right;">
                        <a href="https://<?php echo htmlspecialchars($tenant); ?>.everestburo.com" target="_blank" class="admin-action-btn" title="Siteyi Aç">
                            <i class="fa fa-external-link"></i>
                        </a>
                    </td>
                </tr>
                <?php endforeach; ?>
                <?php if (empty($tenants)): ?>
                <tr>
                    <td colspan="4" style="text-align:center; padding: 40px; color:var(--text-3);">
                        <i class="fa fa-building" style="font-size: 48px; opacity: 0.2; margin-bottom: 15px; display:block;"></i>
                        Hiç bayi (tenant) bulunamadı.
                    </td>
                </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>

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