<!DOCTYPE html>
<html lang="ru" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{default}">

<head>
    <title>Панель администратора (заказы)</title>
</head>

<body th:with="bodyClass='bg-white', mainClass='my-0'">
    <main layout:fragment="content">
        <div class="ms-3 mt-3 me-3 w-75" th:object="${order}">
            <div class="mb-3">
                <label for="id" class="form-label">ID</label>
                <input type="text" th:value="*{id}" id="id" class="form-control" readonly disabled>
            </div>
            <div class="mb-3">
                <label for="date" class="form-label">Дата</label>
                <input type="text" th:field="*{date}" id="date" class="form-control">
            </div>
            <div class="mb-3">
                <label for="sum" class="form-label">Сумма</label>
                <input type="text" th:field="*{sum}" id="sum" class="form-control">
            </div>
            <div class="mb-3">
                <label for="count" class="form-label">Количество книг</label>
                <input type="text" th:field="*{count}" id="count" class="form-control">
            </div>
            <p class="mb-3">Товары в заказе</p>
            <th:block th:each="element : *{books}">
                <div class="mb-3 d-flex">
                    <p class="align-self-center w-25 ms-3 me-5">[[${element.book.title}]] — [[${element.book.author}]]</p>
                    <div class='d-flex align-self-center ms-auto me-4'>
                        <p class="align-self-center me-2" style="color: #ABABAB">
                            [[${#numbers.formatDecimal(element.book.price, 0, 'COMMA', 0, 'POINT')}]] &#8381;
                            * [[${element.count}]] = </p>
                        <p th:text="${#numbers.formatDecimal(element.book.price * element.count, 0, 'COMMA', 0, 'POINT') + ' ₽'}" 
                            class="align-self-center fs-4"></p>
                    </div>
                </div>
            </th:block>
        </div>
    </main>
</body>

</html>