<!DOCTYPE html>
<html lang="fr"  th:replace="~{modele-page :: layout('Crédits',~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">

</head>
    <body>
        <div class="container" id="container-main">
            <div class="row mt-5">
                <div class="col-md-8">
                    <form th:action="@{/bank/checkout}" method="post" th:object="${bank}" class="needs-validation" novalidate>
                        <div class="mb-3">
                            <label for="cartAmount" class="form-label" th:text="#{bank.creditNumber}"></label>
                            <input type="number" class="form-control" th:field="*{cartAmount}" id="cartAmount" step="0.01" max="2000000" required/>
                            <div class="is-invalid text-danger" th:if="${#fields.hasErrors('cartAmount')}">
                                <ul>
                                    <li th:each="erreur: ${#fields.errors('cartAmount')}" th:text="${erreur}"></li>
                                </ul>
                            </div>
                        </div>
                        <div class="mb-3">
                            <label for="cartNumber" class="form-label" th:text="#{bank.cardNumber}"></label>
                            <input type="text" class="form-control" th:field="*{cartNumber}" id="cartNumber" pattern="[0-9]{16}" maxlength="16" placeholder="1234 5678 9012 3456" required/>
                            <div class="is-invalid text-danger" th:if="${#fields.hasErrors('cartNumber')}">
                                <ul>
                                    <li th:each="erreur: ${#fields.errors('cartNumber')}" th:text="${erreur}"></li>
                                </ul>
                            </div>
                        </div>
                        <div class="mb-3">
                            <label for="cartExpired" class="form-label" th:text="#{bank.cardExpired}"></label>
                            <input type="text" class="form-control" th:field="*{cartExpired}" id="cartExpired" pattern="(0[1-9]|1[0-2])\/[0-9]{4}" placeholder="MM/YYYY" required/>
                            <div class="is-invalid text-danger" th:if="${#fields.hasErrors('cartExpired')}">
                                <ul>
                                    <li th:each="erreur: ${#fields.errors('cartExpired')}" th:text="${erreur}"></li>
                                </ul>
                            </div>
                        </div>
                        <div class="mb-3">
                            <label for="cartCVV" class="form-label">CVV:</label>
                            <input type="text" class="form-control" th:field="*{cartCVV}" id="cartCVV" pattern="[0-9]{3}" maxlength="3" required/>
                            <div class="is-invalid text-danger" th:if="${#fields.hasErrors('cartCVV')}">
                                <ul>
                                    <li th:each="erreur: ${#fields.errors('cartCVV')}" th:text="${erreur}"></li>
                                </ul>
                            </div>
                        </div>
                        <div class="mb-3">
                            <label for="cartName" class="form-label" th:text="#{bank.cardTitulaire}"></label>
                            <input type="text" class="form-control" th:field="*{cartName}" id="cartName" required/>
                            <div class="is-invalid text-danger" th:if="${#fields.hasErrors('cartName')}">
                                <ul>
                                    <li th:each="erreur: ${#fields.errors('cartName')}" th:text="${erreur}"></li>
                                </ul>
                            </div>
                        </div>
                        <button type="submit" class="btn btn-primary w-100" th:text="#{bank.payer}"></button>
                    </form>
                </div>
                <div class="col-md-4">
                    <img src="/images/paiementSecu.png" class="img-fluid" alt="Paiement sécurisé" />
                </div>
            </div>
        </div>
    </body>
</html>
