<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Staff Report</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            font-size: 12px;
            line-height: 1.4;
            color: #333;
        }
        .header {
            text-align: center;
            border-bottom: 2px solid #333;
            padding-bottom: 20px;
            margin-bottom: 30px;
        }
        .header h1 {
            margin: 0;
            color: #2d3748;
            font-size: 24px;
        }
        .header p {
            margin: 5px 0;
            color: #718096;
        }
        .summary {
            margin-bottom: 30px;
        }
        .summary-grid {
            display: table;
            width: 100%;
            border-collapse: collapse;
        }
        .summary-cell {
            display: table-cell;
            width: 33.33%;
            padding: 10px;
            text-align: center;
            border: 1px solid #e2e8f0;
        }
        .summary-cell h3 {
            margin: 0 0 5px 0;
            font-size: 14px;
            color: #4a5568;
        }
        .summary-cell .value {
            font-size: 18px;
            font-weight: bold;
            color: #2d3748;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }
        th, td {
            border: 1px solid #e2e8f0;
            padding: 8px;
            text-align: left;
        }
        th {
            background-color: #f7fafc;
            font-weight: bold;
            color: #4a5568;
        }
        .footer {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px solid #e2e8f0;
            text-align: center;
            color: #718096;
            font-size: 10px;
        }
    </style>
</head>
<body>
    <div class="header">
        <h1>Hotel Management System</h1>
        <p>Staff Report</p>
        <p>Generated: {{ now()->format('M d, Y H:i:s') }}</p>
    </div>

    <div class="summary">
        <h2>Staff Summary Statistics</h2>
        <div class="summary-grid">
            <div class="summary-cell">
                <h3>Total Staff</h3>
                <div class="value">{{ $summary['total_staff'] }}</div>
            </div>
            <div class="summary-cell">
                <h3>Departments</h3>
                <div class="value">{{ $summary['by_staff_type']->count() }}</div>
            </div>
            <div class="summary-cell">
                <h3>Active Shifts</h3>
                <div class="value">{{ $summary['by_shift']->count() }}</div>
            </div>
        </div>
    </div>

    @if($staffTypeAnalysis->count() > 0)
    <div class="summary">
        <h2>Department Analysis</h2>
        <table>
            <thead>
                <tr>
                    <th>Department</th>
                    <th>Staff Count</th>
                    <th>Staff Members</th>
                </tr>
            </thead>
            <tbody>
                @foreach($staffTypeAnalysis as $staffType => $data)
                    <tr>
                        <td><strong>{{ $staffType }}</strong></td>
                        <td>{{ $data['count'] }}</td>
                        <td>{{ implode(', ', $data['names']) }}</td>
                    </tr>
                @endforeach
            </tbody>
        </table>
    </div>
    @endif

    <h2>Detailed Staff Information</h2>
    <table>
        <thead>
            <tr>
                <th>Employee Name</th>
                <th>Department</th>
                <th>Contact</th>
                <th>Shift</th>
                <th>ID Card</th>
            </tr>
        </thead>
        <tbody>
            @foreach($staff as $employee)
                <tr>
                    <td>
                        <strong>{{ $employee->first_name }} {{ $employee->last_name }}</strong><br>
                        <small>{{ $employee->email }}</small>
                    </td>
                    <td>{{ $employee->staffType->staff_type ?? 'N/A' }}</td>
                    <td>{{ $employee->contact_no ?? 'N/A' }}</td>
                    <td>{{ $employee->shift->shift_name ?? 'N/A' }}</td>
                    <td>
                        {{ $employee->idCardType->id_card_type ?? 'N/A' }}<br>
                        <small>{{ $employee->id_card_no ?? 'N/A' }}</small>
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>

    <div class="footer">
        <p>This report was generated automatically by the Hotel Management System</p>
        <p>For any questions, please contact the system administrator</p>
    </div>
</body>
</html> 