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

<div class="d-flex justify-content-between align-items-center mb-4">
    <div>
        <h1 class="page-title"><?= e(trans('volume')) ?> <?= e((string)$volume['volume_no']) ?></h1>
        <div class="text-muted">
            <?= e(current_lang()==='ar' ? (string)($volume['conference_title_ar']??'') : (string)($volume['conference_title_en']??'')) ?>
        </div>
    </div>
    <a href="<?= e(base_path('proceedings?conference_id='.(int)$volume['conference_id'])) ?>" class="btn ec-btn btn-outline-secondary rounded-3"><?= e(trans('back')) ?></a>
</div>

<?php foreach ($issues as $iss): ?>
    <div class="ec-card   mb-3">
        <div class="ec-card-body p-4">
            <div class="d-flex justify-content-between flex-wrap gap-2">
                <div>
                    <div class="badge-soft"><i class="fa-solid fa-layer-group"></i> <?= e(trans('issue')) ?> <?= e((string)$iss['issue_no']) ?></div>
                    <div class="fw-bold mt-2">
                        <?= e(current_lang()==='ar' ? (string)($iss['title_ar']??'') : (string)($iss['title_en']??'')) ?>
                    </div>
                </div>
            </div>

            <div class="mt-3">
                <?php foreach (($items[(int)$iss['id']] ?? []) as $it): ?>
                    <div class="d-flex justify-content-between align-items-center border rounded-4 p-3 mb-2 bg-white">
                        <div>
                            <div class="fw-bold"><?= e((string)($it['title']??'')) ?></div>
                            <div class="small text-muted"><?= e((string)($it['submission_no']??'')) ?></div>
                        </div>
                        <a class="btn ec-btn btn-outline-primary rounded-3" href="<?= e(base_path('paper?id='.(int)$it['submission_id'])) ?>">
                            <i class="fa-solid fa-file-lines"></i><?= e(trans('paper_page')) ?>
                        </a>
                    </div>
                <?php endforeach; ?>
                <?php if (empty($items[(int)$iss['id']] ?? [])): ?>
                    <div class="text-muted"><?= e(trans('no_data')) ?></div>
                <?php endif; ?>
            </div>
        </div>
    </div>
<?php endforeach; ?>

<?php if (empty($issues)): ?>
    <div class="alert alert-info rounded-4"><?= e(trans('no_data')) ?></div>
<?php endif; ?>

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