<?php
$title = "Camera-Ready & Copyright";
?>

<div class="container mt-4">

<h3>Camera-Ready & Copyright</h3>

<p class="text-muted">
Submission #<?= (int)$submission['id'] ?>
</p>

<div class="card mb-4">
<div class="card-body">

<h5>Upload Required Documents</h5>

<form method="POST"
      action="/easychair/author/submission/camera-ready/upload"
      enctype="multipart/form-data">

<input type="hidden"
       name="submission_id"
       value="<?= (int)$submission['id'] ?>">

<div class="mb-3">
<label class="form-label">Document Type</label>

<select name="file_category"
        class="form-control"
        required>
    <option value="">Select</option>
    <option value="camera_ready">Camera-Ready Manuscript</option>
    <option value="copyright">Copyright Agreement</option>
    <option value="payment_receipt">Payment Receipt</option>
    <option value="final_source">Final Source Files</option>
    <option value="other_required">Other Required Document</option>
</select>
</div>

<div class="mb-3">
<label class="form-label">File</label>
<input type="file"
       name="file"
       class="form-control"
       required>
</div>

<button class="btn btn-primary">
Upload
</button>

</form>

</div>
</div>

<h5>Uploaded Files</h5>

<table class="table table-bordered">
<thead>
<tr>
<th>Type</th>
<th>File</th>
<th>Uploaded</th>
</tr>
</thead>

<tbody>

<?php foreach ($files as $f): ?>

<tr>
<td><?= htmlspecialchars($f['file_category'] ?? '') ?></td>

<td>
<a href="/easychair/<?= htmlspecialchars($f['file_path'] ?? '') ?>"
   target="_blank">
<?= htmlspecialchars($f['original_name'] ?? $f['original_filename'] ?? 'Download') ?>
</a>
</td>

<td><?= htmlspecialchars($f['created_at'] ?? '') ?></td>
</tr>

<?php endforeach; ?>

</tbody>
</table>

<a href="/easychair/author/submission?id=<?= (int)$submission['id'] ?>"
   class="btn btn-secondary">
Back
</a>

</div>
