<?php
/**
 * Debug Menu Links
 */
require_once __DIR__ . '/includes/init.php';
requireLogin();

header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html>
<head>
    <title>Menu Links Debug</title>
    <style>
        body { font-family: Arial; padding: 20px; }
        .link-test { margin: 10px 0; padding: 10px; border: 1px solid #ccc; }
        .link-test a { display: block; margin: 5px 0; color: blue; text-decoration: underline; }
    </style>
</head>
<body>
    <h1>Menu Links Debug</h1>
    <p><strong>BASE_URL:</strong> <?php echo BASE_URL; ?></p>
    <hr>
    
    <h2>Generated Links:</h2>
    <div class="link-test">
        <strong>Leave Management:</strong><br>
        <a href="<?php echo BASE_URL; ?>/modules/leave/list.php"><?php echo BASE_URL; ?>/modules/leave/list.php</a>
        <small>File exists: <?php echo file_exists(__DIR__ . '/modules/leave/list.php') ? 'YES' : 'NO'; ?></small>
    </div>
    
    <div class="link-test">
        <strong>Payroll:</strong><br>
        <a href="<?php echo BASE_URL; ?>/modules/payroll/list.php"><?php echo BASE_URL; ?>/modules/payroll/list.php</a>
        <small>File exists: <?php echo file_exists(__DIR__ . '/modules/payroll/list.php') ? 'YES' : 'NO'; ?></small>
    </div>
    
    <div class="link-test">
        <strong>Reports:</strong><br>
        <a href="<?php echo BASE_URL; ?>/modules/mis/index.php"><?php echo BASE_URL; ?>/modules/mis/index.php</a>
        <small>File exists: <?php echo file_exists(__DIR__ . '/modules/mis/index.php') ? 'YES' : 'NO'; ?></small>
    </div>
    
    <div class="link-test">
        <strong>Settings:</strong><br>
        <a href="<?php echo BASE_URL; ?>/admin/settings.php"><?php echo BASE_URL; ?>/admin/settings.php</a>
        <small>File exists: <?php echo file_exists(__DIR__ . '/admin/settings.php') ? 'YES' : 'NO'; ?></small>
    </div>
    
    <hr>
    <h2>Test Direct Navigation:</h2>
    <p><a href="<?php echo BASE_URL; ?>/modules/leave/list.php" target="_blank">Click Leave Management (New Tab)</a></p>
    <p><a href="<?php echo BASE_URL; ?>/modules/payroll/list.php" target="_blank">Click Payroll (New Tab)</a></p>
    <p><a href="<?php echo BASE_URL; ?>/modules/mis/index.php" target="_blank">Click Reports (New Tab)</a></p>
    <p><a href="<?php echo BASE_URL; ?>/admin/settings.php" target="_blank">Click Settings (New Tab)</a></p>
    
    <hr>
    <p><a href="<?php echo BASE_URL; ?>/index.php">Back to Dashboard</a></p>
</body>
</html>

