<!--
 SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
 SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
    {{( pgettext "Payments" "title" )}}
{{- end }}

{{ define "breadcrumb" -}}
{{- end }}

{{ define "content" -}}
    {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/payment.paymentIndex*/ -}}
    <a href="/admin/payments/settings">{{( pgettext "Payment Settings" "title" )}}</a>
    <h2>{{ template "title" . }}</h2>
    {{ if .Payments -}}
        <table>
            <thead>
            <tr>
                <th scope="col">{{( pgettext "Date" "header" )}}</th>
                <th scope="col">{{( pgettext "Reference" "header" )}}</th>
                <th scope="col">{{( pgettext "Status" "header" )}}</th>
                <th class="numeric" scope="col">{{( pgettext "Down payment" "header" )}}</th>
                <th class="numeric" scope="col">{{( pgettext "Total" "header" )}}</th>
            </tr>
            </thead>
            <tbody>
            {{ range .Payments -}}
                <tr class="payment-{{ .Status }}">
                    <td>{{ .CreatedAt | formatDate }}</td>
                    <td><a href="{{ .URL }}">{{ .Reference }}</a></td>
                    <td class="payment-status">{{ .StatusLabel }}</td>
                    <td class="numeric">{{ .DownPayment | formatPrice }}</td>
                    <td class="numeric">{{ .Total | formatPrice }}</td>
                </tr>
            {{- end }}
            </tbody>
        </table>
    {{ else -}}
        <p>{{( gettext "No payments found." )}}</p>
    {{- end }}
{{- end }}
