<!DOCTYPE html>
<html lang="de" dir="ltr" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>e-commerce</title>
    <link rel="stylesheet" th:href="@{/css/ecom.css}"/>
</head>
<body>
<body>
<main class="modal l">
    <div class="detailflex l">
        <h1>Erfolgreich zugewiesen.</h1>
        <p>
        <table id="main-table">
            <tr>
                <th>Zeitpunkt</th>
                <th>Artikel</th>
                <th>Anzahl</th>
                <th>Von</th>
                <th>Nach</th>
            </tr>

            <!-------------------------------------------------------------->
            <tr>
                <td th:text="${booking.created.toString()}"></td>
                <td th:if="${booking.reason.isManuel}" colspan="4" class="l">
                    Manuell:
                    <pre th:text="${booking.reason.comment}"></pre>
                </td>
                <td th:if="${booking.reason.isStartBooking}" colspan="4" class="l">
                    Startbuchung
                </td>
                <td th:if="${booking.reason.customerOrder != null}" colspan="4" class="l">
                    <a th:href="${'/intern/customerOrders/' + booking.reason.customerOrder.id}">
                        Bestellung: <span th:text="${booking.reason.customerOrder.id}"></span>
                    </a>
                    <pre th:text="${booking.reason.customerOrder.destination.toString()}"></pre>
                </td>
                <td th:if="${booking.reason.supplierOrder != null}" colspan="4" class="l">
                    <a th:href="${'/intern/supplierOrders/#q=' + booking.reason.supplierOrder.id}">
                        Lieferung: <span th:text="${booking.reason.supplierOrder.id}"></span>
                    </a>
                </td>
            </tr>
            <tr th:each="pos : ${booking.positions}">
                <td><img th:src="@{/shop/articles/{id}/image.jpg(id=${pos.article.id})}" class="s"/></td>
                <td><a th:href="@{/intern/articles/{id}(id=${pos.article.id})}"
                       th:text="${pos.article.title}"></a></td>
                <th:block th:if="${pos.amount > 0}">
                    <td th:text="${pos.amount}"></td>
                    <td> -</td>
                    <td><a th:href="${'/intern/warehouse/slots/#q=%23' + pos.slotEntry.slot.slotNum}">Lagerplatz <span
                            th:text="${pos.slotEntry.slot.slotNum}"></span> </a></td>
                </th:block>
                <th:block th:if="${pos.amount < 0}">
                    <td th:text="${pos.amount * -1}"></td>
                    <td><a th:href="${'/intern/warehouse/slots/#q=%23' + pos.slotEntry.slot.slotNum}">Lagerplatz <span
                            th:text="${pos.slotEntry.slot.slotNum}"></span> </a></td>
                    <td> -</td>
                </th:block>
                <th:block th:if="${pos.amount == 0}">
                    <td th:text="${pos.amount}"></td>
                    <td> -</td>
                    <td> -</td>
                </th:block>
            </tr>
        </table>
        </p>
        <form method="post" th:action="@{/intern/warehouse/progress/{id}/finish(id=${booking.id})}">
            <button class="secondary full-width"> Abschließen</button>
        </form>
    </div>
</main>
<footer th:replace="fragments/footer :: footer"></footer>

</body>
</html>
