<?php
/**
 * Test Links - Debug menu links
 */
require_once __DIR__ . '/includes/init.php';
requireLogin();

echo "<h1>Link Test</h1>";
echo "<p>BASE_URL: " . BASE_URL . "</p>";
echo "<hr>";

$links = [
    'Leave Management' => BASE_URL . '/modules/leave/list.php',
    'Payroll' => BASE_URL . '/modules/payroll/list.php',
    'Reports' => BASE_URL . '/modules/mis/index.php',
    'Settings' => BASE_URL . '/admin/settings.php',
];

echo "<h2>Test Links:</h2>";
echo "<ul>";
foreach ($links as $name => $url) {
    $filePath = str_replace(BASE_URL, __DIR__, $url);
    $exists = file_exists($filePath);
    $status = $exists ? '✅ EXISTS' : '❌ NOT FOUND';
    echo "<li><strong>{$name}</strong>: <a href='{$url}' target='_blank'>{$url}</a> - {$status}</li>";
    echo "<br>File Path: {$filePath}<br><br>";
}
echo "</ul>";

echo "<hr>";
echo "<h2>Direct File Check:</h2>";
$files = [
    __DIR__ . '/modules/leave/list.php',
    __DIR__ . '/modules/payroll/list.php',
    __DIR__ . '/modules/mis/index.php',
    __DIR__ . '/admin/settings.php',
];

foreach ($files as $file) {
    $exists = file_exists($file);
    echo "<p>" . ($exists ? '✅' : '❌') . " " . basename($file) . " - " . $file . "</p>";
}

