<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <style type="text/css">
        body { font-family: "DejaVu Sans", Helvetica, Arial, sans-serif; color: #222; font-size: 10px; }
        .head { border-bottom: 2px solid #f7941d; padding-bottom: 8px; margin-bottom: 12px; }
        .brand { font-size: 18px; font-weight: bold; color: #f7941d; }
        .title { font-size: 14px; font-weight: bold; margin-top: 3px; }
        table.items { width: 100%; border-collapse: collapse; margin-top: 10px; }
        table.items th { text-align: left; border-bottom: 1px solid #999; padding: 4px 3px; font-size: 9px; }
        table.items td { padding: 4px 3px; border-bottom: 1px solid #eee; font-size: 9px; }
        table.summary { width: 50%; border-collapse: collapse; margin-top: 14px; }
        table.summary td { padding: 3px 0; }
        td.amt { text-align: right; }
        tr.tot td { border-top: 2px solid #222; font-weight: bold; }
    </style>
</head>
<body>
<div class="head">
    <div class="brand" th:text="${orgName}">MV Rent</div>
    <div class="title">BOOKINGS REPORT</div>
</div>

<table class="items">
    <thead>
    <tr><th>ID</th><th>Customer</th><th>Car</th><th>Driver</th><th>Owner</th><th>Pickup</th><th>Return</th><th>Vehicle</th><th>Tax</th><th>Total</th><th>Status</th></tr>
    </thead>
    <tbody>
    <tr th:each="b : ${bookings}">
        <td th:text="${b.id}">1</td>
        <td th:text="${b.user.fullName}">name</td>
        <td th:text="${b.car.make + ' ' + b.car.model}">car</td>
        <td th:text="${b.withDriver and b.driver != null ? b.driver.name : 'Self-drive'}">Self</td>
        <td th:text="${b.revenueOwner}">OWNED</td>
        <td th:text="${b.pickupDate}">date</td>
        <td th:text="${b.returnDate}">date</td>
        <td th:text="${currencySymbol + b.vehicleCharge}">0</td>
        <td th:text="${currencySymbol + b.taxAmount}">0</td>
        <td th:text="${currencySymbol + b.totalAmount}">0</td>
        <td th:text="${b.status}">PENDING</td>
    </tr>
    <tr th:if="${#lists.isEmpty(bookings)}"><td colspan="11">No bookings match the filters.</td></tr>
    </tbody>
</table>

<table class="summary">
    <tr><td>Bookings</td><td class="amt" th:text="${summary.count}">0</td></tr>
    <tr><td>Gross (vehicle)</td><td class="amt" th:text="${currencySymbol + summary.gross}">0</td></tr>
    <tr><td>Driver charges</td><td class="amt" th:text="${currencySymbol + summary.driverCharges}">0</td></tr>
    <tr><td>Tax</td><td class="amt" th:text="${currencySymbol + summary.tax}">0</td></tr>
    <tr><td>Commission</td><td class="amt" th:text="${currencySymbol + summary.commission}">0</td></tr>
    <tr class="tot"><td>Total</td><td class="amt" th:text="${currencySymbol + summary.total}">0</td></tr>
</table>
</body>
</html>
