<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/** TALENT LIST — Expects: $talent, $categories. */
?>
<div class="page-head">
	<div><h2>Talent Roster</h2><p>Manage the agency's represented talent.</p></div>
	<a href="<?= base_url('admin/talent/create') ?>" class="btn btn-primary"><?= bloom_icon('plus', 16) ?> Add Talent</a>
</div>

<div class="filter-row">
	<div class="search"><?= bloom_icon('search', 17) ?><input type="text" placeholder="Search talent…" data-table-search="#talentTable"></div>
</div>

<div class="card"><div class="card-body flush">
	<?php if ($talent): ?>
		<div class="table-wrap">
			<table class="data" id="talentTable">
				<thead><tr><th>Photo</th><th>Name</th><th>Category</th><th>Availability</th><th>Featured</th><th>Status</th><th class="text-right">Actions</th></tr></thead>
				<tbody>
				<?php foreach ($talent as $t): ?>
					<tr>
						<td><img class="thumb" src="<?= upload_url($t['photo']) ?>" alt=""></td>
						<td><div class="row-title"><?= html_escape($t['name']) ?></div><div class="row-sub"><?= html_escape($t['tagline']) ?></div></td>
						<td><span class="pill pill-grey"><?= html_escape($categories[$t['category']] ?? $t['category']) ?></span></td>
						<td><?= status_pill($t['availability']) ?></td>
						<td><a href="<?= base_url('admin/talent/feature/'.$t['id']) ?>"><?= $t['is_featured'] ? '<span class="pill pill-amber">★</span>' : '<span class="pill pill-grey">—</span>' ?></a></td>
						<td><a href="<?= base_url('admin/talent/toggle/'.$t['id']) ?>"><?= status_pill($t['is_active'] ? 'published' : 'draft') ?></a></td>
						<td><div class="row-actions" style="justify-content:flex-end;">
							<a href="<?= base_url('admin/talent/edit/'.$t['id']) ?>" class="icon-btn"><?= bloom_icon('edit', 16) ?></a>
							<a href="<?= base_url('admin/talent/delete/'.$t['id']) ?>" class="icon-btn danger" data-confirm="Delete this talent profile?"><?= bloom_icon('trash', 16) ?></a>
						</div></td>
					</tr>
				<?php endforeach; ?>
				</tbody>
			</table>
		</div>
	<?php else: ?>
		<div class="empty"><?= bloom_icon('star', 44) ?><p>No talent yet. Add your first talent profile.</p></div>
	<?php endif; ?>
</div></div>
