rentease/internal/view/report_section.templ
Ruidy 584d81f7bd
Some checks failed
CI / checks (push) Has been cancelled
feat(i18n): add language toggle and localize views
2026-01-09 16:09:20 -04:00

75 lines
2.4 KiB
Text

package view
import "github.com/rjNemo/rentease/internal/i18n"
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">{ i18n.Localize(ctx, "report.section.title") }</h2>
<div class="flex items-center gap-2">
<a class="btn btn-primary" href={ report.PdfUrl } target="_blank">{ i18n.Localize(ctx, "report.section.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">{ i18n.Localize(ctx, "report.table.id") }</th>
<th scope="col">{ i18n.Localize(ctx, "report.table.name") }</th>
<th scope="col">{ i18n.Localize(ctx, "report.table.from") }</th>
<th scope="col">{ i18n.Localize(ctx, "report.table.to") }</th>
<th scope="col">{ i18n.Localize(ctx, "report.table.revenue") } (€)</th>
<th scope="col">{ i18n.Localize(ctx, "report.table.platform") }</th>
<th scope="col">{ i18n.Localize(ctx, "report.table.platform_fees") } (€)</th>
<th scope="col">{ i18n.Localize(ctx, "report.table.fees") } (€)</th>
<th scope="col">{ i18n.Localize(ctx, "report.table.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">{ i18n.Localize(ctx, "report.table.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>{ i18n.Localize(ctx, "report.table.card_only") }: </td>
<td>{ report.CardTotal }</td>
<td>{ i18n.Localize(ctx, "report.table.booking_only") }:</td>
<td>{ report.BookingFees }</td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
}