PYBS (Personel Yönetim Bilgi Sistemi) / Ramsa/includes/header.php
header.php 198 satır • 6.58 KB
<?php
// includes/header.php
require_once __DIR__ . '/../config/db.php';
require_once __DIR__ . '/../config/functions.php';

// Oturum Kontrolü
if (!isset($_SESSION['kullanici_id'])) {
    header("Location: ../index.php");
    exit;
}

$ad_soyad = $_SESSION['ad_soyad'];
$rol = $_SESSION['rol'];

$rol_etiketleri = [
    'root' => 'Sistem Yöneticisi',
    'yonetici' => 'Yönetici',
    'mudur' => 'Müdür',
    'vardiya_amiri' => 'Vardiya Amiri',
    'muhasebe' => 'Muhasebe',
    'insan_kaynaklari' => 'İnsan Kaynakları',
    'calisan' => 'Personel',
    'stajyer' => 'Stajyer'
];
$gosterilen_rol = $rol_etiketleri[$rol] ?? $rol;

$bildirim_sayisi = 0;
if (function_exists('bildirimSayisi')) {
    $bildirim_sayisi = bildirimSayisi($pdo, $_SESSION['kullanici_id']);
}
?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Ramsa PYBS</title>
    <link rel="icon" type="image/png" href="../assets/img/logo.png">
    
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    
    <style>
        :root {
            --ramsa-blue: #2A7BB8;
            --ramsa-yellow: #F3B01B;
            --sidebar-width: 260px;
            --sidebar-bg: #212529;
        }
        
        body {
            background-color: #F4F6F9;
            margin: 0;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            overflow-x: hidden; 
        }

        /* Navbar */
        .navbar-custom {
            background-color: var(--ramsa-blue);
            color: white;
            min-height: 60px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            z-index: 1030;
            position: relative;
        }
        .navbar-brand { font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; color: white !important; }
        .navbar-brand img { height: 35px; margin-right: 10px; background: white; border-radius: 4px; padding: 2px; }

        /* MOBİL MENÜ TETİKLEYİCİ BAR */
        #mobile-menu-trigger {
            background-color: #1e5c8e; /* Headerdan biraz daha koyu */
            color: white;
            text-align: center;
            padding: 12px;
            font-weight: bold;
            cursor: pointer;
            user-select: none;
            display: none; /* Masaüstünde gizli */
            width: 100%;
            box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
        }
        #mobile-menu-trigger:active {
            background-color: #154a75;
        }

        /* Wrapper */
        .wrapper {
            display: flex;
            width: 100%;
            position: relative;
        }

        /* --- SIDEBAR --- */
        #sidebar {
            min-width: var(--sidebar-width);
            max-width: var(--sidebar-width);
            background: var(--sidebar-bg);
            color: #fff;
            transition: all 0.3s;
            z-index: 9999; /* En üstte */
        }

        #sidebar ul.components { padding: 0; margin: 0; list-style: none; }
        #sidebar ul li { border-bottom: 1px solid rgba(255,255,255,0.05); }
        #sidebar ul li a { padding: 15px 20px; display: block; color: rgba(255,255,255,0.8); text-decoration: none; }
        #sidebar ul li a:hover { color: #fff; background: rgba(255,255,255,0.1); }
        #sidebar ul li a.active { color: #fff; background: var(--ramsa-blue); }

        #content { width: 100%; padding: 20px; flex-grow: 1; }

        /* --- MASAÜSTÜ --- */
        @media (min-width: 769px) {
            #sidebar { margin-left: 0; }
            #sidebar-overlay { display: none !important; }
        }

        /* --- MOBİL --- */
        @media (max-width: 768px) {
            /* Mobil Menü Barı Görünür Olsun */
            #mobile-menu-trigger { display: block; }
            
            /* Sidebar Başlangıçta Gizli (Ekran Solunda) */
            #sidebar {
                position: fixed;
                top: 0;
                left: 0;
                height: 100vh;
                margin-left: -100%; /* Sola sakla */
                width: 75%; /* Ekranın %75'ini kaplasın */
                max-width: 300px;
            }

            /* Sidebar Aktif Olduğunda */
            #sidebar.active {
                margin-left: 0 !important; /* İçeri kaydır */
                box-shadow: 10px 0 50px rgba(0,0,0,0.5);
            }

            .navbar-brand { font-size: 1rem; }
            .btn-cikis-text { display: none; }

            /* Overlay */
            #sidebar-overlay {
                display: none;
                position: fixed;
                width: 100vw;
                height: 100vh;
                background: rgba(0, 0, 0, 0.7);
                z-index: 9998; /* Sidebar'ın hemen altında */
                top: 0;
                left: 0;
            }
            #sidebar-overlay.active { display: block; }
        }
        
        .card-box { background: #fff; border-radius: 10px; border-top: 4px solid var(--ramsa-blue); }
    </style>
</head>
<body>

<div id="sidebar-overlay"></div>

<nav class="navbar navbar-expand-lg navbar-custom">
    <div class="container-fluid">
        <a class="navbar-brand" href="#">
            <img src="../assets/img/logo.png" alt="Logo">
            <span class="d-md-none">Ramsa PYBS</span>
            <span class="d-none d-md-inline">RAMSA Personel YBS</span>
        </a>

        <div class="ms-auto d-flex align-items-center">
            <a href="../modules/bildirimler.php" class="text-white me-3 text-decoration-none">
                <i class="fas fa-bell fa-lg"></i>
                <?php if($bildirim_sayisi > 0): ?>
                    <span class="badge rounded-pill bg-danger" style="font-size: 0.6rem; vertical-align: top;">
                        <?php echo $bildirim_sayisi; ?>
                    </span>
                <?php endif; ?>
            </a>

            <div class="d-none d-md-block text-end me-3 text-white" style="line-height: 1.2;">
                <div style="font-size: 0.9rem;"><?php echo guvenlik($ad_soyad); ?></div>
                <small style="font-size: 0.75rem; opacity: 0.8;"><?php echo $gosterilen_rol; ?></small>
            </div>
            
            <a href="../cikis.php" class="btn btn-danger btn-sm rounded-pill px-3">
                <i class="fas fa-power-off"></i> <span class="btn-cikis-text ms-1">Çıkış</span>
            </a>
        </div>
    </div>
</nav>

<div id="mobile-menu-trigger">
    <i class="fas fa-bars me-2"></i> MENÜ
</div>

<div class="wrapper">