rentease/internal/views/report_section.templ

93 lines
2 KiB
Text

package views
type ReportViewModel struct {
Total string
CardTotal string
PlatformFees string
Fee string
Profit string
Lines []*ReportLine
}
type ReportLine struct {
Id string
Url templ.SafeURL
Total string
CustomerName string
From string
To string
Platform string
PlatformFees string
Fee string
Profit string
}
templ ReportSection(report *ReportViewModel) {
<div class="grid">
<h2>Your report </h2>
<div>
<button class="outline">Create PDF</button>
<a href="https://web.whatsapp.com/" target="_blank" rel="noreferrer noopener"><img src="/static/icons/whatsapp.png" width="20px" style="width: 2rem; margin: 0 1rem"/></a>
</div>
</div>
<div class="overflow-auto">
<table class="striped">
<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></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
}