<?php
$sessionUser = $this->getRequest()->getSession()->read('Auth.User');
?>
<h1>Admin Dashboard</h1>

<?php if (!empty($sessionUser)): ?>
    <p>Signed in as <?= h($sessionUser['email']) ?> (role: <?= h($sessionUser['role']) ?>)</p>
    <p><?= $this->Html->link('Log out', ['controller' => 'Users', 'action' => 'logout']) ?></p>
<?php else: ?>
    <p><?= $this->Html->link('Log in',  ['controller' => 'Users', 'action' => 'login']) ?></p>
<?php endif; ?>

<ul>
    <li><?= $this->Html->link('Users',                ['controller' => 'Users',               'action' => 'index']) ?></li>
    <li><?= $this->Html->link('Products',             ['controller' => 'Products',            'action' => 'index']) ?></li>
    <li><?= $this->Html->link('Allergens',            ['controller' => 'Allergens',           'action' => 'index']) ?></li>
    <li><?= $this->Html->link('Orders',               ['controller' => 'Orders',              'action' => 'index']) ?></li>
    <li><?= $this->Html->link('Contact Submissions',  ['controller' => 'ContactSubmissions',  'action' => 'index']) ?></li>
    <li><?= $this->Html->link('Carts',                ['controller' => 'Carts',               'action' => 'index']) ?></li>
    <li><?= $this->Html->link('Cart Items',           ['controller' => 'CartItems',           'action' => 'index']) ?></li>
</ul>
