<!--File that displays a page for registering a new user-->

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Assign a pathway</title>
</head>

<body>
    <h1>Assign a Pathway</h1>
    <form id="assign-form" action="/assign" method="post">
        <label for="pathwayID">Pathway ID:</label>
        <input type="text" id="pathwayID" name="pathwayID" required><br>

        <label for="menteeEmail">Mentee Email:</label>
        <input type="'text" id="menteeEmail" name="menteeEmail" required></textarea><br>

        <label for="step">Starting Step:</label>
        <input type="'text" id="step" name="step" required></textarea><br>

        <input type="submit" value="Assign">
        
        <button onclick="window.location.href='/dashboard'" style="background-color: white; color: black;">Return to Dashboard</button>
        <button type="submit" style="background-color: green; color: white;">Assign Pathway</button>

        <!-- Display error message if present -->
        <div id="message" style="color: red;"></div>
    </form>
    <script src = "/Learnr/public/Pathways.js"></script>
    <script>
        if (performance.navigation.type === 1){
        // This checks for any errors in the URL
            const url = new URL(window.location.href);
            const error = url.searchParams.get("error");
            if (error) {
                document.getElementById("message").innerText = error;
            }
        }
    </script>
</body>

</html>