<%--suppress JSUnresolvedFunction --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%--suppress ALL --%>
<%--
  Created by IntelliJ IDEA.
  User: Кинетик
  Date: 28.12.2016
  Time: 20:07
  To change this template use File | Settings | File Templates.
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Страница студента</title>
    <style type="text/css">
        <%@include file="../cssforpr.css" %>
        <%@include file="../bootstrap.min.css" %>
    </style>
</head>
<script type="text/javascript" charset="utf-8">
    $("select#groupId").change(function(){
        $.getJSON("/loadStudents",{groupId: $(this).val()}, function(j){
            var options = '';
            for (var i = 0; i < j.length; i++) {
                options += '<option value="' + j[i].stFamily + '">' + j[i].stFamily + '</option>';
            }
            $("select#studentId").html(options);
        });
    });

    $("select#groupId").change(function(){
        $.getJSON("/loadStudents",{groupId: $(this).val()}, function(j){
            var options = '';
            for (var i = 0; i < j.length; i++) {
                options += '<option value="' + j[i].stFamily + '">' + j[i].stFamily + '</option>';
            }
            $("select#studentId").html(options);
        });
    });
</script>

<body>

<div class="inner">
    <h3 class="masthead-brand">Mephorce</h3>
    <nav class="nav nav-masthead">
        <a class="nav-link active" href="/">Войти</a>
        <a class="nav-link" href="/aboutUs">О проекте</a>
        <a class="nav-link" href="/registrate">Создать аккаунт</a>
        <a class="nav-link" href="/contacts">Контакты</a>
    </nav>
</div>

<div class="logo"></div>
<div class="login-block">

    <h1>Вход как Исполнитель</h1>
    <form:form method="post" modelAttribute="studentLogin" action="checkStudent">
        <form:select id="groupId" path="">
            <c:forEach items="${groupList}" var="group">
                <form:option value="${group.groupId}" >${group.groupName}</form:option>
            </c:forEach><br/>
        </form:select>
        <form:select id="studentId" path="name">
            <form:option value="${group.groupId}" >${group.groupName}</form:option>
        </form:select>
        <form:input path="password" type="password" value="" placeholder="Пароль" id="password"/>${passMessage}<br/>
        <form:button>Войти</form:button>
    </form:form>
</div>

<footer class="main-footer">
    <span>&copy;2017 Mephorce</span>
</footer>

</body>
</html>

