<!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>Artikelübersicht</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>Bestellungen</h1>

        <script th:src="@{/js/back.js}"></script>
        <div class="back" data-group="intern" data-name="Zurück zu den Kunden Bestellungen." data-insert="false"></div>
    </div>
</div>
<main class="sidebar-layout content-width">
    <nav th:replace="fragments/intern :: sidebar"></nav>
    <div class="content-width">
        <p>
        <table id="main-table">
            <tr>
                <th colspan="6">
                    <input type="text" placeholder="Filtern" class="smaller jsFilterTable full-width"
                           data-target-id="main-table"></input>
                </th>
            </tr>
            <tr>
                <th>Kundennummer</th>
                <th>Bestellnummer</th>
                <th>Bestelldatum</th>
                <th>Betrag</th>
                <th>Status</th>
                <th></th>
            </tr>
            <tr th:each="order: ${orderDeliveryDataMap}">
                <td><a th:href="@{/intern/customers/{id}(id=${order.customerOrder.customer.id})}"
                       th:text="${order.customerOrder.customer.id}">101</a></td>
                <td th:text="${order.customerOrder.id}"></td>
                <td th:text="${order.customerOrder.created.toString().substring(0, 10)}"></td>
                <td th:text="${#numbers.formatDecimal(order.customerOrder.totalGrossCent * 0.01, 1, 'POINT', 2, 'COMMA')}"></td>
                <td th:if="${order.deliveryData.allOk()}"><span th:text="${order.deliveryData.getStatus()}"/></td>
                <td th:if="${order.deliveryData.noTrackingID()}">Bestellung wurde elektronisch angekündigt</td>
                <td th:if="${order.deliveryData.noData()}">DHL-Server ist gerade nicht erreichbar</td>
                <td><a th:href="@{/intern/customerOrders/{id}(id=${order.customerOrder.id})}" class="button smaller">Details</a>
                </td>
            </tr>
        </table>
        </p>
    </div>
</main>
<footer th:replace="fragments/footer :: footer"></footer>
</body>

</html>
