<!DOCTYPE html>
<html>
<head>
    <title>{{ $allocation->allocation_number }} - Print</title>
    <style>
        body { font-family: Arial, sans-serif; font-size: 12px; margin: 20px; }
        .header { text-align: center; margin-bottom: 20px; border-bottom: 2px solid #333; padding-bottom: 10px; }
        .header h2 { margin: 0; }
        .details td { padding: 4px 8px; vertical-align: top; }
        .details .label { font-weight: bold; color: #555; width: 30%; }
        .items-table { width: 100%; border-collapse: collapse; margin: 20px 0; }
        .items-table th, .items-table td { border: 1px solid #ddd; padding: 6px 8px; }
        .items-table th { background-color: #f5f5f5; font-weight: bold; }
        .footer { margin-top: 60px; display: flex; justify-content: space-between; }
        .signature { width: 30%; text-align: center; border-top: 1px solid #333; padding-top: 5px; }
        @media print { body { margin: 0; } }
    </style>
</head>
<body onload="window.print()">
    <div class="header">
        <h2>Asset Allocation</h2>
        <p>{{ $allocation->allocation_number }}</p>
    </div>
    <table class="details" style="width:100%;">
        <tr><td class="label">Project:</td><td>{{ $allocation->project ? $allocation->project->project_name : '-' }}</td><td class="label">Status:</td><td>{{ ucfirst($allocation->status) }}</td></tr>
        <tr><td class="label">Requested By:</td><td>{{ $allocation->requester ? $allocation->requester->name : '-' }}</td><td class="label">Date:</td><td>{{ $allocation->created_at ? $allocation->created_at->format('M d, Y') : '-' }}</td></tr>
        <tr><td class="label">Purpose:</td><td colspan="3">{{ $allocation->purpose ?? '-' }}</td></tr>
    </table>
    <table class="items-table">
        <thead><tr><th>#</th><th>Asset Code</th><th>Asset Name</th><th>Category</th><th>Condition</th></tr></thead>
        <tbody>
            @foreach($allocation->items as $i => $item)
            <tr>
                <td>{{ $i + 1 }}</td>
                <td>{{ $item->fixedAsset ? $item->fixedAsset->asset_code : '-' }}</td>
                <td>{{ $item->fixedAsset ? $item->fixedAsset->asset_name : '-' }}</td>
                <td>{{ $item->fixedAsset && $item->fixedAsset->category ? $item->fixedAsset->category->category_name : '-' }}</td>
                <td>{{ ucfirst($item->condition_at_allocation ?? '-') }}</td>
            </tr>
            @endforeach
        </tbody>
    </table>
    <div class="footer" style="display:flex;justify-content:space-between;margin-top:60px;">
        <div class="signature">Allocated By</div>
        <div class="signature">Received By</div>
    </div>
</body>
</html>
