<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Products Export</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            font-size: 12px;
            margin: 20px;
        }
        h1 {
            text-align: center;
            color: #333;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2;
            font-weight: bold;
        }
        .text-center {
            text-align: center;
        }
        .footer {
            margin-top: 30px;
            text-align: center;
            color: #666;
            font-size: 10px;
        }
    </style>
</head>
<body>
    <h1>Products Export Report</h1>
    <p><strong>Total Products:</strong> {{ $products->count() }}</p>
    <p><strong>Export Date:</strong> {{ now()->format('Y-m-d H:i:s') }}</p>

    @if($products->count() > 0)
        <table>
            <thead>
                <tr>
                    <th class="text-center">ID</th>
                    <th>Name</th>
                    <th>Description</th>
                    <th class="text-center">Exclude From Sales</th>
                    <th class="text-center">Created By</th>
                    <th class="text-center">Created At</th>
                    <th class="text-center">Updated At</th>
                </tr>
            </thead>
            <tbody>
                @foreach($products as $product)
                    <tr>
                        <td class="text-center">{{ $loop->iteration }}</td>
                        <td>{{ $product->name }}</td>
                        <td>{{ $product->description ?? 'N/A' }}</td>
                        <td class="text-center">{{ $product->exclude_from_sales ? 'Yes' : 'No' }}</td>
                        <td class="text-center">{{ $product->creator->name }}</td>
                        <td class="text-center">{{ $product->created_at }}</td>
                        <td class="text-center">{{ $product->updated_at }}</td>
                    </tr>
                @endforeach
            </tbody>
        </table>
    @else
        <p>No products found matching the specified criteria.</p>
    @endif

    <div class="footer">
        <p>Generated by CRM System - {{ $account->name }}</p>
    </div>
</body>
</html>
