<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/** TEAM LIST — Expects: $members. */
?>
<div class="page-head">
	<div><h2>Team</h2><p>Manage agency team members and founders.</p></div>
	<a href="<?= base_url('admin/team/create') ?>" class="btn btn-primary"><?= bloom_icon('plus', 16) ?> Add Member</a>
</div>

<div class="card"><div class="card-body flush">
	<?php if ($members): ?>
		<div class="table-wrap">
			<table class="data">
				<thead><tr><th>Photo</th><th>Name</th><th>Role</th><th>Founder</th><th>Status</th><th class="text-right">Actions</th></tr></thead>
				<tbody>
				<?php foreach ($members as $m): ?>
					<tr>
						<td><img class="thumb" style="border-radius:50%;" src="<?= upload_url($m['photo']) ?>" alt=""></td>
						<td class="row-title"><?= html_escape($m['name']) ?></td>
						<td class="muted"><?= html_escape($m['role']) ?></td>
						<td><?= $m['is_founder'] ? '<span class="pill pill-amber">Founder</span>' : '<span class="pill pill-grey">—</span>' ?></td>
						<td><a href="<?= base_url('admin/team/toggle/'.$m['id']) ?>"><?= status_pill($m['is_active'] ? 'published' : 'draft') ?></a></td>
						<td><div class="row-actions" style="justify-content:flex-end;">
							<a href="<?= base_url('admin/team/edit/'.$m['id']) ?>" class="icon-btn"><?= bloom_icon('edit', 16) ?></a>
							<a href="<?= base_url('admin/team/delete/'.$m['id']) ?>" class="icon-btn danger" data-confirm="Delete this team member?"><?= bloom_icon('trash', 16) ?></a>
						</div></td>
					</tr>
				<?php endforeach; ?>
				</tbody>
			</table>
		</div>
	<?php else: ?>
		<div class="empty"><?= bloom_icon('users', 44) ?><p>No team members yet.</p></div>
	<?php endif; ?>
</div></div>
