<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Import Transit Report</title>
    <style>
        body {
            font-family: 'Segoe UI', Arial, sans-serif;
            background-color: #f9fafb;
            color: #333;
            margin: 0;
            padding: 0;
        }
        h2 {
            color: #215c98;
            text-align: center;
            margin-bottom: 20px;
        }
        table {
            border-collapse: collapse;
            width: 100%;
            font-size: 10px;
            white-space: nowrap !important;
        }
        th, td {
            border: 1px solid #020813da;
            padding: 8px 10px;
            text-align: left;
            white-space: nowrap !important;
            text-overflow: ellipsis;
        }
        .td-left {
            text-align: left !important;
        }
        th {
            background-color: #215c98;
            color: #fff;
            white-space: nowrap !important;
        }
        tr:nth-child(even) {
            background-color: #f3f4f6;
        }

        .status-column {
            text-align: left !important;
            white-space: normal !important;
            min-width: 250px;
            width: 250px;
            vertical-align: top;
        }
        .footer {
            text-align: center;
            font-size: 13px;
            color: #6b7280;
            margin-top: 30px;
        }
    </style>
</head>
<body>
    <div style="text-align: center; font-weight: bold;">
        {{ $company }}
    </div>
    <br>
    <p>{!! $greeting !!}</p>
    <div class="container">
        @if(empty($tableData))
            <p style="text-align:center;">No invoice in transit data available.</p>
        @else
            <table>
                <thead>
                    <tr>
                        <th>No</th>
                        <th>CRI RFQ Number</th>
                        <th>Requestor</th>
                        <th>Shipper</th>
                        <th>Shipper Location</th>
                        <th>Shipper Invoice</th>
                        <th>Shipper Invoice Date</th>
                        <th>Custom Agent Name</th>
                        <th>ETA</th>
                        <th>Status</th>
                        <th>Delivery Location</th>
                        <th>ETD Date</th>
                        <th>Remark</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($tableData as $row)
                <tr style="{{ $row['is_transit_identified'] == 1 ? 'background-color:#FFFF00;' . 'font-weight: bold;' : '' }}">
                    <td>{{ $loop->iteration }}</td>
                    <td>{{ $row['cri_rfq_number'] }}</td>
                    <td>{{ $row['requester'] }}</td>
                    <td>{{ $row['shipper'] }}</td>
                    <td>{{ $row['shipper_location'] }}</td>
                    <td>{{ $row['shipper_invoice'] }}</td>
                    {{-- <td>{{ \Carbon\Carbon::parse($row['shipper_invoice_date'])->format('Y-m-d') }}</td> --}}
                    <td>
                        {{ !empty($row['shipper_invoice_date']) ? \Carbon\Carbon::parse($row['shipper_invoice_date'])->format('Y-m-d') : '' }}
                    </td>
                    <td>{{ $row['customs_agent_name'] }}</td>
                    {{-- <td>{{ \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') }}</td> --}}
                    <td>
                        {{ !empty($row['eta_date']) ? \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') : '' }}
                    </td>
                    <td class="status-column">
                        {{ $row['status'] }}
                    </td>
                    <td>{{ $row['delivery_location'] }}</td>
                    {{-- <td>{{ \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') }}</td> --}}
                    <td>
                        {{ !empty($row['etd_date']) ? \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') : '' }}
                    </td>
                    <td>
                        {{ $row['remark'] }}
                    </td>
                </tr>
                @endforeach
                </tbody>
            </table>
        @endif
        <p>{!! $wishes !!}</p>
    </div>
</body>
</html>
