<?php require __DIR__ . '/../layouts/header.php'; ?>

<div class="d-flex justify-content-between align-items-center mb-4">
    <h1 class="page-title"><?= e(trans('review_assignments')) ?></h1>
</div>

<div class="card border-0 shadow-sm rounded-4">
    <div class="table-responsive">
        <table class="table align-middle mb-0">
            <thead>
                <tr>
                    <th>#</th>
                    <th><?= e(trans('submissions')) ?></th>
                    <th><?= e(trans('conference')) ?></th>
                    <th><?= e(trans('status')) ?></th>
                    <th><?= e(trans('due_date')) ?></th>
                    <th><?= e(trans('actions')) ?></th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($rows as $row): ?>
                    <tr>
                        <td><?= e((string) $row['id']) ?></td>
                        <td>
                            <div class="fw-bold"><?= e((string) ($row['title'] ?? '')) ?></div>
                            <div class="small text-muted"><?= e((string) ($row['submission_no'] ?? '')) ?></div>
                        </td>
                        <td><?= e(current_lang() === 'ar' ? (string) ($row['conference_title_ar'] ?? '') : (string) ($row['conference_title_en'] ?? '')) ?></td>
                        <td><span class="badge bg-primary"><?= e((string) ($row['status'] ?? '')) ?></span></td>
                        <td><?= e((string) ($row['due_date'] ?? '')) ?></td>
                        <td>
                            <a href="<?= e(base_path('reviews/form?assignment_id=' . (int) $row['id'])) ?>" class="btn btn-outline-primary rounded-3 btn-sm"><?= e(trans('edit')) ?></a>
                        </td>
                    </tr>
                <?php endforeach; ?>
                <?php if (empty($rows)): ?>
                    <tr><td colspan="6" class="text-center"><?= e(trans('no_data')) ?></td></tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>

<?php require __DIR__ . '/../layouts/footer.php'; ?>
