<!DOCTYPE html>
<html lang="en">
<head>
    <?= $this->include('admin/inc/title') ?>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet"
          href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">

   
</head>

<body>

 <?= $this->include('admin/inc/header') ?>

<div class="container mt-4">

    <!-- Flash Messages -->
    <?php if (session()->getFlashdata('success')): ?>
        <div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
    <?php endif; ?>

    <?php if (session()->getFlashdata('error')): ?>
        <div class="alert alert-danger"><?= session()->getFlashdata('error') ?></div>
    <?php endif; ?>

    <h3 class="mb-4">Dashboard</h3>

    <div class="row">

        
        <!-- ================= ADMIN ONLY ================= -->
        <?php if (session()->get('role') === 'Admin') { ?>

            <div class="col-md-4">
                <div class="card dashboard-card mb-4 border-success">
                    <div class="card-body text-center">
                        <h5>Manage Employees</h5>
                        <p>Add / Edit / Delete</p>
                        <a href="<?= base_url('users') ?>" class="btn btn-success btn-sm">
                            Manage Users
                        </a>
                    </div>
                </div>
            </div>

            <div class="col-md-4">
                <div class="card dashboard-card mb-4 border-warning">
                    <div class="card-body text-center">
                        <h5>Attendance Report</h5>
                        <p>View & Download</p>
                        <a href="<?= base_url('reports') ?>" class="btn btn-warning btn-sm">
                            Open
                        </a>
                    </div>
                </div>
            </div>

        <?php } ?>

        <!-- ================= EMPLOYEE ONLY ================= -->
        <?php if (session()->get('role') === 'Employee') { ?>


			<div class="col-md-4">
            <div class="card dashboard-card mb-4">
                <div class="card-body text-center">
                    <h5>My Profile</h5>
                    <p>View your profile</p>
                   <a href="<?= base_url('my-profile') ?>" class="btn btn-primary btn-sm">View</a>
                </div>
            </div>
        </div>
            <div class="col-md-4">
                <div class="card dashboard-card mb-4 border-info">
                    <div class="card-body text-center">
                        <h5>Punch Attendance</h5>
                        <p>Punch In / Punch Out</p>
                        <a href="<?= base_url('attendance') ?>" class="btn btn-info btn-sm">
                            Open
                        </a>
                    </div>
                </div>
            </div>

            <div class="col-md-4">
                <div class="card dashboard-card mb-4 border-secondary">
                    <div class="card-body text-center">
                        <h5>My Attendance</h5>
                        <p>View my attendance history</p>
                        <a href="<?= base_url('my-attendance') ?>" class="btn btn-secondary btn-sm">
                            View
                        </a>
                    </div>
                </div>
            </div>

        <?php } ?>

    </div>
</div>
 <?= $this->include('admin/inc/footer') ?>
</body>
</html>
