package view

templ ReportSection(report *ReportViewModel) {
	<div class="flex justify-between items-center mb-4 bg-base-200 p-4 rounded-lg">
		<h2 class="text-2xl font-bold">Your report</h2>
		<div class="flex items-center gap-2">
			<a class="btn btn-primary" href={ report.PdfUrl } target="_blank">Create PDF</a>
			<a class="btn btn-ghost" href="https://web.whatsapp.com/" target="_blank" rel="noreferrer noopener">
				<img src="/static/icons/whatsapp.png" class="w-8 h-8" alt="Share on WhatsApp"/>
			</a>
		</div>
	</div>
	<div class="overflow-auto">
		<table class="table table-zebra w-full">
			<thead>
				<tr>
					<th scope="col">ID</th>
					<th scope="col">Name</th>
					<th scope="col">From</th>
					<th scope="col">To</th>
					<th scope="col">Revenue (€)</th>
					<th scope="col">Platform</th>
					<th scope="col">Platform Fees (€)</th>
					<th scope="col">Fees (€)</th>
					<th scope="col">Profit (€)</th>
				</tr>
			</thead>
			<tbody>
				for _, row := range report.Lines {
					<tr>
						<th scope="row">
							<a href={ row.Url }>
								{ row.Id }
							</a>
						</th>
						<td>{ row.CustomerName }</td>
						<td>{ row.From }</td>
						<td>{ row.To }</td>
						<td>{ row.Total }</td>
						<td>{ row.Platform }</td>
						<td>{ row.PlatformFees }</td>
						<td>{ row.Fee }</td>
						<td>{ row.Profit }</td>
					</tr>
				}
			</tbody>
			<tfoot>
				<tr>
					<td scope="row">Totals</td>
					<td></td>
					<td></td>
					<td></td>
					<td>{ report.Total }</td>
					<td></td>
					<td>{ report.PlatformFees }</td>
					<td>{ report.Fee }</td>
					<td>{ report.Profit }</td>
				</tr>
				<tr>
					<td scope="row"></td>
					<td></td>
					<td></td>
					<td>Card-only: </td>
					<td>{ report.CardTotal }</td>
					<td>Booking-only:</td>
					<td>{ report.BookingFees }</td>
					<td></td>
					<td></td>
				</tr>
			</tfoot>
		</table>
	</div>
}
