<div class="container-fluid py-4">

<div class="card border-0 shadow-sm">

<div class="card-body">

<h2 class="mb-4">
Manual Track Assignment Center
</h2>

<div class="alert alert-info">
Only submissions with no track are shown. Choose a valid track from the same conference.
</div>

<div class="table-responsive">

<table class="table table-bordered table-hover align-middle">

<thead class="table-dark">

<tr>
<th>ID</th>
<th>Submission No</th>
<th>Conference</th>
<th>Title</th>
<th>Status</th>
<th>Assign Track</th>
</tr>

</thead>

<tbody>

<?php foreach($rows as $r): ?>

<tr>

<td><?= (int)$r['id'] ?></td>

<td><?= htmlspecialchars($r['submission_no'] ?? '') ?></td>

<td><?= (int)$r['conference_id'] ?></td>

<td><?= htmlspecialchars($r['title'] ?? '') ?></td>

<td><?= htmlspecialchars($r['status'] ?? '') ?></td>

<td>

<form method="post"
      action="/easychair/admin/conference-home/manual-track-assignment/save"
      class="d-flex gap-2">

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

<select name="track_id"
        class="form-select"
        required>

<option value="">
Select Track
</option>

<?php foreach(($tracksByConference[(int)$r['conference_id']] ?? []) as $track): ?>

<option value="<?= (int)$track['id'] ?>">
<?= htmlspecialchars($track['name_en'] ?: $track['name_ar']) ?>
</option>

<?php endforeach; ?>

</select>

<button class="btn btn-primary btn-sm">
Assign
</button>

</form>

</td>

</tr>

<?php endforeach; ?>

</tbody>

</table>

</div>

</div>

</div>

</div>
