@using RazorLight
@inherits TemplatePage<Elwig.Documents.DeliveryAncmtList>
@model Elwig.Documents.DeliveryAncmtList
@{ Layout = "Document"; }
<link rel="stylesheet" href="file:///@Raw(Model.DocumentsPath)\DeliveryAncmtList.css" />
<main>
    <h1>Anmeldeliste</h1>
    <h2>@Model.Filter</h2>
    <table class="announcement-list">
        <colgroup>
            <col style="width: 15mm;"/>
            <col style="width: 12mm;"/>
            <col style="width: 50mm;"/>
            <col style="width: 25mm;"/>
            <col style="width: 38mm;"/>
            <col style="width: 11mm;"/>
            <col style="width: 14mm;"/>
        </colgroup>
        <thead>
            <tr>
                <th rowspan="2">Datum</th>
                <th rowspan="2">MgNr.</th>
                <th rowspan="2" style="text-align: left;">Mitglied</th>
                <th rowspan="2" style="text-align: left;">Ort</th>
                <th rowspan="2" style="text-align: left;">Sorte</th>
                <th rowspan="2">Anmldg.</th>
                <th>Menge</th>
            </tr>
            <tr>
                <th class="unit">[kg]</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var a in Model.Announcements) {
                <tr>
                    <td class="small">@($"{a.Date:dd.MM.yyyy}")</td>
                    <td class="number">@a.MgNr</td>
                    <td>@a.AdministrativeName</td>
                    <td class="small">@a.DefaultKg</td>
                    <td>@a.Variety</td>
                    <td class="small center">@(a.Status ?? "-")</td>
                    <td class="number">@($"{a.Weight:N0}")</td>
                </tr>
            }
            <tr class="sum bold">
                <td colspan="2">Gesamt:</td>
                <td colspan="3">Anmeldungen: @($"{Model.Announcements.Count():N0}")</td>
                <td colspan="2" class="number">@($"{Model.Announcements.Sum(a => a.Weight):N0}")</td>
            </tr>
        </tbody>
    </table>
</main>
