<!DOCTYPE html>
<html lang="fr">
    <head>
        <meta charset="utf-8">
        <title>Math'Educ - Connexion</title>
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
        <link rel="stylesheet" href="../css/global.css">
    </head>
    <body id="bodyStyle">
        <div>
            <a href="/" role="button" class="fs-4 btn btn-secondary btn-lg position-absolute top-0 mt-2 end-0 me-2">
                Retour
            </a>
        </div>
        <div class="container mt-5">
            <div class="row">
                <div class="col-md-4 offset-md-4">
                    <div class="card">
                        <div class="card-body">
                            <h2 class="card-title">Connexion</h2>
                            <form action="/login/verifyPlayer" method="post">
                                <div class="mb-3">
                                    <label for="nickname" class="form-label">Nom d'utilisateur</label>
                                    <input type="text" class="form-control" id="nickname" name="nickname" required>
                                </div>
                                <div class="mb-3">
                                    <label for="password" class="form-label">Mot de passe</label>
                                    <input type="password" class="form-control" id="password" name="password" required>
                                </div>
                                <button type="submit" class="btn btn-primary">Se connecter</button>
                                <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modalPlayers">S'inscrire</button>
                                <p>{{error}}</p>
                            </form>
                        </div>
                    </div>
                </div>

                <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>

                <div class="modal fade" id="modalPlayers">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h5 class="modal-title" id="exampleModalLabel">Créer son compte</h5>
                            </div>
                            <form method="POST" action="/user/players/add">
                                <div class="modal-body">
                                    <div class="form-group">
                                        <label for="nickname">Nom d'utilisateur :</label>
                                        <input type="text" class="form-control" id="nickname" name="nickname">
                                    </div>
                                    <div class="form-group">
                                        <label for="password">Mot de passe :</label>
                                        <input type="password" class="form-control" id="password" name="password">
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
                                    <button type="submit" class="btn btn-primary">Enregistrer</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
