<!DOCTYPE html>
<html lang="de" dir="ltr" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.75, user-scalable=no">

    <title>Alle Buchungen</title>
    <script th:src="@{/js/filterTable.js}"></script>
    <link rel="stylesheet" th:href="@{/css/ecom.css}"/>
</head>

<body>
<nav th:replace="fragments/header :: header">Header</nav>
<div class="sidebar-layout content-width">
    <nav></nav>
    <div>
        <h1>Alle Buchungen</h1>

        <script th:src="@{/js/back.js}"></script>
        <div class="back" data-group="intern" data-name="Zurück zu allen Buchungen." data-insert="false"></div>
    </div>
</div>
<main class="sidebar-layout content-width">
    <nav th:replace="fragments/intern :: sidebar"></nav>
    <div class="content-width">
        <h2> Manuelle Buchung </h2>
        <p>
            Buchungen können manuell getätigt werden.
            <a class="button" th:href="@{/intern/accounting/addManual}"> Jetzt Buchen </a>
        </p>

        <p>
        <table id="main-table">
            <tr>
                <th colspan="8">
                    <input type="text" placeholder="Filtern" class="jsFilterTable full-width smaller"
                           data-target-id="main-table">
                </th>
            </tr>
            <tr>
                <th>Zeitpunkt</th>
                <th>Betrag</th>
                <th>Von</th>
                <th>Kontostand</th>
                <th>Nach</th>
                <th>Kontostand</th>
                <th>Grund</th>
                <th>Referenz</th>
            </tr>

            <tr th:each="booking: ${bookings}">
                <td th:text="${booking.datetime}" />
                <td th:text="${booking.amount}" />

                <td th:if="${booking.sourceAddr}"><a th:href="@{${booking.sourceAddr}}" th:text="${booking.source}" /></td>
                <td th:unless="${booking.sourceAddr}" th:text="${booking.source}" />
                <td th:text="${booking.sourceBalance}" />

                <td th:if="${booking.destinationAddr}"><a th:href="@{${booking.destinationAddr}}" th:text="${booking.destination}" /></td>
                <td th:unless="${booking.destinationAddr}" th:text="${booking.destination}" />
                <td th:text="${booking.destinationBalance}" />

                <td th:text="${booking.reason}" />
                <td th:if="${booking.referenceAddr}"><a th:href="@{${booking.referenceAddr}}" th:text="${booking.reference}" /></td>
                <td th:unless="${booking.referenceAddr}" th:text="${booking.reference}" />
            </tr>

        </table>
        <p>
    </div>
</main>
<footer th:replace="fragments/footer :: footer"></footer>
</body>

</html>
