conorH22/bike-rental

View on GitHub
src/main/resources/templates/stations.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Station Overview</title>

    <div th:replace="index.html :: imports"></div>
</head>
<body>
<div th:replace="index.html :: header"></div>

<ul class="list-group" th:each="station : ${stations}">
    <li class="list-group-item">
        <p th:text="${station.stationName + ' (' + (station.getTotalStands() - station.getEmptyStands())+ '/' + station.getTotalStands() + ')'}"></p>
        <ul th:each="stand : ${station.stands}" class="list-group">
            <li class="list-group-item">
                <p th:text=" ${stand.id}"></p>
                <div th:if=" ${stand.isEmpty()}">
                    <p style="color: red;" >Station is empty</p>
                    <form th:action="@{/ReturnBike}" method="post">
                        <input type="hidden" th:value="${stand.id}" name="standId">
                        <div class="form-group">
                            <label for="bikeId">Select Bike:</label>
                            <select class="form-control" id="bikeId" name="bikeId">
                                <div th:each="twoWheel : ${bikesInUse}">
                                    <option th:text=" ${twoWheel.getT().getIdentifier()}"></option>
                                </div>

                            </select>
                        </div>
                        <button type="submit" class="btn btn-default">Put Bike back</button>
                    </form>
                </div>
                 <div th:unless=" ${stand.isEmpty()}">
                     <p style="color: green;" >Station is Occupied</p>
                     <form th:action="@{/RentBike}" method="post">
                         <input type="hidden" th:value="${stand.id}" name="standId">
                         <button type="submit" class="btn btn-default">Rent Bike</button>
                     </form>
                 </div>
            </li>
        </ul>
    </li>
</ul>

</body>
</html>