<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/** PAGES LIST — Expects: $pages. */
?>
<div class="page-head">
	<div><h2>Pages</h2><p>Edit static content pages.</p></div>
</div>

<div class="card"><div class="card-body flush">
	<?php if ($pages): ?>
		<div class="table-wrap">
			<table class="data">
				<thead><tr><th>Page</th><th>Slug</th><th>Last Updated</th><th class="text-right">Actions</th></tr></thead>
				<tbody>
				<?php foreach ($pages as $p): ?>
					<tr>
						<td class="row-title"><?= html_escape($p['title']) ?></td>
						<td><code><?= html_escape($p['slug']) ?></code></td>
						<td class="muted"><?= $p['updated_at'] ? nice_date($p['updated_at']) : '—' ?></td>
						<td class="text-right">
							<a href="<?= base_url('admin/pages/edit/'.$p['id']) ?>" class="btn btn-ghost btn-sm"><?= bloom_icon('edit', 14) ?> Edit</a>
						</td>
					</tr>
				<?php endforeach; ?>
				</tbody>
			</table>
		</div>
	<?php else: ?>
		<div class="empty"><?= bloom_icon('film', 44) ?><p>No editable pages.</p></div>
	<?php endif; ?>
</div></div>
