<?php
session_start();
if (isset($_SESSION['username'], $_SESSION['userid']) && 
    !empty($_SESSION['username']) && 
    !empty($_SESSION['userid'])) {
} else {
    header("Location: login.html");
}
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8"> <!-- Sets character encoding for the document -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Ensures responsive behavior on mobile -->
    <title>Dashboard</title> <!-- Title shown in browser tab -->

    <!-- Link to external CSS file for styling -->
    <link rel="stylesheet" href="main.css">
    <link rel="shortcut icon" href="data/favicon.ico" type="image/x-icon">
</head>

<body class="landingphp" onclick="hideNavigation()">
    <?php include "navigation.html"?>
    <button class="menuButton" id="menu" title="Menu" onclick="event.stopPropagation(); toggleNavigation()">☰</button>

    <!-- Main heading of the page -->
    <h1>Welcome <?php echo $_SESSION['uname']; ?></h1>
    <div class="mainDiv" id="mainDiv">
        <div class="homepageCards" id="financeLinks" style="background-image: url(data/favicon.ico);">
            <div class="navigationByCards">
                <img src="data/favicon.ico" alt="">
                Finance dashboard links
                <button onclick="window.location.href = 'main2.php' ">View</button>
                <button onclick="window.location.href = 'universal_upload.php?type=finance' ">Add Data</button>
            </div>
        </div>
        <div class="homepageCards" id="itSalesLinks" style="background-image: url(data/IT_SALES.png);">
            <div class="navigationByCards">
                <img src="data/IT_SALES.png" alt="">
                Sales dashboard links
                <button onclick="window.location.href = 'sales_dashboard.php' ">View</button>
                <button onclick="window.location.href = 'universal_upload.php?type=sales' ">Add Data</button>
            </div>
        </div>
        <div class="homepageCards" id="salesAnalyticsLinks" style="background-image: url(data/SALES\ ANALYTICS.png);">
            <div class="navigationByCards">
                <img src="data/SALES ANALYTICS.png" alt="">
                Sales Analytics dashboard links
                <button onclick="window.location.href = 'salesAnalytics.php' ">View</button>
                <button onclick="window.location.href = 'universal_upload.php?type=sales' ">Add Data</button>
            </div>
        </div>
        <div class="homepageCards" id="otherLinks">

            <div class="navigationByCards">
                <img src="data/favicon.ico" alt="">
                coming soon...
                <button onclick="window.location.href = '#' ">View</button>
                <button onclick="window.location.href = '#' ">Add Data</button>
            </div>
        </div>
        <div class="homepageCards" id="otherLinks">

            <div class="navigationByCards">
                <img src="data/IT_SALES.png" alt="">
                coming soon...
                <button onclick="window.location.href = '#' ">View</button>
                <button onclick="window.location.href = '#' ">Add Data</button>
            </div>
        </div>
        <div class="homepageCards" id="otherLinks">

            <div class="navigationByCards">
                <img src="data/SALES ANALYTICS.png" alt="">
                coming soon...
                <button onclick="window.location.href = '#' ">View</button>
                <button onclick="window.location.href = '#' ">Add Data</button>
            </div>
        </div>
        <div class="homepageCards" id="otherLinks" style="background-image: url(data/avatar.jpg);">
            <div class="navigationByCards">
                <img src="DATA/<?php echo $_SESSION["profile_photo"] ?? "avatar.jpg" ?>" alt="">
                Profile
                <button onclick="window.location.href='profile.php'">View</button>
            </div>
        </div>
    </div>

</body>

</html>