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

<div class="d-flex justify-content-between align-items-center mb-4">
    <div>
        <h1 class="fw-bold mb-0"><?= e(trans('upload_revision')) ?></h1>
        <div class="text-muted"><?= e((string) $submission['submission_no']) ?> — <?= e((string) $submission['title']) ?></div>
    </div>
    <a href="<?= e(base_path('submissions/show?id=' . (int) $submission['id'])) ?>" class="btn btn-outline-secondary rounded-3"><?= e(trans('back')) ?></a>
</div>

<div class="card border-0 shadow-sm rounded-4 mb-4">
    <div class="card-body">
        <?php if ($decision): ?>
            <div class="mb-2"><strong><?= e(trans('current_decision')) ?>:</strong> <?= e((string) $decision['decision']) ?></div>
            <div class="mb-0"><strong><?= e(trans('chair_comments')) ?>:</strong><br><?= nl2br(e((string) ($decision['chair_comments'] ?? ''))) ?></div>
        <?php else: ?>
            <div class="alert alert-info rounded-4 mb-0"><?= e(trans('no_data')) ?></div>
        <?php endif; ?>
    </div>
</div>

<div class="card border-0 shadow-sm rounded-4">
    <div class="card-body p-4">
        <form method="post" action="<?= e(base_path('submissions/revision?id=' . (int) $submission['id'])) ?>" enctype="multipart/form-data">
            <input type="hidden" name="_csrf" value="<?= e(csrf_token()) ?>">

            <div class="mb-3">
                <label class="form-label ec-required"><?= e(trans('revised_file')) ?></label>
                <input type="file" name="main_file" class="form-control rounded-3" required>
                <div class="form-text"><?= e(trans('allowed_files')) ?></div>
            </div>

            <div class="mb-4">
                <label class="form-label"><?= e(trans('upload_response_letter')) ?></label>
                <input type="file" name="response_letter" class="form-control rounded-3">
                <div class="form-text"><?= e(trans('allowed_files')) ?></div>
            </div>

            <button type="submit" class="btn btn-success rounded-3"><?= e(trans('upload_revision')) ?></button>
        </form>
    </div>
</div>

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