Untitled

Anonymous
plain_text
02/25/2026 6:32 AM
14.9 KB
11
Indexable
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Company HR System</title>
    <style>
        :root {
            --primary-color: #4f46e5;
            --secondary-color: #818cf8;
            --bg-color: #f3f4f6;
            --sidebar-bg: #1f2937;
            --text-light: #ffffff;
            --text-dark: #374151;
            --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            display: flex;
            min-height: 100vh;
            background-color: var(--bg-color);
        }

        /* Sidebar */
        .sidebar {
            width: 250px;
            background-color: var(--sidebar-bg);
            color: var(--text-light);
            padding: 20px;
            display: flex;
            flex-direction: column;
        }

        .logo {
            font-size: 1.5rem;
            font-weight: bold;
            margin-bottom: 40px;
            color: var(--secondary-color);
            text-align: center;
        }

        .nav-item {
            padding: 15px;
            cursor: pointer;
            border-radius: 8px;
            margin-bottom: 10px;
            transition: background 0.3s;
        }

        .nav-item:hover, .nav-item.active {
            background-color: var(--primary-color);
        }

        /* Main Content */
        .main-content {
            flex: 1;
            padding: 30px;
            overflow-y: auto;
        }

        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
        }

        h1 {
            color: var(--text-dark);
        }

        /* Dashboard View */
        .dashboard-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
        }

        .dept-card {
            background: white;
            padding: 30px;
            border-radius: 12px;
            box-shadow: var(--card-shadow);
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
            text-align: center;
            border-top: 5px solid var(--primary-color);
        }

        .dept-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        }

        .dept-icon {
            font-size: 2rem;
            margin-bottom: 15px;
            display: block;
        }

        .dept-title {
            font-size: 1.2rem;
            font-weight: bold;
            color: var(--text-dark);
        }

        .dept-count {
            color: #6b7280;
            font-size: 0.9rem;
            margin-top: 5px;
        }

        /* Department Detail View (Hidden by default) */
        .view-section {
            display: none;
        }

        .view-section.active {
            display: block;
        }

        .back-btn {
            background: none;
            border: 1px solid var(--text-dark);
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            margin-bottom: 20px;
            font-weight: bold;
        }

        .back-btn:hover {
            background: #e5e7eb;
        }

        /* Employee Table */
        table {
            width: 100%;
            border-collapse: collapse;
            background: white;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: var(--card-shadow);
        }

        th, td {
            padding: 15px;
            text-align: left;
            border-bottom: 1px solid #e5e7eb;
        }

        th {
            background-color: #f9fafb;
            color: #6b7280;
            font-weight: 600;
        }

        tr:last-child td {
            border-bottom: none;
        }

        .status {
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 0.8rem;
        }
        .status.active { background: #d1fae5; color: #065f46; }
        .status.leave { background: #fee2e2; color: #991b1b; }

    </style>
</head>
<body>

    <!-- Sidebar -->
    <div class="sidebar">
        <div class="logo">HR Nexus</div>
        <div class="nav-item active" onclick="switchView('dashboard')">Dashboard</div>
        <div class="nav-item" onclick="alert('Feature coming soon')">Employees</div>
        <div class="nav-item" onclick="alert('Feature coming soon')">Recruitment</div>
        <div class="nav-item" onclick="alert('Feature coming soon')">Payroll</div>
        <div class="nav-item" onclick="alert('Feature coming soon')">Settings</div>
    </div>

    <!-- Main Content -->
    <div class="main-content">
        
        <!-- DASHBOARD VIEW -->
        <div id="dashboard-view" class="view-section active">
            <header>
                <h1>Company Dashboard</h1>
                <div>Welcome, Admin</div>
            </header>
            
            <div class="dashboard-grid">
                <!-- These buttons trigger the department view -->
                <div class="dept-card" onclick="openDepartment('Engineering')">
                    <span class="dept-icon">💻</span>
                    <div class="dept-title">Engineering</div>
                    <div class="dept-count">12 Employees</div>
                </div>

                <div class="dept-card" onclick="openDepartment('Marketing')">
                    <span class="dept-icon">📢</span>
                    <div class="dept-title">Marketing</div>
                    <div class="dept-count">8 Employees</div>
                </div>

                <div class="dept-card" onclick="openDepartment('Sales')">
                    <span class="dept-icon">💼</span>
                    <div class="dept-title">Sales</div>
                    <div class="dept-count">15 Employees</div>
                </div>

                <div class="dept-card" onclick="openDepartment('Human Resources')">
                    <span class="dept-icon">👥</span>
                    <div class="dept-title">Human Resources</div>
                    <div class="dept-count">4 Employees</div>
                </div>

                <div class="dept-card" onclick="openDepartment('Design')">
                    <span class="dept-icon">🎨</span>
                    <div class="dept-title">Design</div>
                    <div class="dept-count">6 Employees</div>
                </div>
                
                <div class="dept-card" onclick="openDepartment('Finance')">
                    <span class="dept-icon">📊</span>
                    <div class="dept-title">Finance</div>
                    <div class="dept-count">5 Employees</div>
                </div>
            </div>
        </div>

        <!-- DEPARTMENT DETAIL VIEW -->
        <div id="dept-view" class="view-section">
            <button class="back-btn" onclick="switchView('dashboard')">← Back to Dashboard</button>
            <header>
                <h1 id="dept-title-header">Department Name</h1>
            </header>

            <table>
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Name</th>
                        <th>Role</th>
                        <th>Email</th>
                        <th>Status</th>
                    </tr>
                </thead>
                <tbody id="employee-table-body">
                    <!-- Javascript will populate this -->
                </tbody>
            </table>
        </div>

    </div>

    <script>
        // Mock Data for Employees
        const employees = [
            { id: 101, name: "Alice Johnson", role: "Senior Developer", dept: "Engineering", email: "[email protected]", status: "Active" },
            { id: 102, name: "Bob Smith", role: "DevOps Engineer", dept: "Engineering", email: "[email protected]", status: "Active" },
            { id: 103, name: "Charlie Brown", role: "Junior Dev", dept: "Engineering", email: "[email protected]", status: "On Leave" },
            { id: 201, name: "Diana Prince", role: "Marketing Manager", dept: "Marketing", email: "[email protected]", status: "Active" },
            { id: 202, name: "Evan Wright", role: "Content Creator", dept: "Marketing", email: "[email protected]", status: "Active" },
            { id: 301, name: "Frank Castle", role: "Sales Lead", dept: "Sales", email: "[email protected]", status: "Active" },
            { id: 302, name: "Grace Hopper", role: "Sales Rep", dept: "Sales", email: "[email protected]", status: "Active" },
            { id: 401, name: "Hank Pym", role: "HR Director", dept: "Human Resources", email: "[email protected]", status: "Active" },
            { id: 501, name: "Ivy Verde", role: "UI/UX Designer", dept: "Design", email: "[email protected]", status: "Active" },
            { id: 601, name: "Jack Doe", role: "Accountant", dept: "Finance", email: "[email protected]", status: "Active" },
        ];

        // Function to switch between main views
        function switchView(viewName) {
            // Hide all views
            document.querySelectorAll('.view-section').forEach(el => el.classList.remove('active'));
            
            if(viewName === 'dashboard') {
                document.getElementById('dashboard-view').classList.add('active');
            } else if (viewName === 'dept') {
                document.getElementById('dept-view').classList.add('active');
            }
        }

        // Function to open a specific department
        function openDepartment(deptName) {
            // 1. Update Header
            document.getElementById('dept-title-header').innerText = deptName + " Department";

            // 2. Filter Employees
            const filteredEmployees = employees.filter(emp => emp.dept === deptName);

            // 3. Render Table
            const tbody = document.getElementById('employee-table-body');
            tbody.innerHTML = ""; // Clear existing

            if(filteredEmployees.length === 0) {
                tbody.innerHTML = "<tr><td colspan='5'>No employees found in this department.</td></tr>";
            } else {
                filteredEmployees.forEach(emp => {
                    const statusClass = emp.status === "Active" ? "active" : "leave";
                    const row = `
                        <tr>
                            <td>#${emp.id}</td>
                            <td>${emp.name}</td>
                            <td>${emp.role}</td>
                            <td>${emp.email}</td>
                            <td><span class="status ${statusClass}">${emp.status}</span></td>
                        </tr>
                    `;
                    tbody.innerHTML += row;
                });
            }

            // 4. Switch View
            switchView('dept');
        }
    </script>
</body>
</html>
Editor is loading...
Leave a Comment